|
| 1 | +"""Two 10-core servers connected by ConnectX-4 NIC for running AIFM.""" |
| 2 | + |
| 3 | +# Import the Portal object. |
| 4 | +import geni.portal as portal |
| 5 | +# Import the ProtoGENI library. |
| 6 | +import geni.rspec.pg as pg |
| 7 | +# Import the Emulab specific extensions. |
| 8 | +import geni.rspec.emulab as emulab |
| 9 | + |
| 10 | +# Describe the parameter(s) this profile script can accept. |
| 11 | +portal.context.defineParameter( "n", "Number of Machines", portal.ParameterType.INTEGER, 2 ) |
| 12 | + |
| 13 | +# Retrieve the values the user specifies during instantiation. |
| 14 | +params = portal.context.bindParameters() |
| 15 | + |
| 16 | +# Create a portal object, |
| 17 | +pc = portal.Context() |
| 18 | + |
| 19 | +# Create a Request object to start building the RSpec. |
| 20 | +request = pc.makeRequestRSpec() |
| 21 | + |
| 22 | +nodes = [] |
| 23 | +ifaces = [] |
| 24 | + |
| 25 | +# nodes.append(node_0) |
| 26 | +# ifaces.append(iface0) |
| 27 | + |
| 28 | +for i in range(0, params.n): |
| 29 | + n = request.RawPC('node-%d' % i) |
| 30 | + n.routable_control_ip = True |
| 31 | + n.hardware_type = 'xl170' |
| 32 | + n.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU18-64-STD' |
| 33 | + bs = n.Blockstore('bs-%d' % i, "/home") |
| 34 | + bs.size = "400GB" |
| 35 | + intf = n.addInterface('interface-%d' % i, pg.IPv4Address('192.168.6.%d' % (i + 1),'255.255.255.0')) |
| 36 | + nodes.append(n) |
| 37 | + ifaces.append(intf) |
| 38 | + |
| 39 | + |
| 40 | +# Link link-0 |
| 41 | +link_0 = request.LAN('link-0') |
| 42 | +link_0.best_effort = False |
| 43 | +link_0.bandwidth = 25000000 |
| 44 | +link_0.setNoInterSwitchLinks() |
| 45 | +link_0.Site('undefined') |
| 46 | +for iface in ifaces: |
| 47 | + link_0.addInterface(iface) |
| 48 | + |
| 49 | +# Print the generated rspec |
| 50 | +pc.printRequestRSpec(request) |
0 commit comments