Changes between Initial Version and Version 1 of HowTo/ConvertPLAdToRequest


Ignore:
Timestamp:
05/15/12 13:42:29 (12 years ago)
Author:
nriga@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowTo/ConvertPLAdToRequest

    v1 v1  
     1[[PageOutline]]
     2
     3= Creating PlanetLab Request RSpecs from Advertisement RSpecs =
     4In this step by step instructions we are going to use [wiki:RSpecSchema3 GENI v3] RSpecs and also give intuition about how to use ProtoGENI v2 RSpecs.
     5For an overview of RSpecs used in GENI look [wiki:GENIExperimenter/RSpecs here].
     6
     7You can use any tool that talks the GENI AM API to follow these instructions. For the purpose of this page we are using the [http://trac.gpolab.bbn.com/gcf/wiki/Omni Omni command line tool].
     8
     9== 1. Download and save the ad RSpec ==
     10
     11Use Omni to download and save the advertised RSpec from the aggregate you care about.
     12      a. In general the command is:
     13      {{{
     14$ omni.py -a <url or nickname of aggregate> -t GENI 3 -o listresources
     15      }}}
     16
     17If the AM you are using supports ProtoGENI v2 RSpecs then the command will look like:
     18       {{{
     19$ omni.py -a <url or nickname of aggregate> -t ProtoGENI 2 -o listresources
     20      }}}
     21
     22The main difference between ProtoGENI v2 RSpecs and GENI v3 is the location of the schemas.
     23If you are using ProtoGENI v2 then make sure that you replace this URL: `http://www.geni.net/resources/rspec/3` with this:
     24`http://www.protogeni.net/resources/rspec/2` and vice versa.
     25
     26      For example, to get the request RSpec from the MyPLC at the GPO Lab:
     27      {{{
     28$ omni.py -a pl-gpo -t ProtoGENI 2 -o listresources
     29      }}}
     30      b. The output of this command is:
     31      {{{
     32geni@geni-tutorial:~/Tutorials/Omni/gpousr20$ omni.py -a pl-gpo -t ProtoGENI 2 -o listresources
     33INFO:omni:Loading config file omni_config
     34INFO:omni:Using control framework pgeni
     35INFO:omni:Saving output to a file.
     36INFO:omni:Substituting AM nickname pl-gpo with URL http://myplc.gpolab.bbn.com:12346/, URN unspecified_AM_URN
     37INFO:omni:Listed resources on 1 out of 1 possible aggregates.
     38INFO:omni:Writing to 'rspec-myplc-gpolab-bbn-com-12346-.xml'
     39INFO:omni: ------------------------------------------------------------
     40INFO:omni: Completed listresources:
     41
     42  Options as run:
     43                aggregate: pl-gpo
     44                framework: pgeni
     45                native: True
     46                output: True
     47                rspectype: ('ProtoGENI', '2')
     48
     49  Args: listresources
     50
     51  Result Summary: Retrieved resources from 1 aggregates.
     52Wrote rspecs from 1 aggregates to 1 files
     53Saved listResources RSpec at unspecified_AM_URN to file rspec-myplc-gpolab-bbn-com-12346-.xml.
     54.
     55INFO:omni: ============================================================
     56      }}}
     57
     58== 2. Copy and edit the RSpec file. ==
     59      a. Copy the advertisement RSpec file.  The new file will become the request RSpec.  In general this would be:
     60{{{
     61cp <advertisement RSpec filename> <manifest RSpec filename>
     62}}}
     63      The value of {{{<advertisement RSpec filename>}}} appears in the Omni summary.
     64      In this case we will generate a request for the node "navis":
     65      {{{
     66cp rspec-myplc-gpolab-bbn-com-12346-.xml pl-gpo-navis.rspec
     67      }}}
     68      b. Edit the request Rspec file:
     69      {{{
     70emacs pl-gpo-navis.rspec &
     71      }}}
     72      or
     73      {{{
     74vi pl-gpo-navis.rspec
     75      }}}
     76      c. Edit the {{{<rspec>}}} tag.
     77         i. In the {{{<rspec>}}} tag, remove the {{{expires}}} and {{{generated}}} attributes.
     78         ii. In the {{{<rspec>}}} tag, change the {{{type="advertisement"}}} attribute to {{{type="request"}}}.
     79         iii. In the {{{<rspec>}}} tag, change 'ad' to 'request' in the schema location. That is, change this:
     80         {{{
     81xsi:schemaLocation=""http://www.geni.net/resources/rspec/3 "http://www.geni.net/resources/rspec/3/ad.xsd"
     82}}}
     83         To this:
     84         {{{
     85xsi:schemaLocation="http://www.geni.net/resources/rspec/3 http://www.geni.net/resources/rspec/3/request.xsd"
     86         }}}
     87         iv. The {{{<rspec>}}} tag should now look like this (note that the whitespace has been adjusted for ease of reading):
     88         {{{
     89<rspec type="request"
     90       xmlns=""http://www.geni.net/resources/rspec/3"
     91       xmlns:planetlab="http://www.planet-lab.org/resources/sfa/ext/planetlab/1"
     92       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     93       xsi:schemaLocation=""http://www.geni.net/resources/rspec/3 "http://www.geni.net/resources/rspec/3/request.xsd">
     94         }}}
     95      d. Remove the {{{node}}} tags you do not want to request. 
     96         i. For example to only reserve the node {{{navis.gpolab.bbn.com}}} remove the following text:
     97         {{{
     98    <node component_id="urn:publicid:IDN+plc:gpolab:gpolab+node+bain.gpolab.bbn.com"
     99          component_manager_id="urn:publicid:IDN+plc:gpolab+authority+am"
     100          component_name="bain.gpolab.bbn.com"
     101          exclusive="false">   
     102    ....
     103   </node> 
     104    <node component_id="urn:publicid:IDN+plc:gpolab:gpolab+node+sardis.gpolab.bbn.com"
     105          component_manager_id="urn:publicid:IDN+plc:gpolab+authority+am"
     106          component_name="sardis.gpolab.bbn.com"
     107          exclusive="false">
     108    ....     
     109   </node> 
     110    <node component_id="urn:publicid:IDN+plc:gpolab:gpolab+node+ganel.gpolab.bbn.com"
     111          component_manager_id="urn:publicid:IDN+plc:gpolab+authority+am"
     112          component_name="ganel.gpolab.bbn.com" exclusive="false">
     113    ....     
     114   </node> 
     115    <node component_id="urn:publicid:IDN+plc:gpolab:gpolab+node+gardil.gpolab.bbn.com"
     116          component_manager_id="urn:publicid:IDN+plc:gpolab+authority+am"
     117          component_name="gardil.gpolab.bbn.com" exclusive="false">   
     118    ....
     119    </node>
     120}}}
     121         ii. At this point the entire file should look like this:
     122         {{{
     123<?xml version="1.0" ?>
     124<!-- Resources at AM:
     125        URN: unspecified_AM_URN
     126        URL: http://myplc.gpolab.bbn.com:12346/
     127 -->
     128<rspec type="request"
     129       xmlns=""http://www.geni.net/resources/rspec/3"
     130       xmlns:planetlab="http://www.planet-lab.org/resources/sfa/ext/planetlab/1"
     131       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     132       xsi:schemaLocation=""http://www.geni.net/resources/rspec/3 "http://www.geni.net/resources/rspec/3/request.xsd"> 
     133    <node component_id="urn:publicid:IDN+plc:gpolab:gpolab+node+navis.gpolab.bbn.com" component_manager_id="urn:publicid:IDN+plc:gpolab+authority+am" component_name="navis.gpolab.bbn.com" exclusive="false">   
     134        <hardware_type name="plab-pc"/>   
     135        <hardware_type name="pc"/>   
     136        <available now="true"/>   
     137        <sliver_type name="plab-vnode">     
     138            <planetlab:initscript name="gpolab_sirius"/>     
     139        </sliver_type>   
     140        <location country="us" latitude="42.3897" longitude="-71.1475"/>   
     141    </node> 
     142</rspec>
     143}}}
     144      d. Edit the {{{<node>}}} tag you are trying to reserve.
     145         i. Remove all {{{<hardware_type>}}}, {{{<available>}}}, {{{<location>}}}, and {{{<planetlab:initscript"/>}}} tags which exist from the {{{<node>}}} tag you are trying to reserve. 
     146         ii. Add the attribute {{{client_id}}} to the {{{<node>}}} tag you are trying to reserve.  The value is your choice, so here we will use {{{client_id="navis"}}}.
     147         iii. The final request RSpec file should look like this:
     148         {{{
     149<?xml version="1.0" ?>
     150<!-- Resources at AM:
     151        URN: unspecified_AM_URN
     152        URL: http://myplc.gpolab.bbn.com:12346/
     153 -->
     154<rspec type="request"
     155       xmlns="http://www.protogeni.net/resources/rspec/2"
     156       xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1"
     157       xmlns:planetlab="http://www.planet-lab.org/resources/sfa/ext/planetlab/1"
     158       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     159       xsi:schemaLocation="http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/request.xsd"> 
     160    <node component_id="urn:publicid:IDN+plc:gpolab:gpolab+node+navis.gpolab.bbn.com" component_manager_id="urn:publicid:IDN+plc:gpolab+authority+am" component_name="navis.gpolab.bbn.com" exclusive="false" client_id="navis">   
     161        <sliver_type name="plab-vnode">         
     162        </sliver_type>   
     163    </node> 
     164</rspec>
     165}}}
     166      e. Save the file.
     167== 3. Run rspeclint ==
     168 [https://www.protogeni.net/trac/protogeni/wiki/RSpecDebugging rspeclint] is a program that helps you verify the validity of an RSpec document.
     169[http://www.protogeni.net/resources/rspeclint Download rspeclint] and invoke it to validate your rspec. If it works, you should see no errors returned by the call.
     170 In general, this is:
     171 {{{
     172rspeclint <request RSpec filename>
     173}}}
     174 For this example do:
     175 {{{
     176rspeclint  pl-gpo-navis.rspec
     177}}}