Esempio n. 1
0
 def add_node(p_pyhouse_obj, p_message_obj):
     """ Add node (or update if alreeady present).
     @param p_message_obj: is a decoded json message containing node information
     """
     l_nodes = p_pyhouse_obj.Computer.Nodes
     l_uuid = p_message_obj['UUID']
     l_name = p_message_obj['Name']
     l_now = datetime.datetime.now()
     if l_uuid in l_nodes:
         LOG.info('Node already present {} '.format(l_name))
         p_pyhouse_obj.Computer.Nodes[l_uuid].LastUpdate = l_now
     else:
         LOG.info('Node not present - Adding. {}  {}'.format(l_uuid, l_name))
         l_obj = NodeData()
         l_obj.Name = l_name
         l_obj.Key = l_uuid
         l_obj.Active = p_message_obj['Active']
         l_obj.Comment = p_message_obj['Comment']
         l_obj.ConnectionAddr_IPv4 = p_message_obj['ConnectionAddr_IPv4']
         l_obj.ConnectionAddr_IPv6 = p_message_obj['ConnectionAddr_IPv6']
         l_obj.ControllerCount = p_message_obj['ControllerCount']
         l_obj.ControllerTypes = p_message_obj['ControllerTypes']
         l_obj.NodeId = p_message_obj['NodeId']
         l_obj.NodeRole = p_message_obj['NodeRole']
         l_obj.LastUpdate = l_now
         l_obj.UUID = l_uuid
         p_pyhouse_obj.Computer.Nodes[l_uuid] = l_obj
     LOG.info('Contains {} Nodes'.format(len(p_pyhouse_obj.Computer.Nodes)))
Esempio n. 2
0
 def add_node(p_pyhouse_obj, p_message_obj):
     """ Add node (or update if alreeady present).
     @param p_message_obj: is a decoded json message containing node information
     """
     l_nodes = p_pyhouse_obj.Computer.Nodes
     l_uuid = p_message_obj['UUID']
     l_name = p_message_obj['Name']
     l_now = datetime.datetime.now()
     if l_uuid in l_nodes:
         LOG.info('Node already present {} '.format(l_name))
         p_pyhouse_obj.Computer.Nodes[l_uuid].LastUpdate = l_now
     else:
         LOG.info('Node not present - Adding. {}  {}'.format(
             l_uuid, l_name))
         l_obj = NodeData()
         l_obj.Name = l_name
         l_obj.Key = l_uuid
         l_obj.Active = p_message_obj['Active']
         l_obj.Comment = p_message_obj['Comment']
         l_obj.ConnectionAddr_IPv4 = p_message_obj['ConnectionAddr_IPv4']
         l_obj.ConnectionAddr_IPv6 = p_message_obj['ConnectionAddr_IPv6']
         l_obj.ControllerCount = p_message_obj['ControllerCount']
         l_obj.ControllerTypes = p_message_obj['ControllerTypes']
         l_obj.NodeId = p_message_obj['NodeId']
         l_obj.NodeRole = p_message_obj['NodeRole']
         l_obj.LastUpdate = l_now
         l_obj.UUID = l_uuid
         p_pyhouse_obj.Computer.Nodes[l_uuid] = l_obj
     LOG.info('Contains {} Nodes'.format(len(p_pyhouse_obj.Computer.Nodes)))
Esempio n. 3
0
 def _extract_node(self, p_message):
     l_node = NodeData()
     l_node.Name = self._get_field(p_message, 'Name')
     l_node.Key = l_node.Name
     l_node.Active = True
     l_node.Comment = ''
     l_node.ConnectionAddr_IPv4 = self._get_field(p_message, 'ConnectionAddr_IPv4')
     l_node.ConnectionAddr_IPv6 = self._get_field(p_message, 'ConnectionAddr_IPv6')
     l_node.ControllerCount = self._get_field(p_message, 'ControllerCount')
     l_node.ControllerTypes = self._get_field(p_message, 'ControllerTypes')
     l_node.NodeId = self._get_field(p_message, 'NodeId')
     l_node.NodeRole = self._get_field(p_message, 'NodeRole')
Esempio n. 4
0
 def _extract_node(self, p_message):
     l_node = NodeData()
     l_node.Name = self._get_field(p_message, 'Name')
     l_node.Key = l_node.Name
     l_node.Active = True
     l_node.Comment = ''
     l_node.ConnectionAddr_IPv4 = self._get_field(p_message,
                                                  'ConnectionAddr_IPv4')
     l_node.ConnectionAddr_IPv6 = self._get_field(p_message,
                                                  'ConnectionAddr_IPv6')
     l_node.ControllerCount = self._get_field(p_message, 'ControllerCount')
     l_node.ControllerTypes = self._get_field(p_message, 'ControllerTypes')
     l_node.NodeId = self._get_field(p_message, 'NodeId')
     l_node.NodeRole = self._get_field(p_message, 'NodeRole')