本文整理汇总了Python中foam.geni.db.GeniDB.refreshDevices方法的典型用法代码示例。如果您正苦于以下问题:Python GeniDB.refreshDevices方法的具体用法?Python GeniDB.refreshDevices怎么用?Python GeniDB.refreshDevices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类foam.geni.db.GeniDB
的用法示例。
在下文中一共展示了GeniDB.refreshDevices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getAdvertisement
# 需要导入模块: from foam.geni.db import GeniDB [as 别名]
# 或者: from foam.geni.db.GeniDB import refreshDevices [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()
示例2: RspecValidationError
# 需要导入模块: from foam.geni.db import GeniDB [as 别名]
# 或者: from foam.geni.db.GeniDB import refreshDevices [as 别名]
try:
xs3.assertValid(rspec_dom)
except etree.DocumentInvalid, e:
flog.exception("XML rspec validation error")
raise RspecValidationError()
rspec_elem = rspec_dom.getroot()
schemas = rspec_elem.get("{%s}schemaLocation" % (XSNS))
expiration = _asUTC(datetime.datetime.utcnow()) + ConfigDB.getConfigItemByKey("geni.max-lease").getValue()
for cred in creds:
credexp = _asUTC(cred.expiration)
if credexp < expiration:
expiration = credexp
GeniDB.refreshDevices()
sliver = GENISliver(rspec_dom)
sliver.setUserURN(user_info["urn"])
sliver.setUserEmail(user_info["email"], overwrite=False)
sliver.validate()
GeniDB.insertSliver(slice_urn, sliver, rspec, expiration)
return sliver
class IllegalEthertype(CoreException):
def __init__ (self, dltype):
super(IllegalEthertype, self).__init__()
self.dltype = dltype
def __str__ (self):