1710 Rebase - Second Attempt
[so.git] / bpmn / MSOCommonBPMN / src / main / groovy / org / openecomp / mso / bpmn / common / scripts / CatalogDbUtils.groovy
index 4885350..9d67f0a 100644 (file)
@@ -33,6 +33,8 @@ import groovy.json.JsonSlurper
 import groovy.util.slurpersupport.GPathResult\r
 import groovy.xml.QName;\r
 \r
+import org.camunda.bpm.engine.runtime.Execution\r
+\r
 import org.openecomp.mso.logger.MsoLogger;\r
 import org.openecomp.mso.rest.APIResponse;\r
 import org.openecomp.mso.rest.RESTClient\r
@@ -45,17 +47,17 @@ import org.openecomp.mso.rest.RESTConfig
  */\r
 \r
 class CatalogDbUtils {\r
-\r
+       \r
        MsoUtils utils = new MsoUtils()\r
        JsonUtils jsonUtils = new JsonUtils()\r
        MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);\r
        static private String defaultDbAdapterVersion = "v2"\r
 \r
-       public JSONArray getAllNetworksByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) {\r
-               JSONArray networksList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
+       public JSONArray getAllNetworksByServiceModelUuid(Execution execution, String serviceModelUuid) {\r
+               JSONArray networksList = null           \r
+               String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")\r
@@ -68,16 +70,21 @@ class CatalogDbUtils {
 \r
                return networksList\r
        }\r
-       \r
-       public JSONArray getAllNetworksByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid, String catalogUtilsVersion) {\r
-               JSONArray networksList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") \r
+\r
+       public JSONArray getAllNetworksByServiceModelUuid(Execution execution, String serviceModelUuid, String catalogUtilsVersion) {\r
+               JSONArray networksList = null           \r
+               String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)\r
-\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       networksList = responseJson.getJSONArray("serviceNetworks")\r
+                               }\r
+                               else {\r
+                                       networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -88,11 +95,11 @@ class CatalogDbUtils {
                return networksList\r
        }\r
 \r
-       public JSONArray getAllNetworksByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {\r
-               JSONArray networksList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
+       public JSONArray getAllNetworksByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid) {\r
+               JSONArray networksList = null           \r
+               String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")\r
@@ -105,16 +112,21 @@ class CatalogDbUtils {
 \r
                return networksList\r
        }\r
-       \r
-       public JSONArray getAllNetworksByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid, String catalogUtilsVersion) {\r
-               JSONArray networksList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
 \r
+       public JSONArray getAllNetworksByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {\r
+               JSONArray networksList = null           \r
+               String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       networksList = responseJson.getJSONArray("serviceNetworks")\r
+                               }\r
+                               else {\r
+                                       networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -125,11 +137,11 @@ class CatalogDbUtils {
                return networksList\r
        }\r
 \r
-       public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {\r
-               JSONArray networksList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")     \r
+       public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion) {\r
+               JSONArray networksList = null           \r
+               String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")\r
@@ -142,16 +154,21 @@ class CatalogDbUtils {
 \r
                return networksList\r
        }\r
-       \r
-       public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {\r
-               JSONArray networksList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
 \r
+       public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {\r
+               JSONArray networksList = null           \r
+               String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       networksList = responseJson.getJSONArray("serviceNetworks")\r
+                               }\r
+                               else {\r
+                                       networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -162,11 +179,11 @@ class CatalogDbUtils {
                return networksList\r
        }\r
 \r
-       public JSONArray getAllNetworksByNetworkModelCustomizationUuid(String catalogDbEndpoint, String networkModelCustomizationUuid) {\r
-               JSONArray networksList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")\r
+       public JSONArray getAllNetworksByNetworkModelCustomizationUuid(Execution execution, String networkModelCustomizationUuid) {\r
+               JSONArray networksList = null           \r
+               String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")\r
@@ -179,16 +196,21 @@ class CatalogDbUtils {
 \r
                return networksList\r
        }\r
-       \r
-       public JSONArray getAllNetworksByNetworkModelCustomizationUuid(String catalogDbEndpoint, String networkModelCustomizationUuid, String catalogUtilsVersion) {\r
-               JSONArray networksList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")\r
 \r
+       public JSONArray getAllNetworksByNetworkModelCustomizationUuid(Execution execution, String networkModelCustomizationUuid, String catalogUtilsVersion) {\r
+               JSONArray networksList = null           \r
+               String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       networksList = responseJson.getJSONArray("serviceNetworks")\r
+                               }\r
+                               else {\r
+                                       networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -199,11 +221,11 @@ class CatalogDbUtils {
                return networksList\r
        }\r
 \r
-       public JSONArray getAllNetworksByNetworkType(String catalogDbEndpoint, String networkType) {\r
-               JSONArray networksList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")\r
+       public JSONArray getAllNetworksByNetworkType(Execution execution, String networkType) {\r
+               JSONArray networksList = null           \r
+               String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")\r
@@ -216,16 +238,21 @@ class CatalogDbUtils {
 \r
                return networksList\r
        }\r
-       \r
-       public JSONArray getAllNetworksByNetworkType(String catalogDbEndpoint, String networkType, String catalogUtilsVersion) {\r
-               JSONArray networksList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")\r
+\r
+       public JSONArray getAllNetworksByNetworkType(Execution execution, String networkType, String catalogUtilsVersion) {\r
+               JSONArray networksList = null           \r
+               String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)\r
-\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       networksList = responseJson.getJSONArray("serviceNetworks")\r
+                               }\r
+                               else {\r
+                                       networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -237,12 +264,12 @@ class CatalogDbUtils {
        }\r
 \r
 \r
-       public JSONArray getAllVnfsByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) {\r
-               JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
+       public JSONArray getAllVnfsByServiceModelUuid(Execution execution, String serviceModelUuid) {\r
+               JSONArray vnfsList = null               \r
+               String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
                try {\r
                        msoLogger.debug("ENDPOINT: " + endPoint)\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")\r
@@ -255,17 +282,22 @@ class CatalogDbUtils {
 \r
                return vnfsList\r
        }\r
-       \r
-       public JSONArray getAllVnfsByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid, String catalogUtilsVersion) {\r
-               JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
+\r
+       public JSONArray getAllVnfsByServiceModelUuid(Execution execution, String serviceModelUuid, String catalogUtilsVersion) {\r
+               JSONArray vnfsList = null               \r
+               String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
                try {\r
                        msoLogger.debug("ENDPOINT: " + endPoint)\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)\r
-\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       vnfsList = responseJson.getJSONArray("serviceVnfs")\r
+                               }\r
+                               else {\r
+                                       vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -276,12 +308,12 @@ class CatalogDbUtils {
                return vnfsList\r
        }\r
 \r
-       public JSONArray getAllVnfsByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {\r
-               JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
+       public JSONArray getAllVnfsByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid) {\r
+               JSONArray vnfsList = null               \r
+               String endPoint ="/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
                try {\r
                        msoLogger.debug("ENDPOINT: " + endPoint)\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")\r
@@ -294,17 +326,22 @@ class CatalogDbUtils {
 \r
                return vnfsList\r
        }\r
-       \r
-       public JSONArray getAllVnfsByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid, String catalogUtilsVersion) {\r
-               JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
+\r
+       public JSONArray getAllVnfsByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {\r
+               JSONArray vnfsList = null               \r
+               String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
                try {\r
                        msoLogger.debug("ENDPOINT: " + endPoint)\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)\r
-\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       vnfsList = responseJson.getJSONArray("serviceVnfs")\r
+                               }\r
+                               else {\r
+                                       vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -315,12 +352,12 @@ class CatalogDbUtils {
                return vnfsList\r
        }\r
 \r
-       public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {\r
-               JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
+       public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion) {\r
+               JSONArray vnfsList = null               \r
+               String endPoint =  "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
                try {\r
                        msoLogger.debug("ENDPOINT: " + endPoint)\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")\r
@@ -333,17 +370,22 @@ class CatalogDbUtils {
 \r
                return vnfsList\r
        }\r
-       \r
-       public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {\r
-               JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
+\r
+       public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {\r
+               JSONArray vnfsList = null               \r
+               String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
                try {\r
                        msoLogger.debug("ENDPOINT: " + endPoint)\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)\r
-\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       vnfsList = responseJson.getJSONArray("serviceVnfs")\r
+                               }\r
+                               else {\r
+                                       vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -354,12 +396,12 @@ class CatalogDbUtils {
                return vnfsList\r
        }\r
 \r
-       public JSONArray getAllVnfsByVnfModelCustomizationUuid(String catalogDbEndpoint, String vnfModelCustomizationUuid) {\r
-               JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")\r
+       public JSONArray getAllVnfsByVnfModelCustomizationUuid(Execution execution, String vnfModelCustomizationUuid) {\r
+               JSONArray vnfsList = null               \r
+               String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")\r
                try {\r
                        msoLogger.debug("ENDPOINT: " + endPoint)\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")\r
@@ -373,16 +415,47 @@ class CatalogDbUtils {
                return vnfsList\r
        }\r
        \r
-       public JSONArray getAllVnfsByVnfModelCustomizationUuid(String catalogDbEndpoint, String vnfModelCustomizationUuid, String catalogUtilsVersion) {\r
+       /**\r
+        * This method gets a all vnfs for a particular\r
+        * service from the catalog database using the\r
+        * service model's model name.\r
+        *\r
+        * @param catalogDbEndpoint\r
+        * @param serviceModelModelName\r
+        * @return vnfsList      *\r
+        * \r
+        */\r
+       public JSONArray getAllVnfsByServiceModelModelName(Execution execution, String serviceModelModelName) {\r
                JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")\r
+               String endPoint = "/serviceVnfs?serviceModelName=" + UriUtils.encode(serviceModelModelName, "UTF-8")\r
                try {\r
                        msoLogger.debug("ENDPOINT: " + endPoint)\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)\r
+                               vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", defaultDbAdapterVersion)\r
+                       }\r
+               }catch (Exception e) {\r
+                       utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)\r
+               }\r
+               return vnfsList\r
+       }\r
 \r
+       public JSONArray getAllVnfsByVnfModelCustomizationUuid(Execution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) {\r
+               JSONArray vnfsList = null               \r
+               String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")\r
+               try {\r
+                       msoLogger.debug("ENDPOINT: " + endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
+\r
+                       if (catalogDbResponse != null) {\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       vnfsList = responseJson.getJSONArray("serviceVnfs")\r
+                               }\r
+                               else {\r
+                                       vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -393,12 +466,69 @@ class CatalogDbUtils {
                return vnfsList\r
        }\r
 \r
+       /**\r
+        * This method gets a single vf module from\r
+        * the catalog database using the vf module's\r
+        * model name. It returns that vf module as\r
+        * a JSONObject\r
+        *\r
+        * @param catalogDbEndpoint\r
+        * @param vfModuleModelName\r
+        * @return vfModule\r
+        */\r
+       public JSONObject getVfModuleByVfModuleModelName(Execution execution, String vfModuleModelName) {\r
+               JSONObject vfModule = null              \r
+               String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8")\r
+               try{\r
+                       msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
+\r
+                       if (catalogDbResponse != null) {\r
+                               vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1")\r
+                       }\r
+               }\r
+               catch(Exception e){\r
+                       utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)\r
+               }\r
+\r
+               return vfModule\r
+       }\r
+\r
+       /**\r
+        * This method gets a single vf module from\r
+        * the catalog database using the vf module's\r
+        * model name. It returns that vf module as\r
+        * a JSONObject\r
+        *\r
+        * @param catalogDbEndpoint\r
+        * @param vfModuleModelName\r
+        * @param catalogUtilsVersion\r
+        * @return vfModules\r
+        */\r
+       public JSONObject getVfModuleByVfModuleModelName(Execution execution, String vfModuleModelName, String catalogUtilsVersion)  {\r
+               JSONObject vfModule = null\r
+               String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8")\r
+               try{\r
+                       msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
-       public JSONArray getAllottedResourcesByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) {\r
+                       if (catalogDbResponse != null) {\r
+                               vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1")\r
+                       }\r
+               }\r
+               catch(Exception e){\r
+                       utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)\r
+               }\r
+\r
+               return vfModule\r
+       }\r
+\r
+\r
+       public JSONArray getAllottedResourcesByServiceModelUuid(Execution execution, String serviceModelUuid) {\r
                JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
+               String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")\r
@@ -411,16 +541,21 @@ class CatalogDbUtils {
 \r
                return vnfsList\r
        }\r
-       \r
-       public JSONArray getAllottedResourcesByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid, String catalogUtilsVersion) {\r
-               JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
 \r
+       public JSONArray getAllottedResourcesByServiceModelUuid(Execution execution, String serviceModelUuid, String catalogUtilsVersion) {\r
+               JSONArray vnfsList = null\r
+               String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       vnfsList = responseJson.getJSONArray("serviceAllottedResources")\r
+                               }\r
+                               else {\r
+                                       vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -431,11 +566,11 @@ class CatalogDbUtils {
                return vnfsList\r
        }\r
 \r
-       public JSONArray getAllottedResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {\r
+       public JSONArray getAllottedResourcesByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid) {\r
                JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
+               String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")\r
@@ -448,30 +583,37 @@ class CatalogDbUtils {
 \r
                return vnfsList\r
        }\r
-       \r
-       public JSONArray getAllottedResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid, String catalogUtilsVersion) {\r
+\r
+       public JSONArray getAllottedResourcesByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {\r
                JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
+               String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       vnfsList = responseJson.getJSONArray()\r
+                               }\r
+                               else {\r
+                                       vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
                catch (Exception e) {\r
                        utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)\r
+                       utils.log("ERROR", "Exception in Querying Catalog DB: " + e.getStackTrace())\r
                }\r
 \r
                return vnfsList\r
        }\r
 \r
-       public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {\r
+       public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion) {\r
                JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
+               String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")\r
@@ -484,16 +626,21 @@ class CatalogDbUtils {
 \r
                return vnfsList\r
        }\r
-       \r
-       public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {\r
-               JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
 \r
+       public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {\r
+               JSONArray vnfsList = null\r
+               String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       vnfsList = responseJson.getJSONArray("serviceAllottedResources")\r
+                               }\r
+                               else {\r
+                                       vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -504,11 +651,12 @@ class CatalogDbUtils {
                return vnfsList\r
        }\r
 \r
-       public JSONArray getAllottedResourcesByArModelCustomizationUuid(String catalogDbEndpoint, String arModelCustomizationUuid) {\r
+\r
+       public JSONArray getAllottedResourcesByArModelCustomizationUuid(Execution execution, String arModelCustomizationUuid) {\r
                JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")\r
+               String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")\r
@@ -521,15 +669,21 @@ class CatalogDbUtils {
 \r
                return vnfsList\r
        }\r
-       \r
-       public JSONArray getAllottedResourcesByArModelCustomizationUuid(String catalogDbEndpoint, String arModelCustomizationUuid, String catalogUtilsVersion) {\r
+\r
+       public JSONArray getAllottedResourcesByArModelCustomizationUuid(Execution execution, String arModelCustomizationUuid, String catalogUtilsVersion) {\r
                JSONArray vnfsList = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")\r
+               String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                                       vnfsList = responseJson.getJSONArray("serviceAllottedResources")\r
+                               }\r
+                               else {\r
+                                       vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -540,14 +694,14 @@ class CatalogDbUtils {
                return vnfsList\r
        }\r
 \r
-       public JSONObject getServiceResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {\r
+       public JSONObject getServiceResourcesByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid) {\r
                JSONObject resources = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
-\r
+               String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
+\r
                                resources = parseServiceResourcesJson(catalogDbResponse, "v1")\r
                        }\r
 \r
@@ -558,15 +712,20 @@ class CatalogDbUtils {
 \r
                return resources\r
        }\r
-       \r
-       public JSONObject getServiceResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid, String catalogUtilsVersion) {\r
+\r
+       public JSONObject getServiceResourcesByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {\r
                JSONObject resources = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
+               String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       resources = new JSONObject(catalogDbResponse)\r
+                               }\r
+                               else {\r
+                                       resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -575,14 +734,14 @@ class CatalogDbUtils {
                }\r
 \r
                return resources\r
-       }       \r
-       \r
+       }\r
 \r
-       public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {\r
+\r
+       public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion) {\r
                JSONObject resources = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
+               String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
                                resources = parseServiceResourcesJson(catalogDbResponse)\r
@@ -595,15 +754,20 @@ class CatalogDbUtils {
 \r
                return resources\r
        }\r
-       \r
-       public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {\r
+\r
+       public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {\r
                JSONObject resources = null\r
-               String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
+               String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")\r
                try {\r
-                       String catalogDbResponse = getResponseFromCatalogDb(endPoint)\r
+                       String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)\r
 \r
                        if (catalogDbResponse != null) {\r
-                               resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)\r
+                               if (!catalogUtilsVersion.equals("v1")) {\r
+                                       resources = new JSONObject(catalogDbResponse)\r
+                               }\r
+                               else {\r
+                                       resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)\r
+                               }\r
                        }\r
 \r
                }\r
@@ -628,14 +792,14 @@ class CatalogDbUtils {
                        modelInfos = new JSONArray()\r
 \r
                        for (int i = 0; i < networks.length(); i++) {\r
-                               \r
+\r
                                JSONObject network = networks.getJSONObject(i)\r
                                JSONObject modelJson = new JSONObject()\r
                                JSONObject modelInfo = buildModelInfo("network", network, catalogUtilsVersion)\r
                                modelJson.put("modelInfo", modelInfo)\r
                                String networkType = jsonUtils.getJsonValueForKey(network, "networkType")\r
                                modelJson.put("networkType", networkType)\r
-                               \r
+\r
                                switch (catalogUtilsVersion) {\r
                                        case "v1":\r
                                                break\r
@@ -648,7 +812,7 @@ class CatalogDbUtils {
                                                modelJson.put("networkRole", networkRole)\r
                                                String networkScope = jsonUtils.getJsonValueForKey(network, "networkScope")\r
                                                modelJson.put("networkScope", networkScope)\r
-                                               break                                           \r
+                                               break\r
                                }\r
                                modelInfos.put(modelJson)\r
                        }\r
@@ -665,7 +829,7 @@ class CatalogDbUtils {
 \r
        private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {\r
                JSONArray modelInfos = null\r
-               \r
+\r
                msoLogger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion)\r
 \r
                try {\r
@@ -693,14 +857,15 @@ class CatalogDbUtils {
                                                String nfRole = jsonUtils.getJsonValueForKey(vnf, "nfRole")\r
                                                modelJson.put("nfRole", nfRole)\r
                                                String nfCode = jsonUtils.getJsonValueForKey(vnf, "nfCode")\r
-                                               modelJson.put("nfCode", nfCode)\r
-                                               break                                           \r
+                                               modelJson.put("nfNamingCode", nfCode)\r
+                                               String nfFunction = jsonUtils.getJsonValueForKey(vnf, "nfFunction")\r
+                                               modelJson.put("nfFunction", nfFunction)\r
+                                               break\r
                                }\r
                                \r
-                               JSONObject vnfJson = vnf.getJSONObject("vnf")                                                                                           \r
                                JSONArray vfModules = null\r
                                try {\r
-                                       vfModules = vnfJson.getJSONArray("vfModules")\r
+                                       vfModules = vnf.getJSONArray("vfModules")\r
                                } catch (Exception e)\r
                                {\r
                                        msoLogger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message)\r
@@ -729,7 +894,7 @@ class CatalogDbUtils {
                                                                boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase")\r
                                                                vfModuleModelJson.put("isBase", isBase)\r
                                                                break\r
-                                               }                                                                                       \r
+                                               }\r
                                                String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label")\r
                                                vfModuleModelJson.put("vfModuleLabel", vfModuleLabel)\r
                                                Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount")\r
@@ -740,7 +905,7 @@ class CatalogDbUtils {
                                }\r
                                modelInfos.put(modelJson)\r
                        }\r
-                       \r
+\r
                        String modelInfosString = modelInfos.toString()\r
                        msoLogger.debug("Returning vnfs JSON: " + modelInfosString)\r
 \r
@@ -751,9 +916,61 @@ class CatalogDbUtils {
                return modelInfos\r
        }\r
 \r
+       /**\r
+        * This method parses a Vf Module from the\r
+        * Vf Modules array\r
+        *\r
+        * @param catalogDbResponse\r
+        * @param arrayName\r
+        * @param catalogUtilsVersion\r
+        * @return vfModulelJson\r
+        */\r
+       private JSONObject parseVfModuleJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {\r
+               JSONObject vfModulelJson = new JSONObject()\r
+               msoLogger.debug("Started Parse Vf Module Json")\r
+               try {\r
+                       JSONObject responseJson = new JSONObject(catalogDbResponse)\r
+                       JSONArray vfModules = responseJson.getJSONArray(arrayName)\r
+                       if(vfModules != null){\r
+                               JSONObject vfModuleInfo = new JSONObject()\r
+                               for (int i = 0; i < vfModules.length(); i++) {\r
+                                       JSONObject vfModule = vfModules.getJSONObject(i)\r
+                                       JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion)\r
+                                       vfModulelJson.put("modelInfo", vfModuleModelInfo)\r
+                                       String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type")\r
+                                       vfModulelJson.put("vfModuleType", vfModuleType)\r
+                                       switch(catalogUtilsVersion) {\r
+                                               case "v1":\r
+                                                       Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase")\r
+                                                       if (isBase.intValue() == 1) {\r
+                                                               vfModulelJson.put("isBase", "true")\r
+                                                       }\r
+                                                       else {\r
+                                                               vfModulelJson.put("isBase", "false")\r
+                                                       }\r
+                                                       break\r
+                                               default:\r
+                                                       boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase")\r
+                                                       vfModulelJson.put("isBase", isBase)\r
+                                                       break\r
+                                       }\r
+                                       String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label")\r
+                                       vfModulelJson.put("vfModuleLabel", vfModuleLabel)\r
+                                       Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount")\r
+                                       vfModulelJson.put("initialCount", initialCount.intValue())\r
+                               }\r
+                       }\r
+                       msoLogger.debug("Completed Parsing Vf Module: " + vfModulelJson.toString())\r
+               }catch (Exception e){\r
+                       utils.log("DEBUG", "Exception while parsing Vf Modules from Catalog DB Response: " + e.message)\r
+               }\r
+\r
+               return vfModulelJson\r
+       }\r
+\r
        private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {\r
                JSONArray modelInfos = null\r
-               \r
+\r
                msoLogger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion)\r
 \r
                try {\r
@@ -774,12 +991,20 @@ class CatalogDbUtils {
                                        default:\r
                                                String toscaNodeType = jsonUtils.getJsonValueForKey(allottedResource, "toscaNodeType")\r
                                                modelJson.put("toscaNodeType", toscaNodeType)\r
+                                               String nfType = jsonUtils.getJsonValueForKey(allottedResource, "nfType")\r
+                                               modelJson.put("nfType", nfType)\r
+                                               String nfRole = jsonUtils.getJsonValueForKey(allottedResource, "nfRole")\r
+                                               modelJson.put("nfRole", nfRole)\r
+                                               String nfCode = jsonUtils.getJsonValueForKey(allottedResource, "nfCode")\r
+                                               modelJson.put("nfNamingCode", nfCode)\r
+                                               String nfFunction = jsonUtils.getJsonValueForKey(allottedResource, "nfFunction")\r
+                                               modelJson.put("nfFunction", nfFunction)\r
                                                String parentServiceModelUuid = jsonUtils.getJsonValueForKey(allottedResource, "parentServiceModelUuid")\r
                                                modelJson.put("parentServiceModelUuid", parentServiceModelUuid)\r
                                                break\r
                                }\r
-                                               \r
-                               \r
+\r
+\r
                                modelInfos.put(modelJson)\r
                        }\r
 \r
@@ -818,17 +1043,17 @@ class CatalogDbUtils {
 \r
                return serviceResources\r
        }\r
-       \r
+\r
        private JSONObject parseServiceResourcesJson (String catalogDbResponse, String catalogUtilsVersion) {\r
                JSONObject serviceResources = new JSONObject()\r
                JSONObject serviceResourcesObject = new JSONObject()\r
-               String serviceResourcesString = ""              \r
+               String serviceResourcesString = ""\r
 \r
                try {\r
                        // Create array of jsons\r
 \r
                        JSONObject responseJson = new JSONObject(catalogDbResponse)\r
-                       JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources")                        \r
+                       JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources")\r
                        JSONObject modelInfo = buildModelInfo("", serviceResourcesRoot, catalogUtilsVersion)\r
                        serviceResources.put("modelInfo", modelInfo)\r
                        JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "serviceVnfs", catalogUtilsVersion)\r
@@ -860,7 +1085,7 @@ class CatalogDbUtils {
                                String modelInstanceName = jsonUtils.getJsonValueForKey(modelFromDb, "modelInstanceName")\r
                                modelInfo.put("modelInstanceName", modelInstanceName)\r
                        }\r
-                       if (!"vfModule".equals(modelType) && !"vnf".equals(modelType)) {\r
+                       if ((!"vfModule".equals(modelType) && !"vnf".equals(modelType)) || !catalogUtilsVersion.equals("v1")) {\r
                                String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "modelUuid")\r
                                modelInfo.put("modelVersionId", modelVersionId)\r
                        }\r
@@ -884,7 +1109,7 @@ class CatalogDbUtils {
                                default:\r
                                        modelInfo.put("modelCustomizationUuid", modelCustomizationId)\r
                                        break\r
-                       }                       \r
+                       }\r
                        JSONObject modelJson = new JSONObject()\r
                        modelJson.put("modelInfo", modelInfo)\r
                }\r
@@ -894,17 +1119,24 @@ class CatalogDbUtils {
                return modelInfo\r
        }\r
 \r
-       private String getResponseFromCatalogDb (String endPoint) {\r
+       private String getResponseFromCatalogDb (Execution execution, String endPoint) {\r
                try {\r
-                       RESTConfig config = new RESTConfig(endPoint);\r
+                       String catalogDbEndpoint = execution.getVariable("URN_mso_catalog_db_endpoint")\r
+                       String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint\r
+                       RESTConfig config = new RESTConfig(queryEndpoint);\r
                        def responseData = ''\r
                        def bpmnRequestId = UUID.randomUUID().toString()\r
                        RESTClient client = new RESTClient(config).\r
-                               addHeader('X-TransactionId', bpmnRequestId).\r
-                               addHeader('X-FromAppId', 'BPMN').\r
-                               addHeader('Content-Type', 'application/json').\r
-                               addHeader('Accept','application/json');\r
-                       msoLogger.debug('sending GET to Catalog DB endpoint' + endPoint)\r
+                                       addHeader('X-TransactionId', bpmnRequestId).\r
+                                       addHeader('X-FromAppId', 'BPMN').\r
+                                       addHeader('Content-Type', 'application/json').\r
+                                       addHeader('Accept','application/json');\r
+                                       \r
+                       String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB")\r
+                       if (basicAuthCred != null && !"".equals(basicAuthCred)) {\r
+                                       client.addAuthorizationHeader(basicAuthCred)\r
+                       }\r
+                       msoLogger.debug('sending GET to Catalog DB endpoint: ' + endPoint)\r
                        APIResponse response = client.httpGet()\r
 \r
                        responseData = response.getResponseBodyAsString()\r
@@ -928,4 +1160,4 @@ class CatalogDbUtils {
                }\r
 \r
        }\r
-}\r
+}
\ No newline at end of file