1ovn-trace(8)                  Open vSwitch Manual                 ovn-trace(8)
2
3
4

NAME

6       ovn-trace - Open Virtual Network logical network tracing utility
7

SYNOPSIS

9       ovn-trace [options] datapath microflow
10
11       ovn-trace [options] --detach
12

DESCRIPTION

14       This utility simulates packet forwarding within an OVN logical network.
15       It can be used to run through ``what-if’’ scenarios: if a packet origi‐
16       nates at a logical port, what will happen to it and where will it ulti‐
17       mately  end  up?  Users  already  familiar  with   the   Open   vSwitch
18       ofproto/trace  command  described in ovs-vswitch(8) will find ovn-trace
19       to be a similar tool for logical networks.
20
21       ovn-trace works by reading the Logical_Flow and other tables  from  the
22       OVN  southbound  database (see ovn-sb(5)). It simulates a packet’s path
23       through logical networks by repeatedly looking it  up  in  the  logical
24       flow table, following the entire tree of possibilities.
25
26       ovn-trace  simulates only the OVN logical network. It does not simulate
27       the physical elements on which the logical  network  is  layered.  This
28       means  that,  for  example,  it  is unimportant how VMs are distributed
29       among hypervisors, or whether their  hypervisors  are  functioning  and
30       reachable,  so  ovn-trace will yield the same results regardless. There
31       is one important exception: ovn-northd, the daemon that  generates  the
32       logical  flows  that  ovn-trace simulates, treats logical ports differ‐
33       ently based on whether they are up or down. Thus, if you see surprising
34       results, ensure that the ports involved in a simulation are up.
35
36       The  simplest way to use ovn-trace is to provide datapath and microflow
37       arguments on the command line. In this case, it simulates the  behavior
38       of  a single packet and exits. For an alternate usage model, see Daemon
39       Mode below.
40
41       The datapath argument specifies the name of a logical datapath. Accept‐
42       able  names  are  the  name from the northbound Logical_Switch or Logi‐
43       cal_Router table, the UUID of a record from one of those tables, or the
44       UUID of a record from the southbound Datapath_Binding table.
45
46       The  microflow  argument describes the packet whose forwarding is to be
47       simulated, in the syntax of an OVN logical expression, as described  in
48       ovn-sb(5),  to  express  constraints.  The parser understands prerequi‐
49       sites; for example, if the expression refers to ip4.src,  there  is  no
50       need to explicitly state ip4 or eth.type == 0x800.
51
52       For  reasonable  L2  behavior,  the  microflow  should include at least
53       inport and eth.dst, plus eth.src if port security is enabled. For exam‐
54       ple:
55
56           inport == "lp11" && eth.src == 00:01:02:03:04:05 && eth.dst == ff:ff:ff:ff:ff:ff
57
58
59       For  reasonable  L3 behavior, microflow should also include ip4.src and
60       ip4.dst (or ip6.src and ip6.dst) and ip.ttl. For example:
61
62           inport == "lp111" && eth.src == f0:00:00:00:01:11 && eth.dst == 00:00:00:00:ff:11
63           && ip4.src == 192.168.11.1 && ip4.dst == 192.168.22.2 && ip.ttl == 64
64
65
66       Here’s an ARP microflow example:
67
68           inport == "lp123"
69           && eth.dst == ff:ff:ff:ff:ff:ff && eth.src == f0:00:00:00:01:11
70           && arp.op == 1 && arp.sha == f0:00:00:00:01:11 && arp.spa == 192.168.1.11
71           && arp.tha == ff:ff:ff:ff:ff:ff && arp.tpa == 192.168.2.22
72
73
74       ovn-trace will reject erroneous  microflow  expressions,  which  beyond
75       syntax  errors  fall into two categories. First, they can be ambiguous.
76       For example, tcp.src == 80 is ambiguous because it does not state  IPv4
77       or  IPv6  as the Ethernet type. ip4 && tcp.src > 1024 is also ambiguous
78       because it does not constrain bits of  tcp.src  to  particular  values.
79       Second, they can be contradictory, e.g. ip4 && ip6.
80

OUTPUT

