58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/ovsimager/dotwriter.rb', line 58
def add_iface(name, mark, dump, inet, tag, peer, remote=nil, ns=:root)
fill = mark ? "fillcolor=#{mark2color(mark)},style=filled," : ''
label = "#{name}<BR/><FONT POINT-SIZE=\"10\">#{inet.join('<BR/>')}"
if tag or remote
label += "<BR/>#{tag}#{remote && remote.gsub('>','>')}"
end
if dump
label += " </FONT><FONT COLOR=\"blue\">"
if dump[0] && dump[2] && dump[0] == dump[3] && dump[1] == dump[2]
label += "<BR/>[#{dump[0]} <-> #{dump[1]}]"
else
label += "<BR/>[#{dump[0]} --> #{dump[1]}]" if dump[0]
label += "<BR/>[#{dump[3]} <-- #{dump[2]}]" if dump[2]
end
if dump[4] && dump[4][:cap]
cap = dump[4][:cap]
label += "<BR/><FONT POINT-SIZE=\"10\">(#{cap[2]} #{cap[3]} " +
"#{cap[0]}<=>#{cap[1]})</FONT>"
end
end
label += " </FONT>"
ename = escape(name) + (ns == :root ? '' : "___" + escape(ns.to_s))
@dot.puts " #{ename} [#{fill}label=<#{label}>]"
if peer
if peer[0] == ' '
@dot_peers << " #{escape(peer.strip)} -- #{ename}"
elsif name <= peer
@dot_peers << " #{ename} -- #{escape(peer)}"
end
end
end
|