+ for node in nodes:
+ nodes_dict[node['node_id']] = node
+
+ rspec_nodes = []
+ for node in nodes:
+
+ node['hostname'] = hostname_to_hrn( self.driver.root_auth,node['site_login_base'], node['hostname'])
+ rspec_node = Node()
+
+ rspec_node['component_id'] = hostname_to_urn(self.driver.root_auth, node['site_login_base'], node['hostname'])
+ rspec_node['component_name'] = node['hostname']
+ rspec_node['component_manager_id'] = hrn_to_urn(self.driver.root_auth, 'authority+sa')
+ rspec_node['authority_id'] = hrn_to_urn(PlXrn.site_hrn(self.driver.root_auth, node['site_login_base']), 'authority+sa')
+ rspec_node['boot_state'] = node['boot_state']
+ if node['posx'] and node['posy']:
+ location = Location({'longitude':node['posx'], 'latitude': node['posy']})
+ rspec_node['location'] = location
+
+ rspec_node['exclusive'] = 'True'
+ rspec_node['hardware_types']= [HardwareType({'name': 'senslab sensor node'})]
+
+ rspec_node['interfaces'] = []
+
+
+ rspec_node['tags'] = []
+
+ rspec_nodes.append(rspec_node)
+ return (rspec_nodes)
+
+ def get_nodes_and_links(self, slice=None,slivers=[], options={}):
+ # NT: the semantic of this function is not clear to me :
+ # if slice is not defined, then all the nodes should be returned
+ # if slice is defined, we should return only the nodes that are part of this slice
+ # but what is the role of the slivers parameter ?
+ # So i assume that slice['node_ids'] will be the same as slivers for us
+ filter = {}
+ tags_filter = {}
+
+ if slice :
+ if 'node_ids' in slice and slice['node_ids']:
+ #first case, a non empty slice was provided
+ filter['hostname'] = slice['node_ids']
+ tags_filter=filter.copy()
+ nodes = self.driver.GetNodes(filter['hostname'])
+ else :
+ #second case, a slice was provided, but is empty
+ nodes={}
+ else :
+ #third case, no slice was provided
+ nodes = self.driver.GetNodes()
+
+ #geni_available = options.get('geni_available')
+ #if geni_available:
+ #filter['boot_state'] = 'boot'
+ print>>sys.stderr, "\r\n \r\n \t get_nodes_and_links filter %s \r\n \r\n \t slivers %s" %(filter, slivers)
+ #filter.update({'peer_id': None})
+ #nodes = self.driver.GetNodes(filter['hostname'])
+ #print>>sys.stderr, "\r\n \r\n \t get_nodes_and_links nodes %s" %(nodes)
+
+ #site_ids = []
+ #interface_ids = []
+ #tag_ids = []
+ nodes_dict = {}