Hi,

I summit the second patch according to your suggestion.

Thanks,
tungyueh

Iwase Yusuke <[email protected]> 於 2016年8月29日 週一 上午9:43寫道:

> Hi,
>
> Thank you for submitting your patch!
>
>
> > diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py
> > index f407e5a..44f611a 100644
> > --- a/ryu/lib/ofctl_v1_3.py
> > +++ b/ryu/lib/ofctl_v1_3.py
> > @@ -1152,5 +1152,11 @@ def mod_port_behavior(dp, port_config):
> >      ofctl_utils.send_msg(dp, port_mod, LOG)
> >
> >
> > +def set_role(dp, role):
> > +    r = UTIL.ofp_role_from_user(role.get('role',
> dp.ofproto.OFPCR_ROLE_MASTER))
> > +    role_request = dp.ofproto_parser.OFPRoleRequest(dp, r, 0)
> > +    ofctl_utils.send_msg(dp, role_request, LOG)
> > +
> > +
> >  # NOTE(jkoelker) Alias common funcitons
> >  send_experimenter = ofctl_utils.send_experimenter
>
> The implementation for UTIL.ofp_role_from_user() seems not be included in
> your patch.
> And, the default role in OpenFlow is "OFPCR_ROLE_EQUAL",
> so specifying "OFPCR_ROLE_EQUAL" is more safe in this case, I guess.
>
> FYI, the following is an example for UTIL.ofp_role_from_user().
> Could you test and merge this into your patch?
>
> diff --git a/ryu/lib/ofctl_utils.py b/ryu/lib/ofctl_utils.py
> index a09517a..fd8dfc0 100644
> --- a/ryu/lib/ofctl_utils.py
> +++ b/ryu/lib/ofctl_utils.py
> @@ -424,3 +424,9 @@ class OFCtlUtil(object):
>
>       def ofp_queue_to_user(self, queue):
>           return self._reserved_num_to_user(queue, 'OFPQ_')
> +
> +    def ofp_role_from_user(self, role):
> +        return self._reserved_num_from_user(role, 'OFPCR_ROLE_')
> +
> +    def ofp_role_to_user(self, role):
> +        return self._reserved_num_to_user(role, 'OFPCR_ROLE_')
>
>
> Thanks,
> Iwase
>
>
> On 2016年08月25日 17:03, 林東岳 wrote:
> > Hi,
> >     Attachment is my patch.
> > tungyueh
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> >
> >
> >
> > _______________________________________________
> > Ryu-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/ryu-devel
> >
>
From 8cb2da767e990578ce846e95720a848dac5aff7a Mon Sep 17 00:00:00 2001
From: tungyueh <[email protected]>
Date: Mon, 29 Aug 2016 11:18:53 +0800
Subject: [PATCH 2/2] let default role to be equal

Signed-off-by: tungyueh <[email protected]>
---
 ryu/lib/ofctl_utils.py | 3 +++
 ryu/lib/ofctl_v1_2.py  | 2 +-
 ryu/lib/ofctl_v1_3.py  | 2 +-
 ryu/lib/ofctl_v1_4.py  | 2 +-
 ryu/lib/ofctl_v1_5.py  | 2 +-
 5 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ryu/lib/ofctl_utils.py b/ryu/lib/ofctl_utils.py
index a09517a..9104013 100644
--- a/ryu/lib/ofctl_utils.py
+++ b/ryu/lib/ofctl_utils.py
@@ -424,3 +424,6 @@ class OFCtlUtil(object):
 
     def ofp_queue_to_user(self, queue):
         return self._reserved_num_to_user(queue, 'OFPQ_')
+
+    def ofp_role_from_user(self, role):
+        return self._reserved_num_from_user(role, 'OFPCR_ROLE_')
diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py
index bfc3581..3ba1eb4 100644
--- a/ryu/lib/ofctl_v1_2.py
+++ b/ryu/lib/ofctl_v1_2.py
@@ -927,7 +927,7 @@ def mod_port_behavior(dp, port_config):
 
 
 def set_role(dp, role):
-    r = UTIL.ofp_role_from_user(role.get('role', dp.ofproto.OFPCR_ROLE_MASTER))
+    r = UTIL.ofp_role_from_user(role.get('role', dp.ofproto.OFPCR_ROLE_EQUAL))
     role_request = dp.ofproto_parser.OFPRoleRequest(dp, r, 0)
     ofctl_utils.send_msg(dp, role_request, LOG)
 
diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py
index 44f611a..3cac36d 100644
--- a/ryu/lib/ofctl_v1_3.py
+++ b/ryu/lib/ofctl_v1_3.py
@@ -1153,7 +1153,7 @@ def mod_port_behavior(dp, port_config):
 
 
 def set_role(dp, role):
-    r = UTIL.ofp_role_from_user(role.get('role', dp.ofproto.OFPCR_ROLE_MASTER))
+    r = UTIL.ofp_role_from_user(role.get('role', dp.ofproto.OFPCR_ROLE_EQUAL))
     role_request = dp.ofproto_parser.OFPRoleRequest(dp, r, 0)
     ofctl_utils.send_msg(dp, role_request, LOG)
 
diff --git a/ryu/lib/ofctl_v1_4.py b/ryu/lib/ofctl_v1_4.py
index ed7d7c2..e53cc81 100644
--- a/ryu/lib/ofctl_v1_4.py
+++ b/ryu/lib/ofctl_v1_4.py
@@ -940,7 +940,7 @@ def mod_port_behavior(dp, port_config):
 
 
 def set_role(dp, role):
-    r = UTIL.ofp_role_from_user(role.get('role', dp.ofproto.OFPCR_ROLE_MASTER))
+    r = UTIL.ofp_role_from_user(role.get('role', dp.ofproto.OFPCR_ROLE_EQUAL))
     role_request = dp.ofproto_parser.OFPRoleRequest(dp, r, 0)
     ofctl_utils.send_msg(dp, role_request, LOG)
 
diff --git a/ryu/lib/ofctl_v1_5.py b/ryu/lib/ofctl_v1_5.py
index 67459a8..867a39e 100644
--- a/ryu/lib/ofctl_v1_5.py
+++ b/ryu/lib/ofctl_v1_5.py
@@ -1085,7 +1085,7 @@ def mod_port_behavior(dp, port_config):
 
 
 def set_role(dp, role):
-    r = UTIL.ofp_role_from_user(role.get('role', dp.ofproto.OFPCR_ROLE_MASTER))
+    r = UTIL.ofp_role_from_user(role.get('role', dp.ofproto.OFPCR_ROLE_EQUAL))
     role_request = dp.ofproto_parser.OFPRoleRequest(dp, r, 0)
     ofctl_utils.send_msg(dp, role_request, LOG)
 
-- 
2.7.4

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to