"""This profile demonstrates a *parameterized profile* that allows you to select one of several standard OS images for your nodes. When you instantiate this profile, you will be asked to select the OS via a drop down menu. Instructions: Click on any node in the topology and choose the `shell` menu item.""" # Import the Portal object. import geni.portal as portal # Import the ProtoGENI library. import geni.rspec.pg as pg # Create a portal context, needed to defined parameters pc = portal.Context() # Create a Request object to start building the RSpec. request = pc.makeRequestRSpec() # # This is a typical list of images. # imageList = [ ('urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU18-64-STD', 'UBUNTU 18.04'), ('urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU16-64-STD', 'UBUNTU 16.04'), ('urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU20-64-STD', 'UBUNTU 20.04'), ('urn:publicid:IDN+emulab.net+image+emulab-ops//CENTOS7-64-STD', 'CENTOS 7'), ('urn:publicid:IDN+emulab.net+image+emulab-ops//FBSD113-64-STD', 'FreeBSD 11.3')] # Define a single parameter for the instantiation page. pc.defineParameter("osImage", "Select OS image", portal.ParameterType.IMAGE, imageList[0], imageList, longDescription="Most clusters have this set of images, " + "pick your favorite one.") # Retrieve the values the user specifies during instantiation. params = pc.bindParameters() # Add a raw PC to the request and set the disk image. node = request.RawPC("node") node.disk_image = params.osImage # Print the RSpec to the enclosing page. pc.printRequestRSpec(request)