2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-02 07:15:17 +00:00

python: ovs: flowviz: Add console formatting.

Add a flow formatting framework and one implementation for console
printing using rich.

The flow formatting framework is a simple set of classes that can be
used to write different flow formatting implementations. It supports
styles to be described by any class, highlighting and config-file based
style definition.

The first flow formatting implementation is also introduced: the
ConsoleFormatter. It uses the an advanced rich-text printing library
[1].

The console printing supports:
- Heatmap: printing the packet/byte statistics of each flow in a color
  that represents its relative size: blue (low) -> red (high).
- Printing a banner with the file name and alias.
- Extensive style definition via config file.

This console format is added to both OpenFlow and Datapath flows.

Examples:
- Highlight drops in datapath flows:
$ ovs-flowviz -i flows.txt --highlight "drop" datapath console
- Quickly detect where most packets are going using heatmap and
  paginated output:
$ ovs-ofctl dump-flows br-int | ovs-flowviz openflow console -h

[1] https://rich.readthedocs.io/en/stable/introduction.html

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Adrian Moreno
2024-09-25 12:52:06 +02:00
committed by Ilya Maximets
parent e3149d4808
commit ec2646dd43
8 changed files with 732 additions and 4 deletions

View File

@@ -105,9 +105,11 @@ setup_args = dict(
extras_require={':sys_platform == "win32"': ['pywin32 >= 1.0'],
'dns': ['unbound'],
'flow': flow_extras_require,
'flowviz': [*flow_extras_require, 'click'],
'flowviz':
[*flow_extras_require, 'click', 'rich'],
},
scripts=["ovs/flowviz/ovs-flowviz"],
include_package_data=True,
)
try: