Пример #1
0
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)
Пример #2
0
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
Пример #3
0
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
Пример #4
0
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)
Пример #5
0
    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
Пример #6
0
def create_lan(nodes):
    lan = pg.LAN("lan")

    # create an interface for each node and add it to the lan
    for i, n in enumerate(nodes):
        iface = n.addInterface("if1")
        iface.component_id = "eth1"
        iface.addAddress(
            pg.IPv4Address("192.168.1.{}".format(i + 1), "255.255.255.0"))
        lan.addInterface(iface)

    return lan
Пример #7
0
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
Пример #8
0
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)
Пример #9
0
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
Пример #10
0
def create_node(name, nodes, lan):
    # Create node
    node = request.RawPC(name)
    node.disk_image = IMAGE
    node.hardware_type = params.nodeType

    # Add interface
    iface = node.addInterface("if1")
    iface.addAddress(
        rspec.IPv4Address("{}.{}".format(BASE_IP, 1 + len(nodes)),
                          "255.255.255.0"))
    lan.addInterface(iface)

    # Add extra storage space
    bs = node.Blockstore(name + "-bs", "/mydata")
    bs.size = str(params.tempFileSystemSize) + "GB"
    bs.placement = "any"

    # Add to node list
    nodes.append(node)
Пример #11
0
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)
Пример #12
0
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)
Пример #13
0
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
Пример #14
0
for i in range(params.nodeCount):
    # Create a node and add it to the request
    if params.useVMs:
        name = "vm" + str(i)
        node = request.XenVM(name)
    else:
        name = "node" + str(i)
        node = request.RawPC(name)
    if params.osImage and params.osImage != "default":
        node.disk_image = params.osImage
    # Add to lan
    if params.nodeCount > 1:
        for j in range(params.numNetworkInterface):
            iface = node.addInterface(
                "eth%d" % (j + 1),
                pg.IPv4Address('192.168.%d.%d' % (j, i + 1), '255.255.255.0'))
            lans[j].addInterface(iface)
    # Optional hardware type.
    if params.phystype != "":
        node.hardware_type = params.phystype
    # Optional Blockstore
    if params.tempFileSystemSize > 0 or params.tempFileSystemMax:
        bs = node.Blockstore(name + "-bs", params.tempFileSystemMount)
        if params.tempFileSystemMax:
            bs.size = "0GB"
        else:
            bs.size = str(params.tempFileSystemSize) + "GB"
        bs.placement = "any"
    # Link between the nfsServer and the ISCSI device that holds the dataset
    if params.DATASET != "":
        # We need a link to talk to the remote file system, so make an interface.
Пример #15
0
# ip assignment below.

CORES = [1, 2]
RAMS = [2048, 4096]

# Boiler plate
import geni.portal as portal
import geni.rspec.pg as rspec

request = portal.context.makeRequestRSpec()

# Set up a physical target
target1 = request.XenVM("target1")
target1iface = target1.addInterface("if1")
target1iface.component_id = "eth1"
target1iface.addAddress(rspec.IPv4Address("10.10.1.1", "255.255.255.0"))

# Set up VMs with various properties
nodes = []
ifaces = []
ipCount = 2
for cores in CORES:
    for ram in RAMS:
        newNodeName = "node_c" + str(cores) + "_r" + str(ram)
        newNode = request.XenVM(newNodeName)
        newNode.cores = cores
        newNode.ram = ram
        newIface = newNode.addInterface("if" + str(ipCount))
        newIface.component_id = "eth1"
        newIface.addAddress(
            rspec.IPv4Address("10.10.1." + str(ipCount), "255.255.255.0"))
Пример #16
0
# 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")
Пример #17
0
link = request.LAN("lan")

