1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

nxos: remove deprecated test target files (#55949)

* nxos_switchport: remove deprecated test target files

* Remove tests for nxos_ip_interface, nxos_portchannel; update nxos_interface

- `nxos_ip_interface` and `nxos_portchannnel` tests have been removed

- `nxos_interface` now uses current module `nxos_l3_interface` instead of `nxos_ip_interface`
This commit is contained in:
Chris Van Heuveln 2019-05-13 01:13:01 -04:00 committed by Trishna Guha
parent 27fcd0fd9e
commit d0f2da4f76
20 changed files with 7 additions and 661 deletions

View file

@ -85,17 +85,13 @@
- assert: *true
- name: Configure Required SVI
nxos_ip_interface: &addips
interface: "{{ item.os_svi_int }}"
addr: "{{ item.ipv4_addr }}"
mask: "{{ item.ipv4_mask }}"
version: "{{ item.ipv4_ver }}"
nxos_l3_interface: &addips
aggregate:
- {name: vlan2, ipv4: 192.168.2.1/24}
- {name: vlan710, ipv4: 192.168.3.1/24}
- {name: vlan711, ipv4: 192.168.4.1/24}
- {name: vlan712, ipv4: 192.168.5.1/24}
provider: "{{ connection }}"
with_items: &vlanips
- {os_svi_int: vlan2, ipv4_addr: 192.168.2.1, ipv4_mask: 24, ipv4_ver: v4}
- {os_svi_int: vlan710, ipv4_addr: 192.168.3.1, ipv4_mask: 24, ipv4_ver: v4}
- {os_svi_int: vlan711, ipv4_addr: 192.168.4.1, ipv4_mask: 24, ipv4_ver: v4}
- {os_svi_int: vlan712, ipv4_addr: 192.168.5.1, ipv4_mask: 24, ipv4_ver: v4}
register: result
- assert: *true
@ -108,8 +104,7 @@
- assert: *false
- name: Configure Required SVI Idempotence Check
nxos_ip_interface: *addips
with_items: *vlanips
nxos_l3_interface: *addips
register: result
- assert: *false

View file

@ -1,2 +0,0 @@
---
testcase: "*"

View file

@ -1,2 +0,0 @@
dependencies:
- prepare_nxos_tests

View file

@ -1,27 +0,0 @@
---
- name: collect common test cases
find:
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
connection: local
register: test_cases
- name: collect cli test cases
find:
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
connection: local
register: cli_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ cli_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli connection={{ cli }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,7 +0,0 @@
---
# Use block to ensure that both cli and nxapi tests
# will run even if there are failures or errors.
- block:
- { include: cli.yaml, tags: ['cli'] }
always:
- { include: nxapi.yaml, tags: ['nxapi'] }

View file

@ -1,33 +0,0 @@
---
- name: collect common test cases
find:
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
connection: local
register: test_cases
- name: collect nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml"
connection: local
register: nxapi_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=httpapi)
include: "{{ test_case_to_run }} ansible_connection=httpapi connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test cases (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,93 +0,0 @@
---
- debug: msg="START TRANSPORT:CLI nxos_ip_interface sanity test"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- set_fact: testint1="{{ nxos_int1 }}"
- set_fact: testint2="{{ nxos_int2 }}"
- name: "Put interface {{testint1}} into default state"
nxos_config: &intdefault1
lines:
- "default interface {{ testint1 }}"
ignore_errors: yes
- name: "Put interface {{testint2}} into default state"
nxos_config: &intdefault2
lines:
- "default interface {{ testint2 }}"
ignore_errors: yes
- name: "Make {{testint1}} a layer3 interface"
nxos_interface: &l3int1
interface: "{{ testint1 }}"
mode: layer3
description: 'Configured by Ansible - Layer3'
admin_state: 'up'
state: present
- name: "Make {{testint2}} a layer3 interface"
nxos_interface: &l3int2
interface: "{{ testint2 }}"
mode: layer3
description: 'Configured by Ansible - Layer3'
admin_state: 'up'
state: present
# For titanium
- name: Clear interface v4
nxos_ip_interface:
interface: "{{ testint1 }}"
version: v4
state: absent
addr: 20.20.20.20
mask: 24
# For titanium
- name: Clear interface v6
nxos_ip_interface:
interface: "{{ testint2 }}"
version: v6
state: absent
addr: 'fd56:31f7:e4ad:5585::1'
mask: 64
- name: Ensure ipv4 address is configured
nxos_ip_interface: &ipv4
interface: "{{ testint1 }}"
version: v4
state: present
addr: 20.20.20.20
mask: 24
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Check Idempotence"
nxos_ip_interface: *ipv4
register: result
- assert: &false
that:
- "result.changed == false"
- name: Ensure ipv6 address is configured
nxos_ip_interface: &ipv6
interface: "{{ testint2 }}"
version: v6
state: present
addr: 'fd56:31f7:e4ad:5585::1'
mask: 64
register: result
- assert: *true
- name: "Check Idempotence"
nxos_ip_interface: *ipv6
register: result
- assert: *false
- debug: msg="END TRANSPORT:CLI nxos_ip_interface sanity test"

View file

@ -1,99 +0,0 @@
---
- debug: msg="START TRANSPORT:NXAPI nxos_ip_interface sanity test"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- set_fact: testint1="{{ nxos_int1 }}"
- set_fact: testint2="{{ nxos_int2 }}"
- name: "Put interface {{testint1}} into default state"
nxos_config: &intdefault1
lines:
- "default interface {{ testint1 }}"
ignore_errors: yes
- name: "Put interface {{testint2}} into default state"
nxos_config: &intdefault2
lines:
- "default interface {{ testint2 }}"
ignore_errors: yes
- name: "Make {{testint1}} a layer3 interface"
nxos_interface: &l3int1
interface: "{{ testint1 }}"
mode: layer3
description: 'Configured by Ansible - Layer3'
admin_state: 'up'
provider: "{{ connection }}"
state: present
- name: "Make {{testint2}} a layer3 interface"
nxos_interface: &l3int2
interface: "{{ testint2 }}"
mode: layer3
description: 'Configured by Ansible - Layer3'
admin_state: 'up'
provider: "{{ connection }}"
state: present
# For titanium
- name: Clear interface v4
nxos_ip_interface:
interface: "{{ testint1 }}"
version: v4
provider: "{{ connection }}"
state: absent
addr: 20.20.20.20
mask: 24
# For titanium
- name: Clear interface v6
nxos_ip_interface:
interface: "{{ testint2 }}"
version: v6
provider: "{{ connection }}"
state: absent
addr: 'fd56:31f7:e4ad:5585::1'
mask: 64
- name: Ensure ipv4 address is configured
nxos_ip_interface: &ipv4
interface: "{{ testint1 }}"
version: v4
provider: "{{ connection }}"
state: present
addr: 20.20.20.20
mask: 24
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Check Idempotence"
nxos_ip_interface: *ipv4
register: result
- assert: &false
that:
- "result.changed == false"
- name: Ensure ipv6 address is configured
nxos_ip_interface: &ipv6
interface: "{{ testint2 }}"
version: v6
provider: "{{ connection }}"
state: present
addr: 'fd56:31f7:e4ad:5585::1'
mask: 64
register: result
- assert: *true
- name: "Check Idempotence"
nxos_ip_interface: *ipv6
register: result
- assert: *false
- debug: msg="END TRANSPORT:NXAPI nxos_ip_interface sanity test"

View file

@ -1,2 +0,0 @@
---
testcase: "*"

View file

@ -1,2 +0,0 @@
dependencies:
- prepare_nxos_tests

View file

@ -1,27 +0,0 @@
---
- name: collect common test cases
find:
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
connection: local
register: test_cases
- name: collect cli test cases
find:
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
connection: local
register: cli_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ cli_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli connection={{ cli }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,3 +0,0 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: nxapi.yaml, tags: ['nxapi'] }

View file

@ -1,33 +0,0 @@
---
- name: collect common test cases
find:
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
connection: local
register: test_cases
- name: collect nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml"
connection: local
register: nxapi_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=httpapi)
include: "{{ test_case_to_run }} ansible_connection=httpapi connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test cases (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,97 +0,0 @@
---
- debug: msg="START connection={{ ansible_connection }} nxos_portchannel sanity test"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- set_fact: testint1="{{ nxos_int1 }}"
- set_fact: testint2="{{ nxos_int2 }}"
- name: "Enable feature LACP"
nxos_feature:
feature: lacp
provider: "{{ connection }}"
state: enabled
ignore_errors: yes
- name: "Put interface {{testint1}} into default state"
nxos_config: &intdefault1
lines:
- "default interface {{ testint1 }}"
provider: "{{ connection }}"
ignore_errors: yes
- name: "Put interface {{testint2}} into default state"
nxos_config: &intdefault2
lines:
- "default interface {{ testint2 }}"
provider: "{{ connection }}"
ignore_errors: yes
- name: Remove possibly configured port-channel 99
nxos_portchannel: &delpc
group: 99
members: ["{{ testint1 }}", "{{ testint2 }}"]
force: 'true'
provider: "{{ connection }}"
state: absent
- block:
- name: Configure port-channel mode active
nxos_portchannel: &configpc
group: 99
members: ["{{ testint1 }}", "{{ testint2 }}"]
mode: active
force: 'true'
provider: "{{ connection }}"
state: present
register: result
- assert: &true
that:
- "result.changed == true"
- name: Check Idempotence
nxos_portchannel: *configpc
register: result
- assert: &false
that:
- "result.changed == false"
- name: Configure port-channel mode passive
nxos_portchannel: &configpcpassive
group: 99
members: ["{{ testint1 }}", "{{ testint2 }}"]
mode: passive
force: 'true'
provider: "{{ connection }}"
state: present
register: result
- assert: *true
- name: Check Idempotence
nxos_portchannel: *configpcpassive
register: result
- assert: *false
- name: Configure port-channel
nxos_portchannel: *delpc
register: result
- assert: *true
rescue:
- name: "Disable feature LACP"
nxos_feature:
feature: lacp
provider: "{{ connection }}"
state: disabled
always:
- name: Delete port-channel
nxos_portchannel: *delpc
register: result
- debug: msg="END connection={{ ansible_connection }} nxos_portchannel sanity test"

