Commit 19e12abd authored by Simon Redman's avatar Simon Redman

Initial commit of real-world test profile

parents
.idea/
env/
#!/usr/bin/env python2
"""
This is an Emulab profile which models the real-world tests to be run in Summer 2018
"""
import geni.portal as portal
import geni.rspec.pg as pg
import geni.rspec.igext as igext
pc = portal.Context()
pc.defineParameter(name="ovs_name",
description="Base name for the edge OVS switches",
typ=portal.ParameterType.STRING,
defaultValue="ovs")
pc.defineParameter(name="host_name",
description="Base name for the host nodes",
typ=portal.ParameterType.STRING,
defaultValue="host")
params = pc.bindParameters()
image_urn = 'utah.cloudlab.us'
image_project = 'cs6480-2017-cl' # I need to move this to the Safeedge emulab project...
image_os = 'Ubuntu_16.04.04'
image_tag = 'FRR'
router_disk_image = 'urn:publicid:IDN+{urn}+image+{proj}-PG0:{os}_{tag}'.format(urn=image_urn, proj=image_project, os=image_os, tag=image_tag)
ovs_disk_image = 'urn:publicid:IDN+emulab.net+image+SafeEdge:SRV6-OVS'
request = pc.makeRequestRSpec()
node_constructor = request.RawPC
def connectNodes(request, node1, node2):
"""
Build an anonymous LAN to connect two nodes
"""
node1_name = node1.client_id
node2_name = node2.client_id
LAN = request.LAN("{n1}-{n2}".format(n1=node1_name, n2=node2_name))
node1_interface = node1.addInterface("{n1}-{n2}".format(n1=node1_name, n2=node2_name))
node2_interface = node2.addInterface("{n2}-{n1}".format(n1=node1_name, n2=node2_name))
LAN.addInterface(node1_interface)
LAN.addInterface(node2_interface)
# Build Domain A
CO = node_constructor("CO")
CO.disk_image = router_disk_image
N11 = node_constructor("N11")
N11.disk_image = router_disk_image
N09 = node_constructor("N09")
N09.disk_image = router_disk_image
N12 = node_constructor("N12")
N12.disk_image = router_disk_image
N05 = node_constructor("N05")
N05.disk_image = router_disk_image
# Interconnect Domain A
# N11 and N12 are handled implicitly by the other connections
# Connect CO
for node in (N11, N09, N12):
connectNodes(request, CO, node)
# Connect N9
for node in (N11, N12, N05):
connectNodes(request, N09, node)
# Connect N5
for node in (N11, N12):
connectNodes(request, N05, node)
# Add the extra nodes to Domain A
# There should be a "services" node, but I have run out of physical interfaces for the CO router...
CO_ovs = node_constructor("{prefix}_CO".format(prefix=params.ovs_name))
CO_ovs.disk_image = ovs_disk_image
connectNodes(request, CO, CO_ovs)
CO_host = node_constructor("{prefix}_CO".format(prefix=params.host_name))
CO_host.disk_image = router_disk_image
connectNodes(request, CO_host, CO_ovs)
pc.printRequestRSpec(request)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment