X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=yardstick%2Fcmd%2FNSBperf.py;h=011990a3d6b777efa42719f1606d21648e188e9c;hb=15d807c22f33fab8e1f9b61e1d0c041a8144ee89;hp=c3730f8344acdace3c3a0bd73b9a8b345d8cd397;hpb=5e3c9075dcc12619a97b9e99b26532c5576fc6ca;p=yardstick.git diff --git a/yardstick/cmd/NSBperf.py b/yardstick/cmd/NSBperf.py index c3730f834..011990a3d 100755 --- a/yardstick/cmd/NSBperf.py +++ b/yardstick/cmd/NSBperf.py @@ -24,7 +24,7 @@ import argparse import json import subprocess import signal - +from oslo_serialization import jsonutils from six.moves import input @@ -39,13 +39,11 @@ if not PYTHONPATH or not VIRTUAL_ENV: raise SystemExit(1) -def handler(): +def sigint_handler(*args, **kwargs): """ Capture ctrl+c and exit cli """ subprocess.call(["pkill", "-9", "yardstick"]) raise SystemExit(1) -signal.signal(signal.SIGINT, handler) - class YardstickNSCli(object): """ This class handles yardstick network serivce testing """ @@ -126,10 +124,11 @@ class YardstickNSCli(object): if os.path.isfile("/tmp/yardstick.out"): lines = [] with open("/tmp/yardstick.out") as infile: - lines = infile.readlines() + lines = jsonutils.load(infile) if lines: - tc_res = json.loads(lines.pop(len(lines) - 1)) + lines = lines['result'] + tc_res = lines.pop(len(lines) - 1) for key, value in tc_res["benchmark"]["data"].items(): self.generate_kpi_results(key, value) self.generate_nfvi_results(value) @@ -213,5 +212,6 @@ class YardstickNSCli(object): self.run_test(args, test_path) if __name__ == "__main__": + signal.signal(signal.SIGINT, sigint_handler) NS_CLI = YardstickNSCli() NS_CLI.main()