# Generate the nodes
for i in range(params.workerCount + 2):
    if i == 0:
        node = request.RawPC(params.controllerHost)
    elif i == 1:
        node = request.RawPC(params.database)
    else:
        node = request.RawPC("node" + str(i))

    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(
        rspec.IPv4Address("192.168.1." + str(i + 1), "255.255.255.0"))
    link.addInterface(iface)

    node.addService(
        rspec.Execute(
            shell="/bin/sh",
            command="sudo adduser --ingroup adm --disabled-password greenfield"
        ))
    node.addService(
        rspec.Execute(shell="/bin/sh", command="sudo adduser greenfield sudo"))
    node.addService(
        rspec.Execute(shell="/bin/sh", command="sudo apt-get update"))
    node.addService(
        rspec.Execute(
            shell="/bin/sh",
            command="sudo apt-get install -y python-setuptools python-pip"))
Пример #18
0
pc = portal.Context()

# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()
 
# Create local topology
link = request.LAN("lan")

# Add four XenVMs to the request.
for i in range(1, 5):    
    node = request.XenVM("node-" + str(i)) 
    node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:CENTOS7-64-STD"
    
    iface = node.addInterface("if" + str(i))
    iface.component_id = "eth" + str(i)
    
    # assign unique IPs
    iface.addAddress(rspec.IPv4Address("192.168.1." + str(i), "255.255.255.0"))        
    link.addInterface(iface)
    

    # if node-1, give it a public interface
    if i == 1:
        node.routable_control_ip = True
        # install and run Apache server on public-facing machine
        node.addService(rspec.Execute(shell="sh", command="/local/repository/silly.sh"))
        

# Print the RSpec to the enclosing page.
pc.printRequestRSpec(request)
Пример #19
0
    nodes.append(request.XenVM("node%d" % i))
    nodes[
        i].disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU16-64-STD"

    nodes[i].addService(
        rspec.Execute(
            shell="sh",
            command=
            "wget -O /tmp/endpoint.sh https://raw.githubusercontent.com/noormoha/cloudlab-wancast-config/master/endpoint.sh"
        ))
    nodes[i].addService(
        rspec.Execute(shell="sh",
                      command="sh /tmp/endpoint.sh %d > /tmp/endpoint.log" %
                      (i + 1)))

lan_id = 0
for topo_link in test_topo:
    link = request.LAN("lan%d" % lan_id)
    lan_id += 1
    link.bandwidth = base_capacity

    iface1 = nodes[topo_link[0]].addInterface("ifto%d" % topo_link[1])
    iface1.addAddress(rspec.IPv4Address(topo_link[2], "255.255.255.0"))
    iface2 = nodes[topo_link[1]].addInterface("ifto%d" % topo_link[0])
    iface2.addAddress(rspec.IPv4Address(topo_link[3], "255.255.255.0"))

    link.addInterface(iface1)
    link.addInterface(iface2)

portal.context.printRequestRSpec()
Пример #20
0
# 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)
Пример #21
0
counter = 1

# ifaces. 
ifaces = []

# Nodes at Site One.
for i in range(1,9,1): #single site mode with 6 replicas 
    node = request.RawPC("node" + str(counter))
    node.disk_image = disk_image
    node.hardware_type = "m510"
    # Assign to Site One.
    node.Site("Site1")
    # Create iface and assign IP
    iface = node.addInterface("eth1")
    # Specify the IPv4 address
    iface.addAddress(pg.IPv4Address("192.168.101.10" + str(counter), "255.255.255.0"))
    ifaces.append(iface)
    counter = counter + 1
    pass

# Now add the link to the rspec. 
lan = request.LAN("lan")

# Must provide a bandwidth. BW is in Kbps
#lan.bandwidth = 100000

#link1 = request.L1Link("link1")

# Add interfaces to lan
for iface in ifaces:
    #link1.addInterface(iface)
