def filter_unavailable_hwtypes(ctxt, requests): """Removes nodes of particular hwtypes if they're not available. """ available_hwtypes = set() for site in requests: print("querying site: " + str(site)) ad = agg[site].listresources(ctxt, available=True) for node in ad.nodes: if not node.available: continue available_hwtypes.update(node.hardware_types.keys()) filtered_requests = {} for site in requests: print("Checking requests for site: " + site) for r in requests[site].resources: print("Checking if node type " + str(r.hardware_type) + " is available") if r.hardware_type in available_hwtypes: print(" It is available!") if site not in filtered_requests: filtered_requests[site] = rspec.Request() filtered_requests[site].addResource(r) else: print(" It is NOT available :-(") return filtered_requests
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 nodes_rspec(context, number): interfaces = [i for i in xrange(number)] r = PG.Request() nodeA = PG.Node("A", "emulab-xen") nodeA.exclusive = False nodeA_host_intf_list = [] for i in interfaces: nodeA_host_intf = nodeA.addInterface("if_AH{0}".format(i)) nodeA_host_intf.addAddress(PG.IPv4Address("192.165.{0}.1".format(i+1), "255.255.255.0")) nodeA_host_intf_list.append(nodeA_host_intf) r.addResource(nodeA) nodeB = PG.Node("B", "emulab-xen") nodeB.exclusive = False nodeB_host_intf_list = [] for i in interfaces: nodeB_host_intf = nodeB.addInterface("if_BH{0}".format(i)) nodeB_host_intf.addAddress(PG.IPv4Address("192.168.{0}.1".format(i+1), "255.255.255.0")) nodeB_host_intf_list.append(nodeB_host_intf) r.addResource(nodeB) for i in interfaces: link = PG.Link("link{0}".format(interfaces[i])) link.addInterface(nodeA_host_intf_list[i]) link.addInterface(nodeB_host_intf_list[i]) link.bandwidth = 20000 r.addResource(link) name = "test-{0}.rspec".format(number) r.writeXML(name)
def dryrun(): ''' test for new configuration file ''' config_file = 'custom_config.txt' config_info = config.read_config(config_file) rspec_file = config_info['general']['output_rspec'] # create network vn, shared_vlan_info = topo_gen.create_topo(config_info) # Check whether using single InstaGENI site or multiple InstaGENI sites if config_info['general']['single_am'] in BOOL: site_id = config_info['am_nodes'].keys()[0] config_info['am_nodes'][site_id]= vn.topo.nodes() site_dict = config_info['am_nodes'] else: site_dict = {} for site_id in config_info['am_nodes']: temp_list = config_info['am_nodes'][site_id].split(',') site_dict[int(site_id)] = map(int, temp_list) rspec = pg.Request() link_ifaces = {} for link_id in range(1, len(vn.link_list)+1): link_ifaces[link_id] = [] # add node resources rspec = add_node_to_rspec(config_info, site_dict, link_ifaces, vn, rspec) # add link resources rspec = add_link_to_rspec(config_info, site_dict, link_ifaces, vn, rspec) # write rspec rspec.writeXML(rspec_file) return link_ifaces
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 two_nodes_rspec(context, slicename, location1, location2, ip1, ip2, port1, port2, bandwidth, location, number): ''' Create an RSpec for a simple two-node link''' interfaces = [i for i in xrange(number)] r = PG.Request() l1 = getResources(location1, context) l2 = getResources(location2, context) ip1List = [] if "," in ip1: ip1List = ip1.split(",") else: ip1List.append(ip1) ip2List = [] if "," in ip2: ip2List = ip2.split(",") else: ip2List.append(ip2) stub = PG.Node("ig-%s" % (location1), "emulab-xen") stub.component_manager_id = l1.nodes[0].component_manager_id # stub.addService(PG.Install(url="http://www.gpolab.bbn.com/~jbs/dingbot.tar.gz", path="/opt")) stub.addService(PG.Execute(shell="sh", command="sudo yum install iperf -y")) stub.exclusive = False stub_intf_list = [] for i in interfaces: stub_intf = stub.addInterface("if{0}".format(i)) stub_intf.addAddress(PG.IPv4Address(ip1List[i], "255.255.255.0")) stub_intf_list.append(stub_intf) r.addResource(stub) real = PG.Node("ig-%s" % (location2), "emulab-xen") real.component_manager_id = l2.nodes[0].component_manager_id real.addService(PG.Execute(shell="sh", command="sudo yum install iperf -y")) real.exclusive = False real_intf_list = [] for i in interfaces: real_intf = real.addInterface("if{0}".format(i)) real_intf.addAddress(PG.IPv4Address(ip2List[i], "255.255.255.0")) real_intf_list.append(real_intf) r.addResource(real) for i in interfaces: link = PG.Link("link{0}".format(interfaces[i])) link.addInterface(stub_intf_list[i]) link.addInterface(real_intf_list[i]) link.bandwidth = bandwidth r.addResource(link) name = location + "test-{0}-{1}-{2}.rspec".format(location1, location2, number) r.writeXML(name) return name
def rspec_write(self, rspecfile): """Summary Args: rspecfile (TYPE): Description Returns: TYPE: Description """ # Import optional libraries import geni.rspec.pg as PG r = PG.Request() self.rspec_template(r) r.writeXML(rspecfile)
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 cluster(N_NODES, AM, SLICE_NAME, NODE_NAME, XML_NAME, SOFTWARE, PUBLIC_IP): rspec = PG.Request() IFACE = "if%d" INSTALL = "install-%s" for i in range(0, N_NODES): if i == 0: vm = IGX.XenVM("master") vm.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU14-64-STD" rspec.addResource(vm) vm.routable_control_ip = PUBLIC_IP if N_NODES > 1: vm_iface = vm.addInterface(IFACE % i) link = PG.LAN("lan0") link.addInterface(vm_iface) else: vm = IGX.XenVM(NODE_NAME % (i - 1)) vm.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU14-64-STD" rspec.addResource(vm) vm_iface = vm.addInterface(IFACE % i) link.addInterface(vm_iface) # Prepare nodes with corresponding software and install files # Create scripts for each software #for i in SOFTWARE: # /bin/bash # vm.addService(PG.Install(url=software(i), path="/tmp")) # vm.addService(PG.Execute(shell="/bin/bash", command="sudo sh /tmp/%s" % INSTALL % i + ".sh")) # Docker installation (for Trusty) vm.addService(PG.Install(url="", path="/tmp/docker")) vm.addService( PG.Execute(shell="/bin/bash", command="bash /tmp/docker/docker_inst_trusty.sh")) if N_NODES > 1: rspec.addResource(link) # Deploy resources at GENI manifest = AM.createsliver(context, SLICE_NAME, rspec) geni.util.printlogininfo(manifest=manifest) # Create manifest in XML file rspec.writeXML(XML_NAME)
def main(sname, site, of_vlan=False, of_controller=None): # Load GENI credentials context = util.loadContext(key_passphrase=True) # Make a basic request with two VMs r = PG.Request() vms = [] for idx in range(0, 2): vm = r.XenVM("vm%d" % (idx)) vm.addInterface("if0") vms.append(vm) lnk = r.Link() lnk.addInterface(vms[0].interfaces[0]) lnk.addInterface(vms[1].interfaces[0]) # Openflow-enable this link if requested if of_vlan: lnk.addChild(IGX.OFController(of_controller[0], of_controller[1])) # Find nodes that support VMs at the requested site ad = site.listresources(context) vmnodes = [] for node in ad.nodes: if IGU.shared_xen(node): vmnodes.append(node) # Bind request VMs to different nodes by component_id for (vm, node) in zip(vms, vmnodes): vm.component_id = node.component_id # Save the request r.writeXML("%s-%s-request.xml" % (sname, site.name)) # Make the reservation m = site.createsliver(context, sname, r) # Save the manifest m.writeXML("%s-%s-manifest.xml" % (sname, site.name)) # Output login info to stdout util.printlogininfo(manifest=m)
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)
def create_request(img, hw_type, groups, with_lan): request = pg.Request() nodes = [] processed = [] for _, group in groups.items(): for node_name in group: if node_name in processed: # nodes can appear on multiple groups, so we check and skip # creating another request for the same node continue node = create_baremetal_node(node_name, img, hw_type) nodes.append(node) processed.append(node_name) request.addResource(node) # add lan to request if with_lan: lan = create_lan(nodes) request.addResource(lan) return request
def two_nodes_rspec_simple(context, slicename, location1, location2, ip1, ip2, port1, port2, bandwidth, location, number): ''' Create an RSpec for a simple two-node link''' interfaces = [i for i in xrange(number)] r = PG.Request() nodeA = PG.Node("A", "emulab-xen") nodeA.exclusive = False nodeA_host_intf_list = [] for i in interfaces: nodeA_host_intf = nodeA.addInterface("if_AH{0}".format(i)) nodeA_host_intf.addAddress( PG.IPv4Address("192.165.{0}.1".format(i + 1), "255.255.255.0")) nodeA_host_intf_list.append(nodeA_host_intf) r.addResource(nodeA) nodeB = PG.Node("B", "emulab-xen") nodeB.exclusive = False nodeB_host_intf_list = [] for i in interfaces: nodeB_host_intf = nodeB.addInterface("if_BH{0}".format(i)) nodeB_host_intf.addAddress( PG.IPv4Address("192.168.{0}.1".format(i + 1), "255.255.255.0")) nodeB_host_intf_list.append(nodeB_host_intf) r.addResource(nodeB) for i in interfaces: link = PG.Link("link{0}".format(interfaces[i])) link.addInterface(nodeA_host_intf_list[i]) link.addInterface(nodeB_host_intf_list[i]) link.bandwidth = 20000 r.addResource(link) name = location + "test-{0}-{1}-{2}.rspec".format(location1, location2, number) r.writeXML(name) return name
def two_nodes_rspec(context, location1, location2, number): ''' Create an RSpec for a simple two-node link''' interfaces = [i for i in xrange(number)] r = PG.Request() stub = PG.Node("ig-%s" % (location1), "emulab-xen") stub.component_manager_id = "urn:publicid:IDN+instageni.wisc.edu+authority+cm" stub.addService(PG.Execute(shell="sh", command="sudo yum install iperf -y")) stub.exclusive = False stub_intf_list = [] for i in interfaces: stub_intf = stub.addInterface("if{0}".format(i)) stub_intf.addAddress(PG.IPv4Address("192.168.1.{0}".format(i+1), "255.255.255.0")) stub_intf_list.append(stub_intf) r.addResource(stub) real = PG.Node("ig-%s" % (location2), "emulab-xen") real.component_manager_id = "urn:publicid:IDN+instageni.rnet.missouri.edu+authority+cm" real.addService(PG.Execute(shell="sh", command="sudo yum install iperf -y")) real.exclusive = False real_intf_list = [] for i in interfaces: real_intf = real.addInterface("if{0}".format(i)) real_intf.addAddress(PG.IPv4Address("192.168.2.{0}".format(i+1), "255.255.255.0")) real_intf_list.append(real_intf) r.addResource(real) for i in interfaces: link = PG.Link("link{0}".format(interfaces[i])) link.addInterface(stub_intf_list[i]) link.addInterface(real_intf_list[i]) link.bandwidth = 20000 r.addResource(link) name = "test-{0}-{1}-{2}.rspec".format(location1, location2, number) r.writeXML(name)
params = portal.context.bindParameters() ''' c220g5 224 nodes (Intel Skylake, 20 core, 2 disks) CPU Two Intel Xeon Silver 4114 10-core CPUs at 2.20 GHz RAM 192GB ECC DDR4-2666 Memory Disk One 1 TB 7200 RPM 6G SAS HDs Disk One Intel DC S3500 480 GB 6G SATA SSD NIC Dual-port Intel X520-DA2 10Gb NIC (PCIe v3.0, 8 lanes) NIC Onboard Intel i350 1Gb Note that the sysvol is the SSD, while the nonsysvol is the 7200 RPM HD. We almost always want to use the sysvol. ''' rspec = pg.Request() node = pg.RawPC("node") node.hardware_type = params.hardware bs = node.Blockstore("bs", "/mydata") bs.size = params.storage bs.placement = "sysvol" # explicitly copy the needed params for better readability out_params = { "hardware": params.hardware, "storage": params.storage, "scale_factor": params.scale_factor, "common_args": params.common_args, "experiment_1_args": params.experiment_1_args, "experiment_2_args": params.experiment_2_args,
import geni.portal as portal import geni.rspec.pg as rspec import geni.rspec.igext as IG pc = portal.Context() request = rspec.Request() tourDescription = "This profile provides a baseline Ubuntu 14.4 image" # # Setup the Tour info with the above description and instructions. # tour = IG.Tour() tour.Description(IG.Tour.TEXT, tourDescription) request.addTour(tour) node = request.RawPC("basenode") node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU14-64-STD" node.addService(rspec.Execute(shell="/bin/sh", command="touch test.txt")) # Print the RSpec to the enclosing page. portal.context.printRequestRSpec(request)
# Copyright (c) 2016 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 DISK_IMAGE = "urn:publicid:IDN+instageni.gpolab.bbn.com+image+emulab-ops:UBUNTU12-64-STD" ndata = [("bbn-ig-ps103-a", "10.42.103.111"), ("bbn-ig-ps103-b", "10.42.103.112")] r = PG.Request() for (name, ip) in ndata: vm = PG.XenVM(name) vm.disk_image = DISK_IMAGE vm.addService(PG.Install(url="http://www.gpolab.bbn.com/~jbs/dingbot-jbs.tar.gz", path="/opt")) vm.addService(PG.Install(url="http://www.gpolab.bbn.com/~jbs/dingbot.tar.gz", path="/opt")) vm.addService(PG.Execute(shell="/bin/bash", command="sudo /opt/dingbot/dingbot /opt/dingbot/dingbot-jbs.json %s" % (vm.name))) intf = vm.addInterface("if0") intf.addAddress(PG.IPv4Address(ip, "255.255.255.0")) lnk = PG.Link() lnk.addInterface(intf) lnk.connectSharedVlan("mesoscale-openflow") r.addResource(vm) r.addResource(lnk) r.write("ps103.xml")
import geni.rspec.emulab.pnext as PN # # Global variables that should remain relatively static # class GLOBALS(object): EPCIMG = PN.PNDEFS.DEF_BINOEPC_IMG VM_COLLOCATE_FACTOR = 10 # Number of VMs to pack onto a phys node. # # Create our in-memory model of the RSpec -- the resources we're going # to request in our experiment, and their configuration. # rspec = PG.Request() # # This geni-lib script is designed to run in the PhantomNet Portal. # pc = portal.Context() # # Describe profile. Will be rendered in Markdown on Portal. # tourDescription = \ """ ###*<center>Use this profile to instantiate a basic EPC topology.</center>* --- The following functions are included:
gpovtsr = VTS.Request() dp = VTS.Datapath(image, "dp-gpo") dp.attachPort(VTS.PGCircuit()) dp.attachPort( VTS.GRECircuit("geni-core", uiucvtsm.findPort(uiuc_wan_port.clientid).local_endpoint)) gpovtsr.addResource(dp) gpovtsr.write("gpo-vts-request.xml") # Make the VTS reservation at GPO print "-- Making GPO VTS reservation" gpovtsm = VTSAM.GPO.createsliver(context, SLICE, gpovtsr) gpovtsm.write("gpo-vts-manifest.xml") # Build the IG Request for Illinois using the circuit information from the VTS manifest uiucpgr = PG.Request() for idx, circuit in enumerate(uiucvtsm.pg_circuits): vm = PG.XenVM("vm%d" % (idx)) intf = vm.addInterface("if0") intf.addAddress(PG.IPv4Address("172.16.5.1", "255.255.255.0")) uiucpgr.addResource(vm) lnk = PG.Link() lnk.addInterface(intf) lnk.connectSharedVlan(circuit) uiucpgr.addResource(lnk) uiucpgr.write("uiuc-ig-request.xml") # Build the IG request for GPO using the VTS circuit info gpopgr = PG.Request() for idx, circuit in enumerate(gpovtsm.pg_circuits):
def nodes_rspec(context, number): interfaces = [i for i in xrange(number)] r = PG.Request() nodeA = PG.Node("A", "emulab-xen") nodeA.addService( PG.Install( url= "http://pages.cs.wisc.edu/~rkrish/GENI/ospf-script-{0}intf.tar.gz". format(2 * number), path="/local")) nodeA.addService( PG.Execute(shell="sh", command="/local/ospf-script-{0}intf.sh".format(2 * number))) nodeA.exclusive = False nodeA_host_intf_list = [] nodeA_router_intf_list = [] for i in interfaces: nodeA_host_intf = nodeA.addInterface("if_AH{0}".format(i)) nodeA_host_intf.addAddress( PG.IPv4Address("192.165.{0}.1".format(i + 1), "255.255.255.0")) nodeA_host_intf_list.append(nodeA_host_intf) nodeA_router_intf = nodeA.addInterface("if_AR{0}".format(i)) nodeA_router_intf.addAddress( PG.IPv4Address("192.166.{0}.1".format(i + 1), "255.255.255.0")) nodeA_router_intf_list.append(nodeA_router_intf) r.addResource(nodeA) nodeB = PG.Node("B", "emulab-xen") nodeB.addService( PG.Install( url= "http://pages.cs.wisc.edu/~rkrish/GENI/ospf-script-{0}intf.tar.gz". format(2 * number), path="/local")) nodeB.addService( PG.Execute(shell="sh", command="/local/ospf-script-{0}intf.sh".format(2 * number))) nodeB.exclusive = False nodeB_host_intf_list = [] nodeB_router_intf_list = [] for i in interfaces: nodeB_router_intf = nodeB.addInterface("if_BR{0}".format(i)) nodeB_router_intf.addAddress( PG.IPv4Address("192.167.{0}.1".format(i + 1), "255.255.255.0")) nodeB_router_intf_list.append(nodeB_router_intf) nodeB_host_intf = nodeB.addInterface("if_BH{0}".format(i)) nodeB_host_intf.addAddress( PG.IPv4Address("192.168.{0}.1".format(i + 1), "255.255.255.0")) nodeB_host_intf_list.append(nodeB_host_intf) r.addResource(nodeB) router_intf_A_list = [] router_intf_B_list = [] host_intf_A_list = [] host_intf_B_list = [] for i in interfaces: router = PG.Node("Router{0}".format(i + 1), "emulab-xen") router.addService( PG.Install( url= "http://pages.cs.wisc.edu/~rkrish/GENI/ospf-script-2intf.tar.gz", path="/local")) router.addService( PG.Execute(shell="sh", command="/local/ospf-script-2intf.sh".format(number))) router.exclusive = False router_intf_A = router.addInterface("if_RA{0}".format(i)) router_intf_A.addAddress( PG.IPv4Address("192.166.{0}.2".format(i + 1), "255.255.255.0")) router_intf_A_list.append(router_intf_A) router_intf_B = router.addInterface("if_RB{0}".format(i)) router_intf_B.addAddress( PG.IPv4Address("192.167.{0}.2".format(i + 1), "255.255.255.0")) router_intf_B_list.append(router_intf_B) r.addResource(router) hostHA = PG.Node("H{0}".format(2 * i + 1), "emulab-xen") hostHA.addService( PG.Execute(shell="sh", command="sudo yum install iperf -y")) hostHA.exclusive = False host_intf_A = hostHA.addInterface("if_HA{0}".format(i)) host_intf_A.addAddress( PG.IPv4Address("192.165.{0}.2".format(i + 1), "255.255.255.0")) host_intf_A_list.append(host_intf_A) r.addResource(hostHA) hostHB = PG.Node("H{0}".format(2 * i + 2), "emulab-xen") hostHB.addService( PG.Execute(shell="sh", command="sudo yum install iperf -y")) hostHB.exclusive = False host_intf_B = hostHB.addInterface("if_HB{0}".format(i)) host_intf_B.addAddress( PG.IPv4Address("192.168.{0}.2".format(i + 1), "255.255.255.0")) host_intf_B_list.append(host_intf_B) r.addResource(hostHB) for i in interfaces: linkHA = PG.Link("linkHA{0}".format(interfaces[i])) linkHA.addInterface(host_intf_A_list[i]) linkHA.addInterface(nodeA_host_intf_list[i]) linkHA.bandwidth = 20000 r.addResource(linkHA) linkHB = PG.Link("linkHB{0}".format(interfaces[i])) linkHB.addInterface(host_intf_B_list[i]) linkHB.addInterface(nodeB_host_intf_list[i]) linkHB.bandwidth = 20000 r.addResource(linkHB) linkRA = PG.Link("linkRA{0}".format(interfaces[i])) linkRA.addInterface(router_intf_A_list[i]) linkRA.addInterface(nodeA_router_intf_list[i]) linkRA.bandwidth = 20000 r.addResource(linkRA) linkRB = PG.Link("linkRB{0}".format(interfaces[i])) linkRB.addInterface(router_intf_B_list[i]) linkRB.addInterface(nodeB_router_intf_list[i]) linkRB.bandwidth = 20000 r.addResource(linkRB) name = "Performance-{0}.rspec".format(number) r.writeXML(name)
from geni.aggregate import cloudlab from geni.rspec import pg from geni import util from random import randint def baremetal_node(name, img, hardware_type): node = pg.RawPC(name) node.disk_image = img node.hardware_type = hardware_type return node experiment_name = 'popper-test' + str( randint( 0, 9999) ) img = "urn:publicid:IDN+wisconsin.cloudlab.us+image+emulab-ops//UBUNTU18-64-STD" request = pg.Request() request.addResource(baremetal_node("client0", img, 'c220g5')) request.addResource(baremetal_node("osd0", img, 'c220g5')) # load context ctx = util.loadContext(key_passphrase=os.environ['GENI_KEY_PASSPHRASE']) # create slice util.createSlice(ctx, experiment_name, renew_if_exists=True) # create sliver on emulab manifest = util.createSliver(ctx, cloudlab.Wisconsin, experiment_name, request) # grouping inventory groups = { 'osds': ['osd0'],
"additional server for rcmaster, and one for rcnfs). To check " +\ "availability of nodes, visit " +\ "\"https://www.cloudlab.us/cluster-graphs.php\"") pc.defineParameter( "node_names", "Machine Names CSV", portal.ParameterType.STRING, "ms1201,ms1202,ms1203", [], "A comma separated list of physical machines to use. " + "This complicates the profile a bit but gives enough " + "control to make all machines on the same chassis. " + "Please specify enough machines to handle Cluster Size + 2") params = pc.bindParameters() # Create a Request object to start building the RSpec. request = RSpec.Request() # Create a local area network. rclan = RSpec.LAN() rclan.best_effort = True # It's not clear what these options do but they sound like they will make # performance less predictable if true; need to ask jde. rclan.vlan_tagging = False rclan.link_multiplexing = False request.addResource(rclan) # Setup node names so that existing RAMCloud scripts can be used on the # cluster. rcxx_backup_dir = "/local/rcbackup"
def Node(name, public): if params.raw: return RSpec.RawPC(name) elif public: vm = PublicVM(name) vm.ram = params.mem return vm else: vm = geni.rspec.igext.XenVM(name) vm.ram = params.mem return vm rspec = RSpec.Request() lan = RSpec.LAN() rspec.addResource(lan) node = Node("namenode", True) node.disk_image = IMAGE iface = node.addInterface("if0") lan.addInterface(iface) rspec.addResource(node) node = Node("resourcemanager", True) node.disk_image = IMAGE iface = node.addInterface("if0") lan.addInterface(iface) rspec.addResource(node)
def main(argv=None): """ program warpper Create RSpec for a specific topology type. Inputs are: -r config_file: Specify the configuration file """ # get arguments if not argv: argv = sys.argv[1:] usage = ("%prog [-r config_file] ") parser = OptionParser(usage=usage) create_option(parser) (options, _) = parser.parse_args(argv) config_file = options.config_file config_info = config.read_config(config_file) # Error Checking for the configuration file check_config(config_info) rspec_file = config_info['general']['output_rspec'] # Create and configure the topology vn, shared_vlan_info = topo_gen.create_topo(config_info) # Check whether using single InstaGENI site or multiple InstaGENI sites if config_info['general']['single_am'] in YES: # Single InstaGENI site is used site_dict = {} site_name = config_info['am_nodes'].keys()[0].lower() site_nodes = config_info['am_nodes'][site_name] if config_info['am_nodes'][site_name] != 'all': print("INFO: 'single_am=yes' so ALL nodes " \ "belong to a single InstaGENI aggregate.") if config_info['am_nodes'].has_key("any") and config_info['am_nodes']['any'].strip().lower() == "all": print("INFO: The RSpec will be unbound "\ "(because nodes are listed as %s)." % config_info['am_nodes']) else: print("The RSpec will be bound "\ "(because nodes are listed as %s)." % config_info['am_nodes']) if vn.topo_type == 'lan': # excluding the first node, which is the lan-sw type config_info['am_nodes'][site_name]= vn.topo.nodes()[1:] else: config_info['am_nodes'][site_name]= vn.topo.nodes() if site_name != 'any': # RSpec is bounded, find the corresponding InstaGENI site id site_id = find_site_id(site_name) site_dict[site_id] = config_info['am_nodes'][site_name] else: # Unbounded RSpec site_dict = config_info['am_nodes'] else: # Use multiple InstaGENI sites site_dict = {} for site_name in config_info['am_nodes']: temp_list = config_info['am_nodes'][site_name].split(',') if site_name.lower() == 'any': ''' Partially Unbound ''' raise KeyError("WARNING: You are assigning node %s as unbound. " \ "Please select one of the InstaGENI aggregates. "\ "Currently partially unbound RSpecs for multi-aggregate topologies" \ " are not supported" % str(temp_list)) else: site_id = find_site_id(site_name) site_dict[int(site_id)] = map(int, temp_list) rspec = pg.Request() link_ifaces = {} for link_id in range(1, len(vn.link_list)+1): link_ifaces[link_id] = [] # add node resources rspec = add_node_to_rspec(config_info, site_dict, link_ifaces, vn, rspec) # add link resources rspec = add_link_to_rspec(config_info, site_dict, link_ifaces, vn, rspec, shared_vlan_info) # write rspec rspec.writeXML(rspec_file) print("\nThe generated RSpec has been written to:\n\t %s " % rspec_file)