mirror of https://github.com/ansible/ansible.git
add it cases for vrf_af and vpc_interface (#28889)
parent
31dc5342f3
commit
b574be6616
@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
# 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'] }
|
@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: collect all nxapi test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/nxapi"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: enable nxapi
|
||||
nxos_config:
|
||||
lines:
|
||||
- feature nxapi
|
||||
- nxapi http port 80
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: disable nxapi
|
||||
nxos_config:
|
||||
lines:
|
||||
- no feature nxapi
|
||||
provider: "{{ cli }}"
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
- set_fact: connection="{{ cli }}"
|
||||
|
||||
- import_tasks: targets/nxos_vpc_interface/tests/common/sanity.yaml
|
@ -0,0 +1,102 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vpc_interface sanity test"
|
||||
|
||||
- block:
|
||||
- name: enable feature vpc
|
||||
nxos_feature:
|
||||
feature: vpc
|
||||
state: enabled
|
||||
provider: "{{ connection }}"
|
||||
|
||||
- name: create port-channel
|
||||
nxos_config:
|
||||
commands:
|
||||
- interface port-channel10
|
||||
- switchport
|
||||
match: none
|
||||
provider: "{{ connection }}"
|
||||
|
||||
- name: configure vpc
|
||||
nxos_vpc:
|
||||
state: present
|
||||
domain: 100
|
||||
role_priority: 32667
|
||||
system_priority: 2000
|
||||
pkl_dest: 192.168.100.4
|
||||
pkl_src: 10.1.100.20
|
||||
peer_gw: true
|
||||
auto_recovery: false
|
||||
provider: "{{ connection }}"
|
||||
|
||||
- name: Configure vpc port channel
|
||||
nxos_vpc_interface: &conf
|
||||
portchannel: 10
|
||||
vpc: 100
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Conf Idempotence"
|
||||
nxos_vpc_interface: *conf
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: remove vpc port channel
|
||||
nxos_vpc_interface: &remove
|
||||
portchannel: 10
|
||||
vpc: 100
|
||||
state: absent
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Remove Idempotence"
|
||||
nxos_vpc_interface: *remove
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
always:
|
||||
- name: remove vpc
|
||||
nxos_vpc:
|
||||
state: absent
|
||||
domain: 100
|
||||
role_priority: 32667
|
||||
system_priority: 2000
|
||||
pkl_dest: 192.168.100.4
|
||||
pkl_src: 10.1.100.20
|
||||
peer_gw: true
|
||||
auto_recovery: false
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: remove vpc port channel
|
||||
nxos_vpc_interface:
|
||||
portchannel: 10
|
||||
vpc: 100
|
||||
state: absent
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: remove port channel
|
||||
nxos_config:
|
||||
commands:
|
||||
- no interface port-channel10
|
||||
match: none
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: disable feature vpc
|
||||
nxos_feature:
|
||||
feature: vpc
|
||||
state: disabled
|
||||
provider: "{{ connection }}"
|
||||
|
||||
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vpc_interface sanity test"
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
- set_fact: connection="{{ nxapi }}"
|
||||
|
||||
- import_tasks: targets/nxos_vpc_interface/tests/common/sanity.yaml
|
@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
# 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'] }
|
@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: collect all nxapi test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/nxapi"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: enable nxapi
|
||||
nxos_config:
|
||||
lines:
|
||||
- feature nxapi
|
||||
- nxapi http port 80
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: disable nxapi
|
||||
nxos_config:
|
||||
lines:
|
||||
- no feature nxapi
|
||||
provider: "{{ cli }}"
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
- set_fact: connection="{{ cli }}"
|
||||
|
||||
- import_tasks: targets/nxos_vrf_af/tests/common/sanity.yaml
|
@ -0,0 +1,80 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vrf_af sanity test"
|
||||
|
||||
- name: Configure feature bgp
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: enabled
|
||||
provider: "{{ connection }}"
|
||||
|
||||
- name: Configure feature nv overlay
|
||||
nxos_config:
|
||||
commands: "feature nv overlay"
|
||||
provider: "{{ connection }}"
|
||||
|
||||
- name: Configure nv overlay evpn
|
||||
nxos_config:
|
||||
commands: "nv overlay evpn"
|
||||
provider: "{{ connection }}"
|
||||
|
||||
- block:
|
||||
- name: Configure vrf af
|
||||
nxos_vrf_af: &configure
|
||||
vrf: ansible
|
||||
afi: ipv4
|
||||
route_target_both_auto_evpn: true
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Conf Idempotence"
|
||||
nxos_vrf_af: *configure
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: Remove vrf af
|
||||
nxos_vrf_af: &remove
|
||||
vrf: ansible
|
||||
afi: ipv4
|
||||
route_target_both_auto_evpn: true
|
||||
state: absent
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- pause:
|
||||
seconds: 30
|
||||
|
||||
- name: "Remove Idempotence"
|
||||
nxos_vrf_af: *remove
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
always:
|
||||
- name: Remove feature bgp
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: disabled
|
||||
provider: "{{ connection }}"
|
||||
|
||||
- name: Remove feature nv overlay
|
||||
nxos_config:
|
||||
commands: "no feature nv overlay"
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Remove nv overlay evpn
|
||||
nxos_config:
|
||||
commands: "no nv overlay evpn"
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vrf_af sanity test"
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
- set_fact: connection="{{ nxapi }}"
|
||||
|
||||
- import_tasks: targets/nxos_vrf_af/tests/common/sanity.yaml
|
Loading…
Reference in New Issue