Merge pull request #237 from mpeuster/demo-mano-integration
authorpeusterm <manuel.peuster@uni-paderborn.de>
Thu, 13 Jul 2017 11:33:00 +0000 (13:33 +0200)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Thu, 13 Jul 2017 11:33:00 +0000 (13:33 +0200)
Demo mano integration

src/emuvim/api/openstack/compute.py
src/emuvim/api/openstack/openstack_dummies/glance_dummy_api.py
src/emuvim/api/openstack/openstack_dummies/heat_dummy_api.py
src/emuvim/api/openstack/openstack_dummies/nova_dummy_api.py
src/emuvim/api/sonata/dummygatekeeper.py
src/emuvim/dcemulator/net.py
src/emuvim/test/unittests/test_openstack.py
src/emuvim/test/unittests/test_sonata_dummy_gatekeeper.py

index 6d4d864..8c334fb 100755 (executable)
@@ -410,6 +410,7 @@ class OpenstackCompute(object):
         """
         LOG.debug("Starting new compute resources %s" % server.name)
         network = list()
+        network_dict = dict()
 
         for port_name in server.port_names:
             network_dict = dict()
@@ -419,7 +420,14 @@ class OpenstackCompute(object):
                 network_dict['ip'] = port.ip_address
                 network_dict[network_dict['id']] = self.find_network_by_name_or_id(port.net_name).name
                 network.append(network_dict)
+        # default network dict
+        if len(network) < 1:
+            network_dict['id'] = server.name + "-eth0"
+            network_dict[network_dict['id']] = network_dict['id']
+            network.append(network_dict)
+
         self.compute_nets[server.name] = network
+        LOG.debug("Network dict: {}".format(network))
         c = self.dc.startCompute(server.name, image=server.image, command=server.command,
                                  network=network, flavor_name=server.flavor,
                                  properties=server.properties)
@@ -460,7 +468,9 @@ class OpenstackCompute(object):
         LOG.debug("Stopping container %s with full name %s" % (server.name, server.full_name))
         link_names = list()
         for port_name in server.port_names:
-            link_names.append(self.find_port_by_name_or_id(port_name).intf_name)
+            prt = self.find_port_by_name_or_id(port_name)
+            if prt is not None:
+                link_names.append(prt.intf_name)
         my_links = self.dc.net.links
         for link in my_links:
             if str(link.intf1) in link_names:
@@ -486,9 +496,16 @@ class OpenstackCompute(object):
         if name_or_id in self.computeUnits:
             return self.computeUnits[name_or_id]
 
+        if self._shorten_server_name(name_or_id) in self.computeUnits:
+            return self.computeUnits[name_or_id]
+
         for server in self.computeUnits.values():
             if server.name == name_or_id or server.template_name == name_or_id or server.full_name == name_or_id:
                 return server
+            if (server.name == self._shorten_server_name(name_or_id)
+                or server.template_name ==  self._shorten_server_name(name_or_id)
+                or server.full_name == self._shorten_server_name(name_or_id)):
+                return server
         return None
 
     def create_server(self, name, stack_operation=False):
@@ -505,12 +522,40 @@ class OpenstackCompute(object):
         """
         if self.find_server_by_name_or_id(name) is not None and not stack_operation:
             raise Exception("Server with name %s already exists." % name)
-        server = Server(name)
+        safe_name = self._shorten_server_name(name)
+        server = Server(safe_name)
         server.id = str(uuid.uuid4())
         if not stack_operation:
             self.computeUnits[server.id] = server
         return server
 
+    def _shorten_server_name(self, name, char_limit=9):
+        """
+        Docker does not like too long instance names.
+        This function provides a shorter name if needed
+        """
+        # fix for NetSoft'17 demo
+        # TODO remove this after the demo
+        #if "http" in name or "apache" in name:
+        #    return "http"
+        #elif "l4fw" in name or "socat" in name:
+        #    return "l4fw"
+        #elif "proxy" in name or "squid" in name:
+        #    return "proxy"
+        # this is a ugly fix, but we cannot do better for now (interface names are to long)
+        if len(name) > char_limit:
+            LOG.info("Long server name: {}".format(name))
+            # construct a short name
+         #   name = name.strip("-_ .")
+         #   name = name.replace("_vnf", "")
+         #   p = name.split("_")
+         #   if len(p) > 0:
+         #       name = p[len(p)-1]
+            name = name[-char_limit:].strip("-_ .")
+            LOG.info("Short server name: {}".format(name))
+        return name
+
+
     def delete_server(self, server):
         """
         Deletes the given server from the stack dictionary and the computeUnits dictionary.
@@ -638,7 +683,8 @@ class OpenstackCompute(object):
         """
         port = self.find_port_by_name_or_id(name_or_id)
         if port is None:
-            raise Exception("Port with name or id %s does not exists." % name_or_id)
+            LOG.warning("Port with name or id %s does not exist. Can't delete it." % name_or_id)
+            return
 
         my_links = self.dc.net.links
         for link in my_links:
