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 <[email protected]>
---
 ryu/base/app_manager.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
index 7b44eed..e21de9b 100644
--- a/ryu/base/app_manager.py
+++ b/ryu/base/app_manager.py
@@ -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,12 @@ 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, v in Datapath.supported_ofp_version.items():
+                    if not k in cls.OFP_VERSIONS:
+                        del Datapath.supported_ofp_version[k]
+
             assert app_name not in self.applications
             app = cls(*args, **kwargs)
             register_instance(app)
-- 
1.7.4.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to