Changes between Version 33 and Version 34 of HowTo/WriteOFv3Rspecs


Ignore:
Timestamp:
10/05/11 07:58:39 (8 years ago)
Author:
nriga@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowTo/WriteOFv3Rspecs

    v33 v34  
    3535#!xml
    3636
     37<?xml version="1.1" encoding="UTF-8"?>
     38<rspec  xmlns="http://www.protogeni.net/resources/rspec/2"
     39        xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
     40        xmlns:openflow="http://www.geni.net/resources/rspec/ext/openflow/3"
     41        xs:schemaLocation="http://www.protogeni.net/resources/rspec/2
     42              http://www.protogeni.net/resources/rspec/2/request.xsd
     43              http://www.geni.net/resources/rspec/ext/openflow/3
     44              http://www.geni.net/resources/rspec/ext/openflow/3/of-resv.xsd"
     45    type="request">
     46   
     47    <openflow:sliver email="user@geni.net" description="My GENI experiment" ref="http://www.geni.net">
     48
     49        <!-- rest of rspec -->
     50
     51    </openflow:sliver>
     52</rspec>
     53}}}
     54
     55   2. Specify where your controller is running. E.g.:
     56{{{
     57 #!xml
     58<openflow:controller url="tcp:example.geni.net:9933" type="primary" />
     59}}}
     60
     61   3. Organize the datapaths that are relevant to this sliver within groups. The best way to construct the <openflow:datapath> elements is by copying them from the advertisement rspecs. E.g if [attachment:ad-sample.rspec this] is the advertisement rspec, and you want :
     62   * ports 7 and 20 of datapath with dpid 06:a4:00:12:e2:b8:a5:d0
     63   * ports 50 and 71 of datapath with dpid 06:af:00:24:a8:c4:b9:00
     64
     65Then you can construct a group that looks like :
     66{{{
     67 #!xml
     68 <openflow:group name="mygrp">
     69   <openflow:datapath component_id="urn:publicid:IDN+openflow:foam:uxmal.gpolab.bbn.com+datapath:06:a4:00:12:e2:b8:a5:d0"
     70                      component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.gpolab.bbn.com+authority+am"
     71                      dpid="06:a4:00:12:e2:b8:a5:d0">
     72     <openflow:port name="GBE0/7" num="7"/>
     73     <openflow:port name="GBE0/20" num="20"/>
     74   </openflow:datapath>
     75
     76
     77   <openflow:datapath component_id="urn:publicid:IDN+openflow:foam:uxmal.gpolab.bbn.com+datapath:06:af:00:24:a8:c4:b9:00"
     78                      component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.gpolab.bbn.com+authority+am"
     79                      dpid="06:af:00:24:a8:c4:b9:00">
     80     <openflow:port name="26" num="50"/>
     81     <openflow:port name="47" num="71"/>
     82   </openflow:datapath>
     83
     84 </openflow:group>
     85}}}
     86
     87   4. Specify your flowspace. E.g. if you want for the above group to get all traffic that is sourced or destined to the IP subnet 10.1.1.0/24 and uses tcp port 80, then you will need two <openflow:match> tags, one to match the packets that are sourced from that subnet and one to match the packets that are destined to that subnet. Keep in mind that your flowspace is the union of the traffic that is described by each. If you need to get a list of all possible filters and how the tags are named look [wiki:HowTo/WriteOFv3Rspecs/Spec#Filterelements here.]
     88{{{
     89#!xml
     90 <openflow:match>
     91   <openflow:use-group name="mygrp" />
     92   <openflow:packet>
     93     <openflow:dl_type value="0x800" />
     94     <openflow:nw_src value="10.1.1.0/24" />
     95     <openflow:nw_proto value="6, 17" />
     96     <openflow:tp_src value="80" />
     97   </openflow:packet>
     98 </openflow:match>
     99
     100 <openflow:match>
     101   <openflow:use-group name="mygrp" />
     102   <openflow:packet>
     103     <openflow:dl_type value="0x800" />
     104     <openflow:nw_dst value="10.1.1.0/24" />
     105     <openflow:nw_proto value="6, 17" />
     106     <openflow:tp_dst value="80" />
     107   </openflow:packet>
     108 </openflow:match>
     109}}}
     110
     111Notice that although we need to match on IP source/destination and on the transport protocol port, we also applied filters to ensure that the packet is an IP packet and that the IP protocol is TCP or UDP. Openflow can filter on any Layer 2, Layer 3 or Layer 4 header field but you would need to match
     112the type on the lower level in order to filter at the higher one, e.g. in order to match on IP fields you need to first ensure that the packet is indeed an IP packet.
     113
     114Done! The complete rspec looks like :
     115{{{
     116#!xml
    37117<?xml version="1.1" encoding="UTF-8"?>
    38118<rspec  xmlns="http://www.protogeni.net/resources/rspec/2"
     
    47127    <openflow:sliver email="user@geni.net" description="My GENI experiment" ref="http://www.geni.net" />
    48128
    49         <!-- rest of rspec -->
    50 
    51     </openflow:sliver>
    52 </rspec>
    53 }}}
    54 
    55    2. Specify where your controller is running. E.g.:
    56 {{{
    57  #!xml
    58 <openflow:controller url="tcp:example.geni.net:9933" type="primary" />
    59 }}}
    60 
    61    3. Organize the datapaths that are relevant to this sliver within groups. The best way to construct the <openflow:datapath> elements is by copying them from the advertisement rspecs. E.g if [attachment:ad-sample.rspec this] is the advertisement rspec, and you want :
    62    * ports 7 and 20 of datapath with dpid 06:a4:00:12:e2:b8:a5:d0
    63    * ports 50 and 71 of datapath with dpid 06:af:00:24:a8:c4:b9:00
    64 
    65 Then you can construct a group that looks like :
    66 {{{
    67  #!xml
    68  <openflow:group name="mygrp">
    69    <openflow:datapath component_id="urn:publicid:IDN+openflow:foam:uxmal.gpolab.bbn.com+datapath:06:a4:00:12:e2:b8:a5:d0"
    70                       component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.gpolab.bbn.com+authority+am"
    71                       dpid="06:a4:00:12:e2:b8:a5:d0">
    72      <openflow:port name="GBE0/7" num="7"/>
    73      <openflow:port name="GBE0/20" num="20"/>
    74    </openflow:datapath>
    75 
    76 
    77    <openflow:datapath component_id="urn:publicid:IDN+openflow:foam:uxmal.gpolab.bbn.com+datapath:06:af:00:24:a8:c4:b9:00"
    78                       component_manager_id="urn:publicid:IDN+openflow:foam:uxmal.gpolab.bbn.com+authority+am"
    79                       dpid="06:af:00:24:a8:c4:b9:00">
    80      <openflow:port name="26" num="50"/>
    81      <openflow:port name="47" num="71"/>
    82    </openflow:datapath>
    83 
    84  </openflow:group>
    85 }}}
    86 
    87    4. Specify your flowspace. E.g. if you want for the above group to get all traffic that is sourced or destined to the IP subnet 10.1.1.0/24 and uses tcp port 80, then you will need two <openflow:match> tags, one to match the packets that are sourced from that subnet and one to match the packets that are destined to that subnet. Keep in mind that your flowspace is the union of the traffic that is described by each. If you need to get a list of all possible filters and how the tags are named look [wiki:HowTo/WriteOFv3Rspecs/Spec#Filterelements here.]
    88 {{{
    89 #!xml
    90  <openflow:match>
    91    <openflow:use-group name="mygrp" />
    92    <openflow:packet>
    93      <openflow:dl_type value="0x800" />
    94      <openflow:nw_src value="10.1.1.0/24" />
    95      <openflow:nw_proto value="6, 17" />
    96      <openflow:tp_src value="80" />
    97    <openflow:packet />
    98  <openflow:match>
    99 
    100  <openflow:match>
    101    <openflow:use-group name="mygrp" />
    102    <openflow:packet>
    103      <openflow:dl_type value="0x800" />
    104      <openflow:nw_dst value="10.1.1.0/24" />
    105      <openflow:nw_proto value="6, 17" />
    106      <openflow:tp_dst value="80" />
    107    <openflow:packet />
    108  <openflow:match>
    109 }}}
    110 
    111 Notice that although we need to match on IP source/destination and on the transport protocol port, we also applied filters to ensure that the packet is an IP packet and that the IP protocol is TCP or UDP. Openflow can filter on any Layer 2, Layer 3 or Layer 4 header field but you would need to match
    112 the type on the lower level in order to filter at the higher one, e.g. in order to match on IP fields you need to first ensure that the packet is indeed an IP packet.
    113 
    114 Done! The complete rspec looks like :
    115 {{{
    116 #!xml
    117 <?xml version="1.1" encoding="UTF-8"?>
    118 <rspec  xmlns="http://www.protogeni.net/resources/rspec/2"
    119         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
    120         xmlns:openflow="http://www.geni.net/resources/rspec/ext/openflow/3"
    121         xs:schemaLocation="http://www.protogeni.net/resources/rspec/2
    122               http://www.protogeni.net/resources/rspec/2/request.xsd
    123               http://www.geni.net/resources/rspec/ext/openflow/3
    124               http://www.geni.net/resources/rspec/ext/openflow/3/of-resv.xsd"
    125     type="request">
    126    
    127     <openflow:sliver email="user@geni.net" description="My GENI experiment" ref="http://www.geni.net" />
    128 
    129129       <openflow:controller url="tcp:myctrl.example.net:9933" type="primary" />
    130130