Пример #1
0
 def create_computer(_p_pyhouse_obj):
     l_xml = ComputerInformation()
     l_xml.Name = platform.node()
     l_xml.Key = 0
     l_xml.Active = True
     l_xml.UUID = Uuid.create_uuid()
     LOG.warn('Created a new UUID for computer!')
     return l_xml
Пример #2
0
 def get_uuid_from_xml(p_xml, p_name):
     """
     UUIDs are always an element.
     """
     l_xml = XML.get_any_field(p_xml, p_name)
     if l_xml is None or len(l_xml) != 36:
         l_xml = Uuid.create_uuid()
         LOG.error(
             "A valid UUID was not found for {} - generating a new one. {}".
             format(p_name, l_xml))
     return l_xml
Пример #3
0
 def _get_one_interface(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()
     l_interface.NodeInterfaceType = 'Other'
     l_afList = Interfaces._find_addr_lists(p_interface_name)
     for l_afID in l_afList.iterkeys():
         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_INET6(l_afList[l_afID])
             l_interface.V6Address = l_v6
     return l_interface, l_v4, l_v6