this patch fixes the following bugs:

  - "SET_FIELD" action caused an exception at mod_flow_entry command.
  - following match fields caused an exception at get_flow_stats command:
    * mpls_label, arp_spa, arp_tpa
  - following fields in "SET_FIELD" were displayed as classes:
    * eth_dst, eth_src, vlan_vid, mpls_label
  - "arp_spa" and "arp_tpa" were not displayed as IPv4 address

Signed-off-by: Yuichi Ito <[email protected]>
---
 ryu/lib/ofctl_v1_2.py |   21 ++++++++++++++++++---
 ryu/lib/ofctl_v1_3.py |   22 +++++++++++++++++++---
 2 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py
index 2eca850..273b387 100644
--- a/ryu/lib/ofctl_v1_2.py
+++ b/ryu/lib/ofctl_v1_2.py
@@ -162,7 +162,7 @@ def action_to_str(act):
         buf = 'PUSH_MPLS:' + str(act.ethertype)
     elif action_type == ofproto_v1_2.OFPAT_POP_MPLS:
         buf = 'POP_MPLS'
-    elif action_type == ofproto_v1_2.OFPAT_OFPAT_SET_QUEUE:
+    elif action_type == ofproto_v1_2.OFPAT_SET_QUEUE:
         buf = 'SET_QUEUE:' + str(act.queue_id)
     elif action_type == ofproto_v1_2.OFPAT_GROUP:
         buf = 'GROUP:' + str(act.group_id)
@@ -171,7 +171,17 @@ def action_to_str(act):
     elif action_type == ofproto_v1_2.OFPAT_DEC_NW_TTL:
         buf = 'DEC_NW_TTL'
     elif action_type == ofproto_v1_2.OFPAT_SET_FIELD:
-        buf = 'SET_FIELD: {%s:%s}' % (act.field, act.value)
+        if isinstance(act.field, ofproto_v1_2_parser.MTEthDst):
+            field = 'eth_dst'
+        elif isinstance(act.field, ofproto_v1_2_parser.MTEthSrc):
+            field = 'eth_src'
+        elif isinstance(act.field, ofproto_v1_2_parser.MTVlanVid):
+            field = 'vlan_vid'
+        elif isinstance(act.field, ofproto_v1_2_parser.MTMplsLabel):
+            field = 'mpls_label'
+        else:
+            field = '(Unknown field)'
+        buf = 'SET_FIELD: {%s:%s}' % (field, act.value)
     else:
         buf = 'UNKNOWN'
     return buf
@@ -349,6 +359,10 @@ def match_to_str(ofmatch):
             ofproto_v1_2.OXM_OF_TCP_DST: 'tp_dst',
             ofproto_v1_2.OXM_OF_UDP_SRC: 'tp_src',
             ofproto_v1_2.OXM_OF_UDP_DST: 'tp_dst',
+            ofproto_v1_2.OXM_OF_ARP_SPA: 'arp_spa',
+            ofproto_v1_2.OXM_OF_ARP_TPA: 'arp_tpa',
+            ofproto_v1_2.OXM_OF_ARP_SPA_W: 'arp_spa',
+            ofproto_v1_2.OXM_OF_ARP_TPA_W: 'arp_tpa',
             ofproto_v1_2.OXM_OF_IPV6_SRC: 'ipv6_src',
             ofproto_v1_2.OXM_OF_IPV6_DST: 'ipv6_dst',
             ofproto_v1_2.OXM_OF_IPV6_SRC_W: 'ipv6_src',
@@ -359,7 +373,8 @@ def match_to_str(ofmatch):
         key = keys[match_field.header]
         if key == 'dl_src' or key == 'dl_dst':
             value = mac.haddr_to_str(match_field.value)
-        elif key == 'nw_src' or key == 'nw_dst':
+        elif key == 'nw_src' or key == 'nw_dst' or \
+                key == 'arp_spa' or key == 'arp_tpa':
             value = match_ip_to_str(match_field.value, match_field.mask)
         elif key == 'ipv6_src' or key == 'ipv6_dst':
             value = match_ipv6_to_str(match_field.value, match_field.mask)
diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py
index 4bb6ca2..eb9585b 100644
--- a/ryu/lib/ofctl_v1_3.py
+++ b/ryu/lib/ofctl_v1_3.py
@@ -170,7 +170,7 @@ def action_to_str(act):
         buf = 'PUSH_MPLS:' + str(act.ethertype)
     elif action_type == ofproto_v1_3.OFPAT_POP_MPLS:
         buf = 'POP_MPLS'
-    elif action_type == ofproto_v1_3.OFPAT_OFPAT_SET_QUEUE:
+    elif action_type == ofproto_v1_3.OFPAT_SET_QUEUE:
         buf = 'SET_QUEUE:' + str(act.queue_id)
     elif action_type == ofproto_v1_3.OFPAT_GROUP:
         pass
@@ -179,7 +179,17 @@ def action_to_str(act):
     elif action_type == ofproto_v1_3.OFPAT_DEC_NW_TTL:
         buf = 'DEC_NW_TTL'
     elif action_type == ofproto_v1_3.OFPAT_SET_FIELD:
-        buf = 'SET_FIELD: {%s:%s}' % (act.field, act.value)
+        if isinstance(act.field, ofproto_v1_3_parser.MTEthDst):
+            field = 'eth_dst'
+        elif isinstance(act.field, ofproto_v1_3_parser.MTEthSrc):
+            field = 'eth_src'
+        elif isinstance(act.field, ofproto_v1_3_parser.MTVlanVid):
+            field = 'vlan_vid'
+        elif isinstance(act.field, ofproto_v1_3_parser.MTMplsLabel):
+            field = 'mpls_label'
+        else:
+            field = '(Unknown field)'
+        buf = 'SET_FIELD: {%s:%s}' % (field, act.value)
     elif action_type == ofproto_v1_3.OFPAT_PUSH_PBB:
         buf = 'PUSH_PBB:' + str(act.ethertype)
     elif action_type == ofproto_v1_3.OFPAT_POP_PBB:
@@ -383,8 +393,13 @@ def match_to_str(ofmatch):
             ofproto_v1_3.OXM_OF_TCP_DST: 'tp_dst',
             ofproto_v1_3.OXM_OF_UDP_SRC: 'tp_src',
             ofproto_v1_3.OXM_OF_UDP_DST: 'tp_dst',
+            ofproto_v1_3.OXM_OF_MPLS_LABEL: 'mpls_label',
             ofproto_v1_3.OXM_OF_METADATA: 'metadata',
             ofproto_v1_3.OXM_OF_METADATA_W: 'metadata',
+            ofproto_v1_3.OXM_OF_ARP_SPA: 'arp_spa',
+            ofproto_v1_3.OXM_OF_ARP_TPA: 'arp_tpa',
+            ofproto_v1_3.OXM_OF_ARP_SPA_W: 'arp_spa',
+            ofproto_v1_3.OXM_OF_ARP_TPA_W: 'arp_tpa',
             ofproto_v1_3.OXM_OF_IPV6_SRC: 'ipv6_src',
             ofproto_v1_3.OXM_OF_IPV6_DST: 'ipv6_dst',
             ofproto_v1_3.OXM_OF_IPV6_SRC_W: 'ipv6_src',
@@ -395,7 +410,8 @@ def match_to_str(ofmatch):
         key = keys[match_field.header]
         if key == 'dl_src' or key == 'dl_dst':
             value = mac.haddr_to_str(match_field.value)
-        elif key == 'nw_src' or key == 'nw_dst':
+        elif key == 'nw_src' or key == 'nw_dst' or \
+                key == 'arp_spa' or key == 'arp_tpa':
             value = match_ip_to_str(match_field.value, match_field.mask)
         elif key == 'ipv6_src' or key == 'ipv6_dst':
             value = match_ipv6_to_str(match_field.value, match_field.mask)
-- 
1.7.10.4


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to