5GTANGO LLCM: Allow service instanceiation by service_name. 72/7072/1
authorpeusterm <manuel.peuster@uni-paderborn.de>
Wed, 19 Dec 2018 12:58:12 +0000 (13:58 +0100)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Wed, 19 Dec 2018 12:58:12 +0000 (13:58 +0100)
Change-Id: I924a1aa3a0e8f852e19a44471630348de176ea5a
Signed-off-by: peusterm <manuel.peuster@uni-paderborn.de>
src/emuvim/api/tango/llcm.py

index d7c24dd..bc94eb0 100755 (executable)
@@ -883,7 +883,15 @@ class Instantiations(fr.Resource):
         # try to extract the service uuid from the request
         json_data = request.get_json(force=True)
         service_uuid = json_data.get("service_uuid")
-
+        service_name = json_data.get("service_name")
+
+        # first try to find by service_name
+        if service_name is not None:
+            for s_uuid, s in GK.services.iteritems():
+                if s.manifest.get("name") == service_name:
+                    LOG.info("Found service: {} with UUID: {}"
+                             .format(service_name, s_uuid))
+                    service_uuid = s_uuid
         # lets be a bit fuzzy here to make testing easier
         if (service_uuid is None or service_uuid ==
                 "latest") and len(GK.services) > 0: