diff --git a/lib/ansible/modules/network/cloudengine/ce_interface.py b/lib/ansible/modules/network/cloudengine/ce_interface.py index 7b126e814f4..1bbee31b726 100644 --- a/lib/ansible/modules/network/cloudengine/ce_interface.py +++ b/lib/ansible/modules/network/cloudengine/ce_interface.py @@ -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""" diff --git a/lib/ansible/modules/network/cloudengine/ce_interface_ospf.py b/lib/ansible/modules/network/cloudengine/ce_interface_ospf.py index b011ac3658d..f8c17e2e23f 100644 --- a/lib/ansible/modules/network/cloudengine/ce_interface_ospf.py +++ b/lib/ansible/modules/network/cloudengine/ce_interface_ospf.py @@ -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""" diff --git a/lib/ansible/modules/network/cloudengine/ce_ip_interface.py b/lib/ansible/modules/network/cloudengine/ce_ip_interface.py index e6ed37dbe75..8d900a9b9b4 100644 --- a/lib/ansible/modules/network/cloudengine/ce_ip_interface.py +++ b/lib/ansible/modules/network/cloudengine/ce_ip_interface.py @@ -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""" diff --git a/lib/ansible/modules/network/cloudengine/ce_link_status.py b/lib/ansible/modules/network/cloudengine/ce_link_status.py index f617f8cbf05..2b86da25384 100644 --- a/lib/ansible/modules/network/cloudengine/ce_link_status.py +++ b/lib/ansible/modules/network/cloudengine/ce_link_status.py @@ -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"""