test breakage due to incorrect speed calculation
authorimarom <[email protected]>
Sun, 4 Dec 2016 09:30:08 +0000 (11:30 +0200)
committerimarom <[email protected]>
Sun, 4 Dec 2016 09:30:34 +0000 (11:30 +0200)
Signed-off-by: imarom <[email protected]>
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
src/trex_port_attr.cpp

index 9b95546..ef74a85 100644 (file)
@@ -129,10 +129,10 @@ class Port(object):
         return RC_OK(data)
 
     def get_speed_bps (self):
-        return (self.__attr['speed'] * 1000 * 1000 * 1000)
+        return (self.get_speed_gbps() * 1000 * 1000 * 1000)
 
-    def get_formatted_speed (self):
-        return "%g Gb/s" % (self.__attr['speed'] / 1000)
+    def get_speed_gbps (self):
+        return self.__attr['speed']
 
     def is_acquired(self):
         return (self.handler != None)
@@ -826,7 +826,7 @@ class Port(object):
             info['is_virtual'] = 'N/A'
 
         # speed
-        info['speed'] = self.get_formatted_speed()
+        info['speed'] = self.get_speed_gbps()
         
         # RX filter mode
         info['rx_filter_mode'] = 'hardware match' if attr['rx_filter_mode'] == 'hw' else 'fetch all'
@@ -865,7 +865,6 @@ class Port(object):
         queue = rx_info['queue']
         info['rx_queue'] = '[{0} / {1}]'.format(queue['count'], queue['size']) if queue['is_active'] else 'off'
         
-
         return info
 
 
index 2efb5a8..6a59126 100644 (file)
@@ -1130,7 +1130,7 @@ class CPortStats(CTRexStats):
         return {"owner": owner,
                 "state": "{0}".format(port_state),
                 'link': link_state,
-                "speed": self._port_obj.get_formatted_speed() if self._port_obj else '',
+                "speed": "%g Gb/s" % self._port_obj.get_speed_gbps() if self._port_obj else '',
                 "CPU util.": "{0} {1}%".format(self.get_trend_gui("m_cpu_util", use_raw = True),
                                                format_threshold(round_float(self.get("m_cpu_util")), [85, 100], [0, 85])) if self._port_obj else '' ,
                 "--": " ",
index 53ae19d..61e8858 100644 (file)
@@ -119,7 +119,7 @@ TRexPortAttr::to_json(Json::Value &output) {
     output["src_mac"]                = utl_macaddr_to_str(get_src_mac());
     output["promiscuous"]["enabled"] = get_promiscuous();
     output["link"]["up"]             = is_link_up();
-    output["speed"]                  = get_link_speed();
+    output["speed"]                  = get_link_speed() / 1000; // make sure we have no cards of less than 1 Gbps
     output["rx_filter_mode"]         = get_rx_filter_mode();
 
     if (get_src_ipv4() != 0) {