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/rest/CatalogDbAdapterRest.java25
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.13__Add_Default_NeutronNetwork.sql10
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.13__UpdateBBOrchestrationStatusAutoScaleOut.sql26
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14__RemoveRetryFromRainyDayHandlingTable.sql18
-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/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java8
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java1
7 files changed, 86 insertions, 6 deletions
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 eaf3e125a1..36e00ad599 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
@@ -73,6 +73,7 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ToscaCsar;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfRecipe;
import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
@@ -116,6 +117,7 @@ import java.util.List;
public class CatalogDbAdapterRest {
protected static Logger logger = LoggerFactory.getLogger(CatalogDbAdapterRest.class);
private static final boolean IS_ARRAY = true;
+ private static final String NETWORK_SERVICE = "network service";
@Autowired
private VnfCustomizationRepository vnfCustomizationRepo;
@@ -563,15 +565,32 @@ public class CatalogDbAdapterRest {
if (rmUuid != null && !"".equals(rmUuid)) {
logger.debug("Query recipe by resource model uuid: {}", rmUuid);
//check vnf and network and ar, the resource could be any resource.
+ Recipe recipe = null;
+
VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid);
- Recipe recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndAction(vnf.getModelName(), action);
+ if (vnf != null) {
+ recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndActionAndVersionStr(vnf.getModelName(), action, vnf.getModelVersion());
+
+ // for network service fetch the default recipe
+ if (recipe == null && vnf.getSubCategory().equalsIgnoreCase(NETWORK_SERVICE)) {
+ recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndAction("NS_DEFAULT", action);
+ }
+ }
+
+
if (null == recipe) {
NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid);
- recipe = networkRecipeRepo.findFirstByModelNameAndAction(nResource.getModelName(), action);
+ recipe = networkRecipeRepo.findFirstByModelNameAndActionAndVersionStr(nResource.getModelName(), action, vnf.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.findByModelNameAndAction(arResource.getModelName(), action);
+ 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.13__Add_Default_NeutronNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.13__Add_Default_NeutronNetwork.sql
new file mode 100644
index 0000000000..dd821cab78
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.13__Add_Default_NeutronNetwork.sql
@@ -0,0 +1,10 @@
+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\n\ndescription:\n HOT template that creates a Generic Neutron Network\n\nparameters:\n network_name:\n type: string\n description: Name of direct network (e.g. core, dmz)\n default: ECOMPNetwork\n network_subnet_name:\n type: string\n description: Name of subnet network (e.g. core, dmz)\n default: ECOMPNetwork\n network_subnet_cidr:\n type: string\n description: CIDR of subnet network (e.g. core, dmz)\n default: 10.0.0.0/16\n\noutputs:\n network_id:\n description: Openstack network identifier\n value: { get_resource: network }\n network_fqdn:\n description: Openstack network identifier\n value: {list_join: [\':\', { get_attr: [network, fq_name] } ] }\n\nresources:\n network:\n type: OS::Neutron::Net\n properties:\n name: {get_param: network_name }\n\n subnet:\n type: OS::Neutron::Subnet\n properties:\n name: { get_param: network_subnet_name }\n network_id: { get_resource: network }\n cidr: { get_param: network_subnet_cidr }\n enable_dhcp: false\n',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','NULL');
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.13__UpdateBBOrchestrationStatusAutoScaleOut.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.13__UpdateBBOrchestrationStatusAutoScaleOut.sql
new file mode 100644
index 0000000000..04fc68da75
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.13__UpdateBBOrchestrationStatusAutoScaleOut.sql
@@ -0,0 +1,26 @@
+use catalogdb;
+
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'ACTIVE', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'ASSIGNED', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'CREATED', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'INVENTORIED', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'PENDING', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'PRECREATED', 'CUSTOM', 'CONTINUE');
+
+
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'ACTIVE', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'ASSIGNED', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'CREATED', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'INVENTORIED', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'PENDING', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE');
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'PRECREATED', 'CUSTOM', 'CONTINUE');
+
+update building_block_detail set resource_type = "VNF" where building_block_name = "GenericVnfHealthCheckBB";
+
+update building_block_detail set resource_type = "VF_MODULE" where building_block_name = "ConfigurationScaleOutBB"; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14__RemoveRetryFromRainyDayHandlingTable.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14__RemoveRetryFromRainyDayHandlingTable.sql
new file mode 100644
index 0000000000..e4b599a044
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14__RemoveRetryFromRainyDayHandlingTable.sql
@@ -0,0 +1,18 @@
+use catalogdb;
+
+UPDATE rainy_day_handler_macro SET POLICY = 'Rollback' WHERE FLOW_NAME = 'CreateNetworkBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Rollback' WHERE FLOW_NAME = 'CreateNetworkCollectionBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Rollback' WHERE FLOW_NAME = 'CreateVfModuleBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Rollback' WHERE FLOW_NAME = 'CreateVolumeGroupBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'DeleteNetworkBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'DeleteNetworkCollectionBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'DeleteVfModuleBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'DeleteVolumeGroupBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignNetwork1802BB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignNetworkBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignServiceInstanceBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignVfModuleBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignVnfBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignVolumeGroupBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UpdateNetworkBB';
+UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'VnfAdapterBB'; \ No newline at end of file
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/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 0606848b04..eb2d3753d9 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());
@@ -96,4 +96,6 @@ public class CloudConfigTest {
}
+
+
}
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 5e2bd82776..c85a4c28f5 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
@@ -413,6 +413,7 @@ public class CatalogDbClientTest {
Assert.assertEquals("regionId", getCloudSite.getRegionId());
Assert.assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
}
+
@Test
public void testGetServiceByModelName() {
Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service");