aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvempo <vitaliy.emporopulo@amdocs.com>2018-11-07 18:48:04 +0200
committerOren Kleks <orenkle@amdocs.com>2018-11-08 06:32:41 +0000
commitb6379cce2e96293cdc00fc3633a0295b55d6f40c (patch)
tree34d9eaa255e8accf0704c3b881c95a9885b6c379
parent3edb71cfc640b32a7cea3ee0823350ef19dd7694 (diff)
Removed dead and duplicate code in onboarding
Change-Id: I2ca0f1a4b00938838213ba2d615ab72c80d6dda3 Issue-ID: SDC-1903 Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
-rw-r--r--common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-core/src/main/java/org/onap/sdc/generator/aai/AaiArtifactGenerator.java207
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java2
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java63
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java47
-rw-r--r--openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java45
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java38
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidator.java45
8 files changed, 164 insertions, 285 deletions
diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-core/src/main/java/org/onap/sdc/generator/aai/AaiArtifactGenerator.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-core/src/main/java/org/onap/sdc/generator/aai/AaiArtifactGenerator.java
index 1f8b537bec..0a1677e797 100644
--- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-core/src/main/java/org/onap/sdc/generator/aai/AaiArtifactGenerator.java
+++ b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-core/src/main/java/org/onap/sdc/generator/aai/AaiArtifactGenerator.java
@@ -20,20 +20,6 @@
package org.onap.sdc.generator.aai;
-import org.onap.sdc.generator.aai.model.*;
-import org.onap.sdc.generator.aai.tosca.GroupDefinition;
-import org.onap.sdc.generator.aai.tosca.NodeTemplate;
-import org.onap.sdc.generator.aai.tosca.ToscaTemplate;
-import org.onap.sdc.generator.aai.types.ModelType;
-import org.onap.sdc.generator.data.*;
-import org.onap.sdc.generator.intf.ArtifactGenerator;
-import org.onap.sdc.generator.intf.Generator;
-import org.onap.sdc.generator.logging.annotations.Audit;
-import org.onap.sdc.generator.util.ArtifactGeneratorUtil;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.slf4j.MDC;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -44,15 +30,42 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Properties;
import java.util.Set;
-
-import static org.onap.sdc.generator.util.ArtifactGeneratorUtil.logError;
+import org.onap.sdc.generator.aai.model.AllotedResource;
+import org.onap.sdc.generator.aai.model.L3NetworkWidget;
+import org.onap.sdc.generator.aai.model.Model;
+import org.onap.sdc.generator.aai.model.ProvidingService;
+import org.onap.sdc.generator.aai.model.Resource;
+import org.onap.sdc.generator.aai.model.Service;
+import org.onap.sdc.generator.aai.model.TunnelXconnectWidget;
+import org.onap.sdc.generator.aai.model.VfModule;
+import org.onap.sdc.generator.aai.model.Widget;
+import org.onap.sdc.generator.aai.tosca.GroupDefinition;
+import org.onap.sdc.generator.aai.tosca.NodeTemplate;
+import org.onap.sdc.generator.aai.tosca.ToscaTemplate;
+import org.onap.sdc.generator.aai.types.ModelType;
+import org.onap.sdc.generator.data.AdditionalParams;
+import org.onap.sdc.generator.data.Artifact;
+import org.onap.sdc.generator.data.ArtifactType;
+import org.onap.sdc.generator.data.GenerationData;
+import org.onap.sdc.generator.data.GeneratorConstants;
+import org.onap.sdc.generator.data.GeneratorUtil;
+import org.onap.sdc.generator.data.GroupType;
+import org.onap.sdc.generator.data.WidgetConfigurationUtil;
+import org.onap.sdc.generator.intf.ArtifactGenerator;
+import org.onap.sdc.generator.intf.Generator;
+import org.onap.sdc.generator.logging.annotations.Audit;
+import org.onap.sdc.generator.util.ArtifactGeneratorUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.slf4j.MDC;
@Generator(artifactType = ArtifactType.AAI)
public class AaiArtifactGenerator implements ArtifactGenerator {
- private static Logger log = LoggerFactory.getLogger(AaiArtifactGenerator.class.getName());
+ private static final Logger log = LoggerFactory.getLogger(AaiArtifactGenerator.class.getName());
/**
* Implementation of the method to generate AAI artifacts.
@@ -101,9 +114,8 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
} else {
String versionRegex = "^[1-9]\\d*(\\.0)$";
if (! (serviceVersion.matches(versionRegex))) {
- throw new IllegalArgumentException(String
- .format(GeneratorConstants
- .GENERATOR_AAI_INVALID_SERVICE_VERSION));
+ throw new IllegalArgumentException(GeneratorConstants
+ .GENERATOR_AAI_INVALID_SERVICE_VERSION);
}
}
@@ -127,12 +139,11 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
if (serviceTosca.getTopology_template() != null
&& serviceTosca.getTopology_template().getNode_templates() != null) {
- processServiceTosca(service, idTypeStore,resourcesVersion, serviceTosca,resources);
+ processServiceTosca(service, idTypeStore,resourcesVersion, serviceTosca);
}
validateResourceToscaAgainstService(idTypeStore, toscas);
//Process the resource tosca files
- int counter = 0;
List<Resource> currentToscaResources = new LinkedList<>();
while (toscas.size() > 0) {
ToscaTemplate resourceTemplate = toscas.remove(0);
@@ -175,7 +186,6 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
resources.add((Resource) model);
currentToscaResources
.clear(); //Clearing the current tosca resource list for the next iteration
- counter = 0;
}
AaiModelGenerator modelGenerator = AaiModelGenerator.getInstance();
@@ -202,10 +212,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
private void validateResourceToscaAgainstService(Map<String, String> idTypeStore,
List<ToscaTemplate> toscas) {
- Iterator entries = idTypeStore.entrySet().iterator();
- while (entries.hasNext()) {
- Map.Entry entry = (Map.Entry) entries.next();
- String resourceUuidFromService = (String)entry.getKey();
+ for (String resourceUuidFromService : idTypeStore.keySet()) {
Iterator<ToscaTemplate> itr = toscas.iterator();
boolean toscaFound = false;
while (itr.hasNext()) {
@@ -216,21 +223,19 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
break;
}
}
- if (toscaFound == false) {
- throw new IllegalArgumentException(String
- .format(GeneratorConstants.GENERATOR_AAI_ERROR_MISSING_RESOURCE_TOSCA,
- resourceUuidFromService));
+ if (!toscaFound) {
+ throw new IllegalArgumentException(
+ String.format(GeneratorConstants.GENERATOR_AAI_ERROR_MISSING_RESOURCE_TOSCA, resourceUuidFromService));
}
}
}
private ToscaTemplate preProcessingTosca(ToscaTemplate tosca) {
- ToscaTemplate processedTosca = tosca;
if (tosca.getTopology_template() != null
&& tosca.getTopology_template().getNode_templates() != null) {
Collection<NodeTemplate> coll =
- processedTosca.getTopology_template().getNode_templates().values();
+ tosca.getTopology_template().getNode_templates().values();
for (NodeTemplate node : coll) {
if (node.getType().contains("org.openecomp.resource.vf.") && node.getMetadata().get("category")
@@ -244,7 +249,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
}
}
}
- return processedTosca;
+ return tosca;
}
private void processVfTosca(Map<String, String> idTypeStore, ToscaTemplate resourceTemplate,
@@ -276,7 +281,6 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
} else if (resourceNode instanceof Resource && !(resourceNode.getWidgetType().equals(
Widget.Type
.L3_NET))) {
- //resourceNode.populateModelIdentificationInformation(node.getMetadata());
idTypeStore.put(resourceNode.getModelNameVersionId(), node.getType());
model.addResource((Resource) resourceNode);
}
@@ -325,16 +329,15 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
group.populateModelIdentificationInformation(properties);
if (group instanceof VfModule && !currentToscaResources.contains(group)) {
if (gd.getMembers() != null && !gd.getMembers().isEmpty()) {
- Set<String> groupMembers = new HashSet<>();
((VfModule) group).setMembers(gd.getMembers());
nodeNameListForGroups.addAll(gd.getMembers());
- groupMembers.addAll(gd.getMembers());
+ Set<String> groupMembers = new HashSet<>(gd.getMembers());
for (String member : groupMembers) {
NodeTemplate node =
resourceTemplate.getTopology_template().getNode_templates().get(member);
if (node != null) {
- Model resourceNode = null;
+ Model resourceNode;
//L3-network inside vf-module to be generated as Widget a special handling.
if (node.getType().contains("org.openecomp.resource.vl")) {
resourceNode = new L3NetworkWidget();
@@ -372,14 +375,13 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
Iterator<Widget> iter = model.getWidgets().iterator();
while (iter.hasNext()) {
- if (iter.next().allInstancesUsed(nodeNameListForGroups) || true) {
- iter.remove();
- }
+ iter.next().allInstancesUsed(nodeNameListForGroups);
+ iter.remove();
}
}
private void processServiceTosca(Service service, Map<String, String> idTypeStore,Map<String,
- String> resourcesVersion,ToscaTemplate serviceTosca, List<Resource> resources) {
+ String> resourcesVersion,ToscaTemplate serviceTosca) {
Collection<NodeTemplate> coll =
serviceTosca.getTopology_template().getNode_templates().values();
log.debug("Inside Service Tosca ");
@@ -411,6 +413,10 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
* @return Generated {@link Artifact} model for the service
*/
private Artifact getServiceArtifact(Model serviceModel, String aaiServiceModel) {
+ return getArtifactForModel(serviceModel, aaiServiceModel);
+ }
+
+ private Artifact getArtifactForModel(Model serviceModel, String aaiServiceModel) {
Artifact artifact =
new Artifact(ArtifactType.MODEL_INVENTORY_PROFILE.name(), GroupType.DEPLOYMENT.name(),
GeneratorUtil.checkSum(aaiServiceModel.getBytes()),
@@ -432,17 +438,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
* @return Generated {@link Artifact} model for the resource
*/
private Artifact getResourceArtifact(Model resourceModel, String aaiResourceModel) {
- Artifact artifact =
- new Artifact(ArtifactType.MODEL_INVENTORY_PROFILE.name(), GroupType.DEPLOYMENT.name(),
- GeneratorUtil.checkSum(aaiResourceModel.getBytes()),
- GeneratorUtil.encode(aaiResourceModel.getBytes()));
- String resourceArtifactName = getArtifactName(resourceModel);
- String resourceArtifactLabel = getArtifactLabel(resourceModel);
- artifact.setName(resourceArtifactName);
- artifact.setLabel(resourceArtifactLabel);
- String description = getArtifactDescription(resourceModel);
- artifact.setDescription(description);
- return artifact;
+ return getArtifactForModel(resourceModel, aaiResourceModel);
}
/**
@@ -455,30 +451,25 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
StringBuilder artifactName = new StringBuilder(ArtifactType.AAI.name());
artifactName.append("-");
- String truncatedArtifactName = "";
- truncatedArtifactName = truncateName(model.getModelName());
+ String truncatedArtifactName = truncateName(model.getModelName());
artifactName.append(truncatedArtifactName);
artifactName.append("-");
artifactName.append(model.getModelType().name().toLowerCase());
artifactName.append("-");
artifactName.append(model.getModelVersion());
-
- //artifactName.append(model.getModelVersion());
artifactName.append(".");
artifactName.append(GeneratorConstants.GENERATOR_AAI_GENERATED_ARTIFACT_EXTENSION);
return artifactName.toString();
}
private String getArtifactLabel(Model model) {
- // String label = "";
StringBuilder artifactName = new StringBuilder(ArtifactType.AAI.name());
artifactName.append("-");
artifactName.append(model.getModelType().name().toLowerCase());
artifactName.append("-");
artifactName.append(hashCodeUuId(model.getModelNameVersionId()));
- String label = (artifactName.toString()).replaceAll("[^a-zA-Z0-9 +]+", "-");
- return label;
+ return (artifactName.toString()).replaceAll("[^a-zA-Z0-9 +]+", "-");
}
private int hashCodeUuId(String uuId) {
@@ -510,7 +501,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
private void validateVersion(String version, String uuId) {
String versionRegex = "^[0-9]\\d*(\\.\\d+)$";
- if (null == version || version == "") {
+ if (null == version || Objects.equals(version, "")) {
throw new IllegalArgumentException(String
.format(GeneratorConstants.GENERATOR_AAI_ERROR_NULL_RESOURCE_VERSION_IN_SERVICE_TOSCA,
uuId));
@@ -531,7 +522,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
throws SecurityException {
byte[] decodedInput = GeneratorUtil.decoder(input.getPayload());
String checksum = GeneratorUtil.checkSum(decodedInput);
- ToscaTemplate tosca = null;
+ ToscaTemplate tosca;
if (checksum.equalsIgnoreCase(input.getChecksum())) {
try {
log.debug("Input yaml name " + input.getName() + "payload " + new String(decodedInput));
@@ -551,7 +542,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
log.debug("Validating tosca for Artifact: " + input.getName());
if (tosca.getMetadata().containsKey("invariantUUID")) {
if (tosca.getMetadata().get("invariantUUID") == null
- || tosca.getMetadata().get("invariantUUID") == "") {
+ || Objects.equals(tosca.getMetadata().get("invariantUUID"), "")) {
throw new IllegalArgumentException(String
.format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION,
"invariantUUID",
@@ -563,7 +554,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
}
if (tosca.getMetadata().containsKey("UUID")) {
- if (tosca.getMetadata().get("UUID") == null || tosca.getMetadata().get("UUID") == "") {
+ if (tosca.getMetadata().get("UUID") == null || Objects.equals(tosca.getMetadata().get("UUID"), "")) {
throw new IllegalArgumentException(String
.format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION, "UUID",
input.getName()));
@@ -574,55 +565,59 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
}
if (tosca.getMetadata().containsKey("name")) {
- if (tosca.getMetadata().get("name") == null || tosca.getMetadata().get("name") == "") {
+ if (tosca.getMetadata().get("name") == null || Objects.equals(tosca.getMetadata().get("name"), "")) {
throw new IllegalArgumentException(String
.format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION, "name",
input.getName()));
}
}
- //Validate VFmodule
if (tosca.getTopology_template() != null && tosca.getTopology_template().getGroups() != null) {
- Collection<GroupDefinition> groups = tosca.getTopology_template().getGroups().values();
- for (GroupDefinition gd : groups) {
- Model group = Model.getModelFor(gd.getType());
- if (group != null && group instanceof VfModule) {
- if (gd.getMetadata().containsKey("vfModuleModelName")
- && gd.getMetadata().get("vfModuleModelName") == null) {
- throw new IllegalArgumentException(String
- .format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION,
- "vfModuleModelName",
- input.getName()));
- }
- if (gd.getMetadata().containsKey("vfModuleModelInvariantUUID")
- && gd.getMetadata().get("vfModuleModelInvariantUUID") == null) {
- throw new IllegalArgumentException(String
- .format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION,
- "vfModuleModelInvariantUUID", input.getName()));
- } else if (gd.getMetadata().get("vfModuleModelInvariantUUID").length() != GeneratorConstants.ID_LENGTH) {
- throw new IllegalArgumentException(String.format(
- GeneratorConstants.GENERATOR_AAI_ERROR_INVALID_ID, "vfModuleModelInvariantUUID",
- input.getName()));
- }
+ validateVfModule(tosca, input);
+ }
+ }
- if (gd.getMetadata().containsKey("vfModuleModelUUID")
- && gd.getMetadata().get("vfModuleModelUUID") == null) {
- throw new IllegalArgumentException(String
- .format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION,
- "vfModuleModelUUID",
- input.getName()));
- } else if (gd.getMetadata().get("vfModuleModelUUID").length() != GeneratorConstants.ID_LENGTH) {
- throw new IllegalArgumentException(String.format(
- GeneratorConstants.GENERATOR_AAI_ERROR_INVALID_ID, "vfModuleModelUUID",
- input.getName()));
- }
- if (gd.getMetadata().containsKey("vfModuleModelVersion")
- && gd.getMetadata().get("vfModuleModelVersion") == null) {
- throw new IllegalArgumentException(String
- .format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION,
- "vfModuleModelVersion",
- input.getName()));
- }
+ private void validateVfModule(ToscaTemplate tosca, Artifact input) {
+
+ Collection<GroupDefinition> groups = tosca.getTopology_template().getGroups().values();
+ for (GroupDefinition gd : groups) {
+ Model group = Model.getModelFor(gd.getType());
+ if (group instanceof VfModule) {
+ if (gd.getMetadata().containsKey("vfModuleModelName")
+ && gd.getMetadata().get("vfModuleModelName") == null) {
+ throw new IllegalArgumentException(String
+ .format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION,
+ "vfModuleModelName",
+ input.getName()));
+ }
+ if (gd.getMetadata().containsKey("vfModuleModelInvariantUUID")
+ && gd.getMetadata().get("vfModuleModelInvariantUUID") == null) {
+ throw new IllegalArgumentException(String
+ .format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION,
+ "vfModuleModelInvariantUUID", input.getName()));
+ } else if (gd.getMetadata().get("vfModuleModelInvariantUUID").length() != GeneratorConstants.ID_LENGTH) {
+ throw new IllegalArgumentException(String.format(
+ GeneratorConstants.GENERATOR_AAI_ERROR_INVALID_ID, "vfModuleModelInvariantUUID",
+ input.getName()));
+ }
+
+ if (gd.getMetadata().containsKey("vfModuleModelUUID")
+ && gd.getMetadata().get("vfModuleModelUUID") == null) {
+ throw new IllegalArgumentException(String
+ .format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION,
+ "vfModuleModelUUID",
+ input.getName()));
+ } else if (gd.getMetadata().get("vfModuleModelUUID").length() != GeneratorConstants.ID_LENGTH) {
+ throw new IllegalArgumentException(String.format(
+ GeneratorConstants.GENERATOR_AAI_ERROR_INVALID_ID, "vfModuleModelUUID",
+ input.getName()));
+ }
+ if (gd.getMetadata().containsKey("vfModuleModelVersion")
+ && gd.getMetadata().get("vfModuleModelVersion") == null) {
+ throw new IllegalArgumentException(String
+ .format(GeneratorConstants.GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION,
+ "vfModuleModelVersion",
+ input.getName()));
}
}
}
@@ -649,7 +644,7 @@ public class AaiArtifactGenerator implements ArtifactGenerator {
private void initWidgetConfiguration() throws IOException {
log.debug("Getting Widget Configuration");
String configLocation = System.getProperty("artifactgenerator.config");
- Properties properties = null;
+ Properties properties;
if (configLocation != null) {
File file = new File(configLocation);
if (file.exists()) {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java
index d4526da1e5..52135fad55 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java
@@ -36,8 +36,6 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDto
target.setThresholdUnits(source.getThresholdUnit());
target.setIncrements(source.getIncrements());
- MapChoiceOrOtherToChoiceOrOtherDto choiceOrOtherMapper =
- new MapChoiceOrOtherToChoiceOrOtherDto();
target.setOperationalScope(new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto()
.applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class));
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java
index 69cd285cf7..5832596580 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java
@@ -35,8 +35,6 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntity
target.setThresholdValue(source.getThresholdValue());
target.setThresholdUnit(source.getThresholdUnits());
target.setIncrements(source.getIncrements());
- MapChoiceOrOtherDtoToChoiceOrOther choiceOrOtherMapper =
- new MapChoiceOrOtherDtoToChoiceOrOther();
target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther()
.applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class));
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
index 1946db8b5d..e9c75319f5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
@@ -16,6 +16,16 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.core.utilities.CommonMethods;
@@ -34,7 +44,15 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.*;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
@@ -52,17 +70,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTempl
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
public class CompositionEntityDataManagerImpl implements CompositionEntityDataManager {
private static final String COMPOSITION_ENTITY_DATA_MANAGER_ERR =
@@ -218,38 +225,6 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
return new HashSet<>();
}
- private boolean isThereErrorsInSubTree(CompositionEntityValidationData entity) {
- if (Objects.isNull(entity)) {
- return false;
- }
-
- if (CollectionUtils.isNotEmpty(entity.getErrors())) {
- return true;
- }
-
- Collection<CompositionEntityValidationData> subEntitiesValidationData =
- entity.getSubEntitiesValidationData();
- return !CollectionUtils.isEmpty(subEntitiesValidationData) &&
- checkForErrorsInChildren(subEntitiesValidationData);
-
- }
-
- private boolean checkForErrorsInChildren(
- Collection<CompositionEntityValidationData> subEntitiesValidationData) {
- boolean result = false;
- for (CompositionEntityValidationData subEntity : subEntitiesValidationData) {
- if (CollectionUtils.isNotEmpty(subEntity.getErrors())) {
- return true;
- }
-
- result = isThereErrorsInSubTree(subEntity) || result;
- if (result) {
- return true;
- }
- }
- return false;
- }
-
private void saveComponents(String vspId, Version version, CompositionData compositionData,
Map<String, String> networkIdByName) {
if (CollectionUtils.isNotEmpty(compositionData.getComponents())) {
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java
index 78242a6c61..4b9ed4f45e 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java
@@ -16,6 +16,17 @@
package org.openecomp.sdc.enrichment.impl.tosca;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.HIGH_AVAIL_MODE;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATORY;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.NFC_NAMING_CODE;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
@@ -28,18 +39,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.ComponentQuestionnaire;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.HIGH_AVAIL_MODE;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATORY;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.NFC_NAMING_CODE;
-
public class ComponentQuestionnaireData {
@@ -59,10 +58,8 @@ public class ComponentQuestionnaireData {
public Map<String, Map<String, Object>> getPropertiesfromCompQuestionnaire(String key,
Version version) {
- Map<String, Map<String, Object>> componentProperties =
- new HashMap<String, Map<String, Object>>();
+ Map<String, Map<String, Object>> componentProperties = new HashMap<>();
- ComponentEntity entity = new ComponentEntity(key, version, null);
final Collection<ComponentEntity> componentEntities =
componentDao.listCompositionAndQuestionnaire(key, version);
@@ -79,12 +76,10 @@ public class ComponentQuestionnaireData {
sourceToTarget.put(component.getId(), componentData.getDisplayName());
- String nfcNamingCode = componentQuestionnaire.getGeneral().getNfcNamingCode() != null ?
- componentQuestionnaire.getGeneral().getNfcNamingCode() : null;
+ String nfcNamingCode = componentQuestionnaire.getGeneral().getNfcNamingCode();
questionnaireParams.put(NFC_NAMING_CODE, nfcNamingCode);
- String vfcDescription = componentQuestionnaire.getGeneral().getNfcFunction() != null ?
- componentQuestionnaire.getGeneral().getNfcFunction() : null;
+ String vfcDescription = componentQuestionnaire.getGeneral().getNfcFunction();
questionnaireParams.put(EnrichmentConstants.NFC_FUNCTION, vfcDescription);
@@ -128,21 +123,21 @@ public class ComponentQuestionnaireData {
Collection<ComponentDependencyModelEntity> componentDependencies =
componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId, version, null));
- Map<String, List<String>> sourceToTargetComponent = new HashMap<String, List<String>>();
- List<String> targetComponents = null;
+ Map<String, List<String>> dependencies = new HashMap<>();
+ List<String> targetComponents;
for (ComponentDependencyModelEntity dependency : componentDependencies) {
String sourceComponentName = componentNameData.get(dependency.getSourceComponentId());
String targetComponentName = componentNameData.get(dependency.getTargetComponentId());
- if (!sourceToTargetComponent.containsKey(sourceComponentName)) {
- targetComponents = new ArrayList<String>();
+ if (!dependencies.containsKey(sourceComponentName)) {
+ targetComponents = new ArrayList<>();
} else {
- targetComponents = sourceToTargetComponent.get(sourceComponentName);
+ targetComponents = dependencies.get(sourceComponentName);
}
targetComponents.add(targetComponentName);
- sourceToTargetComponent.put(sourceComponentName, targetComponents);
+ dependencies.put(sourceComponentName, targetComponents);
}
- return sourceToTargetComponent;
+ return dependencies;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java
index 8c7a7ca6a8..3d428d0b58 100644
--- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java
+++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java
@@ -16,9 +16,22 @@
package org.openecomp.sdc.generator.core.services;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
-import org.onap.sdc.tosca.datatypes.model.*;
+import org.onap.sdc.tosca.datatypes.model.Import;
+import org.onap.sdc.tosca.datatypes.model.NodeTemplate;
+import org.onap.sdc.tosca.datatypes.model.NodeType;
+import org.onap.sdc.tosca.datatypes.model.PropertyDefinition;
+import org.onap.sdc.tosca.datatypes.model.PropertyType;
+import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.onap.sdc.tosca.datatypes.model.TopologyTemplate;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.generator.core.utils.GeneratorUtils;
import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage;
@@ -27,7 +40,6 @@ import org.openecomp.sdc.generator.util.GeneratorConstants;
import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.tosca.services.DataModelUtil;
-import org.openecomp.sdc.tosca.services.ToscaAnalyzerService;
import org.openecomp.sdc.tosca.services.ToscaConstants;
import org.openecomp.sdc.tosca.services.ToscaUtil;
import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl;
@@ -36,8 +48,6 @@ import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypes
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
-import java.util.*;
-
/**
* The type Manual vsp tosca generator.
*/
@@ -57,7 +67,6 @@ public class ManualVspToscaGenerationService {
*/
public ToscaServiceModel createManualVspToscaServiceModel(VspModelInfo vspModelInfo) {
ToscaServiceModel toscaServiceModel = new ToscaServiceModel();
- ToscaAnalyzerService toscaAnalyzerService = new ToscaAnalyzerServiceImpl();
Map<String, ServiceTemplate> serviceTemplates = new HashMap<>(GlobalTypesGenerator
.getGlobalTypesServiceTemplate(OnboardingTypesEnum.MANUAL));
toscaServiceModel.setServiceTemplates(serviceTemplates);
@@ -74,7 +83,6 @@ public class ManualVspToscaGenerationService {
private void createToscaFromVspData(VspModelInfo vspModelInfo,
ToscaServiceModel toscaServiceModel) {
- List<ServiceTemplate> serviceTemplates = new ArrayList<>();
//Only one component supported
Optional<String> componentName = getComponentNameFromVspModel(vspModelInfo);
if (componentName.isPresent()) {
@@ -198,7 +206,6 @@ public class ManualVspToscaGenerationService {
.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME));
globalSubstitutionTypeImportMap.put(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME,
globalSubstitutionTypeImport);
- Map<String, Import> globalImports = new HashMap<>();
List<Map<String, Import>> manualVspGlobalTypesImportList = GlobalTypesGenerator
.getManualVspGlobalTypesImportList();
manualVspGlobalTypesImportList.add(globalSubstitutionTypeImportMap);
@@ -211,10 +218,8 @@ public class ManualVspToscaGenerationService {
ToscaServiceModel toscaServiceModel) {
ServiceTemplate substitutionServiceTemplate =
createInitSubstitutionServiceTemplate(serviceTemplateName);
- createSubstitutionServiceTemplateComponents(substitutionServiceTemplate, vspModelInfo,
- toscaServiceModel);
- createSubstitutionServiceTemplateNics(substitutionServiceTemplate, vspModelInfo,
- toscaServiceModel);
+ createSubstitutionServiceTemplateComponents(substitutionServiceTemplate, vspModelInfo);
+ createSubstitutionServiceTemplateNics(substitutionServiceTemplate, vspModelInfo);
handleSubstitutionMapping(substitutionServiceTemplate, toscaServiceModel,
substitutionNodeTypeId, serviceTemplateName);
return substitutionServiceTemplate;
@@ -222,12 +227,10 @@ public class ManualVspToscaGenerationService {
private void createSubstitutionServiceTemplateComponents(ServiceTemplate
substitutionServiceTemplate,
- VspModelInfo vspModelInfo,
- ToscaServiceModel toscaServiceModel) {
+ VspModelInfo vspModelInfo) {
Map<String, String> components = vspModelInfo.getComponents();
if (MapUtils.isNotEmpty(components)) {
- for (String componentId : components.keySet()) {
- String componentName = components.get(componentId);
+ for (String componentName : components.values()) {
String localNodeTypeId =
createComponentDefinitionNodeTemplate(substitutionServiceTemplate, componentName);
createLocalNodeType(substitutionServiceTemplate, localNodeTypeId);
@@ -236,8 +239,7 @@ public class ManualVspToscaGenerationService {
}
private void createSubstitutionServiceTemplateNics(ServiceTemplate substitutionServiceTemplate,
- VspModelInfo vspModelInfo,
- ToscaServiceModel toscaServiceModel) {
+ VspModelInfo vspModelInfo) {
Map<String, List<Nic>> nics = vspModelInfo.getNics();
if (MapUtils.isNotEmpty(nics)) {
for (Map.Entry<String, List<Nic>> entry : nics.entrySet()) {
@@ -347,12 +349,11 @@ public class ManualVspToscaGenerationService {
.createInitSubstitutionNodeType(substitutionServiceTemplate,
ToscaNodeType.MULTIFLAVOR_VFC_NODE_TYPE);
substitutionNodeType.setProperties(
- getManualVspSubstitutionNodeTypeProperties(substitutionNodeType, componentName));
+ getManualVspSubstitutionNodeTypeProperties(componentName));
return substitutionNodeType;
}
- private Map<String, PropertyDefinition> getManualVspSubstitutionNodeTypeProperties(
- NodeType substitutionNodeType, String componentName) {
+ private Map<String, PropertyDefinition> getManualVspSubstitutionNodeTypeProperties(String componentName) {
//Create num_cpus property
PropertyDefinition numCpus = new PropertyDefinition();
numCpus.setType(PropertyType.INTEGER.getDisplayName());
@@ -377,10 +378,6 @@ public class ManualVspToscaGenerationService {
return manualVspProperties;
}
- private String getSubstitutionNodeTypeId(String componentName) {
- return ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName;
- }
-
/**
* Fetch global substitution service template service template.
*
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java
index ae289f9178..5fb2953b6a 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java
@@ -24,7 +24,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
-
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.onap.sdc.tosca.services.YamlUtil;
@@ -39,7 +38,6 @@ import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
import org.openecomp.sdc.heat.datatypes.model.Environment;
import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate;
import org.openecomp.sdc.heat.datatypes.model.HeatPseudoParameters;
-import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes;
import org.openecomp.sdc.heat.datatypes.model.Output;
import org.openecomp.sdc.heat.datatypes.model.Parameter;
import org.openecomp.sdc.heat.datatypes.model.Resource;
@@ -282,7 +280,7 @@ public class HeatValidator implements Validator {
globalContext) {
for (Output output : outputMap.values()) {
Object outputValue = output.getValue();
- if (outputValue != null && outputValue instanceof Map) {
+ if (outputValue instanceof Map) {
Map<String, Object> outputValueMap = (Map<String, Object>) outputValue;
List<String> getAttrValue =
(List<String>) outputValueMap.get(
@@ -423,7 +421,7 @@ public class HeatValidator implements Validator {
globalContext) {
Map<String, Parameter> parametersMap = heatOrchestrationTemplate.getParameters();
- if (parametersMap != null && MapUtils.isNotEmpty(parametersMap)) {
+ if (MapUtils.isNotEmpty(parametersMap)) {
for (Map.Entry<String, Parameter> parameterEntry : parametersMap.entrySet()) {
validateParameterEntryForParameterDefaultTypeAlignWithType(parameterEntry,
fileName, globalContext);
@@ -629,36 +627,4 @@ public class HeatValidator implements Validator {
"The heat file does not contain any resources"));
}
}
-
-
- @SuppressWarnings("unchecked")
- private void getSecurityGroupsReferencedResourcesFromOutputs(
- Set<String> securityGroupsNamesFromOutputsMap, Map<String, Output> outputMap,
- Map<String, Resource> resourceMap) {
- if (MapUtils.isNotEmpty(outputMap)) {
- for (Map.Entry<String, Output> outputEntry : outputMap.entrySet()) {
-
- validateOutputEntryForGetSecurityGroupsReferencedResourcesFromOutputs(outputEntry,
- resourceMap, securityGroupsNamesFromOutputsMap);
-
- }
- }
- }
- private void validateOutputEntryForGetSecurityGroupsReferencedResourcesFromOutputs(
- Map.Entry<String, Output> outputEntry,
- Map<String, Resource> resourceMap, Set<String> securityGroupsNamesFromOutputsMap){
- Object outputValue = outputEntry.getValue().getValue();
- if (Objects.nonNull(outputValue) && outputValue instanceof Map) {
- String resourceName = (String) ((Map) outputValue)
- .get(ResourceReferenceFunctions.GET_RESOURCE.getFunction());
- if (Objects.nonNull(resourceName)) {
- Resource resource = resourceMap.get(resourceName);
- if (Objects.nonNull(resource) && resource.getType().equals(
- HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource())) {
- securityGroupsNamesFromOutputsMap.add(outputEntry.getKey());
- }
- }
- }
- }
-
}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidator.java
index b11a287a41..a21173a6b2 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidator.java
@@ -17,12 +17,8 @@
package org.openecomp.sdc.validation.impl.validators.heatresource;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.core.validation.ErrorMessageCode;
@@ -32,8 +28,6 @@ import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes;
import org.openecomp.sdc.heat.datatypes.model.Resource;
-import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions;
-import org.openecomp.sdc.heat.services.HeatStructureUtil;
import org.openecomp.sdc.validation.ResourceValidator;
import org.openecomp.sdc.validation.ValidationContext;
import org.openecomp.sdc.validation.type.HeatResourceValidationContext;
@@ -125,43 +119,4 @@ public class NeutronPortResourceValidator implements ResourceValidator {
return CollectionUtils.isNotEmpty(pointingNovaServers)
&& pointingNovaServers.size() > 1;
}
-
- @SuppressWarnings("unchecked")
- private static void validateAllSecurityGroupsAreUsed(String filename,
- Map.Entry<String, Resource> resourceEntry,
- List<String> securityGroupResourceNameList,
- GlobalValidationContext globalContext) {
- Map<String, Object> propertiesMap = resourceEntry.getValue().getProperties();
-
- if (MapUtils.isEmpty(propertiesMap)) {
- return;
- }
-
- Object securityGroupsValue = propertiesMap.get("security_groups");
-
- if (Objects.isNull(securityGroupsValue)) {
- return;
- }
-
- if (securityGroupsValue instanceof List) {
- List<Object> securityGroupsListFromCurrResource =
- (List<Object>) propertiesMap.get("security_groups");
- for (Object securityGroup : securityGroupsListFromCurrResource) {
- removeSecurityGroupNamesFromListByGivenFunction(filename,
- ResourceReferenceFunctions.GET_RESOURCE.getFunction(), securityGroup,
- securityGroupResourceNameList, globalContext);
- }
- }
- }
-
- private static void removeSecurityGroupNamesFromListByGivenFunction(String filename,
- String functionName,
- Object securityGroup,
- Collection<String>
- securityGroupResourceNameList,
- GlobalValidationContext globalContext) {
- Set<String> securityGroupsNamesFromFunction = HeatStructureUtil
- .getReferencedValuesByFunctionName(filename, functionName, securityGroup, globalContext);
- securityGroupsNamesFromFunction.forEach(securityGroupResourceNameList::remove);
- }
}