[[PageOutline(2-3, Table of Contents)]] = Using GENI-in-a-Box = This page describes how to install and use [wiki:GENI-in-a-Box] on your computer. == 1 Install GENI-in-a-Box == ''Please make sure you have [https://www.virtualbox.org VirtualBox] Version 4.1.16 or later installed on your computer.'' 1. Start up !VirtualBox and from the !VirtualBox "File" menu, select "Import Appliance...". 2. The !VirtualBox Appliance Wizard will start up and guide you through the import of the GENI-in-a-Box virtual machine image you downloaded. Please accept the default VM settings during the import. 3. When the import is done, and entry for GENI-in-a-Box will appear in the Oracle VM !VirtualBox Manager window. Select this entry and click the green arrow labeled Start at the top of this window. A new window will open up and you will see Linux boot up in this window. You will automatically be logged into this Linux virtual machine when it is booted. == 2 Get Started with a Simple Experiment == === 2.1 Discover Resources === We start by finding out the aggregates available to us inside GENI-in-a-Box and learning about the resources advertised by these aggregates: 1. After you are logged into the GENI-in-a-Box virtual machine, open up a terminal window by clicking on the icon for a terminal on top of the screen. 2. In the terminal window, use Omni to list the aggregates available to you using the command {{{omni.py listaggregates}}}. You should see something like this in your terminal window: {{{ $ omni.py listaggregates INFO:omni:Loading config file /home/gibuser/.gcf/omni_config INFO:omni:Using control framework gib_ch INFO:omni:Listing 1 aggregates... INFO:omni: Aggregate 1: urn:publicid:IDN+geni:gpo:gcf:am1+authority+am http://geni-in-a-box.net:8001 INFO:omni: ------------------------------------------------------------ INFO:omni: Completed listaggregates: Options as run: framework: gib_ch getversionCacheName: /home/gibuser/.gcf/get_version_cache.json Args: listaggregates Result Summary: Found 1 aggregate. URN: urn:publicid:IDN+geni:gpo:gcf:am1+authority+am; URL: http://geni-in-a-box.net:8001 INFO:omni: ============================================================ $ }}} Look at the {{{Result Summary}}} from Omni. You'll see that Omni found one aggregate available to you at URL {{{http://geni-in-a-box.net:8001}}}. This is the aggregate you will use to run your experiments. 3. Now, let's find out the resources advertised by this aggregate using omni. {{{ $ omni.py -a http://geni-in-a-box.net:8001 listresources INFO:omni:Loading config file /home/gibuser/.gcf/omni_config INFO:omni:Using control framework gib_ch INFO:omni:Listed resources on 1 out of 1 possible aggregates. INFO:omni: INFO:omni: INFO:omni: ... INFO:omni: ------------------------------------------------------------ INFO:omni: Completed listresources: Options as run: aggregate: ['http://geni-in-a-box.net:8001'] framework: gib_ch getversionCacheName: /home/gibuser/.gcf/get_version_cache.json Args: listresources Result Summary: Queried resources from 1 of 1 aggregate(s). INFO:omni: ============================================================ $ }}} The output of the command is the ''advertisement rspec'' from the GENI-in-a-Box aggregate. You'll see the aggregate advertises six compute resources. Only two are shown here for readability reasons but you will find the complete advertisement rspec [attachment:gib-advert.rspec here]. Look at the description of the first resource in the rspec. This compute resource is an openVZ container running Fedora 15 image (or an Ubuntu 10 image if you are using the Ubuntu flavor of GENI-in-a-Box). The resource has four network interfaces: {{{eth0}}} through {{{eth3}}}. {{{eth0}}} is a control interface and is not available to the experimenter. All six compute resources advertised by this aggregate are identical. You can therefore use this aggregate to create experiment topologies with up to six nodes and up to three links per node. ''Notice the {{{-a}}} option to Omni that gave it the URL of the aggregate manager on which we wish to invoke {{{list resources}}}. To save us from having to type this URL every time we use an Omni command that acts on this aggregate manager, we have defined a ''nickname'' {{{gib}}} for this aggregate. This nickname is defined in the file {{{~/.gcf/omni_config}}}. From now on we will use this nickname instead of the aggregate manager URL with Omni commands that require an aggregate URL.'' === 2.2 Acquire and Configure Resources === Before we run an experiment we need to acquire the resources needed the experiment. Our introductory experiment will consist of two hosts connected to one another by a single link. When the hosts come up they execute a script provided by us that: * Downloads and installs iperf on each host. * Runs iperf in server mode on one host and and in client mode on the other host. The outputs of the iperf commands are written to /var/www/html/iperf-server.log and /var/www/html/iperf-client.log on the respective hosts. As a part of this experiment we will ssh into these hosts to view these logs. The request rspec for this experiment (and other examples of request rspecs) are in the directory {{{~/geni-in-a-box}}}. {{{ $ cd geni-in-a-box $ ls example-scripts install-example.rspec README.txt two-nodes-iperf.rspec four-nodes.rspec islands.rspec three-nodes-lan.rspec two-nodes-iperf.rspec~ $ }}} We'll use the rspec file called two-nodes-iperf.rspec. You can view it [attachment:two-nodes-iperf.rspec here] or inside the VM. This rspec requests two hosts called {{{left}}} and {{{right}}}. Host {{{left}}} has one interface called {{{left:if0}}} and host {{{right}}} has one interface called {{{right:if0}}}. The two interfaces are connected by a link called {{{left-right-lan}}}. The following figure illustrates the resources requested by this rspec. [[Image(ResourcesRequested.png, 45%)]] The {{{}}} element in the rspec asks the GENI-in-a-Box aggregate manager to download a [attachment:iperf-script.sh script] from the specified URL, uncompress and untar it, and save it in the {{{/local}}} directory. The {{{}}} element asks the aggregate to execute the specified script when the hosts come up. In this case the script to be executed is the one that was installed in {{{/local}}}. The following steps will walk us through acquiring the resources for our experiment: 1. First we need to create a slice using the command {{{omni.py createslice myslice}}} where {{{myslice}}} is the name or our slice (of course you can give your slice some other name). {{{ $ omni.py createslice myslice INFO:omni:Loading config file /home/gibuser/.gcf/omni_config INFO:omni:Using control framework gib_ch INFO:omni:Created slice with Name myslice, URN urn:publicid:IDN+geni:gpo:gcf+slice+myslice, Expiration 2012-09-28 23:49:43 INFO:omni: ------------------------------------------------------------ INFO:omni: Completed createslice: Options as run: framework: gib_ch getversionCacheName: /home/gibuser/.gcf/get_version_cache.json Args: createslice myslice Result Summary: Created slice with Name myslice, URN urn:publicid:IDN+geni:gpo:gcf+slice+myslice, Expiration 2012-09-28 23:49:43 INFO:omni: ============================================================ $ }}} 2. We now send our [attachment:two-nodes-iperf.rspec request rspec] to the GENI-in-a-Box aggregate manager using the command {{{omni.py -a http://geni-in-a-box.net:8001 createsliver myslice two-nodes-iperf.rspec}}}. ''This command will take many minutes to complete because it configures and boots up the requested virtual machines; does some additional configuration; and download, installs, and runs iperf.'' If our request is successful, the aggregate manager will allocate the requested resources to our slice. In GENI parlance the resources allocated to our slice are called slivers. The {{{createsliver}}} request returns a manifest spec that provides details of the resources allocated to us. The following is a snippet of the manifest your will get back from {{{createsliver}}}: {{{ $ omni.py -a gib createsliver myslice two-nodes-iperf.rspec INFO:omni:Loading config file /home/gibuser/.gcf/omni_config INFO:omni:Using control framework gib_ch WARNING:omni:Slice urn:publicid:IDN+geni:gpo:gcf+slice+myslice expires in <= 3 hours INFO:omni:Slice urn:publicid:IDN+geni:gpo:gcf+slice+myslice expires on 2012-10-16 14:51:59 UTC INFO:omni:Substituting AM nickname gib with URL http://geni-in-a-box.net:8001, URN unspecified_AM_URN INFO:omni:Substituting AM nickname gib with URL http://geni-in-a-box.net:8001, URN unspecified_AM_URN INFO:omni:Creating sliver(s) from rspec file two-nodes-iperf.rspec for slice urn:publicid:IDN+geni:gpo:gcf+slice+myslice INFO:omni:Got return from CreateSliver for slice myslice at http://geni-in-a-box.net:8001: INFO:omni: INFO:omni: INFO:omni: ... INFO:omni: ------------------------------------------------------------ INFO:omni: Completed createsliver: Options as run: aggregate: ['gib'] framework: gib_ch getversionCacheName: /home/gibuser/.gcf/get_version_cache.json Args: createsliver myslice two-nodes-iperf.rspec Result Summary: Got Reserved resources RSpec from geni-in-a-box-net-8001 INFO:omni: ============================================================ ]0;gibuser@GiB:~/geni-in-a-box[gibuser@GiB geni-in-a-box]$ }}} Notice the manifest rspec is essentially your request rspec annotated with information about the resources that got allocated to you. For example, the {{{}}} element of the manifest includes the MAC and IP addresses assigned to each network interface on the node (host) and information you will need to ssh into the nodes (e.g. the fully qualified domain name of the host ). The following figure illustrates the resource allocation made by the GENI-in-a-Box aggregate. [[Image(ResourcesAllocated.png, 45%)]] === 2.3 Using your Resources === You can now ssh into the hosts allocated to you and do what you need to do to get your experiment working. For example, you can install and run software. If needed, you can use the {{sudo}} command to do things that require root privileges. In the case of our experiment, the software needed (iperf) was installed by our startup script. Our startup script put the output of iperf in a file accessible from a web browser. Since our iperf client ran on node {{{pc101}}} (the node labeled 'left' in the request spec), we can use a browser to view the output of this client. Start up Firefox in a terminal on the GENI-in-a-Box virtual machine and enter the url {{{http://pc101.geni-in-a-box.net/iperf-client.log}}}. The iperf client output should appear in your browser window. You can also ssh into the node pc102 to view this file. GENI-in-a-Box comes with a user account 'alice' with private and public keys for alice installed in it. When experimenter nodes are created an account is created for alice on these nodes and alice's public key installed in the .ssh directory inside alice's home directory. You can create your own user accounts; see [wiki:GiB-tips this page] for instructions. You can ssh into node {{{pc101}}} as alice type {{{ssh -lalice pc101.geni-in-a-box.net}}} or just {{{ssh -lalice pc101}}}. The terminal session below shows the ssh'ing into {{{pc101}}}, going to the directory with the iperf log file, and viewing that file. The password for alice can be found in {{{~/.gcf/passwords}}}. {{{ $ ssh -lalice pc101 The authenticity of host 'pc101 (10.0.1.101)' can't be established. RSA key fingerprint is d1:ea:fe:92:38:69:6b:85:3e:7c:65:cb:83:26:f5:0a. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'pc101,10.0.1.101' (RSA) to the list of known hosts. alice@pc101's password: lice@left ~] $ cd /var/www/html [alice@left html] $ ls iperf-client.log [alice@left html] $ cat iperf-client.log ------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 85.3 KByte (default) ------------------------------------------------------------ [ 4] local 10.0.3.101 port 5001 connected with 10.0.3.102 port 53488 [ ID] Interval Transfer Bandwidth [ 4] 0.0-10.1 sec 50.1 MBytes 41.6 Mbits/sec [alice@left html] $ }}} === 2.4. Freeing up Resources === When you are done with your experiment you can return the resources allocated to you using omni's {{{deletesliver}}} command: {{{ $ omni.py -a http://geni-in-a-box.net:8001 deletesliver myslice INFO:omni:Loading config file /home/gibuser/.gcf/omni_config INFO:omni:Using control framework gib_ch WARNING:omni:Slice urn:publicid:IDN+geni:gpo:gcf+slice+myslice expires in <= 3 hours INFO:omni:Slice urn:publicid:IDN+geni:gpo:gcf+slice+myslice expires on 2012-10-02 21:55:17 UTC INFO:omni:Deleted sliver urn:publicid:IDN+geni:gpo:gcf+slice+myslice on unspecified_AM_URN at http://geni-in-a-box.net:8001 INFO:omni: ------------------------------------------------------------ INFO:omni: Completed deletesliver: Options as run: aggregate: ['http://geni-in-a-box.net:8001'] framework: gib_ch getversionCacheName: /home/gibuser/.gcf/get_version_cache.json Args: deletesliver myslice Result Summary: Deleted sliver urn:publicid:IDN+geni:gpo:gcf+slice+myslice on unspecified_AM_URN at http://geni-in-a-box.net:8001 INFO:omni: ============================================================ $ }}} Congratulations! You have successfully run an experiment using GENI-in-a-Box resources! == 3 GENI-in-a-Box Tips == See [wiki:GiB-tips this page] for tips that you might find helpful while using GENI-in-a-Box. == 4 What's Next? == You are now ready to run your own experiments inside GENI-in-a-Box. You might want to start with one of the sample rspecs in the {{{~/geni-in-a-box}}} directory and edit it as needed by your experiment. See the {{{README}}} file in this directory for a description of the rspecs in this directory. You can [wiki:SignMeUp apply for a GENI account] and use real GENI aggregates and resources for your experiments. See [wiki:GiB-to-ProtoGENI] for tips on moving your experiment from GENI-in-a-Box to other aggregates (and vice versa).