Beispiel #1
0
 def __init__(self):
     self.session = scoped_session(
         sessionmaker(autocommit=False,
                      autoflush=False,
                      bind=engine,
                      expire_on_commit=False))
     self.log = KeyAdapter("GeniDB", logging.getLogger("foam"))
     if not os.path.exists(DB_PATH):
         self.__initDB()
Beispiel #2
0
    def __init__(self):
        self._session = None
        self.log = KeyAdapter("ConfigDB", logging.getLogger("foam"))

        self._updateFuncs = {None: self._writeThrough}
        self._cfgItemsByKey = {}
        self._cfgItemsByID = {}

        self._attributesByID = {}
        self._attributesByName = {}
        self._usersByID = {}
        self._usersByName = {}
        self._rolesByID = {}
        self._rolesByName = {}
        if not os.path.exists(CONFIGDB_PATH):
            self.__initDBCore()

        self.importing = False
 def __init__(self, log):
     super(AMLegExpAPI, self).__init__("legacyexpedientapi", log)
     self._actionLog = KeyAdapter("expedient",
                                  logging.getLogger('legexpapi-actions'))
     #retrieve updated dict as a json file from foam db folder
     filedir = './opt/ofelia/ofam/local/db'
     filename = os.path.join(filedir, 'expedient_slices_info.json')
     if os.path.isfile(filename):
         f = open(filename, 'r')
         self.slice_info_dict = json.load(f)
         f.close()
     else:
         self.slice_info_dict = {}
     #if ConfigDB.getConfigItemByKey("flowvisor.hostname").getValue() is None:
     self.switch_dpid_list = None
     self.link_list = None
     self.callback_http_attr_list = [
     ]  #we have multiple expedients communicating with foam!
     self.callback_cred_attr_list = [
     ]  #we have multiple expedients communicating with foam!
Beispiel #4
0
    def __init__(self, key, logger, app):
        self._log = KeyAdapter(key, logger)
        self._app = app

        for k in dir(self):
            try:
                val = getattr(self, k)
                (path, methods) = val.route
            except TypeError:
                continue
            except AttributeError:
                continue

            try:
                app.add_url_rule(path,
                                 path.replace("/", "_"),
                                 val,
                                 methods=methods)
                self._log.debug("Added route for: %s with method <%s>" %
                                (path, k))
            except Exception, e:
                self._log.exception("Adding URL Rule")
                continue
Beispiel #5
0
 def __init__(self, key, log):
     self._key = key
     self._log = KeyAdapter(key, log)
Beispiel #6
0
 def __init__ (self, log):
   super(AMAPIv1, self).__init__("GAPIv1", log)
   self._actionLog = KeyAdapter("v1", logging.getLogger('gapi-actions'))
 def __init__(self, slivers=None):
     self._log = KeyAdapter("OFELIA Approval", logging.getLogger("foam"))
     self._initCore()
     self._build(slivers)
 def __init__ (self):
   self._log = KeyAdapter("GENI-TopoDB", logging.getLogger("foam"))
   self._attachments = ConfigDB.getConfigItemByKey("site.attachments").getValue()
   self._attachmentsByDPID = {}
   for k,v in self._attachments.iteritems():
     self._attachmentsByDPID.getdefault(v.dpid, []).append(v)
Beispiel #9
0
 def __init__(self, log):
     super(AMAPIv2, self).__init__("GAPIv2", log)
     self._actionLog = KeyAdapter("v2", logging.getLogger('gapi-actions'))
     #self._auto_priority = ConfigDB.getConfigItemByKey("geni.auto-sliver-priority").getValue()
     self._auto_priority = AUTO_SLIVER_PRIORITY