2017-12-20 06:37:23 +01:00
|
|
|
---
|
|
|
|
- debug: msg="START TRANSPORT:NXAPI nxos_l3_interface sanity test"
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-12-20 06:37:23 +01:00
|
|
|
|
|
|
|
# Select interface for test
|
|
|
|
- set_fact: testint2="{{ nxos_int2 }}"
|
|
|
|
- set_fact: testint3="{{ nxos_int3 }}"
|
|
|
|
|
2018-02-17 05:46:03 +01:00
|
|
|
- set_fact: ipv6_address=""
|
|
|
|
- set_fact: ipv6_address="33:db::2/8"
|
|
|
|
when: ipv6_supported
|
|
|
|
|
2017-12-20 06:37:23 +01:00
|
|
|
- name: Setup - Remove address from interfaces aggregate
|
|
|
|
nxos_l3_interface:
|
|
|
|
aggregate:
|
|
|
|
- { name: "{{ testint2 }}", ipv4: 192.168.22.1/24 }
|
2018-02-17 05:46:03 +01:00
|
|
|
- { name: "{{ testint3 }}", ipv4: 192.168.20.1/24, ipv6: "{{ ipv6_address }}" }
|
2017-12-20 06:37:23 +01:00
|
|
|
provider: "{{ nxapi }}"
|
|
|
|
state: absent
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-04-25 09:15:56 +02:00
|
|
|
- name: Setup - Ensure interfaces are layer3
|
|
|
|
nxos_interface:
|
|
|
|
aggregate:
|
|
|
|
- name: "{{ testint2 }}"
|
|
|
|
- name: "{{ testint3 }}"
|
|
|
|
mode: layer3
|
|
|
|
provider: "{{ nxapi }}"
|
|
|
|
|
2017-12-20 06:37:23 +01:00
|
|
|
- name: Configure ipv4 address to interface
|
|
|
|
nxos_l3_interface: &conf
|
|
|
|
name: "{{ testint2 }}"
|
|
|
|
ipv4: 192.168.22.1/24
|
|
|
|
provider: "{{ nxapi }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Configure ipv4 address to interface(Idempotence)
|
|
|
|
nxos_l3_interface: *conf
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Remove ipv4 address from interface
|
|
|
|
nxos_l3_interface: &rm
|
|
|
|
name: "{{ testint2 }}"
|
|
|
|
ipv4: 192.168.22.1/24
|
|
|
|
provider: "{{ nxapi }}"
|
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Remove ipv4 address from interface(Idempotence)
|
|
|
|
nxos_l3_interface: *rm
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Configure address to interfaces aggregate
|
|
|
|
nxos_l3_interface: &conf_agg
|
|
|
|
aggregate:
|
|
|
|
- { name: "{{ testint2 }}", ipv4: 192.168.22.1/24 }
|
2018-02-17 05:46:03 +01:00
|
|
|
- { name: "{{ testint3 }}", ipv4: 192.168.20.1/24, ipv6: "{{ ipv6_address }}" }
|
2017-12-20 06:37:23 +01:00
|
|
|
provider: "{{ nxapi }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Configure address to interfaces aggregate(Idempotence)
|
|
|
|
nxos_l3_interface: *conf_agg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Remove address from interfaces aggregate
|
|
|
|
nxos_l3_interface: &rm_agg
|
|
|
|
aggregate:
|
|
|
|
- { name: "{{ testint2 }}", ipv4: 192.168.22.1/24 }
|
2018-02-17 05:46:03 +01:00
|
|
|
- { name: "{{ testint3 }}", ipv4: 192.168.20.1/24, ipv6: "{{ ipv6_address }}" }
|
2017-12-20 06:37:23 +01:00
|
|
|
provider: "{{ nxapi }}"
|
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Remove address from interfaces aggregate(Idempotence)
|
|
|
|
nxos_l3_interface: *rm_agg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- debug: msg="END TRANSPORT:NXAPI nxos_l3_interface sanity test"
|