Changes between Initial Version and Version 1 of HowTo/SetupGENILIB


Ignore:
Timestamp:
07/17/14 14:35:38 (10 years ago)
Author:
xliu@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowTo/SetupGENILIB

    v1 v1  
     1[[PageOutline]]
     2
     3= How to Install geni-lib =
     4
     5[https://bitbucket.org/barnstorm/geni-lib/src 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.
     6
     7To use geni-lib, you will first need to download it from the [https://bitbucket.org/barnstorm/geni-lib/src geni-lib repository].
     8
     9
     10 
     11== Download geni-lib ==
     12
     13For MacOS Experimenters:
     14
     15 * Install Mercurial
     16   * If you are using !MacPort, you can Install mercurial with
     17{{{
     18sudo port install mercurial
     19}}}
     20   * You can also find the Mercurial download page [http://mercurial.selenic.com/downloads here]
     21
     22 * Configure Mercurial
     23   * Create .hg file under ~/.
     24{{{
     25[ui]
     26username = Your User Name <xxx@xxx.xxx>
     27}}}
     28
     29 * Clone geni-lib
     30{{{
     31hg clone https://bitbucket.org/barnstorm/geni-lib
     32}}}
     33
     34 * Check and Pull Update
     35{{{
     36hg pull && hg update default
     37}}}
     38
     39
     40
     41Once you have downloaded the geni-lib to your local machine, you will see two directories under ./geni-lib/
     42{{{
     43dhcp89-69-127:geni-lib xliu$ ls
     44geni    samples
     45}}}
     46
     47The 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.
     48
     49
     50== Download Dependencies and Configure PYTHONPATH ==
     51
     52In the system that has been tested, a python package lxml is needed for geni-lib.
     53
     54 * Install lxml python packages
     55 
     56 If you are using !MacPort, install lxml using
     57 {{{
     58 $ sudo port install python27-lxml
     59 }}}
     60
     61 * Add PYTHONPATH:
     62
     63 For MacOS experimenters, you can add following lines to the end of your ~/.profile
     64 {{{
     65 # add python path
     66 export PYTHONPATH=$PYTHONPATH:<your path to geni-lib>
     67 }}}
     68 Then, run
     69 {{{
     70 source ~/.profile
     71 }}}
     72
     73  * Optional Step: Switch Python Version
     74 
     75 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.
     76{{{
     77$ sudo port select --set python python27
     78}}}
     79
     80
     81== Configure geni-lib ==
     82
     83 * Modify the configuration file
     84
     85 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
     86
     87 {{{
     88dhcp89-69-127:samples xliu$ cat example_config.py
     89from geni.aggregate import FrameworkRegistry
     90from geni.aggregate.context import Context
     91from geni.aggregate.user import User
     92
     93def buildContext ():
     94  portal = FrameworkRegistry.get("portal")()
     95  portal.cert = "/home/nbastin/.ssh/portal-nbastin.pem"
     96  portal.key = "/home/nbastin/.ssh/portal-nbastin.key"
     97
     98  nbastin = User()
     99  nbastin.name = "nbastin"
     100  nbastin.urn = "urn:publicid:IDN+ch.geni.net+user+nickbas"
     101  nbastin.addKey("/home/nbastin/.ssh/geni_dsa.pub")
     102
     103  context = Context()
     104  context.addUser(nbastin, default = True)
     105  context.cf = portal
     106  context.project = "bss-sw-test"
     107
     108  return context
     109 }}}
     110
     111 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>_config.py
     112
     113 ''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 ''
     114
     115
     116 To see examples on how to use geni-lib to generate RSpec, please go to [http://groups.geni.net/geni/wiki/HowTo/GenerateRSpecUsingGENILIB RSpec Generation Using geni-lib]