summaryrefslogtreecommitdiffstats
path: root/nfvbench/nfvbench.py
diff options
context:
space:
mode:
authorYichen Wang <yicwang@cisco.com>2017-08-15 11:28:53 -0700
committerYichen Wang <yicwang@cisco.com>2017-08-18 01:04:05 -0700
commit5d2becfd9d6398ce9dfd4c83618de42e272ec830 (patch)
treed9039260137b1d9ab57e25eba853220baa7ba9e3 /nfvbench/nfvbench.py
parent4c5e4ba753face81fd73aa3bae1fe3c012e48859 (diff)
[NFVBENCH-7] Return errors when unknown options are passed
1. Return errors when unknown options are passed 2. Fix pep8 warnings Change-Id: I1cbc86de93b4633bbf9bd66c1dc956ff8b3679a6 Signed-off-by: Yichen Wang <yicwang@cisco.com>
Diffstat (limited to 'nfvbench/nfvbench.py')
-rw-r--r--nfvbench/nfvbench.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py
index a4f9ead..5b94ce7 100644
--- a/nfvbench/nfvbench.py
+++ b/nfvbench/nfvbench.py
@@ -21,6 +21,7 @@ from chain_runner import ChainRunner
from collections import defaultdict
from config import config_load
from config import config_loads
+from config import get_err_config
import copy
import credentials
import datetime
@@ -404,10 +405,10 @@ def override_custom_traffic(config, frame_sizes, unidir):
def check_physnet(name, netattrs):
if not netattrs.physical_network:
raise Exception("SRIOV requires physical_network to be specified for the {n} network"
- .format(n=name))
+ .format(n=name))
if not netattrs.segmentation_id:
raise Exception("SRIOV requires segmentation_id to be specified for the {n} network"
- .format(n=name))
+ .format(n=name))
def main():
try:
@@ -455,6 +456,13 @@ def main():
LOG.info('Loading configuration string: ' + opts.config)
config = config_loads(opts.config, config)
+ # Making sure no unknown option is given
+ err_config = get_err_config(config, default_cfg)
+ if err_config:
+ err_msg = 'Unknown options found in config file/string: ' + err_config
+ LOG.error(err_msg)
+ raise Exception(err_msg)
+
# traffic profile override options
override_custom_traffic(config, opts.frame_sizes, opts.unidir)
@@ -504,7 +512,9 @@ def main():
else:
with utils.RunLock():
if unknown_opts:
- LOG.warning('Unknown options: ' + ' '.join(unknown_opts))
+ err_msg = 'Unknown options: ' + ' '.join(unknown_opts)
+ LOG.error(err_msg)
+ raise Exception(err_msg)
# remove unfilled values
opts = {k: v for k, v in vars(opts).iteritems() if v is not None}