From b3a3490b28160fa6e496f04052ee5a95f06e515d Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 3 Nov 2022 17:14:09 +0530 Subject: [PATCH 1/4] updated test playbooks --- tests/junos_jsnapy/test_junos_storage.yml | 2 +- tests/pb.juniper_junos_config.yml | 8 ++++++++ tests/pb.juniper_junos_jsnapy.yml | 6 ++++-- tests/pb.juniper_junos_software.yml | 4 ++-- tests/pb.juniper_junos_system.yml | 4 ++++ 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/tests/junos_jsnapy/test_junos_storage.yml b/tests/junos_jsnapy/test_junos_storage.yml index 3473c27e..1be2c82b 100644 --- a/tests/junos_jsnapy/test_junos_storage.yml +++ b/tests/junos_jsnapy/test_junos_storage.yml @@ -4,7 +4,7 @@ tests_include: check_storage: - command: show system storage - iterate: - xpath: //system-storage-information/filesystem[normalize-space(mounted-on)='/'] + xpath: //system-storage-information/filesystem[normalize-space(mounted-on)='/.mount'] tests: - is-lt: used-percent, 95 info: "File system {{post['mounted-on']}} use less than 95%" diff --git a/tests/pb.juniper_junos_config.yml b/tests/pb.juniper_junos_config.yml index 4e95dee5..0a85a84c 100644 --- a/tests/pb.juniper_junos_config.yml +++ b/tests/pb.juniper_junos_config.yml @@ -91,6 +91,14 @@ # path: out # state: absent ################ + - name: Append .foo to the hostname using private config mode. + config: + config_mode: 'private' + load: 'merge' + lines: + - "set system services netconf ssh" + comment: "Configured system services" + - name: Retrieve [edit system services] of current committed config. config: retrieve: 'committed' diff --git a/tests/pb.juniper_junos_jsnapy.yml b/tests/pb.juniper_junos_jsnapy.yml index 0bcf749a..08f10004 100644 --- a/tests/pb.juniper_junos_jsnapy.yml +++ b/tests/pb.juniper_junos_jsnapy.yml @@ -138,8 +138,10 @@ ignore_errors: True tags: [ test7 ] - - name: Wait for loopback to come up - pause: seconds=15 + - name: Sleep for 15 seconds for loopback to come up + ansible.builtin.wait_for: + timeout: 15 + delegate_to: localhost - name: "TEST 7 - SNAP_POST with additional loopback" jsnapy: diff --git a/tests/pb.juniper_junos_software.yml b/tests/pb.juniper_junos_software.yml index e1de7691..2f8170ce 100644 --- a/tests/pb.juniper_junos_software.yml +++ b/tests/pb.juniper_junos_software.yml @@ -34,9 +34,9 @@ - name: Check TEST - 1 assert: that: - - test1.failed == "false" + - test1.failed == false handlers: - name: wait_reboot wait_for: host={{ ansible_ssh_host }} port=830 timeout={{ wait_time }} - when: not test.check_mode + when: not test1.check_mode diff --git a/tests/pb.juniper_junos_system.yml b/tests/pb.juniper_junos_system.yml index 94216973..f2428221 100644 --- a/tests/pb.juniper_junos_system.yml +++ b/tests/pb.juniper_junos_system.yml @@ -19,3 +19,7 @@ that: - test1.reboot == true tags: [ test1 ] + + - name: Checking NETCONF connectivity + wait_for: host={{ ansible_ssh_host }} port=830 timeout=360 + From 60547b608d916a7b7272c124350e33829aa3c7d9 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 3 Nov 2022 17:20:30 +0530 Subject: [PATCH 2/4] updated test playbooks --- tests/pb.juniper_junos_config.yml | 2 +- tests/pb.juniper_junos_srx_cluster.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/pb.juniper_junos_config.yml b/tests/pb.juniper_junos_config.yml index 0a85a84c..6baf119f 100644 --- a/tests/pb.juniper_junos_config.yml +++ b/tests/pb.juniper_junos_config.yml @@ -91,7 +91,7 @@ # path: out # state: absent ################ - - name: Append .foo to the hostname using private config mode. + - name: Configure system services. config: config_mode: 'private' load: 'merge' diff --git a/tests/pb.juniper_junos_srx_cluster.yml b/tests/pb.juniper_junos_srx_cluster.yml index 97b1a95a..7cbbcb80 100644 --- a/tests/pb.juniper_junos_srx_cluster.yml +++ b/tests/pb.juniper_junos_srx_cluster.yml @@ -29,6 +29,9 @@ timeout: 300 delegate_to: localhost + - name: Checking NETCONF connectivity + wait_for: host={{ ansible_ssh_host }} port=830 timeout=360 + - name: TEST 2 - Disable an SRX cluster srx_cluster: enable: false From 9375ab69b3396337e04bd5a3c9b682f952822ba2 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 11 Nov 2022 15:56:14 +0530 Subject: [PATCH 3/4] updated test playbooks --- tests/pb.juniper_junos_rpc.yml | 42 ++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/tests/pb.juniper_junos_rpc.yml b/tests/pb.juniper_junos_rpc.yml index 9f108294..06b96227 100644 --- a/tests/pb.juniper_junos_rpc.yml +++ b/tests/pb.juniper_junos_rpc.yml @@ -52,7 +52,8 @@ - name: "Get Device Configuration in text" rpc: rpc: get-interface-information - kwargs: "interface_name=em0" + kwargs: + interface_name: "lo0.0" format: text register: test3 ignore_errors: True @@ -97,7 +98,7 @@ - "get-interface-information" kwargs: - {} - - "interface_name=em0" + - interface_name: "lo0.0" register: test5 ignore_errors: True tags: [ test5 ] @@ -122,7 +123,7 @@ - "get-interface-information" kwargs: - {} - - "interface_name=em0" + - interface_name: "lo0.0" dest_dir: "out" register: test6 ignore_errors: True @@ -130,12 +131,12 @@ - name: Check get-interface-information.xml exists stat: - path: "out/{{ ansible_ssh_host }}_get-interface-information.xml" + path: "out/test_get-interface-information.xml" register: stat_result_1 - name: Check get-software-information.xml exists stat: - path: "out/{{ ansible_ssh_host }}_get-software-information.xml" + path: "out/test_get-software-information.xml" register: stat_result_2 - name: Check TEST 6 @@ -183,3 +184,34 @@ tags: [ test8 ] ################# + - name: "Check configuration for errors" + rpc: + rpcs: + - "open-configuration" + - "load-configuration" + - "close-configuration" + attrs: + - {} + - action: 'set' + format: 'text' + - {} + kwargs: + - private: true + - configuration_set: 'set system syslog file test1 any any' + - {} + register: test9 + tags: [ test9 ] + + - name: Check TEST 9 + debug: + var: test9 + tags: [ test9 ] + + - name: Check TEST 9 + assert: + that: + - test9.results[0].msg == "The RPC executed successfully." + - test9.results[1].msg == "The RPC executed successfully." + - test9.results[2].msg == "The RPC executed successfully." + tags: [ test9 ] + From fb1d7682a74aaae7944c721d9edbe205fe1cfeb6 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 11 Nov 2022 16:18:27 +0530 Subject: [PATCH 4/4] updated test playbooks --- tests/pb.juniper_junos_rpc.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/pb.juniper_junos_rpc.yml b/tests/pb.juniper_junos_rpc.yml index 06b96227..92c5a712 100644 --- a/tests/pb.juniper_junos_rpc.yml +++ b/tests/pb.juniper_junos_rpc.yml @@ -215,3 +215,25 @@ - test9.results[2].msg == "The RPC executed successfully." tags: [ test9 ] +################# + - name: "Check huge xml/text data" + rpc: + rpcs: + - get-support-information + - file-archive + kwargs: + - {} + - destination: "support_info" + source: /var/log/* + compress: True + formats: text + timeout: 1200 + huge_tree: True + register: test10 + tags: [ test10 ] + + - name: Check TEST 10 + assert: + that: + test10.results[0].msg == "The RPC executed successfully." + tags: [ test10 ]