12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/netdisco/output/dot.rb', line 12
def to_s
str = "graph Netdisco {\n"
@output.to_a.each do |host|
host_label = label(host)
str += INDENT + id(host) + "[label=\"#{host_label}\" color=\"#{color(host_label)}\"]\n"
if @peers.has_key? host
@peers[host].each do |peer|
peer_name = @resolve ? peer.name : peer.ip
next if (not CFG.dot.bothlinks) && @connections.include?([peer_name, host].sort)
@connections << [peer_name, host].sort
labels = ""
labels = "[headlabel=\"#{peer.dst}\" taillabel=\"#{peer.src}\"]" if CFG.dot.linklabel
str << INDENT + INDENT + id(host) + " -- " + id(peer_name) + labels + "\n"
end
end
end
str += "}\n"
str
end
|