Changes to enable network_cli and netconf on iosxr integration tests. (#35269)

* * Changes to enable network_cli and netconf on modules.
* limits connection local for single TC per playbook.

* * adds a note on why only 1 TC is executed with connection: local
This commit is contained in:
Kedar Kekan 2018-01-24 19:46:27 +05:30 committed by GitHub
commit 56eeaf1b2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 548 additions and 499 deletions

View file

@ -26,6 +26,8 @@
loop_control:
loop_var: test_case_to_run
# Only one of the Testcase would be run to check if `connection: local`
# is established. Full suite is run with `connection:network_cli` or `connection:netconf`
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"

View file

@ -20,14 +20,16 @@
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local"
- name: run test case (connection=netconf)
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
#- name: run test case (connection=netconf)
#include: "{{ test_case_to_run }} ansible_connection=network_cli"
#with_items: "{{ test_items }}"
#loop_control:
# loop_var: test_case_to_run
# Only one of the Testcase would be run to check if `connection: local`
# is established. Full suite is run with `connection:network_cli` or `connection:netconf`
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -6,12 +6,14 @@
state: present
configured_password: pass123
provider: "{{ cli }}"
connection: network_cli
- name: test login
expect:
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version"
responses:
(?i)password: "pass123"
connection: network_cli
- name: test login with invalid password (should fail)
expect:
@ -19,6 +21,7 @@
responses:
(?i)password: "badpass"
ignore_errors: yes
connection: network_cli
register: results
- name: check that attempt failed
@ -32,18 +35,21 @@
state: present
public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public.pub\") }}"
provider: "{{ cli }}"
connection: network_cli
- name: test login with private key
expect:
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version"
responses:
(?i)password: 'pass123'
connection: network_cli
- name: remove user and key
iosxr_user:
name: auth_user
provider: "{{ cli }}"
state: absent
connection: network_cli
- name: test login with private key (should fail, no user)
expect:
@ -51,6 +57,7 @@
responses:
(?i)password: 'pass123'
ignore_errors: yes
connection: network_cli
register: results
- name: create user with private key (path input)
@ -59,6 +66,7 @@
state: present
public_key: "{{ role_path }}/files/public.pub"
provider: "{{ cli }}"
connection: network_cli
- name: test login with private key
expect:
@ -66,6 +74,7 @@
responses:
(?i)password: 'pass123'
ignore_errors: yes
connection: network_cli
- name: change private key for user
iosxr_user:
@ -73,6 +82,7 @@
state: present
public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public2.pub\") }}"
provider: "{{ cli }}"
connection: network_cli
# FIXME: pexpect fails with OSError: [Errno 5] Input/output error
- name: test login with invalid private key (should fail)
@ -81,6 +91,7 @@
responses:
(?i)password: "pass123"
ignore_errors: yes
connection: network_cli
register: results
- name: check that attempt failed
@ -94,4 +105,5 @@
name: auth_user
state: absent
provider: "{{ cli }}"
connection: network_cli
register: result

View file

@ -6,6 +6,7 @@
- no username ansible2
- no username ansible3
provider: "{{ cli }}"
connection: network_cli
- name: Create user (SetUp)
iosxr_user:
@ -13,6 +14,7 @@
configured_password: password
state: present
provider: "{{ netconf }}"
connection: netconf
register: result
- assert:
@ -28,6 +30,7 @@
update_password: always
state: present
provider: "{{ netconf }}"
connection: netconf
register: result
- assert:
@ -43,6 +46,7 @@
update_password: on_create
state: present
provider: "{{ netconf }}"
connection: netconf
register: result
- assert:
@ -58,6 +62,7 @@
group: sysadmin
state: present
provider: "{{ netconf }}"
connection: netconf
register: result
- assert:
@ -74,6 +79,7 @@
group: sysadmin
state: present
provider: "{{ netconf }}"
connection: netconf
register: result
- assert:
@ -90,6 +96,7 @@
state: present
group: sysadmin
provider: "{{ netconf }}"
connection: netconf
register: result
- assert:
@ -111,6 +118,7 @@
state: present
group: sysadmin
provider: "{{ netconf }}"
connection: netconf
register: result
- assert:
@ -130,6 +138,7 @@
state: present
group: sysadmin
provider: "{{ netconf }}"
connection: netconf
register: result
- assert:
@ -145,6 +154,7 @@
- name: ansible3
state: absent
provider: "{{ netconf }}"
connection: netconf
register: result
- assert:
@ -162,6 +172,7 @@
- name: ansible3
state: absent
provider: "{{ netconf }}"
connection: netconf
register: result
- assert: