- for interface in interfaces:
- if 'floating_ips' in interface:
- for hostname in interface['floating_ips']:
- login = Login({'authentication': 'ssh-keys',
- 'hostname': hostname,
- 'port':'22', 'username': 'root'})
- service = Services({'login': login})
- rspec_node['services'].append(service)
+ rspec_node['interfaces'] = []
+ addresses = instance.addresses
+ # HACK: public ips are stored in the list of private, but
+ # this seems wrong. Assume pub ip is the last in the list of
+ # private ips until openstack bug is fixed.
+ if addresses.get('private'):
+ login = Login({'authentication': 'ssh-keys',
+ 'hostname': addresses.get('private')[-1]['addr'],
+ 'port':'22', 'username': 'root'})
+ service = Services({'login': login})
+ rspec_node['services'].append(service)
+
+ for private_ip in addresses.get('private', []):
+ if_xrn = PlXrn(auth=self.driver.hrn,
+ interface='node%s' % (instance.hostId))
+ if_client_id = Xrn(if_xrn.urn, type='interface', id="eth%s" %if_index).urn
+ interface = Interface({'component_id': if_xrn.urn,
+ 'client_id': if_client_id})
+ interface['ips'] = [{'address': private_ip['addr'],
+ #'netmask': private_ip['network'],
+ 'type': 'ipv%s' % str(private_ip['version'])}]
+ rspec_node['interfaces'].append(interface)
+
+ # slivers always provide the ssh service
+ for public_ip in addresses.get('public', []):
+ login = Login({'authentication': 'ssh-keys',
+ 'hostname': public_ip['addr'],
+ 'port':'22', 'username': 'root'})
+ service = Services({'login': login})
+ rspec_node['services'].append(service)