diff options
Diffstat (limited to 'tools/pkt_gen/xena')
-rw-r--r-- | tools/pkt_gen/xena/XenaDriver.py | 9 | ||||
-rwxr-xr-x | tools/pkt_gen/xena/xena.py | 27 |
2 files changed, 29 insertions, 7 deletions
diff --git a/tools/pkt_gen/xena/XenaDriver.py b/tools/pkt_gen/xena/XenaDriver.py index 04a99e9d..e144514f 100644 --- a/tools/pkt_gen/xena/XenaDriver.py +++ b/tools/pkt_gen/xena/XenaDriver.py @@ -57,6 +57,7 @@ CMD_LOGOFF = 'c_logoff' CMD_OWNER = 'c_owner' CMD_PORT = ';Port:' CMD_PORT_IP = 'p_ipaddress' +CMD_PORT_LEARNING = 'p_autotrain' CMD_RESERVE = 'p_reservation reserve' CMD_RELEASE = 'p_reservation release' CMD_RELINQUISH = 'p_reservation relinquish' @@ -560,6 +561,14 @@ class XenaPort(object): "on" if on else "off"), self) return self._manager.driver.ask_verify(command) + def set_port_learning(self, interval): + """Start port learning with the interval in seconds specified. 0 disables port learning + :param: interval as int + :return: Boolean True if response OK, False if error. + """ + command = make_port_command('{} {}'.format(CMD_PORT_LEARNING, interval), self) + return self._manager.driver.ask_verify(command) + def set_port_ip(self, ip_addr, cidr, gateway, wild='255'): """ Set the port ip address of the specific port diff --git a/tools/pkt_gen/xena/xena.py b/tools/pkt_gen/xena/xena.py index 20577e8d..e251c1d6 100755 --- a/tools/pkt_gen/xena/xena.py +++ b/tools/pkt_gen/xena/xena.py @@ -188,9 +188,10 @@ class Xena(ITrafficGenerator): result_dict[ResultsConstants.TX_FRAMES] = self.tx_stats.data[ self.tx_stats.pt_stream_keys[0]]['packets'] result_dict[ResultsConstants.TX_RATE_FPS] = self.tx_stats.data[ - self.tx_stats.pt_stream_keys[0]]['pps'] - result_dict[ResultsConstants.TX_RATE_MBPS] = self.tx_stats.data[ - self.tx_stats.pt_stream_keys[0]]['bps'] / 1000000 + self.tx_stats.pt_stream_keys[0]]['packets'] / self._duration + result_dict[ResultsConstants.TX_RATE_MBPS] = (( + self.tx_stats.data[self.tx_stats.pt_stream_keys[0]]['bytes'] + * 8) / 1000000) / self._duration result_dict[ResultsConstants.TX_BYTES] = self.tx_stats.data[ self.tx_stats.pt_stream_keys[0]]['bytes'] # tx rate percent may need to be halved if bi directional @@ -214,10 +215,11 @@ class Xena(ITrafficGenerator): 'pr_tpldstraffic']['0']['packets'] result_dict[ ResultsConstants.THROUGHPUT_RX_FPS] = self.rx_stats.data[ - 'pr_tpldstraffic']['0']['pps'] + 'pr_tpldstraffic']['0']['packets'] / self._duration result_dict[ - ResultsConstants.THROUGHPUT_RX_MBPS] = self.rx_stats.data[ - 'pr_tpldstraffic']['0']['bps'] / 1000000 + ResultsConstants.THROUGHPUT_RX_MBPS] = (( + self.rx_stats.data['pr_tpldstraffic']['0']['bytes'] + *8) / 1000000) / self._duration result_dict[ResultsConstants.RX_BYTES] = self.rx_stats.data[ 'pr_tpldstraffic']['0']['bytes'] # throughput percent may need to be halved if bi directional @@ -383,6 +385,15 @@ class Xena(ITrafficGenerator): # Clear port configuration for a clean start self.xmanager.ports[0].reset_port() self.xmanager.ports[1].reset_port() + if settings.getValue('TRAFFICGEN_XENA_CONT_PORT_LEARNING_ENABLED'): + # turn on port learning + self.xmanager.ports[0].set_port_learning(1) + self.xmanager.ports[1].set_port_learning(1) + sleep(settings.getValue('TRAFFICGEN_XENA_CONT_PORT_LEARNING_DURATION')) + # turn off port learning + self.xmanager.ports[0].set_port_learning(0) + self.xmanager.ports[1].set_port_learning(0) + sleep(1) self.xmanager.ports[0].clear_stats() self.xmanager.ports[1].clear_stats() @@ -395,6 +406,8 @@ class Xena(ITrafficGenerator): settings.getValue('TRAFFICGEN_XENA_PORT1_IP'), settings.getValue('TRAFFICGEN_XENA_PORT1_CIDR'), settings.getValue('TRAFFICGEN_XENA_PORT1_GATEWAY')) + self.xmanager.ports[0].set_port_time_limit(self._duration) + self.xmanager.ports[1].set_port_time_limit(self._duration) def setup_stream(stream, port, payload_id, flip_addr=False): """ @@ -459,7 +472,7 @@ class Xena(ITrafficGenerator): if not self.xmanager.ports[1].traffic_on(): self._logger.error( "Failure to start port 1. Check settings and retry.") - sleep(self._duration + 1) + sleep(self._duration + 5) # the extra 5 seconds is to allow packets in flight to complete # getting results if self._params['traffic']['bidir'] == 'True': # need to aggregate out both ports stats and assign that data |