Ejemplo n.º 1
0
 def remove_slivers(xml, hostnames):
     for hostname in hostnames:
         nodes = Iotlabv1Node.get_nodes(xml, \
                                 {'component_id': '*%s*' % hostname})
         for node in nodes:
             slivers = Iotlabv1Sliver.get_slivers(node.element)
             for sliver in slivers:
                 node.element.remove(sliver.element)
Ejemplo n.º 2
0
 def remove_slivers(xml, hostnames):
     for hostname in hostnames:
         nodes = Iotlabv1Node.get_nodes(xml, \
                                 {'component_id': '*%s*' % hostname})
         for node in nodes:
             slivers = Iotlabv1Sliver.get_slivers(node.element)
             for sliver in slivers:
                 node.element.remove(sliver.element)
Ejemplo n.º 3
0
    def get_node_objs(node_elems):
        nodes = []
        for node_elem in node_elems:
            node = NodeElement(node_elem.attrib, node_elem)
            nodes.append(node)
            if 'component_id' in node_elem.attrib:
                node['authority_id'] = \
                    Xrn(node_elem.attrib['component_id']).get_authority_urn()

            # get hardware types
            hardware_type_elems = node_elem.xpath('./default:hardware_type | \
                                                            ./hardware_type')
            node['hardware_types'] = [hw_type.get_instance(HardwareType) \
                                            for hw_type in hardware_type_elems]

            # get location
            location_elems = node_elem.xpath('./default:location | ./location')
            locations = [location_elem.get_instance(Location) \
                                            for location_elem in location_elems]
            if len(locations) > 0:
                node['location'] = locations[0]


            # get interfaces
            iface_elems = node_elem.xpath('./default:interface | ./interface')
            node['interfaces'] = [iface_elem.get_instance(Interface) \
                                            for iface_elem in iface_elems]

            # get position
            position_elems = node_elem.xpath('./default:position | ./position')
            if position_elems:
                position_elem = position_elems[0]
                node['position'] = position_elem.get_instance(IotlabPosition)

            # get services
            #node['services'] = PGv2Services.get_services(node_elem)

            # get slivers
            node['slivers'] = Iotlabv1Sliver.get_slivers(node_elem)
            available_elems = node_elem.xpath('./default:available | \
                                                                ./available')
            if len(available_elems) > 0 and 'name' in available_elems[0].attrib:
                if available_elems[0].attrib.get('now', '').lower() == 'true':
                    node['boot_state'] = 'boot'
                else:
                    node['boot_state'] = 'disabled'

        logger.debug("SLABV1NODE \tget_nodes_objs  \
                                #nodes %s"%(nodes))
        return nodes
Ejemplo n.º 4
0
    def get_node_objs(node_elems):
        nodes = []
        for node_elem in node_elems:
            node = NodeElement(node_elem.attrib, node_elem)
            nodes.append(node)
            if 'component_id' in node_elem.attrib:
                node['authority_id'] = \
                    Xrn(node_elem.attrib['component_id']).get_authority_urn()

            # get hardware types
            hardware_type_elems = node_elem.xpath('./default:hardware_type | \
                                                            ./hardware_type')
            node['hardware_types'] = [hw_type.get_instance(HardwareType) \
                                            for hw_type in hardware_type_elems]

            # get location
            location_elems = node_elem.xpath('./default:location | ./location')
            locations = [location_elem.get_instance(Location) \
                                            for location_elem in location_elems]
            if len(locations) > 0:
                node['location'] = locations[0]


            # get interfaces
            iface_elems = node_elem.xpath('./default:interface | ./interface')
            node['interfaces'] = [iface_elem.get_instance(Interface) \
                                            for iface_elem in iface_elems]

            # get position
            position_elems = node_elem.xpath('./default:position | ./position')
            if position_elems:
                position_elem = position_elems[0]
                node['position'] = position_elem.get_instance(IotlabPosition)

            # get services
            #node['services'] = PGv2Services.get_services(node_elem)

            # get slivers
            node['slivers'] = Iotlabv1Sliver.get_slivers(node_elem)
            available_elems = node_elem.xpath('./default:available | \
                                                                ./available')
            if len(available_elems) > 0 and 'name' in available_elems[0].attrib:
                if available_elems[0].attrib.get('now', '').lower() == 'true':
                    node['boot_state'] = 'boot'
                else:
                    node['boot_state'] = 'disabled'

        logger.debug("SLABV1NODE \tget_nodes_objs  \
                                #nodes %s"%(nodes))
        return nodes