本文整理汇总了Python中foam.geni.db.GeniDB.getLocationData方法的典型用法代码示例。如果您正苦于以下问题:Python GeniDB.getLocationData方法的具体用法?Python GeniDB.getLocationData怎么用?Python GeniDB.getLocationData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类foam.geni.db.GeniDB
的用法示例。
在下文中一共展示了GeniDB.getLocationData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addAdDevice
# 需要导入模块: from foam.geni.db import GeniDB [as 别名]
# 或者: from foam.geni.db.GeniDB import getLocationData [as 别名]
def addAdDevice (rspec, dpid, active=True):
switch_urn = generateSwitchComponentID(dpid)
od = ET.SubElement(rspec, "{%s}datapath" % (OFNSv3))
od.attrib["component_id"] = switch_urn
od.attrib["component_manager_id"] = getManagerID()
od.attrib["dpid"] = dpid
locdata = GeniDB.getLocationData(dpid, switch_urn)
if locdata:
ET.SubElement(od, "{%s}location" % (OFNSv3), country=locdata.country, latitude=locdata.lat, longitude=locdata.long)
attachments = TopoDB.getDPIDAttachments(dpid)
if active:
ports = FV.getDevicePorts(dpid)
for port in ports:
if (port.features == None):
p = ET.SubElement(od, "{%s}port" % (OFNSv3), num=str(port.num), name=port.name)
else:
p = ET.SubElement(od, "{%s}port" % (OFNSv3), num=str(port.num), name=port.name, features=port.features)
for info in attachments.setdefault(port.name, []):
a = ET.SubElement(p, "{%s}attachment" % (OFNSv3))
a.attrib["remote_component_id"] = info.remote_component_id
a.attrib["remote_port"] = info.remote_port
a.attrib["desc"] = info.desc