VOL-1714 Fixes an issue where flow_stats reply in ofagent fails.
Change-Id: I4291db3065b320b56ab6003b4097533e5d2a7d96
diff --git a/python/ofagent/converter.py b/python/ofagent/converter.py
index d3c7bea..185fb59 100755
--- a/python/ofagent/converter.py
+++ b/python/ofagent/converter.py
@@ -166,12 +166,26 @@
elif type == pb2.OFPIT_GOTO_TABLE:
return of13.instruction.goto_table(
table_id=inst['goto_table']['table_id'])
-
+ elif type == pb2.OFPIT_WRITE_ACTIONS:
+ return of13.instruction.write_actions(
+ actions=[make_loxi_action(a)
+ for a in inst['actions']['actions']])
+ elif type == pb2.OFPIT_WRITE_METADATA:
+ if 'metadata' in inst['write_metadata']:
+ return of13.instruction.write_metadata(
+ metadata=inst['write_metadata']['metadata'])
+ else:
+ return of13.instruction.write_metadata(0)
+ elif type == pb2.OFPIT_METER:
+ return of13.instruction.meter(
+ meter_id=inst['meter']['meter_id'])
else:
raise NotImplementedError('Instruction type %d' % type)
kw['match'] = make_loxi_match(kw['match'])
- kw['instructions'] = [make_loxi_instruction(i) for i in kw['instructions']]
+ # if the flow action is drop, then the instruction is not found in the dict
+ if 'instructions' in kw:
+ kw['instructions'] = [make_loxi_instruction(i) for i in kw['instructions']]
del kw['id']
return of13.flow_stats_entry(**kw)