Skip to content

Commit

Permalink
Merge pull request #600 from chidanandpujar/test_playbooks
Browse files Browse the repository at this point in the history
updated test playbooks
  • Loading branch information
dineshbaburam91 authored Nov 15, 2022
2 parents e1a0523 + fb1d768 commit 06f1f54
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/junos_jsnapy/test_junos_storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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%"
Expand Down
8 changes: 8 additions & 0 deletions tests/pb.juniper_junos_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@
# path: out
# state: absent
################
- name: Configure system services.
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'
Expand Down
6 changes: 4 additions & 2 deletions tests/pb.juniper_junos_jsnapy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
64 changes: 59 additions & 5 deletions tests/pb.juniper_junos_rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -97,7 +98,7 @@
- "get-interface-information"
kwargs:
- {}
- "interface_name=em0"
- interface_name: "lo0.0"
register: test5
ignore_errors: True
tags: [ test5 ]
Expand All @@ -122,20 +123,20 @@
- "get-interface-information"
kwargs:
- {}
- "interface_name=em0"
- interface_name: "lo0.0"
dest_dir: "out"
register: test6
ignore_errors: True
tags: [ test6 ]

- 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
Expand Down Expand Up @@ -183,3 +184,56 @@
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 ]

#################
- 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 ]
4 changes: 2 additions & 2 deletions tests/pb.juniper_junos_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/pb.juniper_junos_srx_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/pb.juniper_junos_system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@
that:
- test1.reboot == true
tags: [ test1 ]

- name: Checking NETCONF connectivity
wait_for: host={{ ansible_ssh_host }} port=830 timeout=360

0 comments on commit 06f1f54

Please sign in to comment.