]> git.proxmox.com Git - ovs.git/blob - ovn/ovn-sb.xml
ovn-controller: Use UDP checksums when creating Geneve tunnels.
[ovs.git] / ovn / ovn-sb.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <database name="ovn-sb" title="OVN Southbound Database">
3 <p>
4 This database holds logical and physical configuration and state for the
5 Open Virtual Network (OVN) system to support virtual network abstraction.
6 For an introduction to OVN, please see <code>ovn-architecture</code>(7).
7 </p>
8
9 <p>
10 The OVN Southbound database sits at the center of the OVN
11 architecture. It is the one component that speaks both southbound
12 directly to all the hypervisors and gateways, via
13 <code>ovn-controller</code>/<code>ovn-controller-vtep</code>, and
14 northbound to the Cloud Management System, via <code>ovn-northd</code>:
15 </p>
16
17 <h2>Database Structure</h2>
18
19 <p>
20 The OVN Southbound database contains classes of data with
21 different properties, as described in the sections below.
22 </p>
23
24 <h3>Physical Network (PN) data</h3>
25
26 <p>
27 PN tables contain information about the chassis nodes in the system. This
28 contains all the information necessary to wire the overlay, such as IP
29 addresses, supported tunnel types, and security keys.
30 </p>
31
32 <p>
33 The amount of PN data is small (O(n) in the number of chassis) and it
34 changes infrequently, so it can be replicated to every chassis.
35 </p>
36
37 <p>
38 The <ref table="Chassis"/> table comprises the PN tables.
39 </p>
40
41 <h3>Logical Network (LN) data</h3>
42
43 <p>
44 LN tables contain the topology of logical switches and routers, ACLs,
45 firewall rules, and everything needed to describe how packets traverse a
46 logical network, represented as logical datapath flows (see Logical
47 Datapath Flows, below).
48 </p>
49
50 <p>
51 LN data may be large (O(n) in the number of logical ports, ACL rules,
52 etc.). Thus, to improve scaling, each chassis should receive only data
53 related to logical networks in which that chassis participates. Past
54 experience shows that in the presence of large logical networks, even
55 finer-grained partitioning of data, e.g. designing logical flows so that
56 only the chassis hosting a logical port needs related flows, pays off
57 scale-wise. (This is not necessary initially but it is worth bearing in
58 mind in the design.)
59 </p>
60
61 <p>
62 The LN is a slave of the cloud management system running northbound of OVN.
63 That CMS determines the entire OVN logical configuration and therefore the
64 LN's content at any given time is a deterministic function of the CMS's
65 configuration, although that happens indirectly via the
66 <ref db="OVN_Northbound"/> database and <code>ovn-northd</code>.
67 </p>
68
69 <p>
70 LN data is likely to change more quickly than PN data. This is especially
71 true in a container environment where VMs are created and destroyed (and
72 therefore added to and deleted from logical switches) quickly.
73 </p>
74
75 <p>
76 <ref table="Logical_Flow"/> and <ref table="Multicast_Group"/> contain LN
77 data.
78 </p>
79
80 <h3>Logical-physical bindings</h3>
81
82 <p>
83 These tables link logical and physical components. They show the current
84 placement of logical components (such as VMs and VIFs) onto chassis, and
85 map logical entities to the values that represent them in tunnel
86 encapsulations.
87 </p>
88
89 <p>
90 These tables change frequently, at least every time a VM powers up or down
91 or migrates, and especially quickly in a container environment. The
92 amount of data per VM (or VIF) is small.
93 </p>
94
95 <p>
96 Each chassis is authoritative about the VMs and VIFs that it hosts at any
97 given time and can efficiently flood that state to a central location, so
98 the consistency needs are minimal.
99 </p>
100
101 <p>
102 The <ref table="Port_Binding"/> and <ref table="Datapath_Binding"/> tables
103 contain binding data.
104 </p>
105
106 <h3>MAC bindings</h3>
107
108 <p>
109 The <ref table="MAC_Binding"/> table tracks the bindings from IP addresses
110 to Ethernet addresses that are dynamically discovered using ARP (for IPv4)
111 and neighbor discovery (for IPv6). Usually, IP-to-MAC bindings for virtual
112 machines are statically populated into the <ref table="Port_Binding"/>
113 table, so <ref table="MAC_Binding"/> is primarily used to discover bindings
114 on physical networks.
115 </p>
116
117 <h2>Common Columns</h2>
118
119 <p>
120 Some tables contain a special column named <code>external_ids</code>. This
121 column has the same form and purpose each place that it appears, so we
122 describe it here to save space later.
123 </p>
124
125 <dl>
126 <dt><code>external_ids</code>: map of string-string pairs</dt>
127 <dd>
128 Key-value pairs for use by the software that manages the OVN Southbound
129 database rather than by
130 <code>ovn-controller</code>/<code>ovn-controller-vtep</code>. In
131 particular, <code>ovn-northd</code> can use key-value pairs in this
132 column to relate entities in the southbound database to higher-level
133 entities (such as entities in the OVN Northbound database). Individual
134 key-value pairs in this column may be documented in some cases to aid
135 in understanding and troubleshooting, but the reader should not mistake
136 such documentation as comprehensive.
137 </dd>
138 </dl>
139
140 <table name="SB_Global" title="Southbound configuration">
141 <p>
142 Southbound configuration for an OVN system. This table must have exactly
143 one row.
144 </p>
145
146 <group title="Status">
147 This column allow a client to track the overall configuration state of
148 the system.
149
150 <column name="nb_cfg">
151 Sequence number for the configuration. When a CMS or
152 <code>ovn-nbctl</code> updates the northbound database, it increments
153 the <code>nb_cfg</code> column in the <code>NB_Global</code> table in
154 the northbound database. In turn, when <code>ovn-northd</code> updates
155 the southbound database to bring it up to date with these changes, it
156 updates this column to the same value.
157 </column>
158 </group>
159
160 <group title="Common Columns">
161 <column name="external_ids">
162 See <em>External IDs</em> at the beginning of this document.
163 </column>
164 </group>
165 </table>
166
167 <table name="Chassis" title="Physical Network Hypervisor and Gateway Information">
168 <p>
169 Each row in this table represents a hypervisor or gateway (a chassis) in
170 the physical network (PN). Each chassis, via
171 <code>ovn-controller</code>/<code>ovn-controller-vtep</code>, adds
172 and updates its own row, and keeps a copy of the remaining rows to
173 determine how to reach other hypervisors.
174 </p>
175
176 <p>
177 When a chassis shuts down gracefully, it should remove its own row.
178 (This is not critical because resources hosted on the chassis are equally
179 unreachable regardless of whether the row is present.) If a chassis
180 shuts down permanently without removing its row, some kind of manual or
181 automatic cleanup is eventually needed; we can devise a process for that
182 as necessary.
183 </p>
184
185 <column name="name">
186 OVN does not prescribe a particular format for chassis names.
187 ovn-controller populates this column using <ref key="system-id"
188 table="Open_vSwitch" column="external_ids" db="Open_vSwitch"/>
189 in the Open_vSwitch database's <ref table="Open_vSwitch"
190 db="Open_vSwitch"/> table. ovn-controller-vtep populates this
191 column with <ref table="Physical_Switch" column="name"
192 db="hardware_vtep"/> in the hardware_vtep database's
193 <ref table="Physical_Switch" db="hardware_vtep"/> table.
194 </column>
195
196 <column name="hostname">
197 The hostname of the chassis, if applicable. ovn-controller will populate
198 this column with the hostname of the host it is running on.
199 ovn-controller-vtep will leave this column empty.
200 </column>
201
202 <column name="nb_cfg">
203 Sequence number for the configuration. When <code>ovn-controller</code>
204 updates the configuration of a chassis from the contents of the
205 southbound database, it copies <ref table="SB_Global" column="nb_cfg"/>
206 from the <ref table="SB_Global"/> table into this column.
207 </column>
208
209 <column name="external_ids" key="ovn-bridge-mappings">
210 <code>ovn-controller</code> populates this key with the set of bridge
211 mappings it has been configured to use. Other applications should treat
212 this key as read-only. See <code>ovn-controller</code>(8) for more
213 information.
214 </column>
215
216 <column name="external_ids" key="datapath-type">
217 <code>ovn-controller</code> populates this key with the datapath type
218 configured in the <ref table="Bridge" column="datapath_type"/> column of
219 the Open_vSwitch database's <ref table="Bridge" db="Open_vSwitch"/>
220 table. Other applications should treat this key as read-only. See
221 <code>ovn-controller</code>(8) for more information.
222 </column>
223
224 <column name="external_ids" key="iface-types">
225 <code>ovn-controller</code> populates this key with the interface types
226 configured in the <ref table="Open_vSwitch" column="iface_types"/> column
227 of the Open_vSwitch database's <ref table="Open_vSwitch"
228 db="Open_vSwitch"/> table. Other applications should treat this key as
229 read-only. See <code>ovn-controller</code>(8) for more information.
230 </column>
231
232 <group title="Common Columns">
233 The overall purpose of these columns is described under <code>Common
234 Columns</code> at the beginning of this document.
235
236 <column name="external_ids"/>
237 </group>
238
239 <group title="Encapsulation Configuration">
240 <p>
241 OVN uses encapsulation to transmit logical dataplane packets
242 between chassis.
243 </p>
244
245 <column name="encaps">
246 Points to supported encapsulation configurations to transmit
247 logical dataplane packets to this chassis. Each entry is a <ref
248 table="Encap"/> record that describes the configuration.
249 </column>
250 </group>
251
252 <group title="Gateway Configuration">
253 <p>
254 A <dfn>gateway</dfn> is a chassis that forwards traffic between the
255 OVN-managed part of a logical network and a physical VLAN, extending a
256 tunnel-based logical network into a physical network. Gateways are
257 typically dedicated nodes that do not host VMs and will be controlled
258 by <code>ovn-controller-vtep</code>.
259 </p>
260
261 <column name="vtep_logical_switches">
262 Stores all VTEP logical switch names connected by this gateway
263 chassis. The <ref table="Port_Binding"/> table entry with
264 <ref column="options" table="Port_Binding"/>:<code>vtep-physical-switch</code>
265 equal <ref table="Chassis"/> <ref column="name" table="Chassis"/>, and
266 <ref column="options" table="Port_Binding"/>:<code>vtep-logical-switch</code>
267 value in <ref table="Chassis"/>
268 <ref column="vtep_logical_switches" table="Chassis"/>, will be
269 associated with this <ref table="Chassis"/>.
270 </column>
271 </group>
272 </table>
273
274 <table name="Encap" title="Encapsulation Types">
275 <p>
276 The <ref column="encaps" table="Chassis"/> column in the <ref
277 table="Chassis"/> table refers to rows in this table to identify
278 how OVN may transmit logical dataplane packets to this chassis.
279 Each chassis, via <code>ovn-controller</code>(8) or
280 <code>ovn-controller-vtep</code>(8), adds and updates its own rows
281 and keeps a copy of the remaining rows to determine how to reach
282 other chassis.
283 </p>
284
285 <column name="type">
286 The encapsulation to use to transmit packets to this chassis.
287 Hypervisors must use either <code>geneve</code> or
288 <code>stt</code>. Gateways may use <code>vxlan</code>,
289 <code>geneve</code>, or <code>stt</code>.
290 </column>
291
292 <column name="options">
293 <p>
294 Options for configuring the encapsulation. Currently, the only
295 option that has been defined is <code>csum</code>.
296 </p>
297
298 <p>
299 <code>csum</code> indicates that encapsulation checksums can be
300 transmitted and received with reasonable performance. It is a hint
301 to senders transmitting data to this chassis that they should use
302 checksums to protect OVN metadata. Set to <code>true</code> to enable
303 or <code>false</code> to disable.
304 </p>
305
306 <p>
307 In terms of performance, this actually significantly increases
308 throughput in most common cases when running on Linux based hosts
309 without NICs supporting encapsulation hardware offload (around 60% for
310 bulk traffic). The reason is that generally all NICs are capable of
311 offloading transmitted and received TCP/UDP checksums (viewed as
312 ordinary data packets and not as tunnels). The benefit comes on the
313 receive side where the validated outer checksum can be used to
314 additionally validate an inner checksum (such as TCP), which in turn
315 allows aggregation of packets to be more efficiently handled by the
316 rest of the stack.
317 </p>
318
319 <p>
320 Not all devices see such a benefit. The most notable exception is
321 hardware VTEPs. These devices are designed to not buffer entire
322 packets in their switching engines and are therefore unable to
323 efficiently compute or validate full packet checksums. In addition
324 certain versions of the Linux kernel are not able to fully take
325 advantage of encapsulation NIC offloads in the presence of checksums.
326 (This is actually a pretty narrow corner case though - earlier
327 versions of Linux don't support encapsulation offloads at all and
328 later versions support both offloads and checksums well.)
329 </p>
330
331 <p>
332 <code>csum</code> defaults to <code>false</code> for hardware VTEPs and
333 <code>true</code> for all other cases.
334 </p>
335 </column>
336
337 <column name="ip">
338 The IPv4 address of the encapsulation tunnel endpoint.
339 </column>
340 </table>
341
342 <table name="Address_Set" title="Address Sets">
343 <p>
344 See the documentation for the <ref table="Address_Set"
345 db="OVN_Northbound"/> table in the <ref db="OVN_Northbound"/> database
346 for details.
347 </p>
348
349 <column name="name"/>
350 <column name="addresses"/>
351 </table>
352
353 <table name="Logical_Flow" title="Logical Network Flows">
354 <p>
355 Each row in this table represents one logical flow.
356 <code>ovn-northd</code> populates this table with logical flows
357 that implement the L2 and L3 topologies specified in the
358 <ref db="OVN_Northbound"/> database. Each hypervisor, via
359 <code>ovn-controller</code>, translates the logical flows into
360 OpenFlow flows specific to its hypervisor and installs them into
361 Open vSwitch.
362 </p>
363
364 <p>
365 Logical flows are expressed in an OVN-specific format, described here. A
366 logical datapath flow is much like an OpenFlow flow, except that the
367 flows are written in terms of logical ports and logical datapaths instead
368 of physical ports and physical datapaths. Translation between logical
369 and physical flows helps to ensure isolation between logical datapaths.
370 (The logical flow abstraction also allows the OVN centralized
371 components to do less work, since they do not have to separately
372 compute and push out physical flows to each chassis.)
373 </p>
374
375 <p>
376 The default action when no flow matches is to drop packets.
377 </p>
378
379 <p><em>Architectural Logical Life Cycle of a Packet</em></p>
380
381 <p>
382 This following description focuses on the life cycle of a packet through
383 a logical datapath, ignoring physical details of the implementation.
384 Please refer to <em>Architectural Physical Life Cycle of a Packet</em> in
385 <code>ovn-architecture</code>(7) for the physical information.
386 </p>
387
388 <p>
389 The description here is written as if OVN itself executes these steps,
390 but in fact OVN (that is, <code>ovn-controller</code>) programs Open
391 vSwitch, via OpenFlow and OVSDB, to execute them on its behalf.
392 </p>
393
394 <p>
395 At a high level, OVN passes each packet through the logical datapath's
396 logical ingress pipeline, which may output the packet to one or more
397 logical port or logical multicast groups. For each such logical output
398 port, OVN passes the packet through the datapath's logical egress
399 pipeline, which may either drop the packet or deliver it to the
400 destination. Between the two pipelines, outputs to logical multicast
401 groups are expanded into logical ports, so that the egress pipeline only
402 processes a single logical output port at a time. Between the two
403 pipelines is also where, when necessary, OVN encapsulates a packet in a
404 tunnel (or tunnels) to transmit to remote hypervisors.
405 </p>
406
407 <p>
408 In more detail, to start, OVN searches the <ref table="Logical_Flow"/>
409 table for a row with correct <ref column="logical_datapath"/>, a <ref
410 column="pipeline"/> of <code>ingress</code>, a <ref column="table_id"/>
411 of 0, and a <ref column="match"/> that is true for the packet. If none
412 is found, OVN drops the packet. If OVN finds more than one, it chooses
413 the match with the highest <ref column="priority"/>. Then OVN executes
414 each of the actions specified in the row's <ref table="actions"/> column,
415 in the order specified. Some actions, such as those to modify packet
416 headers, require no further details. The <code>next</code> and
417 <code>output</code> actions are special.
418 </p>
419
420 <p>
421 The <code>next</code> action causes the above process to be repeated
422 recursively, except that OVN searches for <ref column="table_id"/> of 1
423 instead of 0. Similarly, any <code>next</code> action in a row found in
424 that table would cause a further search for a <ref column="table_id"/> of
425 2, and so on. When recursive processing completes, flow control returns
426 to the action following <code>next</code>.
427 </p>
428
429 <p>
430 The <code>output</code> action also introduces recursion. Its effect
431 depends on the current value of the <code>outport</code> field. Suppose
432 <code>outport</code> designates a logical port. First, OVN compares
433 <code>inport</code> to <code>outport</code>; if they are equal, it treats
434 the <code>output</code> as a no-op by default. In the common
435 case, where they are different, the packet enters the egress
436 pipeline. This transition to the egress pipeline discards
437 register data, e.g. <code>reg0</code> ... <code>reg9</code> and
438 connection tracking state, to achieve uniform behavior regardless
439 of whether the egress pipeline is on a different hypervisor
440 (because registers aren't preserve across tunnel encapsulation).
441 </p>
442
443 <p>
444 To execute the egress pipeline, OVN again searches the <ref
445 table="Logical_Flow"/> table for a row with correct <ref
446 column="logical_datapath"/>, a <ref column="table_id"/> of 0, a <ref
447 column="match"/> that is true for the packet, but now looking for a <ref
448 column="pipeline"/> of <code>egress</code>. If no matching row is found,
449 the output becomes a no-op. Otherwise, OVN executes the actions for the
450 matching flow (which is chosen from multiple, if necessary, as already
451 described).
452 </p>
453
454 <p>
455 In the <code>egress</code> pipeline, the <code>next</code> action acts as
456 already described, except that it, of course, searches for
457 <code>egress</code> flows. The <code>output</code> action, however, now
458 directly outputs the packet to the output port (which is now fixed,
459 because <code>outport</code> is read-only within the egress pipeline).
460 </p>
461
462 <p>
463 The description earlier assumed that <code>outport</code> referred to a
464 logical port. If it instead designates a logical multicast group, then
465 the description above still applies, with the addition of fan-out from
466 the logical multicast group to each logical port in the group. For each
467 member of the group, OVN executes the logical pipeline as described, with
468 the logical output port replaced by the group member.
469 </p>
470
471 <p><em>Pipeline Stages</em></p>
472
473 <p>
474 <code>ovn-northd</code> populates the <ref table="Logical_Flow"/> table
475 with the logical flows described in detail in <code>ovn-northd</code>(8).
476 </p>
477
478 <column name="logical_datapath">
479 The logical datapath to which the logical flow belongs.
480 </column>
481
482 <column name="pipeline">
483 <p>
484 The primary flows used for deciding on a packet's destination are the
485 <code>ingress</code> flows. The <code>egress</code> flows implement
486 ACLs. See <em>Logical Life Cycle of a Packet</em>, above, for details.
487 </p>
488 </column>
489
490 <column name="table_id">
491 The stage in the logical pipeline, analogous to an OpenFlow table number.
492 </column>
493
494 <column name="priority">
495 The flow's priority. Flows with numerically higher priority take
496 precedence over those with lower. If two logical datapath flows with the
497 same priority both match, then the one actually applied to the packet is
498 undefined.
499 </column>
500
501 <column name="match">
502 <p>
503 A matching expression. OVN provides a superset of OpenFlow matching
504 capabilities, using a syntax similar to Boolean expressions in a
505 programming language.
506 </p>
507
508 <p>
509 The most important components of match expression are
510 <dfn>comparisons</dfn> between <dfn>symbols</dfn> and
511 <dfn>constants</dfn>, e.g. <code>ip4.dst == 192.168.0.1</code>,
512 <code>ip.proto == 6</code>, <code>arp.op == 1</code>, <code>eth.type ==
513 0x800</code>. The logical AND operator <code>&amp;&amp;</code> and
514 logical OR operator <code>||</code> can combine comparisons into a
515 larger expression.
516 </p>
517
518 <p>
519 Matching expressions also support parentheses for grouping, the logical
520 NOT prefix operator <code>!</code>, and literals <code>0</code> and
521 <code>1</code> to express ``false'' or ``true,'' respectively. The
522 latter is useful by itself as a catch-all expression that matches every
523 packet.
524 </p>
525
526 <p><em>Symbols</em></p>
527
528 <p>
529 <em>Type</em>. Symbols have <dfn>integer</dfn> or <dfn>string</dfn>
530 type. Integer symbols have a <dfn>width</dfn> in bits.
531 </p>
532
533 <p>
534 <em>Kinds</em>. There are three kinds of symbols:
535 </p>
536
537 <ul>
538 <li>
539 <p>
540 <dfn>Fields</dfn>. A field symbol represents a packet header or
541 metadata field. For example, a field
542 named <code>vlan.tci</code> might represent the VLAN TCI field in a
543 packet.
544 </p>
545
546 <p>
547 A field symbol can have integer or string type. Integer fields can
548 be nominal or ordinal (see <em>Level of Measurement</em>,
549 below).
550 </p>
551 </li>
552
553 <li>
554 <p>
555 <dfn>Subfields</dfn>. A subfield represents a subset of bits from
556 a larger field. For example, a field <code>vlan.vid</code> might
557 be defined as an alias for <code>vlan.tci[0..11]</code>. Subfields
558 are provided for syntactic convenience, because it is always
559 possible to instead refer to a subset of bits from a field
560 directly.
561 </p>
562
563 <p>
564 Only ordinal fields (see <em>Level of Measurement</em>,
565 below) may have subfields. Subfields are always ordinal.
566 </p>
567 </li>
568
569 <li>
570 <p>
571 <dfn>Predicates</dfn>. A predicate is shorthand for a Boolean
572 expression. Predicates may be used much like 1-bit fields. For
573 example, <code>ip4</code> might expand to <code>eth.type ==
574 0x800</code>. Predicates are provided for syntactic convenience,
575 because it is always possible to instead specify the underlying
576 expression directly.
577 </p>
578
579 <p>
580 A predicate whose expansion refers to any nominal field or
581 predicate (see <em>Level of Measurement</em>, below) is nominal;
582 other predicates have Boolean level of measurement.
583 </p>
584 </li>
585 </ul>
586
587 <p>
588 <em>Level of Measurement</em>. See
589 http://en.wikipedia.org/wiki/Level_of_measurement for the statistical
590 concept on which this classification is based. There are three
591 levels:
592 </p>
593
594 <ul>
595 <li>
596 <p>
597 <dfn>Ordinal</dfn>. In statistics, ordinal values can be ordered
598 on a scale. OVN considers a field (or subfield) to be ordinal if
599 its bits can be examined individually. This is true for the
600 OpenFlow fields that OpenFlow or Open vSwitch makes ``maskable.''
601 </p>
602
603 <p>
604 Any use of a nominal field may specify a single bit or a range of
605 bits, e.g. <code>vlan.tci[13..15]</code> refers to the PCP field
606 within the VLAN TCI, and <code>eth.dst[40]</code> refers to the
607 multicast bit in the Ethernet destination address.
608 </p>
609
610 <p>
611 OVN supports all the usual arithmetic relations (<code>==</code>,
612 <code>!=</code>, <code>&lt;</code>, <code>&lt;=</code>,
613 <code>&gt;</code>, and <code>&gt;=</code>) on ordinal fields and
614 their subfields, because OVN can implement these in OpenFlow and
615 Open vSwitch as collections of bitwise tests.
616 </p>
617 </li>
618
619 <li>
620 <p>
621 <dfn>Nominal</dfn>. In statistics, nominal values cannot be
622 usefully compared except for equality. This is true of OpenFlow
623 port numbers, Ethernet types, and IP protocols are examples: all of
624 these are just identifiers assigned arbitrarily with no deeper
625 meaning. In OpenFlow and Open vSwitch, bits in these fields
626 generally aren't individually addressable.
627 </p>
628
629 <p>
630 OVN only supports arithmetic tests for equality on nominal fields,
631 because OpenFlow and Open vSwitch provide no way for a flow to
632 efficiently implement other comparisons on them. (A test for
633 inequality can be sort of built out of two flows with different
634 priorities, but OVN matching expressions always generate flows with
635 a single priority.)
636 </p>
637
638 <p>
639 String fields are always nominal.
640 </p>
641 </li>
642
643 <li>
644 <p>
645 <dfn>Boolean</dfn>. A nominal field that has only two values, 0
646 and 1, is somewhat exceptional, since it is easy to support both
647 equality and inequality tests on such a field: either one can be
648 implemented as a test for 0 or 1.
649 </p>
650
651 <p>
652 Only predicates (see above) have a Boolean level of measurement.
653 </p>
654
655 <p>
656 This isn't a standard level of measurement.
657 </p>
658 </li>
659 </ul>
660
661 <p>
662 <em>Prerequisites</em>. Any symbol can have prerequisites, which are
663 additional condition implied by the use of the symbol. For example,
664 For example, <code>icmp4.type</code> symbol might have prerequisite
665 <code>icmp4</code>, which would cause an expression <code>icmp4.type ==
666 0</code> to be interpreted as <code>icmp4.type == 0 &amp;&amp;
667 icmp4</code>, which would in turn expand to <code>icmp4.type == 0
668 &amp;&amp; eth.type == 0x800 &amp;&amp; ip4.proto == 1</code> (assuming
669 <code>icmp4</code> is a predicate defined as suggested under
670 <em>Types</em> above).
671 </p>
672
673 <p><em>Relational operators</em></p>
674
675 <p>
676 All of the standard relational operators <code>==</code>,
677 <code>!=</code>, <code>&lt;</code>, <code>&lt;=</code>,
678 <code>&gt;</code>, and <code>&gt;=</code> are supported. Nominal
679 fields support only <code>==</code> and <code>!=</code>, and only in a
680 positive sense when outer <code>!</code> are taken into account,
681 e.g. given string field <code>inport</code>, <code>inport ==
682 "eth0"</code> and <code>!(inport != "eth0")</code> are acceptable, but
683 not <code>inport != "eth0"</code>.
684 </p>
685
686 <p>
687 The implementation of <code>==</code> (or <code>!=</code> when it is
688 negated), is more efficient than that of the other relational
689 operators.
690 </p>
691
692 <p><em>Constants</em></p>
693
694 <p>
695 Integer constants may be expressed in decimal, hexadecimal prefixed by
696 <code>0x</code>, or as dotted-quad IPv4 addresses, IPv6 addresses in
697 their standard forms, or Ethernet addresses as colon-separated hex
698 digits. A constant in any of these forms may be followed by a slash
699 and a second constant (the mask) in the same form, to form a masked
700 constant. IPv4 and IPv6 masks may be given as integers, to express
701 CIDR prefixes.
702 </p>
703
704 <p>
705 String constants have the same syntax as quoted strings in JSON (thus,
706 they are Unicode strings).
707 </p>
708
709 <p>
710 Some operators support sets of constants written inside curly braces
711 <code>{</code> ... <code>}</code>. Commas between elements of a set,
712 and after the last elements, are optional. With <code>==</code>,
713 ``<code><var>field</var> == { <var>constant1</var>,
714 <var>constant2</var>,</code> ... <code>}</code>'' is syntactic sugar
715 for ``<code><var>field</var> == <var>constant1</var> ||
716 <var>field</var> == <var>constant2</var> || </code>...<code></code>.
717 Similarly, ``<code><var>field</var> != { <var>constant1</var>,
718 <var>constant2</var>, </code>...<code> }</code>'' is equivalent to
719 ``<code><var>field</var> != <var>constant1</var> &amp;&amp;
720 <var>field</var> != <var>constant2</var> &amp;&amp;
721 </code>...<code></code>''.
722 </p>
723
724 <p>
725 You may refer to a set of IPv4, IPv6, or MAC addresses stored in the
726 <ref table="Address_Set"/> table by its <ref column="name"
727 table="Address_Set"/>. An <ref table="Address_Set"/> with a name
728 of <code>set1</code> can be referred to as
729 <code>$set1</code>.
730 </p>
731
732 <p><em>Miscellaneous</em></p>
733
734 <p>
735 Comparisons may name the symbol or the constant first,
736 e.g. <code>tcp.src == 80</code> and <code>80 == tcp.src</code> are both
737 acceptable.
738 </p>
739
740 <p>
741 Tests for a range may be expressed using a syntax like <code>1024 &lt;=
742 tcp.src &lt;= 49151</code>, which is equivalent to <code>1024 &lt;=
743 tcp.src &amp;&amp; tcp.src &lt;= 49151</code>.
744 </p>
745
746 <p>
747 For a one-bit field or predicate, a mention of its name is equivalent
748 to <code><var>symobl</var> == 1</code>, e.g. <code>vlan.present</code>
749 is equivalent to <code>vlan.present == 1</code>. The same is true for
750 one-bit subfields, e.g. <code>vlan.tci[12]</code>. There is no
751 technical limitation to implementing the same for ordinal fields of all
752 widths, but the implementation is expensive enough that the syntax
753 parser requires writing an explicit comparison against zero to make
754 mistakes less likely, e.g. in <code>tcp.src != 0</code> the comparison
755 against 0 is required.
756 </p>
757
758 <p>
759 <em>Operator precedence</em> is as shown below, from highest to lowest.
760 There are two exceptions where parentheses are required even though the
761 table would suggest that they are not: <code>&amp;&amp;</code> and
762 <code>||</code> require parentheses when used together, and
763 <code>!</code> requires parentheses when applied to a relational
764 expression. Thus, in <code>(eth.type == 0x800 || eth.type == 0x86dd)
765 &amp;&amp; ip.proto == 6</code> or <code>!(arp.op == 1)</code>, the
766 parentheses are mandatory.
767 </p>
768
769 <ul>
770 <li><code>()</code></li>
771 <li><code>== != &lt; &lt;= &gt; &gt;=</code></li>
772 <li><code>!</code></li>
773 <li><code>&amp;&amp; ||</code></li>
774 </ul>
775
776 <p>
777 <em>Comments</em> may be introduced by <code>//</code>, which extends
778 to the next new-line. Comments within a line may be bracketed by
779 <code>/*</code> and <code>*/</code>. Multiline comments are not
780 supported.
781 </p>
782
783 <p><em>Symbols</em></p>
784
785 <p>
786 Most of the symbols below have integer type. Only <code>inport</code>
787 and <code>outport</code> have string type. <code>inport</code> names a
788 logical port. Thus, its value is a <ref column="logical_port"/> name
789 from the <ref table="Port_Binding"/> table. <code>outport</code> may
790 name a logical port, as <code>inport</code>, or a logical multicast
791 group defined in the <ref table="Multicast_Group"/> table. For both
792 symbols, only names within the flow's logical datapath may be used.
793 </p>
794
795 <p>
796 The <code>reg</code><var>X</var> symbols are 32-bit integers.
797 The <code>xxreg</code><var>X</var> symbols are 128-bit integers,
798 which overlay four of the 32-bit registers: <code>xxreg0</code>
799 overlays <code>reg0</code> through <code>reg3</code>, with
800 <code>reg0</code> supplying the most-significant bits of
801 <code>xxreg0</code> and <code>reg3</code> the least-signficant.
802 <code>xxreg1</code> similarly overlays <code>reg4</code> through
803 <code>reg7</code>.
804 </p>
805
806 <ul>
807 <li><code>reg0</code>...<code>reg9</code></li>
808 <li><code>xxreg0</code> <code>xxreg1</code></li>
809 <li><code>inport</code> <code>outport</code></li>
810 <li><code>flags.loopback</code></li>
811 <li><code>eth.src</code> <code>eth.dst</code> <code>eth.type</code></li>
812 <li><code>vlan.tci</code> <code>vlan.vid</code> <code>vlan.pcp</code> <code>vlan.present</code></li>
813 <li><code>ip.proto</code> <code>ip.dscp</code> <code>ip.ecn</code> <code>ip.ttl</code> <code>ip.frag</code></li>
814 <li><code>ip4.src</code> <code>ip4.dst</code></li>
815 <li><code>ip6.src</code> <code>ip6.dst</code> <code>ip6.label</code></li>
816 <li><code>arp.op</code> <code>arp.spa</code> <code>arp.tpa</code> <code>arp.sha</code> <code>arp.tha</code></li>
817 <li><code>tcp.src</code> <code>tcp.dst</code> <code>tcp.flags</code></li>
818 <li><code>udp.src</code> <code>udp.dst</code></li>
819 <li><code>sctp.src</code> <code>sctp.dst</code></li>
820 <li><code>icmp4.type</code> <code>icmp4.code</code></li>
821 <li><code>icmp6.type</code> <code>icmp6.code</code></li>
822 <li><code>nd.target</code> <code>nd.sll</code> <code>nd.tll</code></li>
823 <li><code>ct_mark</code> <code>ct_label</code></li>
824 <li>
825 <p>
826 <code>ct_state</code>, which has the following Boolean subfields:
827 </p>
828 <ul>
829 <li><code>ct.new</code>: True for a new flow</li>
830 <li><code>ct.est</code>: True for an established flow</li>
831 <li><code>ct.rel</code>: True for a related flow</li>
832 <li><code>ct.rpl</code>: True for a reply flow</li>
833 <li><code>ct.inv</code>: True for a connection entry in a bad state</li>
834 </ul>
835 <p>
836 <code>ct_state</code> and its subfields are initialized by the
837 <code>ct_next</code> action, described below.
838 </p>
839 </li>
840 </ul>
841
842 <p>
843 The following predicates are supported:
844 </p>
845
846 <ul>
847 <li><code>eth.bcast</code> expands to <code>eth.dst == ff:ff:ff:ff:ff:ff</code></li>
848 <li><code>eth.mcast</code> expands to <code>eth.dst[40]</code></li>
849 <li><code>vlan.present</code> expands to <code>vlan.tci[12]</code></li>
850 <li><code>ip4</code> expands to <code>eth.type == 0x800</code></li>
851 <li><code>ip4.mcast</code> expands to <code>ip4.dst[28..31] == 0xe</code></li>
852 <li><code>ip6</code> expands to <code>eth.type == 0x86dd</code></li>
853 <li><code>ip</code> expands to <code>ip4 || ip6</code></li>
854 <li><code>icmp4</code> expands to <code>ip4 &amp;&amp; ip.proto == 1</code></li>
855 <li><code>icmp6</code> expands to <code>ip6 &amp;&amp; ip.proto == 58</code></li>
856 <li><code>icmp</code> expands to <code>icmp4 || icmp6</code></li>
857 <li><code>ip.is_frag</code> expands to <code>ip.frag[0]</code></li>
858 <li><code>ip.later_frag</code> expands to <code>ip.frag[1]</code></li>
859 <li><code>ip.first_frag</code> expands to <code>ip.is_frag &amp;&amp; !ip.later_frag</code></li>
860 <li><code>arp</code> expands to <code>eth.type == 0x806</code></li>
861 <li><code>nd</code> expands to <code>icmp6.type == {135, 136} &amp;&amp; icmp6.code == 0 &amp;&amp; ip.ttl == 255</code></li>
862 <li><code>nd_ns</code> expands to <code>icmp6.type == 135 &amp;&amp; icmp6.code == 0 &amp;&amp; ip.ttl == 255</code></li>
863 <li><code>nd_na</code> expands to <code>icmp6.type == 136 &amp;&amp; icmp6.code == 0 &amp;&amp; ip.ttl == 255</code></li>
864 <li><code>tcp</code> expands to <code>ip.proto == 6</code></li>
865 <li><code>udp</code> expands to <code>ip.proto == 17</code></li>
866 <li><code>sctp</code> expands to <code>ip.proto == 132</code></li>
867 </ul>
868 </column>
869
870 <column name="actions">
871 <p>
872 Logical datapath actions, to be executed when the logical flow
873 represented by this row is the highest-priority match.
874 </p>
875
876 <p>
877 Actions share lexical syntax with the <ref column="match"/> column. An
878 empty set of actions (or one that contains just white space or
879 comments), or a set of actions that consists of just
880 <code>drop;</code>, causes the matched packets to be dropped.
881 Otherwise, the column should contain a sequence of actions, each
882 terminated by a semicolon.
883 </p>
884
885 <p>
886 The following actions are defined:
887 </p>
888
889 <dl>
890 <dt><code>output;</code></dt>
891 <dd>
892 <p>
893 In the ingress pipeline, this action executes the
894 <code>egress</code> pipeline as a subroutine. If
895 <code>outport</code> names a logical port, the egress pipeline
896 executes once; if it is a multicast group, the egress pipeline runs
897 once for each logical port in the group.
898 </p>
899
900 <p>
901 In the egress pipeline, this action performs the actual
902 output to the <code>outport</code> logical port. (In the egress
903 pipeline, <code>outport</code> never names a multicast group.)
904 </p>
905
906 <p>
907 By default, output to the input port is implicitly dropped,
908 that is, <code>output</code> becomes a no-op if
909 <code>outport</code> == <code>inport</code>. Occasionally
910 it may be useful to override this behavior, e.g. to send an
911 ARP reply to an ARP request; to do so, use
912 <code>flags.loopback = 1</code> to allow the packet to
913 "hair-pin" back to the input port.
914 </p>
915 </dd>
916
917 <dt><code>next;</code></dt>
918 <dt><code>next(<var>table</var>);</code></dt>
919 <dd>
920 Executes another logical datapath table as a subroutine. By default,
921 the table after the current one is executed. Specify
922 <var>table</var> to jump to a specific table in the same pipeline.
923 </dd>
924
925 <dt><code><var>field</var> = <var>constant</var>;</code></dt>
926 <dd>
927 <p>
928 Sets data or metadata field <var>field</var> to constant value
929 <var>constant</var>, e.g. <code>outport = "vif0";</code> to set the
930 logical output port. To set only a subset of bits in a field,
931 specify a subfield for <var>field</var> or a masked
932 <var>constant</var>, e.g. one may use <code>vlan.pcp[2] = 1;</code>
933 or <code>vlan.pcp = 4/4;</code> to set the most sigificant bit of
934 the VLAN PCP.
935 </p>
936
937 <p>
938 Assigning to a field with prerequisites implicitly adds those
939 prerequisites to <ref column="match"/>; thus, for example, a flow
940 that sets <code>tcp.dst</code> applies only to TCP flows,
941 regardless of whether its <ref column="match"/> mentions any TCP
942 field.
943 </p>
944
945 <p>
946 Not all fields are modifiable (e.g. <code>eth.type</code> and
947 <code>ip.proto</code> are read-only), and not all modifiable fields
948 may be partially modified (e.g. <code>ip.ttl</code> must assigned
949 as a whole). The <code>outport</code> field is modifiable in the
950 <code>ingress</code> pipeline but not in the <code>egress</code>
951 pipeline.
952 </p>
953 </dd>
954
955 <dt><code><var>field1</var> = <var>field2</var>;</code></dt>
956 <dd>
957 <p>
958 Sets data or metadata field <var>field1</var> to the value of data
959 or metadata field <var>field2</var>, e.g. <code>reg0 =
960 ip4.src;</code> copies <code>ip4.src</code> into <code>reg0</code>.
961 To modify only a subset of a field's bits, specify a subfield for
962 <var>field1</var> or <var>field2</var> or both, e.g. <code>vlan.pcp
963 = reg0[0..2];</code> copies the least-significant bits of
964 <code>reg0</code> into the VLAN PCP.
965 </p>
966
967 <p>
968 <var>field1</var> and <var>field2</var> must be the same type,
969 either both string or both integer fields. If they are both
970 integer fields, they must have the same width.
971 </p>
972
973 <p>
974 If <var>field1</var> or <var>field2</var> has prerequisites, they
975 are added implicitly to <ref column="match"/>. It is possible to
976 write an assignment with contradictory prerequisites, such as
977 <code>ip4.src = ip6.src[0..31];</code>, but the contradiction means
978 that a logical flow with such an assignment will never be matched.
979 </p>
980 </dd>
981
982 <dt><code><var>field1</var> &lt;-&gt; <var>field2</var>;</code></dt>
983 <dd>
984 <p>
985 Similar to <code><var>field1</var> = <var>field2</var>;</code>
986 except that the two values are exchanged instead of copied. Both
987 <var>field1</var> and <var>field2</var> must modifiable.
988 </p>
989 </dd>
990
991 <dt><code>ip.ttl--;</code></dt>
992 <dd>
993 <p>
994 Decrements the IPv4 or IPv6 TTL. If this would make the TTL zero
995 or negative, then processing of the packet halts; no further
996 actions are processed. (To properly handle such cases, a
997 higher-priority flow should match on
998 <code>ip.ttl == {0, 1};</code>.)
999 </p>
1000
1001 <p><b>Prerequisite:</b> <code>ip</code></p>
1002 </dd>
1003
1004 <dt><code>ct_next;</code></dt>
1005 <dd>
1006 <p>
1007 Apply connection tracking to the flow, initializing
1008 <code>ct_state</code> for matching in later tables.
1009 Automatically moves on to the next table, as if followed by
1010 <code>next</code>.
1011 </p>
1012
1013 <p>
1014 As a side effect, IP fragments will be reassembled for matching.
1015 If a fragmented packet is output, then it will be sent with any
1016 overlapping fragments squashed. The connection tracking state is
1017 scoped by the logical port, so overlapping addresses may be used.
1018 To allow traffic related to the matched flow, execute
1019 <code>ct_commit</code>.
1020 </p>
1021
1022 <p>
1023 It is possible to have actions follow <code>ct_next</code>,
1024 but they will not have access to any of its side-effects and
1025 is not generally useful.
1026 </p>
1027 </dd>
1028
1029 <dt><code>ct_commit;</code></dt>
1030 <dt><code>ct_commit(ct_mark=<var>value[/mask]</var>);</code></dt>
1031 <dt><code>ct_commit(ct_label=<var>value[/mask]</var>);</code></dt>
1032 <dt><code>ct_commit(ct_mark=<var>value[/mask]</var>, ct_label=<var>value[/mask]</var>);</code></dt>
1033 <dd>
1034 <p>
1035 Commit the flow to the connection tracking entry associated with it
1036 by a previous call to <code>ct_next</code>. When
1037 <code>ct_mark=<var>value[/mask]</var></code> and/or
1038 <code>ct_label=<var>value[/mask]</var></code> are supplied,
1039 <code>ct_mark</code> and/or <code>ct_label</code> will be set to the
1040 values indicated by <var>value[/mask]</var> on the connection
1041 tracking entry. <code>ct_mark</code> is a 32-bit field.
1042 <code>ct_label</code> is a 128-bit field. The <var>value[/mask]</var>
1043 should be specified in hex string if more than 64bits are to be used.
1044 </p>
1045
1046 <p>
1047 Note that if you want processing to continue in the next table,
1048 you must execute the <code>next</code> action after
1049 <code>ct_commit</code>. You may also leave out <code>next</code>
1050 which will commit connection tracking state, and then drop the
1051 packet. This could be useful for setting <code>ct_mark</code>
1052 on a connection tracking entry before dropping a packet,
1053 for example.
1054 </p>
1055 </dd>
1056
1057 <dt><code>ct_dnat;</code></dt>
1058 <dt><code>ct_dnat(<var>IP</var>);</code></dt>
1059 <dd>
1060 <p>
1061 <code>ct_dnat</code> sends the packet through the DNAT zone in
1062 connection tracking table to unDNAT any packet that was DNATed in
1063 the opposite direction. The packet is then automatically sent to
1064 to the next tables as if followed by <code>next;</code> action.
1065 The next tables will see the changes in the packet caused by
1066 the connection tracker.
1067 </p>
1068 <p>
1069 <code>ct_dnat(<var>IP</var>)</code> sends the packet through the
1070 DNAT zone to change the destination IP address of the packet to
1071 the one provided inside the parentheses and commits the connection.
1072 The packet is then automatically sent to the next tables as if
1073 followed by <code>next;</code> action. The next tables will see
1074 the changes in the packet caused by the connection tracker.
1075 </p>
1076 </dd>
1077
1078 <dt><code>ct_snat;</code></dt>
1079 <dt><code>ct_snat(<var>IP</var>);</code></dt>
1080 <dd>
1081 <p>
1082 <code>ct_snat</code> sends the packet through the SNAT zone to
1083 unSNAT any packet that was SNATed in the opposite direction. If
1084 the packet needs to be sent to the next tables, then it should be
1085 followed by a <code>next;</code> action. The next tables will not
1086 see the changes in the packet caused by the connection tracker.
1087 </p>
1088 <p>
1089 <code>ct_snat(<var>IP</var>)</code> sends the packet through the
1090 SNAT zone to change the source IP address of the packet to
1091 the one provided inside the parenthesis and commits the connection.
1092 The packet is then automatically sent to the next tables as if
1093 followed by <code>next;</code> action. The next tables will see the
1094 changes in the packet caused by the connection tracker.
1095 </p>
1096 </dd>
1097
1098 <dt><code>arp { <var>action</var>; </code>...<code> };</code></dt>
1099 <dd>
1100 <p>
1101 Temporarily replaces the IPv4 packet being processed by an ARP
1102 packet and executes each nested <var>action</var> on the ARP
1103 packet. Actions following the <var>arp</var> action, if any, apply
1104 to the original, unmodified packet.
1105 </p>
1106
1107 <p>
1108 The ARP packet that this action operates on is initialized based on
1109 the IPv4 packet being processed, as follows. These are default
1110 values that the nested actions will probably want to change:
1111 </p>
1112
1113 <ul>
1114 <li><code>eth.src</code> unchanged</li>
1115 <li><code>eth.dst</code> unchanged</li>
1116 <li><code>eth.type = 0x0806</code></li>
1117 <li><code>arp.op = 1</code> (ARP request)</li>
1118 <li><code>arp.sha</code> copied from <code>eth.src</code></li>
1119 <li><code>arp.spa</code> copied from <code>ip4.src</code></li>
1120 <li><code>arp.tha = 00:00:00:00:00:00</code></li>
1121 <li><code>arp.tpa</code> copied from <code>ip4.dst</code></li>
1122 </ul>
1123
1124 <p>
1125 The ARP packet has the same VLAN header, if any, as the IP packet
1126 it replaces.
1127 </p>
1128
1129 <p><b>Prerequisite:</b> <code>ip4</code></p>
1130 </dd>
1131
1132 <dt><code>get_arp(<var>P</var>, <var>A</var>);</code></dt>
1133
1134 <dd>
1135 <p>
1136 <b>Parameters</b>: logical port string field <var>P</var>, 32-bit
1137 IP address field <var>A</var>.
1138 </p>
1139
1140 <p>
1141 Looks up <var>A</var> in <var>P</var>'s mac binding table.
1142 If an entry is found, stores its Ethernet address in
1143 <code>eth.dst</code>, otherwise stores
1144 <code>00:00:00:00:00:00</code> in <code>eth.dst</code>.
1145 </p>
1146
1147 <p><b>Example:</b> <code>get_arp(outport, ip4.dst);</code></p>
1148 </dd>
1149
1150 <dt>
1151 <code>put_arp(<var>P</var>, <var>A</var>, <var>E</var>);</code>
1152 </dt>
1153
1154 <dd>
1155 <p>
1156 <b>Parameters</b>: logical port string field <var>P</var>, 32-bit
1157 IP address field <var>A</var>, 48-bit Ethernet address field
1158 <var>E</var>.
1159 </p>
1160
1161 <p>
1162 Adds or updates the entry for IP address <var>A</var> in
1163 logical port <var>P</var>'s mac binding table, setting its
1164 Ethernet address to <var>E</var>.
1165 </p>
1166
1167 <p><b>Example:</b> <code>put_arp(inport, arp.spa, arp.sha);</code></p>
1168 </dd>
1169
1170 <dt>
1171 <code>nd_na { <var>action</var>; </code>...<code> };</code>
1172 </dt>
1173
1174 <dd>
1175 <p>
1176 Temporarily replaces the IPv6 neighbor solicitation packet
1177 being processed by an IPv6 neighbor advertisement (NA)
1178 packet and executes each nested <var>action</var> on the NA
1179 packet. Actions following the <code>nd_na</code> action,
1180 if any, apply to the original, unmodified packet.
1181 </p>
1182
1183 <p>
1184 The NA packet that this action operates on is initialized based on
1185 the IPv6 packet being processed, as follows. These are default
1186 values that the nested actions will probably want to change:
1187 </p>
1188
1189 <ul>
1190 <li><code>eth.dst</code> exchanged with <code>eth.src</code></li>
1191 <li><code>eth.type = 0x86dd</code></li>
1192 <li><code>ip6.dst</code> copied from <code>ip6.src</code></li>
1193 <li><code>ip6.src</code> copied from <code>nd.target</code></li>
1194 <li><code>icmp6.type = 136</code> (Neighbor Advertisement)</li>
1195 <li><code>nd.target</code> unchanged</li>
1196 <li><code>nd.sll = 00:00:00:00:00:00</code></li>
1197 <li><code>nd.tll</code> copied from <code>eth.dst</code></li>
1198 </ul>
1199
1200 <p>
1201 The ND packet has the same VLAN header, if any, as the IPv6 packet
1202 it replaces.
1203 </p>
1204
1205 <p>
1206 <b>Prerequisite:</b> <code>nd_ns</code>
1207 </p>
1208 </dd>
1209
1210 <dt><code>get_nd(<var>P</var>, <var>A</var>);</code></dt>
1211
1212 <dd>
1213 <p>
1214 <b>Parameters</b>: logical port string field <var>P</var>, 128-bit
1215 IPv6 address field <var>A</var>.
1216 </p>
1217
1218 <p>
1219 Looks up <var>A</var> in <var>P</var>'s mac binding table.
1220 If an entry is found, stores its Ethernet address in
1221 <code>eth.dst</code>, otherwise stores
1222 <code>00:00:00:00:00:00</code> in <code>eth.dst</code>.
1223 </p>
1224
1225 <p><b>Example:</b> <code>get_nd(outport, ip6.dst);</code></p>
1226 </dd>
1227
1228 <dt>
1229 <code>put_nd(<var>P</var>, <var>A</var>, <var>E</var>);</code>
1230 </dt>
1231
1232 <dd>
1233 <p>
1234 <b>Parameters</b>: logical port string field <var>P</var>,
1235 128-bit IPv6 address field <var>A</var>, 48-bit Ethernet
1236 address field <var>E</var>.
1237 </p>
1238
1239 <p>
1240 Adds or updates the entry for IPv6 address <var>A</var> in
1241 logical port <var>P</var>'s mac binding table, setting its
1242 Ethernet address to <var>E</var>.
1243 </p>
1244
1245 <p><b>Example:</b> <code>put_nd(inport, nd.target, nd.tll);</code></p>
1246 </dd>
1247
1248 <dt>
1249 <code><var>R</var> = put_dhcp_opts(<code>offerip</code> = <var>IP</var>, <var>D1</var> = <var>V1</var>, <var>D2</var> = <var>V2</var>, ..., <var>Dn</var> = <var>Vn</var>);</code>
1250 </dt>
1251
1252 <dd>
1253 <p>
1254 <b>Parameters</b>: one or more DHCP option/value pairs, the first
1255 of which must set a value for the offered IP, <code>offerip</code>.
1256 </p>
1257
1258 <p>
1259 <b>Result</b>: stored to a 1-bit subfield <var>R</var>.
1260 </p>
1261
1262 <p>
1263 Valid only in the ingress pipeline.
1264 </p>
1265
1266 <p>
1267 When this action is applied to a DHCP request packet (DHCPDISCOVER
1268 or DHCPREQUEST), it changes the packet into a DHCP reply (DHCPOFFER
1269 or DHCPACK, respectively), replaces the options by those specified
1270 as parameters, and stores 1 in <var>R</var>.
1271 </p>
1272
1273 <p>
1274 When this action is applied to a non-DHCP packet or a DHCP packet
1275 that is not DHCPDISCOVER or DHCPREQUEST, it leaves the packet
1276 unchanged and stores 0 in <var>R</var>.
1277 </p>
1278
1279 <p>
1280 The contents of the <ref table="DHCP_Option"/> table control the
1281 DHCP option names and values that this action supports.
1282 </p>
1283
1284 <p>
1285 <b>Example:</b>
1286 <code>
1287 reg0[0] = put_dhcp_opts(offerip = 10.0.0.2, router = 10.0.0.1,
1288 netmask = 255.255.255.0, dns_server = {8.8.8.8, 7.7.7.7});
1289 </code>
1290 </p>
1291 </dd>
1292
1293 <dt><code>ct_lb;</code></dt>
1294 <dt><code>ct_lb(</code><var>ip</var>[<code>:</code><var>port</var>]...<code>);</code></dt>
1295 <dd>
1296 <p>
1297 With one or more arguments, <code>ct_lb</code> commits the packet
1298 to the connection tracking table and DNATs the packet's destination
1299 IP address (and port) to the IP address or addresses (and optional
1300 ports) specified in the string. If multiple comma-separated IP
1301 addresses are specified, each is given equal weight for picking the
1302 DNAT address. Processing automatically moves on to the next table,
1303 as if <code>next;</code> were specified, and later tables act on
1304 the packet as modified by the connection tracker. Connection
1305 tracking state is scoped by the logical port, so overlapping
1306 addresses may be used.
1307 </p>
1308 <p>
1309 Without arguments, <code>ct_lb</code> sends the packet to the
1310 connection tracking table to NAT the packets. If the packet is
1311 part of an established connection that was previously committed to
1312 the connection tracker via <code>ct_lb(</code>...<code>)</code>, it
1313 will automatically get DNATed to the same IP address as the first
1314 packet in that connection.
1315 </p>
1316 </dd>
1317 </dl>
1318
1319 <p>
1320 The following actions will likely be useful later, but they have not
1321 been thought out carefully.
1322 </p>
1323
1324 <dl>
1325 <dt><code>icmp4 { <var>action</var>; </code>...<code> };</code></dt>
1326 <dd>
1327 <p>
1328 Temporarily replaces the IPv4 packet being processed by an ICMPv4
1329 packet and executes each nested <var>action</var> on the ICMPv4
1330 packet. Actions following the <var>icmp4</var> action, if any,
1331 apply to the original, unmodified packet.
1332 </p>
1333
1334 <p>
1335 The ICMPv4 packet that this action operates on is initialized based
1336 on the IPv4 packet being processed, as follows. These are default
1337 values that the nested actions will probably want to change.
1338 Ethernet and IPv4 fields not listed here are not changed:
1339 </p>
1340
1341 <ul>
1342 <li><code>ip.proto = 1</code> (ICMPv4)</li>
1343 <li><code>ip.frag = 0</code> (not a fragment)</li>
1344 <li><code>icmp4.type = 3</code> (destination unreachable)</li>
1345 <li><code>icmp4.code = 1</code> (host unreachable)</li>
1346 </ul>
1347
1348 <p>
1349 Details TBD.
1350 </p>
1351
1352 <p><b>Prerequisite:</b> <code>ip4</code></p>
1353 </dd>
1354
1355 <dt><code>tcp_reset;</code></dt>
1356 <dd>
1357 <p>
1358 This action transforms the current TCP packet according to the
1359 following pseudocode:
1360 </p>
1361
1362 <pre>
1363 if (tcp.ack) {
1364 tcp.seq = tcp.ack;
1365 } else {
1366 tcp.ack = tcp.seq + length(tcp.payload);
1367 tcp.seq = 0;
1368 }
1369 tcp.flags = RST;
1370 </pre>
1371
1372 <p>
1373 Then, the action drops all TCP options and payload data, and
1374 updates the TCP checksum.
1375 </p>
1376
1377 <p>
1378 Details TBD.
1379 </p>
1380
1381 <p><b>Prerequisite:</b> <code>tcp</code></p>
1382 </dd>
1383 </dl>
1384 </column>
1385
1386 <column name="external_ids" key="stage-name">
1387 Human-readable name for this flow's stage in the pipeline.
1388 </column>
1389
1390 <group title="Common Columns">
1391 The overall purpose of these columns is described under <code>Common
1392 Columns</code> at the beginning of this document.
1393
1394 <column name="external_ids"/>
1395 </group>
1396 </table>
1397
1398 <table name="Multicast_Group" title="Logical Port Multicast Groups">
1399 <p>
1400 The rows in this table define multicast groups of logical ports.
1401 Multicast groups allow a single packet transmitted over a tunnel to a
1402 hypervisor to be delivered to multiple VMs on that hypervisor, which
1403 uses bandwidth more efficiently.
1404 </p>
1405
1406 <p>
1407 Each row in this table defines a logical multicast group numbered <ref
1408 column="tunnel_key"/> within <ref column="datapath"/>, whose logical
1409 ports are listed in the <ref column="ports"/> column.
1410 </p>
1411
1412 <column name="datapath">
1413 The logical datapath in which the multicast group resides.
1414 </column>
1415
1416 <column name="tunnel_key">
1417 The value used to designate this logical egress port in tunnel
1418 encapsulations. An index forces the key to be unique within the <ref
1419 column="datapath"/>. The unusual range ensures that multicast group IDs
1420 do not overlap with logical port IDs.
1421 </column>
1422
1423 <column name="name">
1424 <p>
1425 The logical multicast group's name. An index forces the name to be
1426 unique within the <ref column="datapath"/>. Logical flows in the
1427 ingress pipeline may output to the group just as for individual logical
1428 ports, by assigning the group's name to <code>outport</code> and
1429 executing an <code>output</code> action.
1430 </p>
1431
1432 <p>
1433 Multicast group names and logical port names share a single namespace
1434 and thus should not overlap (but the database schema cannot enforce
1435 this). To try to avoid conflicts, <code>ovn-northd</code> uses names
1436 that begin with <code>_MC_</code>.
1437 </p>
1438 </column>
1439
1440 <column name="ports">
1441 The logical ports included in the multicast group. All of these ports
1442 must be in the <ref column="datapath"/> logical datapath (but the
1443 database schema cannot enforce this).
1444 </column>
1445 </table>
1446
1447 <table name="Datapath_Binding" title="Physical-Logical Datapath Bindings">
1448 <p>
1449 Each row in this table identifies physical bindings of a logical
1450 datapath. A logical datapath implements a logical pipeline among the
1451 ports in the <ref table="Port_Binding"/> table associated with it. In
1452 practice, the pipeline in a given logical datapath implements either a
1453 logical switch or a logical router.
1454 </p>
1455
1456 <column name="tunnel_key">
1457 The tunnel key value to which the logical datapath is bound.
1458 The <code>Tunnel Encapsulation</code> section in
1459 <code>ovn-architecture</code>(7) describes how tunnel keys are
1460 constructed for each supported encapsulation.
1461 </column>
1462
1463 <group title="OVN_Northbound Relationship">
1464 <p>
1465 Each row in <ref table="Datapath_Binding"/> is associated with some
1466 logical datapath. <code>ovn-northd</code> uses these keys to track the
1467 association of a logical datapath with concepts in the <ref
1468 db="OVN_Northbound"/> database.
1469 </p>
1470
1471 <column name="external_ids" key="logical-switch" type='{"type": "uuid"}'>
1472 For a logical datapath that represents a logical switch,
1473 <code>ovn-northd</code> stores in this key the UUID of the
1474 corresponding <ref table="Logical_Switch" db="OVN_Northbound"/> row in
1475 the <ref db="OVN_Northbound"/> database.
1476 </column>
1477
1478 <column name="external_ids" key="logical-router" type='{"type": "uuid"}'>
1479 For a logical datapath that represents a logical router,
1480 <code>ovn-northd</code> stores in this key the UUID of the
1481 corresponding <ref table="Logical_Router" db="OVN_Northbound"/> row in
1482 the <ref db="OVN_Northbound"/> database.
1483 </column>
1484 </group>
1485
1486 <group title="Common Columns">
1487 The overall purpose of these columns is described under <code>Common
1488 Columns</code> at the beginning of this document.
1489
1490 <column name="external_ids"/>
1491 </group>
1492 </table>
1493
1494 <table name="Port_Binding" title="Physical-Logical Port Bindings">
1495 <p>
1496 Most rows in this table identify the physical location of a logical port.
1497 (The exceptions are logical patch ports, which do not have any physical
1498 location.)
1499 </p>
1500
1501 <p>
1502 For every <code>Logical_Switch_Port</code> record in
1503 <code>OVN_Northbound</code> database, <code>ovn-northd</code>
1504 creates a record in this table. <code>ovn-northd</code> populates
1505 and maintains every column except the <code>chassis</code> column,
1506 which it leaves empty in new records.
1507 </p>
1508
1509 <p>
1510 <code>ovn-controller</code>/<code>ovn-controller-vtep</code>
1511 populates the <code>chassis</code> column for the records that
1512 identify the logical ports that are located on its hypervisor/gateway,
1513 which <code>ovn-controller</code>/<code>ovn-controller-vtep</code> in
1514 turn finds out by monitoring the local hypervisor's Open_vSwitch
1515 database, which identifies logical ports via the conventions described
1516 in <code>IntegrationGuide.md</code>. (The exceptions are for
1517 <code>Port_Binding</code> records with <code>type</code> of
1518 <code>l3gateway</code>, whose locations are identified by
1519 <code>ovn-northd</code> via the <code>options:l3gateway-chassis</code>
1520 column in this table. <code>ovn-controller</code> is still responsible
1521 to populate the <code>chassis</code> column.)
1522 </p>
1523
1524 <p>
1525 When a chassis shuts down gracefully, it should clean up the
1526 <code>chassis</code> column that it previously had populated.
1527 (This is not critical because resources hosted on the chassis are equally
1528 unreachable regardless of whether their rows are present.) To handle the
1529 case where a VM is shut down abruptly on one chassis, then brought up
1530 again on a different one,
1531 <code>ovn-controller</code>/<code>ovn-controller-vtep</code> must
1532 overwrite the <code>chassis</code> column with new information.
1533 </p>
1534
1535 <group title="Core Features">
1536 <column name="datapath">
1537 The logical datapath to which the logical port belongs.
1538 </column>
1539
1540 <column name="logical_port">
1541 A logical port, taken from <ref table="Logical_Switch_Port"
1542 column="name" db="OVN_Northbound"/> in the OVN_Northbound
1543 database's <ref table="Logical_Switch_Port" db="OVN_Northbound"/>
1544 table. OVN does not prescribe a particular format for the
1545 logical port ID.
1546 </column>
1547
1548 <column name="chassis">
1549 The meaning of this column depends on the value of the <ref column="type"/>
1550 column. This is the meaning for each <ref column="type"/>
1551
1552 <dl>
1553 <dt>(empty string)</dt>
1554 <dd>
1555 The physical location of the logical port. To successfully identify a
1556 chassis, this column must be a <ref table="Chassis"/> record. This is
1557 populated by <code>ovn-controller</code>.
1558 </dd>
1559
1560 <dt>vtep</dt>
1561 <dd>
1562 The physical location of the hardware_vtep gateway. To successfully
1563 identify a chassis, this column must be a <ref table="Chassis"/> record.
1564 This is populated by <code>ovn-controller-vtep</code>.
1565 </dd>
1566
1567 <dt>localnet</dt>
1568 <dd>
1569 Always empty. A localnet port is realized on every chassis that has
1570 connectivity to the corresponding physical network.
1571 </dd>
1572
1573 <dt>l3gateway</dt>
1574 <dd>
1575 The physical location of the L3 gateway. To successfully identify a
1576 chassis, this column must be a <ref table="Chassis"/> record. This is
1577 populated by <code>ovn-controller</code> based on the value of
1578 the <code>options:l3gateway-chassis</code> column in this table.
1579 </dd>
1580
1581 <dt>l2gateway</dt>
1582 <dd>
1583 The physical location of this L2 gateway. To successfully identify a
1584 chassis, this column must be a <ref table="Chassis"/> record.
1585 This is populated by <code>ovn-controller</code> based on the value
1586 of the <code>options:l2gateway-chassis</code> column in this table.
1587 </dd>
1588 </dl>
1589
1590 </column>
1591
1592 <column name="tunnel_key">
1593 <p>
1594 A number that represents the logical port in the key (e.g. STT key or
1595 Geneve TLV) field carried within tunnel protocol packets.
1596 </p>
1597
1598 <p>
1599 The tunnel ID must be unique within the scope of a logical datapath.
1600 </p>
1601 </column>
1602
1603 <column name="mac">
1604 <p>
1605 The Ethernet address or addresses used as a source address on the
1606 logical port, each in the form
1607 <var>xx</var>:<var>xx</var>:<var>xx</var>:<var>xx</var>:<var>xx</var>:<var>xx</var>.
1608 The string <code>unknown</code> is also allowed to indicate that the
1609 logical port has an unknown set of (additional) source addresses.
1610 </p>
1611
1612 <p>
1613 A VM interface would ordinarily have a single Ethernet address. A
1614 gateway port might initially only have <code>unknown</code>, and then
1615 add MAC addresses to the set as it learns new source addresses.
1616 </p>
1617 </column>
1618
1619 <column name="type">
1620 <p>
1621 A type for this logical port. Logical ports can be used to model other
1622 types of connectivity into an OVN logical switch. The following types
1623 are defined:
1624 </p>
1625
1626 <dl>
1627 <dt>(empty string)</dt>
1628 <dd>VM (or VIF) interface.</dd>
1629
1630 <dt><code>patch</code></dt>
1631 <dd>
1632 One of a pair of logical ports that act as if connected by a patch
1633 cable. Useful for connecting two logical datapaths, e.g. to connect
1634 a logical router to a logical switch or to another logical router.
1635 </dd>
1636
1637 <dt><code>l3gateway</code></dt>
1638 <dd>
1639 One of a pair of logical ports that act as if connected by a patch
1640 cable across multiple chassis. Useful for connecting a logical
1641 switch with a Gateway router (which is only resident on a
1642 particular chassis).
1643 </dd>
1644
1645 <dt><code>localnet</code></dt>
1646 <dd>
1647 A connection to a locally accessible network from each
1648 <code>ovn-controller</code> instance. A logical switch can only
1649 have a single <code>localnet</code> port attached. This is used
1650 to model direct connectivity to an existing network.
1651 </dd>
1652
1653 <dt><code>l2gateway</code></dt>
1654 <dd>
1655 An L2 connection to a physical network. The chassis this
1656 <ref table="Port_Binding"/> is bound to will serve as
1657 an L2 gateway to the network named by
1658 <ref column="options" table="Port_Binding"/>:<code>network_name</code>.
1659 </dd>
1660
1661 <dt><code>vtep</code></dt>
1662 <dd>
1663 A port to a logical switch on a VTEP gateway chassis. In order to
1664 get this port correctly recognized by the OVN controller, the <ref
1665 column="options"
1666 table="Port_Binding"/>:<code>vtep-physical-switch</code> and <ref
1667 column="options"
1668 table="Port_Binding"/>:<code>vtep-logical-switch</code> must also
1669 be defined.
1670 </dd>
1671 </dl>
1672 </column>
1673 </group>
1674
1675 <group title="Patch Options">
1676 <p>
1677 These options apply to logical ports with <ref column="type"/> of
1678 <code>patch</code>.
1679 </p>
1680
1681 <column name="options" key="peer">
1682 The <ref column="logical_port"/> in the <ref table="Port_Binding"/>
1683 record for the other side of the patch. The named <ref
1684 column="logical_port"/> must specify this <ref column="logical_port"/>
1685 in its own <code>peer</code> option. That is, the two patch logical
1686 ports must have reversed <ref column="logical_port"/> and
1687 <code>peer</code> values.
1688 </column>
1689 </group>
1690
1691 <group title="L3 Gateway Options">
1692 <p>
1693 These options apply to logical ports with <ref column="type"/> of
1694 <code>l3gateway</code>.
1695 </p>
1696
1697 <column name="options" key="peer">
1698 The <ref column="logical_port"/> in the <ref table="Port_Binding"/>
1699 record for the other side of the 'l3gateway' port. The named <ref
1700 column="logical_port"/> must specify this <ref column="logical_port"/>
1701 in its own <code>peer</code> option. That is, the two 'l3gateway'
1702 logical ports must have reversed <ref column="logical_port"/> and
1703 <code>peer</code> values.
1704 </column>
1705
1706 <column name="options" key="l3gateway-chassis">
1707 The <code>chassis</code> in which the port resides.
1708 </column>
1709 </group>
1710
1711 <group title="Localnet Options">
1712 <p>
1713 These options apply to logical ports with <ref column="type"/> of
1714 <code>localnet</code>.
1715 </p>
1716
1717 <column name="options" key="network_name">
1718 Required. <code>ovn-controller</code> uses the configuration entry
1719 <code>ovn-bridge-mappings</code> to determine how to connect to this
1720 network. <code>ovn-bridge-mappings</code> is a list of network names
1721 mapped to a local OVS bridge that provides access to that network. An
1722 example of configuring <code>ovn-bridge-mappings</code> would be:
1723
1724 <pre>$ ovs-vsctl set open . external-ids:ovn-bridge-mappings=physnet1:br-eth0,physnet2:br-eth1</pre>
1725
1726 <p>
1727 When a logical switch has a <code>localnet</code> port attached,
1728 every chassis that may have a local vif attached to that logical
1729 switch must have a bridge mapping configured to reach that
1730 <code>localnet</code>. Traffic that arrives on a
1731 <code>localnet</code> port is never forwarded over a tunnel to
1732 another chassis.
1733 </p>
1734 </column>
1735
1736 <column name="tag">
1737 If set, indicates that the port represents a connection to a specific
1738 VLAN on a locally accessible network. The VLAN ID is used to match
1739 incoming traffic and is also added to outgoing traffic.
1740 </column>
1741 </group>
1742
1743 <group title="L2 Gateway Options">
1744 <p>
1745 These options apply to logical ports with <ref column="type"/> of
1746 <code>l2gateway</code>.
1747 </p>
1748
1749 <column name="options" key="network_name">
1750 Required. <code>ovn-controller</code> uses the configuration entry
1751 <code>ovn-bridge-mappings</code> to determine how to connect to this
1752 network. <code>ovn-bridge-mappings</code> is a list of network names
1753 mapped to a local OVS bridge that provides access to that network. An
1754 example of configuring <code>ovn-bridge-mappings</code> would be:
1755
1756 <pre>$ ovs-vsctl set open . external-ids:ovn-bridge-mappings=physnet1:br-eth0,physnet2:br-eth1</pre>
1757
1758 <p>
1759 When a logical switch has a <code>l2gateway</code> port attached,
1760 the chassis that the <code>l2gateway</code> port is bound to
1761 must have a bridge mapping configured to reach the network
1762 identified by <code>network_name</code>.
1763 </p>
1764 </column>
1765
1766 <column name="options" key="l2gateway-chassis">
1767 Required. The <code>chassis</code> in which the port resides.
1768 </column>
1769
1770 <column name="tag">
1771 If set, indicates that the gateway is connected to a specific
1772 VLAN on the physical network. The VLAN ID is used to match
1773 incoming traffic and is also added to outgoing traffic.
1774 </column>
1775 </group>
1776
1777 <group title="VTEP Options">
1778 <p>
1779 These options apply to logical ports with <ref column="type"/> of
1780 <code>vtep</code>.
1781 </p>
1782
1783 <column name="options" key="vtep-physical-switch">
1784 Required. The name of the VTEP gateway.
1785 </column>
1786
1787 <column name="options" key="vtep-logical-switch">
1788 Required. A logical switch name connected by the VTEP gateway. Must
1789 be set when <ref column="type"/> is <code>vtep</code>.
1790 </column>
1791 </group>
1792
1793 <group title="VMI (or VIF) Options">
1794 <p>
1795 These options apply to logical ports with <ref column="type"/> having
1796 (empty string)
1797 </p>
1798
1799 <column name="options" key="policing_rate">
1800 If set, indicates the maximum rate for data sent from this interface,
1801 in kbps. Data exceeding this rate is dropped.
1802 </column>
1803
1804 <column name="options" key="policing_burst">
1805 If set, indicates the maximum burst size for data sent from this
1806 interface, in kb.
1807 </column>
1808 </group>
1809
1810 <group title="Nested Containers">
1811 <p>
1812 These columns support containers nested within a VM. Specifically,
1813 they are used when <ref column="type"/> is empty and <ref
1814 column="logical_port"/> identifies the interface of a container spawned
1815 inside a VM. They are empty for containers or VMs that run directly on
1816 a hypervisor.
1817 </p>
1818
1819 <column name="parent_port">
1820 This is taken from
1821 <ref table="Logical_Switch_Port" column="parent_name"
1822 db="OVN_Northbound"/> in the OVN_Northbound database's
1823 <ref table="Logical_Switch_Port" db="OVN_Northbound"/> table.
1824 </column>
1825
1826 <column name="tag">
1827 <p>
1828 Identifies the VLAN tag in the network traffic associated with that
1829 container's network interface.
1830 </p>
1831
1832 <p>
1833 This column is used for a different purpose when <ref column="type"/>
1834 is <code>localnet</code> (see <code>Localnet Options</code>, above)
1835 or <code>l2gateway</code> (see <code>L2 Gateway Options</code>, above).
1836 </p>
1837 </column>
1838 </group>
1839 </table>
1840
1841 <table name="MAC_Binding" title="IP to MAC bindings">
1842 <p>
1843 Each row in this table specifies a binding from an IP address to an
1844 Ethernet address that has been discovered through ARP (for IPv4) or
1845 neighbor discovery (for IPv6). This table is primarily used to discover
1846 bindings on physical networks, because IP-to-MAC bindings for virtual
1847 machines are usually populated statically into the <ref
1848 table="Port_Binding"/> table.
1849 </p>
1850
1851 <p>
1852 This table expresses a functional relationship: <ref
1853 table="MAC_Binding"/>(<ref column="logical_port"/>, <ref column="ip"/>) =
1854 <ref column="mac"/>.
1855 </p>
1856
1857 <p>
1858 In outline, the lifetime of a logical router's MAC binding looks like
1859 this:
1860 </p>
1861
1862 <ol>
1863 <li>
1864 On hypervisor 1, a logical router determines that a packet should be
1865 forwarded to IP address <var>A</var> on one of its router ports. It
1866 uses its logical flow table to determine that <var>A</var> lacks a
1867 static IP-to-MAC binding and the <code>get_arp</code> action to
1868 determine that it lacks a dynamic IP-to-MAC binding.
1869 </li>
1870
1871 <li>
1872 Using an OVN logical <code>arp</code> action, the logical router
1873 generates and sends a broadcast ARP request to the router port. It
1874 drops the IP packet.
1875 </li>
1876
1877 <li>
1878 The logical switch attached to the router port delivers the ARP request
1879 to all of its ports. (It might make sense to deliver it only to ports
1880 that have no static IP-to-MAC bindings, but this could also be
1881 surprising behavior.)
1882 </li>
1883
1884 <li>
1885 A host or VM on hypervisor 2 (which might be the same as hypervisor 1)
1886 attached to the logical switch owns the IP address in question. It
1887 composes an ARP reply and unicasts it to the logical router port's
1888 Ethernet address.
1889 </li>
1890
1891 <li>
1892 The logical switch delivers the ARP reply to the logical router port.
1893 </li>
1894
1895 <li>
1896 The logical router flow table executes a <code>put_arp</code> action.
1897 To record the IP-to-MAC binding, <code>ovn-controller</code> adds a row
1898 to the <ref table="MAC_Binding"/> table.
1899 </li>
1900
1901 <li>
1902 On hypervisor 1, <code>ovn-controller</code> receives the updated <ref
1903 table="MAC_Binding"/> table from the OVN southbound database. The next
1904 packet destined to <var>A</var> through the logical router is sent
1905 directly to the bound Ethernet address.
1906 </li>
1907 </ol>
1908
1909 <column name="logical_port">
1910 The logical port on which the binding was discovered.
1911 </column>
1912
1913 <column name="ip">
1914 The bound IP address.
1915 </column>
1916
1917 <column name="mac">
1918 The Ethernet address to which the IP is bound.
1919 </column>
1920 <column name="datapath">
1921 The logical datapath to which the logical port belongs.
1922 </column>
1923 </table>
1924
1925 <table name="DHCP_Options" title="DHCP Options supported by native OVN DHCP">
1926 <p>
1927 Each row in this table stores the DHCP Options supported by native OVN
1928 DHCP. <code>ovn-northd</code> populates this table with the supported
1929 DHCP options. <code>ovn-controller</code> looks up this table to get the
1930 DHCP codes of the DHCP options defined in the "put_dhcp_opts" action.
1931 Please refer to the RFC 2132 <code>"https://tools.ietf.org/html/rfc2132"</code>
1932 for the possible list of DHCP options that can be defined here.
1933 </p>
1934
1935 <column name="name">
1936 <p>
1937 Name of the DHCP option.
1938 </p>
1939
1940 <p>
1941 Example. name="router"
1942 </p>
1943 </column>
1944
1945 <column name="code">
1946 <p>
1947 DHCP option code for the DHCP option as defined in the RFC 2132.
1948 </p>
1949
1950 <p>
1951 Example. code=3
1952 </p>
1953 </column>
1954
1955 <column name="type">
1956 <p>
1957 Data type of the DHCP option code.
1958 </p>
1959
1960 <dl>
1961 <dt><code>value: bool</code></dt>
1962 <dd>
1963 <p>
1964 This indicates that the value of the DHCP option is a bool.
1965 </p>
1966
1967 <p>
1968 Example. "name=ip_forward_enable", "code=19", "type=bool".
1969 </p>
1970
1971 <p>
1972 put_dhcp_opts(..., ip_forward_enable = 1,...)
1973 </p>
1974 </dd>
1975
1976 <dt><code>value: uint8</code></dt>
1977 <dd>
1978 <p>
1979 This indicates that the value of the DHCP option is an unsigned
1980 int8 (8 bits)
1981 </p>
1982
1983 <p>
1984 Example. "name=default_ttl", "code=23", "type=uint8".
1985 </p>
1986
1987 <p>
1988 put_dhcp_opts(..., default_ttl = 50,...)
1989 </p>
1990 </dd>
1991
1992 <dt><code>value: uint16</code></dt>
1993 <dd>
1994 <p>
1995 This indicates that the value of the DHCP option is an unsigned
1996 int16 (16 bits).
1997 </p>
1998
1999 <p>
2000 Example. "name=mtu", "code=26", "type=uint16".
2001 </p>
2002
2003 <p>
2004 put_dhcp_opts(..., mtu = 1450,...)
2005 </p>
2006 </dd>
2007
2008 <dt><code>value: uint32</code></dt>
2009 <dd>
2010 <p>
2011 This indicates that the value of the DHCP option is an unsigned
2012 int32 (32 bits).
2013 </p>
2014
2015 <p>
2016 Example. "name=lease_time", "code=51", "type=uint32".
2017 </p>
2018
2019 <p>
2020 put_dhcp_opts(..., lease_time = 86400,...)
2021 </p>
2022 </dd>
2023
2024 <dt><code>value: ipv4</code></dt>
2025 <dd>
2026 <p>
2027 This indicates that the value of the DHCP option is an IPv4
2028 address or addresses.
2029 </p>
2030
2031 <p>
2032 Example. "name=router", "code=3", "type=ipv4".
2033 </p>
2034
2035 <p>
2036 put_dhcp_opts(..., router = 10.0.0.1,...)
2037 </p>
2038
2039 <p>
2040 Example. "name=dns_server", "code=6", "type=ipv4".
2041 </p>
2042
2043 <p>
2044 put_dhcp_opts(..., dns_server = {8.8.8.8 7.7.7.7},...)
2045 </p>
2046 </dd>
2047
2048 <dt><code>value: static_routes</code></dt>
2049 <dd>
2050 <p>
2051 This indicates that the value of the DHCP option contains a pair of
2052 IPv4 route and next hop addresses.
2053 </p>
2054
2055 <p>
2056 Example. "name=classless_static_route", "code=121", "type=static_routes".
2057 </p>
2058
2059 <p>
2060 put_dhcp_opts(..., classless_static_route = {30.0.0.0/24,10.0.0.4,0.0.0.0/0,10.0.0.1}...)
2061 </p>
2062 </dd>
2063
2064 <dt><code>value: str</code></dt>
2065 <dd>
2066 <p>
2067 This indicates that the value of the DHCP option is a string.
2068 </p>
2069
2070 <p>
2071 Example. "name=host_name", "code=12", "type=str".
2072 </p>
2073 </dd>
2074 </dl>
2075 </column>
2076 </table>
2077 </database>