bin/pvl.hosts-graph
changeset 413 cb7782e5a2fd
parent 411 9ac5dae42adb
child 414 b9aa8c35741f
equal deleted inserted replaced
412:b557b472ffa1 413:cb7782e5a2fd
   235                             remote_label = remote_host.location
   235                             remote_label = remote_host.location
   236 
   236 
   237                         log.info("%s:%s: guessing lldp host %s -> %s (%s)", host, port, remote_lldp, remote_host, remote_label)
   237                         log.info("%s:%s: guessing lldp host %s -> %s (%s)", host, port, remote_lldp, remote_host, remote_label)
   238 
   238 
   239                     else :
   239                     else :
   240                         # by chassis id
       
   241                         remote_node = remote_lldp
       
   242                         remote_host = None
       
   243 
       
   244                         log.warning("%s:%s: unknown lldp remote %s (%s)", host, port, remote_lldp, remote_label)
   240                         log.warning("%s:%s: unknown lldp remote %s (%s)", host, port, remote_lldp, remote_label)
       
   241                         
       
   242                         if options.graph_lldp_unknown :
       
   243                             # by chassis id
       
   244                             remote_node = remote_lldp
       
   245                             remote_host = None
       
   246                         else :
       
   247                             remote_node = remote_host = None
   245                     
   248                     
       
   249                     if not remote_node :
       
   250                         continue
       
   251 
   246                     # ensure remote node
   252                     # ensure remote node
   247                     if remote_node not in nodes :
   253                     if remote_node not in nodes :
   248                         log.debug("%s:%s: lazy-add remote %s (%s)", host, port, remote_node, remote_label)
   254                         log.debug("%s:%s: lazy-add remote %s (%s)", host, port, remote_node, remote_label)
   249 
   255 
   250                         nodes[remote_node] = remote_label
   256                         nodes[remote_node] = remote_label
   373                 
   379                 
   374                 else :
   380                 else :
   375                     local_port = port
   381                     local_port = port
   376 
   382 
   377                     # mapping was completely missing
   383                     # mapping was completely missing
   378                     log.warn("%s:%s link -> %s", local_node, local_port, remote_node)
   384                     log.info("%s:%s link -> %s", local_node, local_port, remote_node)
   379 
   385 
   380                     links[(local_node, local_port, None, remote_node)] = None
   386                     links[(local_node, local_port, None, remote_node)] = None
   381 
   387 
   382     if options.graph_bridge :
   388     if options.graph_bridge :
   383         # third graph: bridge
   389         # third graph: bridge
   600     parser.add_option_group(pvl.hosts.optparser(parser))
   606     parser.add_option_group(pvl.hosts.optparser(parser))
   601 
   607 
   602     parser.add_option('--snmp-data', metavar='FILE', default=None,
   608     parser.add_option('--snmp-data', metavar='FILE', default=None,
   603             help="Load snmp data from FILE")
   609             help="Load snmp data from FILE")
   604 
   610 
       
   611 
       
   612     parser.add_option('--graph-lldp-unknown', action='store_true',
       
   613             help="Graph unknown LLDP nodes")
       
   614 
       
   615 
       
   616     parser.add_option('--graph-vlans', action='store_true', dest='graph_vlans', 
       
   617             help="Graph links with VLAN information")
       
   618 
       
   619     parser.add_option('--no-vlans', action='store_false', dest='graph_vlans',
       
   620             help="Do not color VLANs")
       
   621 
       
   622 
       
   623     parser.add_option('--graph-bridge', action='store_true',
       
   624             help="Graph bridge forwarding database links")
       
   625 
       
   626 
   605     parser.add_option('--graph-dot', metavar='FILE',
   627     parser.add_option('--graph-dot', metavar='FILE',
   606             help="Output .dot graph data to file")
   628             help="Output .dot graph data to file")
   607 
       
   608 
       
   609     parser.add_option('--graph-vlans', action='store_true', dest='graph_vlans', 
       
   610             help="Graph links with VLAN information")
       
   611 
       
   612     parser.add_option('--no-vlans', action='store_false', dest='graph_vlans',
       
   613             help="Do not color VLANs")
       
   614 
       
   615     parser.add_option('--graph-bridge', action='store_true',
       
   616             help="Graph bridge forwarding database links")
       
   617 
       
   618 
   629 
   619     # input
   630     # input
   620     options, args = parser.parse_args(argv[1:])
   631     options, args = parser.parse_args(argv[1:])
   621     pvl.args.apply(options)
   632     pvl.args.apply(options)
   622     
   633