summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMinoru TAKAHASHI <takahashi.minoru7@gmail.com>2015-09-02 13:20:28 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-09-03 22:26:57 +0900
commit22387e09e41e5319978f47b04796067e2e6da3f7 (patch)
tree50eea0c12078db06a14513cff23c9e016b995357
parent2701fa129fa3fa7a8752a740c32453a424123891 (diff)
ofctl_v1_[23]: Fix the output result of get_flow_stats()
Add flows OFPIT_APPLY_ACTIONS and OFPIT_WRITE_ACTIONS and OFPIT_CLEAR_ACTIONS as the type of instructions, respectively. Then, the output results of get_flow_stats() are the same. This patch fix this problem. before applying this patch: * case OFPIT_APPLY_ACTIONS and OFPIT_WRITE_ACTIONS { "1": [ { "actions": [ "OUTPUT:2", "OUTPUT:3" ], ... } ] } * case OFPIT_CLEAR_ACTIONS { "1": [ { "actions": [], ... } ] } after apply this patch: * case OFPIT_APPLY_ACTIONS { "1": [ { "actions": [ "OUTPUT:2", "OUTPUT:3" ], ... } ] } * case OFPIT_WRITE_ACTIONS { "1": [ { "actions": [ { "WRITE_ACTIONS": [ "OUTPUT:4", "OUTPUT:5" ] } ], ... } ] } * case OFPIT_CLEAR_ACTIONS { "1": [ { "actions": [ "CLEAR_ACTIONS" ], ... } ] } Reported-by: Liu, Weijie <wliu43@illinois.edu> Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/lib/ofctl_v1_2.py16
-rw-r--r--ryu/lib/ofctl_v1_3.py16
2 files changed, 26 insertions, 6 deletions
diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py
index 7308e1c1..385b5ae3 100644
--- a/ryu/lib/ofctl_v1_2.py
+++ b/ryu/lib/ofctl_v1_2.py
@@ -163,9 +163,19 @@ def actions_to_str(instructions):
for instruction in instructions:
if isinstance(instruction,
ofproto_v1_2_parser.OFPInstructionActions):
- for a in instruction.actions:
- actions.append(action_to_str(a))
-
+ if instruction.type == ofproto_v1_2.OFPIT_APPLY_ACTIONS:
+ for a in instruction.actions:
+ actions.append(action_to_str(a))
+ elif instruction.type == ofproto_v1_2.OFPIT_WRITE_ACTIONS:
+ write_actions = []
+ for a in instruction.actions:
+ write_actions.append(action_to_str(a))
+ if write_actions:
+ actions.append({'WRITE_ACTIONS': write_actions})
+ elif instruction.type == ofproto_v1_2.OFPIT_CLEAR_ACTIONS:
+ actions.append('CLEAR_ACTIONS')
+ else:
+ actions.append('UNKNOWN')
elif isinstance(instruction,
ofproto_v1_2_parser.OFPInstructionGotoTable):
buf = 'GOTO_TABLE:' + str(instruction.table_id)
diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py
index 15452e6e..037b04ad 100644
--- a/ryu/lib/ofctl_v1_3.py
+++ b/ryu/lib/ofctl_v1_3.py
@@ -175,9 +175,19 @@ def actions_to_str(instructions):
for instruction in instructions:
if isinstance(instruction,
ofproto_v1_3_parser.OFPInstructionActions):
- for a in instruction.actions:
- actions.append(action_to_str(a))
-
+ if instruction.type == ofproto_v1_3.OFPIT_APPLY_ACTIONS:
+ for a in instruction.actions:
+ actions.append(action_to_str(a))
+ elif instruction.type == ofproto_v1_3.OFPIT_WRITE_ACTIONS:
+ write_actions = []
+ for a in instruction.actions:
+ write_actions.append(action_to_str(a))
+ if write_actions:
+ actions.append({'WRITE_ACTIONS': write_actions})
+ elif instruction.type == ofproto_v1_3.OFPIT_CLEAR_ACTIONS:
+ actions.append('CLEAR_ACTIONS')
+ else:
+ actions.append('UNKNOWN')
elif isinstance(instruction,
ofproto_v1_3_parser.OFPInstructionGotoTable):
buf = 'GOTO_TABLE:' + str(instruction.table_id)