View file

@ -1,2 +0,0 @@
---
testcase: "*"

View file

@ -1,2 +0,0 @@
dependencies:
- prepare_nxos_tests

View file

@ -1,27 +0,0 @@
---
- name: collect common test cases
find:
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
connection: local
register: test_cases
- name: collect cli test cases
find:
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
connection: local
register: cli_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ cli_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli connection={{ cli }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,3 +0,0 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: nxapi.yaml, tags: ['nxapi'] }

View file

@ -1,33 +0,0 @@
---
- name: collect common test cases
find:
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
connection: local
register: test_cases
- name: collect nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml"
connection: local
register: nxapi_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=httpapi)
include: "{{ test_case_to_run }} ansible_connection=httpapi connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test cases (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,155 +0,0 @@
---
- debug: msg="START connection={{ ansible_connection }} nxos_switchport sanity test"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
# Select interface for test
- set_fact: intname="{{ nxos_int1 }}"
- name: "Interface selected for this test"
debug: msg="{{ intname }}"
- name: "Setup interface"
nxos_config: &default
lines:
- "default interface {{ intname }}"
ignore_errors: yes
- name: "Setup vlans"
nxos_vlan:
vlan_range: "5-10,20"
- block:
- name: Ensure interface is in L2 state
nxos_interface:
interface: "{{ intname }}"
mode: 'layer2'
- name: Ensure interface is in its default switchport state
nxos_switchport: &def_swi
interface: "{{ intname }}"
provider: "{{ connection }}"
state: unconfigured
- name: Ensure interface is configured for access vlan 20
nxos_switchport: &acc_vl
interface: "{{ intname }}"
mode: access
access_vlan: 20
register: result
- assert: &true
that:
- "result.changed == true"
- name: "access vlan Idempotence"
nxos_switchport: *acc_vl
register: result
- assert: &false
that:
- "result.changed == false"
- name: Ensure interface only has vlans 5-10 as trunk vlans
nxos_switchport: &tr_vl
interface: "{{ intname }}"
mode: trunk
native_vlan: 10
trunk_allowed_vlans: 5-10
register: result
- assert: *true
- name: "trunk vlan Idempotence"
nxos_switchport: *tr_vl
register: result
- assert: *false
- name: Ensure interface is a trunk port and ensure 2-50 are being tagged (doesn't mean others aren't also being tagged)
nxos_switchport: &tag
interface: "{{ intname }}"
mode: trunk
native_vlan: 10
trunk_vlans: 2-50
register: result
- assert: *true
- name: "tag vlan Idempotence"
nxos_switchport: *tag
register: result
- assert: *false
- name: Remove full trunk vlan range 2-50.
nxos_switchport: &no_tag
interface: "{{ intname }}"
mode: trunk
trunk_vlans: 2-50
provider: "{{ connection }}"
state: absent
register: result
- assert: *true
- name: Check Idempotence Remove full trunk vlan range 2-50.
nxos_switchport: *no_tag
register: result
- assert: *false
- name: Reconfigure interface trunk port and ensure 2-50 are being tagged
nxos_switchport: *tag
register: result
- assert: *true
- name: Check Idempotence Reconfigure interface trunk port and ensure 2-50 are being tagged
nxos_switchport: *tag
register: result
- assert: *false
- name: Remove partial trunk vlan range 30-4094 are removed
nxos_switchport: &partial
interface: "{{ intname }}"
mode: trunk
trunk_vlans: 30-4094
provider: "{{ connection }}"
state: absent
register: result
- assert: *true
- name: Check Idempotence Remove partial trunk vlan range 30-4094 are removed
nxos_switchport: *partial
register: result
- assert: *false
- name: put interface default state
nxos_switchport: *def_swi
register: result
- assert: *true
- name: "default state idempotence"
nxos_switchport: *def_swi
register: result
- assert: *false
always:
- name: "remove vlans"
nxos_vlan:
vlan_range: "5-10,20"
provider: "{{ connection }}"
state: absent
ignore_errors: yes
- name: "default interface"
nxos_config: *default
ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_switchport sanity test"