From ed44014fcbd625cd464a6a7f7b88c02b9b7a29f5 Mon Sep 17 00:00:00 2001 From: Kerim Gokarslan Date: Tue, 19 Sep 2017 15:33:46 -0700 Subject: NFVBENCH-28 Set result values for NDR/PDR if they cannot be found within the given epsilon Change-Id: Id8019c7f052c2b189f3ab6e39377f65fe00d9fee Signed-off-by: Kerim Gokarslan --- nfvbench/traffic_client.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'nfvbench/traffic_client.py') diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py index 27ff227..4337ad3 100644 --- a/nfvbench/traffic_client.py +++ b/nfvbench/traffic_client.py @@ -640,6 +640,21 @@ class TrafficClient(object): }) right_targets[tag] = target else: + # initialize to 0 all fields of result for + # the worst case scenario of the binary search (if ndr/pdr is not found) + if tag not in results: + results[tag] = dict.fromkeys(rates, 0) + empty_stats = self.__format_output_stats(dict(stats)) + for key in empty_stats: + if isinstance(empty_stats[key], dict): + empty_stats[key] = dict.fromkeys(empty_stats[key], 0) + else: + empty_stats[key] = 0 + results[tag].update({ + 'load_percent_per_direction': 0, + 'stats': empty_stats, + 'timestamp_sec': None + }) left_targets[tag] = target # search lower half -- cgit 1.2.3-korg