wiki:GENIEducation/SampleAssignments/UnderstandAMAPI/Procedure/DesignSetup

Version 9 (modified by sedwards@bbn.com, 6 years ago) (diff)

--

Understanding the AM API

Image Map

1. Design the Experiment

  1. In today's experiment you will use resources at the aggregate listed on the worksheet.

2. Establish the Environment

2.1 Pre-work: Create a GENI account

  1. Go to https://portal.geni.net and press the Use GENI button
  2. From the Drop Down menu select your institution. If you got an account through the GENI Identity Provider, please select GENI Project Office.
    Tip Start typing the name of your institution and see the list become smaller.
  3. You will be transferred to the Login Page of your institution. Fill in your username and password.
  4. Complete the form that appears after you have successfully logged in and press Continue.
  5. You will be transferred to an Activation Page. Make sure both checkboxes are checked and then press Activate.
Use GENI
Figure 2-1 Logging into the GENI Experimenter Portal.

Congratulations, you have successfully created a GENI account.

2.2 Pre-work: Project lead adds you to a project

In order to use the portal to reserve resources, you must join a project. We have created a project for this tutorial.

  1. The tutorial organizers should have added you to the project for this tutorial. On the home page, you should see that you are a member of at least one project.
    Tip If you are not doing this exercise as part of an in-person tutorial please sign up for a GENI account and join a project.

2.3 Pre-work: Generate and Download SSH Keypair

Access to compute resources in GENI is provided through ssh key pairs and thus the portal needs a public key to upload to compute resources. For the purposes of the tutorial we will have the portal create an SSH key pair for you. (However, if you prefer to use your personal public key you can choose to upload it.)

  1. Once you are logged in, click on the Profile page.
  2. On the Profile page in the SSH Keys section, select generate and download an SSH keypair button.
Generate an SSH Key Pair

Figure 2-2 On the Profile page, select the "generate and download an SSH keypair" button.
  1. Enter the same passphrase twice, then press Generate SSH private key.
Generate an SSH Key Pair
Figure 2-3 Enter passphrase twice, then generate SSH private key.
  1. Now, press the Download Private Key button
  2. Open a terminal and execute:
    $ mv ~/Downloads/id_geni_ssh_rsa ~/.ssh/.
    $ chmod 0600 ~/.ssh/id_geni_ssh_rsa
    $ ssh-add ~/.ssh/id_geni_ssh_rsa
    
    Later in the tutorial, this will allow you to log into your nodes securely without a password.
Download an SSH Key Pair
Figure 2-4 Download an SSH Key Pair.

2.4 Configure Omni

  1. Go to your browser tab with the GENI Portal page.
  2. On that page, select the tab labeled "Profile". This is on the upper right of the page.
  3. Now select the section labeled Configure: omni.
  4. Now look for "Option 1: Automatic omni configuration".
  5. Click on "customized configuration data" in Step 2 of this section.
  6. Generate a GENI certificate. The easiest choice is to have the portal generate a combined certificate and key file:
  7. Make sure your default project is "GEC17". If not, make that your default.
  8. Click "Download omni bundle" and "save" the file. The file is saved in your Downloads folder.
  9. Open a terminal window and type:
    omni-configure.py
    The cert and key files you need will be installed in the appropriate folders.

3. Obtain Resources

Now that you are a member of a project, you can create a slice and reserve resources.

3.1 Create a slice

  1. Go to the Home tab.
  2. Press the Create Slice button for this project.
  3. As a slice name use the slice name on your worksheet, you can leave the description empty and press Create Slice
Create a GENI Slice
Figure 3-1 Create a new slice.

Now that you are a member of a project, you can create a slice and reserve resources.

3.2. Import a simple experiment

For this exercise, we will start with a prepared rspec file.

