Skip to content

Commit

Permalink
python: ovs: flowviz: Add datapath graph format.
Browse files Browse the repository at this point in the history
Graph view leverages the TreeFlow hierarchy and uses graphviz library to
build a visual graph of the datapath tree.

Conntrack zones are shown in random colors to help visualize connection
tracking interdependencies.

An html flag builds an HTML page with both the html flows and the graph
(in svg) that enables navigation.

Examples:
$ ovs-appctl dpctl/dump-flows -m | ovs-flowviz datapath graph | dot
-Tpng -o graph.png
$ ovs-appctl dpctl/dump-flows -m | ovs-flowviz datapath graph --html >
flows.html

Acked-by: Eelco Chaudron <[email protected]>
Signed-off-by: Adrian Moreno <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
amorenoz authored and igsilya committed Oct 19, 2024
1 parent f36b065 commit 4214bf4
Show file tree
Hide file tree
Showing 4 changed files with 506 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ ovs_flowviz = \
python/ovs/flowviz/main.py \
python/ovs/flowviz/odp/__init__.py \
python/ovs/flowviz/odp/cli.py \
python/ovs/flowviz/odp/graph.py \
python/ovs/flowviz/odp/html.py \
python/ovs/flowviz/odp/tree.py \
python/ovs/flowviz/ofp/__init__.py \
Expand Down
23 changes: 23 additions & 0 deletions python/ovs/flowviz/odp/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import click

from ovs.flowviz.main import maincli

from ovs.flowviz.odp.graph import GraphProcessor
from ovs.flowviz.odp.html import HTMLTreeProcessor
from ovs.flowviz.odp.tree import ConsoleTreeProcessor
from ovs.flowviz.process import (
Expand Down Expand Up @@ -84,3 +86,24 @@ def html(opts):
processor = HTMLTreeProcessor(opts)
processor.process()
processor.print()


@datapath.command()
@click.option(
"-h",
"--html",
is_flag=True,
default=False,
show_default=True,
help="Output an html file containing the graph",
)
@click.pass_obj
def graph(opts, html):
"""Print the flows in a graphviz (.dot) format showing the relationship
of recirc_ids."""
if len(opts.get("filename")) > 1:
raise click.BadParameter("Graph format only supports one input file")

processor = GraphProcessor(opts)
processor.process()
processor.print(html)
Loading

0 comments on commit 4214bf4

Please sign in to comment.