Add OVS logger
[functest.git] / testcases / features / sfc / sfc_colorado1.py
index 5580d9e..ed35cb3 100755 (executable)
@@ -20,6 +20,7 @@ args = parser.parse_args()
 """ logging configuration """
 logger = ft_logger.Logger("ODL_SFC").getLogger()
 
+FUNCTEST_RESULTS_DIR = '/home/opnfv/functest/results/'
 FUNCTEST_REPO = ft_utils.FUNCTEST_REPO
 
 HOME = os.environ['HOME'] + "/"
@@ -81,15 +82,6 @@ def main():
                                stderr=subprocess.PIPE)
     ip_server = process.stdout.readline().rstrip()
 
-    contr_cmd2 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
-                  " 'fuel node'|grep compute|awk '{print $10}'")
-    logger.info("Executing script to get ip_compute: '%s'" % contr_cmd2)
-    process = subprocess.Popen(contr_cmd2,
-                               shell=True,
-                               stdout=subprocess.PIPE,
-                               stderr=subprocess.PIPE)
-    ip_compute = process.stdout.readline().rstrip()
-
     iptable_cmd1 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
                     " ssh " + ip_server + " iptables -P INPUT ACCEPT ")
     iptable_cmd2 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
@@ -181,10 +173,12 @@ def main():
         logger.debug(
             "Configuration:\n name=%s \n flavor=%s \n image=%s \n "
             "network=%s \n" % (INSTANCE_NAME, FLAVOR, image_id, network_id))
-        instance = os_utils.create_instance_and_wait_for_active(FLAVOR,
-                                                                image_id,
-                                                                network_id,
-                                                                INSTANCE_NAME)
+        instance = os_utils.create_instance_and_wait_for_active(
+            FLAVOR,
+            image_id,
+            network_id,
+            INSTANCE_NAME,
+            av_zone='nova')
 
         if instance is None:
             logger.error("Error while booting instance.")
@@ -222,15 +216,16 @@ def main():
     # STARTING SECOND VM (server) ###
 
         # boot INTANCE
-        logger.info("Creating instance '%s'..." % INSTANCE_NAME)
+        logger.info("Creating instance '%s'..." % INSTANCE_NAME_2)
         logger.debug(
             "Configuration:\n name=%s \n flavor=%s \n image=%s \n "
-            "network=%s \n" % (INSTANCE_NAME, FLAVOR, image_id, network_id))
+            "network=%s \n" % (INSTANCE_NAME_2, FLAVOR, image_id, network_id))
         instance_2 = os_utils.create_instance_and_wait_for_active(
             FLAVOR,
             image_id,
             network_id,
-            INSTANCE_NAME_2)
+            INSTANCE_NAME_2,
+            av_zone='nova')
 
         if instance_2 is None:
             logger.error("Error while booting instance.")
@@ -393,16 +388,6 @@ def main():
         except Exception:
             logger.exception("vxlan_tool not started in SF2")
 
-        # SSH to modify the classification flows in compute
-
-        contr_cmd3 = ("sshpass -p r00tme ssh " + ssh_options + " "
-                      "root@10.20.0.2 'ssh " + ip_compute + " "
-                      "'bash correct_classifier.bash''")
-        logger.info("Executing script to modify the classi: '%s'" % contr_cmd3)
-        process = subprocess.Popen(contr_cmd3,
-                                   shell=True,
-                                   stdout=subprocess.PIPE)
-
         i = 0
 
         # SSH TO EXECUTE cmd_client
@@ -460,17 +445,7 @@ def main():
         subprocess.call(tacker_classi, shell=True)
 
         logger.info("Wait for ODL to update the classification rules in OVS")
-        time.sleep(10)
-
-        # SSH to modify the classification flows in compute
-
-        contr_cmd4 = ("sshpass -p r00tme ssh " + ssh_options + " "
-                      "root@10.20.0.2 'ssh " + ip_compute + " "
-                      "'bash correct_classifier.bash''")
-        logger.info("Executing script to modify the classi: '%s'" % contr_cmd4)
-        process = subprocess.Popen(contr_cmd4,
-                                   shell=True,
-                                   stdout=subprocess.PIPE)
+        time.sleep(100)
 
         # SSH TO EXECUTE cmd_client
 
@@ -526,10 +501,14 @@ def main():
                             " :) \n" + '\033[0m')
             break
         else:
-            logger.debug("Iterating again!")
+            logger.info("Iterating again!")
             delete = ("bash delete.sh")
-            subprocess.call(delete, shell=True, stderr=subprocess.PIPE)
-            time.sleep(10)
+            try:
+                subprocess.call(delete, shell=True, stderr=subprocess.PIPE)
+                time.sleep(10)
+            except Exception, e:
+                logger.error("Problem when executing the delete.sh")
+                logger.error("Problem %s" % e)
 
     if args.report:
         stop_time = time.time()