geni-lib-node-ips.py 1.15 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
"""An example of constructing a profile with node IP addresses specified
manually.

Instructions:
Wait for the profile instance to start, and then log in to either VM via the
ssh ports specified below.  (Note that even though the EXPERIMENTAL
data plane interfaces will use the addresses given in the profile, you
will still connect over the control plane interfaces using addresses
given by the testbed.  The data plane addresses are for intra-experiment
communication only.)
"""

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
import geni.portal as portal
import geni.rspec.pg as pg 

pc = portal.Context()
rspec = pg.Request()

node1 = pg.XenVM("node1")
iface1 = node1.addInterface("if1")

# Specify the component id and the IPv4 address
iface1.component_id = "eth1"
iface1.addAddress(pg.IPv4Address("192.168.1.1", "255.255.255.0"))

rspec.addResource(node1)

node2 = pg.XenVM("node2")
iface2 = node2.addInterface("if2")

# Specify the component id and the IPv4 address
iface2.component_id = "eth2"
iface2.addAddress(pg.IPv4Address("192.168.1.2", "255.255.255.0"))

rspec.addResource(node2)

link = pg.LAN("lan")

link.addInterface(iface1)
link.addInterface(iface2)

rspec.addResource(link)

44
pc.printRequestRSpec(rspec)