Commit e83684d0 authored by Simon Redman's avatar Simon Redman

Allow defining node hardware type

parent 6cfc8b42
......@@ -9,6 +9,9 @@ import geni.rspec.igext as igext
pc = portal.Context()
pc.defineParameter("osNodeType", "Hardware Type",
portal.ParameterType.NODETYPE, "",
longDescription="A specific hardware type to use for each node. Cloudlab clusters all have machines of specific types. When you set this field to a value that is a specific hardware type, you will only be able to instantiate this profile on clusters with machines of that type. If unset, when you instantiate the profile, the resulting experiment may have machines of any available type allocated.")
pc.defineParameter(name="ovs_name",
description="Base name for the edge OVS switches",
typ=portal.ParameterType.STRING,
......@@ -30,8 +33,6 @@ ovs_disk_image = 'urn:publicid:IDN+emulab.net+image+SafeEdge:SRV6-OVS'
request = pc.makeRequestRSpec()
node_constructor = request.RawPC
def connectNodes(request, node1, node2):
"""
......@@ -47,20 +48,26 @@ def connectNodes(request, node1, node2):
LAN.addInterface(node2_interface)
def node_constructor(hardware_type, *args, **kwargs):
node = request.RawPC(*args, **kwargs)
node.hardware_type = hardware_type
return node
# Build Domain A
CB = node_constructor("CB")
CB = node_constructor(params.osNodeType, "CB")
CB.disk_image = router_disk_image
N08 = node_constructor("N08")
N08 = node_constructor(params.osNodeType, "N08")
N08.disk_image = router_disk_image
N02 = node_constructor("N02")
N02 = node_constructor(params.osNodeType, "N02")
N02.disk_image = router_disk_image
N07 = node_constructor("N07")
N07 = node_constructor(params.osNodeType, "N07")
N07.disk_image = router_disk_image
N10 = node_constructor("N10")
N10 = node_constructor(params.osNodeType, "N10")
N10.disk_image = router_disk_image
# Interconnect Domain A
......@@ -79,15 +86,14 @@ for node in (N08, N07):
# Add the extra nodes to Domain A
# There should be a "services" node, but I have run out of physical interfaces for the CB router...
CB_ovs = node_constructor("{prefix}_CB".format(prefix=params.ovs_name))
CB_ovs = node_constructor(params.osNodeType, "{prefix}_CB".format(prefix=params.ovs_name))
CB_ovs.disk_image = ovs_disk_image
connectNodes(request, CB, CB_ovs)
CB_host = node_constructor("{prefix}_CB".format(prefix=params.host_name))
CB_host = node_constructor(params.osNodeType, "{prefix}_CB".format(prefix=params.host_name))
CB_host.disk_image = router_disk_image
connectNodes(request, CB_host, CB_ovs)
pc.printRequestRSpec(request)
\ No newline at end of file
pc.printRequestRSpec(request)
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