def startInstance(nb, diskImg, instType, index, r=None, link=None): if r is None: r = rspec.Request() link = rspec.LAN("lan") for i in range(nb): node = rspec.RawPC("node" + str(i + index + 1)) node.disk_image = diskImg node.hardware_type = instType iface = node.addInterface("if" + str(index + i + 1)) # Specify the component id and the IPv4 address iface.component_id = "eth" + str(i + index + 1) iface.addAddress( rspec.IPv4Address("192.168.1." + str(index + i + 1), "255.255.255.0")) link.addInterface(iface) node.addService( rspec.Install( url= "https://github.com/neilgiri/hotstuff/archive/master.tar.gz", path="/users/giridhn")) node.addService( rspec.Execute( shell="bash", command= "sudo tar -C /users/giridhn -xvzf /users/giridhn/hotstuff-master.tar.gz ; sudo apt-get update ; sudo apt-get install --yes golang-go" )) r.addResource(node) return r, link
def create_request(_site, hw_type, num_nodes): for i in range(0, num_nodes): node = rspec.RawPC('node' + str(i)) node.disk_image = img node.hardware_type = hw_type if _site not in requests: requests[_site] = rspec.Request() requests[_site].addResource(node)
def create_request(site, hw_type): node = rspec.RawPC(hw_type) node.disk_image = img node.hardware_type = hw_type if site not in requests: requests[site] = rspec.Request() requests[site].addResource(node)
def Node(name, public): if params.raw: return RSpec.RawPC(name) else: vm = geni.rspec.igext.XenVM(name) vm.ram = params.mem if public: vm.routable_control_ip = True return vm
def Node( name, public ): if params.raw: return RSpec.RawPC( name ) elif public: vm = PublicVM( name ) return vm else: vm = geni.rspec.igext.XenVM( name ) return vm
def Node(name, public): if params.raw: return RSpec.RawPC(name) else: vm = request.XenVM(name) vm.ram = params.mem # vm.cores = params.core if public: vm.routable_control_ip = True return vm
def Node(name): node = RSpec.RawPC(name) # node.disk_image = "urn:publicid:IDN+apt.emulab.net+image+emulab-ops:UBUNTU14-64-STD" node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops//hadoop-276" # node.addService( RSpec.Install( "http://apache.cs.utah.edu/hadoop/common/hadoop-" + HADOOP_VERSION + "/hadoop-" + HADOOP_VERSION + "-bin.tar.gz", "/usr/local" ) ) # node.addService( RSpec.Install( "http://boa.cs.iastate.edu/cloudlab/hadoop-" + HADOOP_VERSION + "-setup.tar.gz", "/tmp" ) ) # node.addService( RSpec.Execute( "sh", "sudo /tmp/setup/init-hdfs.sh " + HADOOP_VERSION ) ) return node
def Node(name, public): if params.raw: newnode = RSpec.RawPC(name) else: newnode = IG.XenVM(name) newnode.ram = 2048 newnode.cores = 2 if public: newnode.routable_control_ip = True return newnode
def create_request(site, hw_type, num_nodes): for i in range(0, num_nodes): node = rspec.RawPC('node' + str(i)) node.disk_image = img node.hardware_type = hw_type # Add a raw PC to the request and give it an interface. #interface = node.addInterface() # Specify the IPv4 address #interface.addAddress(rspec.IPv4Address("192.168.1.1", "255.255.255.0")) if site not in requests: requests[site] = rspec.Request() requests[site].addResource(node)
def setup(): node = rspec.RawPC("node") #img = "urn:publicid:IDN+apt.emulab.net+image+schedock-PG0:docker-ubuntu16:0" #node.disk_image = img node.hardware_type = 'm400' iface1 = node.addInterface("if1") # Specify the component id and the IPv4 address iface1.component_id = "eth1" iface1.addAddress(rspec.IPv4Address("192.168.1.1", "255.255.255.0")) link = rspec.LAN("lan") link.addInterface(iface1) r = rspec.Request() r.addResource(node) request = {} request['cl-utah'] = r m = cl.request(experiment_name='testing138', requests=request, expiration=960, timeout=15, cloudlab_user='******', cloudlab_password='******', cloudlab_project='Consensus', cloudlab_cert_path='cloudlab.pem', cloudlab_key_path='~/.ssh/id_ed25519.pub') # read info in manifests to introspect allocation print(m['cl-utah'].nodes) for node in m['cl-utah'].nodes: print("Node") print(node) print(node.component_id) for iface in node.interfaces: print("Interface") print(iface) print(node.hostipv4) print(iface.address_info) print(iface.sliver_id)
DISK_IMAGE = "urn:publicid:IDN+utah.cloudlab.us+image+emulab-ops//UBUNTU16-64-STD" pc = portal.Context() rspec = pg.Request() pc.defineParameter( name="node_type", description= ("Hardware spec of node. <br> Refer to manuals at " "<a href=\"http://docs.aptlab.net/hardware.html#%28part._apt-cluster%29\">APT</a> " "for more details."), typ=portal.ParameterType.NODETYPE, defaultValue="r320", legalValues=[("r320", "APT r320"), ("c6220", "APT c6220")], advanced=False, groupId=None) params = pc.bindParameters() node = pg.RawPC("host") node.hardware_type = params.node_type node.disk_image = DISK_IMAGE rspec.addResource(node) instructions = "Use this profile to create a new Etalon disk image with the reTCP kernel patch." desc = "A very basic profile with a single clean node." tour = igext.Tour() tour.Description(type=igext.Tour.TEXT, desc=desc) tour.Instructions(type=igext.Tour.MARKDOWN, inst=instructions) rspec.addTour(tour) pc.printRequestRSpec(rspec)
# Retrieve the values the user specifies during instantiation params = pc.bindParameters() # Create a Request object to start building the RSpec rspec = pg.Request() # Check parameter validity if params.n < 1 or params.n > 64: pc.reportError(portal.ParameterError( "You must choose from 1 to 64")) # Create nodes and links link = pg.LAN("lan") for i in range (params.n): node = pg.RawPC("node-"+str(i)) if params.s != '': bs = node.Blockstore("bs"+str(i), params.p) bs.size = params.s if params.d != '': bsimg = node.Blockstore("bsi"+str(i), "/reusable_data") bsimg.dataset = params.d node.hardware_type=params.t node.disk_image=params.i rspec.addResource(node) iface = node.addInterface("if-"+str(i)) link.addInterface(iface) rspec.addResource(link)
elif params.OSType == 'ubuntu16': if params.archType == 'x86_64': chosenDiskImage = x86_ubuntu16_disk_image elif params.OSType == 'ubuntu14': if params.archType == 'x86_64': chosenDiskImage = x86_ubuntu14_disk_image computeNodeNames = [] computeNodeList = "" for i in range(1,params.computeNodeCount + 1): cpname = "%s-%d" % (params.computeHostBaseName,i) computeNodeNames.append(cpname) pass for cpname in computeNodeNames: cpnode = rspec.RawPC(cpname) cpnode.hardware_type = params.hardwareType cpnode.disk_image = chosenDiskImage if params.computeNodeCount > 1: iface = cpnode.addInterface("if0") mgmtlan.addInterface(iface) if generateIPs: iface.addAddress(rspec.IPv4Address(get_next_ipaddr(mgmtlan.client_id), get_netmask(mgmtlan.client_id))) pass pass cpnode.addService(rspec.Install(url=TBURL, path="/opt/")) if params.FluidMem and params.Infiniswap: cpnode.addService(rspec.Execute(shell="sh",command=COMBINED_CMD)) elif params.FluidMem: cpnode.addService(rspec.Execute(shell="sh",command=FLUIDMEM_CMD))
# Create a Request object to start building the RSpec. rspec = pg.Request() # Create a link with the type of LAN. link = pg.LAN("lan") #disk_image="urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU16-64-STD" #disk_image="urn:publicid:IDN+apt.emulab.net+image+cloudincr-PG0:TTU-OpenHPC-CN" #disk_image="urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU18-64-STD" # Storage Serve for i in range (params.n): node = pg.RawPC("server"+str(i)) node.hardware_type = params.t #node.disk_image=disk_image node.installRootKeys(True, True) #bs = node.Blockstore("bss"+str(i), "/mydata") #bs.size = "60GB" #node.addService(install) #node.addService(execute) # node.disk_image=disk_image iface = node.addInterface("if"+str(i)) link.addInterface(iface) rspec.addResource(node) # Computing Node
# Check parameter for image if params.i == 0: IMAGE = "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU14-64-STD" else: IMAGE = "urn:publicid:IDN+emulab.net+image+emulab-ops:CENTOS7-64-STD" #IMAGE = "urn:publicid:IDN+emulab.net+image+emulab-ops//hadoop-273" DOWNLOAD = "https://github.com/ifding/hadoopOnGeni/raw/master/download.tar.gz" lan = RSpec.LAN() rspec.addResource(lan) #name node #resource manager node = RSpec.RawPC("namenode") #node.hardware_type = "c8220x" node.disk_image = IMAGE bs = node.Blockstore("nn_bs", "/data") bs.size = "100GB" node.addService(RSpec.Install(DOWNLOAD, "/tmp")) node.addService( RSpec.Execute(shell="/bin/sh", command="sudo sh /tmp/download.sh")) node.addService( RSpec.Execute(shell="/bin/sh", command="sh /tmp/hadoopOnGeni/install.sh")) iface = node.addInterface("if0") lan.addInterface(iface) rspec.addResource(node) #data node #slave node
import sys from geni.aggregate import cloudlab from geni.rspec import pg from geni import util experiment_name = 'popperized-geni-example' command = sys.argv[1] # load context ctx = util.loadCtx() if command == 'apply': # create request # { node = pg.RawPC("node") node.disk_image = ("urn:publicid:IDN+clemson.cloudlab.us+image+" "schedock-PG0:ubuntu18-docker") node.hardware_type = 'c6320' request = pg.Request() request.addResource(node) # } # create slice util.createSlice(ctx, experiment_name) # create sliver on clemson manifest = util.createSliver(ctx, cloudlab.Clemson, experiment_name, request)
rspec = RSpec.Request() # kvmarm-3.18-measure disk image URL kvm_disk_image = "https://www.utah.cloudlab.us/image_metadata.php?uuid=89e6d902-cd87-11e4-9fb8-3548323d6d11" # kvmarm-3.18-xen-measure disk image URL xen_disk_image = "https://www.utah.cloudlab.us/image_metadata.php?uuid=9516acec-cd89-11e4-9fb8-3548323d6d11" # kvmarm-3.18-measure-bm disk image URL bm_disk_image = "https://www.utah.cloudlab.us/image_metadata.php?uuid=9f543ea2-ce44-11e4-9fb8-3548323d6d11" # Create private LAN lan = RSpec.LAN() rspec.addResource(lan) # Create Client node # IP will be 10.10.1.1 node = RSpec.RawPC("client-node") node.hardware_type = "m400" node.disk_image = kvm_disk_image rspec.addResource(node) iface = node.addInterface("eth1") lan.addInterface(iface) # Create Bare-Metal node # IP will be 10.10.1.2 node = RSpec.RawPC("bm-node") node.hardware_type = "m400" node.disk_image = bm_disk_image rspec.addResource(node) iface = node.addInterface("eth1") lan.addInterface(iface)
pc.defineParameter("rcnfs", "Setup an extra node for NFS?", portal.ParameterType.BOOLEAN, True, [True, False]) pc.defineParameter("type4nfs", "Node Type for NFS server", portal.ParameterType.NODETYPE, types[2], types) params = pc.bindParameters() rspec = RSpec.Request() lan = RSpec.LAN() rspec.addResource(lan) if params.rcnfs == True: node = RSpec.RawPC("rcnfs") # Ask for a 200GB file system mounted at /shome on rcnfs # bs = node.Blockstore("bs", "/shome") # bs.size = "400GB" node.hardware_type = params.type4nfs node.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops:' + params.image "urn:publicid:IDN+wisc.cloudlab.us:ramcloud-pg0+ltdataset+PipedreamNFS" # The remote file system is represented by special node. nfsrbs = rspec.RemoteBlockstore("nfsrbs", "/shome") # This URN is displayed in the web interfaace for your dataset. nfsrbs.dataset = "urn:publicid:IDN+wisc.cloudlab.us:ramcloud-pg0+ltdataset+PipedreamNFS" iface2 = node.addInterface("eth1")
if name in snifferNodes: vnode._ext_children.append(Label("sniffer", "1")) if name in netflowNodes: vnode._ext_children.append(Label("netflow", "1")) vnode.addService(RSpec.Execute(shell="sh", command=CMD)) vnode.cores = params.coresPerVM vnode.ram = params.ramPerVM vnode.exclusive = True if params.vmImage: vnode.disk_image = params.vmImage if params.hostType != "any": vhostnum = nodemap[num] vhostname = "vhost%s" % (str(vhostnum), ) vnode.InstantiateOn(vhostname) if not vhostname in vhosts: vhost = vhosts[vhostname] = RSpec.RawPC(vhostname) if disableTestbedRootKeys: vhost.installRootKeys(False, False) vhost.exclusive = True if params.hostType: vhost.hardware_type = params.hostType if params.hostImage: vhost.disk_image = params.hostImage iface = vnode.addInterface("ifM") iface.addAddress( IPv4Address("%s.%s" % (mgmtprefix, mgmtmap[num]), prefixlen=mgmtbits)) mgmtlan.addInterface(iface) linkname = "link-%s-%s%s" % (src, dst, postfix) revlinkname = "link-%s-%s%s" % (dst, src, postfix) if not linkname in links and not revlinkname in links:
def bindVlans(rspec, pc, cid, start, end): for vlan in xrange(start, end + 1): intf = pc.addInterface("if%d" % (vlan)) intf.component_id = cid lnk = PG.Link() lnk.addInterface(intf) lnk.connectSharedVlan("pwe-segment-%d" % (vlan)) rspec.addResource(lnk) intf = pc.addInterface("meso:%s" % (cid)) intf.component_id = cid lnk = PG.Link() lnk.addInterface(intf) lnk.connectSharedVlan("mesoscale-openflow") rspec.addResource(lnk) r = PG.Request() pc = PG.RawPC("pwe-router") pc.disk_image = DISK_IMAGE r.addResource(pc) bindVlans(r, pc, "eth1", 1, 10) bindVlans(r, pc, "eth2", 11, 20) bindVlans(r, pc, "eth3", 21, 30) r.write("pwe-raw.xml")
# Copyright (c) 2015 Barnstormer Softworks, Ltd. # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import geni.rspec.pg as PG import geni.rspec.stitching as ST DI_URL = "https://www.emulab.net/image_metadata.php?uuid=b21a466b-da48-11e4-97ea-38eaa71273fa" r = PG.Request() stub = PG.RawPC("stub") stub.component_manager_id = "urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm" stub_intf = stub.addInterface("if0") r.addResource(stub) real = PG.RawPC("raw-nps") real.disk_image = DI_URL real.component_manager_id = "urn:publicid:IDN+instageni.nps.edu+authority+cm" real_intf = real.addInterface("if0") r.addResource(real) link = PG.StitchedLink("s-link") link.addInterface(stub_intf) link.addInterface(real_intf) link.bandwidth = 1
nodes_per_chassis = 45 num_nodes = nodes_per_chassis - len(skiplist) rc_aliases = ["rcmaster", "rcnfs"] for i in range(num_nodes - 2): rc_aliases.append("rc%02d" % (i + 1)) n = 0 for i in range(nodes_per_chassis): name = "ms%02d%02d" % (params.chassis, i + 1) if name in skiplist: continue rc_alias = rc_aliases[n] node = RSpec.RawPC(rc_alias) n = n + 1 if rc_alias == "rcnfs": # Ask for a 200GB file system mounted at /shome on rcnfs bs = node.Blockstore("bs", "/shome") bs.size = "200GB" node.hardware_type = params.type node.disk_image = urn.Image(cloudlab.Utah, "emulab-ops:%s" % params.image) node.component_id = urn.Node(cloudlab.Utah, name) node.addService( RSpec.Execute(shell="sh", command="sudo /local/repository/startup.sh")) rspec.addResource(node)
import geni.rspec.pg as PG context = nbastin.buildContext() am = geni.aggregate.instageni.UtahDDC #am.deletesliver(context, "vts-stage") ad = am.listresources(context) vtsvlans = [] for vlan in ad.shared_vlans: if vlan.name.startswith("vts"): vtsvlans.append(vlan.name) r = PG.Request() node = PG.RawPC("vts") node.disk_image = "https://www.instageni.maxgigapop.net/image_metadata.php?uuid=3219aad0-ac89-11e3-b767-000000000000" intfs = [] for idx in xrange(1, 4): intf = node.addInterface("if%d" % (idx)) intf.component_id = "eth%d" % (idx) intfs.append(intf) lnk = PG.Link() lnk.addInterface(intf) lnk.connectSharedVlan("mesoscale-openflow") r.addResource(lnk) pairs = zip(itertools.cycle(intfs), vtsvlans) for (intf, vlan) in pairs: lnk = PG.Link()
rspec = RSpec.Request() tour = IG.Tour() tour.Description(IG.Tour.TEXT, "Two PCs connected via a link with asymmetric shaping for each.") tour.Instructions(IG.Tour.MARKDOWN, "None") rspec.addTour(tour) pc = portal.Context() link = RSpec.LAN("shaped-link") rspec.addResource(link) node1 = RSpec.RawPC("node-1") rspec.addResource(node1) iface1 = node1.addInterface("if1") iface1.bandwidth = 50000 iface1.latency = 5 iface1.plr = 0.05 link.addInterface(iface1) node2 = RSpec.RawPC("node-2") rspec.addResource(node2) iface2 = node2.addInterface("if2") iface2.bandwidth = 20000 iface2.latency = 15 iface2.plr = 0.1 link.addInterface(iface2)
params = context.bindParameters() request = rspec.Request() # Create a local area network over a 10 Gbps. lan = rspec.LAN() lan.bandwidth = 10000000 # This is in kbps. # Setup node names. rc_aliases = [] for i in range(params.size): rc_aliases.append("sandstorm%02d" % (i + 1)) # Setup the cluster one node at a time. for i in range(params.size): node = rspec.RawPC(rc_aliases[i]) node.hardware_type = params.type node.disk_image = urn.Image(cloudlab.Utah, "emulab-ops:%s" % params.image) # Install and run the startup scripts. node.addService(rspec.Install( url="https://github.com/chinkulkarni/cloudLab-scripts/" +\ "archive/master.tar.gz", path="/local")) node.addService(rspec.Execute( shell="sh", command="sudo mv /local/cloudLab-scripts-master " +\ "/local/scripts")) node.addService( rspec.Execute(shell="sh",
num_nodes) params = pc.bindParameters() #pc.verifyParameters() rspec = RSpec.Request() lan = RSpec.LAN() rspec.addResource(lan) node_names = ["rcmaster", "rcnfs"] for i in range(params.num_nodes - 2): node_names.append("rc%02d" % (i + 1)) for name in node_names: node = RSpec.RawPC(name) if name == "rcnfs": # Ask for a 256GB file system mounted at /shome on rcnfs bs = node.Blockstore("bs", "/shome") bs.size = "200GB" bs2 = node.Blockstore("bs2", "/localdrive") bs2.size = "30GB" node.hardware_type = params.type node.disk_image = urn.Image(cloudlab.Utah, "emulab-ops:%s" % params.image) # node.component_id = urn.Node(cloudlab.Utah, name) node.addService( RSpec.Install( url=
# Setup node names so that existing RAMCloud scripts can be used on the # cluster. rcxx_backup_dir = "/local/rcbackup" hostnames = [] for i in range(params.num_rcnodes): hostnames.append("rc%02d" % (i + 1)) # Add rcmaster and rcnfs at the end so that the rc blocks are contiguous. hostnames.append("rcmaster") hostnames.append("rcnfs") nodeNames = params.node_names.split(",") # Setup the cluster one node at a time. for host in hostnames: node = RSpec.RawPC(host) node.hardware_type = params.hardware_type node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU18-64-STD" if host == "rcnfs": # Ask for a 200GB file system mounted at /shome on rcnfs nfs_bs = node.Blockstore("bs", "/shome") nfs_bs.size = "200GB" # Create a backup partition for RCXX. pattern = re.compile("^rc[0-9][0-9]$") if pattern.match(host): # Ask for a 200GB file system for RAMCloud backups backup_bs = node.Blockstore(host + "backup_bs", rcxx_backup_dir) backup_bs.size = "200GB"
def Node(name): newnode = RSpec.RawPC(name) newnode.routable_control_ip = True return newnode
def baremetal_node(name, img, hardware_type): node = pg.RawPC(name) node.disk_image = img node.hardware_type = hardware_type return node
import itertools import example_config import geni.rspec.pg as PG import geni.aggregate.instageni as IG context = example_config.buildContext() ad = IG.NYSERNet.listresources(context) pairs = itertools.izip(xrange( 1, 4), [x.name for x in ad.shared_vlans if x.name.startswith("vts")]) r = PG.Request() pc = PG.RawPC("bss-rtr") pc.routeable_control_ip = True for (i, vlan) in pairs: intf = pc.addInterface("if%d" % (i)) intf.component_id = "eth%d" % (i) lnk = PG.Link() lnk.addInterface(intf) lnk.connectSharedVlan(vlan) r.addResource(lnk) vm = PG.XenVM("xen-%d" % (i)) intf = vm.addInterface("if0") lnk = PG.Link() lnk.addInterface(intf) lnk.connectSharedVlan(vlan)