本文整理汇总了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')