示例#1
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self._manage_conns
     self.routines.append(self.apiroutine)
     self.managed_conns = {}
     self.endpoint_conns = {}
     self.table_modules = set()
     self._acquiring = False
     self._acquire_updated = False
     self._lastacquire = None
     self._synchronized = False
     self.createAPI(api(self.getconnections, self.apiroutine),
                    api(self.getconnection, self.apiroutine),
                    api(self.waitconnection, self.apiroutine),
                    api(self.getdatapathids, self.apiroutine),
                    api(self.getalldatapathids, self.apiroutine),
                    api(self.getallconnections, self.apiroutine),
                    api(self.getconnectionsbyendpoint, self.apiroutine),
                    api(self.getconnectionsbyendpointname, self.apiroutine),
                    api(self.getendpoints, self.apiroutine),
                    api(self.getallendpoints, self.apiroutine),
                    api(self.acquiretable, self.apiroutine),
                    api(self.unacquiretable, self.apiroutine),
                    api(self.lastacquiredtables)
                    )
示例#2
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.client = ZooKeeperClient(self.apiroutine, self.serverlist)
     self.connections.append(self.client)
     self.apiroutine.main = self.main
     self.routines.append(self.apiroutine)
示例#3
0
 def __init__(self, server):
     Module.__init__(self, server)
     self._managed_objs = {}
     self._watches = {}
     self._watchedkeys = set()
     self._requests = []
     self._transactno = 0
     self._stale = False
     self._updatekeys = set()
     self._update_version = {}
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self._update
     self.routines.append(self.apiroutine)
     self.createAPI(api(self.mget, self.apiroutine),
                    api(self.get, self.apiroutine),
                    api(self.mgetonce, self.apiroutine),
                    api(self.getonce, self.apiroutine),
                    api(self.mwatch, self.apiroutine),
                    api(self.watch, self.apiroutine),
                    api(self.munwatch, self.apiroutine),
                    api(self.unwatch, self.apiroutine),
                    api(self.unwatchall, self.apiroutine),
                    api(self.transact, self.apiroutine),
                    api(self.watchlist),
                    api(self.walk, self.apiroutine)
                    )
示例#4
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self._manage_conns
     self.routines.append(self.apiroutine)
     self.managed_conns = {}
     self.managed_systemids = {}
     self.managed_bridges = {}
     self.managed_routines = []
     self.endpoint_conns = {}
     self.createAPI(api(self.getconnection, self.apiroutine),
                    api(self.waitconnection, self.apiroutine),
                    api(self.getdatapathids, self.apiroutine),
                    api(self.getalldatapathids, self.apiroutine),
                    api(self.getallconnections, self.apiroutine),
                    api(self.getbridges, self.apiroutine),
                    api(self.getbridge, self.apiroutine),
                    api(self.getbridgebyuuid, self.apiroutine),
                    api(self.waitbridge, self.apiroutine),
                    api(self.waitbridgebyuuid, self.apiroutine),
                    api(self.getsystemids, self.apiroutine),
                    api(self.getallsystemids, self.apiroutine),
                    api(self.getconnectionbysystemid, self.apiroutine),
                    api(self.waitconnectionbysystemid, self.apiroutine),
                    api(self.getconnectionsbyendpoint, self.apiroutine),
                    api(self.getconnectionsbyendpointname, self.apiroutine),
                    api(self.getendpoints, self.apiroutine),
                    api(self.getallendpoints, self.apiroutine),
                    api(self.getallbridges, self.apiroutine),
                    api(self.getbridgeinfo, self.apiroutine),
                    api(self.waitbridgeinfo, self.apiroutine)
                    )
     self._synchronized = False
示例#5
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.protocol = ZooKeeper()
     self.client = Client(self.url, self.protocol, self.scheduler)
     self.connections.append(self.client)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self.main
     self.routines.append(self.apiroutine)
示例#6
0
 def __init__(self, server, protocolclass):
     Module.__init__(self, server)
     self._protocolclass = protocolclass
     self.apiroutine = RoutineContainer(self.scheduler)
     self.managed_connections = set()
     self._createServers(self, '')
     self.createAPI(api(self.getservers),
                    api(self.stoplisten, self.apiroutine),
                    api(self.startlisten, self.apiroutine),
                    api(self.updateconfig, self.apiroutine),
                    api(self.getconnections))
