Commit 12f5f516 authored by Tomas Hlavacek's avatar Tomas Hlavacek

Speed up BIRD BGP graph generation.

Refactor BIRD BGP graph generation by means of finishHook and arbitrary
data in sessions. FinishHook is used to set off result parsing and the
preprocessed list of ASes in paths is saved along with AS names resolved
from whois in the session data. In the display phase it is only
transformed into nodes and passed to graphviz.
parent 93e459ac
......@@ -343,13 +343,18 @@ class BirdGraphShowRouteAll(ulgmodel.TextCommand):
],
name=name)
def finishHook(self,session):
session.setData(bird_parse_sh_route_all(session.getResult(),str(session.getRouter().getASN())))
def decorateResult(self,session,decorator_helper=None):
return (decorator_helper.img(decorator_helper.getSpecialContentURL(session.getSessionId()),"BGP graph"),1)
if(session.isFinished()):
return (decorator_helper.img(decorator_helper.getSpecialContentURL(session.getSessionId()),"BGP graph"),1)
else:
return ('',0)
def getSpecialContent(self,session,**params):
pass
paths = session.getData()
print "Content-type: image/png\n"
paths = bird_parse_sh_route_all(session.getResult(),str(session.getRouter().getASN()))
ulggraph.bgp_graph_gen(bird_reduce_paths(paths),start=session.getRouter().getName(),
end=session.getParameters()[1])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment