本文整理汇总了Python中nmlib.nm_utils.TypeConvert.mac_address_array2string方法的典型用法代码示例。如果您正苦于以下问题:Python TypeConvert.mac_address_array2string方法的具体用法?Python TypeConvert.mac_address_array2string怎么用?Python TypeConvert.mac_address_array2string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nmlib.nm_utils.TypeConvert
的用法示例。
在下文中一共展示了TypeConvert.mac_address_array2string方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: is_wired_setting_ok
# 需要导入模块: from nmlib.nm_utils import TypeConvert [as 别名]
# 或者: from nmlib.nm_utils.TypeConvert import mac_address_array2string [as 别名]
def is_wired_setting_ok(self, info_dict):
if info_dict["connection"]["type"] != "802-3-ethernet":
return False
else:
if not self.check_conn_setting(info_dict):
return False
if not self.check_ip4_setting(info_dict):
return False
if "mac-address" in info_dict["802-3-ethernet"].keys():
if not TypeConvert.is_valid_mac_address(
TypeConvert.mac_address_array2string(info_dict["802-3-ethernet"]["mac-address"])
):
print "wired invalid mac address"
return False
if "cloned-mac-address" in info_dict["802-3-ethernet"].keys():
if not TypeConvert.is_valid_mac_address(
TypeConvert.mac_address_array2string(info_dict["802-3-ethernet"]["mac-address"])
):
print "wired invalid clone mac address"
return False
if "duplex" in info_dict["802-3-ethernet"].keys():
if info_dict["802-3-ethernet"]["duplex"] not in ["full", "half"]:
print "wired invalid duplex"
return False
return True
示例2: cloned_mac_address
# 需要导入模块: from nmlib.nm_utils import TypeConvert [as 别名]
# 或者: from nmlib.nm_utils.TypeConvert import mac_address_array2string [as 别名]
def cloned_mac_address(self):
if "cloned-mac-address" in self.prop_dict.iterkeys():
return TypeConvert.mac_address_array2string(self.prop_dict["cloned-mac-address"])
示例3: bssid
# 需要导入模块: from nmlib.nm_utils import TypeConvert [as 别名]
# 或者: from nmlib.nm_utils.TypeConvert import mac_address_array2string [as 别名]
def bssid(self):
if "bssid" in self.prop_dict.iterkeys():
return TypeConvert.mac_address_array2string(self.prop_dict["bssid"])
示例4: is_wireless_setting_ok
# 需要导入模块: from nmlib.nm_utils import TypeConvert [as 别名]
# 或者: from nmlib.nm_utils.TypeConvert import mac_address_array2string [as 别名]
def is_wireless_setting_ok(self, info_dict):
if info_dict["connection"]["type"] != "802-11-wireless":
return False
else:
if not self.check_conn_setting(info_dict):
return False
if not self.check_ip4_setting(info_dict):
return False
if "802-11-wireless" not in info_dict.keys():
print "missing 802-11-wireless setting "
return False
if len(info_dict["802-11-wireless"]["ssid"]) == 0:
print "wireless invalid ssid"
return False
if "mode" in info_dict["802-11-wireless"].keys():
if info_dict["802-11-wireless"]["mode"] not in ["infrastructure", "ad-hoc", "ap"]:
print "wireless invalid mode"
return False
if "mac-address" in info_dict["802-11-wireless"].keys():
if not TypeConvert.is_valid_mac_address(
TypeConvert.mac_address_array2string(info_dict["802-11-wireless"]["mac-address"])
):
print "wireless invalid mac address"
return False
if "802-11-wireless-security" in info_dict.iterkeys():
if info_dict["802-11-wireless-security"]["key-mgmt"] == "none":
####wep
if "wep-tx-keyidx" in info_dict["802-11-wireless-security"].iterkeys():
if info_dict["802-11-wireless-security"]["wep-tx-keyidx"] == 0:
if not info_dict["802-11-wireless-security"]["wep-key0"]:
print "wireless invalid wep-key0"
return False
elif info_dict["802-11-wireless-security"]["wep-tx-keyidx"] == 1:
if not info_dict["802-11-wireless-security"]["wep-key1"]:
print "wireless invalid wep-key1"
return False
elif info_dict["802-11-wireless-security"]["wep-tx-keyidx"] == 2:
if not info_dict["802-11-wireless-security"]["wep-key2"]:
print "wireless invalid wep-key2"
return False
elif info_dict["802-11-wireless-security"]["wep-tx-keyidx"] == 3:
if not info_dict["802-11-wireless-security"]["wep-key3"]:
print "wireless invalid wep-key3"
return False
else:
print "wireless invalid wep tx keyidx"
return False
else:
if not info_dict["802-11-wireless-security"]["wep-key0"]:
print "wireless invalid wep-key0"
return False
###psk
elif info_dict["802-11-wireless-security"]["key-mgmt"] == "wpa-psk":
if not info_dict["802-11-wireless-security"]["psk"]:
print "wireless invalid psk"
return False
elif info_dict["802-11-wireless-security"]["key-mgmt"] == "ieee8021x":
print "wireless currently doesn't support ieee8021x"
return False
elif info_dict["802-11-wireless-security"]["key-mgmt"] == "wpa-eap":
print "wireless currently not support wpa-eap"
return False
else:
print "wireless invalid security method"
return False
return True