Update ping pong config scripts to support Python 3.3 (FC20) 26/1126/1
authorPhilip Joseph <philip.joseph@riftio.com>
Fri, 17 Feb 2017 20:40:14 +0000 (02:10 +0530)
committerPhilip Joseph <philip.joseph@riftio.com>
Fri, 17 Feb 2017 20:40:14 +0000 (02:10 +0530)
Signed-off-by: Philip Joseph <philip.joseph@riftio.com>
examples/ping_pong_ns/rift/mano/examples/ping_rate.py
examples/ping_pong_ns/rift/mano/examples/ping_setup.py
examples/ping_pong_ns/rift/mano/examples/ping_start_stop.py
examples/ping_pong_ns/rift/mano/examples/pong_setup.py
examples/ping_pong_ns/rift/mano/examples/pong_start_stop.py
examples/ping_pong_ns/rift/mano/examples/start_traffic.py

index b3ab07b..0892aa6 100755 (executable)
@@ -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))
 
index c05e669..c0d0589 100755 (executable)
@@ -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
index 76f653c..fdd62ed 100755 (executable)
@@ -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
index cd56eca..7bd2479 100755 (executable)
@@ -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
index b5195dd..30e7fa6 100755 (executable)
@@ -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
index 3093792..2f89c56 100755 (executable)
@@ -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