Remove pause logic form junos_netconf tests (#57966)
We can switch to wait_for / meta, as using pause can lead to race conditions on slower / faster hardware. Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
ec7b18952b
commit
8dc51dfe1c
2 changed files with 40 additions and 21 deletions
|
@ -4,9 +4,9 @@
|
|||
- name: Setup
|
||||
junos_netconf:
|
||||
state: present
|
||||
register: result
|
||||
|
||||
###################################
|
||||
|
||||
- name: Change port
|
||||
junos_netconf:
|
||||
state: present
|
||||
|
@ -27,17 +27,24 @@
|
|||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: wait for netconf server to come up
|
||||
pause:
|
||||
seconds: 10
|
||||
- name: wait for netconf port tcp/8022 to be open
|
||||
wait_for:
|
||||
host: "{{ hostvars[item].ansible_host }}"
|
||||
port: 8022
|
||||
with_inventory_hostnames: junos
|
||||
|
||||
- name: Reset ansible connections
|
||||
meta: reset_connection
|
||||
|
||||
- name: Ensure we can communicate over 8022
|
||||
include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=8022 is_ignore_errors=false"
|
||||
|
||||
- name: wait for persistent socket to timeout
|
||||
pause:
|
||||
seconds: 120
|
||||
|
||||
- name: wait for netconf port tcp/830 to be closed
|
||||
wait_for:
|
||||
host: "{{ hostvars[item].ansible_host }}"
|
||||
port: 830
|
||||
state: stopped
|
||||
with_inventory_hostnames: junos
|
||||
|
||||
# This protects against the port override above not being honoured and a bug setting the port
|
||||
- name: Ensure we can NOT communicate over default port
|
||||
|
@ -50,11 +57,15 @@
|
|||
- name: Set back netconf to default port
|
||||
junos_netconf:
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- name: wait for persistent socket to timeout
|
||||
pause:
|
||||
seconds: 120
|
||||
- name: wait for netconf port tcp/830 to be open
|
||||
wait_for:
|
||||
host: "{{ hostvars[item].ansible_host }}"
|
||||
port: 830
|
||||
with_inventory_hostnames: junos
|
||||
|
||||
- name: Reset ansible connections
|
||||
meta: reset_connection
|
||||
|
||||
- name: Ensure we can communicate over netconf
|
||||
include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=false"
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
---
|
||||
- debug: msg="START netconf/netconf.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
|
||||
- name: Ensure netconf is enabled
|
||||
junos_netconf:
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- name: idempotent tests
|
||||
junos_netconf:
|
||||
|
@ -18,9 +16,14 @@
|
|||
|
||||
###################################
|
||||
|
||||
- name: wait for netconf server to come up
|
||||
pause:
|
||||
seconds: 10
|
||||
- name: wait for netconf port tcp/830 to be open
|
||||
wait_for:
|
||||
host: "{{ hostvars[item].ansible_host }}"
|
||||
port: 830
|
||||
with_inventory_hostnames: junos
|
||||
|
||||
- name: Reset ansible connections
|
||||
meta: reset_connection
|
||||
|
||||
- name: Ensure we can communicate over netconf
|
||||
include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=false"
|
||||
|
@ -61,9 +64,15 @@
|
|||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: wait for persistent socket to timeout
|
||||
pause:
|
||||
seconds: 120
|
||||
- name: wait for netconf port tcp/830 to be closed
|
||||
wait_for:
|
||||
host: "{{ hostvars[item].ansible_host }}"
|
||||
port: 830
|
||||
state: stopped
|
||||
with_inventory_hostnames: junos
|
||||
|
||||
- name: Reset ansible connections
|
||||
meta: reset_connection
|
||||
|
||||
- name: Ensure we can NOT talk via netconf
|
||||
include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=true"
|
||||
|
@ -96,6 +105,5 @@
|
|||
- name: re-enable netconf
|
||||
junos_netconf:
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- debug: msg="END netconf/netconfg.yaml on connection={{ ansible_connection }}"
|
||||
|
|
Loading…
Reference in a new issue