forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nxos_vtp_password and nxos_vrf_interface for remove idempotency t…
…ests (ansible#27724) * fixes for 27600 27676 * add sanity tests
- Loading branch information
Showing
10 changed files
with
145 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
- { include: cli.yaml, tags: ['cli'] } | ||
- { include: nxapi.yaml, tags: ['nxapi'] } | ||
# 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'] } |
39 changes: 2 additions & 37 deletions
39
test/integration/targets/nxos_vrf_interface/tests/cli/sanity.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,4 @@ | ||
--- | ||
- debug: msg="START TRANSPORT:CLI nxos_vrf_interface sanity test" | ||
- set_fact: connection="{{ cli }}" | ||
|
||
# Select interface for test | ||
- set_fact: intname="{{ nxos_int1 }}" | ||
|
||
- block: | ||
- name: put interface in L3 | ||
nxos_config: | ||
commands: | ||
- no switchport | ||
parents: | ||
- "interface {{ intname }}" | ||
match: none | ||
provider: "{{ cli }}" | ||
|
||
- name: Ensure vrf ntc exists on interface | ||
nxos_vrf_interface: | ||
vrf: ntc | ||
interface: "{{ intname }}" | ||
state: present | ||
provider: "{{ cli }}" | ||
|
||
- name: Ensure ntc VRF does not exist on interface | ||
nxos_vrf_interface: | ||
vrf: ntc | ||
interface: "{{ intname }}" | ||
state: absent | ||
provider: "{{ cli }}" | ||
|
||
always: | ||
- name: put interface in default mode | ||
nxos_config: | ||
lines: "default interface {{ intname }}" | ||
provider: "{{ cli }}" | ||
match: none | ||
ignore_errors: yes | ||
|
||
- debug: msg="END TRANSPORT:CLI nxos_vrf_interface sanity test" | ||
- import_tasks: targets/nxos_vrf_interface/tests/common/sanity.yaml |
61 changes: 61 additions & 0 deletions
61
test/integration/targets/nxos_vrf_interface/tests/common/sanity.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vrf_interface sanity test" | ||
|
||
# Select interface for test | ||
- set_fact: intname="{{ nxos_int1 }}" | ||
|
||
- block: | ||
- name: put interface in L3 | ||
nxos_config: | ||
commands: | ||
- no switchport | ||
parents: | ||
- "interface {{ intname }}" | ||
match: none | ||
provider: "{{ connection }}" | ||
|
||
- name: Ensure vrf ntc exists on interface | ||
nxos_vrf_interface: &configure | ||
vrf: ntc | ||
interface: "{{ intname }}" | ||
state: present | ||
provider: "{{ connection }}" | ||
register: result | ||
|
||
- assert: &true | ||
that: | ||
- "result.changed == true" | ||
|
||
- name: "Conf Idempotence" | ||
nxos_vrf_interface: *configure | ||
register: result | ||
|
||
- assert: &false | ||
that: | ||
- "result.changed == false" | ||
|
||
- name: Ensure ntc VRF does not exist on interface | ||
nxos_vrf_interface: &remove | ||
vrf: ntc | ||
interface: "{{ intname }}" | ||
state: absent | ||
provider: "{{ connection }}" | ||
register: result | ||
|
||
- assert: *true | ||
|
||
- name: "Remove Idempotence" | ||
nxos_vrf_interface: *remove | ||
register: result | ||
|
||
- assert: *false | ||
|
||
always: | ||
- name: put interface in default mode | ||
nxos_config: | ||
lines: "default interface {{ intname }}" | ||
provider: "{{ connection }}" | ||
match: none | ||
ignore_errors: yes | ||
|
||
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vrf_interface sanity test" |
39 changes: 2 additions & 37 deletions
39
test/integration/targets/nxos_vrf_interface/tests/nxapi/sanity.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,4 @@ | ||
--- | ||
- debug: msg="START TRANSPORT:NXAPI nxos_vrf_interface sanity test" | ||
- set_fact: connection="{{ nxapi }}" | ||
|
||
# Select interface for test | ||
- set_fact: intname="{{ nxos_int1 }}" | ||
|
||
- block: | ||
- name: put interface in L3 | ||
nxos_config: | ||
commands: | ||
- no switchport | ||
parents: | ||
- "interface {{ intname }}" | ||
match: none | ||
provider: "{{ nxapi }}" | ||
|
||
- name: Ensure vrf ntc exists on interface | ||
nxos_vrf_interface: | ||
vrf: ntc | ||
interface: "{{ intname }}" | ||
state: present | ||
provider: "{{ nxapi }}" | ||
|
||
- name: Ensure ntc VRF does not exist on interface | ||
nxos_vrf_interface: | ||
vrf: ntc | ||
interface: "{{ intname }}" | ||
state: absent | ||
provider: "{{ nxapi }}" | ||
|
||
always: | ||
- name: put interface in default mode | ||
nxos_config: | ||
lines: "default interface {{ intname }}" | ||
provider: "{{ nxapi }}" | ||
match: none | ||
ignore_errors: yes | ||
|
||
- debug: msg="END TRANSPORT:NXAPI nxos_vrf_interface sanity test" | ||
- import_tasks: targets/nxos_vrf_interface/tests/common/sanity.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
- { include: cli.yaml, tags: ['cli'] } | ||
- { include: nxapi.yaml, tags: ['nxapi'] } | ||
# 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'] } |
30 changes: 2 additions & 28 deletions
30
test/integration/targets/nxos_vtp_password/tests/cli/sanity.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,4 @@ | ||
--- | ||
- debug: msg="START TRANSPORT:CLI nxos_vtp_password sanity test" | ||
- set_fact: connection="{{ cli }}" | ||
|
||
- block: | ||
- name: enable feature vtp | ||
nxos_feature: | ||
feature: vtp | ||
state: enabled | ||
provider: "{{ cli }}" | ||
|
||
- name: configure vtp password | ||
nxos_vtp_password: | ||
password: ntc | ||
state: present | ||
provider: "{{ cli }}" | ||
|
||
- name: remove vtp password | ||
nxos_vtp_password: | ||
password: ntc | ||
state: absent | ||
provider: "{{ cli }}" | ||
|
||
always: | ||
- name: disable feature vtp | ||
nxos_feature: | ||
feature: vtp | ||
state: disabled | ||
provider: "{{ cli }}" | ||
|
||
- debug: msg="END TRANSPORT:CLI nxos_vtp_password sanity test" | ||
- import_tasks: targets/nxos_vtp_password/tests/common/sanity.yaml |
57 changes: 57 additions & 0 deletions
57
test/integration/targets/nxos_vtp_password/tests/common/sanity.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vtp_password sanity test" | ||
|
||
- block: | ||
- name: enable feature vtp | ||
nxos_feature: | ||
feature: vtp | ||
state: enabled | ||
provider: "{{ connection }}" | ||
|
||
- name: configure vtp domain | ||
nxos_vtp_domain: | ||
domain: testing | ||
provider: "{{ connection }}" | ||
|
||
- name: configure vtp password | ||
nxos_vtp_password: &configure | ||
vtp_password: ntc | ||
state: present | ||
provider: "{{ connection }}" | ||
register: result | ||
|
||
- assert: &true | ||
that: | ||
- "result.changed == true" | ||
|
||
- name: "Conf Idempotence" | ||
nxos_vtp_password: *configure | ||
register: result | ||
|
||
- assert: &false | ||
that: | ||
- "result.changed == false" | ||
|
||
- name: remove vtp password | ||
nxos_vtp_password: &remove | ||
vtp_password: ntc | ||
state: absent | ||
provider: "{{ connection }}" | ||
register: result | ||
|
||
- assert: *true | ||
|
||
- name: "Remove Idempotence" | ||
nxos_vtp_password: *remove | ||
register: result | ||
|
||
- assert: *false | ||
|
||
always: | ||
- name: disable feature vtp | ||
nxos_feature: | ||
feature: vtp | ||
state: disabled | ||
provider: "{{ connection }}" | ||
|
||
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vtp_password sanity test" |
30 changes: 2 additions & 28 deletions
30
test/integration/targets/nxos_vtp_password/tests/nxapi/sanity.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,4 @@ | ||
--- | ||
- debug: msg="START TRANSPORT:NXAPI nxos_vtp_password sanity test" | ||
- set_fact: connection="{{ nxapi }}" | ||
|
||
- block: | ||
- name: enable feature vtp | ||
nxos_feature: | ||
feature: vtp | ||
state: enabled | ||
provider: "{{ nxapi }}" | ||
|
||
- name: configure vtp password | ||
nxos_vtp_password: | ||
password: ntc | ||
state: present | ||
provider: "{{ nxapi }}" | ||
|
||
- name: remove vtp password | ||
nxos_vtp_password: | ||
password: ntc | ||
state: absent | ||
provider: "{{ nxapi }}" | ||
|
||
always: | ||
- name: disable feature vtp | ||
nxos_feature: | ||
feature: vtp | ||
state: disabled | ||
provider: "{{ nxapi }}" | ||
|
||
- debug: msg="END TRANSPORT:NXAPI nxos_vtp_password sanity test" | ||
- import_tasks: targets/nxos_vtp_password/tests/common/sanity.yaml |