Skip to content

How To Specify RSpecs

Tom Mitchell edited this page May 12, 2017 · 4 revisions

How to Specify RSpecs in Omni

There are several ways to specify a resource specification (RSpec) in the createsliver command in omni:

omni.py -a myaggregate createsliver myslice <RSpec>

Omni will try to read <RSpec> by interpreting it in the following order:

  1. a URL or a file on the local filesystem
  2. (starting in omni 2.4) a fully specified RSpec Nickname listed in the omni_config
  3. (starting in omni 2.4) a file in a default location (file or url) defined as: <default_rspec_location>/<RSpec>.<default_rspec_extension>

URL or full path to a file

All modern versions of omni allow users to specify RSpecs using a full path to a file or a url.

For example, running the following command will reserve resources for the Hello GENI example.

omni.py -a ig-gpo createsliver myslice https://raw.githubusercontent.com/GENI-NSF/geni-tutorials/master/HelloGENI/hellogeni.rspec

RSpec Nicknames

Starting in omni 2.4, RSpec nicknames are allowed as well.

RSpec nicknames are a short string specified in the omni_config file that substitute for the full url or file location of an RSpec file. RSpec nicknames are similar to Aggregate nicknames.

Available RSpec Nicknames can be determined by using the output of:

omni.py nicknames

Specifying RSpec nicknames in the omni_config

Starting in omni 2.4, users who generate their omni_config using omni-configure.py will get the following default [rspec_nicknames] section. In addition, this text is included in the omni_config.sample.

#------RSpec nicknames
# When you call
#      omni.py -a myaggregate createsliver myslice myrspec
# omni will try to read 'myrspec' by interpreting it in the following order:
# 1. a URL or a file on the local filesystem
# 2. a nickname specified in the omni_config
# 3. a file in a location (file or url) defined as: 
#    <default_rspec_server>/<rspec_nickname>.<default_rspec_extension> 

[rspec_nicknames]
# Format :
# Nickname= [location of RSpec file]
# myawesometopology = ~/.gcf/rspecs/myrspecfile.rspec
hellogeni = https://raw.githubusercontent.com/GENI-NSF/geni-tutorials/master/HelloGENI/hellogeni.rspec

default_rspec_location = https://raw.githubusercontent.com/GENI-NSF/geni-tutorials/master
default_rspec_extension = rspec

The [rspec_nicknames] section allows users to specify their own RSpec nicknames and also to specify a default location to store a large number of RSpecs.

Fully Specified RSpec Nicknames

Fully Specified RSpec Nicknames allow users to specify a nickname and a corresponding URL (or path to a file) in their omni_config file.

For example, using the default omni_config, the user could run the Hello GENI example using the following command:

omni.py -a ig-gpo createsliver hellogeni

Omni will first look for a file named hellogeni. When omni does not find that file, it will lookup hellogeni in the omni_config and expand it to https://raw.githubusercontent.com/GENI-NSF/geni-tutorials/master/HelloGENI/hellogeni.rspec.

Relative RSpec Nicknames

Moreover, users can now specify a default webserver (or directory on their local machine) and a default file extension. If an unknown nickname is used, omni.py will look for a file with that name in the specified default location.

Again, using the default omni_config, the user could do the Hello GENI example using the command:

omni.py -a ig-gpo createsliver HelloGENI/hellogeni

Omni will first look for a file named HelloGENI/hellogeni. When omni does not find that file, it will lookup HelloGENI/hellogeni in the omni_config and also not find it.

Finally, omni will look in the default location. Here the nickname HelloGENI/hellogeni will cause omni to look for a file:

https://raw.githubusercontent.com/GENI-NSF/geni-tutorials/master/HelloGENI/hellogeni.rspec

This filename is determined using the following formula:

`<default_rspec_location>/HelloGENI/hellogeni.<default_rspec_extension>`  
   = `https://raw.githubusercontent.com/GENI-NSF/geni-tutorials/master` + `/HelloGENI/hellogeni.` + `rspec`