Version 13 (modified by 13 years ago) (diff) | ,
---|
OF v3 rspecs examples
If you have written any interested OFv3 rspecs, feel free to add them at the bottom of this page and help others:-)
A complete example rspec can be found here example rspec
Rspec with one group
If you want to apply your packet filters to the same set of dpids, then you just need to create one group and use it in all your matches. In this example we only match on Ethernet addresses.
<?xml version="1.1" encoding="UTF-8"?> <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/3" 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/3 http://www.geni.net/resources/rspec/ext/openflow/3/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:dl_src value="10:01:01:00:24:ef" /> <openflow:packet /> <openflow:match> <openflow:match> <openflow:use-group name="mygrp" /> <openflow:packet> <openflow:dl_dst value="10:01:01:0:24:73" /> <openflow:packet /> <openflow:match> </openflow:sliver> </rspec>
Rspec with multiple groups
If you need to apply different packet filters in different datapath sets, then you can create multiple groups and use them as needed in your matches. In this example we want all ARP packets of a specific vlan.
<?xml version="1.1" encoding="UTF-8"?> <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/3" 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/3 http://www.geni.net/resources/rspec/ext/openflow/3/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:dl_vlan value="10" /> <openflow:dl_type value="0x806" /> <openflow:packet /> <openflow:match> <openflow:match> <openflow:use-group name="mygrp2" /> <openflow:packet> <openflow:nw_src dl_vlan="10-12" /> <openflow:dl_type value="0x806" /> <openflow:packet /> <openflow:match> </openflow:sliver> </rspec>
Rspec with groups and datapaths
If for only one of your matches you need a different set of datapaths, you don't need to create a group you can just add the datapaths directly in your match. In this example we match all ssh (TCP port 22) traffic.
<?xml version="1.1" encoding="UTF-8"?> <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/3" 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/3 http://www.geni.net/resources/rspec/ext/openflow/3/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: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:dl_type value="0x800" /> <openflow:nw_proto value="6" /> <openflow:tp_dst value="22" /> <openflow:packet /> <openflow:match> <openflow:match> <openflow:use-group name="mygrp" /> <openflow:packet> <openflow:dl_type value="0x800" /> <openflow:nw_proto value="6" /> <openflow:tp_src value="22" /> <openflow:packet /> <openflow:match> </openflow:sliver> </rspec>
Rspec for ICMP traffic from all the datapaths
<?xml version="1.1" encoding="UTF-8"?> <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/3" 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/3 http://www.geni.net/resources/rspec/ext/openflow/3/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="all" /> <openflow:match> <openflow:use-group name="all" /> <openflow:packet> <openflow:dl_type value="0x800" /> <openflow:nw_proto value="1" /> <openflow:packet /> <openflow:match> </openflow:sliver> </rspec>
Rspec to get all traffic for an IP subnet including ARP
<?xml version="1.1" encoding="UTF-8"?> <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/3" 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/3 http://www.geni.net/resources/rspec/ext/openflow/3/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="all" /> <openflow:match> <openflow:use-group name="all" /> <openflow:packet> <openflow:dl_type value="0x800, 0x806" /> <openflow:nw_src value="10.10.10.0/24" /> <openflow:nw_dst value="10.10.10.0/24" /> <openflow:packet /> <openflow:match> </openflow:sliver> </rspec>
OFv2 to OFv3 conversion examples
Request port TCP port on a subnet
OF v1
<!-- This rspec will reserve the OpenFlow resources at example.net that are used for the Aster*x experiment with OFv1 --> <resv_rspec type="openflow"> <user affiliation="BBN" email="aster*x@example.net" firstname="Aster*x" lastname="Stanford" password="ast"/> <project description="Asterix" name="Stanford's Asterix demo"/> <slice controller_url="tcp:ctrl.example.net:8833" description="The Asterix controller." name="stanford-asterix"/> <flowspace> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:55"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:56"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:71"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:12:e2:b8:a5:d0+port:20"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:12:e2:b8:a5:d0+port:5"/> <dl_type from="2048" to="2048"/> <nw_src from="10.42.111.0" to "10.42.111.255.0" /> <nw_dst from="10.42.111.0" to "10.42.111.255.0" /> <tp_src from="10001" to="10001"/> </flowspace> <flowspace> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:55"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:56"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:71"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:12:e2:b8:a5:d0+port:20"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:12:e2:b8:a5:d0+port:5"/> <dl_type from="2048" to="2048"/> <nw_src from="10.42.111.0" to "10.42.111.255.0" /> <nw_dst from="10.42.111.0" to "10.42.111.255.0" /> <tp_src from="10001" to="10001"/> </flowspace> <flowspace> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:55"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:56"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:71"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:12:e2:b8:a5:d0+port:20"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:12:e2:b8:a5:d0+port:5"/> <dl_type from="2054" to="2054"/> <nw_src from="10.42.111.0" to "10.42.111.255.0" /> <nw_dst from="10.42.111.0" to "10.42.111.255.0" /> <tp_src from="10001" to="10001"/> </flowspace> <flowspace> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:55"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:56"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:24:a8:c4:b9:00+port:71"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:12:e2:b8:a5:d0+port:20"/> <port urn="urn:publicid:IDN+texpedient.example.net:expedient:openflow+switch:06:d6:00:12:e2:b8:a5:d0+port:5"/> <dl_type from="2054" to="2054"/> <nw_src from="10.42.111.0" to "10.42.111.255.0" /> <nw_dst from="10.42.111.0" to "10.42.111.255.0" /> <tp_src from="10001" to="10001"/> </flowspace> </resv_rspec>
OF v3
<?xml version="1.1" encoding="UTF-8"?> <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/3" 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/3 http://www.geni.net/resources/rspec/ext/openflow/3/of-resv.xsd" type="request"> <!-- This rspec will reserve the OpenFlow resources at example.net that are used for the Aster*x experiment with OFv1 --> <openflow:sliver email="asterx@example.net" description="Asterix" name="Stanford's Asterix demo"/> <openflow:controller url="tcp:ctrl.example.net:8833" type="primary"/> <openflow:group name="aster*x"> <openflow:datapath component_id="urn:publicid:IDN+openflow:foam:foam.example.net+datapath:06:d6:00:24:a8:c4:b9:00" component_manager_id="urn:publicid:IDN+openflow:foam:foam.example.net+authority+am"> <openflow:port num="55"/> <openflow:port num="56"/> <openflow:port num="71"/> </openflow:datapath> <openflow:datapath component_id="urn:publicid:IDN+openflow:foam:foam.example.net+datapath:06:d6:00:12:e2:b8:a5:d0" component_manager_id="urn:publicid:IDN+openflow:foam:foam.example.net+authority+am"> <openflow:port num="5"/> <openflow:port num="20"/> </openflow:datapath> </openflow:group> <openflow:match> <openflow:use-group name="aster*x" /> <openflow:packet> <openflow:dl_type value="0x800, 0x806"/> <openflow:nw_src value="10.42.111.0/24" /> <openflow:nw_dst value="10.42.111.0/24" /> <openflow:tp_src value="10001" /> </openflow:match> <openflow:match> <openflow:use-group name="aster*x" /> <openflow:packet> <openflow:dl_type value="0x800, 0x806"/> <openflow:nw_src value="10.42.111.0/24" /> <openflow:nw_dst value="10.42.111.0/24" /> <openflow:tp_dst value="10001" /> </openflow:match> </resv_rspec>