本文整理汇总了Python中foam.geni.db.GeniDB.getDeviceSet方法的典型用法代码示例。如果您正苦于以下问题:Python GeniDB.getDeviceSet方法的具体用法?Python GeniDB.getDeviceSet怎么用?Python GeniDB.getDeviceSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类foam.geni.db.GeniDB
的用法示例。
在下文中一共展示了GeniDB.getDeviceSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getAdvertisement
# 需要导入模块: from foam.geni.db import GeniDB [as 别名]
# 或者: from foam.geni.db.GeniDB import getDeviceSet [as 别名]
def getAdvertisement ():
NSMAP = {None: "%s" % (PGNS),
"xs" : "%s" % (XSNS),
"openflow" : "%s" % (OFNSv3)}
rspec = ET.Element("rspec", nsmap = NSMAP)
rspec.attrib["{%s}schemaLocation" % (XSNS)] = PGNS + " " \
"http://www.geni.net/resources/rspec/3/ad.xsd " + \
OFNSv3 + " " \
"http://www.geni.net/resources/rspec/ext/openflow/3/of-ad.xsd"
rspec.attrib["type"] = "advertisement"
links = FV.getLinkList()
devices = FV.getDeviceList()
fvversion = FV.getFVVersion()
db_devices = GeniDB.getDeviceSet()
GeniDB.refreshDevices(devices)
for dpid in devices:
db_devices.discard(dpid)
addAdDevice(rspec, dpid)
for dpid in db_devices:
addAdDevice(rspec, dpid, False)
#getLinks START
for link in links:
addAdLink(rspec, link)
#getLinks END
xml = StringIO()
ET.ElementTree(rspec).write(xml)
return xml.getvalue()