From 111bd3664b91279883d9f8e2483e436cbdcf3d38 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Fri, 28 Oct 2016 14:32:05 +0200 Subject: move port_attr from driver class to physical port class + small fixes according to code review Signed-off-by: Yaroslav Brustinov --- .../trex_control_plane/stl/trex_stl_lib/trex_stl_port.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py') diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py index 1ce21973..cec3761f 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py @@ -669,10 +669,7 @@ class Port(object): else: info['prom'] = "N/A" - if 'description' in info: - if len(info['description']) > 18: - info['description'] = info['description'][:18] - else: + if 'description' not in info: info['description'] = "N/A" if 'is_fc_supported' in info: @@ -710,7 +707,7 @@ class Port(object): info = self.get_info() return {"driver": info['driver'], - "description": info.get('description', 'N/A'), + "description": info.get('description', 'N/A')[:18], "HW src mac": info['hw_macaddr'], "SW src mac": info['src_macaddr'], "SW dst mac": info['dst_macaddr'], -- cgit 1.2.3-korg