summaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-catalog-db-adapter')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java19
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java19
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14__RemoveRetryFromRainyDayHandlingTable.sql (renamed from adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14___remove_retry_from_rainy_day_handling_table.sql)0
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.15__UpdateRainyDayHandlerMacroForScaleOut.sql4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.16__Add_Default_NeutronNetwork.sql31
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.17__UpdateCloudSiteColumn.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.18__ControllerSelectionReferenceData.sql4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.19__RenameCustomToNoValidate.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.20__SetActivitiesBBsToNoValidate.sql13
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.21__AddHomingTables.sql9
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.22__AddResourceInput.sql13
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.23__ChangeResourceInputLength.sql10
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.24__UpdateHeatRelatedAttribute.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java42
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java8
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java198
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java25
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java76
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql74
24 files changed, 550 insertions, 21 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
index 63ef8e6dd0..cc1b3ddb17 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
@@ -57,7 +57,7 @@ public abstract class CatalogQuery {
while (m.find()) {
String key = template.substring(m.start() + 1, m.end() - 1);
logger.debug("CatalogQuery key: {} contains key? {}", key , valueMap.containsKey(key));
- m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\""));
+ m.appendReplacement(result, Matcher.quoteReplacement(valueMap.getOrDefault(key, "\"TBD\"")));
}
m.appendTail(result);
logger.debug("CatalogQuery return: {}", result.toString());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
index 3dca6a395c..859666f446 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
@@ -52,7 +52,8 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
"\t\t\"nfFunction\" : <NF_FUNCTION>,\n"+
"\t\t\"nfType\" : <NF_TYPE>,\n"+
"\t\t\"nfRole\" : <NF_ROLE>,\n"+
- "\t\t\"nfNamingCode\" : <NF_NAMING_CODE>\n"+
+ "\t\t\"nfNamingCode\" : <NF_NAMING_CODE>,\n"+
+ "\t\t\"resourceInput\" : <RESOURCE_INPUT>\n"+
"\t}";
public QueryAllottedResourceCustomization() {
@@ -117,7 +118,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName());
put(valueMap, "TOSCA_NODE_TYPE", arNull ? null : o.getAllottedResource().getToscaNodeType());
put(valueMap, "ALLOTTED_RESOURCE_TYPE", arNull ? null : o.getAllottedResource().getSubcategory());
- put(valueMap, "ALLOTTED_RESOURCE_ROLE", o.getTargetNetworkRole());
+ put(valueMap, "ALLOTTED_RESOURCE_ROLE", o.getTargetNetworkRole() != null ? o.getTargetNetworkRole() : o.getNfRole());
put(valueMap, "NF_TYPE", o.getNfType());
put(valueMap, "NF_ROLE", o.getNfRole());
put(valueMap, "NF_FUNCTION", o.getNfFunction());
@@ -125,6 +126,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
put(valueMap, "PROVIDING_SERVICE_MODEL_INVARIANT_UUID", o.getProvidingServiceModelInvariantUUID());
put(valueMap, "PROVIDING_SERVICE_MODEL_UUID", o.getProvidingServiceModelUUID());
put(valueMap, "PROVIDING_SERVICE_MODEL_NAME", o.getProvidingServiceModelName());
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
index 8670b78e15..58a2e852f0 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
@@ -22,6 +22,7 @@ package org.onap.so.adapters.catalogdb.catalogrest;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.db.catalog.beans.Recipe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,12 +57,18 @@ public class QueryResourceRecipe extends CatalogQuery{
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
Map<String, String> valueMap = new HashMap<>();
- valueMap.put("id", null == resourceRecipe ? null :String.valueOf(resourceRecipe.getId()));
- valueMap.put("action", null == resourceRecipe ? null :resourceRecipe.getAction());
- valueMap.put("orchestrationUri", null == resourceRecipe ? null : resourceRecipe.getOrchestrationUri());
- valueMap.put("recipeTimeout", null == resourceRecipe ? null : String.valueOf(resourceRecipe.getRecipeTimeout()));
- valueMap.put("paramXSD", null == resourceRecipe ? null : resourceRecipe.getParamXsd());
- valueMap.put("description", null == resourceRecipe ? null : resourceRecipe.getDescription());
+ valueMap.put("id", null == resourceRecipe || null == resourceRecipe.getId()
+ ? StringUtils.EMPTY :String.valueOf(resourceRecipe.getId()));
+ valueMap.put("action", null == resourceRecipe || null == resourceRecipe.getAction()
+ ? StringUtils.EMPTY :resourceRecipe.getAction());
+ valueMap.put("orchestrationUri", null == resourceRecipe || null == resourceRecipe.getOrchestrationUri()
+ ? StringUtils.EMPTY : resourceRecipe.getOrchestrationUri());
+ valueMap.put("recipeTimeout", null == resourceRecipe || null == resourceRecipe.getRecipeTimeout()
+ ? StringUtils.EMPTY : String.valueOf(resourceRecipe.getRecipeTimeout()));
+ valueMap.put("paramXSD", null == resourceRecipe || null == resourceRecipe.getParamXsd()
+ ? StringUtils.EMPTY : resourceRecipe.getParamXsd());
+ valueMap.put("description", null == resourceRecipe || null == resourceRecipe.getDescription()
+ ? StringUtils.EMPTY : resourceRecipe.getDescription());
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
String jsonStr = "";
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
index 3b50871a8d..edbf9749c6 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
@@ -45,6 +45,7 @@ public class QueryServiceMacroHolder extends CatalogQuery {
"\t\"serviceType\" : <SERVICE_TYPE>,\n"+
"\t\"serviceRole\" : <SERVICE_ROLE>,\n"+
"\t\"environmentContext\" : <ENVIRONMENT_CONTEXT>,\n"+
+ "\t\"resourceOrder\" : <RESOURCE_ORDER>,\n"+
"\t\"workloadContext\" : <WORKLOAD_CONTEXT>,\n"+
"<_SERVICEVNFS_>,\n"+
"<_SERVICENETWORKS_>,\n"+
@@ -81,6 +82,7 @@ public class QueryServiceMacroHolder extends CatalogQuery {
put(valueMap, "SERVICE_ROLE", service.getServiceRole());
put(valueMap, "ENVIRONMENT_CONTEXT", service.getEnvironmentContext());
put(valueMap, "WORKLOAD_CONTEXT", service.getWorkloadContext());
+ put(valueMap, "RESOURCE_ORDER", service.getResourceOrder());
String subitem;
subitem = new QueryServiceVnfs(service.getVnfCustomizations()).JSON2(true, true);
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index a2256f724a..f7457fda4a 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -50,6 +50,7 @@ public class QueryServiceNetworks extends CatalogQuery {
"\t\t\"toscaNodeType\" : <TOSCA_NODE_TYPE>,\n"+
"\t\t\"networkType\" : <NETWORK_TYPE>,\n"+
"\t\t\"networkTechnology\" : <NETWORK_TECHNOLOGY>,\n"+
+ "\t\t\"resourceInput\" : <RESOURCE_INPUT>,\n"+
"\t\t\"networkRole\" : <NETWORK_ROLE>,\n"+
"\t\t\"networkScope\" : <NETWORK_SCOPE>\n"+
"\t}";
@@ -116,6 +117,7 @@ public class QueryServiceNetworks extends CatalogQuery {
put(valueMap, "NETWORK_ROLE", o.getNetworkRole());
put(valueMap, "NETWORK_SCOPE", o.getNetworkScope());
put(valueMap, "NETWORK_TECHNOLOGY", o.getNetworkTechnology());
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index 82b6aa2aeb..4170047e0b 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -53,6 +53,7 @@ public class QueryServiceVnfs extends CatalogQuery {
"\t\"nfRole\" : <NF_ROLE>,\n"+
"\t\"nfNamingCode\" : <NF_NAMING_CODE>,\n"+
"\t\"multiStageDesign\" : <MULTI_STEP_DESIGN>,\n"+
+ "\t\"resourceInput\" : <RESOURCE_INPUT>,\n"+
"<_VFMODULES_>\n" +
"\t}";
@@ -119,6 +120,7 @@ public class QueryServiceVnfs extends CatalogQuery {
put(valueMap, "NF_ROLE", o.getNfRole());
put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign());
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true);
valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t"));
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index 70f53133dd..dbb168bd15 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -520,6 +520,7 @@ public class CatalogDbAdapterRest {
try {
if (smUuid != null && !"".equals(smUuid)) {
logger.debug("Query Csar by service model uuid: {}",smUuid);
+
Service service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(smUuid);
if (service != null) {
@@ -587,18 +588,22 @@ public class CatalogDbAdapterRest {
if (null == recipe) {
NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid);
- if(null!=vnf) {
- recipe = networkRecipeRepo.findFirstByModelNameAndActionAndVersionStr(nResource.getModelName(), action, vnf.getModelVersion());
- }
- // for network fetch the default recipe
- if (recipe == null) {
- recipe = networkRecipeRepo.findFirstByModelNameAndAction("SDNC_DEFAULT", action);
+
+ if(nResource != null) {
+ recipe = networkRecipeRepo.findFirstByModelNameAndActionAndVersionStr(nResource.getModelName(), action, nResource.getModelVersion());
+
+ // for network fetch the default recipe
+ if (recipe == null) {
+ recipe = networkRecipeRepo.findFirstByModelNameAndAction("SDNC_DEFAULT", action);
+ }
}
}
if (null == recipe) {
AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid);
- recipe = arRecipeRepo.findByModelNameAndActionAndVersion(arResource.getModelName(), action, arResource.getModelVersion());
+ if (arResource != null) {
+ recipe = arRecipeRepo.findByModelNameAndActionAndVersion(arResource.getModelName(), action, arResource.getModelVersion());
+ }
}
if (recipe != null) {
QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14___remove_retry_from_rainy_day_handling_table.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14__RemoveRetryFromRainyDayHandlingTable.sql
index e4b599a044..e4b599a044 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14___remove_retry_from_rainy_day_handling_table.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14__RemoveRetryFromRainyDayHandlingTable.sql
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.15__UpdateRainyDayHandlerMacroForScaleOut.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.15__UpdateRainyDayHandlerMacroForScaleOut.sql
new file mode 100644
index 0000000000..75a8c20352
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.15__UpdateRainyDayHandlerMacroForScaleOut.sql
@@ -0,0 +1,4 @@
+use catalogdb;
+
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'GenericVnfHealthCheckBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'ConfigurationScaleOutBB'; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.16__Add_Default_NeutronNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.16__Add_Default_NeutronNetwork.sql
new file mode 100644
index 0000000000..47c540b95d
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.16__Add_Default_NeutronNetwork.sql
@@ -0,0 +1,31 @@
+USE catalogdb;
+
+INSERT INTO `heat_template` (`ARTIFACT_UUID`,`NAME`,`VERSION`,`BODY`,`TIMEOUT_MINUTES`,`DESCRIPTION`,`CREATION_TIMESTAMP`,`ARTIFACT_CHECKSUM`) VALUES
+('efee1d84-b8ec-11e7-abc4-cec278b6b50a','Generic NeutronNet','1','
+heat_template_version: 2013-05-23
+description: A simple Neutron network
+parameters:
+ network_name:
+ type: string
+ description: Name of the Neutron Network
+ default: ONAP-NW1
+ shared:
+ type: boolean
+ description: Shared amongst tenants
+ default: False
+outputs:
+ network_id:
+ description: Openstack network identifier
+ value: { get_resource: network }
+resources:
+ network:
+ type: OS::Neutron::Net
+ properties:
+ name: { get_param: network_name }
+ shared: { get_param: shared }',10,'Generic Neutron Template','2017-10-26 14:44:00', 'MANUAL RECORD');
+
+
+
+INSERT INTO `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`, `HEAT_TEMPLATE_ARTIFACT_UUID`,`AIC_VERSION_MIN` , `AIC_VERSION_MAX` )
+VALUES ('Generic NeutronNet','efee1d84-b8ec-11e7-abc4-cec278b6b50a','2.0','3.0');
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.17__UpdateCloudSiteColumn.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.17__UpdateCloudSiteColumn.sql
new file mode 100644
index 0000000000..7077032fca
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.17__UpdateCloudSiteColumn.sql
@@ -0,0 +1,5 @@
+use catalogdb;
+
+ALTER TABLE cloud_sites
+ MODIFY IF EXISTS REGION_ID varchar(50) NULL,
+ MODIFY IF EXISTS CLLI varchar(50) NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.18__ControllerSelectionReferenceData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.18__ControllerSelectionReferenceData.sql
new file mode 100644
index 0000000000..00f4777c03
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.18__ControllerSelectionReferenceData.sql
@@ -0,0 +1,4 @@
+use catalogdb;
+
+INSERT INTO controller_selection_reference (VNF_TYPE, CONTROLLER_NAME, ACTION_CATEGORY) VALUES ('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'HealthCheck');
+INSERT INTO controller_selection_reference (VNF_TYPE, CONTROLLER_NAME, ACTION_CATEGORY) VALUES ('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'ConfigScaleOut'); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.19__RenameCustomToNoValidate.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.19__RenameCustomToNoValidate.sql
new file mode 100644
index 0000000000..bded179395
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.19__RenameCustomToNoValidate.sql
@@ -0,0 +1,2 @@
+update building_block_detail set RESOURCE_TYPE = "NO_VALIDATE" where RESOURCE_TYPE = "CUSTOM";
+update orchestration_status_state_transition_directive set RESOURCE_TYPE = "NO_VALIDATE" where RESOURCE_TYPE = "CUSTOM"; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.20__SetActivitiesBBsToNoValidate.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.20__SetActivitiesBBsToNoValidate.sql
new file mode 100644
index 0000000000..9f51ed173d
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.20__SetActivitiesBBsToNoValidate.sql
@@ -0,0 +1,13 @@
+USE catalogdb;
+
+INSERT INTO building_block_detail (BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION)
+VALUES
+('FlowCompleteActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFHealthCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFQuiesceTrafficActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFResumeTrafficActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFSetInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUnsetInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUpgradePostCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUpgradePreCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUpgradeSoftwareActivity', 'NO_VALIDATE', 'CUSTOM'); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.21__AddHomingTables.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.21__AddHomingTables.sql
new file mode 100644
index 0000000000..1725028104
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.21__AddHomingTables.sql
@@ -0,0 +1,9 @@
+use catalogdb;
+
+CREATE TABLE IF NOT EXISTS `homing_instances` (
+`SERVICE_INSTANCE_ID` varchar(50) NOT NULL,
+`CLOUD_OWNER` VARCHAR(200) NOT NULL,
+`CLOUD_REGION_ID` VARCHAR(200) NOT NULL,
+`OOF_DIRECTIVES` longtext NULL DEFAULT NULL,
+PRIMARY KEY (`SERVICE_INSTANCE_ID`)
+) ;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.22__AddResourceInput.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.22__AddResourceInput.sql
new file mode 100644
index 0000000000..10d8789328
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.22__AddResourceInput.sql
@@ -0,0 +1,13 @@
+use catalogdb;
+
+ALTER TABLE service
+ADD RESOURCE_ORDER varchar(255);
+
+ALTER TABLE vnf_resource_customization
+ADD RESOURCE_INPUT varchar(2000);
+
+ALTER TABLE network_resource_customization
+ADD RESOURCE_INPUT varchar(2000);
+
+ALTER TABLE allotted_resource_customization
+ADD RESOURCE_INPUT varchar(2000); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.23__ChangeResourceInputLength.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.23__ChangeResourceInputLength.sql
new file mode 100644
index 0000000000..dfb5075674
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.23__ChangeResourceInputLength.sql
@@ -0,0 +1,10 @@
+use catalogdb;
+
+ALTER TABLE vnf_resource_customization
+ MODIFY IF EXISTS RESOURCE_INPUT varchar(20000);
+
+ALTER TABLE network_resource_customization
+ MODIFY IF EXISTS RESOURCE_INPUT varchar(20000);
+
+ALTER TABLE allotted_resource_customization
+ MODIFY IF EXISTS RESOURCE_INPUT varchar(20000); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.24__UpdateHeatRelatedAttribute.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.24__UpdateHeatRelatedAttribute.sql
new file mode 100644
index 0000000000..b1aefaf56c
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.24__UpdateHeatRelatedAttribute.sql
@@ -0,0 +1,5 @@
+use catalogdb;
+
+ALTER TABLE network_resource MODIFY COLUMN AIC_VERSION_MIN varchar(20) NULL;
+ALTER TABLE network_resource MODIFY COLUMN HEAT_TEMPLATE_ARTIFACT_UUID varchar(200) NULL;
+ALTER TABLE network_resource DROP FOREIGN KEY fk_network_resource__temp_network_heat_template_lookup__mod_nm1; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index 077b4ea6d5..0f5ad6d92f 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -25,6 +25,8 @@ import static org.junit.Assert.*;
import java.io.IOException;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -65,6 +67,8 @@ public class CatalogDBRestTest {
private static final String ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES = "ecomp/mso/catalog/v2/serviceAllottedResources";
+ private static final String ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE = "ecomp/mso/catalog/v2/resourceRecipe";
+
private static final String ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS = "ecomp/mso/catalog/v2/serviceNetworks";
private static final String ECOMP_MSO_CATALOG_V2_SERVICE_VNFS = "ecomp/mso/catalog/v2/serviceVnfs";
@@ -94,6 +98,8 @@ public class CatalogDBRestTest {
private final String expectedAllottedResponse = "{\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}";
private final String serviceUUID = "5df8b6de-2083-11e7-93ae-92361f002671";
+
+ private final String arResourceUUID = "25e2d69b-3b22-47b8-b4c9-7b14fd4a80df";
private final String serviceInvariantUUID = "9647dfc4-2083-11e7-93ae-92361f002671";
@@ -648,6 +654,42 @@ public class CatalogDBRestTest {
assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
}
+
+ @Test
+ public void testResourceReceipe() throws JSONException {
+ String expectedResourceRecipe = "{\"orchestrationUri\":\"/mso/async/services/CreateSDNCNetworkResource\",\"action\":\"createInstance\",\"description\":\"sotnvpnattachmentvF\",\"id\":\"1\",\"recipeTimeout\":\"180\",\"paramXSD\":\"\"}";
+
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE))
+ .queryParam("resourceModelUuid", arResourceUUID)
+ .queryParam("action", "createInstance");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResourceRecipe, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testResourceReceipeNotMatched() throws JSONException {
+
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE))
+ .queryParam("resourceModelUuid", arResourceUUID)
+ .queryParam("action", "invalid_action");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
+ }
@Test
public void testGetServiceAllottedResourcesByServiceModelInvariantUuid() throws JSONException {
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
index 05d1928a17..5a6ab747c5 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
@@ -63,14 +63,14 @@ public class CloudConfigTest {
headers.set("Content-Type",MediaType.APPLICATION_JSON);
CloudSite cloudSite = new CloudSite();
- cloudSite.setId("MTN6");
+ cloudSite.setId("MTN7");
cloudSite.setClli("TESTCLLI");
cloudSite.setRegionId("regionId");
cloudSite.setCloudVersion("VERSION");
cloudSite.setPlatform("PLATFORM");
CloudIdentity cloudIdentity = new CloudIdentity();
- cloudIdentity.setId("RANDOMID");
+ cloudIdentity.setId("RANDOMID-test");
cloudIdentity.setIdentityUrl("URL");
cloudIdentity.setMsoId("MSO_ID");
cloudIdentity.setMsoPass("MSO_PASS");
@@ -81,7 +81,7 @@ public class CloudConfigTest {
cloudSite.setIdentityService(cloudIdentity);
String uri = "/cloudSite";
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://localhost:"+ port + uri);
- HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers);
+ HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers);
ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(),
HttpMethod.POST, request, String.class);
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatusCode().value());
@@ -98,4 +98,6 @@ public class CloudConfigTest {
}
+
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
new file mode 100644
index 0000000000..aeee279002
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
@@ -0,0 +1,198 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClientPortChanger;
+import org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import org.springframework.beans.BeanUtils;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class CvnfcCatalogDbQueryTest {
+
+ @Autowired
+ private CvnfcCustomizationRepository cvnfcCustomizationRepository;
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CvnfcCatalogDbQueryTest.class);
+
+ @LocalServerPort
+ private int port;
+ boolean isInitialized;
+
+ @Autowired
+ CatalogDbClientPortChanger client;
+
+ @Before
+ public void initialize(){
+ client.wiremockPort= String.valueOf(port);
+ }
+
+ @Test
+ public void cVnfcTest() {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization("dadc2c8c-2bab-11e9-b210-d663bd873d93");
+
+ List<CvnfcCustomization> foundCvnfcCustomization = client.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671","cb82ffd8-252a-11e7-93ae-92361f002671");
+ assertNotNull(foundCvnfcCustomization);
+ assertTrue(foundCvnfcCustomization.size() > 0);
+ CvnfcCustomization found = foundCvnfcCustomization.get(0);
+
+ CvnfcCustomization templateCvnfcCustomization = new CvnfcCustomization();
+ BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization");
+
+ assertThat(cvnfcCustomization, sameBeanAs(templateCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+ }
+
+ @Test
+ public void getLinkedVnfVfmoduleCvnfcConfigurationCustomizationTest() {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization("0c042562-2bac-11e9-b210-d663bd873d93");
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setToscaNodeType("FabricConfiguration");
+ configurationResource.setModelInvariantUUID("modelInvariantUUID");
+ configurationResource.setModelUUID("modelUUID");
+ configurationResource.setModelName("modelName");
+ configurationResource.setModelVersion("modelVersion");
+ configurationResource.setDescription("description");
+ configurationResource.setToscaNodeType("toscaNodeTypeFC");
+
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setModelUUID("6f19c5fa-2b19-11e9-b210-d663bd873d93");
+ vnfResource.setModelVersion("modelVersion");
+ vnfResource.setOrchestrationMode("orchestrationMode");
+
+ VfModule vfModule = new VfModule();
+ vfModule.setModelUUID("98aa2a6e-2b18-11e9-b210-d663bd873d93");
+ vfModule.setModelInvariantUUID("9fe57860-2b18-11e9-b210-d663bd873d93");
+ vfModule.setIsBase(true);
+ vfModule.setModelName("modelName");
+ vfModule.setModelVersion("modelVersion");
+ vfModule.setVnfResources(vnfResource);
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("bdbf984a-2b16-11e9-b210-d663bd873d93");
+ vfModuleCustomization.setVfModule(vfModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("6912dd02-2b16-11e9-b210-d663bd873d93");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+ vnfResourceCustomization.setVnfResources(vnfResource);
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("configurationFunction");
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("64627fec-2b1b-11e9-b210-d663bd873d93");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
+ vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName");
+ vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(vfModuleCustomization);
+ vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
+ vnfVfmoduleCvnfcConfigurationCustomizationSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
+ cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet);
+
+ vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ List<CvnfcCustomization> foundCvnfcCustomization = client.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("6912dd02-2b16-11e9-b210-d663bd873d93","bdbf984a-2b16-11e9-b210-d663bd873d93");
+ assertNotNull(foundCvnfcCustomization);
+ assertTrue(foundCvnfcCustomization.size() > 0);
+ CvnfcCustomization found = foundCvnfcCustomization.get(0);
+
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = found.getVnfVfmoduleCvnfcConfigurationCustomization();
+ if (vnfVfmoduleCvnfcConfigurationCustomizations.size() > 0){
+ for(VnfVfmoduleCvnfcConfigurationCustomization customization : vnfVfmoduleCvnfcConfigurationCustomizations) {
+ Assert.assertTrue(customization.getConfigurationResource().getToscaNodeType().equalsIgnoreCase("toscaNodeTypeFC"));
+ }
+ } else {
+ Assert.fail("No linked VnfVfmoduleCvnfcConfigurationCustomization found for CvnfcCustomization");
+ }
+ }
+
+ protected CvnfcCustomization setUpCvnfcCustomization(String id){
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID(id);
+ cvnfcCustomization.setModelInstanceName("testModelInstanceName");
+ cvnfcCustomization.setModelUUID("b25735fe-9b37-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setModelInvariantUUID("ba7e6ef0-9b37-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setModelVersion("testModelVersion");
+ cvnfcCustomization.setModelName("testModelName");
+ cvnfcCustomization.setToscaNodeType("testToscaNodeType");
+ cvnfcCustomization.setDescription("testCvnfcCustomzationDescription");
+ cvnfcCustomization.setNfcFunction("testNfcFunction");
+ cvnfcCustomization.setNfcNamingCode("testNfcNamingCode");
+ return cvnfcCustomization;
+ }
+
+ protected VnfcCustomization setUpVnfcCustomization(){
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+ vnfcCustomization.setModelInstanceName("testVnfcCustomizationModelInstanceName");
+ vnfcCustomization.setModelUUID("321228a4-9f15-11e8-98d0-529269fb1459");
+ vnfcCustomization.setModelInvariantUUID("c0659136-9f15-11e8-98d0-529269fb1459");
+ vnfcCustomization.setModelVersion("testModelVersion");
+ vnfcCustomization.setModelName("testModelName");
+ vnfcCustomization.setToscaNodeType("testToscaModelType");
+ vnfcCustomization.setDescription("testVnfcCustomizationDescription");
+ return vnfcCustomization;
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java
index 645714cc80..e403867c42 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java
@@ -21,11 +21,16 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.onap.so.db.catalog.beans.ArRecipe;
+import org.onap.so.db.catalog.beans.NetworkRecipe;
import org.onap.so.db.catalog.beans.Recipe;
import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.beans.VnfRecipe;
import org.onap.so.jsonpath.JsonPathUtil;
public class QueryResourceRecipeTest {
@@ -67,4 +72,24 @@ public class QueryResourceRecipeTest {
return recipe;
}
+ @Test
+ public void convertToJson() {
+ Recipe recipe = createRecipe();
+ QueryResourceRecipe queryResourceRecipe = new QueryResourceRecipe(recipe);
+ assertEquals("{\"orchestrationUri\":\"uriTest\",\"action\":\"actionTest\",\"description\":\"descrTest\",\"id\":\"123\",\"recipeTimeout\":\"100\",\"paramXSD\":\"paramsXsdTest\"}",
+ queryResourceRecipe.JSON2(false,false));
+ }
+
+ @Test
+ public void convertToJsonEmptyRecipe() {
+ QueryResourceRecipe vnfQueryRR = new QueryResourceRecipe(new VnfRecipe());
+ QueryResourceRecipe networkQueryRR = new QueryResourceRecipe(new NetworkRecipe());
+ QueryResourceRecipe arQueryRR = new QueryResourceRecipe(new ArRecipe());
+
+ String expected = "{\"orchestrationUri\":\"\",\"action\":\"\",\"description\":\"\",\"id\":\"\",\"recipeTimeout\":\"\",\"paramXSD\":\"\"}";
+ assertEquals(expected, vnfQueryRR.JSON2(false, false));
+ assertEquals(expected, networkQueryRR.JSON2(false,false));
+ assertEquals(expected, arQueryRR.JSON2(false,false));
+ }
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index e249285867..4479e1ba4a 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -39,6 +39,7 @@ import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
+import org.onap.so.db.catalog.beans.HomingInstance;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.ServerType;
@@ -425,6 +426,81 @@ public class CatalogDbClientTest {
Assert.assertEquals("regionId", getCloudSite.getRegionId());
Assert.assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
}
+
+ @Test
+ public void testGetHomingInstance() {
+ HomingInstance homingInstance = client.getHomingInstance("5df8b6de-2083-11e7-93ae-92361f232671");
+ Assert.assertNotNull(homingInstance);
+ Assert.assertNotNull(homingInstance.getCloudOwner());
+ Assert.assertNotNull(homingInstance.getCloudRegionId());
+ Assert.assertNotNull(homingInstance.getOofDirectives());
+ }
+
+ @Test
+ public void testPostHomingInstance() {
+ CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger("http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
+ HomingInstance homingInstance = new HomingInstance();
+ homingInstance.setServiceInstanceId("5df8d6be-2083-11e7-93ae-92361f232671");
+ homingInstance.setCloudOwner("CloudOwner-1");
+ homingInstance.setCloudRegionId("CloudRegionOne");
+ homingInstance.setOofDirectives("{\n" +
+ "\"directives\": [\n" +
+ "{\n" +
+ "\"directives\": [\n" +
+ "{\n" +
+ "\"attributes\": [\n" +
+ "{\n" +
+ "\"attribute_value\": \"onap.hpa.flavor31\",\n" +
+ "\"attribute_name\": \"firewall_flavor_name\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"flavor_directives\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"vnfc\",\n" +
+ "\"id\": \"vfw\"\n" +
+ "},\n" +
+ "{\n" +
+ "\"directives\": [\n" +
+ "{\n" +
+ "\"attributes\": [\n" +
+ "{\n" +
+ "\"attribute_value\": \"onap.hpa.flavor32\",\n" +
+ "\"attribute_name\": \"packetgen_flavor_name\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"flavor_directives\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"vnfc\",\n" +
+ "\"id\": \"vgenerator\"\n" +
+ "},\n" +
+ "{\n" +
+ "\"directives\": [\n" +
+ "{\n" +
+ "\"attributes\": [\n" +
+ "{\n" +
+ "\"attribute_value\": \"onap.hpa.flavor31\",\n" +
+ "\"attribute_name\": \"sink_flavor_name\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"flavor_directives\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"vnfc\",\n" +
+ "\"id\": \"vsink\"\n" +
+ "}\n" +
+ "]\n" +
+ "}");
+ localClient.postHomingInstance(homingInstance);
+ HomingInstance getHomingInstance = this.client.getHomingInstance("5df8d6be-2083-11e7-93ae-92361f232671");
+ Assert.assertNotNull(getHomingInstance);
+ Assert.assertNotNull(getHomingInstance.getCloudRegionId());
+ Assert.assertNotNull(getHomingInstance.getCloudOwner());
+ Assert.assertEquals("CloudOwner-1", getHomingInstance.getCloudOwner());
+ Assert.assertEquals("CloudRegionOne", getHomingInstance.getCloudRegionId());
+ }
+
@Test
public void testGetServiceByModelName() {
Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service");
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 9eb3daa5ae..1223080e59 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -51,6 +51,14 @@ CREATE TABLE IF NOT EXISTS `cloud_sites` (
CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`)
) ;
+CREATE TABLE IF NOT EXISTS `homing_instances` (
+`SERVICE_INSTANCE_ID` varchar(50) NOT NULL,
+`CLOUD_OWNER` VARCHAR(200) NOT NULL,
+`CLOUD_REGION_ID` VARCHAR(200) NOT NULL,
+`OOF_DIRECTIVES` longtext NULL DEFAULT NULL,
+PRIMARY KEY (`SERVICE_INSTANCE_ID`)
+) ;
+
insert into heat_files(artifact_uuid, name, version, description, body, artifact_checksum, creation_timestamp) values
('00535bdd-0878-4478-b95a-c575c742bfb0', 'nimbus-ethernet-gw', '1', 'created from csar', 'DEVICE=$dev\nBOOTPROTO=none\nNM_CONTROLLED=no\nIPADDR=$ip\nNETMASK=$netmask\nGATEWAY=$gateway\n', 'MANUAL RECORD', '2017-01-21 23:56:43');
@@ -105,8 +113,8 @@ insert into heat_environment(artifact_uuid, name, version, description, body, ar
insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values
('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', 'ff874603-4222-11e7-9252-005056850d2e');
-insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values
-('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null);
+insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design, resource_input) values
+('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null, "{\\\"vf_module_id\\\":\\\"vFirewall\\\",\\\"vfw_private_ip_1\\\":\\\"192.168.20.100\\\",\\\"public_net_id\\\":\\\"PUBLIC NET ID\\\",\\\"vfw_private_ip_0\\\":\\\"192.168.10.100\\\",\\\"onap_private_subnet_id\\\":\\\"PRIVATE NETWORK\\\",\\\"sec_group\\\":\\\"SECURITY GROUP\\\",\\\"vfw_private_ip_2\\\":\\\"10.0.100.1\\\",\\\"vfw_name_0\\\":\\\"zdfw1fwl01fwl01\\\",\\\"nexus_artifact_repo\\\":\\\"https://nexus.onap.org\\\",\\\"onap_private_net_cidr\\\":\\\"10.0.0.0/16\\\",\\\"dcae_collector_ip\\\":\\\"10.0.4.1\\\",\\\"vnf_id\\\":\\\"vFirewall_demo_app\\\",\\\"dcae_collector_port\\\":\\\"8081\\\",\\\"vpg_name_0\\\":\\\"zdfw1fwl01pgn01\\\",\\\"vsn_private_ip_0\\\":\\\"192.168.20.250\\\",\\\"vpg_private_ip_1\\\":\\\"10.0.100.2\\\",\\\"vsn_private_ip_1\\\":\\\"10.0.100.3\\\",\\\"vpg_private_ip_0\\\":\\\"192.168.10.200\\\",\\\"protected_private_net_cidr\\\":\\\"192.168.20.0/24\\\",\\\"unprotected_private_net_cidr\\\":\\\"192.168.10.0/24\\\",\\\"nf_naming\\\":\\\"true\\\",\\\"vsn_name_0\\\":\\\"zdfw1fwl01snk01\\\",\\\"multi_stage_design\\\":\\\"false\\\",\\\"onap_private_net_id\\\":\\\"PRIVATE NETWORK\\\",\\\"unprotected_private_net_id\\\":\\\"zdfw1fwl01_unprotected\\\",\\\"availability_zone_max_count\\\":\\\"1\\\",\\\"vfw_flavor_name\\\":\\\"(m1.medium suggested)\\\",\\\"demo_artifacts_version\\\":\\\"1.3.0-SNAPSHOT\\\",\\\"pub_key\\\":\\\"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN\\\",\\\"key_name\\\":\\\"vfw_key\\\",\\\"install_script_version\\\":\\\"1.3.0-SNAPSHOT\\\",\\\"vfw_image_name\\\":\\\"(UBUNTU 1404 required)\\\",\\\"protected_private_net_id\\\":\\\"zdfw1fwl01_protected\\\",\\\"cloud_env\\\":\\\"openstack\\\"}");
insert into vf_module(model_uuid, model_invariant_uuid, model_version, model_name, description, is_base, heat_template_artifact_uuid, vol_heat_template_artifact_uuid, creation_timestamp, vnf_resource_model_uuid) values
@@ -210,7 +218,17 @@ INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPT
VALUES
('volumeGroup', 'createInstance', '1', 'Gr api recipe to create volume-group', '/mso/async/services/WorkflowActionBB', 180, '20c4431c-246d-11e7-93ae-92361f002671');
+insert into homing_instances (service_instance_id, cloud_owner, cloud_region_id, oof_directives) values
+('5df8b6de-2083-11e7-93ae-92361f232671', 'CloudOwner', 'CloudRegionId', '{"directives": [{"directives": [{"attributes": [{"attribute_value": "onap.hpa.flavor32","attribute_name": "firewall_flavor_name"}],"type": "flavor_directives"}],"type": "vnfc","id": "vfw"},{"directives": [{"attributes": [{"attribute_value": "onap.hpa.flavor33","attribute_name": "packetgen_flavor_name"}],"type": "flavor_directives"}],"type": "vnfc","id": "vgenerator"},{"directives": [{"attributes": [{"attribute_value": "onap.hpa.flavor32","attribute_name": "sink_flavor_name"}],"type": "flavor_directives"}],"type": "vnfc","id": "vsink"}]}'),
+('5df8b6de-2083-11e7-93ae-92361f562672', 'CloudOwner', 'CloudRegionId', '{"directives": [{"directives": [{"attributes": [{"attribute_value": "onap.hpa.flavor32","attribute_name": "firewall_flavor_name"}],"type": "flavor_directives"}],"type": "vnfc","id": "vfw"},{"directives": [{"attributes": [{"attribute_value": "onap.hpa.flavor33","attribute_name": "packetgen_flavor_name"}],"type": "flavor_directives"}],"type": "vnfc","id": "vgenerator"},{"directives": [{"attributes": [{"attribute_value": "onap.hpa.flavor32","attribute_name": "sink_flavor_name"}],"type": "flavor_directives"}],"type": "vnfc","id": "vsink"}]}');
+-- for query resource receipe
+INSERT INTO allotted_resource
+(MODEL_UUID, MODEL_INVARIANT_UUID, MODEL_VERSION, MODEL_NAME, TOSCA_NODE_TYPE, SUBCATEGORY, DESCRIPTION, CREATION_TIMESTAMP)
+VALUES('25e2d69b-3b22-47b8-b4c9-7b14fd4a80df', '8f5fe343-9a3a-4d31-a829-49b27bbfc1c4', '2.0', 'sotnvpnattachmentvF', 'org.openecomp.resource.vf.Sdwanvpnattachmentvf', 'Allotted Resource', 'sdwanvpnattachmentVF', '2019-01-24 09:59:16.000');
+
+INSERT INTO ar_recipe(ID, MODEL_NAME, ACTION, VERSION_STR, SERVICE_TYPE, DESCRIPTION, ORCHESTRATION_URI, AR_PARAM_XSD, RECIPE_TIMEOUT, CREATION_TIMESTAMP)
+VALUES(1, 'sotnvpnattachmentvF', 'createInstance', '2.0', 'VF', 'sotnvpnattachmentvF', '/mso/async/services/CreateSDNCNetworkResource', '', 180, '2019-01-24 09:59:16.000');
INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER, SERVICE_TYPE) VALUES
('Service-Create', 'createInstance', 'Service', true, '7','7', 'my-custom-cloud-owner','*');
@@ -223,3 +241,55 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'my-custom-cloud-owner' and SERVICE_TYPE = 'TRANSPORT'));
+
+INSERT INTO `vnfc_customization`
+ (`model_customization_uuid`,
+ `model_instance_name`,
+ `model_uuid`,
+ `model_invariant_uuid`,
+ `model_version`,
+ `model_name`,
+ `tosca_node_type`,
+ `description`,
+ `creation_timestamp`)
+VALUES ( '9bcce658-9b37-11e8-98d0-529269fb1459',
+ 'testModelInstanceName',
+ 'b25735fe-9b37-11e8-98d0-529269fb1459',
+ 'ba7e6ef0-9b37-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'toscaNodeType',
+ 'testVnfcCustomizationDescription',
+ '2018-07-17 14:05:08');
+
+INSERT INTO `cvnfc_customization`
+ (`id`,
+ `model_customization_uuid`,
+ `model_instance_name`,
+ `model_uuid`,
+ `model_invariant_uuid`,
+ `model_version`,
+ `model_name`,
+ `tosca_node_type`,
+ `description`,
+ `nfc_function`,
+ `nfc_naming_code`,
+ `creation_timestamp`,
+ `vnf_resource_cust_model_customization_uuid`,
+ `vf_module_cust_model_customization_uuid`,
+ `vnfc_cust_model_customization_uuid`)
+VALUES ( '1',
+ 'dadc2c8c-2bab-11e9-b210-d663bd873d93',
+ 'testModelInstanceName',
+ 'b25735fe-9b37-11e8-98d0-529269fb1459',
+ 'ba7e6ef0-9b37-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'testToscaNodeType',
+ 'testCvnfcCustomzationDescription',
+ 'testNfcFunction',
+ 'testNfcNamingCode',
+ '2018-07-17 14:05:08',
+ '68dc9a92-214c-11e7-93ae-92361f002671',
+ 'cb82ffd8-252a-11e7-93ae-92361f002671',
+ '9bcce658-9b37-11e8-98d0-529269fb1459');