Change-Id: I67bfba22393f2f324b3c052b443b24c520231172
Signed-off-by: Gwenael Lambrouin <gwenael.lambrouin@orange.com>
if port is not None:
context.port = port
if port is not None:
context.port = port
+ nfvbench_test_url = "http://{ip}:{port}/status".format(ip=context.host_ip, port=context.port)
+
try:
# check if API is already available
try:
# check if API is already available
- requests.get(
- "http://{host_ip}:{port}/status".format(host_ip=context.host_ip, port=context.port))
+ requests.get(nfvbench_test_url)
except RequestException:
cmd = ["nfvbench", "-c", context.data['config'], "--server"]
if context.host_ip != "127.0.0.1":
except RequestException:
cmd = ["nfvbench", "-c", context.data['config'], "--server"]
if context.host_ip != "127.0.0.1":
subprocess.Popen(cmd, stdout=DEVNULL, stderr=subprocess.STDOUT)
subprocess.Popen(cmd, stdout=DEVNULL, stderr=subprocess.STDOUT)
- test_nfvbench_api(context)
+ context.logger.info("start_server: test nfvbench API: " + nfvbench_test_url)
+ test_nfvbench_api(nfvbench_test_url)
@retry(AssertionError, tries=24, delay=5.0, logger=None)
@retry(AssertionError, tries=24, delay=5.0, logger=None)
-def test_nfvbench_api(context):
+def test_nfvbench_api(nfvbench_test_url: str):
- r = requests.get("http://{ip}:{port}/status".format(ip=context.host_ip, port=context.port))
+ r = requests.get(nfvbench_test_url)
assert r.status_code == 200
assert json.loads(r.text)["error_message"] == "no pending NFVbench run"
except RequestException as exc:
assert r.status_code == 200
assert json.loads(r.text)["error_message"] == "no pending NFVbench run"
except RequestException as exc: