summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql21
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java153
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java3
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java6
4 files changed, 124 insertions, 59 deletions
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql
new file mode 100644
index 0000000000..2f7438c1d3
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql
@@ -0,0 +1,21 @@
+ALTER TABLE `requestdb`.`infra_active_requests`
+ADD INDEX IF NOT EXISTS `infra_active_requests__service_instance_id_idx` (`SERVICE_INSTANCE_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__service_instance_name_idx` (`SERVICE_INSTANCE_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__vnf_id_idx` (`VNF_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__vnf_name_name_idx` (`VNF_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__vf_module_id_idx` (`VF_MODULE_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__vf_module_name_idx` (`VF_MODULE_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__volume_group_id_idx` (`VOLUME_GROUP_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__volume_group_name_idx` (`VOLUME_GROUP_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__network_id_idx` (`NETWORK_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__network_name_idx` (`NETWORK_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__configuration_id_idx` (`CONFIGURATION_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__configuration_name_idx` (`CONFIGURATION_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__instance_group_id_idx` (`INSTANCE_GROUP_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__instance_group_name_idx` (`INSTANCE_GROUP_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__aic_cloud_region_idx` (`AIC_CLOUD_REGION` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__tenant_id_idx` (`TENANT_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__request_scope_idx` (`REQUEST_SCOPE` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__requestor_id_idx` (`REQUESTOR_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__start_time_idx` (`START_TIME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__end_time_idx` (`END_TIME` ASC); \ No newline at end of file
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index e33c726b3f..10fd55abbb 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -437,13 +437,15 @@ public class ToscaResourceInstaller {
List<IEntityDetails> vfEntityList = getEntityDetails(toscaResourceStruct,
EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+ List<IEntityDetails> arEntityDetails = new ArrayList<IEntityDetails>();
+
for (IEntityDetails vfEntityDetails : vfEntityList) {
Metadata metadata = vfEntityDetails.getMetadata();
String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) {
- continue;
+ arEntityDetails.add(vfEntityDetails);
}
processVfModules(vfEntityDetails, vfNodeTemplatesList.get(0), toscaResourceStruct, vfResourceStructure,
@@ -451,8 +453,7 @@ public class ToscaResourceInstaller {
}
processResourceSequence(toscaResourceStruct, service);
- List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
- processAllottedResources(toscaResourceStruct, service, allottedResourceList);
+ processAllottedResources(arEntityDetails, toscaResourceStruct, service);
processNetworks(toscaResourceStruct, service);
// process Network Collections
processNetworkCollections(toscaResourceStruct, service);
@@ -678,14 +679,31 @@ public class ToscaResourceInstaller {
}
}
- protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service,
- List<NodeTemplate> allottedResourceList) throws ArtifactInstallerException {
- if (allottedResourceList != null) {
- for (NodeTemplate allottedNode : allottedResourceList) {
+ protected void processAllottedResources(List<IEntityDetails> arEntityDetails,
+ ToscaResourceStructure toscaResourceStruct, Service service) throws ArtifactInstallerException {
+
+ List<IEntityDetails> pnfAREntityList = getEntityDetails(toscaResourceStruct,
+ EntityQuery.newBuilder(SdcTypes.PNF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+ for (IEntityDetails pnfEntity : pnfAREntityList) {
+
+ Metadata metadata = pnfEntity.getMetadata();
+ String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) {
+ arEntityDetails.add(pnfEntity);
+ }
+
+ }
+
+ if (arEntityDetails != null) {
+ for (IEntityDetails arEntity : arEntityDetails) {
AllottedResourceCustomization allottedResource =
- createAllottedResource(allottedNode, toscaResourceStruct, service);
- allottedResource.setResourceInput(
- getResourceInput(toscaResourceStruct, allottedResource.getModelCustomizationUUID()));
+ createAllottedResource(arEntity, toscaResourceStruct, service);
+ String resourceInput =
+ getResourceInput(toscaResourceStruct, allottedResource.getModelCustomizationUUID());
+ if (!"{}".equals(resourceInput)) {
+ allottedResource.setResourceInput(resourceInput);
+ }
service.getAllottedCustomizations().add(allottedResource);
}
}
@@ -2595,21 +2613,21 @@ public class ToscaResourceInstaller {
return vnfResource;
}
- protected AllottedResourceCustomization createAllottedResource(NodeTemplate nodeTemplate,
+ protected AllottedResourceCustomization createAllottedResource(IEntityDetails arEntity,
ToscaResourceStructure toscaResourceStructure, Service service) {
AllottedResourceCustomization allottedResourceCustomization =
allottedCustomizationRepo.findOneByModelCustomizationUUID(
- nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
if (allottedResourceCustomization == null) {
AllottedResource allottedResource = findExistingAllottedResource(service,
- nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
if (allottedResource == null)
- allottedResource = createAR(nodeTemplate);
+ allottedResource = createAR(arEntity);
toscaResourceStructure.setAllottedResource(allottedResource);
- allottedResourceCustomization = createAllottedResourceCustomization(nodeTemplate, toscaResourceStructure);
+ allottedResourceCustomization = createAllottedResourceCustomization(arEntity, toscaResourceStructure);
allottedResourceCustomization.setAllottedResource(allottedResource);
allottedResource.getAllotedResourceCustomization().add(allottedResourceCustomization);
}
@@ -2630,73 +2648,81 @@ public class ToscaResourceInstaller {
return allottedResource;
}
- protected AllottedResourceCustomization createAllottedResourceCustomization(NodeTemplate nodeTemplate,
+ protected AllottedResourceCustomization createAllottedResourceCustomization(IEntityDetails arEntity,
ToscaResourceStructure toscaResourceStructure) {
AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization();
allottedResourceCustomization.setModelCustomizationUUID(
- testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- allottedResourceCustomization.setModelInstanceName(nodeTemplate.getName());
+ testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ allottedResourceCustomization.setModelInstanceName(arEntity.getName());
+
+ allottedResourceCustomization
+ .setNfFunction(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ allottedResourceCustomization.setNfNamingCode(getLeafPropertyValue(arEntity, "nf_naming_code"));
+ allottedResourceCustomization.setNfRole(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ allottedResourceCustomization.setNfType(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ EntityQuery entityQuery = EntityQuery.newBuilder(SdcTypes.VFC).build();
- allottedResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)));
- allottedResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(nodeTemplate, "nf_naming_code")));
- allottedResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)));
- allottedResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)));
+ TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF)
+ .customizationUUID(allottedResourceCustomization.getModelCustomizationUUID()).build();
- List<NodeTemplate> vfcNodes = toscaResourceStructure.getSdcCsarHelper()
- .getVfcListByVf(allottedResourceCustomization.getModelCustomizationUUID());
+ List<IEntityDetails> vfcEntities =
+ toscaResourceStructure.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, false);
- if (vfcNodes != null) {
- for (NodeTemplate vfcNode : vfcNodes) {
- allottedResourceCustomization.setProvidingServiceModelUUID(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_uuid"));
+ if (vfcEntities != null) {
+ for (IEntityDetails vfcEntity : vfcEntities) {
+
+ allottedResourceCustomization
+ .setProvidingServiceModelUUID(getLeafPropertyValue(vfcEntity, "providing_service_uuid"));
+ allottedResourceCustomization.setProvidingServiceModelInvariantUUID(
+ getLeafPropertyValue(vfcEntity, "providing_service_invariant_uuid"));
allottedResourceCustomization
- .setProvidingServiceModelInvariantUUID(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_invariant_uuid"));
- allottedResourceCustomization.setProvidingServiceModelName(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_name"));
+ .setProvidingServiceModelName(getLeafPropertyValue(vfcEntity, "providing_service_name"));
}
}
+ Map<String, CapabilityAssignment> capAssignmentList = arEntity.getCapabilities();
- CapabilityAssignments arCustomizationCapability =
- toscaResourceStructure.getSdcCsarHelper().getCapabilitiesOf(nodeTemplate);
+ if (capAssignmentList != null) {
- if (arCustomizationCapability != null) {
- CapabilityAssignment capAssign = arCustomizationCapability.getCapabilityByName(SCALABLE);
+ for (Map.Entry<String, CapabilityAssignment> entry : capAssignmentList.entrySet()) {
+ CapabilityAssignment arCapability = entry.getValue();
+
+ if (arCapability != null) {
+
+ String capabilityName = arCapability.getName();
+
+ if (capabilityName.equals(SCALABLE)) {
+
+ allottedResourceCustomization
+ .setMinInstances(Integer.getInteger(getCapabilityLeafPropertyValue(arCapability,
+ SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ allottedResourceCustomization
+ .setMinInstances(Integer.getInteger(getCapabilityLeafPropertyValue(arCapability,
+ SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+
+ }
+ }
- if (capAssign != null) {
- allottedResourceCustomization.setMinInstances(
- Integer.getInteger(toscaResourceStructure.getSdcCsarHelper().getCapabilityPropertyLeafValue(
- capAssign, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
- allottedResourceCustomization.setMaxInstances(
- Integer.getInteger(toscaResourceStructure.getSdcCsarHelper().getCapabilityPropertyLeafValue(
- capAssign, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
}
}
+
return allottedResourceCustomization;
}
- protected AllottedResource createAR(NodeTemplate nodeTemplate) {
+ protected AllottedResource createAR(IEntityDetails arEntity) {
AllottedResource allottedResource = new AllottedResource();
- allottedResource
- .setModelUUID(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ allottedResource.setModelUUID(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
allottedResource.setModelInvariantUUID(
- testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ allottedResource.setModelName(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
allottedResource
- .setModelName(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ .setModelVersion(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ allottedResource.setToscaNodeType(testNull(arEntity.getToscaType()));
allottedResource
- .setModelVersion(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- allottedResource.setToscaNodeType(testNull(nodeTemplate.getType()));
- allottedResource.setSubcategory(
- testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
- allottedResource
- .setDescription(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ .setSubcategory(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
+ allottedResource.setDescription(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
return allottedResource;
}
@@ -2788,6 +2814,17 @@ public class ToscaResourceInstaller {
return null;
}
+ protected String getCapabilityLeafPropertyValue(CapabilityAssignment capAssign, String propName) {
+
+ Property leafProperty = capAssign.getProperties().get(propName);
+
+ if (leafProperty != null && leafProperty.getValue() != null) {
+ return leafProperty.getValue().toString();
+ }
+
+ return null;
+ }
+
protected String getPropertyInput(String propertyName) {
String inputName = new String();
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
index a154734690..4b069e6ac7 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
@@ -724,6 +724,9 @@ public class ASDCNotificationLogging {
buffer.append("Model Subcategory:");
buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
buffer.append(System.lineSeparator());
+ buffer.append("Model Category:");
+ buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ buffer.append(System.lineSeparator());
buffer.append("Model Description:");
buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
index fc72f9bc6e..e1b124775b 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
@@ -51,11 +51,13 @@ import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
import org.onap.so.db.catalog.beans.AllottedResource;
import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ToscaCsar;
import org.onap.so.db.catalog.beans.Workflow;
+import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
@@ -77,6 +79,9 @@ public class ASDCRestInterfaceTest extends BaseTest {
private AllottedResourceRepository allottedRepo;
@Autowired
+ private AllottedResourceCustomizationRepository allottedCustomRepo;
+
+ @Autowired
private ServiceRepository serviceRepo;
@Autowired
@@ -148,7 +153,6 @@ public class ASDCRestInterfaceTest extends BaseTest {
AllottedResourceCustomization arCustomization = new AllottedResourceCustomization();
arCustomization.setModelCustomizationUUID("f62bb612-c5d4-4406-865c-0abec30631ba");
arCustomization.setModelInstanceName("rege1802pnf 0");
- arCustomization.setResourceInput("{}");
arCustomizationSet.add(arCustomization);
arCustomization.setAllottedResource(expectedService);