From 6801918e1ca373e61eb081d1d577cbb092a7d234 Mon Sep 17 00:00:00 2001 From: opensource-tnbt Date: Wed, 15 Jul 2020 16:06:41 +0530 Subject: PKT_GEN: Trex with Loss-Verification This patch adds binary-search loss verification to t-rex. Signed-off-by: Sridhar K. N. Rao Change-Id: Ie9b66f3149d4363840455ec1530885b23c3fc183 --- conf/10_custom.conf | 3 +++ tools/pkt_gen/trex/trex.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/conf/10_custom.conf b/conf/10_custom.conf index 0e274aab..99600966 100644 --- a/conf/10_custom.conf +++ b/conf/10_custom.conf @@ -147,6 +147,9 @@ TRAFFICGEN_TREX_VERIFICATION_MODE = False TRAFFICGEN_TREX_VERIFICATION_DURATION = 60 TRAFFICGEN_TREX_MAXIMUM_VERIFICATION_TRIALS = 10 +TRAFFICGEN_TREX_RFC2544_MAX_REPEAT = 0 +TRAFFICGEN_TREX_RFC2544_BINARY_SEARCH_LOSS_VERIFICATION = False + # TREX Configuration and Connection Info-- END #################################################### diff --git a/tools/pkt_gen/trex/trex.py b/tools/pkt_gen/trex/trex.py index d37a52c4..e2bc1e9a 100644 --- a/tools/pkt_gen/trex/trex.py +++ b/tools/pkt_gen/trex/trex.py @@ -594,9 +594,14 @@ class Trex(ITrafficGenerator): :return: passing stats as dictionary """ threshold = settings.getValue('TRAFFICGEN_TREX_RFC2544_TPUT_THRESHOLD') + max_repeat = settings.getValue('TRAFFICGEN_TREX_RFC2544_MAX_REPEAT') + loss_verification = settings.getValue('TRAFFICGEN_TREX_RFC2544_BINARY_SEARCH_LOSS_VERIFICATION') + if loss_verification: + self._logger.info("Running Binary Search with Loss Verification") stats_ok = _EMPTY_STATS new_params = copy.deepcopy(traffic) iteration = 1 + repeat = 0 left = boundaries['left'] right = boundaries['right'] center = boundaries['center'] @@ -620,11 +625,20 @@ class Trex(ITrafficGenerator): if test_lossrate == 0.0 and new_params['frame_rate'] == traffic['frame_rate']: return copy.deepcopy(stats) elif test_lossrate > lossrate: + if loss_verification: + if repeat < max_repeat: + repeat += 1 + iteration += 1 + continue + else: + repeat = 0 right = center center = (left + right) / 2 new_params = copy.deepcopy(traffic) new_params['frame_rate'] = center else: + if loss_verification: + repeat = 0 stats_ok = copy.deepcopy(stats) left = center center = (left + right) / 2 -- cgit 1.2.3-korg