xrn = PlXrn(xrn=urn)
if xrn.type == 'sliver':
# id: slice_id-node_id
- id_parts = xrn.leaf.split('-')
- slice_ids.add(id_parts[0])
- node_ids.append(id_parts[1])
+ sliver_id_parts = xrn.get_sliver_id_parts()
+ slice_ids.add(int(sliver_id_parts[0]))
+ node_ids.append(int(sliver_id_parts[1]))
else:
names.add(xrn.pl_slicename())
- if xrn.id:
- ids.add(xrn.id)
filter = {}
if names:
return []
slice = slices[0]
if node_ids:
+ node_ids = [node_id for node_id in node_ids if node_id in slice['node_ids']]
slice['node_ids'] = node_ids
tags_dict = self.get_slice_tags(slice)
nodes_dict = self.get_slice_nodes(slice, options)
interface['client_id'] = "%s:%s" % (node['node_id'], if_id)
rspec_node['interfaces'].append(interface)
if_count+=1
- tags = [PLTag(node_tags[tag_id]) for tag_id in node['node_tag_ids']]
+ tags = [PLTag(node_tags[tag_id]) for tag_id in node['node_tag_ids'] if tag_id in node_tags]
rspec_node['tags'] = tags
return rspec_node
rspec.xml.set('expires', rspec_expires)
# lookup the sliver allocations
+ geni_urn = None
sliver_ids = [sliver['sliver_id'] for sliver in slivers]
constraint = SliverAllocation.sliver_id.in_(sliver_ids)
sliver_allocations = dbsession.query(SliverAllocation).filter(constraint)
sliver_allocation_dict = {}
for sliver_allocation in sliver_allocations:
+ if not geni_urn:
+ geni_urn = sliver_allocation.slice_urn
sliver_allocation_dict[sliver_allocation.sliver_id] = sliver_allocation
if not options.get('list_leases') or options['list_leases'] != 'leases':
rspec.version.add_leases(leases)
- return {'geni_urn': urns[0],
+ return {'geni_urn': geni_urn,
'geni_rspec': rspec.toxml(),
'geni_slivers': geni_slivers}