From: Philip Joseph Date: Fri, 17 Feb 2017 20:40:14 +0000 (+0530) Subject: Update ping pong config scripts to support Python 3.3 (FC20) X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=63f19c276ee40b872ade533c848192da95b3fb48;p=osm%2FSO.git Update ping pong config scripts to support Python 3.3 (FC20) Signed-off-by: Philip Joseph --- diff --git a/examples/ping_pong_ns/rift/mano/examples/ping_rate.py b/examples/ping_pong_ns/rift/mano/examples/ping_rate.py index b3ab07ba..0892aa66 100755 --- a/examples/ping_pong_ns/rift/mano/examples/ping_rate.py +++ b/examples/ping_pong_ns/rift/mano/examples/ping_rate.py @@ -50,9 +50,11 @@ def ping_rate(yaml_cfg, logger): rate=rate) logger.debug("Executing cmd: %s", cmd) - proc = subprocess.run(cmd, shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + proc = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + + proc.wait() logger.debug("Process: {}".format(proc)) diff --git a/examples/ping_pong_ns/rift/mano/examples/ping_setup.py b/examples/ping_pong_ns/rift/mano/examples/ping_setup.py index c05e669b..c0d05894 100755 --- a/examples/ping_pong_ns/rift/mano/examples/ping_setup.py +++ b/examples/ping_pong_ns/rift/mano/examples/ping_setup.py @@ -62,15 +62,16 @@ def ping_setup(yaml_cfg, logger): while True: count += 1 - proc = subprocess.run(cmd, shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + proc = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + proc.wait() logger.debug("Process: {}".format(proc)) if proc.returncode == 0: # Check if response is 200 OK - resp = proc.stdout.decode() + resp = proc.stdout.read().decode() if 'HTTP/1.1 200 OK' in resp: rc = 0 break diff --git a/examples/ping_pong_ns/rift/mano/examples/ping_start_stop.py b/examples/ping_pong_ns/rift/mano/examples/ping_start_stop.py index 76f653c0..fdd62ed8 100755 --- a/examples/ping_pong_ns/rift/mano/examples/ping_start_stop.py +++ b/examples/ping_pong_ns/rift/mano/examples/ping_start_stop.py @@ -51,17 +51,18 @@ def ping_start_stop(yaml_cfg, logger): start=start) logger.debug("Executing cmd: %s", cmd) - proc = subprocess.run(cmd, shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + proc = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + proc.wait() logger.debug("Process: {}".format(proc)) rc = proc.returncode if rc == 0: # Check if we got 200 OK - resp = proc.stdout.decode() + resp = proc.stdout.read().decode() if 'HTTP/1.1 200 OK' not in resp: self._log.error("Got error response: {}".format(resp)) rc = 1 diff --git a/examples/ping_pong_ns/rift/mano/examples/pong_setup.py b/examples/ping_pong_ns/rift/mano/examples/pong_setup.py index cd56eca8..7bd24798 100755 --- a/examples/ping_pong_ns/rift/mano/examples/pong_setup.py +++ b/examples/ping_pong_ns/rift/mano/examples/pong_setup.py @@ -62,15 +62,16 @@ def pong_setup(yaml_cfg, logger): while True: count += 1 - proc = subprocess.run(config_cmd, shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + proc = subprocess.Popen(config_cmd, shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + proc.wait() logger.debug("Process: {}".format(proc)) if proc.returncode == 0: # Check if response is 200 OK - resp = proc.stdout.decode() + resp = proc.stdout.read().decode() if 'HTTP/1.1 200 OK' in resp: rc = 0 break diff --git a/examples/ping_pong_ns/rift/mano/examples/pong_start_stop.py b/examples/ping_pong_ns/rift/mano/examples/pong_start_stop.py index b5195ddf..30e7fa68 100755 --- a/examples/ping_pong_ns/rift/mano/examples/pong_start_stop.py +++ b/examples/ping_pong_ns/rift/mano/examples/pong_start_stop.py @@ -51,17 +51,18 @@ def pong_start_stop(yaml_cfg, logger): start=start) logger.debug("Executing cmd: %s", cmd) - proc = subprocess.run(cmd, shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + proc = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + proc.wait() logger.debug("Process: {}".format(proc)) rc = proc.returncode if rc == 0: # Check if we got 200 OK - resp = proc.stdout.decode() + resp = proc.stdout.read().decode() if 'HTTP/1.1 200 OK' not in resp: self._log.error("Got error response: {}".format(resp)) rc = 1 diff --git a/examples/ping_pong_ns/rift/mano/examples/start_traffic.py b/examples/ping_pong_ns/rift/mano/examples/start_traffic.py index 3093792f..2f89c569 100755 --- a/examples/ping_pong_ns/rift/mano/examples/start_traffic.py +++ b/examples/ping_pong_ns/rift/mano/examples/start_traffic.py @@ -41,10 +41,11 @@ def start_traffic(yaml_cfg, logger): vnf_type=vnf_type) logger.debug("Executing cmd: %s", curl_cmd) - proc = subprocess.run(curl_cmd, shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + proc = subprocess.Popen(curl_cmd, shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + proc.wait() logger.debug("Process: {}".format(proc)) return proc.returncode