當前位置: 首頁>>代碼示例>>Python>>正文


Python Interface.getMAC方法代碼示例

本文整理匯總了Python中model.hosts.Interface.getMAC方法的典型用法代碼示例。如果您正苦於以下問題:Python Interface.getMAC方法的具體用法?Python Interface.getMAC怎麽用?Python Interface.getMAC使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在model.hosts.Interface的用法示例。


在下文中一共展示了Interface.getMAC方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_interface_serialization

# 需要導入模塊: from model.hosts import Interface [as 別名]
# 或者: from model.hosts.Interface import getMAC [as 別名]
 def test_interface_serialization(self):
     iface = Interface(name="192.168.10.168", mac="01:02:03:04:05:06")
     iface.setDescription("Some description")
     iface.setOwned(True)
     iface.addHostname("www.test.com")
     iface.setIPv4({
         "address": "192.168.10.168",
         "mask": "255.255.255.0",
         "gateway": "192.168.10.1",
         "DNS": "192.168.10.1"
     })
     iface.setPortsOpened(2)
     iface.setPortsClosed(3)
     iface.setPortsFiltered(4)
     iserialized = self.imapper.serialize(iface)
     # if serialization fails, returns None
     self.assertNotEqual(
         iserialized,
         None,
         "Serialized interface shouldn't be None")
     # we check the interface attributes
     self.assertEquals(
         iserialized.get("_id"),
         iface.getID(),
         "Serialized ID is not the same as Interface ID")
     self.assertEquals(
         iserialized.get("name"),
         iface.getName(),
         "Serialized name is not the same as Interface name")
     self.assertEquals(
         iserialized.get("mac"),
         iface.getMAC(),
         "Serialized MAC is not the same as Interface MAC")
     self.assertEquals(
         iserialized.get("network_segment"),
         iface.getNetworkSegment(),
         "Serialized Network Segment is not the same as Interface Network Segment")
     self.assertEquals(
         iserialized.get("description"),
         iface.getDescription(),
         "Serialized description is not the same as Interface description")
     self.assertEquals(
         iserialized.get("owned"),
         iface.isOwned(),
         "Serialized owned flag is not the same as Interface owned flag")
開發者ID:BwRy,項目名稱:faraday,代碼行數:47,代碼來源:mapper.py


注:本文中的model.hosts.Interface.getMAC方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。