From 9de144d47d9283b348d69891a5303f789754df58 Mon Sep 17 00:00:00 2001 From: c00149107 Date: Thu, 1 Mar 2018 16:00:13 +0800 Subject: Support query service resources by modeluuid Support query service resources by modeluuid Change-Id: I7fd1adb19146486314a664ebc15422ca82a2d5f4 Issue-ID: SO-451 Signed-off-by: c00149107 --- .../mso/bpmn/common/scripts/CatalogDbUtils.groovy | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'bpmn/MSOCommonBPMN/src/main/groovy/org') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy index 50e761eb77..dd6e56acc7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy @@ -694,6 +694,49 @@ class CatalogDbUtils { return vnfsList } + public JSONObject getServiceResourcesByServiceModelUuid(Execution execution, String serviceModelUuid) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + + resources = parseServiceResourcesJson(catalogDbResponse, "v1") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelUuid(Execution execution, String serviceModelUuid, String catalogUtilsVersion) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + resources = new JSONObject(catalogDbResponse) + } + else { + resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion) + } + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid) { JSONObject resources = null String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") -- cgit 1.2.3-korg