summaryrefslogtreecommitdiff
path: root/test/integration/targets/junos_netconf
diff options
context:
space:
mode:
authorhexdump0x0200 <43333029+hexdump0x0200@users.noreply.github.com>2019-06-18 16:41:15 +0700
committerGanesh Nalawade <ganesh634@gmail.com>2019-06-18 15:11:15 +0530
commit81f0b70f11ec6b5ebcc56cdf709261662a70ad0b (patch)
treea82939705490fa8ba259dbeed2be9ab72d49f6d5 /test/integration/targets/junos_netconf
parentd24e9ab4bb4800e78c7a4b450c9bc5aeb62dcfd0 (diff)
downloadansible-81f0b70f11ec6b5ebcc56cdf709261662a70ad0b.tar.gz
junos_netconf: fix check mode, fixes #57929 (#57930)
Diffstat (limited to 'test/integration/targets/junos_netconf')
-rw-r--r--test/integration/targets/junos_netconf/tests/cli/changeport.yaml25
-rw-r--r--test/integration/targets/junos_netconf/tests/cli/netconf.yaml38
2 files changed, 63 insertions, 0 deletions
diff --git a/test/integration/targets/junos_netconf/tests/cli/changeport.yaml b/test/integration/targets/junos_netconf/tests/cli/changeport.yaml
index aee2cae92b..a6c42ed190 100644
--- a/test/integration/targets/junos_netconf/tests/cli/changeport.yaml
+++ b/test/integration/targets/junos_netconf/tests/cli/changeport.yaml
@@ -59,4 +59,29 @@
- 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"
+- name: Change port (check mode)
+ junos_netconf:
+ state: present
+ netconf_port: 12345
+ register: result
+ check_mode: true
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: wait for netconf server to come up
+ pause:
+ seconds: 10
+
+- name: Ensure we can NOT communicate over non-default port
+ include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=12345 is_ignore_errors=true"
+
+- assert:
+ that:
+ - "result.failed == true"
+
+- name: Ensure we can communicate over default port
+ include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=false"
+
- debug: msg="END netconf/changeport.yaml on connection={{ ansible_connection }}"
diff --git a/test/integration/targets/junos_netconf/tests/cli/netconf.yaml b/test/integration/targets/junos_netconf/tests/cli/netconf.yaml
index 95db4deeae..9cc69ba356 100644
--- a/test/integration/targets/junos_netconf/tests/cli/netconf.yaml
+++ b/test/integration/targets/junos_netconf/tests/cli/netconf.yaml
@@ -25,6 +25,23 @@
- 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"
+- name: Disable netconf (check mode)
+ junos_netconf:
+ state: absent
+ register: result
+ check_mode: yes
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: wait for persistent socket to timeout
+ pause:
+ seconds: 120
+
+- 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"
+
# Disable netconf
- name: Disable netconf
junos_netconf:
@@ -55,6 +72,27 @@
that:
- "result.failed == true"
+- name: Enable netconf (check mode)
+ junos_netconf:
+ state: present
+ register: result
+ check_mode: yes
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: wait for netconf server to come up
+ pause:
+ seconds: 10
+
+- 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"
+
+- assert:
+ that:
+ - "result.failed == true"
+
- name: re-enable netconf
junos_netconf:
state: present