mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
fix nxos_vrf and migrate get_interface_type to module_utils (#40825)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
45c6fa9784
commit
b4baa2d484
11 changed files with 41 additions and 180 deletions
|
@ -120,36 +120,11 @@ import re
|
|||
from copy import deepcopy
|
||||
|
||||
from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands
|
||||
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec
|
||||
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, get_interface_type
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.network.common.utils import remove_default_spec
|
||||
|
||||
|
||||
def get_interface_type(name):
|
||||
"""Gets the type of interface
|
||||
Args:
|
||||
interface (str): full name of interface, i.e. Ethernet1/1, loopback10,
|
||||
port-channel20, vlan20
|
||||
Returns:
|
||||
type of interface: ethernet, svi, loopback, management, portchannel,
|
||||
or unknown
|
||||
"""
|
||||
if name.upper().startswith('ET'):
|
||||
return 'ethernet'
|
||||
elif name.upper().startswith('VL'):
|
||||
return 'svi'
|
||||
elif name.upper().startswith('LO'):
|
||||
return 'loopback'
|
||||
elif name.upper().startswith('MG'):
|
||||
return 'management'
|
||||
elif name.upper().startswith('MA'):
|
||||
return 'management'
|
||||
elif name.upper().startswith('PO'):
|
||||
return 'portchannel'
|
||||
else:
|
||||
return 'unknown'
|
||||
|
||||
|
||||
def get_interface_mode(name, module):
|
||||
"""Gets current mode of interface: layer2 or layer3
|
||||
Args:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue