1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

update junos_command integration tests (#22213)

fixes integration test to check for full rpc-reply string when
converted from xml.  This is a change from 2.2 as the rpc-reply tag
is no longer stripped off
This commit is contained in:
Peter Sprygada 2017-03-02 16:46:23 -06:00 committed by GitHub
parent 3afc993f3a
commit 911600acf9
9 changed files with 26 additions and 24 deletions

View file

@ -229,15 +229,17 @@ def main():
while retries > 0: while retries > 0:
responses = run_commands(module, commands) responses = run_commands(module, commands)
for item in list(conditionals): for index, (resp, cmd) in enumerate(zip(responses, commands)):
if cmd['output'] == 'xml':
for index, (resp, cmd) in enumerate(zip(responses, commands)): if not HAS_JXMLEASE:
if cmd['output'] == 'xml': module.fail_json(msg='jxmlease is required but does not appear to '
if not HAS_JXMLEASE: 'be installed. It can be installed using `pip install jxmlease`')
module.fail_json(msg='jxmlease is required but does not appear to ' try:
'be installed. It can be installed using `pip install jxmlease`')
responses[index] = jxmlease.parse(resp) responses[index] = jxmlease.parse(resp)
except:
raise ValueError(resp)
for item in list(conditionals):
try: try:
if item(responses): if item(responses):
if match == 'any': if match == 'any':

View file

@ -7,7 +7,7 @@
- show version - show version
- show interfaces fxp0 - show interfaces fxp0
wait_for: wait_for:
- "result[1].interface-information[0].physical-interface[0].name[0].data foo fxp0" - "result[1].rpc-reply.interface-information[0].physical-interface[0].name[0].data foo fxp0"
format: xml format: xml
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result

View file

@ -8,8 +8,8 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[0].software-information.host-name contains {{ inventory_hostname_short }}" - "result[0].rpc-reply.software-information.host-name contains {{ inventory_hostname_short }}"
- "result[1].interface-information.physical-interface.name contains fxp0" - "result[1].rpc-reply.interface-information.physical-interface.name contains fxp0"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result

View file

@ -7,8 +7,8 @@
- show version - show version
- show interfaces fxp0 - show interfaces fxp0
wait_for: wait_for:
- "result[0].software-information.host-name == {{ inventory_hostname_short }}" - "result[0].rpc-reply.software-information.host-name == {{ inventory_hostname_short }}"
- "result[1].interface-information.physical-interface.name == fxp0" - "result[1].rpc-reply.interface-information.physical-interface.name == fxp0"
format: xml format: xml
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result
@ -25,8 +25,8 @@
- show version - show version
- show interfaces fxp0 - show interfaces fxp0
wait_for: wait_for:
- "result[0].software-information.host-name eq {{ inventory_hostname_short }}" - "result[0].rpc-reply.software-information.host-name eq {{ inventory_hostname_short }}"
- "result[1].interface-information.physical-interface.name eq fxp0" - "result[1].rpc-reply.interface-information.physical-interface.name eq fxp0"
format: xml format: xml
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result

View file

@ -8,7 +8,7 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[1].interface-information.physical-interface.mtu gt 1500" - "result[1].rpc-reply.interface-information.physical-interface.mtu gt 1500"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result
@ -25,7 +25,7 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[1].interface-information.physical-interface.mtu > 1500" - "result[1].rpc-reply.interface-information.physical-interface.mtu > 1500"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result

View file

@ -8,7 +8,7 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[1].interface-information.physical-interface.mtu ge 1514" - "result[1].rpc-reply.interface-information.physical-interface.mtu ge 1514"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result
@ -25,7 +25,7 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[1].interface-information.physical-interface.mtu >= 1514" - "result[1].rpc-reply.interface-information.physical-interface.mtu >= 1514"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result

View file

@ -8,7 +8,7 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[1].interface-information.physical-interface.mtu lt 9000" - "result[1].rpc-reply.interface-information.physical-interface.mtu lt 9000"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result
@ -25,7 +25,7 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[1].interface-information.physical-interface.mtu lt 9000" - "result[1].rpc-reply.interface-information.physical-interface.mtu lt 9000"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result

View file

@ -8,7 +8,7 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[1].interface-information.physical-interface.mtu le 1514" - "result[1].rpc-reply.interface-information.physical-interface.mtu le 1514"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result
@ -25,7 +25,7 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[1].interface-information.physical-interface.mtu <= 1514" - "result[1].rpc-reply.interface-information.physical-interface.mtu <= 1514"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result

View file

@ -8,7 +8,7 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[0].software-information.host-name neq localhost" - "result[0].rpc-reply.software-information.host-name neq localhost"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result
@ -25,7 +25,7 @@
- show interfaces fxp0 - show interfaces fxp0
format: xml format: xml
wait_for: wait_for:
- "result[0].software-information.host-name != localhost" - "result[0].rpc-reply.software-information.host-name != localhost"
provider: "{{ netconf }}" provider: "{{ netconf }}"
register: result register: result