def x310_node_pair(idx, x310_radio): radio_link = request.Link("radio-link-%d" % (idx)) radio_link.bandwidth = 10 * 1000 * 1000 node = request.RawPC("%s-comp" % (x310_radio.radio_name)) node.hardware_type = params.x310_pair_nodetype node.disk_image = GLOBALS.SRSLTE_IMG node.component_manager_id = "urn:publicid:IDN+emulab.net+authority+cm" node.addService( rspec.Execute( shell="bash", command="/local/repository/bin/add-nat-and-ip-forwarding.sh")) node.addService( rspec.Execute(shell="bash", command="/local/repository/bin/update-config-files.sh")) node.addService( rspec.Execute(shell="bash", command="/local/repository/bin/tune-cpu.sh")) node.addService( rspec.Execute(shell="bash", command="/local/repository/bin/tune-sdr-iface.sh")) if params.include_srslte_src: bs = node.Blockstore("bs-comp-%s" % idx, "/opt/srslte") bs.dataset = GLOBALS.SRSLTE_SRC_DS node_radio_if = node.addInterface("usrp_if") node_radio_if.addAddress(rspec.IPv4Address("192.168.40.1", "255.255.255.0")) radio_link.addInterface(node_radio_if) radio = request.RawPC("%s-x310" % (x310_radio.radio_name)) radio.component_id = x310_radio.radio_name radio.component_manager_id = "urn:publicid:IDN+emulab.net+authority+cm" radio_link.addNode(radio)
def add_validate_services(self): """Summary Returns: TYPE: Description """ # Import optional libraries import geni.rspec.pg as PG kernel_tuning = """sudo sysctl -w net.core.rmem_max=134217728; sudo sysctl -w net.core.wmem_max=134217728; sudo sysctl -w net.ipv4.tcp_rmem='4096 87380 67108864'; sudo sysctl -w net.ipv4.tcp_wmem='4096 65536 67108864'""" iperf_setup = "wget -qO- https://raw.githubusercontent.com/csmithsalzberg/digitaldivide/master/util/iperfsetup.sh" wget_validate = "wget -O /tmp/validate.sh https://raw.githubusercontent.com/csmithsalzberg/digitaldivide/master/util/validate.sh" wget_consolidate = "wget -O /tmp/consolidate-validation-results.sh https://raw.githubusercontent.com/csmithsalzberg/digitaldivide/master/util/consolidate-validation-results.sh" self.router.addService( PG.Execute(shell="/bin/sh", command="%s | bash; iperf3 -s -D; iperf -s -u" % iperf_setup)) self.router.addService( PG.Execute(shell="/bin/sh", command=kernel_tuning)) for house in self.households: house.addService( PG.Execute(shell="/bin/sh", command="%s | bash" % iperf_setup)) house.addService( PG.Execute(shell="/bin/sh", command=wget_consolidate)) house.addService(PG.Execute(shell="/bin/sh", command=wget_validate))
def create_nodes(count=1, prefix=1, instantiateOn='pnode', cores=2, ram=4): """Allocates and runs an install script on a specified number of VM nodes Returns a list of nodes. """ nodes = [] # index nodes by their proper number (not zero-indexed) nodes.append(None) # create each VM for i in range(1, count + 1): nodes.append( mkVM('node' + str(prefix) + '-' + str(i), GLOBALS.UBUNTU18_IMG, instantiateOn=instantiateOn, cores=cores, ram=ram)) # run install scripts on each vm to install software for node in nodes: if node is not None: node.addService( pg.Execute( shell="sh", command= "chmod +x /local/repository/install_scripts/install_ndn_client.sh" )) node.addService( pg.Execute( shell="sh", command= "/local/repository/install_scripts/install_ndn_client.sh")) return nodes
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 run_install_script(this_node, script_name): """Runs a bash script from the install/ directory on a specific node.""" this_node.addService( pg.Execute(shell='sh', command='chmod +x /local/repository/install/' + script_name)) this_node.addService( pg.Execute(shell='sh', command='/local/repository/install/' + script_name))
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_std_RSpec(num_nodes = 4): print "cloudlab_profile.py :: create_std_RSpec :: Start" # Creating a Request object to start building the RSpec. request = portal.context.makeRequestRSpec() # Initializing a list to hold the node details. node_lst = [] # Dynamically creating the nodes. for i in xrange(num_nodes): # Adding a raw PC to the request node = request.RawPC("vm%d" % i) # Specifying the default disk image. node.disk_image = constants.UBUNTU_16_DISK_IMAGE # Creating Block Storage. bs = node.Blockstore("bs%d" % i, constants.BLOCKSTORE_DIRECTORY) bs.size = constants.BLOCKSTORE_SIZE # Changing the blockstore permissions. bs_perm_cmd = "sudo chmod 777 /mydata" node.addService(pg.Execute(shell="bash", command=bs_perm_cmd)) node_lst.append(node) # Creating a link between the nodes. request.Link(members=node_lst) return request
def b210_nuc_pair(idx, b210_node): b210_nuc_pair_node = request.RawPC("b210-%s-%s" % (b210_node.aggregate_id, "nuc2")) agg_full_name = "urn:publicid:IDN+%s.powderwireless.net+authority+cm" % ( b210_node.aggregate_id) b210_nuc_pair_node.component_manager_id = agg_full_name b210_nuc_pair_node.component_id = "nuc2" b210_nuc_pair_node.disk_image = GLOBALS.SRSLTE_IMG b210_nuc_pair_node.addService( rspec.Execute(shell="bash", command="/local/repository/bin/update-config-files.sh")) b210_nuc_pair_node.addService( rspec.Execute(shell="bash", command="/local/repository/bin/tune-cpu.sh")) if params.include_srslte_src: bs = b210_nuc_pair_node.Blockstore("bs-nuc-%s" % idx, "/opt/srslte") bs.dataset = GLOBALS.SRSLTE_SRC_DS
def add_household(self, house): """Summary Args: house (TYPE): Description Returns: TYPE: Description """ # Import optional libraries import geni.rspec.pg as PG import geni.rspec.igext as IGX speed = max(house.rate_up_kbps, house.rate_down_kbps) self.links.insert(self.house_count_local, PG.LAN('lan%d' % self.house_count)) self.links[self.house_count_local].bandwidth = int(speed) igvm = IGX.XenVM("house-%d" % house.unit_id) ip_netem = "10.0.%d.0" % self.house_count netem_str = "$(ip route get %s | head -n 1 | cut -d \ -f4)" % ( ip_netem) user_netem = house.netem_template_up(netem_str) server_netem = house.netem_template_down(netem_str) self.router.addService( PG.Execute(shell="/bin/sh", command=server_netem)) igvm.addService(PG.Execute(shell="/bin/sh", command=user_netem)) self.households.insert(self.house_count_local, igvm) iface = igvm.addInterface("if-%d-1" % self.house_count) iface.addAddress( PG.IPv4Address("10.0.%d.1" % self.house_count, "255.255.255.0")) self.links[self.house_count_local].addInterface(iface) server_iface = self.router.addInterface("if-%d-2" % self.house_count) server_iface.addAddress( PG.IPv4Address("10.0.%d.2" % self.house_count, "255.255.255.0")) self.links[self.house_count_local].addInterface(server_iface) self.house_count_local += 1 self.house_count += 1
def create_nodes(count=2, instantiateOn='pnode', cores=4, ram=8): """Allocates and runs an install script on a specified number of VM nodes Returns a list of nodes. """ nodes = [] # index nodes by their proper number (not zero-indexed) nodes.append(None) # create each VM for i in range(1, count + 1): nodes.append( mkVM('node' + str(i), GLOBALS.UBUNTU18_IMG, instantiateOn=instantiateOn, cores=cores, ram=ram)) # run alternating install scripts on each vm to install software odd_node = True for node in nodes: if node is not None: if odd_node: node.addService( pg.Execute( shell="sh", command="chmod +x /local/repository/install1.sh")) node.addService( pg.Execute(shell="sh", command="/local/repository/install1.sh")) else: node.addService( pg.Execute( shell="sh", command="chmod +x /local/repository/install2.sh")) node.addService( pg.Execute(shell="sh", command="/local/repository/install2.sh")) odd_node = not odd_node return nodes
def b210_nuc_pair(idx, b210_node, installs): node_name = b210_node.node_name.format(idx=idx) b210_nuc_pair_node = request.RawPC(b210_node.node_name.format(idx=idx)) b210_nuc_pair_node.component_manager_id = b210_node.aggregate_id b210_nuc_pair_node.component_id = b210_node.component_id b210_nuc_pair_node.disk_image = b210_node_disk_image service_command = " ".join([setup_command] + installs) b210_nuc_pair_node.addService( rspec.Execute(shell="bash", command=service_command))
def create_UEs(count, instantiate_on='pnode', cores=2, ram=4, prefix=1): """Allocates and runs an install script on a specified number of VM UE nodes. Returns a list of nodes. """ nodes = [] # index nodes at one nodes.append(None) # create each VM for i in range(1, count + 1): if i <= 10: nodes.append( make_VM('node' + str(prefix) + '-' + str(i), GLOBALS.UBUNTU18_IMG, instantiate_on[0], cores, ram)) elif i <= 20: nodes.append( make_VM('node' + str(prefix) + '-' + str(i), GLOBALS.UBUNTU18_IMG, instantiate_on[1], cores, ram)) elif i <= 30: nodes.append( make_VM('node' + str(prefix) + '-' + str(i), GLOBALS.UBUNTU18_IMG, instantiate_on[2], cores, ram)) # run client install script on each vm to install client software for node in nodes: if node is not None: node.addService( pg.Execute( shell="sh", command= "chmod +x /local/repository/setup/install_ndn_client.sh")) node.addService( pg.Execute( shell="sh", command="/local/repository/setup/install_ndn_client.sh")) return nodes
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)
def add_node_to_rspec(config_info, site_dict, link_ifaces, vn, rspec): ''' add node resource to RSpec ''' for site_id in site_dict: node_in_site = site_dict[site_id] for node_id in node_in_site: node = vn.node_dict[node_id] vm = ig.XenVM(node.hostname) # Nodes are bounded to particular InstaGENI Sites, add component_manager_id to RSpec if site_id != 'any': vm.component_manager_id = site_info.ig_site[int( site_id)].component_manager_id for iface in node.iface_list: vm_iface = vm.addInterface(iface.id) vm_iface.addAddress(pg.IPv4Address(iface.addr, iface.prefix)) link_ifaces[iface.link_id].append(vm_iface) if node.node_type == 'lan-sw': # invisible node for LAN topology, no need to add service, etc. pass else: # add node properties to non-"sw" type nodes vm.disk_image = node.disk_image service_list = config_info[ node.node_type]['install_script'].split('\n') cmd_list = config_info[node.node_type]['execute_cmd'].split( '\n') if "routable_control_ip" in config_info[node.node_type]: vm.routable_control_ip = config_info[ node.node_type]['routable_control_ip'] in YES for service in service_list: if service != '': service_url = service.split(',')[0].strip() service_path = service.split(',')[1].strip() vm.addService( pg.Install(url=service_url, path=service_path)) for cmd in cmd_list: if cmd != '': cmd_exe = cmd.split(',')[0].strip() cmd_shell = cmd.split(',')[1].strip() vm.addService( pg.Execute(shell=cmd_shell, command=cmd_exe)) rspec.addResource(vm) return rspec
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 x310_node_pair(idx, x310_radio, node_type, installs): radio_link = request.Link("radio-link-%d" % (idx)) radio_link.bandwidth = 10 * 1000 * 1000 node = request.RawPC( x310_radio.node_name.format(radio_name=x310_radio.radio_name, idx=idx)) node.hardware_type = node_type node.disk_image = x310_node_disk_image service_command = " ".join([setup_command] + installs) node.addService(rspec.Execute(shell="bash", command=service_command)) node_radio_if = node.addInterface("usrp_if") node_radio_if.addAddress(rspec.IPv4Address("192.168.40.1", "255.255.255.0")) radio_link.addInterface(node_radio_if) radio = request.RawPC("x310-%d" % (idx)) radio.component_id = x310_radio.radio_name radio_link.addNode(radio)
def create_request(request, role, ip, worker_num=None): if role == 'm': name = 'master' elif role == 's': name = 'worker-{}'.format(worker_num) req = request.RawPC(name) if role == 'm': req.routable_control_ip = True if params.osNodeTypeMaster: req.hardware_type = params.osNodeTypeMaster elif role == 's': req.routable_control_ip = params.publicIPSlaves if params.osNodeTypeSlave: req.hardware_type = params.osNodeTypeSlave req.disk_image = DISK_IMG req.addService( pg.Execute( 'sh', 'sudo -H bash /local/repository/bootstrap.sh {} {}> /local/logs/setup.log 2>/local/logs/error.log' .format(role, params.jupyterPassword))) iface = req.addInterface('eth9', pg.IPv4Address(ip, '255.255.255.0')) return iface
def create_routers(names, instantiate_on='pnode', cores=4, ram=8): """Allocates and runs an install script on virtualized routers. Returns a list of routers. """ routers = dict() for name in names: routers[name] = make_VM(name, GLOBALS.UBUNTU18_IMG, instantiate_on, cores, ram) # run base install script routers[name].addService( pg.Execute( shell="sh", command="chmod +x /local/repository/setup/router_install.sh")) routers[name].addService( pg.Execute(shell="sh", command="/local/repository/setup/router_install.sh")) # run appropriate install scripts based on name of router routers[name].addService( pg.Execute(shell="sh", command="chmod +x /local/repository/setup/" + name + ".sh")) routers[name].addService( pg.Execute(shell="sh", command="/local/repository/setup/" + name + ".sh")) # install pyndn client software routers[name].addService( pg.Execute( shell="sh", command="chmod +x /local/repository/setup/install_ndn_client.sh" )) routers[name].addService( pg.Execute( shell="sh", command="/local/repository/setup/install_ndn_client.sh")) return routers
# # Create our in-memory model of the RSpec -- the resources we're going # to request in our experiment, and their configuration. # request = pc.makeRequestRSpec() epclink = request.Link("s1-lan") # Checking for oaisim if params.TYPE == "sim": sim_enb = request.RawPC("sim-enb") sim_enb.disk_image = GLOBALS.OAI_SIM_IMG sim_enb.hardware_type = GLOBALS.SIM_HWTYPE sim_enb.addService( rspec.Execute(shell="sh", command=GLOBALS.OAI_CONF_SCRIPT + " -r SIM_ENB")) connectOAI_DS(sim_enb, 1) epclink.addNode(sim_enb) else: # Add a node to act as the ADB target host #adb_t = request.RawPC("adb-tgt") #adb_t.disk_image = GLOBALS.ADB_IMG # Add a NUC eNB node. enb1 = request.RawPC("enb1") if params.FIXED_ENB: enb1.component_id = params.FIXED_ENB enb1.hardware_type = GLOBALS.NUC_HWTYPE enb1.disk_image = GLOBALS.OAI_ENB_IMG enb1.Desire("rf-radiated" if params.TYPE == "ota" else "rf-controlled", 1) connectOAI_DS(enb1, 0)
node = request.XenVM("storage") else: node = request.XenVM("compute-" + str(i - 2)) node.cores = 2 node.ram = 4096 node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:CENTOS7-64-STD" iface = node.addInterface("if" + str(i - 3)) iface.component_id = "eth1" iface.addAddress(pg.IPv4Address("192.168.1." + str(i + 1), "255.255.255.0")) link.addInterface(iface) node.addService( pg.Execute(shell="sh", command="sudo chmod 755 /local/repository/passwordless.sh")) node.addService( pg.Execute(shell="sh", command="sudo /local/repository/passwordless.sh")) # Ben Walker's solution to address latency node.addService( pg.Execute(shell="sh", command="sudo chmod 755 /local/repository/ssh_setup.sh")) node.addService( pg.Execute( shell="sh", command= "sudo -H -u ab899511 bash -c '/local/repository/ssh_setup.sh'")) node.addService(
# Setup the cluster one node at a time. for host in hostnames: node = request.RawPC(host) node.hardware_type = params.hardware_type if params.image != "UBUNTU16-64-STD": node.disk_image = urn.Image(cloudlab.Utah, "ramcloud-PG0:%s" % params.image) else: node.disk_image = urn.Image(cloudlab.Utah, "emulab-ops:%s" % params.image) # Install a private/public key on this node node.installRootKeys(True, True) node.addService(pg.Execute(shell="sh", command="sudo /local/repository/system-setup.sh %s %s %s %s" % \ (nfs_shared_home_export_dir, nfs_datasets_export_dir, params.username, params.num_nodes))) # Add this node to the cluster LAN. clan.addInterface(node.addInterface("if1")) if host == "nfs": nfs_bs = node.Blockstore(host + "_nfs_bs", nfs_shared_home_export_dir) nfs_bs.size = params.nfs_storage_size # Add this node to the dataset blockstore LAN. if (len(dataset_urns) > 0): dslan.addInterface(node.addInterface("if2")) else: local_storage_bs = node.Blockstore(host + "_local_storage_bs", node_local_storage_dir) local_storage_bs.size = params.local_storage_size
# Setup the Tour info with the above description and instructions. # tour = IG.Tour() tour.Description(IG.Tour.TEXT, tourDescription) request.addTour(tour) prefixForIP = "192.168.1." link = request.LAN("lan") num_nodes = 2 for i in range(num_nodes): if i == 0: node = request.RawPC("arldcn28") else: node = request.RawPC("arldcn24") node.routable_control_ip = "true" node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU18-64-STD" iface = node.addInterface("if" + str(i)) iface.component_id = "eth1" iface.addAddress(pg.IPv4Address(prefixForIP + str(i + 1), "255.255.255.0")) link.addInterface(iface) # setup Docker node.addService( pg.Execute(shell="sh", command="sudo bash /local/repository/install_docker.sh")) node.addService( pg.Execute(shell="/bin/bash", command="sudo bash /local/repository/setuptutum.sh")) pc.printRequestRSpec(request)
import geni.portal as portal import geni.rspec.pg as pg pc = portal.Context() request = pc.makeRequestRSpec() # Add a raw PC to the request. node = request.XenVM("node") node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU16-64-STD" node.routable_control_ip = "true" # Install and execute a script that is contained in the repository. node.addService(pg.Execute(shell="sh", command="sudo chmod 755 /local/repository/webserver.sh")) node.addService(pg.Execute(shell="sh", command="/local/repository/webserver.sh")) # Print the RSpec to the enclosing page. pc.printRequestRSpec(request)
elif i == 2: node = request.XenVM("storage") else: node = request.XenVM("compute-" + str(i-2)) node.cores = 2 node.ram = 4096 node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:CENTOS7-64-STD" iface = node.addInterface("if" + str(i)) iface.component_id = "eth1" iface.addAddress(pg.IPv4Address(prefixForIP + str(i + 1), "255.255.255.0")) link.addInterface(iface) node.addService(pg.Execute(shell="sh", command="sudo chmod 755 /local/repository/passwordless.sh")) node.addService(pg.Execute(shell="sh", command="sudo /local/repository/passwordless.sh")) node.addService(pg.Execute(shell="sh", command="sudo systemctl disable firewalld")) if i == 0: #enable and start the nfs server service node.addService(pg.Execute(shell="sh", command="sudo systemctl enable nfs-server.service")) node.addService(pg.Execute(shell="sh", command="sudo systemctl start nfs-server.service")) #create the nfs directory node.addService(pg.Execute(shell="sh", command="sudo mkdir /software")) node.addService(pg.Execute(shell="sh", command="sudo chmod -R 777 /software")) node.addService(pg.Execute(shell="sh", command="sudo chown nfsnobody:nfsnobody /software")) #delete the current empty exports and copy the new exports form github node.addService(pg.Execute(shell="sh", command="sudo mv /local/repository/xport_software /etc/exports")) #export the NFS shares directory node.addService(pg.Execute(shell="sh", command="sudo chmod 777 /etc/exports")) node.addService(pg.Execute(shell="sh", command="sudo exportfs -a"))
switch_2 = request.RawPC("switch2") switch_3 = request.RawPC("switch3") # This is the master switch which connect switch 1 & 2 controller = request.RawPC("controller") # Proxy server will run inside switches 1 & 2 # proxy_server_1 = request.RawPC("proxy_server1") # proxy_server_2 = request.RawPC("proxy_server2") # Set up servers which clients will ping server_1 = request.RawPC("server1") server_2 = request.RawPC("server2") # Setup python servers in server_1 and server_2 link_py_server = "https://raw.githubusercontent.com/spartakos87/my_thesis/master/powderwireless/setup_servers.py" get_py_server = "wget "+link_py_server run_py_server = "python setup_servers.py" server_1.addService(rspec.Execute(shell="bash", command="cd /home && "+get_py_server+"&& "+run_py_server)) server_2.addService(rspec.Execute(shell="bash", command=get_py_server+"; "+run_py_server)) # Install Squid in proxy_server install_squid = "sudo apt-get --assume-yes install squid" update = "sudo apt-get update" # proxy_server_1.addService(rspec.Execute(shell="bash", command=update+"; "+install_squid)) # proxy_server_2.addService(rspec.Execute(shell="bash", command=update+"; "+install_squid)) # Install POX in controller node cmd = "cd /home && sudo mkdir POX && sudo git clone http://github.com/noxrepo/pox" controller.addService(rspec.Execute(shell="bash", command=cmd))
if i == 0: node = request.XenVM("head") else: node = request.XenVM("worker-" + str(i)) node.cores = 4 node.ram = 8192 node.routable_control_ip = "true" node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU18-64-STD" iface = node.addInterface("if" + str(i)) iface.component_id = "eth1" iface.addAddress(pg.IPv4Address(prefixForIP + str(i + 1), "255.255.255.0")) link.addInterface(iface) # setup Docker node.addService( pg.Execute(shell="sh", command="sudo bash /local/repository/install_docker.sh")) # setup Kubernetes node.addService( pg.Execute( shell="sh", command="sudo bash /local/repository/install_kubernetes.sh")) node.addService(pg.Execute(shell="sh", command="sudo swapoff -a")) if i == 0: node.addService( pg.Execute(shell="sh", command="sudo bash /local/repository/kube_manager.sh")) else: node.addService( pg.Execute(shell="sh", command="sudo bash /local/repository/kube_worker.sh"))
# Setup the Tour info with the above description and instructions. # tour = IG.Tour() tour.Description(IG.Tour.TEXT,tourDescription) request.addTour(tour) prefixForIP = "192.168.1." link = request.LAN("lan") for i in range(4): if i == 0: node = request.RawPC("head") else: node = request.RawPC("worker-" + str(i)) node.routable_control_ip = "true" node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU16-64-STD" iface = node.addInterface("if" + str(i)) iface.component_id = "eth1" iface.addAddress(pg.IPv4Address(prefixForIP + str(i + 1), "255.255.255.0")) link.addInterface(iface) node.addService(pg.Execute(shell="sh", command="sudo bash /local/repository/passwordless.sh")) node.addService(pg.Execute(shell="sh", command="sudo bash /local/repository/install_kvm.sh")) node.addService(pg.Execute(shell="sh", command="sudo bash /local/repository/install_docker.sh")) # Print the RSpec to the enclosing page. pc.printRequestRSpec(request)
# Retrieve the values the user specifies during instantiation. params = pc.bindParameters() # Create a Request object to start building the RSpec. request = pc.makeRequestRSpec() # Node client node_client = request.RawPC('client') node_client.disk_image = 'urn:publicid:IDN+wisc.cloudlab.us+image+cloudlab-PG0//l4s-apr25' iface0 = node_client.addInterface('interface-0') bs0 = node_client.Blockstore("bs0", "/kernel") bs0.size = "30GB" node_client.addService( pg.Execute(shell="sh", command="/usr/bin/sudo /usr/bin/git clone " + params.git + " /tmp/custom-repo; cd /tmp/custom-repo; /usr/bin/sudo bash " + params.client)) # Node M1 node_M1 = request.RawPC('M1') node_M1.disk_image = 'urn:publicid:IDN+wisc.cloudlab.us+image+cloudlab-PG0//l4s-apr25' iface1 = node_M1.addInterface('interface-5') iface2 = node_M1.addInterface('interface-1') bs1 = node_M1.Blockstore("bs1", "/kernel") bs1.size = "30GB" # Node dstn node_dstn = request.RawPC('dstn') node_dstn.disk_image = 'urn:publicid:IDN+wisc.cloudlab.us+image+cloudlab-PG0//l4s-apr25' iface3 = node_dstn.addInterface('interface-8') bs5 = node_dstn.Blockstore("bs5", "/kernel")
# Import the ProtoGENI library. import geni.rspec.pg as pg # Create a portal context. pc = portal.Context() # Create a Request object to start building the RSpec. request = pc.makeRequestRSpec() link = request.LAN("lan") # Loop through creation of nodes. for i in range(1, 5): node = request.XenVM(str("node-") + str(i)) node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:CENTOS7-64-STD" interface = node.addInterface("iface" + str(i)) interface.component_id = "eth1" interface.addAddress(pg.IPv4Address("192.168.1." + str(i), "255.255.255.0")) link.addInterface(interface) if (i == 1): node.routable_control_ip = "true" # Install and execute a script that is contained in the repository. node.addService( pg.Execute(shell="sh", command="/local/repository/silly.sh")) # Print the RSpec to the enclosing page. pc.printRequestRSpec(request)
# #node.addService(pg.Execute(shell="sh", command="sudo -p mkdir /software")) # node.addService(pg.Execute(shell="sh", command="sudo -p mkdir /users/BC843101/software")) # if i == 2: # #node.addService(pg.Execute(shell="sh", command="sudo -p mkdir /scratch")) # node.addService(pg.Execute(shell="sh", command="sudo -p mkdir /users/BC843101/scratch")) # else: # node.addService(pg.Execute(shell="sh", command="sudo -p mkdir /users/BC843101/software")) # node.addService(pg.Execute(shell="sh", command="sudo -p mkdir /users/BC843101/scratch")) if i == 0: node = request.XenVM("head") node.routable_control_ip = "true" # addServices to create NFS server on head node (directory: /software) node.addService( pg.Execute( shell="sh", command="sudo chmod 755 /local/repository/nfs_head_setup.sh")) node.addService( pg.Execute(shell="sh", command="sudo /local/repository/nfs_head_setup.sh")) node.addService( pg.Execute( shell="sh", command="sudo chmod 755 /local/repository/mountHead.sh")) node.addService( pg.Execute(shell="sh", command="sudo /local/repository/mountHead.sh")) # addServices to install MPI in the /software directory on head node node.addService( pg.Execute( shell="sh",