def verify_slice_nodes(self, slice_urn, slice, rspec_nodes):
slivers = {}
- for node in rspec_nodes:
- hostname = node.get('component_name')
- client_id = node.get('client_id')
- component_id = node.get('component_id').strip()
- if hostname:
- hostname = hostname.strip()
- elif component_id:
- hostname = xrn_to_hostname(component_id)
- if hostname:
- slivers[hostname] = {
- 'client_id': client_id, 'component_id': component_id}
+ try:
+ for node in rspec_nodes:
+ hostname = node.get('component_name')
+ client_id = node.get('client_id')
+ component_id = node.get('component_id').strip()
+ if hostname:
+ hostname = hostname.strip()
+ elif component_id:
+ hostname = xrn_to_hostname(component_id)
+ if hostname:
+ slivers[hostname] = {
+ 'client_id': client_id, 'component_id': component_id}
+ # for r2lab and similar use cases
+ # the incoming rspec has no component_id, and
+ # since there's only one node in the whole testbed
+ # we can assume that's the one
+ # admittedly quite hacky, but this is intended temporary
+ # in an attempt to make progress on the fed4fire-r2lab federation link
+ except AttributeError:
+ all_nodes = self.driver.shell.GetNodes({},['hostname'])
+ if len(all_nodes) == 1:
+ hostname = all_nodes[0]['hostname']
+ component_id = Xrn(xrn=hostname).get_urn()
+ slivers[hostname] = dict(
+ client_id=client_id,
+ component_id=component_id)
nodes = self.driver.shell.GetNodes(
slice['node_ids'], ['node_id', 'hostname', 'interface_ids'])