parent
717c0da32b
commit
7089fa1cd4
4 changed files with 72 additions and 88 deletions
|
@ -274,49 +274,45 @@ def get_interface_type(interface):
|
|||
if interface is None:
|
||||
return None
|
||||
|
||||
iftype = None
|
||||
|
||||
if interface.upper().startswith('GE'):
|
||||
iftype = 'ge'
|
||||
return 'ge'
|
||||
elif interface.upper().startswith('10GE'):
|
||||
iftype = '10ge'
|
||||
return '10ge'
|
||||
elif interface.upper().startswith('25GE'):
|
||||
iftype = '25ge'
|
||||
return '25ge'
|
||||
elif interface.upper().startswith('4X10GE'):
|
||||
iftype = '4x10ge'
|
||||
return '4x10ge'
|
||||
elif interface.upper().startswith('40GE'):
|
||||
iftype = '40ge'
|
||||
return '40ge'
|
||||
elif interface.upper().startswith('100GE'):
|
||||
iftype = '100ge'
|
||||
return '100ge'
|
||||
elif interface.upper().startswith('VLANIF'):
|
||||
iftype = 'vlanif'
|
||||
return 'vlanif'
|
||||
elif interface.upper().startswith('LOOPBACK'):
|
||||
iftype = 'loopback'
|
||||
return 'loopback'
|
||||
elif interface.upper().startswith('METH'):
|
||||
iftype = 'meth'
|
||||
return 'meth'
|
||||
elif interface.upper().startswith('ETH-TRUNK'):
|
||||
iftype = 'eth-trunk'
|
||||
return 'eth-trunk'
|
||||
elif interface.upper().startswith('VBDIF'):
|
||||
iftype = 'vbdif'
|
||||
return 'vbdif'
|
||||
elif interface.upper().startswith('NVE'):
|
||||
iftype = 'nve'
|
||||
return 'nve'
|
||||
elif interface.upper().startswith('TUNNEL'):
|
||||
iftype = 'tunnel'
|
||||
return 'tunnel'
|
||||
elif interface.upper().startswith('ETHERNET'):
|
||||
iftype = 'ethernet'
|
||||
return 'ethernet'
|
||||
elif interface.upper().startswith('FCOE-PORT'):
|
||||
iftype = 'fcoe-port'
|
||||
return 'fcoe-port'
|
||||
elif interface.upper().startswith('FABRIC-PORT'):
|
||||
iftype = 'fabric-port'
|
||||
return 'fabric-port'
|
||||
elif interface.upper().startswith('STACK-PORT'):
|
||||
iftype = 'stack-port'
|
||||
return 'stack-port'
|
||||
elif interface.upper().startswith('NULL'):
|
||||
iftype = 'null'
|
||||
return 'null'
|
||||
else:
|
||||
return None
|
||||
|
||||
return iftype.lower()
|
||||
|
||||
|
||||
def is_admin_state_enable(iftype):
|
||||
"""admin state disable: loopback nve"""
|
||||
|
|
|
@ -285,49 +285,45 @@ def get_interface_type(interface):
|
|||
if interface is None:
|
||||
return None
|
||||
|
||||
iftype = None
|
||||
|
||||
if interface.upper().startswith('GE'):
|
||||
iftype = 'ge'
|
||||
return 'ge'
|
||||
elif interface.upper().startswith('10GE'):
|
||||
iftype = '10ge'
|
||||
return '10ge'
|
||||
elif interface.upper().startswith('25GE'):
|
||||
iftype = '25ge'
|
||||
return '25ge'
|
||||
elif interface.upper().startswith('4X10GE'):
|
||||
iftype = '4x10ge'
|
||||
return '4x10ge'
|
||||
elif interface.upper().startswith('40GE'):
|
||||
iftype = '40ge'
|
||||
return '40ge'
|
||||
elif interface.upper().startswith('100GE'):
|
||||
iftype = '100ge'
|
||||
return '100ge'
|
||||
elif interface.upper().startswith('VLANIF'):
|
||||
iftype = 'vlanif'
|
||||
return 'vlanif'
|
||||
elif interface.upper().startswith('LOOPBACK'):
|
||||
iftype = 'loopback'
|
||||
return 'loopback'
|
||||
elif interface.upper().startswith('METH'):
|
||||
iftype = 'meth'
|
||||
return 'meth'
|
||||
elif interface.upper().startswith('ETH-TRUNK'):
|
||||
iftype = 'eth-trunk'
|
||||
return 'eth-trunk'
|
||||
elif interface.upper().startswith('VBDIF'):
|
||||
iftype = 'vbdif'
|
||||
return 'vbdif'
|
||||
elif interface.upper().startswith('NVE'):
|
||||
iftype = 'nve'
|
||||
return 'nve'
|
||||
elif interface.upper().startswith('TUNNEL'):
|
||||
iftype = 'tunnel'
|
||||
return 'tunnel'
|
||||
elif interface.upper().startswith('ETHERNET'):
|
||||
iftype = 'ethernet'
|
||||
return 'ethernet'
|
||||
elif interface.upper().startswith('FCOE-PORT'):
|
||||
iftype = 'fcoe-port'
|
||||
return 'fcoe-port'
|
||||
elif interface.upper().startswith('FABRIC-PORT'):
|
||||
iftype = 'fabric-port'
|
||||
return 'fabric-port'
|
||||
elif interface.upper().startswith('STACK-PORT'):
|
||||
iftype = 'stack-port'
|
||||
return 'stack-port'
|
||||
elif interface.upper().startswith('NULL'):
|
||||
iftype = 'null'
|
||||
return 'null'
|
||||
else:
|
||||
return None
|
||||
|
||||
return iftype.lower()
|
||||
|
||||
|
||||
def is_valid_v4addr(addr):
|
||||
"""check is ipv4 addr is valid"""
|
||||
|
|
|
@ -303,49 +303,45 @@ def get_interface_type(interface):
|
|||
if interface is None:
|
||||
return None
|
||||
|
||||
iftype = None
|
||||
|
||||
if interface.upper().startswith('GE'):
|
||||
iftype = 'ge'
|
||||
return 'ge'
|
||||
elif interface.upper().startswith('10GE'):
|
||||
iftype = '10ge'
|
||||
return '10ge'
|
||||
elif interface.upper().startswith('25GE'):
|
||||
iftype = '25ge'
|
||||
return '25ge'
|
||||
elif interface.upper().startswith('4X10GE'):
|
||||
iftype = '4x10ge'
|
||||
return '4x10ge'
|
||||
elif interface.upper().startswith('40GE'):
|
||||
iftype = '40ge'
|
||||
return '40ge'
|
||||
elif interface.upper().startswith('100GE'):
|
||||
iftype = '100ge'
|
||||
return '100ge'
|
||||
elif interface.upper().startswith('VLANIF'):
|
||||
iftype = 'vlanif'
|
||||
return 'vlanif'
|
||||
elif interface.upper().startswith('LOOPBACK'):
|
||||
iftype = 'loopback'
|
||||
return 'loopback'
|
||||
elif interface.upper().startswith('METH'):
|
||||
iftype = 'meth'
|
||||
return 'meth'
|
||||
elif interface.upper().startswith('ETH-TRUNK'):
|
||||
iftype = 'eth-trunk'
|
||||
return 'eth-trunk'
|
||||
elif interface.upper().startswith('VBDIF'):
|
||||
iftype = 'vbdif'
|
||||
return 'vbdif'
|
||||
elif interface.upper().startswith('NVE'):
|
||||
iftype = 'nve'
|
||||
return 'nve'
|
||||
elif interface.upper().startswith('TUNNEL'):
|
||||
iftype = 'tunnel'
|
||||
return 'tunnel'
|
||||
elif interface.upper().startswith('ETHERNET'):
|
||||
iftype = 'ethernet'
|
||||
return 'ethernet'
|
||||
elif interface.upper().startswith('FCOE-PORT'):
|
||||
iftype = 'fcoe-port'
|
||||
return 'fcoe-port'
|
||||
elif interface.upper().startswith('FABRIC-PORT'):
|
||||
iftype = 'fabric-port'
|
||||
return 'fabric-port'
|
||||
elif interface.upper().startswith('STACK-PORT'):
|
||||
iftype = 'stack-port'
|
||||
return 'stack-port'
|
||||
elif interface.upper().startswith('NULL'):
|
||||
iftype = 'null'
|
||||
return 'null'
|
||||
else:
|
||||
return None
|
||||
|
||||
return iftype.lower()
|
||||
|
||||
|
||||
def is_valid_v4addr(addr):
|
||||
"""check is ipv4 addr is valid"""
|
||||
|
|
|
@ -197,49 +197,45 @@ def get_interface_type(interface):
|
|||
if interface is None:
|
||||
return None
|
||||
|
||||
iftype = None
|
||||
|
||||
if interface.upper().startswith('GE'):
|
||||
iftype = 'ge'
|
||||
return 'ge'
|
||||
elif interface.upper().startswith('10GE'):
|
||||
iftype = '10ge'
|
||||
return '10ge'
|
||||
elif interface.upper().startswith('25GE'):
|
||||
iftype = '25ge'
|
||||
return '25ge'
|
||||
elif interface.upper().startswith('4X10GE'):
|
||||
iftype = '4x10ge'
|
||||
return '4x10ge'
|
||||
elif interface.upper().startswith('40GE'):
|
||||
iftype = '40ge'
|
||||
return '40ge'
|
||||
elif interface.upper().startswith('100GE'):
|
||||
iftype = '100ge'
|
||||
return '100ge'
|
||||
elif interface.upper().startswith('VLANIF'):
|
||||
iftype = 'vlanif'
|
||||
return 'vlanif'
|
||||
elif interface.upper().startswith('LOOPBACK'):
|
||||
iftype = 'loopback'
|
||||
return 'loopback'
|
||||
elif interface.upper().startswith('METH'):
|
||||
iftype = 'meth'
|
||||
return 'meth'
|
||||
elif interface.upper().startswith('ETH-TRUNK'):
|
||||
iftype = 'eth-trunk'
|
||||
return 'eth-trunk'
|
||||
elif interface.upper().startswith('VBDIF'):
|
||||
iftype = 'vbdif'
|
||||
return 'vbdif'
|
||||
elif interface.upper().startswith('NVE'):
|
||||
iftype = 'nve'
|
||||
return 'nve'
|
||||
elif interface.upper().startswith('TUNNEL'):
|
||||
iftype = 'tunnel'
|
||||
return 'tunnel'
|
||||
elif interface.upper().startswith('ETHERNET'):
|
||||
iftype = 'ethernet'
|
||||
return 'ethernet'
|
||||
elif interface.upper().startswith('FCOE-PORT'):
|
||||
iftype = 'fcoe-port'
|
||||
return 'fcoe-port'
|
||||
elif interface.upper().startswith('FABRIC-PORT'):
|
||||
iftype = 'fabric-port'
|
||||
return 'fabric-port'
|
||||
elif interface.upper().startswith('STACK-PORT'):
|
||||
iftype = 'stack-Port'
|
||||
return 'stack-Port'
|
||||
elif interface.upper().startswith('NULL'):
|
||||
iftype = 'null'
|
||||
return 'null'
|
||||
else:
|
||||
return None
|
||||
|
||||
return iftype.lower()
|
||||
|
||||
|
||||
def is_ethernet_port(interface):
|
||||
"""Judge whether it is ethernet port"""
|
||||
|
|
Loading…
Reference in a new issue