Logical grouping of edges with labels

48 Views Asked by At

In computer networks nodes are often interconnected using multiple links (=edges) which are logically grouped (Link Aggregation [LAG], Multi-Chassis LAG [MCLAG], Port-Channels, Etherchannels etc). This is often included in network diagrams using a circle over the links and a label for this circle

Visual Examples: LAG (a single node to another single node):

LAG

Logical grouping and label in blue

The logical group IDs (Po100, Po200) of the LAG is only locally unique. Meaning the IDs can be different on nodes A and B.

MCLAG (a cluster to another cluster/single node):

MCLAG

Logical grouping and label in blue

In a cluster, the two links towards another node are logically linked with an ID which is globally unique within the cluster.

Can the parts in blue be generated using graphviz / dot?

I read through the graphviz documentation and could not find a fitting attribute to achieve what I want.

1

There are 1 best solutions below

0
sroush On

Graphviz is not well suited for this, but you can duplicate the examples. It is rather fiddly.

digraph A{
  splines=false
  ranksep=.8

  subgraph cluster1{
    { 
      rank=same
      VPC1 //[ordering=out]
      dummy1 [shape=point label="" style=invis]  // used to position loops
      VPC2
      edge[style=invis]
      VPC1 -> dummy1  -> VPC2
    }
  }
  {
    node[color=blue height=.3 width=1.3 label="" fontcolor=blue fixedsize=true]
    // fiddle w/ fonts to get constant-width spaces when positioning label
    loopG11 [label=<<FONT FACE="courier">                  </FONT><FONT FACE="Times-Roman">Po100</FONT>>]
    loopG12 [label=<<FONT FACE="courier">                  </FONT><FONT FACE="Times-Roman">Po200</FONT>>]
  }
  A
  VPC1->A [taillabel="\neth1/2 " headlabel="eth1/2  "]
  VPC2->A [taillabel="\neth1/2  " headlabel="  eth1/2"]

  {
    edge[style=invis]
    dummy1 -> loopG11 -> loopG12 -> A
  }

  /////////////////////////////////////////////////////////////////

  node [group=Y]  // vertically align
  A1 [label="A"]
  B1 [label="B"]
  {
    node[color=blue fontcolor=blue height=.3 width=.7 XXfixedsize=true XXfontsize=10 label=""]
    loopG21 [xlabel="Po100"]
    loopG22 [xlabel="Po200"]
  }

  {
    edge[style=invis]
    A1 -> loopG21 -> loopG22 -> B1
  }
  A1:sw->B1:nw [taillabel="\neth1/1 " headlabel="eth1/2" dir=none  ]
  A1:se->B1:ne [taillabel="\neth1/2 " headlabel="eth1/2" dir=none  ]
}

Giving:
enter image description here

Here are two other solutions to the question (more or less)