def get_node_properties( self, node_name ): """ Heckle Glossary Function gets all the properties of one node """ #hwlist = heckle_list_hardware(session, name=node_name) #Use if it worked... #return hwlist['properties'] # logger.debug("HICCUP: get_node_properties &&&&&&&&&&&&") props = [] self.session.expire_all() hwlist = heckle_list_hardware( self.session ) for element in hwlist: if node_name in element['nodes']: props = element['properties'] continue props.update(heckle_list_node(self.session, name=node_name)[0]) return props
def get_node_properties( self, node_name ): """ Heckle Glossary Function gets all the properties of one node """ #hwlist = list_hardware(session, name=node_name) #Use if it worked... #return hwlist['properties'] logstr = "HICCUP:get_node_properties:" # LOGGER.debug("HICCUP:get_node_properties &&&&&&&&&&&&") self.session.expire_all() if node_name in self.node_list: properties = heckle_list_node( session=self.session, name=node_name )[0] properties.update( heckle_list_hardware( session=self.session, name=properties['hardware'] )[0] ) properties['mac'] = properties['mac'].replace('-',':') properties['mac'] = ( properties['mac'].upper() ) return properties else: raise Exception( logstr + "No node %s recognized" % node_name )
def get_glossary( self ): """ Heckle Glossary Function gets a basic glossary of all the hardware_criteria gets list of all nodes, all hardware """ nodelist = self.list_all_nodes() hwlist = heckle_list_hardware(self.session) propdict = {} for name in nodelist: for element in hwlist: if name in element['nodes']: for prop in element['properties']: val = element['properties'][prop][0] if prop not in propdict.keys(): propdict[prop]=[] if val not in propdict[prop]: propdict[prop].append( val ) return propdict