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 <[email protected]>
Signed-off-by: Minoru TAKAHASHI <[email protected]>
---
ryu/lib/ofctl_v1_2.py | 16 +++++++++++++---
ryu/lib/ofctl_v1_3.py | 16 +++++++++++++---
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py
index 7308e1c..385b5ae 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 15452e6..037b04a 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)
--
1.9.1
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel