generate /tmp/topology.svg from descriptions
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 8 Jul 2018 11:06:32 +0000 (13:06 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 8 Jul 2018 11:06:32 +0000 (13:06 +0200)
graphiz-topology.sh [new file with mode: 0755]

diff --git a/graphiz-topology.sh b/graphiz-topology.sh
new file mode 100755 (executable)
index 0000000..ecfc44a
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh -xe
+
+(
+echo "digraph topology {"
+
+egrep '\[sw-' /dev/shm/port-status/* | cut -d: -f2- | tr -d '\[' | tr -d '\]' | awk '{ printf("  \"%s\" -> \"%s\";\n", $1,$7)}'
+
+echo "}"
+) | tee /tmp/topology.dot | dot -Tsvg -o /tmp/topology.svg
+