geni-lib-two-vm-lan.py 690 Bytes
Newer Older
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
"""An example of constructing a profile with two VMs connected by a LAN.

Instructions:
Wait for the profile instance to start, and then log in to either VM via the
ssh ports specified below.
"""

import geni.portal as portal
import geni.rspec.pg as rspec

request = portal.context.makeRequestRSpec()

# Create two XenVM nodes.
node1 = request.XenVM("node1")
node2 = request.XenVM("node2")

# Create interfaces for each node.
iface1 = node1.addInterface("if1")
iface2 = node2.addInterface("if2")

# Create a link with the type of LAN.
link = request.LAN("lan")

# Add both node interfaces to the link.
link.addInterface(iface1)
link.addInterface(iface2)

portal.context.printRequestRSpec()