示例#7
0
文件: script.py 项目: dq5070410/vlcp
 def __init__(self, server):
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     def _main():
         try:
             for m in self.run(*self.args, **self.kwargs):
                 yield m
         finally:
             self.scheduler.quit()
     self.apiroutine.main = _main
     self.routines.append(self.apiroutine)
示例#8
0
文件: session.py 项目: hubo1016/vlcp
 def __init__(self, server):
     """
     Constructor
     """
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.createAPI(
         api(self.start, self.apiroutine),
         api(self.create, self.apiroutine),
         api(self.get, self.apiroutine),
         api(self.destroy, self.apiroutine),
     )
示例#9
0
文件: static.py 项目: hubo1016/vlcp
 def __init__(self, server):
     Module.__init__(self, server)
     self.dispatcher = Dispatcher(self.scheduler)
     self.mimetypedatabase = mimetypes.MimeTypes(self.mimetypes)
     self._cache = {}
     self.apiroutine = RoutineContainer(self.scheduler)
     self.lastcleartime = 0
     def start(asyncStart = False):
         self._createHandlers(self)
     def close():
         self.dispatcher.close()
     self.apiroutine.start = start
     self.apiroutine.close = close
     self.routines.append(self.apiroutine)
     self.createAPI(api(self.updateconfig))
示例#10
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self._manage_ports
     self.routines.append(self.apiroutine)
     self.managed_ports = {}
     self.createAPI(api(self.getports, self.apiroutine),
                    api(self.getallports, self.apiroutine),
                    api(self.getportbyno, self.apiroutine),
                    api(self.waitportbyno, self.apiroutine),
                    api(self.getportbyname, self.apiroutine),
                    api(self.waitportbyname, self.apiroutine),
                    api(self.resync, self.apiroutine)
                    )
     self._synchronized = False
示例#11
0
文件: autoload.py 项目: hubo1016/vlcp
 def load(self, container):
     for m in Module.load(self, container):
         yield m
     loadmodules = []
     for p in self.autoloadpackages:
         try:
             def onerror(name):
                 self._logger.warning("Autoload package %r on package %r failed", name, p)
             pkg = __import__(p, fromlist = ('dummy',))
             for _, name, ispkg in pkgutil.walk_packages(pkg.__path__, p + '.', onerror):
                 if not ispkg:
                     try:
                         pymod = __import__(name, fromlist = ('dummy',))
                         for m in vars(pymod).values():
                             if isinstance(m, type) and issubclass(m, Module) and getattr(m, '__module__', '') == name:
                                 loadmodules.append(m)
                     except Exception:
                         self._logger.warning('Autoload module %r failed', name, exc_info = True)
         except Exception:
             self._logger.warning('Autoload package %r failed', p, exc_info = True)
     if loadmodules:
         for m in container.executeAll([self.server.moduleloader.loadmodule(m) for m in loadmodules],
                                       self.server.moduleloader, ()):
             yield m
     for m in self.changestate(ModuleLoadStateChanged.LOADED, container):
         yield m
示例#12
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self._main
     self.routines.append(self.apiroutine)
     self._reqid = 0
     self._ownerid = uuid1().hex
     self.createAPI(api(self.createlogicalnetwork, self.apiroutine),
                    api(self.createlogicalnetworks, self.apiroutine),
                    api(self.createphysicalnetwork, self.apiroutine),
                    api(self.createphysicalnetworks, self.apiroutine),
                    api(self.createphysicalport, self.apiroutine),
                    api(self.createphysicalports, self.apiroutine),
                    api(self.createlogicalport, self.apiroutine),
                    api(self.createlogicalports, self.apiroutine),
                    api(self.getlogicalnetworks, self.apiroutine))
     self._logger.setLevel(logging.DEBUG)
示例#13
0
 def __init__(self, server):
     """
     Constructor
     """
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self._autoreload
     self._lastcheck = time()
     if self.autoreload:
         self.routines.append(self.apiroutine)
     self.createAPI(
         api(self.enableAutoReload),
         api(self.activeModules),
         api(self.reloadmodules, self.apiroutine),
         api(self.loadmodule, self.apiroutine),
         api(self.unloadmodule, self.apiroutine),
     )
示例#14
0
 def load(self, container):
     self.scheduler.queue.addSubQueue(\
             self.objectupdatepriority, dataobj.DataObjectUpdateEvent.createMatcher(), 'dataobjectupdate')
     for m in callAPI(container, 'updatenotifier', 'createnotifier'):
         yield m
     self._notifier = container.retvalue
     for m in Module.load(self, container):
         yield m
     self.routines.append(self._notifier)
