.. _ofp-flow-examples: Flow Examples ------------- Overview ~~~~~~~~ The flow examples on this page are tested to work with OVS. Use, for example, POSTMAN with the following parameters: :: PUT http://:8181/restconf/config/opendaylight-inventory:nodes/node//table//flow/ - Accept: application/xml - Content-Type: application/xml For example: :: PUT http://localhost:8181/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 ~~~~~~~~~~~~~~ The format of the XML that describes OpenFlow matches is determined by the opendaylight-match-types yang model: . 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) .. code:: xml false 0 0 2 124 255 false 2048 10.0.1.1/24 12 1 34 FooXf1 2 false Ethernet Src Address ^^^^^^^^^^^^^^^^^^^^ - Flow=126, Table=2, Priority=2, Instructions=\\{Apply\_Actions={drop}}, match=\\{ethernet-source=00:00:00:00:00:01} .. code:: 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 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} .. code:: 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Note that ethernet-type MUST be 34887 (0x8847) .. code:: 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 - Note that ethernet-type MUST be 2048 (0x800) .. code:: 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 - Note that ethernet-type MUST be 2048 (0x800) - Note that IP Protocol Type MUST be 6 .. code:: 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 - Note that ethernet-type MUST be 2048 (0x800) - Note that IP Protocol Type MUST be 17 .. code:: 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 - Note that ethernet-type MUST be 2048 (0x800) - Note that IP Protocol Type MUST be 1 .. code:: 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 - Note that ethernet-type MUST be 2054 (0x806) .. code:: 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code:: 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code:: 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 ^^^^^^^^^^^^^^^^^^^^^^^^^ - Note that ethernet-type MUST be 34525 .. code:: 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 ^^^^^^^^ .. code:: xml false FooXf19 142 255 19 2 1 1200 3400 false 0 0 12345 Metadata, Metadata Mask ^^^^^^^^^^^^^^^^^^^^^^^ .. code:: 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Note that ethernet-type MUST be 34525 .. code:: 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Note that ethernet-type MUST be 34525 - Note that IP Protocol MUST be 6 .. code:: 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Note that ethernet-type MUST be 34525 - Note that IP Protocol MUST be 6 .. code:: 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 ^^^^^^^^^ .. code:: 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Note that ethernet-type MUST be 34525 - Note that IP Protocol MUST be 58 .. code:: 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Note that ethernet-type MUST be 34525 - Note that IP Protocol MUST be 58 .. code:: 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 ~~~~~~~ The format of the XML that describes OpenFlow actions is determined by the opendaylight-action-types yang model: . Apply Actions ^^^^^^^^^^^^^ Output to TABLE ''''''''''''''' .. code:: 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 '''''''''''''''' .. code:: 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 ''''''''''''''''''''''' .. code:: 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 ''''''''''''''' .. code:: 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 '''''''''''''''' .. code:: 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 ''''''''''''''' .. code:: 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 ''''''''''''' .. code:: 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 '''''''''''''''''''' .. code:: 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 ''''''''''''' .. code:: 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 ''''''''' .. code:: 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 ''''''''' .. code:: 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 ''''''''' - Note that ethernet-type MUST be 34887 .. code:: xml push-mpls-action 2 37 1 2 2 false 101 34887 1 27 0 255 401 8 0 false 0 Pop MPLS '''''''' - Note that ethernet-type MUST be 34887 - Issue with OVS 2.1 `OVS fix `_ .. code:: xml FooXf10 0 2048 1 2 60 2 11 false 34887 1 37 0 889 255 false 0 10 0 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 .. code:: 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