aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-08-16 12:20:10 +0100
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-08-20 11:02:56 +0100
commitb103e6a8544d727ea155ec2c2bc71dbf91a36219 (patch)
tree908282719f2540549d7a2f62a116578596609676 /yardstick/network_services
parentf32d9e5e452429905c8099db9b5d4a0fa14dff13 (diff)
Improvie TRex RFC2544 throughput calculation
Improve TRex RFC2544 throughput calculation by using the in/out packets instead of using the throughput samples. JIRA: YARDSTICK-1387 Change-Id: I877e901c3226d31c6435a877a2924bb95deb1cf0 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/network_services')
-rw-r--r--yardstick/network_services/traffic_profile/rfc2544.py23
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_trex.py4
2 files changed, 13 insertions, 14 deletions
diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py
index b54fc575f..898315671 100644
--- a/yardstick/network_services/traffic_profile/rfc2544.py
+++ b/yardstick/network_services/traffic_profile/rfc2544.py
@@ -247,19 +247,16 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
correlated_traffic):
"""Calculate the drop percentage and run the traffic"""
completed = False
- tx_rate_fps = 0
- rx_rate_fps = 0
- for sample in samples:
- tx_rate_fps += sum(
- port['tx_throughput_fps'] for port in sample.values())
- rx_rate_fps += sum(
- port['rx_throughput_fps'] for port in sample.values())
- tx_rate_fps = round(float(tx_rate_fps) / len(samples), 2)
- rx_rate_fps = round(float(rx_rate_fps) / len(samples), 2)
-
- # TODO(esm): RFC2544 doesn't tolerate packet loss, why do we?
- out_packets = sum(port['out_packets'] for port in samples[-1].values())
- in_packets = sum(port['in_packets'] for port in samples[-1].values())
+ out_pkt_end = sum(port['out_packets'] for port in samples[-1].values())
+ in_pkt_end = sum(port['in_packets'] for port in samples[-1].values())
+ out_pkt_ini = sum(port['out_packets'] for port in samples[0].values())
+ in_pkt_ini = sum(port['in_packets'] for port in samples[0].values())
+ time_diff = (list(samples[-1].values())[0]['timestamp'] -
+ list(samples[0].values())[0]['timestamp']).total_seconds()
+ out_packets = out_pkt_end - out_pkt_ini
+ in_packets = in_pkt_end - in_pkt_ini
+ tx_rate_fps = float(out_packets) / time_diff
+ rx_rate_fps = float(in_packets) / time_diff
drop_percent = 100.0
# https://tools.ietf.org/html/rfc2544#section-26.3
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_trex.py b/yardstick/network_services/vnf_generic/vnf/tg_trex.py
index 58b73488b..4296da84c 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_trex.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_trex.py
@@ -11,8 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-""" Trex acts as traffic generation and vnf definitions based on IETS Spec """
+import datetime
import logging
import os
@@ -167,6 +167,7 @@ class TrexResourceHelper(ClientResourceHelper):
def _get_samples(self, ports, port_pg_id=None):
stats = self.get_stats(ports)
+ timestamp = datetime.datetime.now()
samples = {}
for pname in (intf['name'] for intf in self.vnfd_helper.interfaces):
port_num = self.vnfd_helper.port_num(pname)
@@ -178,6 +179,7 @@ class TrexResourceHelper(ClientResourceHelper):
'tx_throughput_bps': float(port_stats.get('tx_bps', 0.0)),
'in_packets': int(port_stats.get('ipackets', 0)),
'out_packets': int(port_stats.get('opackets', 0)),
+ 'timestamp': timestamp
}
pg_id_list = port_pg_id.get_pg_ids(port_num)