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:
parent
3afc993f3a
commit
911600acf9
9 changed files with 26 additions and 24 deletions
|
@ -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)):
|
for index, (resp, cmd) in enumerate(zip(responses, commands)):
|
||||||
if cmd['output'] == 'xml':
|
if cmd['output'] == 'xml':
|
||||||
if not HAS_JXMLEASE:
|
if not HAS_JXMLEASE:
|
||||||
module.fail_json(msg='jxmlease is required but does not appear to '
|
module.fail_json(msg='jxmlease is required but does not appear to '
|
||||||
'be installed. It can be installed using `pip install jxmlease`')
|
'be installed. It can be installed using `pip install jxmlease`')
|
||||||
|
try:
|
||||||
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':
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue