"""This profile allocates two bare metal nodes and connects them together with a link. We specify that the link be *shaped*, setting the bandwidth, latency, and packet loss for the link. Instructions: Click on any node in the topology and choose the `shell` menu item. When your shell window appears, use `ping` to test the link.""" # Import the Portal object. import geni.portal as portal # Import the ProtoGENI library. import geni.rspec.pg as pg # Create a portal context. pc = portal.Context() # Create a Request object to start building the RSpec. request = pc.makeRequestRSpec() # Add a raw PC to the request and give it an interface. node1 = request.RawPC("node1") iface1 = node1.addInterface() # Specify the IPv4 address iface1.addAddress(pg.IPv4Address("192.168.1.1", "255.255.255.0")) # Add another raw PC to the request and give it an interface. node2 = request.RawPC("node2") iface2 = node2.addInterface() # Specify the IPv4 address iface2.addAddress(pg.IPv4Address("192.168.1.2", "255.255.255.0")) # Add a link to the request and then add the interfaces to the link link = request.Link("link") link.addInterface(iface1) link.addInterface(iface2) # Specify duplex parameters for each of the nodes in the link (or lan). # BW is in Kbps link.bandwidth = 110000 # Latency is in milliseconds link.latency = 10 # Packet loss is a number 0.0 <= loss <= 1.0 link.plr = 0.05 # Print the RSpec to the enclosing page. pc.printRequestRSpec(request)