wiki:HowTo/WriteOFv3Rspecs/Examples

Version 3 (modified by nriga@bbn.com, 13 years ago) (diff)

--

If you have written any interested OFv3 rspecs, feel free to add them at the bottom of this page and help others:-)

Rspec with one group

In this rspec there is only one defined group that is used in all the matches :

<rspec xmlns="http://www.protogeni.net/resources/rspec/2"
       xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:openflow="http://www.geni.net/resources/rspec/ext/openflow/2"
       xs:schemaLocation="http://www.protogeni.net/resources/rspec/2
                          http://www.protogeni.net/resources/rspec/2/request.xsd
                          http://www.geni.net/resources/rspec/ext/openflow/2
                          http://wwww.geni.net/resources/rspec/ext/openflow/2/of-resv.xsd"
       type="request">
    
    <openflow:sliver email="user@example.net" description="My GENI experiment"
ref="http://wiki.example.net/myproj" />

       <openflow:controller url="tcp:myctrl.example.net:9933" type="primary" />

       <openflow:group name="mygrp">

           <openflow:datapath
component_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+datapath:06:af:00:24:a8:c4:b9:00"
component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+authority+am">
             <openflow:port name="26" num="50"/>
             <openflow:port name="47" num="71"/>
           </openflow:datapath>

       </openflow:group>

       <openflow:match>
           <openflow:use-group name="mygrp" />
           <openflow:packet>
             <openflow:nw_src value="10.1.1.0/24" />
             <openflow:tp_src value="80" />
           <openflow:packet />
       <openflow:match>
    
       <openflow:match>
           <openflow:use-group name="mygrp" />
           <openflow:packet>
             <openflow:nw_src value="10.1.1.0/24" />
             <openflow:tp_src value="80, 8080-8090" />
           <openflow:packet />
         <openflow:match>

    </openflow:sliver>

</rspec>

Rspec with multiple groups

<rspec xmlns="http://www.protogeni.net/resources/rspec/2"
       xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:openflow="http://www.geni.net/resources/rspec/ext/openflow/2"
       xs:schemaLocation="http://www.protogeni.net/resources/rspec/2
                          http://www.protogeni.net/resources/rspec/2/request.xsd
                          http://www.geni.net/resources/rspec/ext/openflow/2
                          http://wwww.geni.net/resources/rspec/ext/openflow/2/of-resv.xsd"
       type="request">
    
    <openflow:sliver email="user@example.net" description="My GENI experiment"
ref="http://wiki.example.net/myproj" />

       <openflow:controller url="tcp:myctrl.example.net:9933" type="primary" />

       <openflow:group name="mygrp1">

           <openflow:datapath
component_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+datapath:06:af:00:24:a8:c4:b9:00"
component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+authority+am">
             <openflow:port name="26" num="50"/>
             <openflow:port name="47" num="71"/>
           </openflow:datapath>

       </openflow:group>

       <openflow:group name="mygrp2">

           <openflow:datapath
component_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+datapath:06:af:00:24:a8:c4:b9:00" component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+authority+am"/>
           <openflow:datapath
component_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+datapath:06:ac:00:24:a8:c4:b9:ff" component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+authority+am">
             <openflow:port name="26" num="20"/>
             <openflow:port name="27" num="21"/>
             <openflow:port name="28" num="22"/>
           </openflow:datapath>

       </openflow:group>

       <openflow:match>
           <openflow:use-group name="mygrp1" />
           <openflow:use-group name="mygrp2" />
           <openflow:packet>
             <openflow:nw_src value="10.1.1.0/24" />
             <openflow:tp_src value="80" />
           <openflow:packet />
       <openflow:match>
    
       <openflow:match>
           <openflow:use-group name="mygrp2" />
           <openflow:packet>
             <openflow:nw_src value="10.1.1.0/24" />
             <openflow:tp_src value="80, 8080-8090" />
           <openflow:packet />
         <openflow:match>

    </openflow:sliver>

</rspec>

Rspec with groups and datapaths

<rspec xmlns="http://www.protogeni.net/resources/rspec/2"
       xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:openflow="http://www.geni.net/resources/rspec/ext/openflow/2"
       xs:schemaLocation="http://www.protogeni.net/resources/rspec/2
                          http://www.protogeni.net/resources/rspec/2/request.xsd
                          http://www.geni.net/resources/rspec/ext/openflow/2
                          http://wwww.geni.net/resources/rspec/ext/openflow/2/of-resv.xsd"
       type="request">
    
    <openflow:sliver email="user@example.net" description="My GENI experiment"
ref="http://wiki.example.net/myproj" />

       <openflow:controller url="tcp:myctrl.example.net:9933" type="primary" />

       <openflow:group name="mygrp1">

           <openflow:datapath
component_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+datapath:06:af:00:24:a8:c4:b9:00" component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+authority+am">
             <openflow:port name="26" num="50"/>
             <openflow:port name="47" num="71"/>
           </openflow:datapath>

       </openflow:group>

       <openflow:match>
           <openflow:use-group name="mygrp1" />
            <openflow:datapath
component_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+datapath:06:af:00:24:a8:c4:b9:00" component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+authority+am"/>
           <openflow:datapath
component_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+datapath:06:ac:00:24:a8:c4:b9:ff" component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.example.net+authority+am">
             <openflow:port name="26" num="20"/>
             <openflow:port name="27" num="21"/>
             <openflow:port name="28" num="22"/>
           </openflow:datapath>

           <openflow:packet>
             <openflow:nw_src value="10.1.1.0/24" />
             <openflow:tp_src value="80" />
           <openflow:packet />
       <openflow:match>
    
       <openflow:match>
           <openflow:use-group name="mygrp2" />
           <openflow:packet>
             <openflow:nw_src value="10.1.1.0/24" />
             <openflow:tp_src value="80, 8080-8090" />
           <openflow:packet />
         <openflow:match>

    </openflow:sliver>

</rspec>