It has two basic styles defined: "dark" and "light" intended for
dark and light terminals.

Examples:
$ ovs-flowviz -i /tmp/dpflows --style=dark datapath console
$ ovs-flowviz -i /tmp/ofpflows --style=light openflow console

Acked-by: Eelco Chaudron <echau...@redhat.com>
Signed-off-by: Adrian Moreno <amore...@redhat.com>
---
 python/automake.mk                  |  5 +-
 python/ovs/flowviz/ovs-flowviz.conf | 94 +++++++++++++++++++++++++++++
 python/setup.py                     |  1 +
 3 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 python/ovs/flowviz/ovs-flowviz.conf

diff --git a/python/automake.mk b/python/automake.mk
index bd53c5405..23212e4b5 100644
--- a/python/automake.mk
+++ b/python/automake.mk
@@ -89,7 +89,8 @@ EXTRA_DIST += \
        python/ovs/compat/sortedcontainers/LICENSE \
        python/README.rst \
        python/setup.py \
-       python/test_requirements.txt
+       python/test_requirements.txt \
+       python/ovs/flowviz/ovs-flowviz.conf
 
 # C extension support.
 EXTRA_DIST += python/ovs/_json.c
@@ -109,6 +110,8 @@ FLAKE8_PYFILES += \
        python/setup.py
 
 nobase_pkgdata_DATA = $(ovs_pyfiles) $(ovstest_pyfiles) $(ovs_flowviz)
+nobase_pkgdata_DATA += python/ovs/flowviz/ovs-flowviz.conf
+
 ovs-install-data-local:
        $(MKDIR_P) python/ovs
        sed \
diff --git a/python/ovs/flowviz/ovs-flowviz.conf 
b/python/ovs/flowviz/ovs-flowviz.conf
new file mode 100644
index 000000000..3acd0a29e
--- /dev/null
+++ b/python/ovs/flowviz/ovs-flowviz.conf
@@ -0,0 +1,94 @@
+# Create any number of styles.{style_name} sections with a defined style.
+#
+# Syntax:
+#
+#  [FORMAT].[PORTION].[SELECTOR].[ELEMENT] = [VALUE]
+#
+#  * FORMAT: console
+#  * PORTION: The portion of the flow that the style applies to
+#     - key: Selects how to print the key of a KeyValue pair
+#     - key: Selects how to print the value of a KeyValue pair
+#     - flag: Selects how to print the a flag
+#     - delim: Selects how to print the delimiters around key and values
+#
+#  * SELECTOR:
+#    - highlighted: to apply when the key is highlighted
+#    - type.{TYPE}: to apply when the value matches a type
+#       (special types such as IPAddress or EthMask can be used)
+#       (only aplicable to 'value')
+#    - {key_name}: to apply when the key matches the key_name
+#
+# Console Styles
+# ==============
+#   * ELEMENT:
+#     - color: defines the color in hex or a color rich starndard ones [1]
+#     - underline: if set to "true", the selected portion will be underlined
+#
+#[1] https://rich.readthedocs.io/en/stable/appendix/colors.html#standard-colors
+
+[styles.dark]
+
+# defaults for key-values
+console.key.color = #5D86BA
+console.value.color= #B0C4DE
+console.delim.color= #B0C4DE
+console.default.color= #FFFFFF
+
+# defaults for special types
+console.value.type.IPAddress.color = #008700
+console.value.type.IPMask.color = #008700
+console.value.type.EthMask.color = #008700
+
+# dim some long arguments
+console.value.ct.color = grey66
+console.value.ufid.color = grey66
+console.value.clone.color = grey66
+console.value.controller.color = grey66
+
+# highlight flags
+console.flag.color = #875fff
+
+# show drop and recirculations
+console.key.drop.color = red
+console.key.resubmit.color = #00d700
+console.key.output.color = #00d700
+console.value.output.color = #00d700
+
+# highlights
+console.key.highlighted.color = red
+console.key.highlighted.underline = true
+console.value.highlighted.underline = true
+console.delim.highlighted.underline = true
+
+
+[styles.light]
+# If a color is omitted, the default terminal color will be used
+# highlight keys
+console.key.color = blue
+
+# special types
+console.value.type.IPAddress.color = #008700
+console.value.type.IPMask.color = #008700
+console.value.type.EthMask.color = #008700
+
+# dim long arguments
+console.value.ct.color = bright_black
+console.value.ufid.color = #870000
+console.value.clone.color = bright_black
+console.value.controller.color = bright_black
+
+# highlight flags
+console.flag.color = #00005F
+
+# show drop and recirculations
+console.key.drop.color = red
+console.key.resubmit.color = #00d700
+console.key.output.color = #005f00
+console.value.output.color = #00d700
+
+# highlights
+console.key.highlighted.color = #f20905
+console.value.highlighted.color = #f20905
+console.key.highlighted.underline = true
+console.value.highlighted.underline = true
+console.delim.highlighted.underline = true
diff --git a/python/setup.py b/python/setup.py
index 76f9fc820..c734f68f3 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -117,6 +117,7 @@ setup_args = dict(
                         [*flow_extras_require, 'click', 'rich'],
                     },
     scripts=["ovs/flowviz/ovs-flowviz"],
+    data_files=["ovs/flowviz/ovs-flowviz.conf"],
     include_package_data=True,
 )
 
-- 
2.44.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to