本文整理汇总了Python中foam.geni.db.GeniDB.getFlowvisorSliceName方法的典型用法代码示例。如果您正苦于以下问题:Python GeniDB.getFlowvisorSliceName方法的具体用法?Python GeniDB.getFlowvisorSliceName怎么用?Python GeniDB.getFlowvisorSliceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类foam.geni.db.GeniDB
的用法示例。
在下文中一共展示了GeniDB.getFlowvisorSliceName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: approveSliver
# 需要导入模块: from foam.geni.db import GeniDB [as 别名]
# 或者: from foam.geni.db.GeniDB import getFlowvisorSliceName [as 别名]
def approveSliver (request, logger):
try:
jsonValidate(request.json, [("sliver_urn", (unicode,str)), ("priority", int)], logger)
if (not request.json.has_key("sliver_urn")) or (not request.json.has_key("priority")):
return jsonify({"exception" : "You must specify a sliver_urn and priority"})
slice_name = GeniDB.getFlowvisorSliceName(sliver_urn=request.json["sliver_urn"])
if FV.sliceExists(slice_name):
return jsonify({"Fault" : "Flowvisor slice '%s' already exists" % (slice_name)})
sobj = GeniDB.getSliverObj(request.json["sliver_urn"])
GeniDB.setSliverStatus(request.json["sliver_urn"], True)
GeniDB.setSliverPriority(request.json["sliver_urn"], request.json["priority"])
GeniDB.commit()
foam.geni.approval.AppData.addSliver(sobj)
sobj.createSlice()
sobj.insertFlowspace(request.json["priority"])
sobj.insertVirtualLink()
data = GeniDB.getSliverData(sobj.getURN(), True)
foam.task.emailApproveSliver(data)
return jsonify(None)
except JSONValidationError, e:
jd = e.__json__()
return jsonify(jd, code = 1, msg = jd["exception"])
示例2: deleteSliver
# 需要导入模块: from foam.geni.db import GeniDB [as 别名]
# 或者: from foam.geni.db.GeniDB import getFlowvisorSliceName [as 别名]
def deleteSliver (slice_urn = None, sliver_urn = None):
slice_name = GeniDB.getFlowvisorSliceName(slice_urn=slice_urn, sliver_urn = sliver_urn)
if FV.sliceExists(slice_name):
# stats = FV.getCombinedStats(slice_name)
# GeniDB.insertFinalStats(slice_urn, stats)
FV.deleteSlice(slice_name)
GeniDB.deleteSliver(slice_urn=slice_urn, sliver_urn=sliver_urn)
foam.geni.approval.rebuildDB()
示例3: getSliverStatus
# 需要导入模块: from foam.geni.db import GeniDB [as 别名]
# 或者: from foam.geni.db.GeniDB import getFlowvisorSliceName [as 别名]
def getSliverStatus (sliver_urn):
try:
slice_name = GeniDB.getFlowvisorSliceName(sliver_urn=sliver_urn)
if FV.sliceExists(slice_name):
return "ready"
else:
return "configuring"
except Exception, e:
return "failed"
示例4: getFVSliceName
# 需要导入模块: from foam.geni.db import GeniDB [as 别名]
# 或者: from foam.geni.db.GeniDB import getFlowvisorSliceName [as 别名]
def getFVSliceName (self):
if not request.json:
return
try:
self.validate(request.json, [("slice_urn", (unicode,str))])
name = GeniDB.getFlowvisorSliceName(request.json["slice_urn"])
return jsonify({"name" : name})
except JSONValidationError, e:
jd = e.__json__()
return jsonify(jd, code = 1, msg = jd["exception"])
示例5: rejectSliver
# 需要导入模块: from foam.geni.db import GeniDB [as 别名]
# 或者: from foam.geni.db.GeniDB import getFlowvisorSliceName [as 别名]
def rejectSliver (self):
if not request.json:
return
try:
self.validate(request.json, [("sliver_urn", (unicode,str))])
slice_name = GeniDB.getFlowvisorSliceName(sliver_urn=request.json["sliver_urn"])
sobj = GeniDB.getSliverObj(request.json["sliver_urn"])
data = GeniDB.getSliverData(sobj.getURN(), True)
GeniDB.setSliverStatus(request.json["sliver_urn"], False)
if FV.sliceExists(slice_name):
FV.deleteSlice(slice_name)
foam.task.emailRejectSliver(data)
return jsonify(None)
except JSONValidationError, e:
jd = e.__json__()
return jsonify(jd, code = 1, msg = jd["exception"])