82       ovn-trace  supports the three different forms of output, each described
83       in a separate section below. Regardless of the selected output  format,
84       ovn-trace  starts the output with a line that shows the microflow being
85       traced in OpenFlow syntax.
86
87   Detailed Output
88       The detailed form of output is also the default form. This form  groups
89       output  into sections headed up by the ingress or egress pipeline being
90       traversed. Each pipeline lists each table that was visited  (by  number
91       and  name), the ovn-northd source file and line number of the code that
92       added the flow, the match expression and priority of the  logical  flow
93       that was matched, and the actions that were executed.
94
95       The  execution  of  OVN  logical  actions  naturally  forms a ``control
96       stack’’ that resembles that of a program  in  conventional  programming
97       languages  such  as  C or Java. Because the next action that calls into
98       another logical flow table for a lookup is a recursive  construct,  OVN
99       ``programs’’  in  practice  tend to form deep control stacks that, dis‐
100       played in the obvious way using additional indentation for each  level,
101       quickly  use up the horizontal space on all but the widest displays. To
102       make  detailed  output  more  readable,  without  loss  of  generality,
103       ovn-trace  omits indentation for ``tail recursion,’’ that is, when next
104       is the last action in a logical flow, it does not indent details of the
105       next table lookup more deeply. Output still uses indentation when it is
106       needed for clarity.
107
108       OVN ``programs’’ traces also tend to encounter long strings of  logical
109       flows with match expression 1 (which matches every packet) and the sin‐
110       gle action next;. These are uninteresting and merely clutter output, so
111       ovn-trace omits them entirely even from detailed output.
112
113       The  following  excerpt  from detailed ovn-trace output shows a section
114       for a packet traversing the ingress pipeline of  logical  datapath  ls1
115       with  ingress  logical port lp111. The packet matches a logical flow in
116       table 0 (aka ls_in_port_sec_l2) with priority 50 and executes  next(1);
117       to pass to table 1. Tables 1 through 11 are trivial and omitted. In ta‐
118       ble 12 (aka ls_in_l2_lkup), the packet matches a flow with priority  50
119       based on its Ethernet destination address and the flow’s actions output
120       the packet to the lrp11-attachement logical port.
121
122           ingress(dp="ls1", inport="lp111")
123           ---------------------------------
124           0. ls_in_port_sec_l2: inport == "lp111", priority 50
125           next(1);
126           12. ls_in_l2_lkup: eth.dst == 00:00:00:00:ff:11, priority 50
127           outport = "lrp11-attachment";
128           output;
129
130
131   Summary Output
132       Summary output includes the logical pipelines visited by a  packet  and
133       the  logical  actions  executed on it. Compared to the detailed output,
134       however, it removes details of tables and logical flows traversed by  a
135       packet.  It  uses a format closer to that of a programming language and
136       does not attempt to avoid indentation. The summary output equivalent to
137       the above detailed output fragment is:
138
139           ingress(dp="ls1", inport="lp111") {
140           outport = "lrp11-attachment";
141           output;
142           ...
143           };
144
145
146   Minimal Output
147       Minimal  output  includes  only  actions  that  modify packet data (not
148       including OVN registers or metadata such as outport) and output actions
149       that  actually  deliver  a  packet  to  a logical port (excluding patch
150       ports). The operands of actions that modify packet data  are  displayed
151       reduced  to  constants, e.g. ip4.dst = reg0; might be show as ip4.dst =
152       192.168.0.1; if that was the value actually loaded. This yields  output
153       even simpler than the summary format. (Users familiar with Open vSwitch
154       may recognize this as similar in spirit to the datapath actions  listed
155       at the bottom of ofproto/trace output.)
156
157       The  minimal output format reflects the externally seen behavior of the
158       logical networks more than it does the implementation. This makes  this
159       output format the most suitable for use in regression tests, because it
160       is least likely to change when logical flow tables are rearranged with‐
161       out semantic change.
162

STATEFUL ACTIONS

