aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller/src/main/java/org')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java300
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java3
2 files changed, 169 insertions, 134 deletions
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 c3ee081c69..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);
}
}
@@ -821,13 +839,13 @@ public class ToscaResourceInstaller {
protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) {
- List<NodeTemplate> networkCollectionList =
- toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR);
+ List<IEntityDetails> crEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.CR),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
- if (networkCollectionList != null) {
- for (NodeTemplate crNode : networkCollectionList) {
+ if (crEntityList != null) {
+ for (IEntityDetails ncEntity : crEntityList) {
- createNetworkCollection(crNode, toscaResourceStruct, service);
+ createNetworkCollection(ncEntity, toscaResourceStruct, service);
collectionRepo.saveAndFlush(toscaResourceStruct.getCatalogCollectionResource());
List<NetworkInstanceGroup> networkInstanceGroupList =
@@ -1658,7 +1676,7 @@ public class ToscaResourceInstaller {
return networkResource;
}
- protected CollectionNetworkResourceCustomization createNetworkCollection(NodeTemplate networkNodeTemplate,
+ protected CollectionNetworkResourceCustomization createNetworkCollection(IEntityDetails cnrEntity,
ToscaResourceStructure toscaResourceStructure, Service service) {
CollectionNetworkResourceCustomization collectionNetworkResourceCustomization =
@@ -1667,33 +1685,26 @@ public class ToscaResourceInstaller {
// **** Build Object to populate Collection_Resource table
CollectionResource collectionResource = new CollectionResource();
+ collectionResource.setModelName(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
collectionResource
- .setModelName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- collectionResource.setModelInvariantUUID(
- networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- collectionResource
- .setModelUUID(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- collectionResource
- .setModelVersion(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- collectionResource
- .setDescription(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- collectionResource.setToscaNodeType(networkNodeTemplate.getType());
+ .setModelInvariantUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ collectionResource.setModelUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ collectionResource.setModelVersion(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ collectionResource.setDescription(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ collectionResource.setToscaNodeType(cnrEntity.getToscaType());
toscaResourceStructure.setCatalogCollectionResource(collectionResource);
// **** Build object to populate Collection_Resource_Customization table
NetworkCollectionResourceCustomization ncfc = new NetworkCollectionResourceCustomization();
- ncfc.setFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- "cr_function"));
- ncfc.setRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- "cr_role"));
- ncfc.setType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- "cr_type"));
+ ncfc.setFunction(getLeafPropertyValue(cnrEntity, "cr_function"));
+ ncfc.setRole(getLeafPropertyValue(cnrEntity, "cr_role"));
+ ncfc.setType(getLeafPropertyValue(cnrEntity, "cr_type"));
- ncfc.setModelInstanceName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ ncfc.setModelInstanceName(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
ncfc.setModelCustomizationUUID(
- networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
Set<CollectionNetworkResourceCustomization> networkResourceCustomizationSet = new HashSet<>();
networkResourceCustomizationSet.add(collectionNetworkResourceCustomization);
@@ -1704,25 +1715,28 @@ public class ToscaResourceInstaller {
toscaResourceStructure.setCatalogCollectionResourceCustomization(ncfc);
// *** Build object to populate the Instance_Group table
- List<Group> groupList =
- toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(
- networkNodeTemplate, "org.openecomp.groups.NetworkCollection");
+ List<IEntityDetails> ncEntityList =
+ getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.NetworkCollection"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID(
+ cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
List<NetworkInstanceGroup> networkInstanceGroupList = new ArrayList<>();
List<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationList =
new ArrayList<>();
- for (Group group : groupList) {
+ for (IEntityDetails ncGroupEntity : ncEntityList) {
NetworkInstanceGroup networkInstanceGroup = new NetworkInstanceGroup();
- Metadata instanceMetadata = group.getMetadata();
+ Metadata instanceMetadata = ncGroupEntity.getMetadata();
networkInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
networkInstanceGroup
.setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
networkInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
networkInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- networkInstanceGroup.setToscaNodeType(group.getType());
+ networkInstanceGroup.setToscaNodeType(ncGroupEntity.getToscaType());
networkInstanceGroup.setRole(SubType.SUB_INTERFACE.toString()); // Set
// Role
networkInstanceGroup.setType(InstanceGroupType.L3_NETWORK); // Set
@@ -1736,27 +1750,26 @@ public class ToscaResourceInstaller {
crInstanceGroupCustomization.setInstanceGroup(networkInstanceGroup);
crInstanceGroupCustomization.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
crInstanceGroupCustomization.setModelCustomizationUUID(
- networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
// Loop through the template policy to find the subinterface_network_quantity property name. Then extract
// the value for it.
- List<Policy> policyList =
- toscaResourceStructure.getSdcCsarHelper().getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(
- networkNodeTemplate, "org.openecomp.policies.scaling.Fixed");
+ List<IEntityDetails> policyEntityList = getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.policies.scaling.Fixed"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), true);
- if (policyList != null) {
- for (Policy policy : policyList) {
- for (String policyNetworkCollection : policy.getTargets()) {
+ if (policyEntityList != null) {
+ for (IEntityDetails policyEntity : policyEntityList) {
+ for (String policyNetworkCollection : policyEntity.getTargets()) {
- if (policyNetworkCollection.equalsIgnoreCase(group.getName())) {
+ if (policyNetworkCollection.equalsIgnoreCase(ncGroupEntity.getName())) {
- Map<String, Object> propMap = policy.getPolicyProperties();
+ Map<String, Property> propMap = policyEntity.getProperties();
if (propMap.get("quantity") != null) {
- String quantity = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- getPropertyInput(propMap.get("quantity").toString()));
+ String quantity = getLeafPropertyValue(cnrEntity,
+ getPropertyInput(propMap.get("quantity").toString()));
if (quantity != null) {
crInstanceGroupCustomization
@@ -1771,13 +1784,12 @@ public class ToscaResourceInstaller {
}
crInstanceGroupCustomization.setDescription(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)
- + "_network_collection_description"));
- crInstanceGroupCustomization.setFunction(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)
- + "_network_collection_function"));
+ getLeafPropertyValue(cnrEntity, instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)
+ + "_network_collection_description"));
+
+ crInstanceGroupCustomization.setFunction(getLeafPropertyValue(cnrEntity,
+ instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) + "_network_collection_function"));
+
crInstanceGroupCustomization.setCollectionResourceCust(ncfc);
collectionResourceInstanceGroupCustomizationList.add(crInstanceGroupCustomization);
@@ -1789,18 +1801,21 @@ public class ToscaResourceInstaller {
toscaResourceStructure.setCatalogNetworkInstanceGroup(networkInstanceGroupList);
- List<NodeTemplate> vlNodeList = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplateBySdcType(networkNodeTemplate, SdcTypes.VL);
+ List<IEntityDetails> networkEntityList =
+ getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.VL),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID(
+ cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
List<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationList = new ArrayList<>();
// *****Build object to populate the NetworkResource table
NetworkResource networkResource = new NetworkResource();
- for (NodeTemplate vlNodeTemplate : vlNodeList) {
+ for (IEntityDetails networkEntity : networkEntityList) {
- String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
+ String providerNetwork = getLeafPropertyValue(networkEntity,
+ SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
if ("true".equalsIgnoreCase(providerNetwork)) {
networkResource.setNeutronNetworkType(PROVIDER);
@@ -1808,22 +1823,20 @@ public class ToscaResourceInstaller {
networkResource.setNeutronNetworkType(BASIC);
}
- networkResource
- .setModelName(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ networkResource.setModelName(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
networkResource.setModelInvariantUUID(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- networkResource
- .setModelUUID(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ networkResource.setModelUUID(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
networkResource
- .setModelVersion(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ .setModelVersion(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
networkResource.setAicVersionMax(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
TempNetworkHeatTemplateLookup tempNetworkLookUp =
tempNetworkLookupRepo.findFirstBynetworkResourceModelName(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
if (tempNetworkLookUp != null) {
@@ -1835,29 +1848,28 @@ public class ToscaResourceInstaller {
}
- networkResource.setToscaNodeType(vlNodeTemplate.getType());
+ networkResource.setToscaNodeType(networkEntity.getToscaType());
networkResource.setDescription(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
networkResource.setOrchestrationMode(HEAT);
// Build object to populate the
// Collection_Network_Resource_Customization table
- for (NodeTemplate memberNode : group.getMemberNodes()) {
- collectionNetworkResourceCustomization.setModelInstanceName(memberNode.getName());
+ for (IEntityDetails networkMemberEntity : ncGroupEntity.getMemberNodes()) {
+ collectionNetworkResourceCustomization.setModelInstanceName(networkMemberEntity.getName());
}
collectionNetworkResourceCustomization.setModelCustomizationUUID(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
collectionNetworkResourceCustomization.setNetworkTechnology(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNodeTemplate,
- SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
- collectionNetworkResourceCustomization.setNetworkType(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
- collectionNetworkResourceCustomization.setNetworkRole(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
- collectionNetworkResourceCustomization.setNetworkScope(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
+ getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
+ collectionNetworkResourceCustomization.setNetworkType(
+ getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
+ collectionNetworkResourceCustomization.setNetworkRole(
+ getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
+ collectionNetworkResourceCustomization.setNetworkScope(
+ getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
collectionNetworkResourceCustomization.setInstanceGroup(networkInstanceGroup);
collectionNetworkResourceCustomization.setNetworkResource(networkResource);
collectionNetworkResourceCustomization.setNetworkResourceCustomization(ncfc);
@@ -2601,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);
}
@@ -2636,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();
+ TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF)
+ .customizationUUID(allottedResourceCustomization.getModelCustomizationUUID()).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)));
+ List<IEntityDetails> vfcEntities =
+ toscaResourceStructure.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, false);
- List<NodeTemplate> vfcNodes = toscaResourceStructure.getSdcCsarHelper()
- .getVfcListByVf(allottedResourceCustomization.getModelCustomizationUUID());
- if (vfcNodes != null) {
- for (NodeTemplate vfcNode : vfcNodes) {
+ if (vfcEntities != null) {
+ for (IEntityDetails vfcEntity : vfcEntities) {
- allottedResourceCustomization.setProvidingServiceModelUUID(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_uuid"));
allottedResourceCustomization
- .setProvidingServiceModelInvariantUUID(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_invariant_uuid"));
- allottedResourceCustomization.setProvidingServiceModelName(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_name"));
+ .setProvidingServiceModelUUID(getLeafPropertyValue(vfcEntity, "providing_service_uuid"));
+ allottedResourceCustomization.setProvidingServiceModelInvariantUUID(
+ getLeafPropertyValue(vfcEntity, "providing_service_invariant_uuid"));
+ allottedResourceCustomization
+ .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;
}
@@ -2794,14 +2814,26 @@ 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();
if (propertyName != null) {
int getInputIndex = propertyName.indexOf("{get_input=");
+ int getClosingIndex = propertyName.indexOf("}");
if (getInputIndex > -1) {
- inputName = propertyName.substring(getInputIndex + 11, propertyName.length() - 1);
+ inputName = propertyName.substring(getInputIndex + 11, getClosingIndex);
}
}
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());