Version 1 (modified by, 10 years ago) (diff)


How to Install geni-lib

geni-lib is a python library written by Nick Bastin of Barnstormer Softworks. It can be used to create RSpec file for large topology. In this page, we show how to install and configure geni-lib, and show some examples of using geni-lib. The installation and configuration of geni-lib has been tested on MacOS 10.9.3, and python27 installed from MacPort is set to be the default python.

To use geni-lib, you will first need to download it from the geni-lib repository.

Download geni-lib

For MacOS Experimenters:

  • Install Mercurial
    • If you are using MacPort, you can Install mercurial with
      sudo port install mercurial
    • You can also find the Mercurial download page here
  • Configure Mercurial
    • Create .hg file under ~/.
      username = Your User Name <>
  • Clone geni-lib
    hg clone
  • Check and Pull Update
    hg pull && hg update default

Once you have downloaded the geni-lib to your local machine, you will see two directories under ./geni-lib/

dhcp89-69-127:geni-lib xliu$ ls
geni	samples

The directory "geni" is the library for RSpec generation and other purposes, and "samples" contains examples of using the library, as well as a sample configuration file that you need to modify it before writing and testing your scripts.

Download Dependencies and Configure PYTHONPATH

In the system that has been tested, a python package lxml is needed for geni-lib.

  • Install lxml python packages

If you are using MacPort, install lxml using

$ sudo port install python27-lxml

For MacOS experimenters, you can add following lines to the end of your ~/.profile

# add python path
export PYTHONPATH=$PYTHONPATH:<your path to geni-lib>

Then, run

source ~/.profile
  • Optional Step: Switch Python Version

Sometimes you may have problems with python versions if you have two different versions of python installed. If you installed python27 and python modules from MacPort, so you may need to select python27 installed by MacPort as your default python.

$ sudo port select --set python python27

Configure geni-lib

  • Modify the configuration file

To use geni-lib, you will need to create a configuration file that contains your credential to GENI and other information about your experiments. Go to ./geni-lib/samples/, and open the file

dhcp89-69-127:samples xliu$ cat
from geni.aggregate import FrameworkRegistry
from geni.aggregate.context import Context
from geni.aggregate.user import User

def buildContext ():
  portal = FrameworkRegistry.get("portal")()
  portal.cert = "/home/nbastin/.ssh/portal-nbastin.pem"
  portal.key = "/home/nbastin/.ssh/portal-nbastin.key"

  nbastin = User() = "nbastin"
  nbastin.urn = ""

  context = Context()
  context.addUser(nbastin, default = True) = portal
  context.project = "bss-sw-test"

  return context

You will modify this module on from line 7 to line 13, line 16 and line 18 with your own information, and you may want to save it as a different file, for example, with name <your initial>

Note that portal.cert and portal.key should be the same SSL certificate file that you have downloaded from protal, the extension (either .pem or .key) does not matter

To see examples on how to use geni-lib to generate RSpec, please go to RSpec Generation Using geni-lib