示例#1
0
文件: lib.py 项目: HalasNet/felix
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()
示例#2
0
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
0
  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"])