-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcloudlab.profile
62 lines (52 loc) · 2.17 KB
/
cloudlab.profile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""For Nu."""
# Import the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
import geni.rspec.pg as pg
# Import the Emulab specific extensions.
import geni.rspec.emulab as emulab
# Describe the parameter(s) this profile script can accept.
portal.context.defineParameter("n", "Number of Machines", portal.ParameterType.INTEGER, 8)
portal.context.defineParameter("node_type", "Node Type", portal.ParameterType.STRING, "c6525-100g")
portal.context.defineParameter("link_0_bw", "The bandwidth (GB/s) of link 0", portal.ParameterType.INTEGER, 25)
portal.context.defineParameter("link_1_bw", "The bandwidth (GB/s) of link 1", portal.ParameterType.INTEGER, 100)
portal.context.defineParameter("no_inter_switch", "Avoid interswitch links", portal.ParameterType.BOOLEAN, False)
# Retrieve the values the user specifies during instantiation.
params = portal.context.bindParameters()
# Create a portal object,
pc = portal.Context()
# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()
nodes = []
ifaces_0 = []
ifaces_1 = []
for i in range(0, params.n):
n = request.RawPC('node-%d' % i)
n.routable_control_ip = True
n.hardware_type = params.node_type
n.disk_image = 'urn:publicid:IDN+utah.cloudlab.us+image+shenango-PG0//nu'
nodes.append(n)
iface_0 = n.addInterface('interface-%d' % (2 * i), pg.IPv4Address('10.10.1.%d' % (i + 1),'255.255.255.0'))
iface_0.bandwidth = params.link_0_bw * 1000000
ifaces_0.append(iface_0)
iface_1 = n.addInterface('interface-%d' % (2 * i + 1), pg.IPv4Address('10.10.2.%d' % (i + 1),'255.255.255.0'))
iface_1.bandwidth = params.link_1_bw * 1000000
ifaces_1.append(iface_1)
# link 0
link_0 = request.Link('link-0')
link_0.Site('undefined')
link_0.bandwidth = params.link_0_bw * 1000000
if params.no_inter_switch:
link_0.setNoInterSwitchLinks()
for iface in ifaces_0:
link_0.addInterface(iface)
# link 1
link_1 = request.Link('link-1')
link_1.Site('undefined')
link_1.bandwidth = params.link_1_bw * 1000000
if params.no_inter_switch:
link_1.setNoInterSwitchLinks()
for iface in ifaces_1:
link_1.addInterface(iface)
# Print the generated rspec
pc.printRequestRSpec(request)