On Thu, Apr 25, 2013 at 04:19:22PM +0800, ?3?炯 wrote:
> Hello,
> I find that when I use ryu app ofctl_rest to check flows, there will be an
> error in method actions_to_str of ofctl_v1_0, the code as follows:
>
> def actions_to_str(acts):
> actions = []
> for a in acts:
> action_type = a.cls_action_type
>
> if action_type == ofproto_v1_0.OFPAT_OUTPUT:
> buf = 'OUTPUT:' + str(a.port)
>
> ......
>
> when I receive a action msg (e.g NXActionResubmitTable,NXActionSetTunnel,
> other
> nx_action_subtype),and these msgs do not have a member like cls_action_type.
> so it encounters an error.
NXActionHeader should derive from OFPActionVendor, not object?
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py
b/ryu/ofproto/ofproto_v1_0_parser.py
index 7945888..b1fe52d 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -394,7 +394,7 @@ class OFPActionVendor(OFPAction):
@OFPActionVendor.register_action_vendor(ofproto_v1_0.NX_VENDOR_ID)
-class NXActionHeader(object):
+class NXActionHeader(OFPActionVendor):
_NX_ACTION_SUBTYPES = {}
@staticmethod
@@ -406,9 +406,8 @@ class NXActionHeader(object):
return _register_nx_action_subtype
def __init__(self, subtype_, len_):
- self.type = ofproto_v1_0.OFPAT_VENDOR
+ super(NXActionHeader, self).__init__(ofproto_v1_0.NX_VENDOR_ID)
self.len = len_
- self.vendor = ofproto_v1_0.NX_VENDOR_ID
self.subtype = subtype_
def serialize(self, buf, offset):
---------------------------------------------------------------------------
thanks,
> I don't know if there are proper ways to fix it ,and my solution is as
> follows:
> ---------------------------------------
> diff --git a/ryu/lib/ofctl_v1_0.py b/ryu/lib/ofctl_v1_0.py
> index ad47470..ca9d207 100644
> --- a/ryu/lib/ofctl_v1_0.py
> +++ b/ryu/lib/ofctl_v1_0.py
> @@ -71,6 +71,12 @@ def actions_to_str(acts):
> buf = 'SET_DL_SRC:' + haddr_to_str(a.dl_addr)
> elif action_type == ofproto_v1_0.OFPAT_SET_DL_DST:
> buf = 'SET_DL_DST:' + haddr_to_str(a.dl_addr)
> + elif action_type == ofproto_v1_0.OFPAT_VENDOR:
> + action_subtype = a.cls_subtype
> + if action_subtype == ofproto_v1_0.NXAST_RESUBMIT:
> + pass #TODO
> + else:
> + pass
> else:
> buf = 'UNKNOWN'
> actions.append(buf)
> diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/
> ofproto_v1_0_parse
> index 7945888..ede1b13 100644
> --- a/ryu/ofproto/ofproto_v1_0_parser.py
> +++ b/ryu/ofproto/ofproto_v1_0_parser.py
> @@ -400,6 +400,7 @@ class NXActionHeader(object):
> @staticmethod
> def register_nx_action_subtype(subtype):
> def _register_nx_action_subtype(cls):
> + cls.cls_action_type = ofproto_v1_0.OFPAT_VENDOR
> cls.cls_subtype = subtype
> NXActionHeader._NX_ACTION_SUBTYPES[cls.cls_subtype] = cls
> return cls
>
>
>
> Best regards,
> Joe
>
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
--
yamahata
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel