Merge "added check for null object"
[so.git] / bpmn / MSOCommonBPMN / src / main / groovy / org / onap / so / bpmn / common / scripts / CatalogDbUtils.groovy
index f1eab66..103326a 100644 (file)
@@ -22,17 +22,12 @@ package org.onap.so.bpmn.common.scripts
 
 import org.json.JSONObject;
 import org.json.JSONArray;
-import org.json.XML
 import org.onap.logging.ref.slf4j.ONAPLogConstants
 import org.onap.so.bpmn.core.UrnPropertiesReader;
 import org.springframework.web.util.UriUtils;
 
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.client.HttpClient
-import groovy.json.JsonBuilder
-import groovy.json.JsonSlurper
-import groovy.util.slurpersupport.GPathResult
-import groovy.xml.QName;
 
 import javax.ws.rs.core.MediaType
 import javax.ws.rs.core.Response
@@ -57,413 +52,7 @@ class CatalogDbUtils {
        JsonUtils jsonUtils = new JsonUtils()
        static private String defaultDbAdapterVersion = "v2"
 
-       public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
-               JSONArray networksList = null
-               String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return networksList
-       }
-
-       public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
-               JSONArray networksList = null
-               String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       networksList = responseJson.getJSONArray("serviceNetworks")
-                               }
-                               else {
-                                       networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return networksList
-       }
-
-       public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
-               JSONArray networksList = null
-               String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return networksList
-       }
-
-       public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
-               JSONArray networksList = null
-               String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       networksList = responseJson.getJSONArray("serviceNetworks")
-                               }
-                               else {
-                                       networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return networksList
-       }
-
-       public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
-               JSONArray networksList = null
-               String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return networksList
-       }
-
-       public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
-               JSONArray networksList = null
-               String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       networksList = responseJson.getJSONArray("serviceNetworks")
-                               }
-                               else {
-                                       networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return networksList
-       }
-
-       public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid) {
-               JSONArray networksList = null
-               String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return networksList
-       }
-
-       public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid, String catalogUtilsVersion) {
-               JSONArray networksList = null
-               String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       networksList = responseJson.getJSONArray("serviceNetworks")
-                               }
-                               else {
-                                       networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return networksList
-       }
-
-       public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType) {
-               JSONArray networksList = null
-               String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return networksList
-       }
-
-       public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType, String catalogUtilsVersion) {
-               JSONArray networksList = null
-               String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       networksList = responseJson.getJSONArray("serviceNetworks")
-                               }
-                               else {
-                                       networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return networksList
-       }
-
-
-       public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
-               try {
-                       msoLogger.debug("ENDPOINT: " + endPoint)
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
-               try {
-                       msoLogger.debug("ENDPOINT: " + endPoint)
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       vnfsList = responseJson.getJSONArray("serviceVnfs")
-                               }
-                               else {
-                                       vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
-               JSONArray vnfsList = null
-               String endPoint ="/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
-               try {
-                       msoLogger.debug("ENDPOINT: " + endPoint)
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
-               try {
-                       msoLogger.debug("ENDPOINT: " + endPoint)
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       vnfsList = responseJson.getJSONArray("serviceVnfs")
-                               }
-                               else {
-                                       vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
-               JSONArray vnfsList = null
-               String endPoint =  "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
-               try {
-                       msoLogger.debug("ENDPOINT: " + endPoint)
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
-               try {
-                       msoLogger.debug("ENDPOINT: " + endPoint)
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       vnfsList = responseJson.getJSONArray("serviceVnfs")
-                               }
-                               else {
-                                       vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
-               try {
-                       msoLogger.debug("ENDPOINT: " + endPoint)
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       /**
-        * This method gets a all vnfs for a particular
-        * service from the catalog database using the
-        * service model's model name.
-        *
-        * @param catalogDbEndpoint
-        * @param serviceModelModelName
-        * @return vnfsList      *
-        *
-        */
-       public JSONArray getAllVnfsByServiceModelModelName(DelegateExecution execution, String serviceModelModelName) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceVnfs?serviceModelName=" + UriUtils.encode(serviceModelModelName, "UTF-8")
-               try {
-                       msoLogger.debug("ENDPOINT: " + endPoint)
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", defaultDbAdapterVersion)
-                       }
-               }catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-               return vnfsList
-       }
-
-       public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) {
+       public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid) {
                JSONArray vnfsList = null
                String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
                try {
@@ -471,225 +60,7 @@ class CatalogDbUtils {
                        String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
 
                        if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       vnfsList = responseJson.getJSONArray("serviceVnfs")
-                               }
-                               else {
-                                       vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       /**
-        * This method gets a single vf module from
-        * the catalog database using the vf module's
-        * model name. It returns that vf module as
-        * a JSONObject
-        *
-        * @param catalogDbEndpoint
-        * @param vfModuleModelName
-        * @return vfModule
-        */
-       public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName) {
-               JSONObject vfModule = null
-               String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8")
-               try{
-                       msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint)
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1")
-                       }
-               }
-               catch(Exception e){
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vfModule
-       }
-
-       /**
-        * This method gets a single vf module from
-        * the catalog database using the vf module's
-        * model name. It returns that vf module as
-        * a JSONObject
-        *
-        * @param catalogDbEndpoint
-        * @param vfModuleModelName
-        * @param catalogUtilsVersion
-        * @return vfModules
-        */
-       public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName, String catalogUtilsVersion)  {
-               JSONObject vfModule = null
-               String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8")
-               try{
-                       msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint)
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1")
-                       }
-               }
-               catch(Exception e){
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vfModule
-       }
-
-
-       public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
-               JSONArray vnfsList = null
-               String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
-               JSONArray vnfsList = null
-               String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       vnfsList = responseJson.getJSONArray("serviceAllottedResources")
-                               }
-                               else {
-                                       vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       vnfsList = responseJson.getJSONArray()
-                               }
-                               else {
-                                       vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getStackTrace());
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-       public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               if (!catalogUtilsVersion.equals("v1")) {
-                                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       vnfsList = responseJson.getJSONArray("serviceAllottedResources")
-                               }
-                               else {
-                                       vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
-                               }
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return vnfsList
-       }
-
-
-       public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid) {
-               JSONArray vnfsList = null
-               String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
+                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
                        }
 
                }