Пример #22
0
# Setup experiments for individual students plus one lab instructor
lan = RSpec.LAN()
rspec.addResource(lan)
prefixForIP = "192.168.1."
local_ip_count = 0
for i in range(params.machines):
    if i == 0:
        node = Node("head")
    else:
        node = Node("worker_" + str(i + 1))
    node.disk_image = IMAGE
    local_ip_count += 1
    iface = node.addInterface("if" + str(local_ip_count))
    iface.component_id = "eth1"
    iface.addAddress(
        RSpec.IPv4Address(prefixForIP + str(local_ip_count), "255.255.255.0"))
    lan.addInterface(iface)

    # setup NFS
    if i == 0:
        node.addService(RSpec.Execute("sh", "sudo apt-get update"))
        node.addService(
            RSpec.Execute("sh", "sudo apt-get install -y nfs-kernel-server"))
        node.addService(RSpec.Execute("sh", "sudo mkdir -p /opt/keys"))
        node.addService(
            RSpec.Execute("sh", "sudo chown nobody:nogroup /opt/keys"))
        for k in range(1, params.machines):
            node.addService(
                RSpec.Execute(
                    "sh", "sudo echo '/opt/keys 192.168.1." + str(k + 1) +
                    "(rw,sync,no_root_squash,no_subtree_check)' | sudo tee -a /etc/exports"
Пример #23
0
pc.defineParameter("DATASET2", "URN of your dataset2",
                   portal.ParameterType.STRING, "")

# Always need this when using parameters
params = pc.bindParameters()

cachelan = request.LAN('cacheLan')

# The NFS server.
nfsServer = request.RawPC(nfsServerName)
nfsServer.disk_image = params.osImage
nfsServer.hardware_type = params.phystype

iface = nfsServer.addInterface("eth2",
                               pg.IPv4Address('192.168.1.1', '255.255.255.0'))
cachelan.addInterface(iface)
# Initialization script for the server
nfsServer.addService(
    pg.Execute(
        shell="sh",
        command="sudo /bin/cp /local/repository/.bashrc /users/yangdsh/"))
nfsServer.addService(
    pg.Execute(
        shell="sh",
        command=
        "sudo cp /proj/lrbplus-PG0/workspaces/yangdsh/id_rsa /users/yangdsh/.ssh/"
    ))
nfsServer.addService(
    pg.Execute(shell="sh",
               command="sudo chown yangdsh /users/yangdsh/.ssh/id_rsa"))
Пример #24
0
# Link between routers
link_r = request.Link('link-r')
link_r.Site('Site 1')

# Link between webserver and router 3
link_web = request.Link('link-web')
link_web.Site('Site 1')

# First, set up routers

# Node router1
node_router_1 = request.XenVM('router1')
node_router_1.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU18-64-STD'
node_router_1.Site('Site 1')
iface_r1 = node_router_1.addInterface('interface-router1', pg.IPv4Address('10.10.254.1','255.255.255.0'))
iface_r1.bandwidth = params.cap
link_r.addInterface(iface_r1)

# Node router2
node_router_2 = request.XenVM('router2')
node_router_2.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU18-64-STD'
node_router_2.Site('Site 1')
iface_r2 = node_router_2.addInterface('interface-router2', pg.IPv4Address('10.10.254.2','255.255.255.0'))
iface_r2.bandwidth = params.cap
link_r.addInterface(iface_r2)

# Node router3
node_router_3 = request.XenVM('router3')
node_router_3.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU18-64-STD'
node_router_3.Site('Site 1')
Пример #25
0
epc.addService(
    rspec.Execute(shell="sh", command=GLOBALS.OAI_CONF_SCRIPT + " -r EPC"))
connectOAI_DS(epc, 1)

# 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
connectOAI_DS(enb1, 1)
enb1.addService(
    rspec.Execute(shell="sh", command=GLOBALS.OAI_CONF_SCRIPT + " -r ENB"))
#enb1_rue1_rf = enb1.addInterface("rue1_rf")
enb1_usrp_if = enb1.addInterface("usrp_if")
enb1_usrp_if.addAddress(rspec.IPv4Address("192.168.30.1", "255.255.255.0"))

# Add an OTS (Nexus 5) UE
#rue1 = request.UE("rue1")
#if params.FIXED_UE:
#    rue1.component_id = params.FIXED_UE
#rue1.hardware_type = GLOBALS.UE_HWTYPE
#rue1.disk_image = GLOBALS.UE_IMG
#rue1.adb_target = "adb-tgt"
#rue1_enb1_rf = rue1.addInterface("enb1_rf")

# Create the RF link between the Nexus 5 UE and eNodeB
#rflink2 = request.RFLink("rflink2")
#rflink2.addInterface(enb1_rue1_rf)
#rflink2.addInterface(rue1_enb1_rf)
Пример #26
0
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))
    elif params.Infiniswap:
      cpnode.addService(rspec.Execute(shell="sh",command=INFINISWAP_CMD))
    else:
      cpnode.addService(rspec.Execute(shell="sh",command=BASE_CMD))
    request.addResource(cpnode)
    computeNodeList += cpname + ' '
    pass
