Fix/cleanup: Added missing license headers and removed unused files.
[osm/vim-emu.git] / src / emuvim / test / api_base_openstack.py
index 207d359..c951665 100755 (executable)
@@ -34,6 +34,7 @@ import unittest
 import os
 import subprocess
 import docker
+import time
 from emuvim.dcemulator.net import DCNetwork
 from emuvim.api.openstack.openstack_api_endpoint import OpenstackApiEndpoint
 from mininet.clean import cleanup
@@ -69,7 +70,7 @@ class ApiBaseOpenStack(unittest.TestCase):
         """
         self.net = DCNetwork(controller=controller, **kwargs)
         for i in range(0, ndatacenter):
-            self.api.append(OpenstackApiEndpoint("0.0.0.0", 5000+i))
+            self.api.append(OpenstackApiEndpoint("0.0.0.0", 15000+i))
 
         # add some switches
         # start from s1 because ovs does not like to have dpid = 0
@@ -102,7 +103,7 @@ class ApiBaseOpenStack(unittest.TestCase):
 
     def startApi(self):
         for i in self.api:
-            i.start()
+            i.start(wait_for_port=True)
 
     def stopApi(self):
         for i in self.api:
@@ -136,13 +137,14 @@ class ApiBaseOpenStack(unittest.TestCase):
 
 
     def tearDown(self):
+        time.sleep(2)
         print('->>>>>>> tear everything down ->>>>>>>>>>>>>>>')
         self.stopApi() # stop all flask threads
         self.stopNet() # stop some mininet and containernet stuff
         cleanup()
         # make sure that all pending docker containers are killed
         with open(os.devnull, 'w') as devnull: # kill a possibly running docker process that blocks the open ports
-            subprocess.call("kill $(netstat -npl | grep '5000' | grep -o -e'[0-9]\+/docker' | grep -o -e '[0-9]\+')",
+            subprocess.call("kill $(netstat -npl | grep '15000' | grep -o -e'[0-9]\+/docker' | grep -o -e '[0-9]\+')",
                 stdout=devnull,
                 stderr=devnull,
                 shell=True)
@@ -153,6 +155,7 @@ class ApiBaseOpenStack(unittest.TestCase):
                 stdout=devnull,
                 stderr=devnull,
                 shell=True)
+        time.sleep(2)