From 85f300e02bcf421a87e148ca5269811fb7991941 Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Fri, 12 Jan 2018 08:46:21 +0530 Subject: [PATCH] Fix junos_netconf integration test failure (#34744) * Fix junos_netconf integration test failure Set ansible_connection to netconf for junos_command module in junos_netconf integration test * Fix review comments --- .../junos_netconf/tests/cli/changeport.yaml | 22 ++++--------------- .../junos_netconf/tests/cli/netconf.yaml | 14 ++---------- .../tests/utils/junos_command.yaml | 6 +++++ 3 files changed, 12 insertions(+), 30 deletions(-) create mode 100644 test/integration/targets/junos_netconf/tests/utils/junos_command.yaml diff --git a/test/integration/targets/junos_netconf/tests/cli/changeport.yaml b/test/integration/targets/junos_netconf/tests/cli/changeport.yaml index 5f65da47781..aee2cae92ba 100644 --- a/test/integration/targets/junos_netconf/tests/cli/changeport.yaml +++ b/test/integration/targets/junos_netconf/tests/cli/changeport.yaml @@ -1,7 +1,6 @@ --- - debug: msg="START netconf/changeport.yaml on connection={{ ansible_connection }}" - - name: Setup junos_netconf: state: present @@ -33,25 +32,16 @@ seconds: 10 - name: Ensure we can communicate over 8022 - junos_command: - rpcs: - - get-software-information - provider: "{{ netconf }}" - port: 8022 - connection: netconf + 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 + # 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 - junos_command: - rpcs: get-software-information - provider: "{{ netconf }}" - register: result - connection: netconf - ignore_errors: true + include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=true" - assert: that: @@ -67,10 +57,6 @@ seconds: 120 - name: Ensure we can communicate over netconf - junos_command: - rpcs: - - get-software-information - provider: "{{ netconf }}" - connection: netconf + 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 2c99163f9ca..95db4deeae6 100644 --- a/test/integration/targets/junos_netconf/tests/cli/netconf.yaml +++ b/test/integration/targets/junos_netconf/tests/cli/netconf.yaml @@ -23,13 +23,9 @@ seconds: 10 - name: Ensure we can communicate over netconf - junos_command: - rpcs: get-software-information - provider: "{{ netconf }}" - connection: 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: state: absent @@ -53,12 +49,7 @@ seconds: 120 - name: Ensure we can NOT talk via netconf - junos_command: - rpcs: get-software-information - provider: "{{ netconf }}" - register: result - connection: netconf - ignore_errors: true + include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=true" - assert: that: @@ -69,5 +60,4 @@ state: present register: result - - debug: msg="END netconf/netconfg.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/junos_netconf/tests/utils/junos_command.yaml b/test/integration/targets/junos_netconf/tests/utils/junos_command.yaml new file mode 100644 index 00000000000..ed6011aee86 --- /dev/null +++ b/test/integration/targets/junos_netconf/tests/utils/junos_command.yaml @@ -0,0 +1,6 @@ +--- +- name: run junos_command to check netconf connectivity + junos_command: + rpcs: get-software-information + register: result + ignore_errors: "{{ is_ignore_errors }}"