From 1d61af34eb7b35b912d124768ad26eb5f0cd03a8 Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Tue, 5 Jun 2018 14:06:29 +0200 Subject: Fix NSB NfVi support for 25 and 40Gbps When setting interface_speed option in the test case, NSB/PROX was still considering 100% as 10 Gbps. With this fix, when interface_speed is set to for instance 25 Gbps then NSB/PROX will start generate at 25 Gbps. Yardstick logging info printed on the screen will show performance result as percentage of interface_speed (e.g. 100% will be 25 Gbps). This is done by sending the command "speed 250" to PROX (PROX cannot know the underlying interface speed in all cases e.g. in virtio, and hence considers 100% as 10Gbps). JIRA: YARDSTICK-1217 Change-Id: I4989161b04a7afa5e347935ee7ccef7dfe5a504d Signed-off-by: Xavier Simonart Signed-off-by: Emma Foley --- .../vnf_generic/vnf/prox_helpers.py | 31 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/yardstick/network_services/vnf_generic/vnf/prox_helpers.py b/yardstick/network_services/vnf_generic/vnf/prox_helpers.py index 7fac75a29..6d28f4750 100644 --- a/yardstick/network_services/vnf_generic/vnf/prox_helpers.py +++ b/yardstick/network_services/vnf_generic/vnf/prox_helpers.py @@ -1226,12 +1226,32 @@ class ProxProfileHelper(object): return cores + def pct_10gbps(self, percent, line_speed): + """Get rate in percent of 10 Gbps. + + Returns the rate in percent of 10 Gbps. + For instance 100.0 = 10 Gbps; 400.0 = 40 Gbps. + + This helper method isrequired when setting interface_speed option in + the testcase because NSB/PROX considers 10Gbps as 100% of line rate, + this means that the line rate must be expressed as a percentage of + 10Gbps. + + :param percent: (float) Percent of line rate (100.0 = line rate). + :param line_speed: (int) line rate speed, in bits per second. + + :return: (float) Represents the rate in percent of 10Gbps. + """ + return (percent * line_speed / ( + constants.ONE_GIGABIT_IN_BITS * constants.NIC_GBPS_DEFAULT)) + def run_test(self, pkt_size, duration, value, tolerated_loss=0.0, line_speed=(constants.ONE_GIGABIT_IN_BITS * constants.NIC_GBPS_DEFAULT)): data_helper = ProxDataHelper(self.vnfd_helper, self.sut, pkt_size, value, tolerated_loss, line_speed) - with data_helper, self.traffic_context(pkt_size, value): + with data_helper, self.traffic_context(pkt_size, + self.pct_10gbps(value, line_speed)): with data_helper.measure_tot_stats(): time.sleep(duration) # Getting statistics to calculate PPS at right speed.... @@ -1491,7 +1511,8 @@ class ProxBngProfileHelper(ProxProfileHelper): data_helper = ProxDataHelper(self.vnfd_helper, self.sut, pkt_size, value, tolerated_loss, line_speed) - with data_helper, self.traffic_context(pkt_size, value): + with data_helper, self.traffic_context(pkt_size, + self.pct_10gbps(value, line_speed)): with data_helper.measure_tot_stats(): time.sleep(duration) # Getting statistics to calculate PPS at right speed.... @@ -1680,7 +1701,8 @@ class ProxVpeProfileHelper(ProxProfileHelper): data_helper = ProxDataHelper(self.vnfd_helper, self.sut, pkt_size, value, tolerated_loss, line_speed) - with data_helper, self.traffic_context(pkt_size, value): + with data_helper, self.traffic_context(pkt_size, + self.pct_10gbps(value, line_speed)): with data_helper.measure_tot_stats(): time.sleep(duration) # Getting statistics to calculate PPS at right speed.... @@ -1871,7 +1893,8 @@ class ProxlwAFTRProfileHelper(ProxProfileHelper): data_helper = ProxDataHelper(self.vnfd_helper, self.sut, pkt_size, value, tolerated_loss, line_speed) - with data_helper, self.traffic_context(pkt_size, value): + with data_helper, self.traffic_context(pkt_size, + self.pct_10gbps(value, line_speed)): with data_helper.measure_tot_stats(): time.sleep(duration) # Getting statistics to calculate PPS at right speed.... -- cgit 1.2.3-korg