Пример #27
0
# Import the ProtoGENI library.
import geni.rspec.pg as pg
# Import the emulab extensions library.
import geni.rspec.emulab as emulab

# Create a portal context.
pc = portal.Context()

# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()

# Add a raw PC to the request and give it an interface.
node1 = request.RawPC("node1")
iface1 = node1.addInterface()
# Specify the IPv4 address
iface1.addAddress(pg.IPv4Address("192.168.1.1", "255.255.255.0"))

# Add another raw PC to the request and give it an interface.
node2 = request.RawPC("node2")
iface2 = node2.addInterface()
# Specify the IPv4 address
iface2.addAddress(pg.IPv4Address("192.168.1.2", "255.255.255.0"))

# Create the bridged link between the two nodes.
link = request.BridgedLink("link")
# Add the interfaces we created above.
link.addInterface(iface1)
link.addInterface(iface2)

# Give bridge some shaping parameters.
link.bandwidth = 10000
Пример #28
0
                      command="/local/onvm/onvm-tutorial/setup.sh"))
    nodes.append(node)
    cnt = cnt + 1

# Link 1---(n-2)
for n in range(1, NUM_NODES - 2):
    if1 = nodes[n].addInterface()
    if2 = nodes[n + 1].addInterface()
    link = request.Link("link" + str(n) + "-" + str(n + 1))
    link.addInterface(if1)
    link.addInterface(if2)

# Link 0---1
n = 0
if1 = nodes[n].addInterface()
if1.addAddress(rspec.IPv4Address("192.168.1.1", "255.255.255.0"))
if2 = nodes[n + 1].addInterface()
link = request.Link("link" + str(n) + "-" + str(n + 1))
link.addInterface(if1)
link.addInterface(if2)
# Link (n-2)---(n-1)
n = NUM_NODES - 2
if1 = nodes[n].addInterface()
if2 = nodes[n + 1].addInterface()
if2.addAddress(
    rspec.IPv4Address("192.168.1." + str(NUM_NODES), "255.255.255.0"))
link = request.Link("link" + str(n) + "-" + str(n + 1))
link.addInterface(if1)
link.addInterface(if2)

# Print the RSpec to the enclosing page.
Пример #29
0
# 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)
Пример #30
0
doh_resolvers={'cloudflare':1}

interfaces = []
for key in doh_resolvers:
    # node doh_cloudflare
    kube_doh = request.RawPC(str(key))
    kube_doh.hardware_type = params.osNodeType
    kube_doh.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU18-64-STD'
    kube_doh.Site(str(key))

    iface0 = kube_doh.addInterface('interface-0')
    iface0.component_id="eth1"
    ip_address_end = doh_resolvers[key]
    ip_address_base="10.10.0."
    iface0.addAddress(pg.IPv4Address(ip_address_base + str(ip_address_end),"255.255.255.0"))
    interfaces.append(iface0)

    bs0 = kube_doh.Blockstore('bs0', '/mnt/extra')
    bs0.size = '1GB'
    bs0.placement = 'NONSYSVOL'

    #start doh_capture
    kube_doh.addService(pg.Execute(shell="bash", command="/local/repository/cloudlabs_start.sh "+str(doh_resolvers[key])))

# connecting containers
link_m = request.Link('link-0')
link_m.Site('undefined')
link_m.addInterface(iface0)
for iface in interfaces:
    link_m.addInterface(iface)