list: Rename all functions in list.h with ovs_ prefix.
[cascardo/ovs.git] / ovn / ovn-nb.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <database name="ovn-nb" title="OVN Northbound Database">
3   <p>
4     This database is the interface between OVN and the cloud management system
5     (CMS), such as OpenStack, running above it.  The CMS produces almost all of
6     the contents of the database.  The <code>ovn-northd</code> program
7     monitors the database contents, transforms it, and stores it into the <ref
8     db="OVN_Southbound"/> database.
9   </p>
10
11   <p>
12     We generally speak of ``the'' CMS, but one can imagine scenarios in
13     which multiple CMSes manage different parts of an OVN deployment.
14   </p>
15
16   <h2>External IDs</h2>
17
18   <p>
19     Each of the tables in this database contains a special column, named
20     <code>external_ids</code>.  This column has the same form and purpose each
21     place it appears.
22   </p>
23
24   <dl>
25     <dt><code>external_ids</code>: map of string-string pairs</dt>
26     <dd>
27       Key-value pairs for use by the CMS.  The CMS might use certain pairs, for
28       example, to identify entities in its own configuration that correspond to
29       those in this database.
30     </dd>
31   </dl>
32
33   <table name="Logical_Switch" title="L2 logical switch">
34     <p>
35       Each row represents one L2 logical switch.
36     </p>
37
38     <p>
39       There are two kinds of logical switches, that is, ones that fully
40       virtualize the network (overlay logical switches) and ones that provide
41       simple connectivity to a physical network (bridged logical switches).
42       They work in the same way when providing connectivity between logical
43       ports on same chasis, but differently when connecting remote logical
44       ports.  Overlay logical switches connect remote logical ports by tunnels,
45       while bridged logical switches provide connectivity to remote ports by
46       bridging the packets to directly connected physical L2 segment with the
47       help of <code>localnet</code> ports.  Each bridged logical switch has
48       one and only one <code>localnet</code> port, which has only one special
49       address <code>unknown</code>.
50     </p>
51
52     <column name="name">
53       <p>
54         A name for the logical switch.  This name has no special meaning or purpose
55         other than to provide convenience for human interaction with the ovn-nb
56         database.  There is no requirement for the name to be unique.  The
57         logical switch's UUID should be used as the unique identifier.
58       </p>
59     </column>
60
61     <column name="ports">
62       <p>
63         The logical ports connected to the logical switch.
64       </p>
65
66       <p>
67         It is an error for multiple logical switches to include the same
68         logical port.
69       </p>
70     </column>
71
72     <column name="acls">
73       Access control rules that apply to packets within the logical switch.
74     </column>
75
76     <group title="Common Columns">
77       <column name="external_ids">
78         See <em>External IDs</em> at the beginning of this document.
79       </column>
80     </group>
81   </table>
82
83   <table name="Logical_Port" title="L2 logical switch port">
84     <p>
85       A port within an L2 logical switch.
86     </p>
87
88     <group title="Core Features">
89       <column name="name">
90         <p>
91           The logical port name.
92         </p>
93
94         <p>
95           For entities (VMs or containers) that are spawned in the hypervisor,
96           the name used here must match those used in the <ref key="iface-id"
97           table="Interface" column="external_ids" db="Open_vSwitch"/> in the
98           <ref db="Open_vSwitch"/> database's <ref table="Interface"
99           db="Open_vSwitch"/> table, because hypervisors use <ref key="iface-id"
100           table="Interface" column="external_ids" db="Open_vSwitch"/> as a lookup
101           key to identify the network interface of that entity.
102         </p>
103
104         <p>
105           For containers that share a VIF within a VM, the name can be any
106           unique identifier.  See <code>Containers</code>, below, for more
107           information.
108         </p>
109       </column>
110
111       <column name="type">
112         <p>
113           Specify a type for this logical port.  Logical ports can be used to
114           model other types of connectivity into an OVN logical switch.  The
115           following types are defined:
116         </p>
117
118         <dl>
119           <dt>(empty string)</dt>
120           <dd>
121             A VM (or VIF) interface.
122           </dd>
123
124           <dt><code>router</code></dt>
125           <dd>
126             A connection to a logical router.
127           </dd>
128
129           <dt><code>localnet</code></dt>
130           <dd>
131             A connection to a locally accessible network from each
132             <code>ovn-controller</code> instance.  A logical switch can only
133             have a single <code>localnet</code> port attached.  This is used
134             to model direct connectivity to an existing network.
135           </dd>
136
137           <dt><code>vtep</code></dt>
138           <dd>
139             A port to a logical switch on a VTEP gateway.
140           </dd>
141         </dl>
142       </column>
143     </group>
144
145     <group title="Options">
146       <column name="options">
147         This column provides key/value settings specific to the logical port
148         <ref column="type"/>.  The type-specific options are described
149         individually below.
150       </column>
151
152       <group title="Options for router ports">
153         <p>
154           These options apply when <ref column="type"/> is <code>router</code>.
155         </p>
156
157         <p>
158           If a given logical switch has multiple <code>router</code> ports, the
159           <ref table="Logical_Router_Port"/> rows that they reference must be
160           all on the same <ref table="Logical_Router"/> (for different
161           subnets).
162         </p>
163
164         <column name="options" key="router-port">
165           Required.  The <ref column="name"/> of the <ref
166           table="Logical_Router_Port"/> to which this logical switch port is
167           connected.
168         </column>
169       </group>
170
171       <group title="Options for localnet ports">
172         <p>
173           These options apply when <ref column="type"/> is
174           <code>localnet</code>.
175         </p>
176
177         <column name="options" key="network_name">
178           Required.  The name of the network to which the <code>localnet</code>
179           port is connected.  Each hypervisor, via <code>ovn-controller</code>,
180           uses its local configuration to determine exactly how to connect to
181           this locally accessible network.
182         </column>
183       </group>
184
185       <group title="Options for vtep ports">
186         <p>
187           These options apply when <ref column="type"/> is <code>vtep</code>.
188         </p>
189
190         <column name="options" key="vtep-physical-switch">
191           Required.  The name of the VTEP gateway.
192         </column>
193
194         <column name="options" key="vtep-logical-switch">
195           Required.  A logical switch name connected by the VTEP gateway.
196         </column>
197       </group>
198
199       <group title="VMI (or VIF) Options">
200         <p>
201           These options apply to logical ports with <ref column="type"/> having
202           (empty string)
203         </p>
204
205         <column name="options" key="policing_rate">
206           If set, indicates the maximum rate for data sent from this interface,
207           in kbps. Data exceeding this rate is dropped.
208         </column>
209
210         <column name="options" key="policing_burst">
211           If set, indicates the maximum burst size for data sent from this
212           interface, in kb.
213         </column>
214       </group>
215     </group>
216
217     <group title="Containers">
218       <p>
219         When a large number of containers are nested within a VM, it may be too
220         expensive to dedicate a VIF to each container.  OVN can use VLAN tags
221         to support such cases.  Each container is assigned a VLAN ID and each
222         packet that passes between the hypervisor and the VM is tagged with the
223         appropriate ID for the container.  Such VLAN IDs never appear on a
224         physical wire, even inside a tunnel, so they need not be unique except
225         relative to a single VM on a hypervisor.
226       </p>
227
228       <p>
229         These columns are used for VIFs that represent nested containers using
230         shared VIFs.  For VMs and for containers that have dedicated VIFs, they
231         are empty.
232       </p>
233
234       <column name="parent_name">
235         The VM interface through which the nested container sends its network
236         traffic.  This must match the <ref column="name"/> column for some
237         other <ref table="Logical_Port"/>.
238       </column>
239
240       <column name="tag">
241         <p>
242           The VLAN tag in the network traffic associated with a container's
243           network interface.
244         </p>
245
246         <p>
247           When <ref column="type"/> is set to <code>localnet</code>, this can
248           be set to indicate that the port represents a connection to a
249           specific VLAN on a locally accessible network. The VLAN ID is used to
250           match incoming traffic and is also added to outgoing traffic.
251         </p>
252       </column>
253     </group>
254
255     <group title="Port State">
256       <column name="up">
257         This column is populated by <code>ovn-northd</code>, rather than by the
258         CMS plugin as is most of this database.  When a logical port is bound
259         to a physical location in the OVN Southbound database <ref
260         db="OVN_Southbound" table="Binding"/> table, <code>ovn-northd</code>
261         sets this column to <code>true</code>; otherwise, or if the port
262         becomes unbound later, it sets it to <code>false</code>.  This allows
263         the CMS to wait for a VM's (or container's) networking to become active
264         before it allows the VM (or container) to start.
265       </column>
266
267       <column name="enabled">
268         This column is used to administratively set port state.  If this column
269         is empty or is set to <code>true</code>, the port is enabled.  If this
270         column is set to <code>false</code>, the port is disabled.  A disabled
271         port has all ingress and egress traffic dropped.
272       </column>
273
274     </group>
275
276     <group title="Addressing">
277       <column name="addresses">
278         <p>
279           Addresses owned by the logical port.
280         </p>
281
282         <p>
283           Each element in the set must take one of the following forms:
284         </p>
285
286         <dl>
287           <dt><code>Ethernet address followed by zero or more IPv4 or IPv6 addresses (or both)</code></dt>
288           <dd>
289             <p>
290               An Ethernet address defined is owned by the logical port.
291               Like a physical Ethernet NIC, a logical port ordinarily has
292               a single fixed Ethernet address.
293             </p>
294
295             <p>
296               When a OVN logical switch processes a unicast Ethernet frame
297               whose destination MAC address is in a logical port's <ref
298               column="addresses"/> column, it delivers it only to that port, as
299               if a MAC learning process had learned that MAC address on the
300               port.
301             </p>
302
303             <p>
304               If IPv4 or IPv6 address(es) (or both) are defined, it indicates
305               that the logical port owns the given IP addresses.
306             </p>
307
308             <p>
309               If IPv4 address(es) are defined, the OVN logical switch uses this
310               information to synthesize responses to ARP requests without
311               traversing the physical network. The OVN logical router connected
312               to the logical switch, if any, uses this information to avoid
313               issuing ARP requests for logical switch ports.
314             </p>
315
316             <p>
317               Note that the order here is important. The Ethernet address must
318               be listed before the IP address(es) if defined.
319             </p>
320
321             <p>
322               Examples:
323             </p>
324
325             <dl>
326               <dt><code>80:fa:5b:06:72:b7</code></dt>
327               <dd>
328                 This indicates that the logical port owns the above mac address.
329               </dd>
330
331               <dt><code>80:fa:5b:06:72:b7 10.0.0.4 20.0.0.4</code></dt>
332               <dd>
333                 This indicates that the logical port owns the mac address and two
334                 IPv4 addresses.
335               </dd>
336
337               <dt><code>80:fa:5b:06:72:b7 fdaa:15f2:72cf:0:f816:3eff:fe20:3f41</code></dt>
338               <dd>
339                 This indicates that the logical port owns the mac address and
340                 1 IPv6 address.
341               </dd>
342
343               <dt><code>80:fa:5b:06:72:b7 10.0.0.4 fdaa:15f2:72cf:0:f816:3eff:fe20:3f41</code></dt>
344               <dd>
345                 This indicates that the logical port owns the mac address and
346                 1 IPv4 address and 1 IPv6 address.
347               </dd>
348             </dl>
349           </dd>
350
351           <dt><code>unknown</code></dt>
352           <dd>
353             This indicates that the logical port has an unknown set of Ethernet
354             addresses.  When an OVN logical switch processes a unicast Ethernet
355             frame whose destination MAC address is not in any logical port's
356             <ref column="addresses"/> column, it delivers it to the port (or
357             ports) whose <ref column="addresses"/> columns include
358             <code>unknown</code>.
359           </dd>
360         </dl>
361       </column>
362
363       <column name="port_security">
364         <p>
365           This column controls the addresses from which the host attached to the
366           logical port (``the host'') is allowed to send packets and to which it
367           is allowed to receive packets.  If this column is empty, all addresses
368           are permitted.
369         </p>
370
371         <p>
372           Each element in the set must begin with one Ethernet address.
373           This would restrict the host to sending packets from and receiving
374           packets to the ethernet addresses defined in the logical port's
375           <ref column="port_security"/> column. It also restricts the inner
376           source MAC addresses that the host may send in ARP and IPv6
377           Neighbor Discovery packets. The host is always allowed to receive packets
378           to multicast and broadcast Ethernet addresses.
379         </p>
380
381         <p>
382           Each element in the set may additionally contain one or more IPv4 or
383           IPv6 addresses (or both), with optional masks.  If a mask is given, it
384           must be a CIDR mask.  In addition to the restrictions described for
385           Ethernet addresses above, such an element restricts the IPv4 or IPv6
386           addresses from which the host may send and to which it may receive
387           packets to the specified addresses.  A masked address, if the host part
388           is zero, indicates that the host is allowed to use any address in the
389           subnet; if the host part is nonzero, the mask simply indicates the size
390           of the subnet. In addition:
391         </p>
392
393         <ul>
394           <li>
395             <p>
396               If any IPv4 address is given, the host is also allowed to receive
397               packets to the IPv4 local broadcast address 255.255.255.255 and to
398               IPv4 multicast addresses (224.0.0.0/4).  If an IPv4 address with a
399               mask is given, the host is also allowed to receive packets to the
400               broadcast address in that specified subnet.
401             </p>
402
403             <p>
404               If any IPv4 address is given, the host is additionally restricted
405               to sending ARP packets with the specified source IPv4 address.
406               (RARP is not restricted.)
407             </p>
408           </li>
409
410           <li>
411             <p>
412               If any IPv6 address is given, the host is also allowed to receive
413               packets to IPv6 multicast addresses (ff00::/8).
414             </p>
415
416             <p>
417               If any IPv6 address is given, the host is additionally restricted
418               to sending IPv6 Neighbor Discovery Solicitation or Advertisement
419               packets with the specified source address or, for solicitations,
420               the unspecified address.
421             </p>
422           </li>
423         </ul>
424
425         <p>
426           If an element includes an IPv4 address, but no IPv6 addresses, then
427           IPv6 traffic is not allowed.  If an element includes an IPv6 address,
428           but no IPv4 address, then IPv4 and ARP traffic is not allowed.
429         </p>
430
431         <p>
432           This column uses the same lexical syntax as the <ref column="match"
433           table="Pipeline" db="OVN_Southbound"/> column in the OVN Southbound
434           database's <ref table="Pipeline" db="OVN_Southbound"/> table.  Multiple
435           addresses within an element may be space or comma separated.
436         </p>
437
438         <p>
439           This column is provided as a convenience to cloud management systems,
440           but all of the features that it implements can be implemented as ACLs
441           using the <ref table="ACL"/> table.
442         </p>
443
444         <p>
445           Examples:
446         </p>
447
448         <dl>
449           <dt><code>80:fa:5b:06:72:b7</code></dt>
450           <dd>
451             The host may send traffic from and receive traffic to the specified
452             MAC address, and to receive traffic to Ethernet multicast and
453             broadcast addresses, but not otherwise.  The host may not send ARP or
454             IPv6 Neighbor Discovery packets with inner source Ethernet addresses
455             other than the one specified.
456           </dd>
457
458           <dt><code>80:fa:5b:06:72:b7 192.168.1.10/24</code></dt>
459           <dd>
460             This adds further restrictions to the first example.  The host may
461             send IPv4 packets from or receive IPv4 packets to only 192.168.1.10,
462             except that it may also receive IPv4 packets to 192.168.1.255 (based
463             on the subnet mask), 255.255.255.255, and any address in 224.0.0.0/4.
464             The host may not send ARPs with a source Ethernet address other than
465             80:fa:5b:06:72:b7 or source IPv4 address other than 192.168.1.10.
466             The host may not send or receive any IPv6 (including IPv6 Neighbor
467             Discovery) traffic.
468           </dd>
469
470           <dt><code>"80:fa:5b:12:42:ba", "80:fa:5b:06:72:b7 192.168.1.10/24"</code></dt>
471           <dd>
472             The host may send traffic from and receive traffic to the
473             specified MAC addresses, and
474             to receive traffic to Ethernet multicast and broadcast addresses,
475             but not otherwise.   With MAC 80:fa:5b:12:42:ba, the host may
476             send traffic from and receive traffic to any L3 address.
477             With MAC 80:fa:5b:06:72:b7, the host may send IPv4 packets from or
478             receive IPv4 packets to only 192.168.1.10, except that it may also
479             receive IPv4 packets to 192.168.1.255 (based on the subnet mask),
480             255.255.255.255, and any address in 224.0.0.0/4.  The host may not
481             send or receive any IPv6 (including IPv6 Neighbor Discovery) traffic.
482           </dd>
483         </dl>
484       </column>
485     </group>
486
487     <group title="Common Columns">
488       <column name="external_ids">
489         See <em>External IDs</em> at the beginning of this document.
490       </column>
491     </group>
492   </table>
493
494   <table name="ACL" title="Access Control List (ACL) rule">
495     <p>
496       Each row in this table represents one ACL rule for a logical switch
497       that points to it through its <ref column="acls"/> column.  The <ref
498       column="action"/> column for the highest-<ref column="priority"/>
499       matching row in this table determines a packet's treatment.  If no row
500       matches, packets are allowed by default.  (Default-deny treatment is
501       possible: add a rule with <ref column="priority"/> 0, <code>0</code> as
502       <ref column="match"/>, and <code>deny</code> as <ref column="action"/>.)
503     </p>
504
505     <column name="priority">
506       <p>
507         The ACL rule's priority.  Rules with numerically higher priority
508         take precedence over those with lower.  If two ACL rules with
509         the same priority both match, then the one actually applied to a
510         packet is undefined.
511       </p>
512
513       <p>
514         Return traffic from an <code>allow-related</code> flow is always
515         allowed and cannot be changed through an ACL.
516       </p>
517     </column>
518
519     <column name="direction">
520       <p>Direction of the traffic to which this rule should apply:</p>
521       <ul>
522         <li>
523           <code>from-lport</code>: Used to implement filters on traffic
524           arriving from a logical port.  These rules are applied to the
525           logical switch's ingress pipeline.
526         </li>
527         <li>
528           <code>to-lport</code>: Used to implement filters on traffic
529           forwarded to a logical port.  These rules are applied to the
530           logical switch's egress pipeline.
531         </li>
532       </ul>
533     </column>
534
535     <column name="match">
536       <p>
537         The packets that the ACL should match, in the same expression
538         language used for the <ref column="match" table="Logical_Flow"
539         db="OVN_Southbound"/> column in the OVN Southbound database's
540         <ref table="Logical_Flow" db="OVN_Southbound"/> table.  The
541         <code>outport</code> logical port is only available in the
542         <code>to-lport</code> direction (the <code>inport</code> is
543         available in both directions).
544       </p>
545
546       <p>
547         By default all traffic is allowed.  When writing a more
548         restrictive policy, it is important to remember to allow flows
549         such as ARP and IPv6 neighbor discovery packets.
550       </p>
551
552       <p>
553         Note that you can not create an ACL matching on a port with
554         type=router.
555       </p>
556
557       <p>
558         Note that when <code>localnet</code> port exists in a lswitch, for
559         <code>to-lport</code> direction, the <code>inport</code> works only if
560         the <code>to-lport</code> is located on the same chassis as the
561         <code>inport</code>.
562       </p>
563     </column>
564
565     <column name="action">
566       <p>The action to take when the ACL rule matches:</p>
567       <ul>
568         <li>
569           <code>allow</code>: Forward the packet.
570         </li>
571
572         <li>
573           <code>allow-related</code>: Forward the packet and related traffic
574           (e.g. inbound replies to an outbound connection).
575         </li>
576
577         <li>
578           <code>drop</code>: Silently drop the packet.
579         </li>
580
581         <li>
582           <code>reject</code>: Drop the packet, replying with a RST for TCP or
583           ICMP unreachable message for other IP-based protocols.
584           <code>Not implemented--currently treated as drop</code>
585         </li>
586       </ul>
587     </column>
588
589     <column name="log">
590       <p>
591         If set to <code>true</code>, packets that match the ACL will trigger a
592         log message on the transport node or nodes that perform ACL processing.
593         Logging may be combined with any <ref column="action"/>.
594       </p>
595
596       <p>
597         Logging is not yet implemented.
598       </p>
599     </column>
600
601     <group title="Common Columns">
602       <column name="external_ids">
603         See <em>External IDs</em> at the beginning of this document.
604       </column>
605     </group>
606   </table>
607
608   <table name="Logical_Router" title="L3 logical router">
609     <p>
610       Each row represents one L3 logical router.
611     </p>
612
613     <column name="name">
614       <p>
615         A name for the logical router.  This name has no special meaning or purpose
616         other than to provide convenience for human interaction with the ovn-nb
617         database.  There is no requirement for the name to be unique.  The
618         logical router's UUID should be used as the unique identifier.
619       </p>
620     </column>
621
622     <column name="ports">
623       The router's ports.
624     </column>
625
626     <column name="default_gw">
627       IP address to use as default gateway, if any.
628     </column>
629
630     <group title="Common Columns">
631       <column name="external_ids">
632         See <em>External IDs</em> at the beginning of this document.
633       </column>
634     </group>
635   </table>
636
637   <table name="Logical_Router_Port" title="L3 logical router port">
638     <p>
639       A port within an L3 logical router.
640     </p>
641
642     <p>
643       Exactly one <ref table="Logical_Router"/> row must reference a given
644       logical router port.
645     </p>
646
647     <column name="name">
648       <p>
649         A name for the logical router port.
650       </p>
651
652       <p>
653         In addition to provide convenience for human interaction with the
654         ovn-nb database, this column is used as reference by its patch port in
655         <ref table="Logical_Port"/> or another logical router port in <ref
656         table="Logical_Router_Port"/>.
657       </p>
658     </column>
659
660     <column name="network">
661       The IP address of the router and the netmask.  For example,
662       <code>192.168.0.1/24</code> indicates that the router's IP address is
663       192.168.0.1 and that packets destined to 192.168.0.<var>x</var> should be
664       routed to this port.
665     </column>
666
667     <column name="mac">
668       The Ethernet address that belongs to this router port.
669     </column>
670
671     <column name="enabled">
672       This column is used to administratively set port state.  If this column
673       is empty or is set to <code>true</code>, the port is enabled.  If this
674       column is set to <code>false</code>, the port is disabled.  A disabled
675       port has all ingress and egress traffic dropped.
676     </column>
677
678     <group title="Attachment">
679       <p>
680         A given router port serves one of two purposes:
681       </p>
682
683       <ul>
684         <li>
685           To attach a logical switch to a logical router.  A logical router
686           port of this type is referenced by exactly one <ref
687           table="Logical_Port"/> of type <code>router</code>.  The value of
688           <ref column="name"/> is set as <code>router-port</code> in column
689           <ref column="options"/> of <ref table="Logical_Port"/>.
690           In this case <ref column="peer"/> column is empty.
691         </li>
692
693         <li>
694           To connect one logical router to another.  This requires a pair of
695           logical router ports, each connected to a different router.  Each
696           router port in the pair specifies the other in its <ref
697           column="peer"/> column.  No <ref table="Logical_Switch"/> refers to
698           the router port.
699         </li>
700       </ul>
701
702       <column name="peer">
703         <p>
704           For a router port used to connect two logical routers, this
705           identifies the other router port in the pair by <ref column="name"/>.
706         </p>
707
708         <p>
709           For a router port attached to a logical switch, this column is empty.
710         </p>
711       </column>
712     </group>
713
714     <group title="Common Columns">
715       <column name="external_ids">
716         See <em>External IDs</em> at the beginning of this document.
717       </column>
718     </group>
719   </table>
720 </database>