iface['interface_id'] = interface['interface_id']
iface['node_id'] = interface['node_id']
iface['ipv4'] = interface['ip']
- iface['bwlimit'] = str(int(interface['bwlimit'])/1000)
+ if interface['bwlimit']:
+ iface['bwlimit'] = str(int(interface['bwlimit'])/1000)
interfaces[iface['interface_id']] = iface
return interfaces
# get hrns
site1_hrn = self.api.hrn + '.' + site1['login_base']
site2_hrn = self.api.hrn + '.' + site2['login_base']
- # get the first node
- node1 = self.nodes[site1['node_ids'][0]]
- node2 = self.nodes[site2['node_ids'][0]]
-
- # set interfaces
- # just get first interface of the first node
- if1_xrn = PlXrn(auth=self.api.hrn, interface='node%s:eth0' % (node1['node_id']))
- if1_ipv4 = self.interfaces[node1['interface_ids'][0]]['ip']
- if2_xrn = PlXrn(auth=self.api.hrn, interface='node%s:eth0' % (node2['node_id']))
- if2_ipv4 = self.interfaces[node2['interface_ids'][0]]['ip']
-
- if1 = Interface({'component_id': if1_xrn.urn, 'ipv4': if1_ipv4} )
- if2 = Interface({'component_id': if2_xrn.urn, 'ipv4': if2_ipv4} )
-
- # set link
- link = Link({'capacity': '1000000', 'latency': '0', 'packet_loss': '0', 'type': 'ipv4'})
- link['interface1'] = if1
- link['interface2'] = if2
- link['component_name'] = "%s:%s" % (site1['login_base'], site2['login_base'])
- link['component_id'] = PlXrn(auth=self.api.hrn, interface=link['component_name']).get_urn()
- link['component_manager_id'] = hrn_to_urn(self.api.hrn, 'authority+am')
- links[link['component_name']] = link
+
+ for s1_node in self.nodes[site1['node_ids']]:
+ for s2_node in self.nodes[site2['node_ids']]:
+ # set interfaces
+ # just get first interface of the first node
+ if1_xrn = PlXrn(auth=self.api.hrn, interface='node%s:eth0' % (s1_node['node_id']))
+ if1_ipv4 = self.interfaces[node1['interface_ids'][0]]['ip']
+ if2_xrn = PlXrn(auth=self.api.hrn, interface='node%s:eth0' % (s2_node['node_id']))
+ if2_ipv4 = self.interfaces[node2['interface_ids'][0]]['ip']
+
+ if1 = Interface({'component_id': if1_xrn.urn, 'ipv4': if1_ipv4} )
+ if2 = Interface({'component_id': if2_xrn.urn, 'ipv4': if2_ipv4} )
+
+ # set link
+ link = Link({'capacity': '1000000', 'latency': '0', 'packet_loss': '0', 'type': 'ipv4'})
+ link['interface1'] = if1
+ link['interface2'] = if2
+ link['component_name'] = "%s:%s" % (site1['login_base'], site2['login_base'])
+ link['component_id'] = PlXrn(auth=self.api.hrn, interface=link['component_name']).get_urn()
+ link['component_manager_id'] = hrn_to_urn(self.api.hrn, 'authority+am')
+ links[link['component_name']] = link
return links
rspec_node['authority_id'] = hrn_to_urn(PlXrn.site_hrn(self.api.hrn, site['login_base']), 'authority+sa')
rspec_node['boot_state'] = node['boot_state']
rspec_node['exclusive'] = 'False'
- rspec_node['hardware_types'].append(HardwareType({'name': 'plab-vserver'}))
+ rspec_node['hardware_types']= [HardwareType({'name': 'plab-pc'}),
+ HardwareType({'name': 'pc'})]
# only doing this because protogeni rspec needs
# to advertise available initscripts
rspec_node['pl_initscripts'] = pl_initscripts.values()
for if_id in node['interface_ids']:
interface = Interface(interfaces[if_id])
interface['ipv4'] = interface['ipv4']
- interface['component_id'] = PlXrn(auth=self.api.hrn, interface='node%s:eth%s' % (node['node_id'], if_count))
+ interface['component_id'] = PlXrn(auth=self.api.hrn, interface='node%s:eth%s' % (node['node_id'], if_count)).get_urn()
rspec_node['interfaces'].append(interface)
if_count+=1
# slivers always provide the ssh service
login = Login({'authentication': 'ssh-keys', 'hostname': node['hostname'], 'port':'22'})
service = Services({'login': login})
- rspec_node['services'].append(service)
+ rspec_node['services'] = [service]
rspec_nodes.append(rspec_node)
return rspec_nodes
slice, slivers = self.get_slice_and_slivers(slice_xrn)
rspec = RSpec(version=rspec_version, user_options=self.user_options)
- if slice and 'expiration_date' in slice:
- rspec.set('expires', epochparse(slice['expiration_date']))
+ if slice and 'expires' in slice:
+ rspec.xml.set('expires', epochparse(slice['expires']))
rspec.version.add_nodes(self.get_nodes(slice, slivers))
rspec.version.add_links(self.get_links(slice))