enable applications to specify OF versions
Some applications need to use particular OF versions. With this patch, applications can specify OF versions in the following way: class YourApplication(app_manager.RyuApp): OFP_VERSIONS = [ofproto_v1_1.OFP_VERSION, ofproto_v1_2.OFP_VERSION] Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Reviewed-by: Isaku Yamahata <yamahata@valinux.co.jp>
This commit is contained in:
parent
c9edce4872
commit
42f704f943
@ -19,6 +19,7 @@ import logging
|
||||
|
||||
from ryu import utils
|
||||
from ryu.controller.handler import register_instance
|
||||
from ryu.controller.controller import Datapath
|
||||
|
||||
LOG = logging.getLogger('ryu.base.app_manager')
|
||||
|
||||
@ -111,6 +112,15 @@ class AppManager(object):
|
||||
# Do we need to support multiple instances?
|
||||
# Yes, maybe for slicing.
|
||||
LOG.info('instantiating app %s', app_name)
|
||||
|
||||
if 'OFP_VERSIONS' in cls.__dict__:
|
||||
for k in Datapath.supported_ofp_version.keys():
|
||||
if not k in cls.OFP_VERSIONS:
|
||||
del Datapath.supported_ofp_version[k]
|
||||
|
||||
assert len(Datapath.supported_ofp_version), \
|
||||
'No OpenFlow version is available'
|
||||
|
||||
assert app_name not in self.applications
|
||||
app = cls(*args, **kwargs)
|
||||
register_instance(app)
|
||||
|
Loading…
Reference in New Issue
Block a user