[[odl-ofp-example-flows_overview]] ==== Overview The flow examples on this page are tested to work with OVS. Use, for example, POSTMAN with the following parameters: --------------------------------------------------------------------------------------------------------------------- PUT http://:8080/restconf/config/opendaylight-inventory:nodes/node//table//flow/ - Accept: application/xml - Content-Type: application/xml --------------------------------------------------------------------------------------------------------------------- For example: ------------------------------------------------------------------------------------------------------- PUT http://localhost:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/2/flow/127 ------------------------------------------------------------------------------------------------------- Make sure that the Table-# and Flow-# in the URL and in the XML match. The format of the flow-programming XML is determined by by the grouping 'flow' in the opendaylight-flow-types yang model: MISSING LINK. [[match-examples]] ==== Match Examples The format of the XML that describes OpenFlow matches is determined by the opendaylight-match-types yang model: . The RESTCONF documentation for the match-types yang model can be found at https://jenkins.opendaylight.org/controller/job/controller-merge/lastSuccessfulBuild/artifact/opendaylight/md-sal/model/model-flow-base/target/site/models/opendaylight-match-types.html[opendaylight-match-types.html] [[ipv4-dest-address]] ===== IPv4 Dest Address * Flow=124, Table=2, Priority=2, Instructions=\{Apply_Actions=\{dec_nw_ttl}}, match=\{ipv4_destination_address=10.0.1.1/24} * Note that ethernet-type MUST be 2048 (0x800) [source,xml] -------------------------------------------------------- false 0 0 2 124 255 false 2048 10.0.1.1/24 12 1 34 FooXf1 2 false -------------------------------------------------------- [[ethernet-src-address]] ===== Ethernet Src Address * Flow=126, Table=2, Priority=2, Instructions=\{Apply_Actions=\{drop}}, match=\{ethernet-source=00:00:00:00:00:01} [source,xml] ------------------------------------------------------ false 0 0 2 126 255 false
00:00:00:00:00:01
12 3 34 FooXf3 2 false
------------------------------------------------------ [[ethernet-src-dest-addresses-ethernet-type]] ===== Ethernet Src & Dest Addresses, Ethernet Type * Flow=127, Table=2, Priority=2, Instructions=\{Apply_Actions=\{drop}}, match=\{ethernet-source=00:00:00:00:23:ae, ethernet-destination=ff:ff:ff:ff:ff:ff, ethernet-type=45} [source,xml] ------------------------------------------------------ false 0 0 2 127 255 false 45
ff:ff:ff:ff:ff:ff
00:00:00:00:23:ae
12 4 34 FooXf4 2 false
------------------------------------------------------ [[ethernet-src-dest-addresses-ipv4-src-dest-addresses-input-port]] ===== Ethernet Src & Dest Addresses, IPv4 Src & Dest Addresses, Input Port * Note that ethernet-type MUST be 34887 (0x8847) [source,xml] -------------------------------------------------------- false 0 0 2 128 255 34887
ff:ff:ff:ff:ff:ff
00:00:00:00:23:ae
10.1.2.3/24 20.4.5.6/16 0
12 5 34 FooXf5 2 false
-------------------------------------------------------- [[ethernet-src-dest-addresses-ipv4-src-dest-addresses-ip-protocol-ip-dscp-ip-ecn-input-port]] ===== Ethernet Src & Dest Addresses, IPv4 Src & Dest Addresses, IP Protocol #, IP DSCP, IP ECN, Input Port * Note that ethernet-type MUST be 2048 (0x800) [source,xml] -------------------------------------------------------- false 0 0 2 130 255 2048
ff:ff:ff:ff:ff:aa
00:00:00:11:23:ae
10.1.2.3/24 20.4.5.6/16 56 15 1 0
12000 7 12000 FooXf7 2 false
-------------------------------------------------------- [[ethernet-src-dest-addresses-ipv4-src-dest-addresses-tcp-src-dest-ports-ip-dscp-ip-ecn-input-port]] ===== Ethernet Src & Dest Addresses, IPv4 Src & Dest Addresses, TCP Src & Dest Ports, IP DSCP, IP ECN, Input Port * Note that ethernet-type MUST be 2048 (0x800) * Note that IP Protocol Type MUST be 6 [source,xml] ----------------------------------------------------------- false 0 0 2 131 255 2048
ff:ff:29:01:19:61
00:00:00:11:23:ae
17.1.2.3/8 172.168.5.6/16 6 2 2 25364 8080 0
1200 8 3400 FooXf8 2 false
----------------------------------------------------------- [[ethernet-src-dest-addresses-ipv4-src-dest-addresses-udp-src-dest-ports-ip-dscp-ip-ecn-input-port]] ===== Ethernet Src & Dest Addresses, IPv4 Src & Dest Addresses, UDP Src & Dest Ports, IP DSCP, IP ECN, Input Port * Note that ethernet-type MUST be 2048 (0x800) * Note that IP Protocol Type MUST be 17 [source,xml] ----------------------------------------------------------- false 0 0 2 132 255 2048
20:14:29:01:19:61
00:00:00:11:23:ae
19.1.2.3/10 172.168.5.6/18 17 8 3 25364 8080 0
1200 9 3400 FooXf9 2 false ----------------------------------------------------------- [[ethernet-src-dest-addresses-ipv4-src-dest-addresses-icmpv4-type-code-ip-dscp-ip-ecn-input-port]] ===== Ethernet Src & Dest Addresses, IPv4 Src & Dest Addresses, ICMPv4 Type & Code, IP DSCP, IP ECN, Input Port * Note that ethernet-type MUST be 2048 (0x800) * Note that IP Protocol Type MUST be 1 [source,xml] ----------------------------------------------------------- false 0 0 2 134 255 2048
ff:ff:29:01:19:61
00:00:00:11:23:ae
17.1.2.3/8 172.168.5.6/16 1 27 3 6 3 0
1200 11 3400 FooXf11 2
----------------------------------------------------------- [[ethernet-src-dest-addresses-arp-operation-arp-src-target-transport-addresses-arp-src-target-hw-addresses]] ===== Ethernet Src & Dest Addresses, ARP Operation, ARP Src & Target Transport Addresses, ARP Src & Target Hw Addresses * Note that ethernet-type MUST be 2054 (0x806) [source,xml] -------------------------------------------------------------------------------- false 0 0 1 2 137 255 2054
ff:ff:ff:ff:FF:ff
00:00:FC:01:23:ae
1 192.168.4.1 10.21.22.23
12:34:56:78:98:AB
FE:DC:BA:98:76:54
12 14 34 FooXf14 2 false -------------------------------------------------------------------------------- [[ethernet-src-dest-addresses-ethernet-type-vlan-id-vlan-pcp]] ===== Ethernet Src & Dest Addresses, Ethernet Type, VLAN ID, VLAN PCP [source,xml] ------------------------------------------------------- false 0 0 2 138 255 2048
ff:ff:29:01:19:61
00:00:00:11:23:ae
78 true 3
1200 15 3400 FooXf15 2 false
------------------------------------------------------- [[ethernet-src-dest-addresses-mpls-label-mpls-tc-mpls-bos]] ===== Ethernet Src & Dest Addresses, MPLS Label, MPLS TC, MPLS BoS [source,xml] ------------------------------------------------------ FooXf17 140 255 17 1200 3400 2 2 false 0 0 34887
ff:ff:29:01:19:61
00:00:00:11:23:ae
567 3 1
------------------------------------------------------ [[ipv6-src-dest-addresses]] ===== IPv6 Src & Dest Addresses * Note that ethernet-type MUST be 34525 [source,xml] ------------------------------------------------------------------------------ false FooXf18 141 255 18 2 2 1200 3400 false 0 0 34525 fe80::2acf:e9ff:fe21:6431/128 aabb:1234:2acf:e9ff::fe21:6431/64 ------------------------------------------------------------------------------ [[metadata]] ===== Metadata [source,xml] ------------------------------------------------------ false FooXf19 142 255 19 2 1 1200 3400 false 0 0 12345 ------------------------------------------------------ [[metadata-metadata-mask]] ===== Metadata, Metadata Mask [source,xml] ------------------------------------------------------ false FooXf20 143 255 20 2 2 1200 3400 false 0 0 12345 //FF ------------------------------------------------------ [[ipv6-src-dest-addresses-metadata-ip-dscp-ip-ecn-udp-src-dest-ports]] ===== IPv6 Src & Dest Addresses, Metadata, IP DSCP, IP ECN, UDP Src & Dest Ports * Note that ethernet-type MUST be 34525 [source,xml] ----------------------------------------------------------------------------- false FooXf21 144 255 21 2 2 1200 3400 false 0 0 34525 1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76 fe80::2acf:e9ff:fe21:6431/128 12345 17 8 3 25364 8080 ----------------------------------------------------------------------------- [[ipv6-src-dest-addresses-metadata-ip-dscp-ip-ecn-tcp-src-dest-ports]] ===== IPv6 Src & Dest Addresses, Metadata, IP DSCP, IP ECN, TCP Src & Dest Ports * Note that ethernet-type MUST be 34525 * Note that IP Protocol MUST be 6 [source,xml] ----------------------------------------------------------------------------- false FooXf22 145 255 22 2 2 1200 3400 false 0 0 34525 1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76 fe80:2acf:e9ff:fe21::6431/94 12345 6 60 3 183 8080 ----------------------------------------------------------------------------- [[ipv6-src-dest-addresses-metadata-ip-dscp-ip-ecn-tcp-src-dest-ports-ipv6-label]] ===== IPv6 Src & Dest Addresses, Metadata, IP DSCP, IP ECN, TCP Src & Dest Ports, IPv6 Label * Note that ethernet-type MUST be 34525 * Note that IP Protocol MUST be 6 [source,xml] ----------------------------------------------------------------------------- false FooXf23 146 255 23 2 2 1200 3400 false 0 0 34525 1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76 fe80:2acf:e9ff:fe21::6431/94 12345 33 6 60 3 183 8080 ----------------------------------------------------------------------------- [[tunnel-id]] ===== Tunnel ID [source,xml] ------------------------------------------------------ false FooXf24 147 255 24 2 2 1200 3400 false 0 0 2591 ------------------------------------------------------ [[ipv6-src-dest-addresses-metadata-ip-dscp-ip-ecn-icmpv6-type-code-ipv6-label]] ===== IPv6 Src & Dest Addresses, Metadata, IP DSCP, IP ECN, ICMPv6 Type & Code, IPv6 Label * Note that ethernet-type MUST be 34525 * Note that IP Protocol MUST be 58 [source,xml] ----------------------------------------------------------------------------- false FooXf25 148 255 25 2 2 1200 3400 false 0 0 34525 1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76 fe80:2acf:e9ff:fe21::6431/94 12345 33 58 60 3 6 3 ----------------------------------------------------------------------------- [[ipv6-src-dest-addresses-metadata-ip-dscp-ip-ecn-tcp-src-dst-ports-ipv6-label-ipv6-ext-header]] ===== IPv6 Src & Dest Addresses, Metadata, IP DSCP, IP ECN, TCP Src & Dst Ports, IPv6 Label, IPv6 Ext Header * Note that ethernet-type MUST be 34525 * Note that IP Protocol MUST be 58 [source,xml] ----------------------------------------------------------------------------- false FooXf27 150 255 27 2 2 1200 3400 false 0 0 34525 1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76 fe80:2acf:e9ff:fe21::6431/94 12345 33 0 6 60 3 183 8080 ----------------------------------------------------------------------------- [[actions]] ==== Actions The format of the XML that describes OpenFlow actions is determined by the opendaylight-action-types yang model: . The RESTCONF documentation for the match-types yang model can be found at https://jenkins.opendaylight.org/controller/job/controller-merge/lastSuccessfulBuild/artifact/opendaylight/md-sal/model/model-flow-base/target/site/models/opendaylight-action-types.html[opendaylight-action-types.html] [[apply-actions]] ===== Apply Actions [[output-to-table]] ====== Output to TABLE [source,xml] ----------------------------------------------------------------------------- false FooXf101 256 255 101 2 2 1200 3400 false 0 0 TABLE 60 34525 1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76 fe80:2acf:e9ff:fe21::6431/94 12345 6 60 3 183 8080 ----------------------------------------------------------------------------- [[output-to-inport]] ====== Output to INPORT [source,xml] ----------------------------------------------------------------------------- false FooXf102 257 255 102 2 2 1200 3400 false 0 0 INPORT 60 7 2048
ff:ff:29:01:19:61
00:00:00:11:23:ae
17.1.2.3/8 172.168.5.6/16 6 2 2 25364 8080
----------------------------------------------------------------------------- [[output-to-physical-port]] ====== Output to Physical Port [source,xml] ------------------------------------------------------------------------ false FooXf103 258 255 103 2 2 1200 3400 false 0 0 1 60 2048
ff:ff:29:01:19:61
00:00:00:11:23:ae
17.1.2.3/8 172.168.5.6/16 6 2 2 25364 8080
------------------------------------------------------------------------ [[output-to-local]] ====== Output to LOCAL [source,xml] ----------------------------------------------------------------------------- false FooXf104 259 255 104 2 2 1200 3400 false 0 0 LOCAL 60 34525 1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76 fe80:2acf:e9ff:fe21::6431/94 12345 6 60 3 183 8080 ----------------------------------------------------------------------------- [[output-to-normal]] ====== Output to NORMAL [source,xml] ----------------------------------------------------------------------------- false FooXf105 260 255 105 2 2 1200 3400 false 0 0 NORMAL 60 34525 1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/84 fe80:2acf:e9ff:fe21::6431/90 12345 6 45 2 20345 80 ----------------------------------------------------------------------------- [[output-to-flood]] ====== Output to FLOOD [source,xml] ------------------------------------------------------------------------------ false FooXf106 261 255 106 2 2 1200 3400 false 0 0 FLOOD 60 34525 1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/100 fe80:2acf:e9ff:fe21::6431/67 12345 6 45 2 20345 80 ------------------------------------------------------------------------------ [[output-to-all]] ====== Output to ALL [source,xml] -------------------------------------------------------------------------- false FooXf107 262 255 107 2 2 1200 3400 false 0 0 ALL 60 2048
20:14:29:01:19:61
00:00:00:11:23:ae
19.1.2.3/10 172.168.5.6/18 17 8 3 25364 8080 0
-------------------------------------------------------------------------- [[output-to-controller]] ====== Output to CONTROLLER [source,xml] --------------------------------------------------------------------------------- false FooXf108 263 255 108 2 2 1200 3400 false 0 0 CONTROLLER 60 2048
20:14:29:01:19:61
00:00:00:11:23:ae
19.1.2.3/10 172.168.5.6/18 17 8 3 25364 8080 0
--------------------------------------------------------------------------------- [[output-to-any]] ====== Output to ANY [source,xml] -------------------------------------------------------------------------- false FooXf109 264 255 109 2 2 1200 3400 false 0 0 ANY 60 2048
20:14:29:01:19:61
00:00:00:11:23:ae
19.1.2.3/10 172.168.5.6/18 17 8 3 25364 8080 0
-------------------------------------------------------------------------- [[push-vlan]] ====== Push VLAN [source,xml] ----- false 0 33024 0 79 true 1 5 2 0 31 2048
FF:FF:29:01:19:61
00:00:00:11:23:AE
1
vlan_flow 2
----- [[push-mpls]] ====== Push MPLS [source,xml] ------------------------------------------------------------------------ push-mpls-action 3 34887 0 27 1 2 2 false 100 2048 1 10.0.0.4/32 0 255 401 8 0 false 0 ------------------------------------------------------------------------ [[swap-mpls]] ====== Swap MPLS * Note that ethernet-type MUST be 34887 [source,xml] ------------------------------------------------------------------------ push-mpls-action 2 37 1 2 2 false 101 34887 1 27 0 255 401 8 0 false 0 ------------------------------------------------------------------------ [[pop-mpls]] ====== Pop MPLS * Note that ethernet-type MUST be 34887 * Issue with OVS 2.1 http://git.openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=b3f2fc93e3f357f8d05a92f53ec253339a40887f[OVS fix] [source,xml] ------------------------------------------------------------------------ FooXf10 0 2048 1 2 60 2 11 false 34887 1 37 0 889 255 false 0 10 0 ------------------------------------------------------------------------ [[learn]] ====== Learn * Nicira extension defined in https://github.com/osrg/openvswitch/blob/master/include/openflow/nicira-ext.h * Example section is - https://github.com/osrg/openvswitch/blob/master/include/openflow/nicira-ext.h#L788 [source,xml] ------------------------------------------------------------------------ ICMP_Ingress258a5a5ad-08a8-4ff7-98f5-ef0b96ca3bb8 0 0 2048 2199023255552 2305841909702066176 1 110100480 0 1 220
0 60 0 60 0 41 61010 0 0 2048 1538 16 0 0 4100 3588 32 0 0 518 1030 48 0 0 3073 3073 8 0 1 65540 8 110100480
true false false 61010 253 ACL
------------------------------------------------------------------------