示例#1
0
 def _get_one_interface(self, p_interface_name):
     """ Gather the information about a single interface given the interface name.
     Only UP interfaces return data, apparently,
     """
     l_interface = NodeInterfaceData()
     l_interface.Name = p_interface_name
     # l_interface.Active = True
     l_interface.Key = 0
     l_interface.UUID = toolUuid.create_uuid(
     )  # We need a way to persist the UUID instead of this
     l_interface.NodeInterfaceType = 'Other'
     l_afList = Interfaces()._find_addr_lists(p_interface_name)
     for l_afID in l_afList.keys():
         l_v4 = []
         l_v6 = []
         l_afName = Interfaces()._find_addr_family_name(l_afID)
         if l_afName == 'AF_PACKET':
             l_interface.MacAddress = l_afList[l_afID]
         if l_afName == 'AF_INET':
             l_v4 = Interfaces()._get_address_list_INET(l_afList[l_afID])
             l_interface.V4Address = l_v4
         if l_afName == 'AF_INET6':
             l_v6 = Interfaces()._get_address_list_INET(l_afList[l_afID])
             l_interface.V6Address = l_v6
     return l_interface, l_v4, l_v6
示例#2
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_interface_obj = NodeInterfaceData()
     self.m_node_obj = NodeData()