示例#15
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self._manage_ports
     self.routines.append(self.apiroutine)
     self.managed_ports = {}
     self.managed_ids = {}
     self.monitor_routines = set()
     self.ports_uuids = {}
     self.wait_portnos = {}
     self.wait_names = {}
     self.wait_ids = {}
     self.bridge_datapathid = {}
     self.createAPI(api(self.getports, self.apiroutine),
                    api(self.getallports, self.apiroutine),
                    api(self.getportbyid, self.apiroutine),
                    api(self.waitportbyid, self.apiroutine),
                    api(self.getportbyname, self.apiroutine),
                    api(self.waitportbyname, self.apiroutine),
                    api(self.getportbyno, self.apiroutine),
                    api(self.waitportbyno, self.apiroutine),
                    api(self.resync, self.apiroutine)
                    )
     self._synchronized = False
示例#16
0
文件: console.py 项目: dq5070410/vlcp
 def __init__(self, server):
     '''
     Constructor
     '''
     Module.__init__(self, server)
     self._ce_matcher = ConsoleEvent.createMatcher()
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self._service_routine
     self._restore_console_event = threading.Event()
     @generator_to_async(True, False)
     def proxy(event, matcher):
         while True:
             events = self.sendEventQueue.get()
             if events is None:
                 break
             yield events
     @async_to_async(True, False)
     @async_processor
     def processor(event, matcher, queueout):
         if event.type == 'initproxy':
             proxy(event, matcher, queueout)
     self.connector = Connector(processor, (self._ce_matcher,), self.scheduler, False)
     self.routines.append(self.apiroutine)
     self.routines.append(self.connector)
示例#17
0
    def load(self, container):
        for m in Module.load(self, container):
            yield m
        loadmodules = []
        for p in self.autoloadpackages:
            try:

                def onerror(name):
                    self._logger.warning(
                        "Autoload package %r on package %r failed", name, p)

                pkg = __import__(p, fromlist=('dummy', ))
                for _, name, ispkg in pkgutil.walk_packages(
                        pkg.__path__, p + '.', onerror):
                    if not ispkg:
                        try:
                            pymod = __import__(name, fromlist=('dummy', ))
                            for m in vars(pymod).values():
                                if isinstance(m, type) and issubclass(
                                        m, Module) and getattr(
                                            m, '__module__', '') == name:
                                    loadmodules.append(m)
                        except Exception:
                            self._logger.warning('Autoload module %r failed',
                                                 name,
                                                 exc_info=True)
            except Exception:
                self._logger.warning('Autoload package %r failed',
                                     p,
                                     exc_info=True)
        if loadmodules:
            for m in container.executeAll(
                [self.server.moduleloader.loadmodule(m) for m in loadmodules],
                    self.server.moduleloader, ()):
                yield m
        for m in self.changestate(ModuleLoadStateChanged.LOADED, container):
            yield m
示例#18
0
 def load(self, container):
     @updater
     def initialize(phynetset, lognetset, logportset, phyportset):
         if phynetset is None:
             phynetset = PhysicalNetworkSet()
             phynetset.set = DataObjectSet()
         if lognetset is None:
             lognetset = LogicalNetworkSet()
             lognetset.set = DataObjectSet()
         if logportset is None:
             logportset = LogicalPortSet()
             logportset.set = DataObjectSet()
         if phyportset is None:
             phyportset = PhysicalPortSet()
             phyportset.set = DataObjectSet()
         return [phynetset, lognetset, logportset, phyportset]
     for m in callAPI(container, 'objectdb', 'transact', {'keys':[PhysicalNetworkSet.default_key(),
                                                                LogicalNetworkSet.default_key(),
                                                                LogicalPortSet.default_key(),
                                                                PhysicalPortSet.default_key()],
                                                          'updater': initialize}):
         yield m
     for m in Module.load(self, container):
         yield m
示例#19
0
文件: autoload.py 项目: hubo1016/vlcp
 def unload(self, container, force=False):
     for m in Module.unload(self, container, force=force):
         yield m
示例#20
0
 def unload(self, container, force=False):
     for m in Module.unload(self, container, force=force):
         yield m
示例#21
0
 def unload(self, container, force=False):
     if self.connmanage:
         self.connections.extend(self.managed_connections)
         self.managed_connections.clear()
     for m in Module.unload(self, container, force=force):
         yield m