164       Some  OVN  logical actions use or update state that is not available in
165       the southbound database. ovn-trace handles these actions  as  described
166       below:
167
168              ct_next
169                     By  default  ovn-trace  treats  flows  as ``tracked’’ and
170                     ``established.’’ See the description of the  --ct  option
171                     for a way to override this behavior.
172
173              ct_dnat (without an argument)
174                     Forks the pipeline. In one fork, advances to the next ta‐
175                     ble as if next; were executed. The packet is not changed,
176                     on the assumption that no NAT state was available. In the
177                     other fork, the pipeline continues without  change  after
178                     the ct_dnat action.
179
180              ct_snat (without an argument)
181                     This  action  distinguishes  between  gateway routers and
182                     distributed routers. A gateway router  is  defined  as  a
183                     logical  datapath  that  contains  an l3gateway port; any
184                     other logical datapath is  a  distributed  router.  On  a
185                     gateway router, ct_snat; is treated as a no-op. On a dis‐
186                     tributed router, it is treated the same way as ct_dnat;.
187
188              ct_dnat(ip)
189              ct_snat(ip)
190                   Forks the pipeline. In one fork, sets ip4.dst (or  ip4.src)
191                   to  ip  and  ct.dnat  (or ct.snat) to 1 and advances to the
192                   next table as if next; were executed. In  the  other  fork,
193                   the pipeline continues without change after the ct_dnat (or
194                   ct_snat) action.
195
196              ct_lb;
197              ct_lb(ip[:port]...);
198                   Forks the pipeline. In one fork, sets ip4.dst (or  ip6.dst)
199                   to  one  of the load-balancer addresses and the destination
200                   port to its associated port, if any, and sets ct.dnat to 1.
201                   With one or more arguments, gives preference to the address
202                   specified on --lb-dst, if any; without arguments, uses  the
203                   address  and port specified on --lb-dst. In the other fork,
204                   the pipeline  continues  without  change  after  the  ct_lb
205                   action.
206
207              ct_commit
208              put_arp
209              put_nd
210                   These actions are treated as no-ops.
211

DAEMON MODE

213       If  ovn-trace  is invoked with the --detach option (see Daemon Options,
214       below), it runs in the background as a daemon and accepts commands from
215       ovs-appctl  (or  another  JSON-RPC  client) indefinitely. The currently
216       supported commands are described below.
217
218              trace [options] datapath microflow
219                     Traces microflow through datapath and  replies  with  the
220                     results of the trace. Accepts the options described under
221                     Trace Options below.
222
223              exit   Causes ovn-trace to gracefully terminate.
224

OPTIONS

