Learning how to use SPHERE

Created by: Jelena Mirkovic, USC/ISI, sunshine@isi.edu
Contents
  1. Overview
  2. Introduction
  3. Required background reading
  4. Assignment Instructions
    1. Setup
    2. Tasks
    3. What Can Go Wrong
  5. Submission Instructions

Overview

This exercise provides a gentle introduction for students into how to use SPHERE. It works well as a first assignment or in-class demonstration.

Introduction

SPHERE testbed provides students exclusive access to virtual machines, which they can organize into custom topologies. Operating systems, applications and configurations on nodes can also be customized. This material teaches you how to start experiments on SPHERE and how to use them for your class work.

Required background reading

Please read these guidelines before starting the exercise.

Assignment Instructions

Setup

If you don't have an account, follow the instructions here.

Tasks

Setting up your account

Follow steps 1-5 from class use guidelines to set up your account on SPHERE. These steps operate on your experiment development container (XDC), which serves as a gateway into your experiment.

Running the lab

Execute steps 7 and 8 using twonode as your labname. Step 7 creates the experiment, allocates nodes and sets up virtual machines on them. Step 8 installs necessary applications on the experiment nodes. Wait about 20 seconds between steps 7 and 8 to make sure that nodes have been fully set up, before the applications are installed.

This experiment sets up the topology shown below:

Ping

In your terminal window type:
ssh a
    
to log into node a. You may see an alert asking you if you really want to connect. Answer "y" for "yes". Once logged into a type:
ping b
    
This sends a kind of "hello" message from a to b. You should see once-per-second replies from node b. Hold the CTRL key and press C to exit the program.

Iperf

In this task we will run iperf application, which measures bandwidth between two nodes.

On node a type:

iperf -s
    
This starts an iperf server. Open another browser window, log into SPHERE and follow steps 1, 2, 3, 4, 6 from class use guidelines.

Then type:

ssh b
    
to log into node b. Then type
iperf -c a
    
After a few seconds the program should exit and report the bandwidth it measured.

Copying Files

Table below shows some useful commands in Linux.
CommandEffect
ls dirList contents of the directory dir
cat filenamePrint contents of the file named filename
less filenamePrint contents of the file named filename one screen at the time; press space to go to the next screen
touch filenameCreate an empty file named filename
rm filenameDelete file named filename
sudo cmdExecute command cmd as root

Build on the previous example by storing the output of iperf into a file. On node b type:

iperf -c a > iperf.out
    
Our goal now will be to transfer this file to your machine (desktop or laptop), and to transfer another file from your machine to one of your experimental nodes.
  1. Install mrg Utility. If you haven't already, install mrg utility on your machine by following instructions here. Note that on Mac OS the binary may not readily run, because it is unsigned. You can use instructions here to allow it to run.

    You can test that you have installed the utility successfully by typing mrg in your Terminal window. If it prints a help page, the utility was successfully installed. Then type

    	  mrg config set server grpc.sphere-testbed.net
    	  mrg login yourusername (type your password when prompted)
    	
  2. Copy a file from your experimental node to your machine. On your machine type (note that there is a space and a dot at the end of the command below; that means "copy the file into the file with the same name". You could replace the dot with a name like output.txt):
    	mrg xdc scp download -x xdc.yourusername b:iperf.out .
    	
    Check that you can see iperf.out in your local directory. How would you copy a file from a different remote directory (not your home directory) into a different local directory?
  3. Copy a file from your XDC to your machine. On your XDC (Jupyter Terminal window) type:
    	  su - yourusername
    	  echo "Hello world" > hw.out
    	

    On your machine type:

    	mrg xdc scp download xdc.yourusername:hw.out .
    	
    Check that you can see hw.out in your local directory.
  4. Copy a file from your machine to your experimental node. On your machine type:
    	echo "Local file" > lf.out
    	mrg xdc scp upload -x xdc.yourusername lf.out b:.
    	
    Log into b node and check that you can see lf.out.
  5. Copy a file from your machine to your XDC. On your machine type:
    	echo "Local file take two" > lftt.out
    	mrg xdc scp upload  lftt.out xdc.yourusername:.
    	
    Log into your XDC and check that you can see lftt.out.

Stopping the Experiment

Find a terminal window you want to use. It can be a new window, obtained by following steps 1, 2, 3, 4, 6 from class use guidelines. Or it can be a window where you logged into a or b -- type exit to return to your XDC. Type:

stopexp twonode
	
This will return all the resources to SPHERE. What Can Go Wrong

Submission Instructions

This exercise does not require you to submit anything to your instructor.