index d9ca091..a61c710 100755 (executable)
@@ -134,7 +134,10 @@ class GlanceListImagesApi(Resource):
         like the image was just created to make orchestrators, like OSM, happy.
         """
         LOG.debug("API CALL: %s POST" % str(self.__class__.__name__))
-        body_data = json.loads(request.data)
+        try:
+            body_data = json.loads(request.data)
+        except:
+            body_data = dict()
         # lets see what we should create
         img_name = request.headers.get("X-Image-Meta-Name")
         img_size = request.headers.get("X-Image-Meta-Size")
index 107d8fd..8262adb 100755 (executable)
@@ -259,7 +259,8 @@ class HeatShowStackTemplate(Resource):
                         stack = tmp_stack
             if stack is None:
                 return 'Could not resolve Stack - ID', 404
-
+            #LOG.debug("STACK: {}".format(stack))
+            #LOG.debug("TEMPLATE: {}".format(stack.template))
             return Response(json.dumps(stack.template), status=200, mimetype="application/json")
 
         except Exception as ex:
@@ -350,6 +351,7 @@ class HeatUpdateStack(Resource):
                 stack_dict['template'] = json.loads(stack_dict['template'])
             if not reader.parse_input(stack_dict['template'], stack, self.api.compute.dc.label, stack_update=True):
                 return 'Could not create stack.', 400
+            stack.template = stack_dict['template']
 
             if not self.api.compute.update_stack(old_stack.id, stack):
                 return 'Could not update stack.', 400
index 1d5a9ac..514755e 100755 (executable)
@@ -522,6 +522,14 @@ class NovaListFlavorById(Resource):
             LOG.exception(u"%s: Could not retrieve flavor with id %s" % (__name__, flavorid))
             return ex.message, 500
 
+    def delete(self, id, flavorid):
+        """
+        Removes the given flavor.
+        Does not really remove anything from the machine, just fakes an OK.
+        """
+        LOG.debug("API CALL: %s GET" % str(self.__class__.__name__))
+        return Response("{}", status=204, mimetype="application/json")
+
 
 class NovaListImages(Resource):
     def __init__(self, api):
@@ -636,6 +644,14 @@ class NovaListImageById(Resource):
             LOG.exception(u"%s: Could not retrieve image with id %s." % (__name__, imageid))
             return ex.message, 500
 
+    def delete(self, id, imageid):
+        """
+        Removes the given image.
+        Does not really remove anything from the machine, just fakes an OK.
+        """
+        LOG.debug("API CALL: %s GET" % str(self.__class__.__name__))
+        return Response("{}", status=204, mimetype="application/json")
+
 
 class NovaShowServerDetails(Resource):
     def __init__(self, api):
index 759ed41..f37d2ff 100755 (executable)
@@ -211,7 +211,9 @@ class Service(object):
             self._start_sap(self.saps[sap], instance_uuid)
 
         # 5. Deploy E-Line and E_LAN links
-        if "virtual_links" in self.nsd:
+        # Attention: Only done if ""forwarding_graphs" section in NSD exists,
+        # even if "forwarding_graphs" are not used directly.
+        if "virtual_links" in self.nsd and "forwarding_graphs" in self.nsd:
             vlinks = self.nsd["virtual_links"]
             # constituent virtual links are not checked
             #fwd_links = self.nsd["forwarding_graphs"][0]["constituent_virtual_links"]
index faa090b..8e0134e 100755 (executable)
@@ -249,11 +249,11 @@ class DCNetwork(Containernet):
         try:
             self.DCNetwork_graph.remove_edge(node2.name, node1.name)
         except:
-            LOG.warning("%s not found in DCNetwork_graph." % ((node2.name, node1.name)))
+            LOG.warning("%s, %s not found in DCNetwork_graph." % ((node2.name, node1.name)))
         try:
             self.DCNetwork_graph.remove_edge(node1.name, node2.name)
         except:
-            LOG.warning("%s not found in DCNetwork_graph." % ((node1.name, node2.name)))
+            LOG.warning("%s, %s not found in DCNetwork_graph." % ((node1.name, node2.name)))
 
     def addDocker( self, label, **params ):
         """
index 6ed7efe..1e43a75 100755 (executable)
@@ -58,317 +58,6 @@ class testRestApi(ApiBaseOpenStack):
 
         # start Mininet network
         self.startNet()
