From ba318e412158ecd7a43bfc6d72b1c4faa41adb14 Mon Sep 17 00:00:00 2001 From: "t.moriyama" Date: Fri, 14 Jun 2013 22:49:10 +0900 Subject: [PATCH] add vlan style to formaters --- linkpair/formatter/baseformatter.py | 2 ++ linkpair/formatter/grapheasy.py | 2 ++ linkpair/formatter/graphviz_tb.py | 1 + linkpair/formatter/springy.py | 4 +++- linkpair/formatter/springy_raphael.py | 6 ++++-- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/linkpair/formatter/baseformatter.py b/linkpair/formatter/baseformatter.py index d2d193c..3adad92 100755 --- a/linkpair/formatter/baseformatter.py +++ b/linkpair/formatter/baseformatter.py @@ -16,6 +16,7 @@ class BaseFormatter(object): OS_ROUTE_STYLE = '' PHYNET_STYLE = '' NAMESPACE_STYLE = '' + PATCH_STYLE = '' NOT_CONNECTED_STYLE = '' DEFAULT_FORMAT = '[ %s ] %s -- { label: "%s %s"; } [ %s ] %s' @@ -23,6 +24,7 @@ class BaseFormatter(object): NAMESPACE_FORMAT = '[ %s ] %s --> { label: %s %s; } [ %s ] %' PATCH_FORMAT = '[ %s ] %s <==> { label: %s : %s; } [ %s ] %s' VETH_FORMAT = '[ %s ] %s <--> { label: %s \| %s; } [ %s ] %s' + VLAN_DIST_FORMAT = '[ %s ] %s <--> { label: %s \| %s; } [ %s ] %s' HEADER_FORMAT = "" FOOTER_FORMAT = "" diff --git a/linkpair/formatter/grapheasy.py b/linkpair/formatter/grapheasy.py index d13d731..f19849d 100755 --- a/linkpair/formatter/grapheasy.py +++ b/linkpair/formatter/grapheasy.py @@ -20,6 +20,7 @@ class GraphEasyFormatter(BaseFormatter): OS_ROUTE_STYLE = '{ fill: white; border: dotted; bordercolor: black; }' PHYNET_STYLE = '{ fill: white; border: dotted; bordercolor: green; }' NAMESPACE_STYLE = '{ fill: green; border: none; }' + PATCH_STYLE = '{ fill: #ddddff; border: dotted; bordercolor: black; }' NOT_CONNECTED_STYLE = '{ fill: #ffdddd; border: dotted; bordercolor: black; }' DEFAULT_FORMAT = '[ %s ] %s -- { label: "%s %s"; labelcolor: #663333; } [ %s ] %s' @@ -27,6 +28,7 @@ class GraphEasyFormatter(BaseFormatter): NAMESPACE_FORMAT = '[ %s ] %s --> { label: "%s %s"; labelcolor: #663333; } [ %s ] %s' PATCH_FORMAT = '[ %s ] %s <==> { label: "%s : %s"; labelcolor: #333366; } [ %s ] %s' VETH_FORMAT = '[ %s ] %s <--> { label: "%s \| %s"; labelcolor: #336633; } [ %s ] %s' + VLAN_DIST_FORMAT = '[ %s ] %s <--> { label: "%s \| %s"; labelcolor: #336633; } [ %s ] %s' HEADER = "" FOOTER = "" diff --git a/linkpair/formatter/graphviz_tb.py b/linkpair/formatter/graphviz_tb.py index a32f547..29b5f2f 100755 --- a/linkpair/formatter/graphviz_tb.py +++ b/linkpair/formatter/graphviz_tb.py @@ -28,6 +28,7 @@ class GraphvizTBFormatter(BaseFormatter): NAMESPACE_FORMAT = '"%s" -> "%s" [ color="#000000", fontcolor="#663333", label = "%s %s" ]' PATCH_FORMAT = '"%s" -> "%s" [ dir=both, arrowhead=box, arrowtail=box, color="#000000:#000000", fontcolor="#333366", label = "%s : %s" ]' VETH_FORMAT = '"%s" -> "%s" [ dir=both, arrowhead=box, arrowtail=box, color="#000000", fontcolor="#336633", label="%s \| %s" ]' + VLAN_DIST_FORMAT = '"%s" -> "%s" [ dir=forward, arrowhead=none, arrowtail=inv, color="#660000", fontcolor="#336633", label="%s \| %s" ]' # ADDNODE_STYLE = '"%s" [ fillcolor="#ffffff", style="filled,dotted" ]' ADDNODE_STYLE = '"%s" [ %s ]' diff --git a/linkpair/formatter/springy.py b/linkpair/formatter/springy.py index 2b674cd..6b2b7b7 100755 --- a/linkpair/formatter/springy.py +++ b/linkpair/formatter/springy.py @@ -20,6 +20,7 @@ class SpringyFormatter(BaseFormatter): OS_ROUTE_STYLE = "color: '#00A0B0', directional: false" PHYNET_STYLE = "color: '#00A0B0', directional: false" NAMESPACE_STYLE = "color: '#00A0B0', directional: true" + PATCH_STYLE = "color: '#DDDDFF', directional: true" NOT_CONNECTED_STYLE = "color: '#FFDDDD', directional: true" DEFAULT_FORMAT = "['%s', '%s', {%s, label: '%s %s'}]" @@ -27,7 +28,8 @@ class SpringyFormatter(BaseFormatter): NAMESPACE_FORMAT = "['%s', '%s', {%s, label: '%s %s'}]" PATCH_FORMAT = "['%s', '%s', {%s, label: '%s : %s'}]" VETH_FORMAT = "['%s', '%s', {%s, label: '%s \| %s'}]" - + VLAN_DIST_FORMAT = "['%s', '%s', {%s, label: '%s -> %s'}]" + ADDNODE_STYLE = "graph.addNodes('%s');" ADDEDGE_START = "graph.addEdges(" ADDEDGE_END = ");" diff --git a/linkpair/formatter/springy_raphael.py b/linkpair/formatter/springy_raphael.py index 1f3a4e3..a099be1 100755 --- a/linkpair/formatter/springy_raphael.py +++ b/linkpair/formatter/springy_raphael.py @@ -19,14 +19,16 @@ class SpringyRaphaelFormatter(BaseFormatter): BR_STYLE = "color: '#00A0B0', directional: false" OS_ROUTE_STYLE = "color: '#00A0B0', directional: false" PHYNET_STYLE = "color: '#00A0B0', directional: false" - NAMESPACE_STYLE = "color: '#00A0B0', directional: true" - NAMESPACE_STYLE = "color: '#FFDDDD', directional: true" + NAMESPACE_STYLE = "color: '#DDFFDD', directional: true" + PATCH_STYLE = "color: '#DDDDFF', directional: true" + NOT_CONNECTED_STYLE = "color: '#FFDDDD', directional: true" DEFAULT_FORMAT = "graph.newEdge(%s, %s, {color: '#00A0B0'});" OS_ROUTING_FORMAT = "graph.newEdge(%s, %s, {color: '#00A0B0'});" NAMESPACE_FORMAT = "graph.newEdge(%s, %s, {color: '#00A0B0'});" PATCH_FORMAT = "graph.newEdge(%s, %s, {color: '#00A0B0'});" VETH_FORMAT = "graph.newEdge(%s, %s, {color: '#00A0B0'});" + VLAN_DIST_FORMAT = "graph.newEdge(%s, %s, {color: '#00A0B0'});" ADDNODE_STYLE = "var %s = graph.newNode({label: '%s'});" ADDEDGE_START = "graph.addEdges(" -- 2.11.0