當前位置: 首頁>>代碼示例>>Python>>正文


Python GeniDB.commit方法代碼示例

本文整理匯總了Python中foam.geni.db.GeniDB.commit方法的典型用法代碼示例。如果您正苦於以下問題:Python GeniDB.commit方法的具體用法?Python GeniDB.commit怎麽用?Python GeniDB.commit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在foam.geni.db.GeniDB的用法示例。


在下文中一共展示了GeniDB.commit方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: approveSliver

# 需要導入模塊: from foam.geni.db import GeniDB [as 別名]
# 或者: from foam.geni.db.GeniDB import commit [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"])
開發者ID:HalasNet,項目名稱:felix,代碼行數:31,代碼來源:lib.py

示例2: disableSliver

# 需要導入模塊: from foam.geni.db import GeniDB [as 別名]
# 或者: from foam.geni.db.GeniDB import commit [as 別名]
  def disableSliver (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"], None)
      GeniDB.commit()

      if FV.sliceExists(slice_name):
        FV.deleteSlice(slice_name)

      foam.task.emailDisableSliver(data)

      return jsonify(None)
    except JSONValidationError, e:
      jd = e.__json__()
      return jsonify(jd, code = 1, msg = jd["exception"])
開發者ID:HalasNet,項目名稱:felix,代碼行數:24,代碼來源:admin.py

示例3: init

# 需要導入模塊: from foam.geni.db import GeniDB [as 別名]
# 或者: from foam.geni.db.GeniDB import commit [as 別名]
geni_apih = geni.setup(app) #Vasileios: get the returned api handlers

#here check maybe ofelia-geni api collaboration

from foam.api import gapi2
gapi2_apih = gapi2.setup(app) #Vasileios: get the returned api handlers

#modified by Vasileios, load afterwards
#from foam.api import legacyexpgapi2
#legexpgapi2_apih = legacyexpgapi2.setup(app) #Vasileios: get the returned api handlers

#modified by Vasileios, load afterwards
from foam.api import legacyexpedientapi #Vasileios: get the returned api handlers
legacyexpedientapi_apih = legacyexpedientapi.setup(app) #Vasileios: get the returned api handlers

from foam.api import sfaapi
sfaapi_apih = sfaapi.setup(app)

ConfigDB.commit()
GeniDB.commit()

def init (pm):
  pass
  #  for plugin in pm.getByInterface("foam.interface.rpc"):
  #  plugin.connect(app)

@request_started.connect_via(app)
def log_request (sender):
  app.logger.info("[REQUEST] [%s] <%s>" % (request.remote_addr, request.url))

開發者ID:HalasNet,項目名稱:felix,代碼行數:31,代碼來源:app.py


注:本文中的foam.geni.db.GeniDB.commit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。