diff --git a/README.md b/README.md index ba008ae84..55356b95d 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,8 @@ This collection is intended for use with the following release versions: ## Ansible version compatibility -This collection has been tested against following Ansible versions: **>=2.15.0**. +This collection has been tested against the following Ansible versions: **>=2.15.0**. -For collections that support Ansible 2.9, please ensure you update your `network_os` to use the -fully qualified collection name (for example, `cisco.ios.ios`). Plugins and modules within a collection may be tested with only specific Ansible versions. A collection may contain metadata that identifies these versions. PEP440 is the schema used to describe the versions of Ansible. diff --git a/docs/cisco.dcnm.dcnm_interface_module.rst b/docs/cisco.dcnm.dcnm_interface_module.rst index e0764f565..56b7c5f12 100644 --- a/docs/cisco.dcnm.dcnm_interface_module.rst +++ b/docs/cisco.dcnm.dcnm_interface_module.rst @@ -562,6 +562,69 @@ Parameters
Duplex of the interface. Speed must be set to use duplex.
+ + + + +
+ enable_cdp + +
+ boolean +
+ + + + + +
State of CDP protocol on the interface
+ + + + + + +
+ enable_monitor + +
+ boolean +
+ + + + + +
State of Switchport Monitor for SPAN/ERSPAN
+ + + + + + +
+ enable_pfc + +
+ boolean +
+ + + + + +
State of Priority Flow Control (PFC) on the interface
+ + @@ -1105,6 +1168,69 @@ Parameters
Duplex of the interface. Speed must be set to use duplex.
+ + + + +
+ enable_cdp + +
+ boolean +
+ + + + + +
State of CDP protocol on the interface
+ + + + + + +
+ enable_monitor + +
+ boolean +
+ + + + + +
State of Switchport Monitor for SPAN/ERSPAN
+ + + + + + +
+ enable_pfc + +
+ boolean +
+ + + + + +
State of Priority Flow Control (PFC) on the interface
+ + diff --git a/plugins/modules/dcnm_interface.py b/plugins/modules/dcnm_interface.py index 93270e778..7a29c3ebd 100644 --- a/plugins/modules/dcnm_interface.py +++ b/plugins/modules/dcnm_interface.py @@ -181,6 +181,21 @@ type: str choices: ['auto', 'full', 'half'] default: auto + enable_pfc: + description: + - State of Priority Flow Control (PFC) on the interface + type: bool + default: false + enable_cdp: + description: + - State of CDP protocol on the interface + type: bool + default: true + enable_monitor: + description: + - State of Switchport Monitor for SPAN/ERSPAN + type: bool + default: false profile_vpc: description: - Though the key shown here is 'profile_vpc' the actual key to be used in playbook @@ -564,6 +579,21 @@ - Administrative state of the interface type: bool default: true + enable_pfc: + description: + - State of Priority Flow Control (PFC) on the interface + type: bool + default: false + enable_cdp: + description: + - State of CDP protocol on the interface + type: bool + default: true + enable_monitor: + description: + - State of Switchport Monitor for SPAN/ERSPAN + type: bool + default: false profile_svi: description: - Though the key shown here is 'profile_svi' the actual key to be used in playbook @@ -1920,6 +1950,9 @@ def __init__(self, module): "DCI_ROUTING_PROTO": "dci_routing_proto", "DCI_ROUTING_TAG": "dci_routing_tag", "ENABLE_ORPHAN_PORT": "orphan_port", + "ENABLE_PFC": "enable_pfc", + "ENABLE_MONITOR": "enable_monitor", + "CDP_ENABLE": "enable_cdp", } # New Interfaces @@ -2268,6 +2301,9 @@ def dcnm_intf_validate_port_channel_input(self, config): description=dict(type="str", default=""), admin_state=dict(type="bool", default=True), orphan_port=dict(type="bool", default=False), + enable_cdp=dict(type="bool", default=True), + enable_monitor=dict(type="bool", default=False), + enable_pfc=dict(type="bool", default=False), duplex=dict( type="str", default="auto", choices=["auto", "full", "half"]), ) @@ -2285,6 +2321,9 @@ def dcnm_intf_validate_port_channel_input(self, config): description=dict(type="str", default=""), admin_state=dict(type="bool", default=True), orphan_port=dict(type="bool", default=False), + enable_cdp=dict(type="bool", default=True), + enable_monitor=dict(type="bool", default=False), + enable_pfc=dict(type="bool", default=False), duplex=dict( type="str", default="auto", choices=["auto", "full", "half"]), ) @@ -2487,6 +2526,9 @@ def dcnm_intf_validate_ethernet_interface_input(self, cfg): description=dict(type="str", default=""), admin_state=dict(type="bool", default=True), orphan_port=dict(type="bool", default=False), + enable_cdp=dict(type="bool", default=True), + enable_monitor=dict(type="bool", default=False), + enable_pfc=dict(type="bool", default=False), duplex=dict( type="str", default="auto", choices=["auto", "full", "half"]), ) @@ -2504,6 +2546,9 @@ def dcnm_intf_validate_ethernet_interface_input(self, cfg): description=dict(type="str", default=""), admin_state=dict(type="bool", default=True), orphan_port=dict(type="bool", default=False), + enable_cdp=dict(type="bool", default=True), + enable_monitor=dict(type="bool", default=False), + enable_pfc=dict(type="bool", default=False), duplex=dict( type="str", default="auto", choices=["auto", "full", "half"]), ) @@ -2843,6 +2888,12 @@ def dcnm_intf_get_pc_payload(self, delem, intf, profile): intf["interfaces"][0]["nvPairs"]["PO_ID"] = ifname intf["interfaces"][0]["nvPairs"][ "ENABLE_ORPHAN_PORT"] = delem[profile]["orphan_port"] + intf["interfaces"][0]["nvPairs"][ + "CDP_ENABLE"] = delem[profile]["enable_cdp"] + intf["interfaces"][0]["nvPairs"][ + "ENABLE_PFC"] = delem[profile]["enable_pfc"] + intf["interfaces"][0]["nvPairs"][ + "ENABLE_MONITOR"] = delem[profile]["enable_monitor"] intf["interfaces"][0]["nvPairs"][ "PORT_DUPLEX_MODE"] = delem[profile]["duplex"] if delem[profile]["mode"] == "access": @@ -2870,6 +2921,12 @@ def dcnm_intf_get_pc_payload(self, delem, intf, profile): intf["interfaces"][0]["nvPairs"]["PO_ID"] = ifname intf["interfaces"][0]["nvPairs"][ "ENABLE_ORPHAN_PORT"] = delem[profile]["orphan_port"] + intf["interfaces"][0]["nvPairs"][ + "CDP_ENABLE"] = delem[profile]["enable_cdp"] + intf["interfaces"][0]["nvPairs"][ + "ENABLE_PFC"] = delem[profile]["enable_pfc"] + intf["interfaces"][0]["nvPairs"][ + "ENABLE_MONITOR"] = delem[profile]["enable_monitor"] intf["interfaces"][0]["nvPairs"][ "PORT_DUPLEX_MODE"] = delem[profile]["duplex"] if delem[profile]["mode"] == "l3": @@ -3241,6 +3298,12 @@ def dcnm_intf_get_eth_payload(self, delem, intf, profile): intf["interfaces"][0]["nvPairs"]["INTF_NAME"] = ifname intf["interfaces"][0]["nvPairs"][ "ENABLE_ORPHAN_PORT"] = delem[profile]["orphan_port"] + intf["interfaces"][0]["nvPairs"][ + "CDP_ENABLE"] = delem[profile]["enable_cdp"] + intf["interfaces"][0]["nvPairs"][ + "ENABLE_PFC"] = delem[profile]["enable_pfc"] + intf["interfaces"][0]["nvPairs"][ + "ENABLE_MONITOR"] = delem[profile]["enable_monitor"] intf["interfaces"][0]["nvPairs"][ "PORT_DUPLEX_MODE"] = delem[profile]["duplex"] if delem[profile]["mode"] == "access": @@ -3259,6 +3322,12 @@ def dcnm_intf_get_eth_payload(self, delem, intf, profile): intf["interfaces"][0]["nvPairs"]["INTF_NAME"] = ifname intf["interfaces"][0]["nvPairs"][ "ENABLE_ORPHAN_PORT"] = delem[profile]["orphan_port"] + intf["interfaces"][0]["nvPairs"][ + "CDP_ENABLE"] = delem[profile]["enable_cdp"] + intf["interfaces"][0]["nvPairs"][ + "ENABLE_PFC"] = delem[profile]["enable_pfc"] + intf["interfaces"][0]["nvPairs"][ + "ENABLE_MONITOR"] = delem[profile]["enable_monitor"] intf["interfaces"][0]["nvPairs"][ "PORT_DUPLEX_MODE"] = delem[profile]["duplex"] if delem[profile]["mode"] == "routed": @@ -3884,7 +3953,7 @@ def dcnm_intf_compare_elements( else: t_e2 = e2 - if k == 'ENABLE_ORPHAN_PORT': + if k in ['ENABLE_ORPHAN_PORT', 'ENABLE_PFC', 'ENABLE_MONITOR', 'CDP_ENABLE']: # This is a special case where the value is a boolean and we need to compare it as such t_e1 = str(t_e1).lower() t_e2 = str(t_e2).lower() diff --git a/tests/unit/modules/dcnm/fixtures/dcnm_intf_eth_configs.json b/tests/unit/modules/dcnm/fixtures/dcnm_intf_eth_configs.json index 896f3c042..98aa80c27 100644 --- a/tests/unit/modules/dcnm/fixtures/dcnm_intf_eth_configs.json +++ b/tests/unit/modules/dcnm/fixtures/dcnm_intf_eth_configs.json @@ -94,6 +94,9 @@ "allowed_vlans": "none", "native_vlan": 10, "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "duplex": "auto", "cmds": [ "no shutdown" @@ -219,6 +222,9 @@ "allowed_vlans": "all", "native_vlan": 10, "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "duplex": "auto", "cmds": [ "no shutdown", @@ -469,6 +475,9 @@ "allowed_vlans": "all", "native_vlan": 10, "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "duplex": "auto", "cmds": [ "no shutdown", @@ -500,6 +509,9 @@ "allowed_vlans": "all", "native_vlan": 10, "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "duplex": "auto", "cmds": [ "no shutdown", diff --git a/tests/unit/modules/dcnm/fixtures/dcnm_intf_eth_payloads.json b/tests/unit/modules/dcnm/fixtures/dcnm_intf_eth_payloads.json index e1fcba524..a1701db08 100644 --- a/tests/unit/modules/dcnm/fixtures/dcnm_intf_eth_payloads.json +++ b/tests/unit/modules/dcnm/fixtures/dcnm_intf_eth_payloads.json @@ -21,7 +21,10 @@ "PORT_DUPLEX_MODE": "auto", "DESC": "eth interface acting as trunk", "NATIVE_VLAN": "10", - "ENABLE_ORPHAN_PORT": false + "ENABLE_ORPHAN_PORT": false, + "ENABLE_PFC": false, + "CDP_ENABLE": true, + "ENABLE_MONITOR": false }, "ifName": "Ethernet1/30", "serialNumber": "SAL1819SAN8", @@ -53,6 +56,9 @@ "BPDUGUARD_ENABLED": "True", "SPEED": "auto", "ENABLE_ORPHAN_PORT": false, + "ENABLE_PFC": false, + "CDP_ENABLE": true, + "ENABLE_MONITOR": false, "PORT_DUPLEX_MODE": "auto", "DESC": "eth interface acting as access" }, diff --git a/tests/unit/modules/dcnm/fixtures/dcnm_intf_multi_intf_configs.json b/tests/unit/modules/dcnm/fixtures/dcnm_intf_multi_intf_configs.json index 4b28d1528..f305552f7 100644 --- a/tests/unit/modules/dcnm/fixtures/dcnm_intf_multi_intf_configs.json +++ b/tests/unit/modules/dcnm/fixtures/dcnm_intf_multi_intf_configs.json @@ -97,6 +97,9 @@ "allowed_vlans": "none", "native_vlan": "10", "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "speed": "Auto", "duplex": "auto", "cmds": [ @@ -167,6 +170,9 @@ "allowed_vlans": "none", "native_vlan": "10", "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "cmds": [ "no shutdown" ], @@ -252,6 +258,9 @@ "allowed_vlans": "none", "native_vlan": "10", "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "speed": "Auto", "duplex": "auto", "cmds": [ @@ -322,6 +331,9 @@ "allowed_vlans": "none", "native_vlan": "10", "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "cmds": [ "spanning-tree bpduguard enable" ], diff --git a/tests/unit/modules/dcnm/fixtures/dcnm_intf_multi_intf_payloads.json b/tests/unit/modules/dcnm/fixtures/dcnm_intf_multi_intf_payloads.json index c2e1d84cb..3413254c2 100644 --- a/tests/unit/modules/dcnm/fixtures/dcnm_intf_multi_intf_payloads.json +++ b/tests/unit/modules/dcnm/fixtures/dcnm_intf_multi_intf_payloads.json @@ -29,6 +29,9 @@ "ALLOWED_VLANS": "none", "NATIVE_VLAN": "10", "ENABLE_ORPHAN_PORT": false, + "ENABLE_PFC": false, + "CDP_ENABLE": true, + "ENABLE_MONITOR": false, "DESC": "port channel acting as trunk" } }], @@ -69,6 +72,9 @@ "DESC": "port channel acting as trunk", "CONF": "no shutdown", "ENABLE_ORPHAN_PORT": false, + "ENABLE_PFC": false, + "CDP_ENABLE": true, + "ENABLE_MONITOR": false, "ADMIN_STATE": "true" } } @@ -147,6 +153,9 @@ "DESC": "eth interface acting as trunk", "CONF": "no shutdown", "ENABLE_ORPHAN_PORT": false, + "ENABLE_PFC": false, + "CDP_ENABLE": true, + "ENABLE_MONITOR": false, "ADMIN_STATE": "true" } } diff --git a/tests/unit/modules/dcnm/fixtures/dcnm_intf_pc_configs.json b/tests/unit/modules/dcnm/fixtures/dcnm_intf_pc_configs.json index 360492993..618fa8a31 100644 --- a/tests/unit/modules/dcnm/fixtures/dcnm_intf_pc_configs.json +++ b/tests/unit/modules/dcnm/fixtures/dcnm_intf_pc_configs.json @@ -154,6 +154,9 @@ "admin_state": "True", "access_vlan": 200, "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "cmds": [ "no shutdown" ], @@ -217,6 +220,9 @@ "allowed_vlans": "none", "native_vlan": "10", "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "speed": "Auto", "duplex": "auto", "cmds": [ @@ -249,6 +255,9 @@ "admin_state": "False", "ifname": "Port-channel301", "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "cmds": [ "no shutdown" ], @@ -474,6 +483,9 @@ "allowed_vlans": "all", "native_vlan": "10", "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "speed": "Auto", "duplex": "auto", "cmds": [ @@ -507,6 +519,9 @@ "admin_state": "True", "ifname": "Port-channel301", "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "cmds": [ "no shutdown", "no shutdown" @@ -584,6 +599,9 @@ "allowed_vlans": "none", "native_vlan": "10", "orphan_port": false, + "enable_pfc": false, + "enable_cdp": true, + "enable_monitor": false, "speed": "Auto", "duplex": "auto", "cmds": [ diff --git a/tests/unit/modules/dcnm/fixtures/dcnm_intf_pc_payloads.json b/tests/unit/modules/dcnm/fixtures/dcnm_intf_pc_payloads.json index 661269a2c..35f6c7310 100644 --- a/tests/unit/modules/dcnm/fixtures/dcnm_intf_pc_payloads.json +++ b/tests/unit/modules/dcnm/fixtures/dcnm_intf_pc_payloads.json @@ -28,6 +28,9 @@ "ALLOWED_VLANS": "none", "NATIVE_VLAN": "10", "ENABLE_ORPHAN_PORT": false, + "ENABLE_PFC": false, + "CDP_ENABLE": true, + "ENABLE_MONITOR": false, "DESC": "port channel acting as trunk" } }], @@ -65,7 +68,10 @@ "ADMIN_STATE": "False", "POLICY_ID": "POLICY-1849730", "DESC": "port channel acting as access", - "ENABLE_ORPHAN_PORT": false + "ENABLE_ORPHAN_PORT": false, + "ENABLE_PFC": false, + "CDP_ENABLE": true, + "ENABLE_MONITOR": false } }], "skipResourceCheck": "True"