aboutsummaryrefslogtreecommitdiffstats
path: root/asdctool
diff options
context:
space:
mode:
Diffstat (limited to 'asdctool')
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/Migration1707ArtifactUuidFix.java133
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/Migration1707Config.java43
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/ComponentMigration.java26
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/NodeTemplateMissingDataResolver.java75
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/NormativesMigration.java2
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/ServicesMigration.java22
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/VFResourcesMigration.java12
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/main/MigrationMenu.java83
8 files changed, 299 insertions, 97 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/Migration1707ArtifactUuidFix.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/Migration1707ArtifactUuidFix.java
index 6ae0669151..6f645dc8dd 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/Migration1707ArtifactUuidFix.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/Migration1707ArtifactUuidFix.java
@@ -22,6 +22,7 @@ import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
@@ -56,14 +57,20 @@ public class Migration1707ArtifactUuidFix {
private static Logger log = LoggerFactory.getLogger(Migration1707ArtifactUuidFix.class.getName());
- public boolean migrate(String fixServices, String runMode) {
+ public boolean migrate(String fixComponent, String runMode) {
List<Resource> vfLst = new ArrayList<>();
List<Service> serviceList = new ArrayList<>();
long time = System.currentTimeMillis();
- if (fetchServices(fixServices, serviceList, time) == false) {
- return false;
+ if (fixComponent.equals("vf_only")) {
+ if (fetchFaultVf(fixComponent, vfLst, time) == false) {
+ return false;
+ }
+ } else {
+ if (fetchServices(fixComponent, serviceList, time) == false) {
+ return false;
+ }
}
if (runMode.equals("service_vf") || runMode.equals("fix")) {
log.info("Mode {}. Find problem VFs", runMode);
@@ -85,6 +92,80 @@ public class Migration1707ArtifactUuidFix {
return true;
}
+ private boolean fetchFaultVf(String fixComponent, List<Resource> vfLst, long time) {
+ log.info("Find fault VF ");
+ Writer writer = null;
+ try {
+ String fileName = "fault_" + time + ".csv";
+ writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), "utf-8"));
+ writer.write("vf name, vf id, state, version\n");
+
+ Map<GraphPropertyEnum, Object> hasProps = new HashMap<>();
+ hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name());
+ hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VF.name());
+
+ Map<GraphPropertyEnum, Object> hasNotProps = new HashMap<>();
+ hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
+ log.info("Try to fetch resources with properties {} and not {}", hasProps, hasNotProps);
+
+ Either<List<GraphVertex>, TitanOperationStatus> servicesByCriteria = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll);
+ if (servicesByCriteria.isRight()) {
+ log.info("Failed to fetch resources {}", servicesByCriteria.right().value());
+ return false;
+ }
+ List<GraphVertex> resources = servicesByCriteria.left().value();
+ for (GraphVertex gv : resources) {
+ ComponentParametersView filter = new ComponentParametersView(true);
+ filter.setIgnoreComponentInstances(false);
+ filter.setIgnoreArtifacts(false);
+ filter.setIgnoreGroups(false);
+
+ Either<Resource, StorageOperationStatus> toscaElement = toscaOperationFacade.getToscaElement(gv.getUniqueId());
+ if (toscaElement.isRight()) {
+ log.info("Failed to fetch resources {} {}", gv.getUniqueId(), toscaElement.right().value());
+ return false;
+ }
+
+ Resource resource = toscaElement.left().value();
+ String resourceName = resource.getName();
+ Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+ List<GroupDefinition> groups = resource.getGroups();
+ if (groups == null || groups.isEmpty()) {
+ log.info("No groups for resource {} id {} ", resourceName, gv.getUniqueId());
+ continue;
+ }
+ boolean isProblematic = false;
+ for (GroupDefinition gr : groups) {
+ if (gr.getType().equals(Constants.DEFAULT_GROUP_VF_MODULE)) {
+ if (isProblematicGroup(gr, resourceName, deploymentArtifacts)) {
+ isProblematic = true;
+ break;
+ }
+ }
+ }
+ if (isProblematic) {
+ vfLst.add(resource);
+ writeModuleResultToFile(writer, resource, null);
+ writer.flush();
+ break;
+ }
+ }
+ titanDao.commit();
+
+ } catch (Exception e) {
+ log.info("Failed to fetch vf resources ", e);
+ return false;
+ } finally {
+ titanDao.commit();
+ try {
+ writer.flush();
+ writer.close();
+ } catch (Exception ex) {
+ /* ignore */}
+ }
+ return true;
+ }
+
private boolean fetchVf(List<Service> serviceList, List<Resource> vfLst, long time) {
log.info("Find problem VF ");
if (serviceList.isEmpty()) {
@@ -196,6 +277,7 @@ public class Migration1707ArtifactUuidFix {
serviceList.add(service);
writeModuleResultToFile(writer, service, null);
writer.flush();
+ break;
}
}
titanDao.commit();
@@ -215,6 +297,49 @@ public class Migration1707ArtifactUuidFix {
return true;
}
+ private boolean isProblematicGroup(GroupDefinition gr, String resourceName, Map<String, ArtifactDefinition> deploymentArtifacts) {
+ List<String> artifacts = gr.getArtifacts();
+ List<String> artifactsUuid = gr.getArtifactsUuid();
+
+ if ((artifactsUuid == null || artifactsUuid.isEmpty()) && (artifacts == null || artifacts.isEmpty())) {
+ log.info("No groups in resource {} ", resourceName);
+ return false;
+ }
+ if (artifacts.size() < artifactsUuid.size()) {
+ log.info(" artifacts.size() < artifactsUuid.size() group {} in resource {} ", gr.getName(), resourceName);
+ return true;
+ }
+ if (artifacts.size() > 0 && (artifactsUuid == null || artifactsUuid.isEmpty())) {
+ log.info(" artifacts.size() > 0 && (artifactsUuid == null || artifactsUuid.isEmpty() group {} in resource {} ", gr.getName(), resourceName);
+ return true;
+ }
+ if (artifactsUuid.contains(null)) {
+ log.info(" artifactsUuid.contains(null) group {} in resource {} ", gr.getName(), resourceName);
+ return true;
+ }
+
+ for (String artifactId : artifacts) {
+ String artifactlabel = findArtifactLabelFromArtifactId(artifactId);
+ ArtifactDefinition artifactDefinition = deploymentArtifacts.get(artifactlabel);
+ if (artifactDefinition == null) {
+ log.info(" artifactDefinition == null label {} group {} in resource {} ", artifactlabel, gr.getName(), resourceName);
+ return true;
+ }
+ ArtifactTypeEnum artifactType = ArtifactTypeEnum.findType(artifactDefinition.getArtifactType());
+ if (artifactType != ArtifactTypeEnum.HEAT_ENV) {
+ if (!artifactId.equals(artifactDefinition.getUniqueId())) {
+ log.info(" !artifactId.equals(artifactDefinition.getUniqueId() artifact {} artId {} group {} in resource {} ", artifactlabel, artifactId, gr.getName(), resourceName);
+ return true;
+ }
+ if (!artifactsUuid.contains(artifactDefinition.getArtifactUUID())) {
+ log.info(" artifactsUuid.contains(artifactDefinition.getArtifactUUID() label {} group {} in resource {} ", artifactlabel, gr.getName(), resourceName);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
private boolean isProblematicGroupInstance(GroupInstance gi, String instName, String servicename, Map<String, ArtifactDefinition> deploymentArtifacts) {
List<String> artifacts = gi.getArtifacts();
List<String> artifactsUuid = gi.getArtifactsUuid();
@@ -359,7 +484,7 @@ public class Migration1707ArtifactUuidFix {
if (correctArtifactUUID != null && !correctArtifactUUID.isEmpty()) {
group.getArtifactsUuid().add(correctArtifactUUID);
}
- }else{
+ } else {
log.debug("Migration1707ArtifactUuidFix fix group: group name {} correct artifactId {} artifactUUID {} ", group.getName(), correctArtifactId, correctArtifactUUID);
group.getGroupInstanceArtifacts().add(correctArtifactId);
if (correctArtifactUUID != null && !correctArtifactUUID.isEmpty()) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/Migration1707Config.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/Migration1707Config.java
index eeb29d67c2..93081e00a3 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/Migration1707Config.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/Migration1707Config.java
@@ -47,60 +47,60 @@ public class Migration1707Config {
return new Migration1707(migrations);
}
- //@Bean(name = "renameGraphPropertyKeysMigration")
- //@Order(1)
- //public Migration1707Task renameGraphPropertyKeysMigration() {
- // return new RenameGraphPropertyKeys();
- // }
-
- //@Bean(name = "toscaNamesUpdate")
- //@Order(2)
- //public Migration1707Task toscaNamesUpdate() {
- // return new ToscaNamesUpdate();
- //}
+ @Bean(name = "renameGraphPropertyKeysMigration")
+ @Order(1)
+ public Migration1707Task renameGraphPropertyKeysMigration() {
+ return new RenameGraphPropertyKeys();
+ }
+
+ @Bean(name = "toscaNamesUpdate")
+ @Order(2)
+ public Migration1707Task toscaNamesUpdate() {
+ return new ToscaNamesUpdate();
+ }
@Bean(name = "users-migration")
- @Order(1)
+ @Order(3)
public Migration1707Task usersMigration() {
return new UsersMigration();
}
@Bean(name = "resource-category-migration")
- @Order(2)
+ @Order(4)
public Migration1707Task resourceCategoriesMigration() {
return new ResourcesCategoriesMigration();
}
@Bean(name = "service-category-migration")
- @Order(3)
+ @Order(5)
public Migration1707Task serviceCategoriesMigration() {
return new ServiceCategoriesMigration();
}
@Bean(name = "normatives-migration")
- @Order(4)
+ @Order(6)
public Migration1707Task normativesMigration() {
return new NormativesMigration();
}
@Bean(name = "vf-migration")
- @Order(5)
+ @Order(7)
public Migration1707Task vfMigration() {
return new VFResourcesMigration();
}
@Bean(name = "service-migration")
- @Order(6)
+ @Order(8)
public Migration1707Task serviceMigration() {
return new ServicesMigration();
}
@Bean(name = "consumers-migration")
- @Order(7)
+ @Order(9)
public Migration1707Task consumersMigration() { return new ConsumersMigration(); }
@Bean(name = "tosca-template-regeneration")
- @Order(8)
+ @Order(10)
public Migration1707Task ToscaTemplateRegeneration() {
return new ToscaTemplateRegeneration();
}
@@ -245,5 +245,10 @@ public class Migration1707Config {
public VfModulesPropertiesAdding vfModulesPropertiesAdding() {
return new VfModulesPropertiesAdding();
}
+
+ @Bean(name = "node-template-missing-data-resolver")
+ public NodeTemplateMissingDataResolver nodeTemplateMissingDataResolver() {
+ return new NodeTemplateMissingDataResolver<>();
+ }
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/ComponentMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/ComponentMigration.java
index 63eb8879c9..30d14e686b 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/ComponentMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/ComponentMigration.java
@@ -3,7 +3,11 @@ package org.openecomp.sdc.asdctool.impl.migration.v1707.jsonmodel;
import fj.data.Either;
import org.openecomp.sdc.asdctool.impl.migration.v1707.jsonmodel.relations.RequirementsCapabilitiesMigrationService;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
+import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.migration.MigrationMalformedDataLogger;
@@ -12,7 +16,9 @@ import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
import static org.openecomp.sdc.asdctool.impl.migration.v1707.MigrationUtils.handleError;
@@ -29,14 +35,16 @@ public abstract class ComponentMigration <T extends Component> extends JsonModel
@Resource(name = "invariant-uuid-resolver")
private InvariantUUIDResolver <T> invariantUUIDResolver;
-
+
+ @Resource(name = "node-template-missing-data-resolver")
+ private NodeTemplateMissingDataResolver nodeTemplateMissingDataResolver;
+
@Override
boolean save(T element) {
LOGGER.debug(String.format("creating component %s in new graph", element.getName()));
return toscaOperations.createToscaComponent(element)
.either(savedNode -> true,
err -> handleError(String.format("failed to create component %s with id %s. reason: %s", element.getName(), element.getUniqueId(), err.name())));
-
}
@Override
@@ -70,6 +78,20 @@ public abstract class ComponentMigration <T extends Component> extends JsonModel
}
return cmptsWithoutInvariant;
}
+
+
+ protected void setMissingTemplateInfo(List<T> components) {
+ Map<String, ToscaElement> origCompMap = new HashMap<>();
+ for (T component : components) {
+ for (ComponentInstance instance : component.getComponentInstances()){
+ nodeTemplateMissingDataResolver.resolveNodeTemplateInfo(instance, origCompMap, component);
+ }
+ }
+ }
+
+
+
+
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/NodeTemplateMissingDataResolver.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/NodeTemplateMissingDataResolver.java
new file mode 100644
index 0000000000..275d499bae
--- /dev/null
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/NodeTemplateMissingDataResolver.java
@@ -0,0 +1,75 @@
+package org.openecomp.sdc.asdctool.impl.migration.v1707.jsonmodel;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
+import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstanceInput;
+import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fj.data.Either;
+
+
+public class NodeTemplateMissingDataResolver <T extends Component> {
+
+ private static Logger LOGGER = LoggerFactory.getLogger(NodeTemplateMissingDataResolver.class);
+
+ @Resource(name = "tosca-element-lifecycle-operation")
+ private ToscaElementLifecycleOperation lifecycleOperation;
+
+ @Resource(name = "topology-template-operation")
+ private TopologyTemplateOperation topologyTemplateOperation;
+
+ public void resolveNodeTemplateInfo(ComponentInstanceDataDefinition vfInst, Map<String, ToscaElement> origCompMap, T component) {
+ lifecycleOperation.resolveToscaComponentName(vfInst, origCompMap);
+ if(OriginTypeEnum.VF == vfInst.getOriginType())
+ collectVFInstanceInputs(component.getComponentInstancesInputs(), origCompMap, vfInst);
+ }
+
+ private void collectVFInstanceInputs(Map<String, List<ComponentInstanceInput>> instInputs, Map<String, ToscaElement> origCompMap, ComponentInstanceDataDefinition vfInst) {
+ String ciUid = vfInst.getUniqueId();
+ String origCompUid = vfInst.getComponentUid();
+ Either<ToscaElement, StorageOperationStatus> origComp = fetchToscaElement(origCompMap, vfInst, origCompUid);
+ if(origComp.isRight())
+ return;
+ Map<String, PropertyDataDefinition> origVFInputs = ((TopologyTemplate)origComp.left().value()).getInputs();
+ if (origVFInputs != null && !origVFInputs.isEmpty()) {
+ Map<String, ComponentInstanceInput> collectedVFInputs = origVFInputs.values().stream()
+ .collect(Collectors.toMap(p -> p.getName(), p -> new ComponentInstanceInput(p)));
+ List<ComponentInstanceInput> instInputList = instInputs.get(ciUid);
+ Map<String, ComponentInstanceInput> existingInstInputs = ToscaDataDefinition.listToMapByName(instInputList);
+ collectedVFInputs.putAll(existingInstInputs);
+ List<ComponentInstanceInput> mergedList = new ArrayList<>(collectedVFInputs.values());
+ instInputs.put(ciUid, mergedList);
+ }
+ }
+
+ private Either<ToscaElement, StorageOperationStatus> fetchToscaElement(Map<String, ToscaElement> origCompMap, ComponentInstanceDataDefinition vfInst, String origCompUid) {
+ Either<ToscaElement, StorageOperationStatus> origCompEither;
+ if (!origCompMap.containsKey(origCompUid)) {
+ origCompEither = topologyTemplateOperation.getToscaElement(origCompUid);
+ if (origCompEither.isRight()) {
+ LOGGER.error("failed to fetch Tosca element {} with id {}", vfInst.getComponentName(), origCompUid);
+ return origCompEither;
+ }
+ origCompMap.put(origCompUid, origCompEither.left().value());
+ }
+ return Either.left(origCompMap.get(origCompUid));
+ }
+}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/NormativesMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/NormativesMigration.java
index 82d59e57b7..e95a724be2 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/NormativesMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/NormativesMigration.java
@@ -16,7 +16,7 @@ public class NormativesMigration extends ComponentMigration<Resource> {
private static Logger LOGGER = LoggerFactory.getLogger(NormativesMigration.class);
private static final String JCP_VERSION_PROPERTY = "jcp-version";
- private static final Set<String> e2eMalformedVfcs = Sets.newHashSet("71879ee1-ad63-46d0-9943-d33083a6fdbb", "e54e7c4d-6020-4c53-838b-42d34c0da5c9");
+ private static final Set<String> e2eMalformedVfcs = Sets.newHashSet("59da26b4-edd0-4412-a2e6-d6711f376340");
@javax.annotation.Resource(name = "normatives-resolver")
private NormativesResolver normativesResolver;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/ServicesMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/ServicesMigration.java
index 254a75b317..a6134070d4 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/ServicesMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/ServicesMigration.java
@@ -1,6 +1,12 @@
package org.openecomp.sdc.asdctool.impl.migration.v1707.jsonmodel;
-import fj.data.Either;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.Service;
@@ -9,11 +15,7 @@ import org.openecomp.sdc.be.model.operations.migration.MigrationMalformedDataLog
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
+import fj.data.Either;
public class ServicesMigration extends ComponentMigration<Service> {
@@ -57,6 +59,12 @@ public class ServicesMigration extends ComponentMigration<Service> {
LOGGER.info("migrating services versions");
return versionMigration.buildComponentsVersionChain(elements);
}
+
+ @Override
+ void doPreMigrationOperation(List<Service> elements) {
+ super.doPreMigrationOperation(elements);
+ setMissingTemplateInfo(elements);
+ }
private void filterOutDuplicatePropsAndAttrs(Service element) {
if (element.getComponentInstancesProperties() != null) {
@@ -148,5 +156,5 @@ public class ServicesMigration extends ComponentMigration<Service> {
// .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
// }
-
+
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/VFResourcesMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/VFResourcesMigration.java
index 34c40f0aa9..74755c8326 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/VFResourcesMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/migration/v1707/jsonmodel/VFResourcesMigration.java
@@ -1,14 +1,14 @@
package org.openecomp.sdc.asdctool.impl.migration.v1707.jsonmodel;
-import fj.data.Either;
+import java.util.List;
+
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.operations.api.IResourceOperation;
-import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.List;
+import fj.data.Either;
public class VFResourcesMigration extends ComponentMigration<Resource> {
@@ -49,5 +49,11 @@ public class VFResourcesMigration extends ComponentMigration<Resource> {
return versionMigration.buildComponentsVersionChain(elements);
}
+ @Override
+ void doPreMigrationOperation(List<Resource> elements) {
+ super.doPreMigrationOperation(elements);
+ setMissingTemplateInfo(elements);
+ }
+
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/MigrationMenu.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/MigrationMenu.java
index d3935000fe..cfb1ec0b27 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/MigrationMenu.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/MigrationMenu.java
@@ -246,69 +246,30 @@ public class MigrationMenu {
break;
case MIGRATION_1702_1707://this migration is currently not needed, but will be commented out for production env
-// log.info("Start ASDC migration from 1702 to 1707");
-// Migration1707 migration1707 = (Migration1707) context.getBean(operationEnum.getBeanName());
-// isSuccessful = migration1707.migrate();
-// if (isSuccessful) {
-// log.info("SDC migration from 1702 to 1707 was finished successfully");
-// System.exit(0);
-// } else{
-// log.info("SDC migration from 1702 to 1707 has failed");
-// System.exit(2);
-// }
- System.exit(0);
+ log.info("Start ASDC migration from 1702 to 1707");
+ Migration1707 migration1707 = (Migration1707) context.getBean(operationEnum.getBeanName());
+ isSuccessful = migration1707.migrate();
+ if (isSuccessful) {
+ log.info("SDC migration from 1702 to 1707 was finished successfully");
+ System.exit(0);
+ } else{
+ log.info("SDC migration from 1702 to 1707 has failed");
+ System.exit(2);
+ }
+ //System.exit(0);
break;
case VFMODULES_PROPERTIES_ADDING://this migration is currently not needed, but will be commented out for production env
-// log.info("Start adding new properties to vfModules");
-// VfModulesPropertiesAdding migrationVfModulesProperties = (VfModulesPropertiesAdding) context.getBean(operationEnum.getBeanName());
-// isSuccessful = migrationVfModulesProperties.migrate(args[1]);
-// if (isSuccessful) {
-// log.info("Adding new properties to vfModules was finished successfully");
-// System.exit(0);
-// } else{
-// log.info("Adding new properties to vfModules has failed");
-// System.exit(2);
-// }
- System.exit(0);
- break;
- case MIGRATION_1707_VNF_FIX://this migration is currently not needed, but will be commented out for production env
-// log.info("Start fixing vnf after 1707 migration");
-// Migration1707VnfFix migrationVnfFix = (Migration1707VnfFix) context.getBean(operationEnum.getBeanName());
-// isSuccessful = migrationVnfFix.migrate();
-// if (isSuccessful) {
-// log.info("Fixing VNFs after 1707 migration was finished successfully");
-// System.exit(0);
-// } else{
-// log.info("Fixing VNFs after 1707 migration has failed");
-// System.exit(2);
-// }
- System.exit(0);
- break;
- case DISTRIBUTION_STATUS_UPDATE_1707://not needed can be dropped
-// log.info("Start Distribution status update 1707");
-// DistributionStatusUpdate distStatusUpdate = (DistributionStatusUpdate) context.getBean(operationEnum.getBeanName());
-// isSuccessful = distStatusUpdate.migrate();
-// if (isSuccessful) {
-// log.info("ASDC Distribution status update 1707 was finished successful");
-// System.exit(0);
-// } else{
-// log.info("ASDC Distribution status update 1707 has failed");
-// System.exit(2);
-// }
- System.exit(0);
- break;
- case MIGRATION_1707_RELATIONS_FIX://not needed can be dropped
-// log.info("Start fixing relations after 1707 migration");
-// Migration migrationFix = (Migration1707RelationsFix) context.getBean(operationEnum.getBeanName());
-// isSuccessful = migrationFix.migrate();
-// if (isSuccessful) {
-// log.info("Fixing relations after 1707 migration was finished successfully");
-// System.exit(0);
-// } else{
-// log.info("Fixing relations after 1707 migration has failed");
-// System.exit(2);
-// }
- System.exit(0);
+ log.info("Start adding new properties to vfModules");
+ VfModulesPropertiesAdding migrationVfModulesProperties = (VfModulesPropertiesAdding) context.getBean(operationEnum.getBeanName());
+ isSuccessful = migrationVfModulesProperties.migrate(args[1]);
+ if (isSuccessful) {
+ log.info("Adding new properties to vfModules was finished successfully");
+ System.exit(0);
+ } else{
+ log.info("Adding new properties to vfModules has failed");
+ System.exit(2);
+ }
+ //System.exit(0);
break;
case MIGRATION_1707_UUID_FIX:
if (args == null || args.length < 5) {