Changes between Version 50 and Version 51 of GiB-gettingStarted


Ignore:
Timestamp:
10/17/12 09:26:12 (12 years ago)
Author:
lnevers@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GiB-gettingStarted

    v50 v51  
    1 [[PageOutline(2-3, Table of Contents)]]
    21
    3 = Using GENI-in-a-Box =
    4 
    5 This page describes how to install and use [wiki:GENI-in-a-Box] on your computer.
    6 
    7 
    8 == 1 Install GENI-in-a-Box ==
    9 1. Start up !VirtualBox (Version 4.1.23 or later) and from the !VirtualBox "File" menu, select "Import Appliance...".
    10 
    11 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.
    12 
    13 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.
    14 
    15 
    16 == 2 Get Started with a Simple Experiment ==
    17 
    18 === 2.1 Discover Resources ===
    19 
    20 We start by finding out the aggregates available to us inside GENI-in-a-Box and learning about the resources advertised by these aggregates:
    21 
    22 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.
    23 
    24 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:
    25 {{{
    26 $ omni.py listaggregates
    27 INFO:omni:Loading config file /home/gibuser/.gcf/omni_config
    28 INFO:omni:Using control framework gib_ch
    29 INFO:omni:Listing 1 aggregates...
    30 INFO:omni:  Aggregate 1:
    31 urn:publicid:IDN+geni:gpo:gcf:am1+authority+am
    32 http://geni-in-a-box.net:8001
    33 INFO:omni: ------------------------------------------------------------
    34 INFO:omni: Completed listaggregates:
    35 
    36     Options as run:
    37                 framework: gib_ch
    38                 getversionCacheName: /home/gibuser/.gcf/get_version_cache.json
    39 
    40     Args: listaggregates
    41 
    42     Result Summary: Found 1 aggregate. URN: urn:publicid:IDN+geni:gpo:gcf:am1+authority+am; URL: http://geni-in-a-box.net:8001
    43 INFO:omni: ============================================================
    44 $
    45 }}}
    46 
    47 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.
    48 
    49 3. Now, let's find out the resources advertised by this aggregate using omni.
    50 {{{
    51 $  omni.py -a http://geni-in-a-box.net:8001 listresources
    52 INFO:omni:Loading config file /home/gibuser/.gcf/omni_config
    53 INFO:omni:Using control framework gib_ch
    54 INFO:omni:Listed resources on 1 out of 1 possible aggregates.
    55 INFO:omni:<?xml version="1.0" encoding="UTF-8"?>
    56 INFO:omni:  <!-- Resources at AM:
    57         URN: unspecified_AM_URN
    58         URL: http://geni-in-a-box.net:8001
    59  -->
    60 INFO:omni: 
    61 <!-- Resources at AM:
    62         URN: urn:publicid:IDN+geni-in-a-box.net+authority+cm
    63         URL: http://geni-in-a-box.net:8001
    64  -->
    65 <rspec expires="2013-12-20T22:26:14Z" type="advertisement" xmlns="http://www.geni.net/resources/rspec/3"
    66        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    67        xsi:schemaLocation="http://www.geni.net/resources/rspec/3 http://www.geni.net/resources/rspec/3/ad.xsd" >
    68   <node component_id="urn:publicid:IDN+geni-in-a-box.net+node+pc101" component_manager_id="urn:publicid:IDN+geni-in-a-box.net+authority+cm" component_name="pc101" exclusive="true">   
    69       <hardware_type name="openVZ container">     
    70       </hardware_type>   
    71       <sliver_type name="virtual-pc">     
    72       <disk_image description="Standard 32-bit Fedora 15 image" name="urn:publicid:IDN+geni-in-a-box.net+image:FEDORA15-STD" os="Fedora" version="15"/>     
    73       <disk_image default="true" description="Standard 32-bit Fedora 15 image" name="urn:publicid:IDN+geni-in-a-box.net+image:FEDORA15-STD" os="Fedora" version="15"/>     
    74       </sliver_type>   
    75       <interface component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc101:eth0" role="control">     
    76           <emulab:interface name="eth0"/>     
    77       </interface>   
    78       <interface component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc101:eth1" role="experimental">     
    79           <emulab:interface name="eth2"/>     
    80       </interface>   
    81       <interface component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc101:eth2" role="experimental">     
    82           <emulab:interface name="eth3"/>     
    83       </interface>   
    84       <interface component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc101:eth3" role="experimental">     
    85           <emulab:interface name="eth1"/>     
    86       </interface>
    87       <location country="Molvania" />   
    88   </node>       
    89       ...
    90   <node component_id="urn:publicid:IDN+geni-in-a-box.net+node+pc106" component_manager_id="urn:publicid:IDN+geni-in-a-box.net+authority+cm" component_name="pc106" exclusive="true">   
    91       <hardware_type name="openVZ container">     
    92       </hardware_type>   
    93       <sliver_type name="virtual-pc">     
    94       <disk_image description="Standard 32-bit Fedora 15 image" name="urn:publicid:IDN+geni-in-a-box.net+image:FEDORA15-STD" os="Fedora" version="15"/>     
    95       <disk_image default="true" description="Standard 32-bit Fedora 15 image" name="urn:publicid:IDN+geni-in-a-box.net+image:FEDORA15-STD" os="Fedora" version="15"/>     
    96       </sliver_type>   
    97       <interface component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc106:eth0" role="control">     
    98           <emulab:interface name="eth0"/>     
    99       </interface>   
    100       <interface component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc106:eth1" role="experimental">     
    101           <emulab:interface name="eth2"/>     
    102       </interface>   
    103       <interface component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc106:eth2" role="experimental">     
    104           <emulab:interface name="eth3"/>     
    105       </interface>   
    106       <interface component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc106:eth3" role="experimental">     
    107           <emulab:interface name="eth1"/>     
    108       </interface>
    109       <location country="Molvania" />   
    110   </node>
    111 </rspec>
    112 
    113 INFO:omni: ------------------------------------------------------------
    114 INFO:omni: Completed listresources:
    115 
    116   Options as run:
    117                 aggregate: ['http://geni-in-a-box.net:8001']
    118                 framework: gib_ch
    119                 getversionCacheName: /home/gibuser/.gcf/get_version_cache.json
    120 
    121   Args: listresources
    122 
    123   Result Summary: Queried resources from 1 of 1 aggregate(s).
    124  
    125 INFO:omni: ============================================================
    126 $
    127 }}}
    128 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.
    129 
    130 ''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.''
    131 
    132 === 2.2 Acquire and Configure Resources ===
    133 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:
    134     * Downloads and installs iperf on each host.
    135     * 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.
    136 As a part of this experiment we will ssh into these hosts to view these logs.
    137 
    138 The request rspec for this experiment (and other examples of request rspecs) are in the directory {{{~/geni-in-a-box}}}.
    139 {{{
    140 $ cd geni-in-a-box
    141 $ ls
    142 example-scripts    install-example.rspec  README.txt             two-nodes-iperf.rspec
    143 four-nodes.rspec   islands.rspec          three-nodes-lan.rspec
    144 $
    145 }}}
    146 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.
    147 
    148 [[Image(ResourcesRequested.png, 60%)]]
    149 
    150 The {{{<install>}}} 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 {{{<execute>}}} 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}}}.
    151 
    152 The following steps will walk us through acquiring the resources for our experiment:
    153 
    154 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).
    155 {{{
    156 $ omni.py createslice myslice
    157 INFO:omni:Loading config file /home/gibuser/.gcf/omni_config
    158 INFO:omni:Using control framework gib_ch
    159 INFO:omni:Created slice with Name myslice, URN urn:publicid:IDN+geni:gpo:gcf+slice+myslice, Expiration 2012-09-28 23:49:43
    160 INFO:omni: ------------------------------------------------------------
    161 INFO:omni: Completed createslice:
    162 
    163   Options as run:
    164                 framework: gib_ch
    165                 getversionCacheName: /home/gibuser/.gcf/get_version_cache.json
    166 
    167   Args: createslice myslice
    168 
    169   Result Summary: Created slice with Name myslice, URN urn:publicid:IDN+geni:gpo:gcf+slice+myslice, Expiration 2012-09-28 23:49:43
    170  
    171 INFO:omni: ============================================================
    172 $
    173 }}}
    174 
    175 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}}}.   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. 
    176 
    177 ''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.''
    178 
    179 The following is a snippet of the manifest your will get back from {{{createsliver}}}:
    180 {{{
    181 $ omni.py -a gib createsliver myslice two-nodes-iperf.rspec
    182 INFO:omni:Loading config file /home/gibuser/.gcf/omni_config
    183 INFO:omni:Using control framework gib_ch
    184 WARNING:omni:Slice urn:publicid:IDN+geni:gpo:gcf+slice+myslice expires in <= 3 hours
    185 INFO:omni:Slice urn:publicid:IDN+geni:gpo:gcf+slice+myslice expires on 2012-10-16 14:51:59 UTC
    186 INFO:omni:Substituting AM nickname gib with URL http://geni-in-a-box.net:8001, URN unspecified_AM_URN
    187 INFO:omni:Substituting AM nickname gib with URL http://geni-in-a-box.net:8001, URN unspecified_AM_URN
    188 INFO:omni:Creating sliver(s) from rspec file two-nodes-iperf.rspec for slice urn:publicid:IDN+geni:gpo:gcf+slice+myslice
    189 INFO:omni:Got return from CreateSliver for slice myslice at http://geni-in-a-box.net:8001:
    190 INFO:omni:<?xml version="1.0" ?>
    191 INFO:omni:  <!-- Reserved resources for:
    192         Slice: myslice
    193         at AM:
    194         URN: unspecified_AM_URN
    195         URL: http://geni-in-a-box.net:8001
    196  -->
    197 INFO:omni:  <rspec type="manifest" xmlns="http://www.geni.net/resources/rspec/3" xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" xmlns:planetlab="http://www.planet-lab.org/resources/sfa/ext/planetlab/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.geni.net/resources/rspec/3   http://www.geni.net/resources/rspec/3/manifest.xsd"> 
    198     <node client_id="left" component_id="urn:publicid:IDN+geni-in-a-box.net+node+pc101" component_manager_id="urn:publicid:IDN+geni-in-a-box.net+authority+cm" exclusive="false" sliver_id="urn:publicid:IDN+geni-in-a-box.net+sliver+101">   
    199         <sliver_type name="virtual-pc">     
    200             <disk_image name="urn:publicid:geni-in-a-box.net+image+//FEDORA15-STD" os="Linux" version="10"/>     
    201         </sliver_type>   
    202         <services>     
    203             <execute command="/local/iperf-script.sh" shell="sh"/>     
    204             <install install_path="/local" url="http://www.gpolab.bbn.com/experiment-support/geni-in-a-box/iperf-script.tar.gz"/>     
    205             <login authentication="ssh-keys" hostname="pc101.geni-in-a-box.net" port="22" username="gibuser"/>     
    206         </services>   
    207         <interface client_id="left:if0" component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc101:eth1" mac_address="00:0C:29:B4:DF:A7" sliver_id="urn:publicid:IDN+geni-in-a-box.net+sliver+1011">     
    208             <ip address="10.0.3.101"/>     
    209         </interface>   
    210         <rs:vnode name="pc101" xmlns:rs="http://www.protogeni.net/resources/rspec/ext/emulab/1"/>   
    211         <host name="pc101.geni-in-a-box.net"/>   
    212     </node> 
    213     ... 
    214     <link client_id="left-right-lan">   
    215         <component_manager name="urn:publicid:IDN+geni-in-a-box.net+authority+cm"/>   
    216         <interface_ref client_id="left:if0" component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc101:eth1" sliver_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc101:eth1"/>   
    217         <interface_ref client_id="right:if0" component_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc102:eth1" sliver_id="urn:publicid:IDN+geni-in-a-box.net+interface+pc102:eth1"/>   
    218         <property dest_id="right:if0" source_id="left:if0"/>   
    219         <property dest_id="left:if0" source_id="right:if0"/>   
    220         <link_type name="lan"/>   
    221     </link> 
    222 </rspec>
    223 INFO:omni: ------------------------------------------------------------
    224 INFO:omni: Completed createsliver:
    225 
    226   Options as run:
    227                 aggregate: ['gib']
    228                 framework: gib_ch
    229                 getversionCacheName: /home/gibuser/.gcf/get_version_cache.json
    230 
    231   Args: createsliver myslice two-nodes-iperf.rspec
    232 
    233   Result Summary: Got Reserved resources RSpec from geni-in-a-box-net-8001
    234 INFO:omni: ============================================================
    235 ]0;gibuser@GiB:~/geni-in-a-box[gibuser@GiB geni-in-a-box]$
    236 }}}
    237 Notice the manifest rspec is essentially your request rspec annotated with information about the resources that got allocated to you.  For example, the {{{<node>}}} 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, as described in the manifest spec.
    238 
    239 [[Image(ResourcesAllocated.png, 60%)]]
    240 
    241 === 2.3 Using your Resources ===
    242 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. 
    243 
    244 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 server 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-server.log}}}.  The iperf server output should appear in your browser window.  You can view the iperf client output at {{{http://pc102.geni-in-a-box.net/iperf-client.log}}}.   
    245 
    246 You can also ssh into the node pc101 or pc102 to view these log files.  Your username on GENI-in-a-Box (gibuser) is given an account on the nodes allocated to your experiment and the public key for this user ({{{~/.gcf/gibuser.pub}}} is copied into gibuser's {{{.ssh}}} directory in each of these nodes.  The private key for gibuser is in {{{~/.ssh/gibuser}}} and must be provided to the {{{ssh}}} command. 
    247 {{{
    248 $ ssh -i ~/.ssh/gibuser pc101
    249 The authenticity of host 'pc101 (10.0.1.101)' can't be established.
    250 RSA key fingerprint is e3:7c:8a:21:16:05:93:fd:dd:56:1c:f5:5c:5b:f3:c7.
    251 Are you sure you want to continue connecting (yes/no)? yes
    252 Warning: Permanently added 'pc101,10.0.1.101' (RSA) to the list of known hosts.
    253 
    254 [gibuser@left ~]$ cd /var/www/html
    255 [gibuser@left html]$ ls
    256 iperf-server.log
    257 [gibuser@left html]$ cat iperf-server.log
    258 ------------------------------------------------------------
    259 Server listening on TCP port 5001
    260 TCP window size: 85.3 KByte (default)
    261 ------------------------------------------------------------
    262 [  4] local 10.0.3.101 port 5001 connected with 10.0.3.102 port 60542
    263 [ ID] Interval       Transfer     Bandwidth
    264 [  4]  0.0-10.1 sec  61.8 MBytes  51.5 Mbits/sec
    265 [gibuser@left html]$
    266 }}}
    267 
    268 You can have the GENI-in-a-Box aggregate create additional user accounts on your experiment nodes; see [wiki:GiB-tips this page] for instructions.
    269 
    270 === 2.4. Freeing up Resources ===
    271 When you are done with your experiment you can return the resources allocated to you using omni's {{{deletesliver}}} command:
    272 {{{
    273 $ omni.py -a gib deletesliver myslice
    274 INFO:omni:Loading config file /home/gibuser/.gcf/omni_config
    275 INFO:omni:Using control framework gib_ch
    276 WARNING:omni:Slice urn:publicid:IDN+geni:gpo:gcf+slice+myslice expires in <= 3 hours
    277 INFO:omni:Slice urn:publicid:IDN+geni:gpo:gcf+slice+myslice expires on 2012-10-16 14:51:59 UTC
    278 INFO:omni:Substituting AM nickname gib with URL http://geni-in-a-box.net:8001, URN unspecified_AM_URN
    279 INFO:omni:Deleted sliver urn:publicid:IDN+geni:gpo:gcf+slice+myslice on unspecified_AM_URN at http://geni-in-a-box.net:8001
    280 INFO:omni: ------------------------------------------------------------
    281 INFO:omni: Completed deletesliver:
    282 
    283   Options as run:
    284                 aggregate: ['gib']
    285                 framework: gib_ch
    286                 getversionCacheName: /home/gibuser/.gcf/get_version_cache.json
    287 
    288   Args: deletesliver myslice
    289 
    290   Result Summary: Deleted sliver urn:publicid:IDN+geni:gpo:gcf+slice+myslice on unspecified_AM_URN at http://geni-in-a-box.net:8001
    291 INFO:omni: ============================================================
    292 $
    293 }}}
    294 
    295 Congratulations!  You have successfully run an experiment using GENI-in-a-Box resources!
    296 
    297 == 3 GENI-in-a-Box Tips ==
    298 See [wiki:GiB-tips this page] for tips that you might find helpful while using GENI-in-a-Box.
    299 
    300 
    301 == 4 What's Next? ==
    302 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.
    303 
    304 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).
     2This page has been moved to http://groups.geni.net/geni/wiki/GENI-in-a-Box/GiB-gettingStarted