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:
parent
f49a782099
commit
56eeaf1b2f
25 changed files with 548 additions and 499 deletions
|
@ -359,6 +359,8 @@ def get_oper(module, filter=None):
|
||||||
|
|
||||||
if filter is not None:
|
if filter is not None:
|
||||||
response = conn.get(filter)
|
response = conn.get(filter)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
return to_bytes(etree.tostring(response), errors='surrogate_then_replace').strip()
|
return to_bytes(etree.tostring(response), errors='surrogate_then_replace').strip()
|
||||||
|
|
||||||
|
|
|
@ -431,7 +431,7 @@ class NCConfiguration(ConfigBase):
|
||||||
if self._want['name_servers']:
|
if self._want['name_servers']:
|
||||||
server_param = {}
|
server_param = {}
|
||||||
server_param['vrf'] = self._want['vrf']
|
server_param['vrf'] = self._want['vrf']
|
||||||
server_param['order'] = '1'
|
server_param['order'] = '0'
|
||||||
for server in self._want['name_servers']:
|
for server in self._want['name_servers']:
|
||||||
if server in sys_node['name_servers']:
|
if server in sys_node['name_servers']:
|
||||||
server_param['name_servers'] = server
|
server_param['name_servers'] = server
|
||||||
|
@ -476,7 +476,7 @@ class NCConfiguration(ConfigBase):
|
||||||
server_adds, server_removes = diff_list(self._want['name_servers'], sys_node['name_servers'])
|
server_adds, server_removes = diff_list(self._want['name_servers'], sys_node['name_servers'])
|
||||||
server_param = {}
|
server_param = {}
|
||||||
server_param['vrf'] = self._want['vrf']
|
server_param['vrf'] = self._want['vrf']
|
||||||
server_param['order'] = '1'
|
server_param['order'] = '0'
|
||||||
for domain in server_adds:
|
for domain in server_adds:
|
||||||
if domain not in sys_node['name_servers']:
|
if domain not in sys_node['name_servers']:
|
||||||
server_param['name_servers'] = domain
|
server_param['name_servers'] = domain
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
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)
|
- name: run test case (connection=local)
|
||||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||||
with_first_found: "{{ test_items }}"
|
with_first_found: "{{ test_items }}"
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
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)
|
- name: run test case (connection=local)
|
||||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||||
with_first_found: "{{ test_items }}"
|
with_first_found: "{{ test_items }}"
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
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)
|
- name: run test case (connection=local)
|
||||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||||
with_first_found: "{{ test_items }}"
|
with_first_found: "{{ test_items }}"
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
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)
|
- name: run test case (connection=local)
|
||||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||||
with_items: "{{ test_items }}"
|
with_items: "{{ test_items }}"
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
- name: Setup interface
|
- name: Setup interface
|
||||||
iosxr_interface:
|
iosxr_interface:
|
||||||
name: GigabitEthernet0/0/0/1
|
aggregate:
|
||||||
|
- name: GigabitEthernet0/0/0/0
|
||||||
|
- name: GigabitEthernet0/0/0/1
|
||||||
state: absent
|
state: absent
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
register: result
|
||||||
|
|
|
@ -15,8 +15,13 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
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)
|
- name: run test case (connection=local)
|
||||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||||
with_first_found: "{{ test_items }}"
|
with_first_found: "{{ test_items }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
loop_var: test_case_to_run
|
||||||
|
|
||||||
|
- name: reset connection
|
||||||
|
meta: reset_connection
|
||||||
|
|
|
@ -15,8 +15,13 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
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)
|
- name: run test case (connection=local)
|
||||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||||
with_first_found: "{{ test_items }}"
|
with_first_found: "{{ test_items }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
loop_var: test_case_to_run
|
||||||
|
|
||||||
|
- name: reset connection
|
||||||
|
meta: reset_connection
|
||||||
|
|
|
@ -93,6 +93,9 @@
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ result }}"
|
||||||
|
|
||||||
- assert: &true
|
- assert: &true
|
||||||
that:
|
that:
|
||||||
- 'result.changed == true'
|
- 'result.changed == true'
|
||||||
|
|
|
@ -15,8 +15,13 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
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)
|
- name: run test case (connection=local)
|
||||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||||
with_first_found: "{{ test_items }}"
|
with_first_found: "{{ test_items }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
loop_var: test_case_to_run
|
||||||
|
|
||||||
|
- name: reset connection
|
||||||
|
meta: reset_connection
|
||||||
|
|
|
@ -9,14 +9,19 @@
|
||||||
- name: set test_items
|
- name: set test_items
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||||
|
|
||||||
- name: run test case (connection=local)
|
- name: run test case (connection=netconf)
|
||||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
include: "{{ test_case_to_run }}"
|
||||||
with_items: "{{ test_items }}"
|
with_items: "{{ test_items }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
loop_var: test_case_to_run
|
||||||
|
|
||||||
# - name: run test case (connection=netconf)
|
# Only one of the Testcase would be run to check if `connection: local`
|
||||||
# include: "{{ test_case_to_run }} ansible_connection=netconf"
|
# is established. Full suite is run with `connection:network_cli` or `connection:netconf`
|
||||||
# with_items: "{{ test_items }}"
|
- name: run test case (connection=local)
|
||||||
# loop_control:
|
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||||
# loop_var: test_case_to_run
|
with_first_found: "{{ test_items }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: test_case_to_run
|
||||||
|
|
||||||
|
- name: reset connection
|
||||||
|
meta: reset_connection
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
- name: setup
|
- name: setup
|
||||||
iosxr_config:
|
iosxr_config:
|
||||||
lines:
|
lines:
|
||||||
- no ip domain-list ansible.com
|
- no domain list ansible.com
|
||||||
- no ip domain-list redhat.com
|
- no domain list redhat.com
|
||||||
match: none
|
match: none
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@
|
||||||
- "'domain list ansible.com' in result.commands"
|
- "'domain list ansible.com' in result.commands"
|
||||||
- "'domain list redhat.com' in result.commands"
|
- "'domain list redhat.com' in result.commands"
|
||||||
|
|
||||||
- name: setup
|
- name: teardown
|
||||||
iosxr_config:
|
iosxr_config:
|
||||||
lines:
|
lines:
|
||||||
- no ip domain-list ansible.com
|
- no domain list ansible.com
|
||||||
- no ip domain-list redhat.com
|
- no domain list redhat.com
|
||||||
match: none
|
match: none
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
- name: setup
|
- name: setup
|
||||||
iosxr_config:
|
iosxr_config:
|
||||||
lines:
|
lines:
|
||||||
- no ip domain-list ansible.com
|
- no domain list ansible.com
|
||||||
- no ip domain-list redhat.com
|
- no domain list redhat.com
|
||||||
match: none
|
match: none
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
|
@ -114,7 +114,6 @@
|
||||||
iosxr_config:
|
iosxr_config:
|
||||||
lines:
|
lines:
|
||||||
- no domain list ansible.com
|
- no domain list ansible.com
|
||||||
- no domain list redhat.com
|
|
||||||
- no domain list eng.ansible.com
|
- no domain list eng.ansible.com
|
||||||
match: none
|
match: none
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
- name: setup
|
- name: setup
|
||||||
iosxr_config:
|
iosxr_config:
|
||||||
lines:
|
lines: no domain lookup source-interface Loopback10
|
||||||
- no domain lookup source-interface Loopback10
|
|
||||||
# - vrf ansible
|
|
||||||
match: none
|
match: none
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
|
@ -30,36 +28,10 @@
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
#- name: change to vrf
|
|
||||||
# iosxr_system:
|
|
||||||
# lookup_source:
|
|
||||||
# - interface: Loopback10
|
|
||||||
# vrf: ansible
|
|
||||||
# register: result
|
|
||||||
#
|
|
||||||
#- assert:
|
|
||||||
# that:
|
|
||||||
# - result.changed == true
|
|
||||||
# - "'no ip domain lookup source-interface Management1' in result.commands"
|
|
||||||
# - "'ip domain lookup vrf ansible source-interface Management1' in result.commands"
|
|
||||||
# - result.commands|length == 2
|
|
||||||
#
|
|
||||||
#- name: verify change to vrf
|
|
||||||
# iosxr_system:
|
|
||||||
# lookup_source:
|
|
||||||
# - interface: Management1
|
|
||||||
# vrf: ansible
|
|
||||||
# register: result
|
|
||||||
#
|
|
||||||
#- assert:
|
|
||||||
# that:
|
|
||||||
# - result.changed == false
|
|
||||||
|
|
||||||
- name: teardown
|
- name: teardown
|
||||||
iosxr_config:
|
iosxr_config:
|
||||||
lines:
|
lines:
|
||||||
- no domain lookup source-interface Loopback10
|
- no domain lookup source-interface Loopback10
|
||||||
- no vrf ansible
|
|
||||||
match: none
|
match: none
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
|
|
|
@ -40,33 +40,6 @@
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
#- name: change to vrf
|
|
||||||
# iosxr_system:
|
|
||||||
# name_servers:
|
|
||||||
# - 1.1.1.1
|
|
||||||
# - { server: 2.2.2.2, vrf: ansible }
|
|
||||||
# - 3.3.3.3
|
|
||||||
# register: result
|
|
||||||
|
|
||||||
#- assert:
|
|
||||||
# that:
|
|
||||||
# - result.changed == true
|
|
||||||
# - result.commands|length == 2
|
|
||||||
# - "'no ip name-server 2.2.2.2' in result.commands"
|
|
||||||
# - "'ip name-server 2.2.2.2 vrf ansible' in result.commands"
|
|
||||||
|
|
||||||
#- name: verify change to vrf
|
|
||||||
# iosxr_system:
|
|
||||||
# name_servers:
|
|
||||||
# - 1.1.1.1
|
|
||||||
# - { server: 2.2.2.2, vrf: ansible }
|
|
||||||
# - 3.3.3.3
|
|
||||||
# register: result
|
|
||||||
#
|
|
||||||
#- assert:
|
|
||||||
# that:
|
|
||||||
# - result.changed == false
|
|
||||||
|
|
||||||
- name: remove one
|
- name: remove one
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
name_servers:
|
name_servers:
|
||||||
|
@ -86,7 +59,6 @@
|
||||||
lines:
|
lines:
|
||||||
- no ip name-server 1.1.1.1
|
- no ip name-server 1.1.1.1
|
||||||
- no ip name-server 2.2.2.2
|
- no ip name-server 2.2.2.2
|
||||||
- no ip name-server 3.3.3.3
|
|
||||||
match: none
|
match: none
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
|
|
|
@ -2,161 +2,176 @@
|
||||||
- debug:
|
- debug:
|
||||||
msg: "START netconf/set_domain_search.yaml on connection={{ ansible_connection }}"
|
msg: "START netconf/set_domain_search.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
- block:
|
- name: setup
|
||||||
- name: setup
|
iosxr_config:
|
||||||
iosxr_config:
|
lines:
|
||||||
lines:
|
- no domain list ansible.com
|
||||||
- no domain list ansible.com
|
- no domain list redhat.com
|
||||||
- no domain list redhat.com
|
- no domain list eng.ansible.com
|
||||||
match: none
|
- no domain vrf ansiblevrf list redhat.com
|
||||||
provider: "{{ cli }}"
|
- no domain vrf ansiblevrf list ansible.com
|
||||||
|
match: none
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: configure domain_search
|
- name: configure domain_search
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
domain_search:
|
domain_search:
|
||||||
- ansible.com
|
- ansible.com
|
||||||
- redhat.com
|
- redhat.com
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'ansible.com' in result.xml[0]"
|
- "'ansible.com' in result.xml[0]"
|
||||||
- "'redhat.com' in result.xml[0]"
|
- "'redhat.com' in result.xml[0]"
|
||||||
|
|
||||||
- name: configure domain_search with vrf
|
- name: configure domain_search with vrf
|
||||||
iosxr_system: &domainvrf
|
iosxr_system: &domainvrf
|
||||||
vrf: ansiblevrf
|
vrf: ansiblevrf
|
||||||
domain_search:
|
domain_search:
|
||||||
- redhat.com
|
- redhat.com
|
||||||
- ansible.com
|
- ansible.com
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'ansiblevrf' in result.xml[0]"
|
- "'ansiblevrf' in result.xml[0]"
|
||||||
- "'ansible.com' in result.xml[0]"
|
- "'ansible.com' in result.xml[0]"
|
||||||
- "'redhat.com' in result.xml[0]"
|
- "'redhat.com' in result.xml[0]"
|
||||||
|
|
||||||
- name: verify domain_search with vrf
|
- name: verify domain_search with vrf
|
||||||
iosxr_system: *domainvrf
|
iosxr_system: *domainvrf
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- name: delete domain_search with vrf
|
- name: delete domain_search with vrf
|
||||||
iosxr_system: &deldomainvrf
|
iosxr_system: &deldomainvrf
|
||||||
vrf: ansiblevrf
|
vrf: ansiblevrf
|
||||||
domain_search:
|
domain_search:
|
||||||
- redhat.com
|
- redhat.com
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'ansiblevrf' in result.xml[0]"
|
- "'ansiblevrf' in result.xml[0]"
|
||||||
- "'ansible.com' in result.xml[0]"
|
- "'ansible.com' in result.xml[0]"
|
||||||
|
|
||||||
- name: verify delete domain_search with vrf
|
- name: verify delete domain_search with vrf
|
||||||
iosxr_system: *deldomainvrf
|
iosxr_system: *deldomainvrf
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- name: remove one entry
|
- name: remove one entry
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
domain_search:
|
domain_search:
|
||||||
- ansible.com
|
- ansible.com
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'redhat.com' in result.xml[0]"
|
- "'redhat.com' in result.xml[0]"
|
||||||
|
|
||||||
- name: verify remove one entry
|
- name: verify remove one entry
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
domain_search:
|
domain_search:
|
||||||
- ansible.com
|
- ansible.com
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- name: add one entry
|
- name: add one entry
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
domain_search:
|
domain_search:
|
||||||
- ansible.com
|
- ansible.com
|
||||||
- redhat.com
|
- redhat.com
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'redhat.com' in result.xml[0]"
|
- "'redhat.com' in result.xml[0]"
|
||||||
|
|
||||||
- name: verify add one entry
|
- name: verify add one entry
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
domain_search:
|
domain_search:
|
||||||
- ansible.com
|
- ansible.com
|
||||||
- redhat.com
|
- redhat.com
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- name: add and remove one entry
|
- name: add and remove one entry
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
domain_search:
|
domain_search:
|
||||||
- ansible.com
|
- ansible.com
|
||||||
- eng.ansible.com
|
- eng.ansible.com
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'redhat.com' in result.xml[1]"
|
- "'redhat.com' in result.xml[1]"
|
||||||
- "'eng.ansible.com' in result.xml[0]"
|
- "'eng.ansible.com' in result.xml[0]"
|
||||||
- result.xml|length == 2
|
- result.xml|length == 2
|
||||||
|
|
||||||
- name: verify add and remove one entry
|
- name: verify add and remove one entry
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
domain_search:
|
domain_search:
|
||||||
- ansible.com
|
- ansible.com
|
||||||
- eng.ansible.com
|
- eng.ansible.com
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- always:
|
- name: teardown
|
||||||
- name: teardown
|
iosxr_config:
|
||||||
iosxr_config:
|
lines:
|
||||||
lines:
|
- no domain list ansible.com
|
||||||
- no domain list ansible.com
|
- no domain list redhat.com
|
||||||
- no domain list redhat.com
|
- no domain list eng.ansible.com
|
||||||
- no domain list eng.ansible.com
|
- no domain vrf ansiblevrf list redhat.com
|
||||||
- no domain vrf ansiblevrf list redhat.com
|
- no domain vrf ansiblevrf list ansible.com
|
||||||
- no domain vrf ansiblevrf list ansible.com
|
- no domain vrf ansiblevrf list eng.ansible.com
|
||||||
match: none
|
match: none
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: "END netconf/set_domain_search.yaml on connection={{ ansible_connection }}"
|
msg: "END netconf/set_domain_search.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
|
@ -1,79 +1,77 @@
|
||||||
---
|
---
|
||||||
- debug:
|
- debug:
|
||||||
msg: "START netconf/set_domain_name.yaml on connection={{ ansible_connection }}"
|
msg: "START netconf/set_domain_name.yaml on connection={{ ansible_connection }}"
|
||||||
- block:
|
|
||||||
- name: setup
|
|
||||||
iosxr_config:
|
|
||||||
lines:
|
|
||||||
- no domain name
|
|
||||||
- no domain vrf ansiblevrf name
|
|
||||||
match: none
|
|
||||||
provider: "{{ cli }}"
|
|
||||||
|
|
||||||
- name: configure domain_name
|
- name: setup
|
||||||
iosxr_system: &domain
|
iosxr_config:
|
||||||
domain_name: eng.ansible.com
|
lines:
|
||||||
provider: "{{ netconf }}"
|
- no domain name
|
||||||
register: result
|
- no domain vrf ansiblevrf name
|
||||||
|
match: none
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- assert:
|
- name: configure domain_name
|
||||||
that:
|
iosxr_system: &domain
|
||||||
- "result.changed == true"
|
domain_name: eng.ansible.com
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: verify domain_name
|
- assert:
|
||||||
iosxr_system: *domain
|
that:
|
||||||
register: result
|
- "result.changed == true"
|
||||||
|
|
||||||
- assert:
|
- name: verify domain_name
|
||||||
that:
|
iosxr_system: *domain
|
||||||
- "result.changed == false"
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: configure domain_name
|
- assert:
|
||||||
iosxr_system: &deldomain
|
that:
|
||||||
domain_name: eng.ansible.com
|
- "result.changed == false"
|
||||||
provider: "{{ netconf }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
- name: configure domain_name
|
||||||
that:
|
iosxr_system: &deldomain
|
||||||
- "result.changed == true"
|
domain_name: eng.ansible.com
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
state: absent
|
||||||
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: verify domain_name
|
- assert:
|
||||||
iosxr_system: *deldomain
|
that:
|
||||||
register: result
|
- "result.changed == true"
|
||||||
|
|
||||||
- assert:
|
- name: verify domain_name
|
||||||
that:
|
iosxr_system: *deldomain
|
||||||
- "result.changed == false"
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: configure domain_name with vrf
|
- assert:
|
||||||
iosxr_system: &domainvrf
|
that:
|
||||||
domain_name: eng.ansible.com
|
- "result.changed == false"
|
||||||
vrf: ansiblevrf
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
- name: configure domain_name with vrf
|
||||||
that:
|
iosxr_system: &domainvrf
|
||||||
- "result.changed == true"
|
domain_name: eng.ansible.com
|
||||||
|
vrf: ansiblevrf
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: verify domain_name with vrf
|
- assert:
|
||||||
iosxr_system: *domainvrf
|
that:
|
||||||
register: result
|
- "result.changed == true"
|
||||||
|
|
||||||
- assert:
|
- name: verify domain_name with vrf
|
||||||
that:
|
iosxr_system: *domainvrf
|
||||||
- "result.changed == false"
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- always:
|
- assert:
|
||||||
- name: teardown
|
that:
|
||||||
iosxr_config:
|
- "result.changed == false"
|
||||||
lines:
|
|
||||||
- no domain name
|
|
||||||
- no domain vrf ansiblevrf name
|
|
||||||
match: none
|
|
||||||
provider: "{{ cli }}"
|
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: "END netconf/set_domain_name.yaml on connection={{ ansible_connection }}"
|
msg: "END netconf/set_domain_name.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
|
@ -8,11 +8,13 @@
|
||||||
lines: hostname switch
|
lines: hostname switch
|
||||||
match: none
|
match: none
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: configure hostname
|
- name: configure hostname
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
hostname: foo
|
hostname: foo
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -23,6 +25,7 @@
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
hostname: foo
|
hostname: foo
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -34,6 +37,7 @@
|
||||||
lines: "hostname {{ inventory_hostname }}"
|
lines: "hostname {{ inventory_hostname }}"
|
||||||
match: none
|
match: none
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: "END netconf/set_hostname.yaml on connection={{ ansible_connection }}"
|
msg: "END netconf/set_hostname.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
|
@ -2,149 +2,159 @@
|
||||||
- debug:
|
- debug:
|
||||||
msg: "START netconf/set_lookup_source.yaml on connection={{ ansible_connection }}"
|
msg: "START netconf/set_lookup_source.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
- block:
|
- name: setup
|
||||||
- name: setup
|
iosxr_config:
|
||||||
iosxr_config:
|
lines:
|
||||||
lines:
|
- no domain lookup source-interface Loopback10
|
||||||
- no domain lookup source-interface Loopback10
|
- no domain vrf ansiblevrf lookup source-interface Loopback10
|
||||||
- no domain vrf ansiblevrf lookup source-interface Loopback10
|
- no domain lookup disable
|
||||||
- no domain lookup disable
|
- no domain vrf ansiblevrf lookup disable
|
||||||
- no domain vrf ansiblevrf lookup disable
|
match: none
|
||||||
match: none
|
provider: "{{ cli }}"
|
||||||
provider: "{{ cli }}"
|
connection: network_cli
|
||||||
|
|
||||||
- name: configure lookup_source
|
- name: configure lookup_source
|
||||||
iosxr_system: &lookup
|
iosxr_system: &lookup
|
||||||
lookup_source: Loopback10
|
lookup_source: Loopback10
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'Loopback10' in result.xml[0]"
|
- "'Loopback10' in result.xml[0]"
|
||||||
|
|
||||||
- name: verify lookup_source
|
- name: verify lookup_source
|
||||||
iosxr_system: *lookup
|
iosxr_system: *lookup
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- name: disable lookup
|
- name: disable lookup
|
||||||
iosxr_system: &disable
|
iosxr_system: &disable
|
||||||
lookup_enabled: False
|
lookup_enabled: False
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'lookup' in result.xml[0]"
|
- "'lookup' in result.xml[0]"
|
||||||
|
|
||||||
- name: verify disable lookup
|
- name: verify disable lookup
|
||||||
iosxr_system: *disable
|
iosxr_system: *disable
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- name: delete lookup_source
|
- name: delete lookup_source
|
||||||
iosxr_system: &dellookup
|
iosxr_system: &dellookup
|
||||||
lookup_source: Loopback10
|
lookup_source: Loopback10
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'Loopback10' in result.xml[0]"
|
- "'Loopback10' in result.xml[0]"
|
||||||
|
|
||||||
- name: verify lookup_source
|
- name: verify lookup_source
|
||||||
iosxr_system: *dellookup
|
iosxr_system: *dellookup
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- name: configure lookup_source with vrf
|
- name: configure lookup_source with vrf
|
||||||
iosxr_system: &lookupvrf
|
iosxr_system: &lookupvrf
|
||||||
lookup_source: Loopback10
|
lookup_source: Loopback10
|
||||||
vrf: ansiblevrf
|
vrf: ansiblevrf
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'Loopback10' in result.xml[0]"
|
- "'Loopback10' in result.xml[0]"
|
||||||
- "'ansiblevrf' in result.xml[0]"
|
- "'ansiblevrf' in result.xml[0]"
|
||||||
|
|
||||||
- name: verify lookup_source
|
- name: verify lookup_source
|
||||||
iosxr_system: *lookupvrf
|
iosxr_system: *lookupvrf
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- name: disable lookup
|
- name: disable lookup
|
||||||
iosxr_system: &disablevrf
|
iosxr_system: &disablevrf
|
||||||
lookup_enabled: False
|
lookup_enabled: False
|
||||||
vrf: ansiblevrf
|
vrf: ansiblevrf
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'lookup' in result.xml[0]"
|
- "'lookup' in result.xml[0]"
|
||||||
- "'ansiblevrf' in result.xml[0]"
|
- "'ansiblevrf' in result.xml[0]"
|
||||||
|
|
||||||
- name: verify disable lookup
|
- name: verify disable lookup
|
||||||
iosxr_system: *disablevrf
|
iosxr_system: *disablevrf
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- name: delete lookup_source
|
- name: delete lookup_source
|
||||||
iosxr_system: &dellookupvrf
|
iosxr_system: &dellookupvrf
|
||||||
lookup_source: Loopback10
|
lookup_source: Loopback10
|
||||||
vrf: ansiblevrf
|
vrf: ansiblevrf
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "'Loopback10' in result.xml[0]"
|
- "'Loopback10' in result.xml[0]"
|
||||||
- "'ansiblevrf' in result.xml[0]"
|
- "'ansiblevrf' in result.xml[0]"
|
||||||
|
|
||||||
- name: verify lookup_source
|
- name: verify lookup_source
|
||||||
iosxr_system: *dellookupvrf
|
iosxr_system: *dellookupvrf
|
||||||
register: result
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
|
|
||||||
- always:
|
- name: teardown
|
||||||
- name: teardown
|
iosxr_config:
|
||||||
iosxr_config:
|
lines:
|
||||||
lines:
|
- no domain lookup disable
|
||||||
- no domain lookup source-interface Loopback10
|
- no domain vrf ansiblevrf lookup disable
|
||||||
- no domain vrf ansiblevrf lookup source-interface Loopback10
|
match: none
|
||||||
- no domain lookup disable
|
provider: "{{ cli }}"
|
||||||
- no domain vrf ansiblevrf lookup disable
|
connection: network_cli
|
||||||
match: none
|
|
||||||
provider: "{{ cli }}"
|
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: "END netconf/set_lookup_source.yaml on connection={{ ansible_connection }}"
|
msg: "END netconf/set_lookup_source.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
|
@ -1,120 +1,137 @@
|
||||||
---
|
---
|
||||||
- debug:
|
- debug:
|
||||||
msg: "START netconf/set_name_servers.yaml on connection={{ ansible_connection }}"
|
msg: "START netconf/set_name_servers.yaml on connection={{ ansible_connection }}"
|
||||||
- block:
|
|
||||||
- name: configure name_servers
|
|
||||||
iosxr_system:
|
|
||||||
name_servers:
|
|
||||||
- 1.1.1.1
|
|
||||||
- 2.2.2.2
|
|
||||||
- 3.3.3.3
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
- name: setup
|
||||||
that:
|
iosxr_config:
|
||||||
- result.changed == true
|
lines:
|
||||||
- result.xml|length == 1
|
- no domain name-server 1.1.1.1
|
||||||
- "'1.1.1.1' in result.xml[0]"
|
- no domain name-server 2.2.2.2
|
||||||
- "'2.2.2.2' in result.xml[0]"
|
- no domain name-server 3.3.3.3
|
||||||
- "'3.3.3.3' in result.xml[0]"
|
match: none
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: verify name_servers
|
- name: setup
|
||||||
iosxr_system:
|
iosxr_system:
|
||||||
name_servers:
|
vrf: ansible
|
||||||
- 1.1.1.1
|
name_servers:
|
||||||
- 2.2.2.2
|
- 1.1.1.1
|
||||||
- 3.3.3.3
|
- 2.2.2.2
|
||||||
provider: "{{ netconf }}"
|
- 3.3.3.3
|
||||||
register: result
|
provider: "{{ netconf }}"
|
||||||
|
state: absent
|
||||||
|
connection: netconf
|
||||||
|
ignore_errors: True
|
||||||
|
register: result
|
||||||
|
|
||||||
- assert:
|
- name: configure name_servers
|
||||||
that:
|
iosxr_system:
|
||||||
- result.changed == false
|
name_servers:
|
||||||
|
- 1.1.1.1
|
||||||
|
- 2.2.2.2
|
||||||
|
- 3.3.3.3
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: add with to vrf
|
- assert:
|
||||||
iosxr_system: &addvrf
|
that:
|
||||||
vrf: ansible
|
- result.changed == true
|
||||||
name_servers:
|
- result.xml|length == 1
|
||||||
- 1.1.1.1
|
- "'1.1.1.1' in result.xml[0]"
|
||||||
- 2.2.2.2
|
- "'2.2.2.2' in result.xml[0]"
|
||||||
- 3.3.3.3
|
- "'3.3.3.3' in result.xml[0]"
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
- name: verify name_servers
|
||||||
that:
|
iosxr_system:
|
||||||
- result.changed == true
|
name_servers:
|
||||||
- result.xml|length == 1
|
- 1.1.1.1
|
||||||
- "'ansible' in result.xml[0]"
|
- 2.2.2.2
|
||||||
- "'1.1.1.1' in result.xml[0]"
|
- 3.3.3.3
|
||||||
- "'2.2.2.2' in result.xml[0]"
|
provider: "{{ netconf }}"
|
||||||
- "'3.3.3.3' in result.xml[0]"
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: verify change to vrf
|
- assert:
|
||||||
iosxr_system: *addvrf
|
that:
|
||||||
register: result
|
- result.changed == false
|
||||||
|
|
||||||
- assert:
|
- name: add name servers with vrf
|
||||||
that:
|
iosxr_system: &addvrf
|
||||||
- result.changed == false
|
vrf: ansible
|
||||||
|
name_servers:
|
||||||
|
- 1.1.1.1
|
||||||
|
- 2.2.2.2
|
||||||
|
- 3.3.3.3
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: remove one
|
- assert:
|
||||||
iosxr_system:
|
that:
|
||||||
name_servers:
|
- result.changed == true
|
||||||
- 1.1.1.1
|
- result.xml|length == 1
|
||||||
- 2.2.2.2
|
- "'ansible' in result.xml[0]"
|
||||||
provider: "{{ netconf }}"
|
- "'1.1.1.1' in result.xml[0]"
|
||||||
register: result
|
- "'2.2.2.2' in result.xml[0]"
|
||||||
|
- "'3.3.3.3' in result.xml[0]"
|
||||||
|
|
||||||
- assert:
|
- name: verify change to vrf
|
||||||
that:
|
iosxr_system: *addvrf
|
||||||
- result.changed == true
|
connection: netconf
|
||||||
- result.xml|length == 1
|
register: result
|
||||||
- "'3.3.3.3' in result.xml[0]"
|
|
||||||
|
|
||||||
## multiple name-servers deletion commands doesn't work in single
|
- assert:
|
||||||
# config session (only the 1st one takes effect). May or may not be
|
that:
|
||||||
# a VIRL software issue.
|
- result.changed == false
|
||||||
- always:
|
|
||||||
- name: setup
|
|
||||||
iosxr_config:
|
|
||||||
lines: no domain name-server 1.1.1.1
|
|
||||||
match: none
|
|
||||||
provider: "{{ cli }}"
|
|
||||||
|
|
||||||
- name: setup
|
- name: remove one
|
||||||
iosxr_config:
|
iosxr_system:
|
||||||
lines: no domain name-server 2.2.2.2
|
name_servers:
|
||||||
match: none
|
- 1.1.1.1
|
||||||
provider: "{{ cli }}"
|
- 2.2.2.2
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: setup
|
- assert:
|
||||||
iosxr_config:
|
that:
|
||||||
lines: no domain name-server 3.3.3.3
|
- result.changed == true
|
||||||
match: none
|
- result.xml|length == 1
|
||||||
provider: "{{ cli }}"
|
- "'3.3.3.3' in result.xml[0]"
|
||||||
|
|
||||||
- name: setup
|
- name: remove one with vrf
|
||||||
iosxr_config:
|
iosxr_system:
|
||||||
lines: no domain vrf ansible name-server 1.1.1.1
|
vrf: ansible
|
||||||
match: none
|
name_servers:
|
||||||
provider: "{{ cli }}"
|
- 1.1.1.1
|
||||||
ignore_errors: true
|
- 2.2.2.2
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
|
ignore_errors: True
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: setup
|
- name: teardown
|
||||||
iosxr_config:
|
iosxr_config:
|
||||||
lines: no domain vrf ansible name-server 2.2.2.2
|
lines:
|
||||||
match: none
|
- no domain name-server 1.1.1.1
|
||||||
provider: "{{ cli }}"
|
- no domain name-server 2.2.2.2
|
||||||
ignore_errors: true
|
match: none
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: setup
|
- name: teardown
|
||||||
iosxr_config:
|
iosxr_system:
|
||||||
lines: no domain vrf ansible name-server 3.3.3.3
|
vrf: ansible
|
||||||
match: none
|
name_servers:
|
||||||
provider: "{{ cli }}"
|
- 1.1.1.1
|
||||||
ignore_errors: true
|
- 2.2.2.2
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
state: absent
|
||||||
|
connection: netconf
|
||||||
|
ignore_errors: True
|
||||||
|
register: result
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: "END netconf/set_name_servers.yaml on connection={{ ansible_connection }}"
|
msg: "END netconf/set_name_servers.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
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)
|
- name: run test case (connection=local)
|
||||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||||
with_first_found: "{{ test_items }}"
|
with_first_found: "{{ test_items }}"
|
||||||
|
|
|
@ -20,14 +20,16 @@
|
||||||
- name: set test_items
|
- name: set test_items
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||||
|
|
||||||
- name: run test case (connection=local)
|
- name: run test case (connection=netconf)
|
||||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
include: "{{ test_case_to_run }}"
|
||||||
with_items: "{{ test_items }}"
|
with_items: "{{ test_items }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_case_to_run
|
loop_var: test_case_to_run
|
||||||
|
|
||||||
#- name: run test case (connection=netconf)
|
# Only one of the Testcase would be run to check if `connection: local`
|
||||||
#include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
# is established. Full suite is run with `connection:network_cli` or `connection:netconf`
|
||||||
#with_items: "{{ test_items }}"
|
- name: run test case (connection=local)
|
||||||
#loop_control:
|
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||||
# loop_var: test_case_to_run
|
with_first_found: "{{ test_items }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: test_case_to_run
|
||||||
|
|
|
@ -6,12 +6,14 @@
|
||||||
state: present
|
state: present
|
||||||
configured_password: pass123
|
configured_password: pass123
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: test login
|
- name: test login
|
||||||
expect:
|
expect:
|
||||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version"
|
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version"
|
||||||
responses:
|
responses:
|
||||||
(?i)password: "pass123"
|
(?i)password: "pass123"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: test login with invalid password (should fail)
|
- name: test login with invalid password (should fail)
|
||||||
expect:
|
expect:
|
||||||
|
@ -19,6 +21,7 @@
|
||||||
responses:
|
responses:
|
||||||
(?i)password: "badpass"
|
(?i)password: "badpass"
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
connection: network_cli
|
||||||
register: results
|
register: results
|
||||||
|
|
||||||
- name: check that attempt failed
|
- name: check that attempt failed
|
||||||
|
@ -32,18 +35,21 @@
|
||||||
state: present
|
state: present
|
||||||
public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public.pub\") }}"
|
public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public.pub\") }}"
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: test login with private key
|
- name: test login with private key
|
||||||
expect:
|
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"
|
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:
|
responses:
|
||||||
(?i)password: 'pass123'
|
(?i)password: 'pass123'
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: remove user and key
|
- name: remove user and key
|
||||||
iosxr_user:
|
iosxr_user:
|
||||||
name: auth_user
|
name: auth_user
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: test login with private key (should fail, no user)
|
- name: test login with private key (should fail, no user)
|
||||||
expect:
|
expect:
|
||||||
|
@ -51,6 +57,7 @@
|
||||||
responses:
|
responses:
|
||||||
(?i)password: 'pass123'
|
(?i)password: 'pass123'
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
connection: network_cli
|
||||||
register: results
|
register: results
|
||||||
|
|
||||||
- name: create user with private key (path input)
|
- name: create user with private key (path input)
|
||||||
|
@ -59,6 +66,7 @@
|
||||||
state: present
|
state: present
|
||||||
public_key: "{{ role_path }}/files/public.pub"
|
public_key: "{{ role_path }}/files/public.pub"
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: test login with private key
|
- name: test login with private key
|
||||||
expect:
|
expect:
|
||||||
|
@ -66,6 +74,7 @@
|
||||||
responses:
|
responses:
|
||||||
(?i)password: 'pass123'
|
(?i)password: 'pass123'
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: change private key for user
|
- name: change private key for user
|
||||||
iosxr_user:
|
iosxr_user:
|
||||||
|
@ -73,6 +82,7 @@
|
||||||
state: present
|
state: present
|
||||||
public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public2.pub\") }}"
|
public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public2.pub\") }}"
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
# FIXME: pexpect fails with OSError: [Errno 5] Input/output error
|
# FIXME: pexpect fails with OSError: [Errno 5] Input/output error
|
||||||
- name: test login with invalid private key (should fail)
|
- name: test login with invalid private key (should fail)
|
||||||
|
@ -81,6 +91,7 @@
|
||||||
responses:
|
responses:
|
||||||
(?i)password: "pass123"
|
(?i)password: "pass123"
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
connection: network_cli
|
||||||
register: results
|
register: results
|
||||||
|
|
||||||
- name: check that attempt failed
|
- name: check that attempt failed
|
||||||
|
@ -94,4 +105,5 @@
|
||||||
name: auth_user
|
name: auth_user
|
||||||
state: absent
|
state: absent
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
register: result
|
register: result
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
- no username ansible2
|
- no username ansible2
|
||||||
- no username ansible3
|
- no username ansible3
|
||||||
provider: "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
connection: network_cli
|
||||||
|
|
||||||
- name: Create user (SetUp)
|
- name: Create user (SetUp)
|
||||||
iosxr_user:
|
iosxr_user:
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
configured_password: password
|
configured_password: password
|
||||||
state: present
|
state: present
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -28,6 +30,7 @@
|
||||||
update_password: always
|
update_password: always
|
||||||
state: present
|
state: present
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -43,6 +46,7 @@
|
||||||
update_password: on_create
|
update_password: on_create
|
||||||
state: present
|
state: present
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -58,6 +62,7 @@
|
||||||
group: sysadmin
|
group: sysadmin
|
||||||
state: present
|
state: present
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -74,6 +79,7 @@
|
||||||
group: sysadmin
|
group: sysadmin
|
||||||
state: present
|
state: present
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -90,6 +96,7 @@
|
||||||
state: present
|
state: present
|
||||||
group: sysadmin
|
group: sysadmin
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -111,6 +118,7 @@
|
||||||
state: present
|
state: present
|
||||||
group: sysadmin
|
group: sysadmin
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -130,6 +138,7 @@
|
||||||
state: present
|
state: present
|
||||||
group: sysadmin
|
group: sysadmin
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -145,6 +154,7 @@
|
||||||
- name: ansible3
|
- name: ansible3
|
||||||
state: absent
|
state: absent
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -162,6 +172,7 @@
|
||||||
- name: ansible3
|
- name: ansible3
|
||||||
state: absent
|
state: absent
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
|
connection: netconf
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
|
Loading…
Reference in a new issue