diff --git a/test/integration/targets/junos_interface/tests/netconf/basic.yaml b/test/integration/targets/junos_interface/tests/netconf/basic.yaml index b08b6244cdc..d29dda301f0 100644 --- a/test/integration/targets/junos_interface/tests/netconf/basic.yaml +++ b/test/integration/targets/junos_interface/tests/netconf/basic.yaml @@ -79,7 +79,6 @@ - assert: that: - "result.changed == true" - - "'' in config.xml" - "'ge-0/0/1' in config.xml" - name: Configure interface attributes @@ -116,17 +115,10 @@ provider: "{{ netconf }}" register: result -- name: Get running configuration - junos_rpc: - rpc: get-configuration - provider: "{{ netconf }}" - register: config - - assert: that: - "result.changed == true" - - "'' in config.xml" - - "'ge-0/0/1' in config.xml" + - result.diff.prepared | search("\+ *disable") - name: Enable interface junos_interface: @@ -136,17 +128,10 @@ provider: "{{ netconf }}" register: result -- name: Get running configuration - junos_rpc: - rpc: get-configuration - provider: "{{ netconf }}" - register: config - - assert: that: - "result.changed == true" - - "'[edit interfaces ge-0/0/1]\n- disable;' in result.diff.prepared" - - "'ge-0/0/1' in config.xml" + - result.diff.prepared | search("\- *disable") - name: Delete interface junos_interface: diff --git a/test/integration/targets/junos_l3_interface/tests/netconf/basic.yaml b/test/integration/targets/junos_l3_interface/tests/netconf/basic.yaml index f3d31c42fef..a0617ea0845 100644 --- a/test/integration/targets/junos_l3_interface/tests/netconf/basic.yaml +++ b/test/integration/targets/junos_l3_interface/tests/netconf/basic.yaml @@ -29,8 +29,8 @@ - "result.changed == true" - "'1.1.1.1/32' in config.xml" - "'fd5d:12c9:2201:1::1/128' in config.xml" - - "'+ address 1.1.1.1/32;' in result.diff.prepared" - - "'+ address fd5d:12c9:2201:1::1/128;' in result.diff.prepared" + - result.diff.prepared | search("\+ *address 1.1.1.1/32") + - result.diff.prepared | search("\+ *address fd5d:12c9:2201:1::1/128") - name: Configure interface address (idempotent) junos_l3_interface: @@ -65,8 +65,8 @@ that: - "result.changed == true" - "'
' in config.xml" - - "'! inactive: address 1.1.1.1/32' in result.diff.prepared" - - "'! inactive: address fd5d:12c9:2201:1::1/128' in result.diff.prepared" + - result.diff.prepared | search("! *inactive[:] address 1.1.1.1/32") + - result.diff.prepared | search("! *inactive[:] address fd5d:12c9:2201:1::1/128") - name: Activate interface address junos_l3_interface: @@ -78,19 +78,11 @@ provider: "{{ netconf }}" register: result -- name: Get running configuration - junos_rpc: - rpc: get-configuration - provider: "{{ netconf }}" - register: config - - assert: that: - "result.changed == true" - - "'1.1.1.1/32' in config.xml" - - "'fd5d:12c9:2201:1::1/128' in config.xml" - - "'! active: address 1.1.1.1/32' in result.diff.prepared" - - "'! active: address fd5d:12c9:2201:1::1/128' in result.diff.prepared" + - result.diff.prepared | search("! *active[:] address 1.1.1.1/32") + - result.diff.prepared | search("! *active[:] address fd5d:12c9:2201:1::1/128") - name: Delete interface address junos_l3_interface: @@ -101,19 +93,10 @@ provider: "{{ netconf }}" register: result -- name: Get running configuration - junos_rpc: - rpc: get-configuration - provider: "{{ netconf }}" - register: config - - assert: that: - - "result.changed == true" - - "'1.1.1.1/32' not in config.xml" - - "'fd5d:12c9:2201:1::1/128' not in config.xml" - - "'- address 1.1.1.1/32;' in result.diff.prepared" - - "'- address fd5d:12c9:2201:1::1/128;' in result.diff.prepared" + - result.diff.prepared | search("\- *address 1.1.1.1/32") + - result.diff.prepared | search("\- *address fd5d:12c9:2201:1::1/128") - name: Delete interface address (idempotent) junos_l3_interface: diff --git a/test/integration/targets/junos_lldp/tests/netconf/basic.yaml b/test/integration/targets/junos_lldp/tests/netconf/basic.yaml index 1213921b2e3..428d425cb69 100644 --- a/test/integration/targets/junos_lldp/tests/netconf/basic.yaml +++ b/test/integration/targets/junos_lldp/tests/netconf/basic.yaml @@ -38,9 +38,9 @@ - assert: that: - "result.changed == true" - - "'+ advertisement-interval 10;' in result.diff.prepared" - - "'+ transmit-delay 30;' in result.diff.prepared" - - "'+ hold-multiplier 5;' in result.diff.prepared" + - result.diff.prepared | search("\+ *advertisement-interval 10") + - result.diff.prepared | search("\+ *transmit-delay 30") + - result.diff.prepared | search("\+ *hold-multiplier 5") - name: configure lldp parameters and enable lldp(idempotent) junos_lldp: @@ -67,7 +67,7 @@ - assert: that: - "result.changed == true" - - "'+ disable;' in result.diff.prepared" + - result.diff.prepared | search("\+ *disable") - "'advertisement-interval 10;' not in result.diff.prepared" - "'transmit-delay 30;' not in result.diff.prepared" - "'hold-multiplier 5;' not in result.diff.prepared" @@ -84,7 +84,7 @@ - assert: that: - "result.changed == true" - - "'- disable;' in result.diff.prepared" + - result.diff.prepared | search("\- *disable") - "'advertisement-interval 10;' not in result.diff.prepared" - "'transmit-delay 30;' not in result.diff.prepared" - "'hold-multiplier 5;' not in result.diff.prepared" @@ -101,10 +101,10 @@ - assert: that: - "result.changed == true" - - "'+ disable;' in result.diff.prepared" - - "'- advertisement-interval 10;' in result.diff.prepared" - - "'- transmit-delay 30;' in result.diff.prepared" - - "'- hold-multiplier 5;' in result.diff.prepared" + - result.diff.prepared | search("\+ *disable") + - result.diff.prepared | search("\- *advertisement-interval 10") + - result.diff.prepared | search("\- *transmit-delay 30") + - result.diff.prepared | search("\- *hold-multiplier 5") - name: Remove lldp (idempotent) junos_lldp: diff --git a/test/integration/targets/junos_lldp_interface/tests/netconf/basic.yaml b/test/integration/targets/junos_lldp_interface/tests/netconf/basic.yaml index f3ab806dc6b..51c82e53525 100644 --- a/test/integration/targets/junos_lldp_interface/tests/netconf/basic.yaml +++ b/test/integration/targets/junos_lldp_interface/tests/netconf/basic.yaml @@ -17,7 +17,7 @@ - assert: that: - "result.changed == true" - - "'+ interface ge-0/0/5;' in result.diff.prepared" + - result.diff.prepared | search("\+ *interface ge-0/0/5") - name: lldp interface configuration (idempotent) junos_lldp_interface: @@ -41,7 +41,7 @@ - assert: that: - "result.changed == true" - - "'! inactive: interface ge-0/0/5' in result.diff.prepared" + - result.diff.prepared | search("! *inactive[:] interface ge-0/0/5") - name: Activate lldp interface configuration junos_lldp_interface: @@ -54,7 +54,7 @@ - assert: that: - "result.changed == true" - - "'! active: interface ge-0/0/5' in result.diff.prepared" + - result.diff.prepared | search("! *active[:] interface ge-0/0/5") - name: Disable lldp on particular interface junos_lldp_interface: diff --git a/test/integration/targets/junos_user/tests/netconf/basic.yaml b/test/integration/targets/junos_user/tests/netconf/basic.yaml index c1556365b06..0f8280f765d 100644 --- a/test/integration/targets/junos_user/tests/netconf/basic.yaml +++ b/test/integration/targets/junos_user/tests/netconf/basic.yaml @@ -27,7 +27,7 @@ - "result.changed == true" - "'test_user' in config.xml" - "'test_user' in config.xml" - - "'read-only' in config.xml" + - "'operator' in config.xml" - name: Create user again (idempotent) junos_user: @@ -85,7 +85,7 @@ - "result.changed == true" - "'test_user' in config.xml" - "'test_user' in config.xml" - - "'read-only' in config.xml" + - "'operator' in config.xml" - name: Delete user junos_user: diff --git a/test/integration/targets/junos_vrf/tests/netconf/basic.yaml b/test/integration/targets/junos_vrf/tests/netconf/basic.yaml index 32850112fcf..ee57090dbde 100644 --- a/test/integration/targets/junos_vrf/tests/netconf/basic.yaml +++ b/test/integration/targets/junos_vrf/tests/netconf/basic.yaml @@ -23,13 +23,13 @@ - assert: that: - "result.changed == true" - - "'+ test-1' in result.diff.prepared" - - "'+ description test-vrf-1;' in result.diff.prepared" - - "'+ instance-type vrf;' in result.diff.prepared" - - "'+ interface ge-0/0/5.0;' in result.diff.prepared" - - "'+ interface ge-0/0/6.0;' in result.diff.prepared" - - "'+ route-distinguisher 3.3.3.3:10;' in result.diff.prepared" - - "'+ vrf-target target:65513:111;' in result.diff.prepared" + - result.diff.prepared | search("\+ *test-1") + - result.diff.prepared | search("\+ *description test-vrf-1") + - result.diff.prepared | search("\+ *instance-type vrf") + - result.diff.prepared | search("\+ *interface ge-0/0/5.0") + - result.diff.prepared | search("\+ *interface ge-0/0/6.0") + - result.diff.prepared | search("\+ *route-distinguisher 3.3.3.3:10") + - result.diff.prepared | search("\+ *vrf-target target:65513:111") - name: Configure vrf and its parameter (idempotent) junos_vrf: @@ -65,16 +65,15 @@ that: - "result.changed == true" - "'[edit routing-instances test-1]' in result.diff.prepared" - - "'+ interface ge-0/0/2.0;' in result.diff.prepared" - - "'+ interface ge-0/0/3.0;' in result.diff.prepared" - - "'- interface ge-0/0/5.0;' in result.diff.prepared" - - "'- interface ge-0/0/6.0;' in result.diff.prepared" + - result.diff.prepared | search("\+ *interface ge-0/0/2.0") + - result.diff.prepared | search("\+ *interface ge-0/0/3.0") + - result.diff.prepared | search("\- *interface ge-0/0/5.0") + - result.diff.prepared | search("\- *interface ge-0/0/6.0") - "'[edit routing-instances test-1]' in result.diff.prepared" - - "'- route-distinguisher 3.3.3.3:10;' in result.diff.prepared" - - "'+ route-distinguisher 1.1.1.1:10;' in result.diff.prepared" - - "'- vrf-target target:65513:111;' in result.diff.prepared" - - "'+ vrf-target target:65514:113;' in result.diff.prepared" - + - result.diff.prepared | search("\- *route-distinguisher 3.3.3.3:10") + - result.diff.prepared | search("\+ *route-distinguisher 1.1.1.1:10") + - result.diff.prepared | search("\- *vrf-target target:65513:111") + - result.diff.prepared | search("\+ *vrf-target target:65514:113") - name: Deactivate vrf junos_vrf: @@ -94,13 +93,13 @@ that: - "result.changed == true" - "'[edit routing-instances]' in result.diff.prepared" - - "'! inactive: test-1' in result.diff.prepared" + - result.diff.prepared | search("! *inactive[:] test-1") - "'[edit routing-instances test-1]' in result.diff.prepared" - - "'! inactive: interface ge-0/0/2.0' in result.diff.prepared" - - "'! inactive: interface ge-0/0/3.0' in result.diff.prepared" + - result.diff.prepared | search("! *inactive[:] interface ge-0/0/2.0") + - result.diff.prepared | search("! *inactive[:] interface ge-0/0/3.0") - "'[edit routing-instances test-1]' in result.diff.prepared" - - "'! inactive: route-distinguisher' in result.diff.prepared" - - "'! inactive: vrf-target' in result.diff.prepared" + - result.diff.prepared | search("! *inactive[:] route-distinguisher") + - result.diff.prepared | search("! *inactive[:] vrf-target") - name: Activate vrf junos_vrf: @@ -120,13 +119,13 @@ that: - "result.changed == true" - "'[edit routing-instances]' in result.diff.prepared" - - "'! active: test-1' in result.diff.prepared" + - result.diff.prepared | search("! *active[:] test-1") - "'[edit routing-instances test-1]' in result.diff.prepared" - - "'! active: interface ge-0/0/2.0' in result.diff.prepared" - - "'! active: interface ge-0/0/3.0' in result.diff.prepared" + - result.diff.prepared | search("! *active[:] interface ge-0/0/2.0") + - result.diff.prepared | search("! *active[:] interface ge-0/0/3.0") - "'[edit routing-instances test-1]' in result.diff.prepared" - - "'! active: route-distinguisher' in result.diff.prepared" - - "'! active: vrf-target' in result.diff.prepared" + - result.diff.prepared | search("! *active[:] route-distinguisher") + - result.diff.prepared | search("! *active[:] vrf-target") - name: Delete vrf junos_vrf: @@ -144,14 +143,13 @@ - assert: that: - "result.changed == true" - - "'[edit routing-instances]' in result.diff.prepared" - - "'- test-1' in result.diff.prepared" - - "'- description test-vrf-1;' in result.diff.prepared" - - "'- instance-type vrf;' in result.diff.prepared" - - "'- interface ge-0/0/2.0;' in result.diff.prepared" - - "'- interface ge-0/0/3.0;' in result.diff.prepared" - - "'- route-distinguisher 1.1.1.1:10;' in result.diff.prepared" - - "'- vrf-target target:65514:113;' in result.diff.prepared" + - result.diff.prepared | search("\- *test-1") + - result.diff.prepared | search("\- *description test-vrf-1") + - result.diff.prepared | search("\- *instance-type vrf") + - result.diff.prepared | search("\- *interface ge-0/0/2.0") + - result.diff.prepared | search("\- *interface ge-0/0/3.0") + - result.diff.prepared | search("\- *route-distinguisher 1.1.1.1:10") + - result.diff.prepared | search("\- *vrf-target target:65514:113") - name: Delete vrf (idempotent) junos_vrf: