本文整理匯總了Python中henmanager.HenManager.getLinks方法的典型用法代碼示例。如果您正苦於以下問題:Python HenManager.getLinks方法的具體用法?Python HenManager.getLinks怎麽用?Python HenManager.getLinks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類henmanager.HenManager
的用法示例。
在下文中一共展示了HenManager.getLinks方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: old
# 需要導入模塊: from henmanager import HenManager [as 別名]
# 或者: from henmanager.HenManager import getLinks [as 別名]
def old(self):
BASE_URL="cgi-bin/gui/components/network/"
manager = HenManager()
manager.initLogging()
links = manager.getLinks("all","all")
graph = pydot.Dot()
switches = manager.getNodes("switch")
for switch in switches.values():
if self.__switchStatuses.has_key(switch.getNodeID()):
if self.__switchStatuses[switch.getNodeID()] == 1:
graph.add_node(pydot.Node(switch.getNodeID(),URL=BASE_URL+\
"switchinfocgi.py?id="+switch.getNodeID(),\
style="filled",color="chartreuse1"))
else:
graph.add_node(pydot.Node(switch.getNodeID(),URL=BASE_URL+\
"switchinfocgi.py?id="+switch.getNodeID(),\
style="filled",color="firebrick"))
else:
graph.add_node(pydot.Node(switch.getNodeID(),URL=BASE_URL+\
"switchinfocgi.py?id="+switch.getNodeID()))
for linktype in links.values():
for link in linktype.values():
members = link.getLinkMembers()
graph.add_edge(pydot.Edge(str(members[0].getDeviceId()),\
str(members[1].getDeviceId()),label=link.getLinkId(),\
arrowhead="none",headlabel=str(members[1].getDevicePort().\
replace('GigabitEthernet ','').replace('Management','M')),\
taillabel=str(members[0].getDevicePort().\
replace('GigabitEthernet','')),fontsize=8,\
tooltip=link.getLinkId(),\
URL=BASE_URL+"linkinfocgi.py?id="+link.getLinkId()))
# prog='circo' isn't bad
print graph.create_svg(prog='dot')