-        
-    @unittest.skip("temporarily disabled")
-    def testChainingDummy(self):
-        print('->>>>>>> test Chaining Class->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        print(" ")
-
-        headers = {'Content-type': 'application/json'}
-        test_heatapi_template_create_stack = open(os.path.join(os.path.dirname(__file__), "test_heatapi_template_chaining.json")).read()
-        url = "http://0.0.0.0:8004/v1/tenantabc123/stacks"
-        requests.post(url, data=json.dumps(json.loads(test_heatapi_template_create_stack)), headers=headers)
-
-
-        print('->>>>>>> test Chaining Versions ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/"
-        listapiversionstackresponse = requests.get(url, headers=headers)
-        self.assertEqual(listapiversionstackresponse.status_code, 200)
-        self.assertEqual(json.loads(listapiversionstackresponse.content)["versions"][0]["id"], "v1")
-        print(" ")
-
-        print('->>>>>>> test Chaining List ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/list"
-        chainlistresponse = requests.get(url, headers=headers)
-        self.assertEqual(chainlistresponse.status_code, 200)
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"], [])
-        print(" ")
-
-        print('->>>>>>> test Loadbalancing List ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/lb/list"
-        lblistresponse = requests.get(url, headers=headers)
-        self.assertEqual(lblistresponse.status_code, 200)
-        self.assertEqual(json.loads(lblistresponse.content)["loadbalancers"], [])
-        print(" ")
-
-        testchain = "dc0_s1_firewall1/fire-out-0/dc0_s1_iperf1/iper-in-0"
-        print('->>>>>>> test Chain VNF Interfaces ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" %(testchain)
-        chainvnfresponse = requests.put(url)
-        self.assertEqual(chainvnfresponse.status_code, 200)
-        self.assertGreaterEqual(json.loads(chainvnfresponse.content)["cookie"], 0)
-        print(" ")
-
-        print('->>>>>>> test Chaining List ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/list"
-        chainlistresponse = requests.get(url, headers=headers)
-        self.assertEqual(chainlistresponse.status_code, 200)
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"][0]["dst_vnf"], "dc0_s1_firewall1")
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"][0]["dst_intf"], "fire-out-0")
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"][0]["src_vnf"], "dc0_s1_iperf1")
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"][0]["src_intf"], "iper-in-0")
-        print(" ")
-
-        print('->>>>>>> test Chain VNF Delete Chain ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        deletechainvnfresponse = requests.delete(url)
-        self.assertEqual(deletechainvnfresponse.status_code, 200)
-        self.assertEqual(deletechainvnfresponse.content, "true")
-        print(" ")
-
-        print('->>>>>>> test Chaining List If Empty Again ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/list"
-        chainlistresponse = requests.get(url, headers=headers)
-        self.assertEqual(chainlistresponse.status_code, 200)
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"], [])
-        print(" ")
-
-        testchain = "dc0_s1_firewall1/fire-out-0/dc0_s1_iperf1/iper-in-0"
-        print('->>>>>>> test Stack Chain VNF Interfaces ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        stackchainvnfresponse = requests.post(url, data=json.dumps(json.loads('{"path":["dc1.s1", "s1","s2","s3","s1","dc1.s1"]}')), headers=headers)
-        self.assertEqual(stackchainvnfresponse.status_code, 200)
-        print (stackchainvnfresponse.content)
-        self.assertGreaterEqual(json.loads(stackchainvnfresponse.content)["cookie"], 0)
-        print(" ")
-
-
-        print('->>>>>>> test Stack Chaining List ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/list"
-        chainlistresponse = requests.get(url, headers=headers)
-        self.assertEqual(chainlistresponse.status_code, 200)
-        print (chainlistresponse.content)
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"][0]["dst_vnf"], "dc0_s1_firewall1")
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"][0]["dst_intf"], "fire-out-0")
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"][0]["src_vnf"], "dc0_s1_iperf1")
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"][0]["src_intf"], "iper-in-0")
-        self.assertItemsEqual(json.loads(chainlistresponse.content)["chains"][0]["path"],['dc1.s1', 's1', 's2', 's3', 's1', 'dc1.s1'])
-        print(" ")
-
-        print('->>>>>>> test Chain VNF Delete Chain ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        deletechainvnfresponse = requests.delete(url)
-        self.assertEqual(deletechainvnfresponse.status_code, 200)
-        self.assertEqual(deletechainvnfresponse.content, "true")
-        print(" ")
-
-        print('->>>>>>> test Chaining List If Empty Again ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/list"
-        chainlistresponse = requests.get(url, headers=headers)
-        self.assertEqual(chainlistresponse.status_code, 200)
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"], [])
-        print(" ")
-
-
-        testchain = "dc0_s1_firewall1/non-existing-interface/dc0_s1_iperf1/iper-in-0"
-        print('->>>>>>> test Chain VNF Interfaces ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        chainvnfresponse = requests.put(url)
-        self.assertEqual(chainvnfresponse.status_code, 501)
-        print(" ")
-
-        testchain = "dc0_s1_firewall1/fire-out-0/dc0_s1_iperf1/non-existing-interface"
-        print('->>>>>>> test Chain VNF Interfaces ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        chainvnfresponse = requests.put(url)
-        self.assertEqual(chainvnfresponse.status_code, 501)
-        print(" ")
-
-        testchain = "dc0_s1_firewall1/non-existing-interface/dc0_s1_iperf1/iper-in-0"
-        print('->>>>>>> test Chain VNF Delete Chain ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        deletechainvnfresponse = requests.delete(url)
-        self.assertEqual(deletechainvnfresponse.status_code, 501)
-        print(" ")
-
-        testchain = "dc0_s1_firewall1/fire-out-0/dc0_s1_iperf1/non-existing-interface"
-        print('->>>>>>> test Chain VNF Delete Chain ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        deletechainvnfresponse = requests.delete(url)
-        self.assertEqual(deletechainvnfresponse.status_code, 501)
-        print(" ")
-
-        testchain = "non-existent-dc/s1/firewall1/firewall1:cp03:output/dc0/s1/iperf1/iperf1:cp02:input"
-        print('->>>>>>> test Chain VNF Non-Existing DC ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        chainvnfresponse = requests.put(url)
-        self.assertEqual(chainvnfresponse.status_code, 500)
-        print(" ")
-
-
-        testchain = "dc0/s1/firewall1/non-existent:cp03:output/dc0/s1/iperf1/iperf1:cp02:input"
-        print('->>>>>>> test Chain VNF Non-Existing Interfaces ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        chainvnfresponse = requests.put(url)
-        self.assertEqual(chainvnfresponse.status_code, 500)
-        print(" ")
-
-        testchain = "dc0/s1/firewall1/firewall1:cp03:output/dc0/s1/iperf1/non-existent:cp02:input"
-        print('->>>>>>> test Chain VNF Non-Existing Interfaces ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        chainvnfresponse = requests.put(url)
-        self.assertEqual(chainvnfresponse.status_code, 500)
-        print(" ")
-
-        testchain = "dc0/s1/firewall1/firewall1:cp03:output/dc0/s1/iperf1/iperf1:cp02:input"
-        print('->>>>>>> test Chain VNF Interfaces ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        chainvnfresponse = requests.put(url)
-        print (chainvnfresponse.content)
-        self.assertEqual(chainvnfresponse.status_code, 200)
-        self.assertGreaterEqual(json.loads(chainvnfresponse.content)["cookie"], 0)
-        print(" ")
-
-        print('->>>>>>> test Chain VNF Delete Chain ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        deletechainvnfresponse = requests.delete(url)
-        self.assertEqual(deletechainvnfresponse.status_code, 200)
-        self.assertEqual(deletechainvnfresponse.content, "true")
-        print(" ")
-
-        print('->>>>>>> test Chaining List If Empty Again ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/list"
-        chainlistresponse = requests.get(url, headers=headers)
-        self.assertEqual(chainlistresponse.status_code, 200)
-        self.assertEqual(json.loads(chainlistresponse.content)["chains"], [])
-        print(" ")
-
-        testchain = "dc0/s1/firewall1/firewall1:cp03:output/dc0/s1/iperf1/iperf1:cp02:input"
-        print('->>>>>>> test Stack Chain VNF Interfaces ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        stackchainvnfresponse = requests.post(url, data=json.dumps(
-            json.loads('{"path":["dc1.s1", "s1","s2","s3","s1","dc1.s1"]}')), headers=headers)
-        self.assertEqual(stackchainvnfresponse.status_code, 200)
-        print (stackchainvnfresponse.content)
-        self.assertGreaterEqual(json.loads(stackchainvnfresponse.content)["cookie"], 0)
-        print(" ")
-
-        testchain = "dc0/s1/firewall1/firewall1:cp03:output/dc0/s1/iperf1/iperf1:cp02:input"
-        print('->>>>>>> test Stack Chain VNF Interfaces ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/chain/%s" % (testchain)
-        stackchainvnfresponse = requests.delete(url, headers=headers)
-        self.assertEqual(stackchainvnfresponse.status_code, 200)
-        print(" ")
-
-
-        print('->>>>>>> test Loadbalancing ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/lb/dc0/s1/firewall1/firewall1:cp03:output"
-        lblistresponse = requests.post(url, data=json.dumps(
-            {"dst_vnf_interfaces":[{"pop":"dc0","stack":"s1","server":"iperf1","port":"iperf1:cp02:input"}]})
-            , headers=headers)
-        print (lblistresponse.content)
-        self.assertEqual(lblistresponse.status_code, 200)
-        self.assertIn("dc0_s1_firewall1:fire-out-0", lblistresponse.content)
-        print(" ")
-
-        print('->>>>>>> test Loadbalancing List ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/lb/list"
-        lblistresponse = requests.get(url, headers=headers)
-        self.assertEqual(lblistresponse.status_code, 200)
-        print (lblistresponse.content )
-        self.assertEqual(json.loads(lblistresponse.content)["loadbalancers"][0]["paths"][0]["dst_vnf"], "dc0_s1_iperf1")
-        self.assertEqual(json.loads(lblistresponse.content)["loadbalancers"][0]["paths"][0]["dst_intf"], "iper-in-0")
-        self.assertEqual(json.loads(lblistresponse.content)["loadbalancers"][0]["src_vnf"], "dc0_s1_firewall1")
-        self.assertEqual(json.loads(lblistresponse.content)["loadbalancers"][0]["src_intf"],"fire-out-0")
-        print(" ")
-
-        print('->>>>>>> test delete Loadbalancing ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/lb/dc0/s1/firewall1/firewall1:cp03:output"
-        lbdeleteresponse = requests.delete(url, headers=headers)
-        print (lbdeleteresponse.content)
-        self.assertEqual(lbdeleteresponse.status_code, 200)
-        print(" ")
-
-        print('->>>>>>> testFloatingLoadbalancer ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/lb/dc0/floating/bla/blubb"
-        lblistresponse = requests.post(url, data=json.dumps(
-            {"dst_vnf_interfaces":[{"pop":"dc0","stack":"s1","server":"iperf1","port":"iperf1:cp02:input"}]})
-            , headers=headers)
-        print (lblistresponse.content)
-        self.assertEqual(lblistresponse.status_code, 200)
-        resp = json.loads(lblistresponse.content)
-        self.assertIsNotNone(resp.get('cookie'))
-        self.assertIsNotNone(resp.get('floating_ip'))
-        cookie = resp.get('cookie')
-        print(" ")
-
-        print('->>>>>>> testDeleteFloatingLoadbalancer ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/lb/dc0/floating/%s/blubb" % cookie
-        lblistresponse = requests.delete(url, headers=headers)
-        print (lblistresponse.content)
-        self.assertEqual(lblistresponse.status_code, 200)
-        print(" ")
-
-        print('->>>>>>> testLoadbalancingCustomPath ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/lb/dc0_s1_firewall1/fire-out-0"
-        lblistresponse = requests.post(url, data=json.dumps(
-            {"dst_vnf_interfaces":{"dc0_s1_iperf1":"iper-in-0"},
-             "path": {"dc0_s1_iperf1": {"iper-in-0": ["dc1.s1", "s1","s2","s3","s1","dc1.s1"]}}}), headers=headers)
-        print (lblistresponse.content)
-        self.assertEqual(lblistresponse.status_code, 200)
-        self.assertIn("dc0_s1_firewall1:fire-out-0", lblistresponse.content)
-        print(" ")
-
-        print('->>>>>>> testLoadbalancingListCustomPath ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/lb/list"
-        lblistresponse = requests.get(url, headers=headers)
-        self.assertEqual(lblistresponse.status_code, 200)
-        print (lblistresponse.content )
-        self.assertEqual(json.loads(lblistresponse.content)["loadbalancers"][0]["paths"][0]["dst_vnf"], "dc0_s1_iperf1")
-        self.assertEqual(json.loads(lblistresponse.content)["loadbalancers"][0]["paths"][0]["dst_intf"], "iper-in-0")
-        self.assertEqual(json.loads(lblistresponse.content)["loadbalancers"][0]["paths"][0]["path"],
-                         ["dc1.s1", "s1","s2","s3","s1","dc1.s1"] )
-        self.assertEqual(json.loads(lblistresponse.content)["loadbalancers"][0]["src_vnf"], "dc0_s1_firewall1")
-        self.assertEqual(json.loads(lblistresponse.content)["loadbalancers"][0]["src_intf"],"fire-out-0")
-        print(" ")
-
-
-        print('->>>>>>> test Delete Loadbalancing ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/lb/dc0_s1_firewall1/fire-out-0"
-        lblistresponse = requests.delete(url, headers=headers)
-        self.assertEqual(lblistresponse.status_code, 200)
-        print(" ")
-
-        print('->>>>>>> test Query Topology ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:4000/v1/topo"
-        topolistresponse = requests.get(url, headers=headers)
-        print(topolistresponse.content)
-        self.assertEqual(topolistresponse.status_code, 200)
-        print(" ")
-
 
     def testNovaDummy(self):
         print('->>>>>>> test Nova Dummy Class->>>>>>>>>>>>>>>')
@@ -531,8 +220,6 @@ class testRestApi(ApiBaseOpenStack):
             if image["name"] == "ubuntu:trusty":
                 ubuntu_image_id = image["id"]
 
-
-
         print('->>>>>>> test Nova Create Server Instance ->>>>>>>>>>>>>>>')
         print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
         url = "http://0.0.0.0:18774/v2.1/id_bla/servers"
@@ -573,8 +260,6 @@ class testRestApi(ApiBaseOpenStack):
         self.assertEqual(listnonexistingserverdetailsresponse.status_code, 404)
         print(" ")
 
-
-
     def testNeutronDummy(self):
         print('->>>>>>> test Neutron Dummy Class->>>>>>>>>>>>>>>')
         print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
@@ -780,8 +465,6 @@ class testRestApi(ApiBaseOpenStack):
         self.assertEqual(updatenonexistingsubnetresponse.status_code, 404)
         print(" ")
 
-
-
         print('->>>>>>> test Neutron List Ports ->>>>>>>>>>>>>>>')
         print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
         url = "http://0.0.0.0:19696/v2.0/ports"
@@ -963,7 +646,6 @@ class testRestApi(ApiBaseOpenStack):
         self.assertEqual(json.loads(gettokenstackresponse.content)["access"]["user"]["name"], "tenantName")
         print(" ")
 
-
     def testHeatDummy(self):
         print('->>>>>>> test Heat Dummy Class->>>>>>>>>>>>>>>')
         print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
@@ -1053,119 +735,6 @@ class testRestApi(ApiBaseOpenStack):
         self.assertEqual(deletestackdetailsresponse.status_code, 204)
         print(" ")
 
-
-    def test_CombinedTesting(self):
-        print('->>>>>>> test Combinded tests->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        print(" ")
-
-        headers = {'Content-type': 'application/json'}
-        test_heatapi_template_create_stack = open(os.path.join(os.path.dirname(__file__),
-                                                               "test_heatapi_template_create_stack.json")).read()
-        test_heatapi_template_update_stack = open(os.path.join(os.path.dirname(__file__),
-                                                               "test_heatapi_template_update_stack.json")).read()
-
-        print('->>>>>>> test Combined Create Stack ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:18004/v1/tenantabc123/stacks"
-        createstackresponse = requests.post(url,
-                                            data=json.dumps(json.loads(test_heatapi_template_create_stack)),
-                                            headers=headers)
-        self.assertEqual(createstackresponse.status_code, 201)
-        self.assertNotEqual(json.loads(createstackresponse.content)["stack"]["id"], "")
-        print(" ")
-
-        print('->>>>>>> test Combined Neutron List Ports ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:19696/v2.0/ports"
-        listportsesponse = requests.get(url, headers=headers)
-        self.assertEqual(listportsesponse.status_code, 200)
-        self.assertEqual(len(json.loads(listportsesponse.content)["ports"]), 9)
-        for port in json.loads(listportsesponse.content)["ports"]:
-            self.assertEqual(len(str(port['fixed_ips'][0]['subnet_id'])), 36)
-        print(" ")
-
-        print('->>>>>>> test Combined Neutron List Networks ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:19696/v2.0/networks"
-        listnetworksesponse = requests.get(url, headers=headers)
-        self.assertEqual(listnetworksesponse.status_code, 200)
-        self.assertEqual(len(json.loads(listnetworksesponse.content)["networks"]), 10)
-        for net in json.loads(listnetworksesponse.content)["networks"]:
-            self.assertEqual(len(str(net['subnets'][0])), 36)
-        print(" ")
-
-        print('->>>>>>> test Combined Update Stack ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:18004/v1/tenantabc123updateStack/stacks/%s"% \
-              json.loads(createstackresponse.content)['stack']['id']
-        updatestackresponse = requests.put(url,
-                                           data=json.dumps(json.loads(test_heatapi_template_update_stack)),
-                                           headers=headers)
-        self.assertEqual(updatestackresponse.status_code, 202)
-        liststackdetailsresponse = requests.get(url, headers=headers)
-        self.assertEqual(json.loads(liststackdetailsresponse.content)["stack"]["stack_status"], "UPDATE_COMPLETE")
-        print(" ")
-
-        print('->>>>>>> test Combined Neutron List Ports ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:19696/v2.0/ports"
-        listportsesponse = requests.get(url, headers=headers)
-        self.assertEqual(listportsesponse.status_code, 200)
-        self.assertEqual(len(json.loads(listportsesponse.content)["ports"]), 18)
-        for port in json.loads(listportsesponse.content)["ports"]:
-            self.assertEqual(len(str(port['fixed_ips'][0]['subnet_id'])), 36)
-        print(" ")
-
-        print('->>>>>>> test Combined Neutron List Networks ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:19696/v2.0/networks"
-        listnetworksesponse = requests.get(url, headers=headers)
-        self.assertEqual(listnetworksesponse.status_code, 200)
-        self.assertEqual(len(json.loads(listnetworksesponse.content)["networks"]), 14)
-        for net in json.loads(listnetworksesponse.content)["networks"]:
-            self.assertEqual(len(str(net['subnets'][0])), 36)
-        print(" ")
-
-
-        # workflow create floating ip and assign it to a server
-
-        print('->>>>>>> CombinedNeutronCreateFloatingIP ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:19696/v2.0/floatingips"
-        createflip = requests.post(url, headers=headers,
-                                            data='{"floatingip":{"floating_network_id":"default"}}')
-        self.assertEqual(createflip.status_code, 200)
-        self.assertIsNotNone(json.loads(createflip.content)["floatingip"].get("port_id"))
-        port_id = json.loads(createflip.content)["floatingip"].get("port_id")
-        print(" ")
-
-        print('->>>>>>> CombinedNovaGetServer ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:18774/v2.1/id_bla/servers/detail"
-        listserverapisdetailedresponse = requests.get(url, headers=headers)
-        self.assertEqual(listserverapisdetailedresponse.status_code, 200)
-        self.assertEqual(json.loads(listserverapisdetailedresponse.content)["servers"][0]["status"], "ACTIVE")
-        server_id = json.loads(listserverapisdetailedresponse.content)["servers"][0]["id"]
-        print(" ")
-
-        print('->>>>>>> CombinedNovaAssignInterface ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:18774/v2.1/id_bla/servers/%s/os-interface" % server_id
-        assign = requests.post(url, headers=headers,
-                                            data='{"interfaceAttachment":{"net_id": "default"}}')
-        self.assertEqual(assign.status_code, 202)
-        self.assertIsNotNone(json.loads(assign.content)["interfaceAttachment"].get("port_id"))
-        port_id = json.loads(assign.content)["interfaceAttachment"].get("port_id")
-        print(" ")
-
-        print('->>>>>>> CombinedNovaDeleteInterface ->>>>>>>>>>>>>>>')
-        print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
-        url = "http://0.0.0.0:18774/v2.1/id_bla/servers/%s/os-interface/%s" % (server_id, port_id)
-        getintfs = requests.delete(url, headers=headers)
-        self.assertEqual(getintfs.status_code, 202)
-        print(" ")
-
     def testNeutronSFC(self):
         """
         Tests the Neutron Service Function Chaining implementation. As Some functions build up on others, a
@@ -1286,7 +855,6 @@ class testRestApi(ApiBaseOpenStack):
         self.assertEqual(ppg2_show_resp.status_code, 200)
         self.assertEqual(json.loads(ppg2_show_resp.content)["port_pair_group"]["name"], "ppg2")
 
-
         print('->>>>>>> test Neutron SFC Flow Classifier Create ->>>>>>>>>>>>>>>')
         print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
         url = "http://0.0.0.0:19696/v2.0/sfc/flow_classifiers"
index 1b13158..9cdccac 100755 (executable)
@@ -51,7 +51,7 @@ class testSonataDummyGatekeeper(SimpleTestTopology):
         self.net.addLink(self.dc[0], self.dc[1])
         self.net.addLink(self.h[1], self.dc[1])
         # connect dummy GK to data centers
-        sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000)
+        sdkg1 = SonataDummyGatekeeperEndpoint("127.0.0.1", 55000)
         sdkg1.connectDatacenter(self.dc[0])
         sdkg1.connectDatacenter(self.dc[1])
         # run the dummy gatekeeper (in another thread, don't block)
@@ -59,27 +59,27 @@ class testSonataDummyGatekeeper(SimpleTestTopology):
         time.sleep(3)
         # start Mininet network
         self.startNet()
-        time.sleep(1)
+        time.sleep(3)
 
         print "starting tests"
         # board package
         files = {"package": open(PACKAGE_PATH, "rb")}
-        r = requests.post("http://127.0.0.1:5000/packages", files=files)
+        r = requests.post("http://127.0.0.1:55000/packages", files=files)
         self.assertEqual(r.status_code, 201)
         self.assertTrue(json.loads(r.text).get("service_uuid") is not None)
 
         # instantiate service
         self.service_uuid = json.loads(r.text).get("service_uuid")
-        r2 = requests.post("http://127.0.0.1:5000/instantiations", data=json.dumps({"service_uuid": self.service_uuid}))
+        r2 = requests.post("http://127.0.0.1:55000/instantiations", data=json.dumps({"service_uuid": self.service_uuid}))
         self.assertEqual(r2.status_code, 201)
 
         # give the emulator some time to instantiate everything
         time.sleep(2)
 
         # check get request APIs
-        r3 = requests.get("http://127.0.0.1:5000/packages")
+        r3 = requests.get("http://127.0.0.1:55000/packages")
         self.assertEqual(len(json.loads(r3.text).get("service_uuid_list")), 1)
-        r4 = requests.get("http://127.0.0.1:5000/instantiations")
+        r4 = requests.get("http://127.0.0.1:55000/instantiations")
         self.assertEqual(len(json.loads(r4.text).get("service_instantiations_list")), 1)
 
         # check number of running nodes
@@ -157,7 +157,7 @@ class testSonataDummyGatekeeper(SimpleTestTopology):
         self.net.addLink(self.dc[0], self.dc[1])
         self.net.addLink(self.h[1], self.dc[1])
         # connect dummy GK to data centers
-        sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000)
+        sdkg1 = SonataDummyGatekeeperEndpoint("127.0.0.1", 55001)
         sdkg1.connectDatacenter(self.dc[0])
         sdkg1.connectDatacenter(self.dc[1])
         # run the dummy gatekeeper (in another thread, don't block)
@@ -165,27 +165,27 @@ class testSonataDummyGatekeeper(SimpleTestTopology):
         time.sleep(3)
         # start Mininet network
         self.startNet()
-        time.sleep(1)
+        time.sleep(3)
 
         print "starting tests"
         # board package
         files = {"package": open(PACKAGE_PATH, "rb")}
-        r = requests.post("http://127.0.0.1:5000/packages", files=files)
+        r = requests.post("http://127.0.0.1:55001/packages", files=files)
         self.assertEqual(r.status_code, 201)
         self.assertTrue(json.loads(r.text).get("service_uuid") is not None)
 
         # instantiate service
         self.service_uuid = json.loads(r.text).get("service_uuid")
-        r2 = requests.post("http://127.0.0.1:5000/instantiations", data=json.dumps({"service_uuid": self.service_uuid}))
+        r2 = requests.post("http://127.0.0.1:55001/instantiations", data=json.dumps({"service_uuid": self.service_uuid}))
         self.assertEqual(r2.status_code, 201)
 
         # give the emulator some time to instantiate everything
         time.sleep(2)
 
         # check get request APIs
-        r3 = requests.get("http://127.0.0.1:5000/packages")
+        r3 = requests.get("http://127.0.0.1:55001/packages")
         self.assertEqual(len(json.loads(r3.text).get("service_uuid_list")), 1)
-        r4 = requests.get("http://127.0.0.1:5000/instantiations")
+        r4 = requests.get("http://127.0.0.1:55001/instantiations")
         self.assertEqual(len(json.loads(r4.text).get("service_instantiations_list")), 1)
 
         # check number of running nodes
@@ -198,9 +198,9 @@ class testSonataDummyGatekeeper(SimpleTestTopology):
         # stop the service
         service_instance_uuid = json.loads(r2.text).get("service_instance_uuid")
         self.assertTrue(service_instance_uuid is not None)
-        requests.delete("http://127.0.0.1:5000/instantiations", data=json.dumps({"service_uuid": self.service_uuid, "service_instance_uuid":service_instance_uuid}))
+        requests.delete("http://127.0.0.1:55001/instantiations", data=json.dumps({"service_uuid": self.service_uuid, "service_instance_uuid":service_instance_uuid}))
 
-        r5 = requests.get("http://127.0.0.1:5000/instantiations")
+        r5 = requests.get("http://127.0.0.1:55001/instantiations")
         self.assertTrue(len(json.loads(r5.text).get("service_instantiations_list")), 0)     # note that there was 1 instance before
 
         # stop Mininet network
@@ -213,7 +213,7 @@ class testSonataDummyGatekeeper(SimpleTestTopology):
         # create network
         self.createNet(ndatacenter=2, nhosts=2)
         # connect dummy GK to data centers
-        sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000)
+        sdkg1 = SonataDummyGatekeeperEndpoint("127.0.0.1", 55002)
         sdkg1.connectDatacenter(self.dc[0])
         sdkg1.connectDatacenter(self.dc[1])
         # run the dummy gatekeeper (in another thread, don't block)
@@ -221,35 +221,35 @@ class testSonataDummyGatekeeper(SimpleTestTopology):
         time.sleep(3)
         # start Mininet network
         self.startNet()
-        time.sleep(1)
+        time.sleep(3)
 
         print "starting tests"
         # board package
         files = {"package": open("misc/sonata-stress-service.son", "rb")}
-        r = requests.post("http://127.0.0.1:5000/packages", files=files)
+        r = requests.post("http://127.0.0.1:55002/packages", files=files)
         self.assertEqual(r.status_code, 201)
         self.assertTrue(json.loads(r.text).get("service_uuid") is not None)
 
         # instantiate service
         self.service_uuid = json.loads(r.text).get("service_uuid")
-        r2 = requests.post("http://127.0.0.1:5000/instantiations", data=json.dumps({"service_uuid": self.service_uuid}))
+        r2 = requests.post("http://127.0.0.1:55002/instantiations", data=json.dumps({"service_uuid": self.service_uuid}))
         self.assertEqual(r2.status_code, 201)
 
         # give the emulator some time to instantiate everything
         time.sleep(2)
 
         # check get request APIs
-        r3 = requests.get("http://127.0.0.1:5000/packages")
+        r3 = requests.get("http://127.0.0.1:55002/packages")
         self.assertEqual(len(json.loads(r3.text).get("service_uuid_list")), 1)
-        r4 = requests.get("http://127.0.0.1:5000/instantiations")
+        r4 = requests.get("http://127.0.0.1:55002/instantiations")
         self.assertEqual(len(json.loads(r4.text).get("service_instantiations_list")), 1)
 
         # stop the service
         service_instance_uuid = json.loads(r2.text).get("service_instance_uuid")
         self.assertTrue(service_instance_uuid is not None)
-        requests.delete("http://127.0.0.1:5000/instantiations", data=json.dumps({"service_uuid": self.service_uuid, "service_instance_uuid":service_instance_uuid}))
+        requests.delete("http://127.0.0.1:55002/instantiations", data=json.dumps({"service_uuid": self.service_uuid, "service_instance_uuid":service_instance_uuid}))
 
-        r5 = requests.get("http://127.0.0.1:5000/instantiations")
+        r5 = requests.get("http://127.0.0.1:55002/instantiations")
         self.assertTrue(len(json.loads(r5.text).get("service_instantiations_list")), 0)     # note that there was 1 instance before
 
         # stop Mininet network