wiki:GENIExperimenter/Tutorials/GENIDesktop/GEC23/GENIDesktop_CLI

Version 34 (modified by Hussamuddin Nasir, 4 years ago) (diff)

--

Navigation: Back

GENIDesktop Command Line Interface Tool

The GENIDesktop Command line Interface Tool is a simple client side tool written in python that interacts with the GENIDesktop server to provide a user with a subset of operations that can currently be done via the GUI interface. It provides a user with the flexibility to automate GENIDesktop related operations by combining multiple operation into a bash/.bat scripts and customize them as per their use case. Some of the operations currently supported by the GENIDesktop CLI Tool are :

  • Check status of the slice/slivers
  • Download files from nodes in the Slice
  • Download passive monitoring data collected from nodes in a CSV, PNG and RRD formats.
  • Download a list of slice, list of nodes/link from a slice or the whole slice topology itself in a JSON format.
  • Run commands on the node(s) in the slice. (Similar to the Run module in the GUI)
  • Upload file(s) to the node(s) in the slice. (Similar to the File upload module in the GUI)
  • CLI version of the Experiment validation tool provided in the GUI.

So to get started please follow the steps below.

  1. Download and Install and Test GENIDesktop CLI Tool.
  2. Generate and Download GDCLI key.
  3. Enable the GDCLI using the GDCLI key.
  4. Using GENIDesktop CLI.

STEP 1. Download and Install and Test GENIDesktop CLI Tool

To Download the GENIDesktop CLI Tool, please log in to the GENIDesktop if you are not already logged in. Click on the setting wheel like icon on the far top-right of the page to launch the settings menu. Click on Accounts button.

On the Account page, Under the GDCLI Downloads section, please click on the appropriate installer for your operating system. We currently have installers for MAC OS, Windows and Ubuntu/Debian (or any other debian based Linux OS). If you are using any other OS and have python 2.7 or greater (python 3.0 not supported), you can go ahead and use the python version of the GDCLI.

Click on the INSTALL Instructions link above the download links and skip to STEP 4 (Installing) and follow the section for your Operating system

If installed correctly you should be able to run the "gdcli version" command

}}}

bash:~# gdcli version
GENI Desktop Command Line Interface v1.16

If you do not see this output or run into any error , please ask for help.

STEP 2. Generate and Copy GDCLI key.

If you never used the GENIDesktop CLI Tool before, you will have to first generate a gdcli key which is an authentication token used by the system. To do this, Please click the "generate key" button under GDCLI Key Section on the accounts page. Then copy the gdcli key for further use. Please save the key to a file since it will required in the next step.

STEP 3. Enable the GDCLI using the GDCLI key.

Open a terminal (command prompt if using Windows. Also cd c:\GDCLI .).

Run the command below to authenticate your CLI session using the gdcli.key just downloaded.

 gdcli authkey -k <key>

STEP 4. Using GENIDesktop CLI

In this exercise we will use the existing slice that we had created for this tutorial. We assume here that you have "iperf" installed on your nodes in the previous sections of this tutorial. Please note down your slicename and projectname your slice belongs to. This will be needed as the command line parameters for this exercise. There are numerous operation that can be performed using the CLI, but this example will focus on three things

  • List your nodes
  • Start iperf server on node-0
  • Start iperf client on node-1
  • View the traffic on the link graph after downloading the PNG

A user may want to automate these steps using custom scripts which is what we would like to emphasize in this section. We have created

Click on the "Download in Original format" link at the bottom of the relevant script page mentioned above to download the script on your laptops.

Go to the download folder and run the relevant custom script

 ./gdcli_gec23.sh <Projectname> <slicename>

OR

gdcli_gec23.bat <Projectname> <slicename>

If the script finishes sucessfully , windows users should see a folder window pop up with the relevant graphs in them. Linux/MAC users should see a folder called "mygraphs" appear on the Desktop which should contain the graph files. Double-clicking on them to view.

Some of the sample GENIDesktop CLI operations are show below. These could be combined in a custom script like the one you just ran.

Sample GENIDesktop CLI operations

NOTE: Slicename = demo , ProjectName = UKGENI

  1. ListNodes operation
gdcli listnodes -s demo -r UKGENI

["node-0", "node-1", "GDGN0"]
  1. Run Command operation
#Start Iperf Server in daemon on node-0
bash:~$ gdcli run -s demo -r UKGENI -n "node-0" -c "iperf -s -D> /dev/null 2>&1"
#Start iperf client on node-1

bash:~$ gdcli run -s demo -r UKGENI -n "node-1" -c "iperf -t 30 -c node-0 -b 10000M"
------------------------------------------------------------
Client connecting to node-0, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local 10.10.1.2 port 53242 connected with 10.10.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-30.0 sec  2.68 GBytes   768 Mbits/sec
[  3] Sent 1959326 datagrams

  1. Download graph in PNG Format
# Fetch graphs for the link in the slice.

bash:~$ gdcli getpng -s demo -r UKGENI  -g linkbytes -l link-0 -n node-0 -o ~/mygraphs