コード例 #1
0
"""This is a trivial example of a gitrepo-based profile; The profile source code and other software, documentation, etc. are stored in in a publicly accessible GIT repository (say, github.com). When you instantiate this profile, the repository is cloned to all of the nodes in your experiment, to `/local/repository`. 

This particular profile is a simple example of using a single raw PC. It can be instantiated on any cluster; the node will boot the default operating system, which is typically a recent version of Ubuntu.

Instructions:
Wait for the profile instance to start, then click on the node in the topology and choose the `shell` menu item. 
"""

# Import the Portal object.
import geni.portal as portal
# 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)
コード例 #2
0
# The second field of every tupule is what is displayed on the cloudlab
# dashboard.
images = [("UBUNTU16-64-STD", "Ubuntu 16.04 (64-bit)")]

# The possible set of node-types this cluster can be configured with.
nodes = [
    ("d430", "d430 (2 x Xeon E5 2630v3, 64 GB RAM, 10 Gbps Intel Ethernet)"),
    ("c6420", "c6420 (2 x Xeon Gold 6142, 384 GB RAM, 10 Gbps Intel Ethernet)")
]

# The set of disks to mount.
disks = ["/dev/sdb", "/dev/sdc"]

# Allows for general parameters like disk image to be passed in. Useful for
# setting up the cloudlab dashboard for this profile.
context = portal.Context()

# Default the disk image to 64-bit Ubuntu 16.04
context.defineParameter("image", "Disk Image",
        portal.ParameterType.IMAGE, images[0], images,
        "Specify the base disk image that all the nodes of the cluster " +\
        "should be booted with.")

# Default the node type to the d430.
context.defineParameter("type", "Node Type",
        portal.ParameterType.NODETYPE, nodes[0], nodes,
        "Specify the type of nodes the cluster should be configured with. " +\
        "For more details, refer to " +\
        "\"http://docs.cloudlab.us/hardware.html#%28part._apt-cluster%29\"")

# Default the cluster size to 2 nodes.