Commit 2d56f123 authored by Leigh Stoller's avatar Leigh Stoller

Add new file

parent ea209f00
"""Spectrum testing
# Import the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
import as pg
# Emulab specific extensions.
import geni.rspec.emulab as emulab
# Spectrum specific extensions.
import geni.rspec.emulab.spectrum as spectrum
# Create a portal context, needed to defined parameters
pc = portal.Context()
# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()
# Request a specific node that we know has a radio.
pc.defineParameter("node_id", "Node ID",
portal.ParameterType.STRING, "nuc2")
# And a specific interface on that node,
pc.defineParameter("iface", "Interface",
portal.ParameterType.STRING, "rf0")
imageList = [
('default', 'Default Image'),
('', 'UBUNTU 18.04'),
('', 'UBUNTU 16.04'),
('', 'CENTOS 7'),
('', 'FreeBSD 11.2')]
pc.defineParameter("osImage", "Select OS 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()
# Check parameter validity.
if params.node_id.strip() == "":
pc.reportError(portal.ParameterError("You must specify a node.", ["node_id"]))
if params.iface.strip() == "":
pc.reportError(portal.ParameterError("You must specify an interface.", ["iface"]))
# Throw the errors back to the user.
# Add a raw PC to the request
node = request.RawPC("node")
if params.osImage and params.osImage != "default":
node.disk_image = params.osImage
node.component_id = params.node_id
# Request spectrum to use on a specific interface on the node. In MHZ
iface = node.addInterface("rf")
iface.component_id = params.iface
# First arg is frequency low bound, second is high bound, third is max power.
iface.requestSpectrum(902, 904, -10)
# Request to use spectrum on any TX devices attached to the node.
node.requestSpectrum(5725, 5730, 5.5)
node.requestSpectrum(5740, 5750, -30)
# Request spectrum to use across the all nodes in the experiment.
request.requestSpectrum(2400, 2410, -20)
# Print the RSpec to the enclosing page.
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