diff --git a/changelogs/fragments/fix_purge_and_overridden_operations.yaml b/changelogs/fragments/fix_purge_and_overridden_operations.yaml
new file mode 100644
index 000000000..3bd498f6f
--- /dev/null
+++ b/changelogs/fragments/fix_purge_and_overridden_operations.yaml
@@ -0,0 +1,6 @@
+---
+bugfixes:
+ - Fix purged state operation to enable users to completely remove VLAN configurations.
+ - Fix overridden state operations to ensure excluded VLANs in the provided configuration are removed, thus overriding the VLAN configuration.
+ - Improve documentation to provide clarity on the "shutdown" variable.
+ - Improve unit tests to align with the changes made.
diff --git a/docs/cisco.ios.ios_vlans_module.rst b/docs/cisco.ios.ios_vlans_module.rst
index 78fa5ec97..1ed4c1d23 100644
--- a/docs/cisco.ios.ios_vlans_module.rst
+++ b/docs/cisco.ios.ios_vlans_module.rst
@@ -229,7 +229,10 @@ Parameters
- Shutdown VLAN switching.
+ Specifies whether VLAN switching should be administratively enabled or disabled.
+ When set to enabled , the VLAN interface is administratively shut down, which prevents it from forwarding traffic.
+ When set to disabled , the VLAN interface is administratively enabled by issuing the internal no shutdown command, allowing it to forward traffic.
+ The operational state of the VLAN depends on both the administrative state (shutdown or no shutdown ) and the physical link status.
|
@@ -448,100 +451,330 @@ Examples
# Before state:
# -------------
#
- # vios_l2#show vlan
+ # S1#show vlan
+
# VLAN Name Status Ports
# ---- -------------------------------- --------- -------------------------------
- # 1 default active Gi0/1, Gi0/2
- # 10 vlan_10 active
- # 20 vlan_20 act/lshut
- # 30 vlan_30 sus/lshut
+ # 1 default active Gi0/0, Gi0/1, Gi0/2, Gi0/3
+ # 10 Vlan_10 active
+ # 20 Vlan_20 active
+ # 30 Vlan_30 suspended
+ # 44 Vlan_44 suspended
# 1002 fddi-default act/unsup
# 1003 token-ring-default act/unsup
# 1004 fddinet-default act/unsup
# 1005 trnet-default act/unsup
- #
+
# VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
# ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
# 1 enet 100001 1500 - - - - - 0 0
# 10 enet 100010 1500 - - - - - 0 0
# 20 enet 100020 610 - - - - - 0 0
# 30 enet 100030 1500 - - - - - 0 0
+ # 44 enet 100044 1500 - - - - - 0 0
# 1002 fddi 101002 1500 - - - - - 0 0
# 1003 tr 101003 1500 - - - - - 0 0
# 1004 fdnet 101004 1500 - - - ieee - 0 0
# 1005 trnet 101005 1500 - - - ibm - 0 0
- #
+
# Remote SPAN VLANs
# ------------------------------------------------------------------------------
- # 10
+
+
+ # Primary Secondary Type Ports
+ # ------- --------- ----------------- ------------------------------------------
+ # S1#
+
- name: Override device configuration of all VLANs with provided configuration
cisco.ios.ios_vlans:
config:
- - name: Vlan_10
- vlan_id: 10
- mtu: 1000
+ - name: Vlan_2020
+ state: active
+ vlan_id: 20
+ shutdown: disabled
state: overridden
+ # Task output:
+ # ------------
+
+ # after:
+ # - mtu: 1500
+ # name: default
+ # shutdown: disabled
+ # state: active
+ # vlan_id: 1
+ # - mtu: 1500
+ # name: Vlan_2020
+ # shutdown: disabled
+ # state: active
+ # vlan_id: 20
+ # - mtu: 1500
+ # name: fddi-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1002
+ # - mtu: 1500
+ # name: token-ring-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1003
+ # - mtu: 1500
+ # name: fddinet-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1004
+ # - mtu: 1500
+ # name: trnet-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1005
+
+ # before:
+ # - mtu: 1500
+ # name: default
+ # shutdown: disabled
+ # state: active
+ # vlan_id: 1
+ # - mtu: 1500
+ # name: Vlan_10
+ # shutdown: disabled
+ # state: active
+ # vlan_id: 10
+ # - mtu: 610
+ # name: Vlan_20
+ # shutdown: disabled
+ # state: active
+ # vlan_id: 20
+ # - mtu: 1500
+ # name: Vlan_30
+ # shutdown: disabled
+ # state: suspend
+ # vlan_id: 30
+ # - mtu: 1500
+ # name: Vlan_44
+ # shutdown: disabled
+ # state: suspend
+ # vlan_id: 44
+ # - mtu: 1500
+ # name: fddi-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1002
+ # - mtu: 1500
+ # name: token-ring-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1003
+ # - mtu: 1500
+ # name: fddinet-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1004
+ # - mtu: 1500
+ # name: trnet-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1005
+
+ # commands:
+ # - no vlan 1
+ # - no vlan 10
+ # - no vlan 30
+ # - no vlan 44
+ # - no vlan 1002
+ # - no vlan 1003
+ # - no vlan 1004
+ # - no vlan 1005
+ # - vlan 20
+ # - name Vlan_2020
+ # - no mtu 610
+ # - no vlan configuration 1
+ # - no vlan configuration 10
+ # - no vlan configuration 30
+ # - no vlan configuration 44
+ # - no vlan configuration 1002
+ # - no vlan configuration 1003
+ # - no vlan configuration 1004
+ # - no vlan configuration 1005
+
# After state:
# ------------
#
# vios_l2#show vlan
# VLAN Name Status Ports
# ---- -------------------------------- --------- -------------------------------
- # 1 default active Gi0/1, Gi0/2
- # 10 Vlan_10 active
+ # 1 default active Gi0/0, Gi0/1, Gi0/2, Gi0/3
+ # 20 Vlan_2020 active
# 1002 fddi-default act/unsup
# 1003 token-ring-default act/unsup
# 1004 fddinet-default act/unsup
# 1005 trnet-default act/unsup
- #
+
# VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
# ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
# 1 enet 100001 1500 - - - - - 0 0
- # 10 enet 100010 1000 - - - - - 0 0
+ # 20 enet 100020 1500 - - - - - 0 0
# 1002 fddi 101002 1500 - - - - - 0 0
# 1003 tr 101003 1500 - - - - - 0 0
# 1004 fdnet 101004 1500 - - - ieee - 0 0
# 1005 trnet 101005 1500 - - - ibm - 0 0
+ # Remote SPAN VLANs
+ # ------------------------------------------------------------------------------
- # Using overridden
+
+ # Primary Secondary Type Ports
+ # ------- --------- ----------------- ------------------------------------------
+
+ # Using purged
# Before state:
# -------------
#
- # Leaf-01#show run nve | sec ^vlan configuration
- # vlan configuration 101
- # member evpn-instance 101 vni 10101
- # vlan configuration 102
- # member evpn-instance 102 vni 10102
- # vlan configuration 201
- # member evpn-instance 201 vni 10201
- # vlan configuration 901
- # member vni 50901
+ # S1#show vlan
- - name: Override device configuration of all VLANs with provided configuration
+ # VLAN Name Status Ports
+ # ---- -------------------------------- --------- -------------------------------
+ # 1 default active Gi0/0, Gi0/1, Gi0/2, Gi0/3
+ # 20 Vlan_2020 active
+ # 1002 fddi-default act/unsup
+ # 1003 token-ring-default act/unsup
+ # 1004 fddinet-default act/unsup
+ # 1005 trnet-default act/unsup
+
+ # VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
+ # ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
+ # 1 enet 100001 1500 - - - - - 0 0
+ # 20 enet 100020 1500 - - - - - 0 0
+ # 1002 fddi 101002 1500 - - - - - 0 0
+ # 1003 tr 101003 1500 - - - - - 0 0
+ # 1004 fdnet 101004 1500 - - - ieee - 0 0
+ # 1005 trnet 101005 1500 - - - ibm - 0 0
+
+ # Remote SPAN VLANs
+ # ------------------------------------------------------------------------------
+
+
+ # Primary Secondary Type Ports
+ # ------- --------- ----------------- ------------------------------------------
+
+ # S1#show running-config | section ^vlan configuration .+
+ # vlan configuration 20
+
+
+ - name: Purge all vlans configuration
cisco.ios.ios_vlans:
config:
- - vlan_id: 101
- member:
- vni: 10102
- evi: 102
- - vlan_id: 102
- member:
- vni: 10101
- evi: 101
- state: overridden
+ state: purged
+
+ # Task output:
+ # ------------
+
+ # after:
+ # - mtu: 1500
+ # name: default
+ # shutdown: disabled
+ # state: active
+ # vlan_id: 1
+ # - mtu: 1500
+ # name: fddi-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1002
+ # - mtu: 1500
+ # name: token-ring-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1003
+ # - mtu: 1500
+ # name: fddinet-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1004
+ # - mtu: 1500
+ # name: trnet-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1005
+
+ # before:
+ # - mtu: 1500
+ # name: default
+ # shutdown: disabled
+ # state: active
+ # vlan_id: 1
+ # - mtu: 1500
+ # name: Vlan_2020
+ # shutdown: disabled
+ # state: active
+ # vlan_id: 20
+ # - mtu: 1500
+ # name: fddi-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1002
+ # - mtu: 1500
+ # name: token-ring-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1003
+ # - mtu: 1500
+ # name: fddinet-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1004
+ # - mtu: 1500
+ # name: trnet-default
+ # shutdown: enabled
+ # state: active
+ # vlan_id: 1005
+
+ # commands:
+ # - no vlan 1
+ # - no vlan 20
+ # - no vlan 1002
+ # - no vlan 1003
+ # - no vlan 1004
+ # - no vlan 1005
+ # - no vlan configuration 1
+ # - no vlan configuration 20
+ # - no vlan configuration 1002
+ # - no vlan configuration 1003
+ # - no vlan configuration 1004
+ # - no vlan configuration 1005
# After state:
# ------------
#
- # Leaf-01#show run nve | sec ^vlan configuration
- # vlan configuration 101
- # member evpn-instance 102 vni 10102
- # vlan configuration 102
- # member evpn-instance 101 vni 10101
+ # S1#show vlan
+
+ # VLAN Name Status Ports
+ # ---- -------------------------------- --------- -------------------------------
+ # 1 default active Gi0/0, Gi0/1, Gi0/2, Gi0/3
+ # 1002 fddi-default act/unsup
+ # 1003 token-ring-default act/unsup
+ # 1004 fddinet-default act/unsup
+ # 1005 trnet-default act/unsup
+
+ # VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
+ # ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
+ # 1 enet 100001 1500 - - - - - 0 0
+ # 1002 fddi 101002 1500 - - - - - 0 0
+ # 1003 tr 101003 1500 - - - - - 0 0
+ # 1004 fdnet 101004 1500 - - - ieee - 0 0
+ # 1005 trnet 101005 1500 - - - ibm - 0 0
+
+ # Remote SPAN VLANs
+ # ------------------------------------------------------------------------------
+
+
+ # Primary Secondary Type Ports
+ # ------- --------- ----------------- ------------------------------------------
+
+ # S1#show running-config | section ^vlan configuration .+
+ # S1#
+
# Using replaced
diff --git a/plugins/module_utils/network/ios/config/vlans/vlans.py b/plugins/module_utils/network/ios/config/vlans/vlans.py
index d195c317e..a438d3f8e 100644
--- a/plugins/module_utils/network/ios/config/vlans/vlans.py
+++ b/plugins/module_utils/network/ios/config/vlans/vlans.py
@@ -114,10 +114,12 @@ def generate_commands(self, conf_want, conf_have, resource=None):
if self.state == "merged":
wantd = dict_merge(haved, wantd)
- # if state is deleted, empty out wantd and set haved to wantd
- if self.state == "deleted":
+ # if state is overridden, remove excluded vlans
+ if self.state == "overridden":
+ excluded_vlans = {k: v for k, v in iteritems(haved) if k not in wantd or not wantd}
haved = {k: v for k, v in iteritems(haved) if k in wantd or not wantd}
- wantd = {}
+ for k, have in iteritems(excluded_vlans):
+ self.purge(have, resource)
# if state is deleted, empty out wantd and set haved to wantd
if self.state in ["deleted", "purged"]:
@@ -165,3 +167,5 @@ def purge(self, have, resource):
"""Handle operation for purged state"""
if resource == "vlan_configuration":
self.commands.append(self._tmplt.render(have, resource, True))
+ elif resource == "vlans":
+ self.commands.append(self._tmplt.render(have, resource, True))
diff --git a/plugins/modules/ios_vlans.py b/plugins/modules/ios_vlans.py
index de9a0212a..f3dd3ecbc 100644
--- a/plugins/modules/ios_vlans.py
+++ b/plugins/modules/ios_vlans.py
@@ -75,7 +75,11 @@
type: bool
shutdown:
description:
- - Shutdown VLAN switching.
+ - Specifies whether VLAN switching should be administratively enabled or disabled.
+ - When set to C(enabled), the VLAN interface is administratively shut down, which prevents it from forwarding traffic.
+ - When set to C(disabled), the VLAN interface is administratively enabled by issuing the internal C(no shutdown) command,
+ allowing it to forward traffic.
+ - The operational state of the VLAN depends on both the administrative state (C(shutdown) or C(no shutdown)) and the physical link status.
type: str
choices:
- enabled
@@ -266,100 +270,330 @@
# Before state:
# -------------
#
-# vios_l2#show vlan
+# S1#show vlan
+
# VLAN Name Status Ports
# ---- -------------------------------- --------- -------------------------------
-# 1 default active Gi0/1, Gi0/2
-# 10 vlan_10 active
-# 20 vlan_20 act/lshut
-# 30 vlan_30 sus/lshut
+# 1 default active Gi0/0, Gi0/1, Gi0/2, Gi0/3
+# 10 Vlan_10 active
+# 20 Vlan_20 active
+# 30 Vlan_30 suspended
+# 44 Vlan_44 suspended
# 1002 fddi-default act/unsup
# 1003 token-ring-default act/unsup
# 1004 fddinet-default act/unsup
# 1005 trnet-default act/unsup
-#
+
# VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
# ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
# 1 enet 100001 1500 - - - - - 0 0
# 10 enet 100010 1500 - - - - - 0 0
# 20 enet 100020 610 - - - - - 0 0
# 30 enet 100030 1500 - - - - - 0 0
+# 44 enet 100044 1500 - - - - - 0 0
# 1002 fddi 101002 1500 - - - - - 0 0
# 1003 tr 101003 1500 - - - - - 0 0
# 1004 fdnet 101004 1500 - - - ieee - 0 0
# 1005 trnet 101005 1500 - - - ibm - 0 0
-#
+
# Remote SPAN VLANs
# ------------------------------------------------------------------------------
-# 10
+
+
+# Primary Secondary Type Ports
+# ------- --------- ----------------- ------------------------------------------
+# S1#
+
- name: Override device configuration of all VLANs with provided configuration
cisco.ios.ios_vlans:
config:
- - name: Vlan_10
- vlan_id: 10
- mtu: 1000
+ - name: Vlan_2020
+ state: active
+ vlan_id: 20
+ shutdown: disabled
state: overridden
+# Task output:
+# ------------
+
+# after:
+# - mtu: 1500
+# name: default
+# shutdown: disabled
+# state: active
+# vlan_id: 1
+# - mtu: 1500
+# name: Vlan_2020
+# shutdown: disabled
+# state: active
+# vlan_id: 20
+# - mtu: 1500
+# name: fddi-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1002
+# - mtu: 1500
+# name: token-ring-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1003
+# - mtu: 1500
+# name: fddinet-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1004
+# - mtu: 1500
+# name: trnet-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1005
+
+# before:
+# - mtu: 1500
+# name: default
+# shutdown: disabled
+# state: active
+# vlan_id: 1
+# - mtu: 1500
+# name: Vlan_10
+# shutdown: disabled
+# state: active
+# vlan_id: 10
+# - mtu: 610
+# name: Vlan_20
+# shutdown: disabled
+# state: active
+# vlan_id: 20
+# - mtu: 1500
+# name: Vlan_30
+# shutdown: disabled
+# state: suspend
+# vlan_id: 30
+# - mtu: 1500
+# name: Vlan_44
+# shutdown: disabled
+# state: suspend
+# vlan_id: 44
+# - mtu: 1500
+# name: fddi-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1002
+# - mtu: 1500
+# name: token-ring-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1003
+# - mtu: 1500
+# name: fddinet-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1004
+# - mtu: 1500
+# name: trnet-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1005
+
+# commands:
+# - no vlan 1
+# - no vlan 10
+# - no vlan 30
+# - no vlan 44
+# - no vlan 1002
+# - no vlan 1003
+# - no vlan 1004
+# - no vlan 1005
+# - vlan 20
+# - name Vlan_2020
+# - no mtu 610
+# - no vlan configuration 1
+# - no vlan configuration 10
+# - no vlan configuration 30
+# - no vlan configuration 44
+# - no vlan configuration 1002
+# - no vlan configuration 1003
+# - no vlan configuration 1004
+# - no vlan configuration 1005
+
# After state:
# ------------
#
# vios_l2#show vlan
# VLAN Name Status Ports
# ---- -------------------------------- --------- -------------------------------
-# 1 default active Gi0/1, Gi0/2
-# 10 Vlan_10 active
+# 1 default active Gi0/0, Gi0/1, Gi0/2, Gi0/3
+# 20 Vlan_2020 active
# 1002 fddi-default act/unsup
# 1003 token-ring-default act/unsup
# 1004 fddinet-default act/unsup
# 1005 trnet-default act/unsup
-#
+
# VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
# ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
# 1 enet 100001 1500 - - - - - 0 0
-# 10 enet 100010 1000 - - - - - 0 0
+# 20 enet 100020 1500 - - - - - 0 0
# 1002 fddi 101002 1500 - - - - - 0 0
# 1003 tr 101003 1500 - - - - - 0 0
# 1004 fdnet 101004 1500 - - - ieee - 0 0
# 1005 trnet 101005 1500 - - - ibm - 0 0
+# Remote SPAN VLANs
+# ------------------------------------------------------------------------------
-# Using overridden
+
+# Primary Secondary Type Ports
+# ------- --------- ----------------- ------------------------------------------
+
+# Using purged
# Before state:
# -------------
#
-# Leaf-01#show run nve | sec ^vlan configuration
-# vlan configuration 101
-# member evpn-instance 101 vni 10101
-# vlan configuration 102
-# member evpn-instance 102 vni 10102
-# vlan configuration 201
-# member evpn-instance 201 vni 10201
-# vlan configuration 901
-# member vni 50901
+# S1#show vlan
-- name: Override device configuration of all VLANs with provided configuration
+# VLAN Name Status Ports
+# ---- -------------------------------- --------- -------------------------------
+# 1 default active Gi0/0, Gi0/1, Gi0/2, Gi0/3
+# 20 Vlan_2020 active
+# 1002 fddi-default act/unsup
+# 1003 token-ring-default act/unsup
+# 1004 fddinet-default act/unsup
+# 1005 trnet-default act/unsup
+
+# VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
+# ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
+# 1 enet 100001 1500 - - - - - 0 0
+# 20 enet 100020 1500 - - - - - 0 0
+# 1002 fddi 101002 1500 - - - - - 0 0
+# 1003 tr 101003 1500 - - - - - 0 0
+# 1004 fdnet 101004 1500 - - - ieee - 0 0
+# 1005 trnet 101005 1500 - - - ibm - 0 0
+
+# Remote SPAN VLANs
+# ------------------------------------------------------------------------------
+
+
+# Primary Secondary Type Ports
+# ------- --------- ----------------- ------------------------------------------
+
+# S1#show running-config | section ^vlan configuration .+
+# vlan configuration 20
+
+
+- name: Purge all vlans configuration
cisco.ios.ios_vlans:
config:
- - vlan_id: 101
- member:
- vni: 10102
- evi: 102
- - vlan_id: 102
- member:
- vni: 10101
- evi: 101
- state: overridden
+ state: purged
+
+# Task output:
+# ------------
+
+# after:
+# - mtu: 1500
+# name: default
+# shutdown: disabled
+# state: active
+# vlan_id: 1
+# - mtu: 1500
+# name: fddi-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1002
+# - mtu: 1500
+# name: token-ring-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1003
+# - mtu: 1500
+# name: fddinet-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1004
+# - mtu: 1500
+# name: trnet-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1005
+
+# before:
+# - mtu: 1500
+# name: default
+# shutdown: disabled
+# state: active
+# vlan_id: 1
+# - mtu: 1500
+# name: Vlan_2020
+# shutdown: disabled
+# state: active
+# vlan_id: 20
+# - mtu: 1500
+# name: fddi-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1002
+# - mtu: 1500
+# name: token-ring-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1003
+# - mtu: 1500
+# name: fddinet-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1004
+# - mtu: 1500
+# name: trnet-default
+# shutdown: enabled
+# state: active
+# vlan_id: 1005
+
+# commands:
+# - no vlan 1
+# - no vlan 20
+# - no vlan 1002
+# - no vlan 1003
+# - no vlan 1004
+# - no vlan 1005
+# - no vlan configuration 1
+# - no vlan configuration 20
+# - no vlan configuration 1002
+# - no vlan configuration 1003
+# - no vlan configuration 1004
+# - no vlan configuration 1005
# After state:
# ------------
#
-# Leaf-01#show run nve | sec ^vlan configuration
-# vlan configuration 101
-# member evpn-instance 102 vni 10102
-# vlan configuration 102
-# member evpn-instance 101 vni 10101
+# S1#show vlan
+
+# VLAN Name Status Ports
+# ---- -------------------------------- --------- -------------------------------
+# 1 default active Gi0/0, Gi0/1, Gi0/2, Gi0/3
+# 1002 fddi-default act/unsup
+# 1003 token-ring-default act/unsup
+# 1004 fddinet-default act/unsup
+# 1005 trnet-default act/unsup
+
+# VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
+# ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
+# 1 enet 100001 1500 - - - - - 0 0
+# 1002 fddi 101002 1500 - - - - - 0 0
+# 1003 tr 101003 1500 - - - - - 0 0
+# 1004 fdnet 101004 1500 - - - ieee - 0 0
+# 1005 trnet 101005 1500 - - - ibm - 0 0
+
+# Remote SPAN VLANs
+# ------------------------------------------------------------------------------
+
+
+# Primary Secondary Type Ports
+# ------- --------- ----------------- ------------------------------------------
+
+# S1#show running-config | section ^vlan configuration .+
+# S1#
+
# Using replaced
diff --git a/tests/unit/modules/network/ios/test_ios_vlans.py b/tests/unit/modules/network/ios/test_ios_vlans.py
index 10b30e140..a48a6fd16 100644
--- a/tests/unit/modules/network/ios/test_ios_vlans.py
+++ b/tests/unit/modules/network/ios/test_ios_vlans.py
@@ -511,42 +511,13 @@ def test_ios_vlans_overridden(self):
)
result = self.execute_module(changed=True)
commands = [
- "vlan 1",
- "no name default",
- "no state active",
- "no mtu 1500",
- "shutdown",
- "vlan 150",
- "no name VLAN0150",
- "no state active",
- "no mtu 1500",
- "no remote-span",
- "shutdown",
- "vlan 888",
- "no name a_very_long_vlan_name_a_very_long_vlan_name",
- "no state active",
- "no mtu 1500",
- "shutdown",
- "vlan 1002",
- "no name fddi-default",
- "no state active",
- "no mtu 1500",
- "shutdown",
- "vlan 1003",
- "no name trcrf-default",
- "no state active",
- "no mtu 4472",
- "shutdown",
- "vlan 1004",
- "no name fddinet-default",
- "no state active",
- "no mtu 1500",
- "shutdown",
- "vlan 1005",
- "no name trbrf-default",
- "no state active",
- "no mtu 4472",
- "shutdown",
+ "no vlan 1",
+ "no vlan 150",
+ "no vlan 888",
+ "no vlan 1002",
+ "no vlan 1003",
+ "no vlan 1004",
+ "no vlan 1005",
"vlan 200",
"name test_vlan_200",
"state active",
@@ -558,6 +529,13 @@ def test_ios_vlans_overridden(self):
"no mtu 610",
"remote-span",
"shutdown",
+ "no vlan configuration 1",
+ "no vlan configuration 150",
+ "no vlan configuration 888",
+ "no vlan configuration 1002",
+ "no vlan configuration 1003",
+ "no vlan configuration 1004",
+ "no vlan configuration 1005",
]
self.assertEqual(result["commands"], commands)
@@ -1225,14 +1203,14 @@ def test_ios_vlans_config_overridden(self):
)
result = self.execute_module(changed=True)
commands = [
- "vlan configuration 201",
- "no member evpn-instance 201 vni 10201",
- "vlan configuration 202",
- "no member evpn-instance 202 vni 10202",
- "vlan configuration 901",
- "no member vni 50901",
- "vlan configuration 902",
- "no member vni 50902",
+ "no vlan 201",
+ "no vlan 202",
+ "no vlan 901",
+ "no vlan 902",
+ "no vlan configuration 201",
+ "no vlan configuration 202",
+ "no vlan configuration 901",
+ "no vlan configuration 902",
"vlan configuration 101",
"member evpn-instance 102 vni 10102",
"vlan configuration 102",
@@ -1299,7 +1277,7 @@ def test_ios_purged_vlans_config(self):
),
)
result = self.execute_module(changed=True)
- commands = ["no vlan configuration 101"]
+ commands = ["no vlan 101", "no vlan configuration 101"]
self.assertEqual(result["commands"], commands)
def test_ios_vlans_config_rendered(self):