@@ -701,19 +72,20 @@ class CatalogDbUtils {
                return vnfsList
        }
 
-       public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid, String catalogUtilsVersion) {
+       public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) {
                JSONArray vnfsList = null
-               String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")
+               String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
                try {
+                       msoLogger.debug("ENDPOINT: " + endPoint)
                        String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
 
                        if (catalogDbResponse != null) {
                                if (!catalogUtilsVersion.equals("v1")) {
                                        JSONObject responseJson = new JSONObject(catalogDbResponse)
-                                       vnfsList = responseJson.getJSONArray("serviceAllottedResources")
+                                       vnfsList = responseJson.getJSONArray("serviceVnfs")
                                }
                                else {
-                                       vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
+                                       vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
                                }
                        }
 
@@ -726,26 +98,6 @@ class CatalogDbUtils {
                return vnfsList
        }
 
-       public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution 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)
-                       throw e
-               }
-
-               return resources
-       }
-
        public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
                JSONObject resources = null
                String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
@@ -769,26 +121,6 @@ class CatalogDbUtils {
                return resources
        }
 
-       public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
-               JSONObject resources = null
-               String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-
-                               resources = parseServiceResourcesJson(catalogDbResponse, "v1")
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return resources
-       }
-
        public String getServiceResourcesByServiceModelInvariantUuidString(DelegateExecution execution, String serviceModelInvariantUuid) {
                String resources = null
                String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
@@ -833,27 +165,6 @@ class CatalogDbUtils {
                return resources
        }
 
-
-       public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
-               JSONObject resources = null
-               String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
-               try {
-                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
-                       if (catalogDbResponse != null) {
-                               //TODO this is wrong
-                               resources = parseServiceResourcesJson(catalogDbResponse)
-                       }
-
-               }
-               catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-                       throw e
-               }
-
-               return resources
-       }
-
        public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
                JSONObject resources = null
                String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