You should load this topology into Flack:

  1. From the "Import" menu (see figure), select the "Import from the web" item.
  2. Enter the URL corresponding to the rack type you are using and open it:

    InstaGENI

    http://protogeni.net/gec17tut2.rspec

    ExoGENI

    http://protogeni.net/gec17tut2eg.rspec
  3. Because this file contains a generic description of resources and does not specify any particular aggregate manager, Flack will report "There were resources detected without a manager selected, please select which manager you would like to use." Select "OK", and then choose the manager listed on your worksheet from the list. Then select "Accept", and a network topology (which might look familiar if you have completed earlier tutorials) should appear on the canvas.

3.3. Modify the experiment to automatically install and execute network test software

1. For this sample experiment, we'd like some additional software (Apache, iperf, and a couple of custom scripts) loaded onto the VMs to perform traffic measurements. In Flack, you can manipulate the details of the request for a node or link with the "i" button on the relevant component on the canvas (see figure). Do this now on the client node.

2. When you open the node information, you should see options like those in the figure. The controls available to you will vary depending on the types of the aggregate manager and the component, but many features are widely available throughout GENI.

3. The way we will request installation of the proper software and execution of our experiment is to add install and execute services. First, select "+ Add Install Service" as shown. Flack will now prompt you for an "Archive URL" and a location for installation. For this experiment, please enter the appropriate URL:

InstaGENI

http://protogeni.net/gec17tut2.tar.gz

ExoGENI

http://protogeni.net/gec17tut2eg.tar.gz
and ask for this to be installed in:
/local

4. Similarly, please use the "+ Add Execute Service" button to request that the appropriate command:

InstaGENI

sudo /local/install-script.sh

ExoGENI

/local/install-client.sh
(client node only)
/local/install-server.sh
(server node only)

be executed using
sh

Be very careful when entering this information -- these commands will not be executed yet, so it will be some time before you will see any relevant error messages if there is a mistake here.

5. Once both the "install" and "execute" services are specified, please choose "Apply". Then repeat the procedure to add the same "install" and "execute" services on the server node.

If you have time, it would be instructive to download the "gec17tut2.tar.gz" file yourself, and inspect the contents. You will see the install-script.sh file referred to in the execute service, and this is a good example of how you can ask for GENI components to perform tasks for you without any manual intervention. This is a very useful facility for large experiments!

3.4. Export the modified request RSpec

Now we will pull back some of the covers and inspect exactly what Flack has been doing for us when preparing the rspecs for the experiments we design. Each node and link has a corresponding element in the rspec, and the details of the component configuration (such as the install and execute services we requested above) are specified with attributes, or sometimes child elements, within those portions of the document.

  1. From the "View" menu (see figure), select the "Preview request document(s)" item. This will bring up a window showing the current rspec -- please take a moment to inspect it. The XML elements under the "flack" namespace were added for Flack's internal use (containing information about the canvas layout, editing history, etc.), and are ignored by aggregate managers. The "node" and "link" elements contain the specification for the components we will request, and if you look closely, you will be able to see the install and execute service elements you added earlier.
  2. Use the "Save to file" button (in the upper left) to make a local copy of your rspec. We'll use this in the next step to demonstrate how other client tools also use rspec files to communicate requests to aggregate managers.

3.5. Instantiate the new experiment using Omni

For this step, we'll change the approach a bit and switch to a new client tool: the command line Omni client. From a terminal, please enter the command:

$ omni.py -a AM_NICKNAME createsliver SLICENAME RSPEC_FILE

where AM_NICKNAME is the nickname for your assigned aggregate manager and SLICENAME is the name of the slice you created at the portal (both of these are given on your worksheet). RSPEC_FILE should be replaced with the filename of the rspec you saved in step 4.

If all is well, Omni should give you a number of informational messages, such as:

INFO:omni:Loading config file /home/geni/.gcf/omni_config

It should quickly proceed to the point where it makes the request to the remote manager:

INFO:omni:Creating sliver(s) from rspec file /home/geni/Downloads/experiments.rspec for slice ...

This step can sometimes be time-consuming, so please be patient. If it succeeds, within a few minutes Omni should report:

INFO:omni: Completed createsliver:

and your sliver is complete!


Introduction

Next: Execute