mirror of https://github.com/ansible/ansible.git
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: localpull/34101/merge
parent
f49a782099
commit
56eeaf1b2f
@ -1,79 +1,77 @@
|
||||
---
|
||||
- debug:
|
||||
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
|
||||
iosxr_system: &domain
|
||||
domain_name: eng.ansible.com
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
lines:
|
||||
- no domain name
|
||||
- no domain vrf ansiblevrf name
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
connection: network_cli
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- name: configure domain_name
|
||||
iosxr_system: &domain
|
||||
domain_name: eng.ansible.com
|
||||
provider: "{{ netconf }}"
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- name: verify domain_name
|
||||
iosxr_system: *domain
|
||||
register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- name: verify domain_name
|
||||
iosxr_system: *domain
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- name: configure domain_name
|
||||
iosxr_system: &deldomain
|
||||
domain_name: eng.ansible.com
|
||||
provider: "{{ netconf }}"
|
||||
state: absent
|
||||
register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- name: configure domain_name
|
||||
iosxr_system: &deldomain
|
||||
domain_name: eng.ansible.com
|
||||
provider: "{{ netconf }}"
|
||||
state: absent
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- name: verify domain_name
|
||||
iosxr_system: *deldomain
|
||||
register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- name: verify domain_name
|
||||
iosxr_system: *deldomain
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- name: configure domain_name with vrf
|
||||
iosxr_system: &domainvrf
|
||||
domain_name: eng.ansible.com
|
||||
vrf: ansiblevrf
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- name: configure domain_name with vrf
|
||||
iosxr_system: &domainvrf
|
||||
domain_name: eng.ansible.com
|
||||
vrf: ansiblevrf
|
||||
provider: "{{ netconf }}"
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- name: verify domain_name with vrf
|
||||
iosxr_system: *domainvrf
|
||||
register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- name: verify domain_name with vrf
|
||||
iosxr_system: *domainvrf
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- always:
|
||||
- name: teardown
|
||||
iosxr_config:
|
||||
lines:
|
||||
- no domain name
|
||||
- no domain vrf ansiblevrf name
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- debug:
|
||||
msg: "END netconf/set_domain_name.yaml on connection={{ ansible_connection }}"
|
||||
- debug:
|
||||
msg: "END netconf/set_domain_name.yaml on connection={{ ansible_connection }}"
|
||||
|
@ -1,120 +1,137 @@
|
||||
---
|
||||
- debug:
|
||||
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:
|
||||
that:
|
||||
- result.changed == true
|
||||
- result.xml|length == 1
|
||||
- "'1.1.1.1' in result.xml[0]"
|
||||
- "'2.2.2.2' in result.xml[0]"
|
||||
- "'3.3.3.3' in result.xml[0]"
|
||||
|
||||
- name: verify name_servers
|
||||
iosxr_system:
|
||||
name_servers:
|
||||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
- 3.3.3.3
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
|
||||
- name: add with to vrf
|
||||
iosxr_system: &addvrf
|
||||
vrf: ansible
|
||||
name_servers:
|
||||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
- 3.3.3.3
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- result.xml|length == 1
|
||||
- "'ansible' in result.xml[0]"
|
||||
- "'1.1.1.1' in result.xml[0]"
|
||||
- "'2.2.2.2' in result.xml[0]"
|
||||
- "'3.3.3.3' in result.xml[0]"
|
||||
|
||||
- name: verify change to vrf
|
||||
iosxr_system: *addvrf
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
|
||||
- name: remove one
|
||||
iosxr_system:
|
||||
name_servers:
|
||||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- result.xml|length == 1
|
||||
- "'3.3.3.3' in result.xml[0]"
|
||||
|
||||
## multiple name-servers deletion commands doesn't work in single
|
||||
# config session (only the 1st one takes effect). May or may not be
|
||||
# a VIRL software issue.
|
||||
- always:
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
lines: no domain name-server 1.1.1.1
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
lines: no domain name-server 2.2.2.2
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
lines: no domain name-server 3.3.3.3
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
lines: no domain vrf ansible name-server 1.1.1.1
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: true
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
lines: no domain vrf ansible name-server 2.2.2.2
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: true
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
lines: no domain vrf ansible name-server 3.3.3.3
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: true
|
||||
|
||||
- debug:
|
||||
msg: "END netconf/set_name_servers.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
lines:
|
||||
- no domain name-server 1.1.1.1
|
||||
- no domain name-server 2.2.2.2
|
||||
- no domain name-server 3.3.3.3
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
connection: network_cli
|
||||
|
||||
- name: setup
|
||||
iosxr_system:
|
||||
vrf: ansible
|
||||
name_servers:
|
||||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
- 3.3.3.3
|
||||
provider: "{{ netconf }}"
|
||||
state: absent
|
||||
connection: netconf
|
||||
ignore_errors: True
|
||||
register: result
|
||||
|
||||
- name: configure name_servers
|
||||
iosxr_system:
|
||||
name_servers:
|
||||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
- 3.3.3.3
|
||||
provider: "{{ netconf }}"
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- result.xml|length == 1
|
||||
- "'1.1.1.1' in result.xml[0]"
|
||||
- "'2.2.2.2' in result.xml[0]"
|
||||
- "'3.3.3.3' in result.xml[0]"
|
||||
|
||||
- name: verify name_servers
|
||||
iosxr_system:
|
||||
name_servers:
|
||||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
- 3.3.3.3
|
||||
provider: "{{ netconf }}"
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
|
||||
- name: add name servers with vrf
|
||||
iosxr_system: &addvrf
|
||||
vrf: ansible
|
||||
name_servers:
|
||||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
- 3.3.3.3
|
||||
provider: "{{ netconf }}"
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- result.xml|length == 1
|
||||
- "'ansible' in result.xml[0]"
|
||||
- "'1.1.1.1' in result.xml[0]"
|
||||
- "'2.2.2.2' in result.xml[0]"
|
||||
- "'3.3.3.3' in result.xml[0]"
|
||||
|
||||
- name: verify change to vrf
|
||||
iosxr_system: *addvrf
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
|
||||
- name: remove one
|
||||
iosxr_system:
|
||||
name_servers:
|
||||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
provider: "{{ netconf }}"
|
||||
connection: netconf
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- result.xml|length == 1
|
||||
- "'3.3.3.3' in result.xml[0]"
|
||||
|
||||
- name: remove one with vrf
|
||||
iosxr_system:
|
||||
vrf: ansible
|
||||
name_servers:
|
||||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
provider: "{{ netconf }}"
|
||||
connection: netconf
|
||||
ignore_errors: True
|
||||
register: result
|
||||
|
||||
- name: teardown
|
||||
iosxr_config:
|
||||
lines:
|
||||
- no domain name-server 1.1.1.1
|
||||
- no domain name-server 2.2.2.2
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
connection: network_cli
|
||||
|
||||
- name: teardown
|
||||
iosxr_system:
|
||||
vrf: ansible
|
||||
name_servers:
|
||||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
provider: "{{ netconf }}"
|
||||
state: absent
|
||||
connection: netconf
|
||||
ignore_errors: True
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
msg: "END netconf/set_name_servers.yaml on connection={{ ansible_connection }}"
|
||||
|
Loading…
Reference in New Issue