summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrishna Guha <trishnaguha17@gmail.com>2018-03-08 18:22:43 +0530
committerGitHub <noreply@github.com>2018-03-08 18:22:43 +0530
commit2e145cd1f272a43a370276bb3834765f5c40cf5c (patch)
tree30f82fca1bd4e540f4293be7ba7454cd04cf5f9c
parent934d1df0d141e2c95b50adf0748a3e901cc91148 (diff)
downloadansible-2e145cd1f272a43a370276bb3834765f5c40cf5c.tar.gz
fix nxos_switchport/l2_interface trunk_vlans state absent (#37180) (#37181)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> (cherry picked from commit 02999b77a4f3f1ab1cc528d4f713b21dd0592b82)
-rw-r--r--lib/ansible/modules/network/nxos/_nxos_switchport.py2
-rw-r--r--lib/ansible/modules/network/nxos/nxos_l2_interface.py2
-rw-r--r--test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml2
-rw-r--r--test/integration/targets/nxos_switchport/tests/common/sanity.yaml2
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/ansible/modules/network/nxos/_nxos_switchport.py b/lib/ansible/modules/network/nxos/_nxos_switchport.py
index 3a726b4964..7b6a2aae39 100644
--- a/lib/ansible/modules/network/nxos/_nxos_switchport.py
+++ b/lib/ansible/modules/network/nxos/_nxos_switchport.py
@@ -271,7 +271,7 @@ def remove_switchport_config_commands(interface, existing, proposed, module):
elif mode == 'trunk':
tv_check = existing.get('trunk_vlans_list') == proposed.get('trunk_vlans_list')
- if not tv_check:
+ if tv_check:
existing_vlans = existing.get('trunk_vlans_list')
proposed_vlans = proposed.get('trunk_vlans_list')
vlans_to_remove = set(proposed_vlans).intersection(existing_vlans)
diff --git a/lib/ansible/modules/network/nxos/nxos_l2_interface.py b/lib/ansible/modules/network/nxos/nxos_l2_interface.py
index ae92d1309a..72e3ab26fd 100644
--- a/lib/ansible/modules/network/nxos/nxos_l2_interface.py
+++ b/lib/ansible/modules/network/nxos/nxos_l2_interface.py
@@ -254,7 +254,7 @@ def remove_switchport_config_commands(name, existing, proposed, module):
elif mode == 'trunk':
tv_check = existing.get('trunk_vlans_list') == proposed.get('trunk_vlans_list')
- if not tv_check:
+ if tv_check:
existing_vlans = existing.get('trunk_vlans_list')
proposed_vlans = proposed.get('trunk_vlans_list')
vlans_to_remove = set(proposed_vlans).intersection(existing_vlans)
diff --git a/test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml b/test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml
index cd6fc07e7f..1558ebac7c 100644
--- a/test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml
+++ b/test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml
@@ -95,7 +95,7 @@
nxos_l2_interface: &no_tag
name: "{{ intname }}"
mode: trunk
- trunk_vlans: 30-4094
+ trunk_vlans: 2-50
state: absent
provider: "{{ connection }}"
register: result
diff --git a/test/integration/targets/nxos_switchport/tests/common/sanity.yaml b/test/integration/targets/nxos_switchport/tests/common/sanity.yaml
index db35d3ff3d..20e6e3033b 100644
--- a/test/integration/targets/nxos_switchport/tests/common/sanity.yaml
+++ b/test/integration/targets/nxos_switchport/tests/common/sanity.yaml
@@ -92,7 +92,7 @@
nxos_switchport: &no_tag
interface: "{{ intname }}"
mode: trunk
- trunk_vlans: 30-4094
+ trunk_vlans: 2-50
state: absent
provider: "{{ connection }}"
register: result