Fix to allow Po interface descriptions (#51726)

* Fix to allow Po interface descriptions

* add absent to UNSUPPORTED_STATES for IF_TYPE_PO
This commit is contained in:
Thomas Stewart 2019-03-27 14:04:10 +00:00 committed by Ricardo Carrillo Cruz
parent 8d742d9bff
commit f242f3475e

View file

@ -135,25 +135,30 @@ class OnyxInterfaceModule(BaseOnyxModule):
IF_ETH_REGEX = re.compile(r"^Eth(\d+\/\d+|\d+\/\d+\/\d+)$")
IF_VLAN_REGEX = re.compile(r"^Vlan (\d+)$")
IF_LOOPBACK_REGEX = re.compile(r"^Loopback (\d+)$")
IF_PO_REGEX = re.compile(r"^Po(\d+)$")
IF_TYPE_ETH = "ethernet"
IF_TYPE_LOOPBACK = "loopback"
IF_TYPE_VLAN = "vlan"
IF_TYPE_PO = "port-channel"
IF_TYPE_MAP = {
IF_TYPE_ETH: IF_ETH_REGEX,
IF_TYPE_VLAN: IF_VLAN_REGEX,
IF_TYPE_LOOPBACK: IF_LOOPBACK_REGEX,
IF_TYPE_PO: IF_PO_REGEX
}
UNSUPPORTED_ATTRS = {
IF_TYPE_ETH: (),
IF_TYPE_VLAN: ('speed', 'rx_rate', 'tx_rate'),
IF_TYPE_LOOPBACK: ('speed', 'mtu', 'rx_rate', 'tx_rate'),
IF_TYPE_PO: ('speed', 'rx_rate', 'tx_rate'),
}
UNSUPPORTED_STATES = {
IF_TYPE_ETH: ('absent',),
IF_TYPE_VLAN: (),
IF_TYPE_LOOPBACK: ('up', 'down'),
IF_TYPE_PO: ('absent'),
}
IF_MODIFIABLE_ATTRS = ('speed', 'description', 'mtu')