diff options
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py | 27 |
1 files changed, 21 insertions, 6 deletions
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 8d542b35..ef454b8c 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 @@ -473,9 +473,6 @@ class Port(object): return self.ok() - def get_attr (self): - return self.attr - def get_profile (self): return self.profile @@ -520,6 +517,20 @@ class Port(object): format_time(exp_time_factor_sec)) print "\n" + # generate port info + def get_info (self): + info = {} + info['speed'] = self.speed + info['driver'] = self.driver + info['status'] = self.get_port_state_name() + + if self.attr.get('promiscuous'): + info['prom'] = "on" if self.attr['promiscuous']['enabled'] else "off" + else: + info['prom'] = "N/A" + + return info + def get_port_state_name(self): return self.STATES_MAP.get(self.state, "Unknown") @@ -529,9 +540,13 @@ class Port(object): return self.port_stats.generate_stats() def generate_port_status(self): - return {"type": self.driver, - "maximum": "{speed} Gb/s".format(speed=self.speed), - "status": self.get_port_state_name() + + info = self.get_info() + + return {"type": info['driver'], + "maximum": "{speed} Gb/s".format(speed=info['speed']), + "status": info['status'], + "promiscuous" : info['prom'] } def clear_stats(self): |