From: peusterm Date: Wed, 19 Jun 2019 08:21:25 +0000 (+0200) Subject: Fix: Allow CORS to fetch emulator state X-Git-Tag: v7.0.0rc1~24 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F81%2F7681%2F1;p=osm%2Fvim-emu.git Fix: Allow CORS to fetch emulator state Change-Id: I26e0cc5a570bdc35ec27b9eeb2c4ec528bdf8bf3 Signed-off-by: peusterm --- diff --git a/src/emuvim/api/tango/llcm.py b/src/emuvim/api/tango/llcm.py index 8b4a350..75c71bf 100755 --- a/src/emuvim/api/tango/llcm.py +++ b/src/emuvim/api/tango/llcm.py @@ -52,6 +52,10 @@ LOG = logging.getLogger("5gtango.llcm") LOG.setLevel(logging.INFO) +CORS_HEADER = {'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET,OPTIONS'} + + GK_STORAGE = "/tmp/vim-emu-tango-llcm/" UPLOAD_FOLDER = os.path.join(GK_STORAGE, "uploads/") CATALOG_FOLDER = os.path.join(GK_STORAGE, "catalog/") @@ -1038,7 +1042,7 @@ class Packages(fr.Resource): pkg["pd"]["version"] = sobj.manifest.get("version") pkg["created_at"] = sobj.created_at result.append(pkg) - return result, 200 + return result, 200, CORS_HEADER class Services(fr.Resource): @@ -1060,7 +1064,7 @@ class Services(fr.Resource): service["nsd"]["version"] = sobj.nsd.get("version") service["created_at"] = sobj.created_at result.append(service) - return result, 200 + return result, 200, CORS_HEADER class Instantiations(fr.Resource): @@ -1107,7 +1111,7 @@ class Instantiations(fr.Resource): Returns a list of UUIDs containing all running services. :return: dict / list """ - LOG.info("GET /instantiations or /api/v3/records/services") + LOG.debug("GET /instantiations or /api/v3/records/services") # return {"service_instantiations_list": [ # list(s.instances.iterkeys()) for s in GK.services.itervalues()]} result = list() @@ -1120,7 +1124,7 @@ class Instantiations(fr.Resource): inst["status"] = "running" inst["created_at"] = iobj.get("created_at") result.append(inst) - return result, 200 + return result, 200, CORS_HEADER def delete(self): """