From ac8dcddc9e11c958a1e42839793a5fa1e207143c 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 --- cleanup/__init__.py | 2 +- client/__init__.py | 2 +- docs/testing/user/userguide/conf.py | 15 +++++++++++++++ nfvbench/traffic_client.py | 15 +++++++++++++++ tox.ini | 4 ++-- 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/cleanup/__init__.py b/cleanup/__init__.py index fcaa79b..04924ec 100644 --- a/cleanup/__init__.py +++ b/cleanup/__init__.py @@ -10,4 +10,4 @@ # distributed under the License is distributed on an "AS IS" BASIS, 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. \ No newline at end of file +# under the License. diff --git a/client/__init__.py b/client/__init__.py index fcaa79b..04924ec 100644 --- a/client/__init__.py +++ b/client/__init__.py @@ -10,4 +10,4 @@ # distributed under the License is distributed on an "AS IS" BASIS, 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. \ No newline at end of file +# under the License. diff --git a/docs/testing/user/userguide/conf.py b/docs/testing/user/userguide/conf.py index 0aae169..5846b00 100644 --- a/docs/testing/user/userguide/conf.py +++ b/docs/testing/user/userguide/conf.py @@ -1,5 +1,17 @@ # Copyright 2017 Cisco Systems, Inc. All rights reserved. # +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, 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. +# # NFVBench documentation build configuration file, created by # sphinx-quickstart on Thu Sep 29 14:25:18 2016. # @@ -16,6 +28,9 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # + + + # import os # import sys # sys.path.insert(0, os.path.abspath('.')) 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 diff --git a/tox.ini b/tox.ini index 3120ac1..ea0894e 100644 --- a/tox.ini +++ b/tox.ini @@ -37,6 +37,6 @@ show-source = True #H404: multi line docstring should start without a leading new line #H405: multi line docstring summary not separated with an empty line #H904: Wrap long lines in parentheses instead of a backslash -ignore = E123,E125,H803,E302,E303,H233,H236,H302,H404,H405,H904 +ignore = E123,E125,H803,E302,E303,H104,H233,H236,H302,H404,H405,H904 builtins = _ -exclude=venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build +exclude=venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,dib-venv -- cgit 1.2.3-korg