diff options
author | GomathiselviS <gomathiselvi@gmail.com> | 2020-03-02 20:16:23 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 17:16:23 -0800 |
commit | 18377e639034c3d829cad041f2ca171a11f71cfd (patch) | |
tree | f9a7dbf84a442553799788d9cb6850806f1d9cd0 /test | |
parent | c3dbd69a1b41c134c9a35a31217b7f532b0a206c (diff) | |
download | ansible-18377e639034c3d829cad041f2ca171a11f71cfd.tar.gz |
[2.9] Allow nxos_l2_interfaces to append the allowed vlans list (#67703)
* Added Fix - Allow nxos_l2_interfaces to append the allowed vlans list (#66517)
* Added Integration tests
* Corrected lint errors
* Added fix for bug # 54400
* Revert "Added fix for bug # 54400"
This reverts commit bf42db42697d64abbfea4e546f890637d4a5175b.
* Revert "Adding files for RM static_routes"
This reverts commit dafdd92d4327cfc6dfcebb1e977454b2f77a1daa.
* Revert "Added Integration tests"
This reverts commit 129dc87682bba9292105fc3b642fdf3930ce79fd.
* Bug Fix 65332
* Added testcase for #66517
* Removed unnecessary commit
* fixing conflicts
* fixing conflicts
* addressed mikeweibe's comments
* Corrected lint errors
* Added idempotent tc for add vlans
* Added replaced and overridded tcs for trunk vlan add
(cherry picked from commit 4ac89b8ac7120f553c78eafb294c045f3baa8792)
* backport to PR #66517
Diffstat (limited to 'test')
3 files changed, 48 insertions, 3 deletions
diff --git a/test/integration/targets/nxos_l2_interfaces/tests/cli/merged.yaml b/test/integration/targets/nxos_l2_interfaces/tests/cli/merged.yaml index 72aba5ebda..3e563e5973 100644 --- a/test/integration/targets/nxos_l2_interfaces/tests/cli/merged.yaml +++ b/test/integration/targets/nxos_l2_interfaces/tests/cli/merged.yaml @@ -23,6 +23,8 @@ - name: "{{ test_int1 }}" access: vlan: 6 + trunk: + allowed_vlans: 200 state: merged register: result @@ -32,7 +34,7 @@ - "result.before|length == 0" - "'interface {{ test_int1 }}' in result.commands" - "'switchport access vlan 6' in result.commands" - - "result.commands|length == 2" + - "result.commands|length == 3" - name: Gather l2_interfaces facts nxos_facts: @@ -54,6 +56,43 @@ - "result.changed == false" - "result.commands|length == 0" + - name: Merge with existing vlans + nxos_l2_interfaces: &vlanadd + config: + - name: "{{ test_int1 }}" + trunk: + allowed_vlans: "10-12" + state: merged + register: result + + - assert: + that: + - "result.changed == true" + - "'interface {{ test_int1 }}' in result.commands" + - "'switchport trunk allowed vlan add 10,11,12' in result.commands" + - "result.commands|length == 2" + + - name: Gather l2_interfaces facts + nxos_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: l2_interfaces + + - assert: + that: + - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.after)|length == 0" + + - name: Idempotence - with newly added vlans + nxos_l2_interfaces: *vlanadd + register: result + + - assert: + that: + - "result.changed == false" + - "result.commands|length == 0" + + always: - name: teardown cli_config: *cleanup diff --git a/test/integration/targets/nxos_l2_interfaces/tests/cli/overridden.yaml b/test/integration/targets/nxos_l2_interfaces/tests/cli/overridden.yaml index 63f0d327e7..af8a18ec45 100644 --- a/test/integration/targets/nxos_l2_interfaces/tests/cli/overridden.yaml +++ b/test/integration/targets/nxos_l2_interfaces/tests/cli/overridden.yaml @@ -35,6 +35,8 @@ - name: "{{ test_int2 }}" access: vlan: 6 + trunk: + allowed_vlans: "10-12" state: overridden register: result @@ -46,6 +48,7 @@ - "'no switchport trunk allowed vlan' in result.commands" - "'interface {{ test_int2 }}' in result.commands" - "'switchport access vlan 6' in result.commands" + - "'switchport trunk allowed vlan 10,11,12' in result.commands" - name: Gather l2_interfaces post facts nxos_facts: *facts diff --git a/test/integration/targets/nxos_l2_interfaces/tests/cli/replaced.yaml b/test/integration/targets/nxos_l2_interfaces/tests/cli/replaced.yaml index 0e98182a80..275ce8b6e7 100644 --- a/test/integration/targets/nxos_l2_interfaces/tests/cli/replaced.yaml +++ b/test/integration/targets/nxos_l2_interfaces/tests/cli/replaced.yaml @@ -22,6 +22,7 @@ interface {{ test_int2 }} switchport switchport trunk native vlan 15 + switchport trunk allowed vlan 25-27 - name: Gather l2_interfaces facts nxos_facts: &facts @@ -36,16 +37,18 @@ - name: "{{ test_int1 }}" access: vlan: 8 + trunk: + allowed_vlans: "10-12" state: replaced register: result - assert: that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.before)|length == 0" - "result.changed == true" - "'interface {{ test_int1 }}' in result.commands" - "'switchport access vlan 8' in result.commands" - - "result.commands|length == 2" + - "'switchport trunk allowed vlan 10,11,12' in result.commands" + - "result.commands|length == 3" - name: Gather l2_interfaces post facts nxos_facts: *facts |