Support query service resources by modeluuid 57/33557/1
authorc00149107 <chenchuanyu@huawei.com>
Thu, 1 Mar 2018 08:00:13 +0000 (16:00 +0800)
committerc00149107 <chenchuanyu@huawei.com>
Thu, 1 Mar 2018 08:00:13 +0000 (16:00 +0800)
Support query service resources by modeluuid

Change-Id: I7fd1adb19146486314a664ebc15422ca82a2d5f4
Issue-ID: SO-451
Signed-off-by: c00149107 <chenchuanyu@huawei.com>
bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy

index 50e761e..dd6e56a 100644 (file)
@@ -694,6 +694,49 @@ class CatalogDbUtils {
                return vnfsList\r
        }\r
 \r
+       public JSONObject getServiceResourcesByServiceModelUuid(Execution execution, String serviceModelUuid) {\r
+        JSONObject resources = null\r
+        String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
+        try {\r
+            String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
+\r
+            if (catalogDbResponse != null) {\r
+\r
+                resources = parseServiceResourcesJson(catalogDbResponse, "v1")\r
+            }\r
+\r
+        }\r
+        catch (Exception e) {\r
+            utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)\r
+        }\r
+\r
+        return resources\r
+    }\r
+\r
+    public JSONObject getServiceResourcesByServiceModelUuid(Execution execution, String serviceModelUuid, String catalogUtilsVersion) {\r
+        JSONObject resources = null\r
+        String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
+        try {\r
+            String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
+\r
+            if (catalogDbResponse != null) {\r
+                if (!catalogUtilsVersion.equals("v1")) {\r
+                    resources = new JSONObject(catalogDbResponse)\r
+                }\r
+                else {\r
+                    resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)\r
+                }\r
+            }\r
+\r
+        }\r
+        catch (Exception e) {\r
+            utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)\r
+        }\r
+\r
+        return resources\r
+    }\r
+\r
+       \r
        public JSONObject getServiceResourcesByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid) {\r
                JSONObject resources = null\r
                String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r