示例#22
0
 def unload(self, container, force=False):
     for m in Module.unload(self, container, force=force):
         yield m
     for m in container.syscall_noreturn(syscall_removequeue(self.scheduler.queue, "redisnotifier_modifylisten")):
         yield m
示例#23
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.createAPI(api(self.createnotifier))
示例#24
0
 def unload(self, container, force=False):
     for m in container.syscall(
             syscall_removequeue(self.scheduler.queue, 'dataobjectupdate')):
         yield m
     for m in Module.unload(self, container, force=force):
         yield m
示例#25
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self.main
     self.routines.append(self.apiroutine)
示例#26
0
文件: server.py 项目: hubo1016/vlcp
 def __init__(self, server):
     Module.__init__(self, server)
     # Should consider to use a subclass of vlcp.service.connection.tcpserver.TcpServerBase
     self.connections.append(TcpServer(self.url, MyProtocol(), self.scheduler))
     self.routines.append(MyServer(self.scheduler))
示例#27
0
 def unload(self, container, force=False):
     for m in Module.unload(self, container, force=force):
         yield m
     for m in container.syscall(syscall_removequeue(self.scheduler.queue, 'ofpmanager_tableacquiredelay')):
         yield m
示例#28
0
文件: flowbase.py 项目: hubo1016/vlcp
 def __init__(self, server):
     Module.__init__(self, server)
     self._tableacquire_routine = RoutineContainer(self.scheduler)
     self._tableacquire_routine.main = self._acquiretable
     self.routines.append(self._tableacquire_routine)
     self.createAPI(api(self.gettablerequest))
示例#29
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.apiroutine = RoutineContainer(self.scheduler)
     self.apiroutine.main = self.main
     self.routines.append(self.apiroutine)
示例#30
0
文件: flowbase.py 项目: vtanrun/vlcp
 def __init__(self, server):
     Module.__init__(self, server)
     self._tableacquire_routine = RoutineContainer(self.scheduler)
     self._tableacquire_routine.main = self._acquiretable
     self.routines.append(self._tableacquire_routine)
     self.createAPI(api(self.gettablerequest))
示例#31
0
文件: autoload.py 项目: sinofeng/vlcp
 def __init__(self, server):
     Module.__init__(self, server)
示例#32
0
文件: server.py 项目: sinofeng/vlcp
 def __init__(self, server):
     Module.__init__(self, server)
     # Should consider to use a subclass of vlcp.service.connection.tcpserver.TcpServerBase
     self.connections.append(
         TcpServer(self.url, MyProtocol(), self.scheduler))
     self.routines.append(MyServer(self.scheduler))
示例#33
0
 def unload(self, container, force=False):
     if self.connmanage:
         self.connections.extend(self.managed_connections)
         self.managed_connections.clear()
     for m in Module.unload(self, container, force=force):
         yield m
示例#34
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.client = RedisClient()
     self.routines.append(MainRoutine(self.client, self.scheduler))
示例#35
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.createAPI(api(self.createnotifier))
示例#36
0
文件: webapi.py 项目: missuzhang/vlcp
 def __init__(self, server):
     '''
     Constructor
     '''
     Module.__init__(self, server)
     self.routines.append(WebAPIHandler(self))
示例#37
0
 def load(self, container):
     self.scheduler.queue.addSubQueue(999, ModifyListen.createMatcher(),
                                      "redisnotifier_modifylisten")
     for m in Module.load(self, container):
         yield m
示例#38
0
 def load(self, container):
     self.scheduler.queue.addSubQueue(999, ModifyListen.createMatcher(), "redisnotifier_modifylisten")
     for m in Module.load(self, container):
         yield m
示例#39
0
文件: autoload.py 项目: hubo1016/vlcp
 def __init__(self, server):
     Module.__init__(self, server)
示例#40
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.routines.append(MainHandler(self.scheduler))
示例#41
0
 def __init__(self, server):
     Module.__init__(self, server)
     self.routines.append(MainRoutine(self.scheduler))
示例#42
0
 def load(self, container):
     self.scheduler.queue.addSubQueue(1, TableAcquireDelayEvent.createMatcher(), 'ofpmanager_tableacquiredelay')
     for m in container.waitForSend(TableAcquireUpdate(result = None)):
         yield m
     for m in Module.load(self, container):
         yield m
示例#43
0
 def unload(self, container, force=False):
     for m in container.syscall(syscall_removequeue(self.scheduler.queue, 'dataobjectupdate')):
         yield m
     for m in Module.unload(self, container, force=force):
         yield m