Reputation: 1489
I'm using python+graphviz in order to create networking topologies out of the information contained in Racktables. I've succeded pretty well so far but I'm willing now to add multiple lines labels to a cluster (not a node).
For example, I have the following code with python:
for router in routers:
[...]
cluster_name = "cluster"+str(i)
router_label=router_name+"\n"+router_hw
c = gv.Graph(cluster_name)
c.body.append('label='+router_label)
When ever I run that program, I get the following:
ST120_CMS70_SARM
SARM
ST202_P9J70_SARM
SARM
Error: node "SARM" is contained in two non-comparable clusters "cluster1" and "cluster0"
But, if I change this router_label=router_name+"\n"+router_hw
to this router_label=router_name+"_"+router_hw
, I get no error and the topology gets drawn, but, of course, a one line label.
Any hint on this?
Many thanks!
Lucas
Upvotes: 1
Views: 1490
Reputation: 1489
Ok, I've found the solution. The multiline label is achieved using HTML like labels, like the following one...
router_label="<"+router_name+"<BR />"+router_ip+">"
c = gv.Graph(cluster_name)
c.body.append('label='+router_label)
This code provides the following:
Thanks!
Lucas
Upvotes: 1