Beispiel #1
0
def topo_draw():
    impacts = spofs(gr1)
#    gr1.remove_node('RST-BAK01')
    changes = diff(gr1, gr2)
    for key in impacts:
        print key, impacts[key]
    for key in changes:
        print key, changes[key]
    time_start = time.clock()
#    draw(gr1, impacts, changes)
#    draw(gr1, impacts, return_svg=True)
    topo_entry = draw(gr1, impacts, save_svg=False, return_svg=True, return_graphml=True)
    print topo_entry['graphml']
    print topo_entry['svg']
#    draw(gr1)
    print "Topology drawing execution time:", time.clock() - time_start, "seconds"
Beispiel #2
0
def draw_isis(job, host, conn):
    """"Use Exscript to login to a Cisco IOS router, get the IS-IS database,
    and parse+analyze+draw the IS-IS topology."""
    # host.name is provided by Exscript, returns name of current host
    region = router_region[host.name]
    conn.send("enable\r")
    conn.app_authorize()
    conn.execute('term len 0')
    conn.execute('show isis database detail')
    isis_db = conn.response
    # Got the database, now parse it into a DiGraph
    topo = isis_db_to_digraph(isis_db, region)
    # Got topology DiGraph, now analyze it for potential SPOF impacts
    impacts = spofs(topo)
    # Got topology & SPOF impacts, now save the diagram (SVG) in the current
    # working directory, and try to upload the topology XML data (SVG+GraphML)
    # to MongoDB server
    topo_entry = draw(topo, impacts, save_svg=True, return_svg=True, return_graphml=True)
    topo_entry['region'] = region
    topo_entry['timestamp'] = topo.graph['timestamp']
    mongo_save(topo_entry)
    # use conn.send to 'exit' because conn.execute waits for a normal
    # prompt that will never come, and cause a script timeout error.
    conn.send('exit')
Beispiel #3
0
def ana_spof():
    time_start = time.clock()
    impacts = spofs(gr1)
    print "SPOF nodes:", impacts['spofs']
    print "Impacted nodes:", impacts['isolated']
    print "SPOF Analysis execution time:", time.clock() - time_start, "seconds"