Updates to the cli to clean up table handling when all fields are
available from protobuf. All tables should look the way they did before
the cli changes for performance management.
Change-Id: I28ab15eea063db475f1ba689ff01eb1a15a39f86
diff --git a/cli/device.py b/cli/device.py
index adef6ff..05f97c9 100644
--- a/cli/device.py
+++ b/cli/device.py
@@ -75,13 +75,28 @@
def do_show(self, line):
"""Show detailed device information"""
+ omit_fields = {
+ 'pm_configs',
+ 'flows',
+ 'flow_groups',
+ 'ports',
+ 'parent_port_no',
+ 'reason',
+ 'vlan',
+ 'parent_id',
+ 'root',
+ 'type',
+ 'vendor',
+ 'id'
+ }
print_pb_as_table('Device {}'.format(self.device_id),
- self.get_device(depth=-1))
+ self.get_device(depth=-1), omit_fields)
def do_ports(self, line):
"""Show ports of device"""
device = self.get_device(depth=-1)
omit_fields = {
+ 'peers'
}
print_pb_list_as_table('Device ports:', device.ports,
omit_fields, self.poutput)
diff --git a/cli/logical_device.py b/cli/logical_device.py
index 46b1865..24508df 100644
--- a/cli/logical_device.py
+++ b/cli/logical_device.py
@@ -63,8 +63,24 @@
def do_show(self, _):
"""Show detailed logical device information"""
+ omit_fields = {
+ 'flow_groups',
+ 'flows',
+ 'ports',
+ 'switch_features.auxiliary_id',
+ 'switch_features.capabilities',
+ 'switch_features.datapath_id',
+ 'switch_features.n_buffers',
+ 'switch_features.n_tables',
+ 'desc.dp_desc',
+ 'desc.hw_desc',
+ 'desc.mfr_desc',
+ 'desc.serial_num',
+ 'desc.sw_desc',
+ 'datapath_id'
+ }
print_pb_as_table('Logical device {}'.format(self.logical_device_id),
- self.get_logical_device(depth=-1))
+ self.get_logical_device(depth=-1), omit_fields)
def do_ports(self, _):
"""Show ports of logical device"""
@@ -103,7 +119,13 @@
'hardware_version',
'software_version',
'firmware_version',
- 'serial_number'
+ 'serial_number',
+ 'parent_port_no',
+ 'vlan',
+ 'ports',
+ 'reason',
+ 'root',
+ 'parent_id'
}
print_pb_list_as_table('Devices:', devices, omit_fields, self.poutput)
diff --git a/cli/main.py b/cli/main.py
index ec84bf5..c31000c 100755
--- a/cli/main.py
+++ b/cli/main.py
@@ -176,7 +176,13 @@
'hardware_version',
'software_version',
'firmware_version',
- 'serial_number'
+ 'serial_number',
+ 'parent_port_no',
+ 'vlan',
+ 'ports',
+ 'reason',
+ 'root',
+ 'parent_id'
}
print_pb_list_as_table('Devices:', devices, omit_fields, self.poutput)
@@ -190,7 +196,13 @@
'desc.sw_desc',
'desc.dp_desc',
'desc.serial_number',
- 'switch_features.capabilities'
+ 'desc.serial_num',
+ 'switch_features.n_buffers',
+ 'switch_features.n_tables',
+ 'switch_features.auxiliary_id',
+ 'switch_features.datapath_id',
+ 'switch_features.capabilities',
+ 'ports'
}
print_pb_list_as_table('Logical devices:', res.items, omit_fields,
self.poutput)
diff --git a/cli/table.py b/cli/table.py
index fd25c69..1a1f576 100644
--- a/cli/table.py
+++ b/cli/table.py
@@ -85,8 +85,8 @@
if field_key not in self.field_names:
self.field_names[field_key] = field_name
self._update_max_length(field_key, field_name)
- #else:
- # assert self.field_names[field_key] == field_name
+ else:
+ assert self.field_names[field_key] == field_name
def print_pb_list_as_table(header, items, fields_to_omit=None,