Two Extra Columns Are Removed From Flow-table of Device
Change-Id: I10823b94a5e4c87567eab8e53b65d8123f5649a7
diff --git a/cli/utils.py b/cli/utils.py
index 82d6a12..de03759 100644
--- a/cli/utils.py
+++ b/cli/utils.py
@@ -111,7 +111,7 @@
}
-def print_flows(what, id, type, flows, groups, printfn=_printfn):
+def print_flows(what, id, type, flows, groups, printfn=_printfn, fields_to_omit=[]):
header = ''.join([
'{} '.format(what),
@@ -124,9 +124,14 @@
table = TablePrinter()
for i, flow in enumerate(flows):
- table.add_cell(i, 0, 'table_id', value=str(flow['table_id']))
- table.add_cell(i, 1, 'priority', value=str(flow['priority']))
- table.add_cell(i, 2, 'cookie', p_cookie(flow['cookie']))
+ if 'table_id' not in fields_to_omit:
+ table.add_cell(i, 0, 'table_id', value=str(flow['table_id']))
+
+ if 'priority' not in fields_to_omit:
+ table.add_cell(i, 1, 'priority', value=str(flow['priority']))
+
+ if 'cookie' not in fields_to_omit:
+ table.add_cell(i, 2, 'cookie', p_cookie(flow['cookie']))
assert flow['match']['type'] == 'OFPMT_OXM'
for field in flow['match']['oxm_fields']:
@@ -142,16 +147,20 @@
atype = action['type'][len('OFPAT_'):]
table.add_cell(i, *action_printers[atype](action))
elif itype == 1:
- table.add_cell(i, 10000, 'goto-table',
- instruction['goto_table']['table_id'])
+ if 'goto-table' not in fields_to_omit:
+ table.add_cell(i, 10000, 'goto-table',
+ instruction['goto_table']['table_id'])
elif itype == 2:
- table.add_cell(i, 10001, 'write-metadata',
- instruction['write_metadata']['metadata'])
+ if 'write-metadata' not in fields_to_omit:
+ table.add_cell(i, 10001, 'write-metadata',
+ instruction['write_metadata']['metadata'])
elif itype == 5:
- table.add_cell(i, 10002, 'clear-actions', [])
+ if 'clear-actions' not in fields_to_omit:
+ table.add_cell(i, 10002, 'clear-actions', [])
elif itype == 6:
- table.add_cell(i, 10003, 'meter',
- instruction['meter']['meter_id'])
+ if 'meter' not in fields_to_omit:
+ table.add_cell(i, 10003, 'meter',
+ instruction['meter']['meter_id'])
else:
raise NotImplementedError(
'not handling instruction type {}'.format(itype))