@@ -878,8 +189,6 @@ class CatalogDbUtils {
                return resources
        }
 
-
-
        private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
                JSONArray modelInfos = null
 
@@ -1004,58 +313,6 @@ class CatalogDbUtils {
                return modelInfos
        }
 
-       /**
-        * This method parses a Vf Module from the
-        * Vf Modules array
-        *
-        * @param catalogDbResponse
-        * @param arrayName
-        * @param catalogUtilsVersion
-        * @return vfModulelJson
-        */
-       private JSONObject parseVfModuleJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
-               JSONObject vfModulelJson = new JSONObject()
-               msoLogger.debug("Started Parse Vf Module Json")
-               try {
-                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                       JSONArray vfModules = responseJson.getJSONArray(arrayName)
-                       if(vfModules != null){
-                               JSONObject vfModuleInfo = new JSONObject()
-                               for (int i = 0; i < vfModules.length(); i++) {
-                                       JSONObject vfModule = vfModules.getJSONObject(i)
-                                       JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion)
-                                       vfModulelJson.put("modelInfo", vfModuleModelInfo)
-                                       String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type")
-                                       vfModulelJson.put("vfModuleType", vfModuleType)
-                                       switch(catalogUtilsVersion) {
-                                               case "v1":
-                                                       Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase")
-                                                       if (isBase.intValue() == 1) {
-                                                               vfModulelJson.put("isBase", "true")
-                                                       }
-                                                       else {
-                                                               vfModulelJson.put("isBase", "false")
-                                                       }
-                                                       break
-                                               default:
-                                                       boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase")
-                                                       vfModulelJson.put("isBase", isBase)
-                                                       break
-                                       }
-                                       String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label")
-                                       vfModulelJson.put("vfModuleLabel", vfModuleLabel)
-                                       Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount")
-                                       vfModulelJson.put("initialCount", initialCount.intValue())
-                               }
-                       }
-                       msoLogger.debug("Completed Parsing Vf Module: " + vfModulelJson.toString())
-               }catch (Exception e){
-                       msoLogger.debug("Exception while parsing Vf Modules from Catalog DB Response: " + e.message)
-               }
-
-               return vfModulelJson
-       }
-
        private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
                JSONArray modelInfos = null
 
@@ -1108,37 +365,9 @@ class CatalogDbUtils {
                return modelInfos
        }
 
-       //TODO this is wrong
-       private JSONObject parseServiceResourcesJson (String catalogDbResponse) {
-               JSONObject serviceResources = new JSONObject()
-               String catalogUtilsVersion = "v1"
-
-               try {
-                       // Create array of jsons
-
-                       JSONObject responseJson = new JSONObject(catalogDbResponse)
-                       JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources")
-                       JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "vnfResources", catalogUtilsVersion)
-                       serviceResources.put("vnfs", vnfsArray)
-                       JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "networkResourceCustomization", catalogUtilsVersion)
-                       serviceResources.put("networks", networksArray)
-                       JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "allottedResourceCustomization", catalogUtilsVersion)
-                       serviceResources.put("allottedResources", allottedResourcesArray)
-
-                       String serviceResourcesString = serviceResources.toString()
-                       msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString)
-
-               } catch (Exception e) {
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
-               }
-
-               return serviceResources
-       }
-
        private JSONObject parseServiceResourcesJson (String catalogDbResponse, String catalogUtilsVersion) {
                JSONObject serviceResources = new JSONObject()
                JSONObject serviceResourcesObject = new JSONObject()
-               String serviceResourcesString = ""
 
                try {
                        // Create array of jsons
@@ -1154,9 +383,7 @@ class CatalogDbUtils {
                        JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "serviceAllottedResources", catalogUtilsVersion)
                        serviceResources.put("serviceAllottedResources", allottedResourcesArray)
                        serviceResourcesObject.put("serviceResources", serviceResources)
-
-                       serviceResourcesString = serviceResourcesObject.toString()
-                       msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString)
+                       msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString())
 
                } catch (Exception e) {
                        msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);