226   Trace Options
227       --detailed
228       --summary
229       --minimal
230            These options control the form and level of  detail  in  ovn-trace
231            output. If more than one of these options is specified, all of the
232            selected forms are output, in the order listed above, each  headed
233            by a banner line. If none of these options is given, --detailed is
234            the default. See Output, above, for a description of each kind  of
235            output.
236
237       --all
238            Selects all three forms of output.
239
240       --ovs[=remote]
241            Makes  ovn-trace  attempt to obtain and display the OpenFlow flows
242            that correspond to each OVN logical flow. To do so, ovn-trace con‐
243            nects     to     remote     (by    default,    unix:/var/run/open‐
244            vswitch/br-int.mgmt) over OpenFlow and  retrieves  the  flows.  If
245            remote  is  specified,  it  must  be an active OpenFlow connection
246            method described in ovs-ofctl(8).
247
248            To make the best use of the output, it is important to  understand
249            the   relationship  between  logical  flows  and  OpenFlow  flows.
250            ovn-architecture(7), under Architectural Physical Life Cycle of  a
251            Packet,  describes  this  relationship. Keep in mind the following
252            points:
253
254            ·      ovn-trace currently shows all the OpenFlow flows to which a
255                   logical  flow  corresponds,  even  though  an actual packet
256                   ordinarily matches only one of these.
257
258            ·      Some logical flows can map to the Open  vSwitch  ``conjunc‐
259                   tive   match’’  extension  (see  ovs-fields(7)).  Currently
260                   ovn-trace cannot display the flows with conjunction actions
261                   that effectively produce the conj_id match.
262
263            ·      Some  logical  flows may not be represented in the OpenFlow
264                   tables on a given hypervisor, if they could not be used  on
265                   that hypervisor.
266
267            ·      Some  OpenFlow  flows  do  not correspond to logical flows,
268                   such as OpenFlow flows that map between physical and  logi‐
269                   cal ports. These flows will never show up in a trace.
270
271            ·      When  ovn-trace omits uninteresting logical flows from out‐
272                   put, it does not look up the corresponding OpenFlow flows.
273
274       --ct=flags
275            This option sets the ct_state flags that a ct_next logical  action
276            will report. The flags must be a comma- or space-separated list of
277            the following connection tracking flags:
278
279            ·      trk: Include to  indicate  connection  tracking  has  taken
280                   place. (This bit is set automatically even if not listed in
281                   flags.
282
283            ·      new: Include to indicate a new flow.
284
285            ·      est: Include to indicate an established flow.
286
287            ·      rel: Include to indicate a related flow.
288
289            ·      rpl: Include to indicate a reply flow.
290
291            ·      inv: Include to indicate a connection entry in a bad state.
292
293            ·      dnat: Include to indicate a  packet  whose  destination  IP
294                   address has been changed.
295
296            ·      snat:  Include to indicate a packet whose source IP address
297                   has been changed.
298
299            The ct_next action is used to implement the OVN distributed  fire‐
300            wall. For testing, useful flag combinations include:
301
302            ·      trk,new:  A  packet in a flow in either direction through a
303                   firewall that has not yet been committed (with ct_commit).
304
305            ·      trk,est: A packet in an established flow going out  through
306                   a firewall.
307
308            ·      trk,rpl:  A packet coming in through a firewall in reply to
309                   an established flow.
310
311            ·      trk,inv: An invalid packet in either direction.
312
313            A packet might pass through the connection tracker  twice  in  one
314            trip  through  OVN:  once  following egress from a VM as it passes
315            outward through a firewall, and once preceding ingress to a second
316            VM  as  it  passes  inward  through  a firewall. Use multiple --ct
317            options to specify the flags for multiple ct_next actions.
318
319            When --ct is unspecified, or when there  are  fewer  --ct  options
320            than ct_next actions, the flags default to trk,est.
321
322       --lb-dst=ip[:port]
323            Sets  the  IP  from  VIP pool to use as destination of the packet.
324            --lb-dst is not available in daemon mode.
325
326       --friendly-names
327       --no-friendly-names
328            When cloud management systems such as OpenStack are layered on top
329            of  OVN, they often use long, human-unfriendly names for ports and
330            datapaths, for example, ones that include entire  UUIDs.  They  do
331            usually include friendlier names, but the long, hard-to-read names
332            are the ones that appear in matches and actions.  By  default,  or
333            with  --friendly-names,  ovn-trace  substitutes  these  friendlier
334            names for the long names in its output. Use --no-friendly-names to
335            disable  this  behavior; this option might be useful, for example,
336            if a program is going to parse ovn-trace output.
337
338   Daemon Options
339       --pidfile[=pidfile]
340              Causes a file (by default, program.pid) to be created indicating
341              the  PID  of the running process. If the pidfile argument is not
342              specified, or if it does not begin with /, then it is created in
343              /var/run/openvswitch.
344
345              If --pidfile is not specified, no pidfile is created.
346
347       --overwrite-pidfile
348              By  default,  when --pidfile is specified and the specified pid‐
349              file already exists and is locked by a running process, the dae‐
350              mon refuses to start. Specify --overwrite-pidfile to cause it to
351              instead overwrite the pidfile.
352
353              When --pidfile is not specified, this option has no effect.
354
355       --detach
356              Runs this program as a background process.  The  process  forks,
357              and  in  the  child it starts a new session, closes the standard
358              file descriptors (which has the side effect of disabling logging
359              to  the  console), and changes its current directory to the root
360              (unless --no-chdir is specified). After the child completes  its
361              initialization, the parent exits.
362
363       --monitor
364              Creates  an  additional  process  to monitor this program. If it
365              dies due to a signal that indicates a programming  error  (SIGA‐
366              BRT, SIGALRM, SIGBUS, SIGFPE, SIGILL, SIGPIPE, SIGSEGV, SIGXCPU,
367              or SIGXFSZ) then the monitor process starts a new copy of it. If
368              the daemon dies or exits for another reason, the monitor process
369              exits.
370
371              This option is normally used with --detach, but  it  also  func‐
372              tions without it.
373
374       --no-chdir
375              By  default,  when --detach is specified, the daemon changes its
376              current  working  directory  to  the  root  directory  after  it
377              detaches.  Otherwise, invoking the daemon from a carelessly cho‐
378              sen directory would prevent the  administrator  from  unmounting
379              the file system that holds that directory.
380
381              Specifying  --no-chdir  suppresses this behavior, preventing the
382              daemon from changing its current working directory. This may  be
383              useful for collecting core files, since it is common behavior to
384              write core dumps into the current working directory and the root
385              directory is not a good directory to use.
386
387              This option has no effect when --detach is not specified.
388
389       --no-self-confinement
390              By  default  this daemon will try to self-confine itself to work
391              with files under well-known  directories  whitelisted  at  build
392              time.  It  is better to stick with this default behavior and not
393              to use this flag unless some other Access  Control  is  used  to
394              confine  daemon.  Note  that in contrast to other access control
395              implementations that are typically  enforced  from  kernel-space
396              (e.g.  DAC  or  MAC), self-confinement is imposed from the user-
397              space daemon itself and hence should not be considered as a full
398              confinement  strategy,  but instead should be viewed as an addi‐
399              tional layer of security.
400
401       --user=user:group
402              Causes this program to run as  a  different  user  specified  in
403              user:group,  thus  dropping  most  of the root privileges. Short
404              forms user and :group are also allowed,  with  current  user  or
405              group  assumed,  respectively.  Only daemons started by the root
406              user accepts this argument.
407
408              On   Linux,   daemons   will   be   granted   CAP_IPC_LOCK   and
409              CAP_NET_BIND_SERVICES  before  dropping root privileges. Daemons
410              that interact with a datapath, such  as  ovs-vswitchd,  will  be
411              granted  three  additional  capabilities,  namely CAP_NET_ADMIN,
412              CAP_NET_BROADCAST and CAP_NET_RAW. The  capability  change  will
413              apply even if the new user is root.
414
415              On Windows, this option is not currently supported. For security
416              reasons, specifying this option will cause  the  daemon  process
417              not to start.
418
419   Logging Options
420       -v[spec]
421       --verbose=[spec]
422            Sets  logging  levels.  Without  any  spec, sets the log level for
423            every module and destination to dbg. Otherwise, spec is a list  of
424            words separated by spaces or commas or colons, up to one from each
425            category below:
426
427            ·      A valid module name, as displayed by the vlog/list  command
428                   on ovs-appctl(8), limits the log level change to the speci‐
429                   fied module.
430
431            ·      syslog, console, or file, to limit the log level change  to
432                   only  to  the  system  log,  to  the console, or to a file,
433                   respectively. (If --detach is specified, the daemon  closes
434                   its  standard  file  descriptors, so logging to the console
435                   will have no effect.)
436
437                   On Windows platform, syslog is accepted as a  word  and  is
438                   only useful along with the --syslog-target option (the word
439                   has no effect otherwise).
440
441            ·      off, emer, err, warn, info, or  dbg,  to  control  the  log
442                   level.  Messages  of  the  given severity or higher will be
443                   logged, and messages of lower  severity  will  be  filtered
444                   out.  off filters out all messages. See ovs-appctl(8) for a
445                   definition of each log level.
446
447            Case is not significant within spec.
448
449            Regardless of the log levels set for file, logging to a file  will
450            not take place unless --log-file is also specified (see below).
451
452            For compatibility with older versions of OVS, any is accepted as a
453            word but has no effect.
454
455       -v
456       --verbose
457            Sets the maximum logging verbosity  level,  equivalent  to  --ver‐
458            bose=dbg.
459
460       -vPATTERN:destination:pattern
461       --verbose=PATTERN:destination:pattern
462            Sets  the  log  pattern  for  destination  to  pattern.  Refer  to
463            ovs-appctl(8) for a description of the valid syntax for pattern.
464
465       -vFACILITY:facility
466       --verbose=FACILITY:facility
467            Sets the RFC5424 facility of the log message. facility can be  one
468            of kern, user, mail, daemon, auth, syslog, lpr, news, uucp, clock,
469            ftp, ntp, audit, alert, clock2, local0,  local1,  local2,  local3,
470            local4, local5, local6 or local7. If this option is not specified,
471            daemon is used as the default for  the  local  system  syslog  and
472            local0  is used while sending a message to the target provided via
473            the --syslog-target option.
474
475       --log-file[=file]
476            Enables logging to a file. If file is specified, then it  is  used
477            as the exact name for the log file. The default log file name used
478            if file is omitted is /var/log/openvswitch/program.log.
479
480       --syslog-target=host:port
481            Send syslog messages to UDP port on host, in addition to the  sys‐
482            tem  syslog.  The host must be a numerical IP address, not a host‐
483            name.
484
485       --syslog-method=method
486            Specify method as how syslog messages should  be  sent  to  syslog
487            daemon. The following forms are supported:
488
489            ·      libc,  to  use  the  libc  syslog()  function.  This is the
490                   default behavior. Downside of using this  options  is  that
491                   libc  adds fixed prefix to every message before it is actu‐
492                   ally sent to the syslog daemon over  /dev/log  UNIX  domain
493                   socket.
494
495            ·      unix:file, to use a UNIX domain socket directly. It is pos‐
496                   sible to specify arbitrary message format with this option.
497                   However,  rsyslogd  8.9  and  older versions use hard coded
498                   parser function anyway that limits UNIX domain socket  use.
499                   If  you  want  to  use  arbitrary message format with older
500                   rsyslogd versions, then use  UDP  socket  to  localhost  IP
501                   address instead.
502
503            ·      udp:ip:port,  to  use  a UDP socket. With this method it is
504                   possible to use arbitrary message format  also  with  older
505                   rsyslogd.  When  sending  syslog  messages  over UDP socket
506                   extra precaution needs to be taken into account, for  exam‐
507                   ple,  syslog daemon needs to be configured to listen on the
508                   specified UDP port,  accidental  iptables  rules  could  be
509                   interfering  with  local  syslog traffic and there are some
510                   security considerations that apply to UDP sockets,  but  do
511                   not apply to UNIX domain sockets.
512
513   PKI Options
514       PKI  configuration  is  required  to  use SSL for the connection to the
515       database (and the switch, if --ovs is specified).
516
517              -p privkey.pem
518              --private-key=privkey.pem
519                   Specifies a PEM file containing the  private  key  used  as
520                   identity for outgoing SSL connections.
521
522              -c cert.pem
523              --certificate=cert.pem
524                   Specifies  a  PEM file containing a certificate that certi‐
525                   fies the private key specified on -p or --private-key to be
526                   trustworthy. The certificate must be signed by the certifi‐
527                   cate authority (CA) that the peer in SSL  connections  will
528                   use to verify it.
529
530              -C cacert.pem
531              --ca-cert=cacert.pem
532                   Specifies a PEM file containing the CA certificate for ver‐
533                   ifying certificates presented to this program by SSL peers.
534                   (This  may  be  the  same certificate that SSL peers use to
535                   verify the certificate specified on -c or --certificate, or
536                   it  may  be a different one, depending on the PKI design in
537                   use.)
538
539              -C none
540              --ca-cert=none
541                   Disables verification  of  certificates  presented  by  SSL
542                   peers.  This  introduces  a security risk, because it means
543                   that certificates cannot be verified to be those  of  known
544                   trusted hosts.
545
546   Other Options
547       --db database
548              The  OVSDB database remote to contact. If the OVN_SB_DB environ‐
549              ment variable is set, its value is used as the  default.  Other‐
550              wise, the default is unix:/var/run/openvswitch/db.sock, but this
551              default is unlikely to be useful outside of  single-machine  OVN
552              test environments.
553
554              -h
555              --help
556                   Prints a brief help message to the console.
557
558              -V
559              --version
560                   Prints version information to the console.
561
562
563
564Open vSwitch 2.10.0                ovn-trace                      ovn-trace(8)
Impressum