2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.asdctool.impl.migration.v1604;
23 import static java.nio.file.Files.readAllBytes;
24 import static java.nio.file.Paths.get;
26 import java.util.ArrayList;
27 import java.util.HashMap;
28 import java.util.HashSet;
29 import java.util.Iterator;
30 import java.util.List;
32 import java.util.Map.Entry;
34 import java.util.UUID;
36 import org.apache.commons.lang3.tuple.ImmutablePair;
37 import org.apache.tinkerpop.gremlin.structure.Direction;
38 import org.apache.tinkerpop.gremlin.structure.Edge;
39 import org.apache.tinkerpop.gremlin.structure.Vertex;
40 import org.openecomp.sdc.be.dao.api.ActionStatus;
41 import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
42 import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
43 import org.openecomp.sdc.be.dao.graph.datatype.RelationEndPoint;
44 import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
45 import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary;
46 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
47 import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
48 import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
49 import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
50 import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
51 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
52 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
53 import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
54 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
55 import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
56 import org.openecomp.sdc.be.model.CapabilityDefinition;
57 import org.openecomp.sdc.be.model.Component;
58 import org.openecomp.sdc.be.model.ComponentInstance;
59 import org.openecomp.sdc.be.model.LifecycleStateEnum;
60 import org.openecomp.sdc.be.model.PropertyDefinition;
61 import org.openecomp.sdc.be.model.RequirementDefinition;
62 import org.openecomp.sdc.be.model.Resource;
63 import org.openecomp.sdc.be.model.User;
64 import org.openecomp.sdc.be.model.category.CategoryDefinition;
65 import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
66 import org.openecomp.sdc.be.model.operations.api.IElementOperation;
67 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
68 import org.openecomp.sdc.be.model.operations.impl.AdditionalInformationOperation;
69 import org.openecomp.sdc.be.model.operations.impl.ComponentInstanceOperation;
70 import org.openecomp.sdc.be.model.operations.impl.ComponentOperation;
71 import org.openecomp.sdc.be.model.operations.impl.LifecycleOperation;
72 import org.openecomp.sdc.be.model.operations.impl.ProductOperation;
73 import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
74 import org.openecomp.sdc.be.model.operations.impl.ResourceOperation;
75 import org.openecomp.sdc.be.model.operations.impl.ServiceOperation;
76 import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
77 import org.openecomp.sdc.be.resources.data.CapabilityData;
78 import org.openecomp.sdc.be.resources.data.ComponentInstanceData;
79 import org.openecomp.sdc.be.resources.data.ComponentMetadataData;
80 import org.openecomp.sdc.be.resources.data.ProductMetadataData;
81 import org.openecomp.sdc.be.resources.data.RelationshipInstData;
82 import org.openecomp.sdc.be.resources.data.RequirementData;
83 import org.openecomp.sdc.be.resources.data.ResourceMetadataData;
84 import org.openecomp.sdc.be.resources.data.ServiceMetadataData;
85 import org.openecomp.sdc.be.resources.data.TagData;
86 import org.openecomp.sdc.be.resources.data.category.CategoryData;
87 import org.openecomp.sdc.be.resources.data.category.SubCategoryData;
88 import org.openecomp.sdc.be.utils.CommonBeUtils;
89 import org.openecomp.sdc.common.util.ValidationUtils;
90 import org.slf4j.Logger;
91 import org.slf4j.LoggerFactory;
92 import org.springframework.beans.factory.annotation.Autowired;
93 import org.yaml.snakeyaml.Yaml;
95 import com.thinkaurelius.titan.core.TitanEdge;
96 import com.thinkaurelius.titan.core.TitanGraph;
97 import com.thinkaurelius.titan.core.TitanVertex;
99 import fj.data.Either;
101 public class ServiceMigration {
103 private static final String[] NORMATIVE_OLD_NAMES = { "tosca.nodes.network.Network", "tosca.nodes.network.Port", "tosca.nodes.BlockStorage", "tosca.nodes.Compute", "tosca.nodes.Container.Application", "tosca.nodes.Container.Runtime",
104 "tosca.nodes.Database", "tosca.nodes.DBMS", "tosca.nodes.LoadBalancer", "tosca.nodes.ObjectStorage", "tosca.nodes.Root", "tosca.nodes.SoftwareComponent", "tosca.nodes.WebApplication", "tosca.nodes.WebServer", };
106 private static Logger log = LoggerFactory.getLogger(ServiceMigration.class.getName());
109 protected TitanGenericDao titanGenericDao;
111 protected ResourceOperation resourceOperation;
113 protected ServiceOperation serviceOperation;
115 protected ProductOperation productOperation;
117 protected LifecycleOperation lifecycleOperaion;
119 protected PropertyOperation propertyOperation;
121 protected AdditionalInformationOperation additionalInformationOperation;
123 protected ComponentInstanceOperation componentInstanceOperaion;
125 protected IElementOperation elementOperation;
127 public boolean migrate1602to1604(String appConfigDir) {
129 boolean result = false;
133 if (!addResourceCounterToResources()) {
134 log.debug("Failed to update resource instance counter on resources");
138 if (!updateComponentInstanceType()) {
139 log.debug("Failed to update component instance type");
144 if (!fixDerivedVf()) {
145 log.debug("Failed to fix VFs");
149 // update instances and relation
150 if (!updateCalculatedEdges()) {
151 log.debug("Failed to update calculated edges for VF instances");
155 // update instances and relation
156 if (!updateRelations()) {
157 log.debug("Failed to update Instance And Relations in services");
161 if (!updateCategories(appConfigDir)) {
162 log.debug("Failed to update categories");
167 if (!AllowMultipleHeats.removeAndUpdateHeatPlaceHolders(titanGenericDao, log, true)) {
168 log.error("Failed to update heat place holders");
173 if (!AddGroupUuid.addGroupUuids(titanGenericDao, log, true)) {
174 log.error("Failed to update group UUIDs");
182 titanGenericDao.rollback();
184 titanGenericDao.commit();
190 private boolean updateCategories(String appConfigDir) {
191 // String categoryMigrationFile = appConfigDir + File.separator +
192 // "categoryMigration.yaml";
193 String categoryMigrationFile = appConfigDir + "categoryMigration.yaml";
195 Map<String, List<MigrationCategory>> categoriesFromYml;
197 categoriesFromYml = createCategoriesFromYml(categoryMigrationFile);
198 if (categoriesFromYml == null || categoriesFromYml.isEmpty()) {
199 log.debug("updateCategories failed to load categories form migration file {}", categoryMigrationFile);
202 } catch (Exception e) {
203 log.debug("Failed to load category migration file : {}", categoryMigrationFile, e);
206 for (Map.Entry<String, List<MigrationCategory>> entry : categoriesFromYml.entrySet()) {
207 ComponentTypeEnum componentType = ComponentTypeEnum.findByParamName(entry.getKey());
208 if (componentType != null) {
209 switch (componentType) {
211 if (updateResourceCategories(entry.getValue()) == false) {
212 log.debug("updateCategories failed to update resource categories");
217 if (updateServiceCategories(entry.getValue()) == false) {
218 log.debug("updateCategories failed to update service categories");
223 log.debug("updateCategories no changes for categories from type {}", componentType);
226 log.debug("updateCategories failed not supported component file in migration categories file" + entry.getKey());
233 private boolean updateServiceCategories(List<MigrationCategory> categories) {
234 log.debug("updateServiceCategories STARTED");
235 Either<List<CategoryDefinition>, ActionStatus> serviceCategories = elementOperation.getAllCategories(NodeTypeEnum.ServiceNewCategory, true);
236 if (serviceCategories.isRight()) {
237 log.debug("updateServiceCategories failed fetch all service categories ,error " + serviceCategories.right().value());
240 for (MigrationCategory newCat : categories) {
242 if (newCat.getOldName() == null) {
244 boolean exist = false;
245 for (CategoryDefinition catInDB : serviceCategories.left().value()) {
246 if (newCat.getName().equals(catInDB.getName())) {
252 CategoryDefinition categoryDefinition = new CategoryDefinition(newCat);
253 Either<CategoryDefinition, ActionStatus> result = elementOperation.createCategory(categoryDefinition, NodeTypeEnum.ServiceNewCategory, true);
254 if (result.isRight()) {
255 log.debug("Failed to create service category {} error {}", categoryDefinition, result.right().value());
258 log.debug("service category {} created", categoryDefinition);
262 for (CategoryDefinition catInDB : serviceCategories.left().value()) {
263 if (newCat.getOldName().equals(catInDB.getName())) {
264 Either<CategoryData, TitanOperationStatus> updateSingleResult = updateSingleResourceCategory(newCat, NodeTypeEnum.ServiceNewCategory);
265 if (updateSingleResult.isRight()) {
273 log.debug("updateServiceCategories ENDED");
277 private Either<CategoryData, TitanOperationStatus> updateSingleResourceCategory(MigrationCategory newCat, NodeTypeEnum nodetype) {
278 Map<String, Object> properties = new HashMap<>();
279 properties.put(GraphPropertiesDictionary.NAME.getProperty(), newCat.getOldName());
280 Either<List<CategoryData>, TitanOperationStatus> categoryEither = titanGenericDao.getByCriteria(nodetype, properties, CategoryData.class);
281 if (categoryEither.isRight() && categoryEither.right().value() != TitanOperationStatus.NOT_FOUND) {
282 log.debug("Failed to get {} categories, for name {} error {}", nodetype, newCat.getOldName(), categoryEither.right().value());
283 return Either.right(categoryEither.right().value());
285 List<CategoryData> categoryList = (categoryEither.isLeft() ? categoryEither.left().value() : null);
286 if (categoryList == null) {
287 log.debug("No {} categories, for name {} error {}", nodetype, newCat.getOldName());
288 return Either.right(TitanOperationStatus.NOT_FOUND);
290 CategoryData categoryData = categoryList.get(0);
291 categoryData.getCategoryDataDefinition().setName(newCat.getName());
292 categoryData.getCategoryDataDefinition().setIcons(newCat.getIcons());
293 categoryData.getCategoryDataDefinition().setNormalizedName(ValidationUtils.normalizeCategoryName4Uniqueness(newCat.getName()));
294 Either<CategoryData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(categoryData, CategoryData.class);
295 if (updateNode.isRight()) {
296 log.debug("Failed to update {} category {} error {}", nodetype, categoryData, updateNode.right().value());
297 return Either.right(updateNode.right().value());
299 log.debug("Update {} category {} ", nodetype, categoryData);
300 return Either.left(updateNode.left().value());
303 private boolean updateResourceCategories(List<MigrationCategory> categories) {
304 log.debug("updateResourceCategories STARTED");
305 Either<List<CategoryDefinition>, ActionStatus> resourceCategories = elementOperation.getAllCategories(NodeTypeEnum.ResourceNewCategory, true);
306 if (resourceCategories.isRight()) {
307 log.debug("updateResourceCategories failed fetch all resource categories ,error " + resourceCategories.right().value());
310 for (MigrationCategory newCat : categories) {
311 if (newCat.getOldName() == null) {
313 // check if already created in previous running
314 boolean exist = false;
315 for (CategoryDefinition catInDB : resourceCategories.left().value()) {
316 if (newCat.getName().equals(catInDB.getName())) {
321 CategoryDefinition categoryDefinition = new CategoryDefinition(newCat);
322 Either<CategoryDefinition, ActionStatus> resultCat = elementOperation.createCategory(categoryDefinition, NodeTypeEnum.ResourceNewCategory, true);
323 if (resultCat.isRight()) {
324 log.debug("Failed to create resource category {} error {}", categoryDefinition, resultCat.right().value());
327 log.debug("resource category {} created", categoryDefinition);
329 List<MigrationSubCategory> nSubCat = newCat.getSubcategories();
330 List<MigrationSubCategory> newSubcat = nSubCat;
331 List<MigrationSubCategory> subcategories = newSubcat;
332 for (MigrationSubCategory msubcat : subcategories) {
333 SubCategoryDefinition subcat = new SubCategoryDefinition(msubcat);
334 Either<SubCategoryDefinition, ActionStatus> resultSubcat = elementOperation.createSubCategory(resultCat.left().value().getUniqueId(), subcat, NodeTypeEnum.ResourceSubcategory, true);
335 if (resultSubcat.isRight()) {
336 log.debug("Failed to create resource sub category {} error {}", subcat, resultSubcat.right().value());
339 log.debug("resource sub category {} created for category {}", categoryDefinition, resultCat.left().value().getName());
344 for (CategoryDefinition catInDB : resourceCategories.left().value()) {
345 if (newCat.getOldName().equals(catInDB.getName())) {
346 Either<CategoryData, TitanOperationStatus> updateSingleResult = updateSingleResourceCategory(newCat, NodeTypeEnum.ResourceNewCategory);
347 if (updateSingleResult.isRight()) {
351 CategoryData categoryData = updateSingleResult.left().value();
352 for (MigrationSubCategory migSubCat : newCat.getSubcategories()) {
353 if (migSubCat.getOldName() == null) {
355 boolean existSub = false;
356 for (SubCategoryDefinition subCatInDb : catInDB.getSubcategories()) {
357 if (subCatInDb.getName().equals(migSubCat.getName())) {
362 SubCategoryDefinition subcat = new SubCategoryDefinition(migSubCat);
364 Either<SubCategoryDefinition, ActionStatus> resultSubcat = elementOperation.createSubCategory((String) categoryData.getUniqueId(), subcat, NodeTypeEnum.ResourceSubcategory, true);
365 if (resultSubcat.isRight()) {
366 log.debug("Failed to create resource sub category {} error {}", subcat, resultSubcat.right().value());
369 log.debug("resource sub category {} created for category {}", categoryData, resultSubcat.left().value().getName());
372 if (updateSingleSubCategory(newCat, migSubCat, updateSingleResult.left().value()) == false) {
385 private boolean updateSingleSubCategory(MigrationCategory newCat, MigrationSubCategory migSubCat, CategoryData categoryData) {
387 Either<List<ImmutablePair<SubCategoryData, GraphEdge>>, TitanOperationStatus> subcategories = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceNewCategory), (String) categoryData.getUniqueId(),
388 GraphEdgeLabels.SUB_CATEGORY, NodeTypeEnum.ResourceSubcategory, SubCategoryData.class);
390 if (subcategories.isRight()) {
391 log.debug("Failed to get resource sub categories, for name {} error {}", newCat.getOldName(), subcategories.right().value());
395 for (ImmutablePair<SubCategoryData, GraphEdge> pair : subcategories.left().value()) {
396 if (pair.getKey().getSubCategoryDataDefinition().getName().equals(migSubCat.getOldName())) {
397 SubCategoryData subCategoryData = pair.getKey();
398 subCategoryData.getSubCategoryDataDefinition().setName(migSubCat.getName());
399 subCategoryData.getSubCategoryDataDefinition().setIcons(migSubCat.getIcons());
400 subCategoryData.getSubCategoryDataDefinition().setNormalizedName(ValidationUtils.normalizeCategoryName4Uniqueness(migSubCat.getName()));
401 Either<SubCategoryData, TitanOperationStatus> updateSubNode = titanGenericDao.updateNode(subCategoryData, SubCategoryData.class);
402 if (updateSubNode.isRight()) {
403 log.debug("Failed to update resource sub category {} error {}", subCategoryData, updateSubNode.right().value());
406 log.debug("Update resource subcategory category {} ", subCategoryData);
413 private Map<String, List<MigrationCategory>> createCategoriesFromYml(String categoriesTypesYml) {
416 yamlAsString = new String(readAllBytes(get(categoriesTypesYml)));
417 } catch (Exception e) {
418 log.debug("Failed to load category import file exception : ", e);
422 log.debug("received yaml: {}", yamlAsString);
424 Map<String, Object> toscaJson = (Map<String, Object>) new Yaml().load(yamlAsString);
425 Map<String, List<MigrationCategory>> allCategories = new HashMap<>();
427 Iterator<Entry<String, Object>> categoryEntryItr = toscaJson.entrySet().iterator();
428 while (categoryEntryItr.hasNext()) {
429 Entry<String, Object> categoryTypeEntry = categoryEntryItr.next();
430 String categoryType = categoryTypeEntry.getKey();
431 List<MigrationCategory> categoriesPerType = null;
432 Map<String, Object> categoryPerType = null;
433 switch (categoryType) {
434 case ComponentTypeEnum.SERVICE_PARAM_NAME:
435 categoryPerType = (Map<String, Object>) categoryTypeEntry.getValue();
436 categoriesPerType = createServiceCategories(categoryPerType);
438 case ComponentTypeEnum.RESOURCE_PARAM_NAME:
439 categoryPerType = (Map<String, Object>) categoryTypeEntry.getValue();
440 categoriesPerType = createResourceCategories(categoryPerType);
442 case ComponentTypeEnum.PRODUCT_PARAM_NAME:
446 log.debug("Not supported category type - {}", categoryType);
449 if (categoriesPerType != null) {
450 allCategories.put(categoryType, categoriesPerType);
453 return allCategories;
456 private List<MigrationCategory> createServiceCategories(Map<String, Object> categories) {
457 List<MigrationCategory> categroiesDef = new ArrayList<>();
458 String catName = null;
459 List<String> icons = null;
460 String oldName = null;
461 for (Entry<String, Object> entry : categories.entrySet()) {
462 MigrationCategory catDef = new MigrationCategory();
463 Map<String, Object> category = (Map<String, Object>) entry.getValue();
464 catName = (String) category.get("name");
465 catDef.setName(catName);
466 icons = (List<String>) category.get("icons");
467 catDef.setIcons(icons);
468 String normalizedName = ValidationUtils.normalizeCategoryName4Uniqueness(catName);
469 catDef.setNormalizedName(normalizedName);
470 oldName = (String) category.get("oldName");
471 catDef.setOldName(oldName);
472 categroiesDef.add(catDef);
475 return categroiesDef;
478 private List<MigrationCategory> createResourceCategories(Map<String, Object> categoryPerType) {
479 List<MigrationCategory> categroiesDef = new ArrayList<>();
480 for (Map.Entry<String, Object> entry : categoryPerType.entrySet()) {
481 Map<String, Object> category = (Map<String, Object>) entry.getValue();
482 MigrationCategory catDef = new MigrationCategory();
483 String catName = (String) category.get("name");
484 catDef.setName(catName);
485 String normalizedName = ValidationUtils.normalizeCategoryName4Uniqueness(catName);
486 catDef.setNormalizedName(normalizedName);
487 String oldName = (String) category.get("oldName");
488 catDef.setOldName(oldName);
490 Map<String, Object> subcategories = (Map<String, Object>) category.get("subcategories");
491 List<MigrationSubCategory> subcateDef = new ArrayList<>();
492 for (Entry<String, Object> subcategory : subcategories.entrySet()) {
493 Map<String, Object> subcategoryInfo = (Map<String, Object>) subcategory.getValue();
494 MigrationSubCategory subDef = new MigrationSubCategory();
495 String subcategoryName = (String) subcategoryInfo.get("name");
496 subDef.setName(subcategoryName);
497 List<String> subcategoryIcons = (List<String>) subcategoryInfo.get("icons");
498 subDef.setIcons(subcategoryIcons);
499 normalizedName = ValidationUtils.normalizeCategoryName4Uniqueness(subcategoryName);
500 subDef.setNormalizedName(normalizedName);
501 oldName = (String) subcategoryInfo.get("oldName");
502 subDef.setOldName(oldName);
504 subcateDef.add(subDef);
507 catDef.setSubcategories(subcateDef);
508 categroiesDef.add(catDef);
510 return categroiesDef;
513 private boolean updateCalculatedEdges() {
514 log.debug("update calculated edges STARTED");
516 Either<List<ComponentInstanceData>, TitanOperationStatus> allInstances = titanGenericDao.getByCriteria(NodeTypeEnum.ResourceInstance, null, ComponentInstanceData.class);
517 if (allInstances.isRight() && !allInstances.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
518 log.debug("updateCalculatedEdges failed fetch all resource instances ,error " + allInstances.right().value());
521 if (allInstances.isRight() && allInstances.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
522 log.debug("updateCalculatedEdges - no VFs");
525 List<ComponentInstanceData> listOfInstances = allInstances.left().value();
526 for (ComponentInstanceData instance : listOfInstances) {
527 // check if already have calculated edges
528 log.debug("start handle instance {}", instance.getUniqueId());
529 boolean needProcess = true;
530 Either<List<ImmutablePair<CapabilityData, GraphEdge>>, TitanOperationStatus> vfci = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), instance.getUniqueId(),
531 GraphEdgeLabels.CALCULATED_CAPABILITY, NodeTypeEnum.Capability, CapabilityData.class);
532 if (vfci.isRight()) {
533 if (!vfci.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
534 log.debug("createCalculatedCapabilitiesForInstance failed to fetch instance for resource " + instance.getComponentInstDataDefinition().getComponentUid() + " error " + vfci.right().value());
538 if (vfci.left().value().size() > 0) {
542 Either<List<ImmutablePair<RequirementData, GraphEdge>>, TitanOperationStatus> vfciReq = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), instance.getUniqueId(),
543 GraphEdgeLabels.CALCULATED_REQUIREMENT, NodeTypeEnum.Requirement, RequirementData.class);
544 if (vfciReq.isRight()) {
545 if (!vfciReq.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
546 log.debug("createCalculatedCapabilitiesForInstance failed to fetch instance for resource " + instance.getComponentInstDataDefinition().getComponentUid() + " error " + vfciReq.right().value());
550 if (vfciReq.left().value().size() > 0) {
554 Either<List<ImmutablePair<RequirementData, GraphEdge>>, TitanOperationStatus> vfciReqFF = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), instance.getUniqueId(),
555 GraphEdgeLabels.CALCULATED_REQUIREMENT_FULLFILLED, NodeTypeEnum.Requirement, RequirementData.class);
556 if (vfciReqFF.isRight()) {
558 if (!vfciReqFF.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
559 log.debug("createCalculatedCapabilitiesForInstance failed to fetch instance for resource " + instance.getComponentInstDataDefinition().getComponentUid() + " error " + vfciReqFF.right().value());
563 if (vfciReqFF.left().value().size() > 0) {
568 if (needProcess == false) {
569 log.debug("updateCalculatedEdges : for instance {} calculated capabilty/requirement already created", instance.getUniqueId());
572 String originId = instance.getComponentInstDataDefinition().getComponentUid();
573 Either<Resource, StorageOperationStatus> resourceE = resourceOperation.getResource(originId, true);
574 if (resourceE.isRight()) {
575 log.debug("updateCalculatedEdges failed to fetch origin resource with id {} error {}", originId, resourceE.right().value());
578 Resource resource = resourceE.left().value();
579 Map<String, List<RequirementDefinition>> requirements = resource.getRequirements();
580 if (createCalculatedRequirementsForInstance(instance, requirements) != true) {
583 Map<String, List<CapabilityDefinition>> capabilities = resource.getCapabilities();
584 if (createCalculatedCapabilitiesForInstance(instance, capabilities) != true) {
587 log.debug("finish handle instance {}", instance.getUniqueId());
589 log.debug("update calculated edges ENDED");
593 private boolean createCalculatedCapabilitiesForInstance(ComponentInstanceData instance, Map<String, List<CapabilityDefinition>> capabilities) {
594 for (Map.Entry<String, List<CapabilityDefinition>> entry : capabilities.entrySet()) {
595 for (CapabilityDefinition capability : entry.getValue()) {
596 Either<CapabilityData, TitanOperationStatus> capNode = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Capability), capability.getUniqueId(), CapabilityData.class);
597 if (capNode.isRight()) {
598 log.debug("createCalculatedCapabilitiesForInstance failed to fetch capability node with id " + capability.getUniqueId() + " error " + capNode.right().value());
601 Map<String, Object> props = new HashMap<>();
602 props.put(GraphEdgePropertiesDictionary.NAME.getProperty(), capability.getName());
603 if (fillEdgeProperties(instance, props) != true) {
607 Either<GraphRelation, TitanOperationStatus> createRelation = titanGenericDao.createRelation(instance, capNode.left().value(), GraphEdgeLabels.CALCULATED_CAPABILITY, props);
608 if (createRelation.isRight()) {
609 TitanOperationStatus titanOperationStatus = createRelation.right().value();
610 log.debug("Failed to create calculated requirement from component instance {} to requirement {}, error: {}", instance.getUniqueId(), capNode.left().value().getUniqueId(), titanOperationStatus);
613 log.debug("CALCULATED_CAPABILITY was created from {} to {} with props : {}", capNode.left().value().getUniqueId(), instance.getUniqueId(), props);
619 private boolean fillEdgeProperties(ComponentInstanceData instance, Map<String, Object> props) {
620 if (instance.getComponentInstDataDefinition().getOriginType().equals(OriginTypeEnum.VF)) {
621 Either<List<ImmutablePair<ComponentInstanceData, GraphEdge>>, TitanOperationStatus> vfci = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource),
622 instance.getComponentInstDataDefinition().getComponentUid(), GraphEdgeLabels.RESOURCE_INST, NodeTypeEnum.ResourceInstance, ComponentInstanceData.class);
623 if (vfci.isRight()) {
624 log.debug("createCalculatedCapabilitiesForInstance failed to fetch instance for resource " + instance.getComponentInstDataDefinition().getComponentUid() + " error " + vfci.right().value());
627 ImmutablePair<ComponentInstanceData, GraphEdge> immutablePair = vfci.left().value().get(0);
628 String vfciId = immutablePair.getLeft().getUniqueId();
629 props.put(GraphEdgePropertiesDictionary.OWNER_ID.getProperty(), vfciId);
630 props.put(GraphEdgePropertiesDictionary.SOURCE.getProperty(), immutablePair.getLeft().getComponentInstDataDefinition().getComponentUid());
633 props.put(GraphEdgePropertiesDictionary.OWNER_ID.getProperty(), instance.getUniqueId());
634 props.put(GraphEdgePropertiesDictionary.SOURCE.getProperty(), instance.getComponentInstDataDefinition().getComponentUid());
639 private boolean createCalculatedRequirementsForInstance(ComponentInstanceData instance, Map<String, List<RequirementDefinition>> requirements) {
640 for (Map.Entry<String, List<RequirementDefinition>> entry : requirements.entrySet()) {
641 for (RequirementDefinition requirement : entry.getValue()) {
642 Either<RequirementData, TitanOperationStatus> reqNode = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Requirement), requirement.getUniqueId(), RequirementData.class);
643 if (reqNode.isRight()) {
644 log.debug("updateCalculatedEdges failed to fetch requirement node with id " + requirement.getUniqueId() + " error " + reqNode.right().value());
647 Map<String, Object> props = new HashMap<>();
648 props.put(GraphEdgePropertiesDictionary.NAME.getProperty(), requirement.getName());
650 if (fillEdgeProperties(instance, props) != true) {
654 Either<GraphRelation, TitanOperationStatus> createRelation = titanGenericDao.createRelation(instance, reqNode.left().value(), GraphEdgeLabels.CALCULATED_REQUIREMENT, props);
655 if (createRelation.isRight()) {
656 TitanOperationStatus titanOperationStatus = createRelation.right().value();
657 log.debug("Failed to create calculated requirement from component instance {} to requirement {}, error: {}", instance.getUniqueId(), reqNode.left().value().getUniqueId(), titanOperationStatus);
660 log.debug("CALCULATED_REQUIREMENT was created from {} to {} with props : {}", reqNode.left().value().getUniqueId(), instance.getUniqueId(), props);
666 private boolean updateRelations() {
667 log.debug("update relations and edges STARTED");
668 Either<List<RelationshipInstData>, TitanOperationStatus> allRelations = titanGenericDao.getByCriteria(NodeTypeEnum.RelationshipInst, null, RelationshipInstData.class);
669 if (allRelations.isRight()) {
670 if (allRelations.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
671 log.debug("updateRelations : No relations to update. updateRelations ENDED");
674 log.debug("updateRelations : failed to fetch all relation nodes , error ", allRelations.right().value());
677 for (RelationshipInstData rel : allRelations.left().value()) {
679 if (rel.getCapabilityOwnerId() != null && rel.getRequirementOwnerId() != null) {
680 log.debug("updateRelations : for relation {} all fields alredy fixed -> {}", rel.getUniqueId(), rel);
683 // update capability parameters
684 if (updateCapabiltyFieldsInRelation(rel) != true) {
688 // update requirement parameters and set calculated edge to full
690 if (updateRequirementFieldsInRelation(rel) != true) {
694 Either<RelationshipInstData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(rel, RelationshipInstData.class);
695 if (updateNode.isRight()) {
696 log.debug("updateRelations : failed to update relation node with id {} , error {}", rel.getUniqueId(), updateNode.right().value());
699 log.debug("Relations was updated with values {}", rel);
701 log.debug("update relations and edges ENDED");
705 private boolean updateRequirementFieldsInRelation(RelationshipInstData rel) {
706 Either<ImmutablePair<ComponentInstanceData, GraphEdge>, TitanOperationStatus> reqInst = titanGenericDao.getParentNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.RelationshipInst), rel.getUniqueId(), GraphEdgeLabels.RELATIONSHIP_INST,
707 NodeTypeEnum.ResourceInstance, ComponentInstanceData.class);
708 if (reqInst.isRight()) {
709 log.debug("updateRelations : failed to fetch capability component instance for relation {}, error {}", rel.getUniqueId(), reqInst.right().value());
712 ComponentInstanceData requirementInstanceData = reqInst.left().value().getLeft();
713 ComponentInstanceDataDefinition reqRI = requirementInstanceData.getComponentInstDataDefinition();
714 if (reqRI.getOriginType().equals(OriginTypeEnum.VF)) {
715 Either<ImmutablePair<ComponentInstanceData, GraphEdge>, TitanOperationStatus> vfcInstInOrigVf = titanGenericDao.getChildByEdgeCriteria(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), reqRI.getComponentUid(),
716 GraphEdgeLabels.RESOURCE_INST, NodeTypeEnum.ResourceInstance, ComponentInstanceData.class, null);
717 if (vfcInstInOrigVf.isRight()) {
718 log.debug("updateRelations : failed to fetch VFC instance in origin VF with id " + reqRI.getComponentUid() + ", error ", vfcInstInOrigVf.right().value());
721 rel.setRequirementOwnerId(vfcInstInOrigVf.left().value().getLeft().getUniqueId());
723 rel.setRequirementOwnerId(reqRI.getUniqueId());
726 Either<TitanVertex, TitanOperationStatus> vertexReqRI = titanGenericDao.getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), requirementInstanceData.getUniqueId());
727 if (vertexReqRI.isRight()) {
728 log.debug("updateRelations : failed to fetch veterx for instance {}, error {}", requirementInstanceData.getUniqueId(), vertexReqRI.right().value());
731 String[] splitIds = rel.getUniqueId().split("\\.");
732 String reqName = splitIds[splitIds.length - 1];
733 Map<String, Object> props = new HashMap<>();
734 props.put(GraphEdgePropertiesDictionary.NAME.getProperty(), reqName);
735 Either<List<Edge>, TitanOperationStatus> edgesForNode = titanGenericDao.getOutgoingEdgesByCriteria(vertexReqRI.left().value(), GraphEdgeLabels.CALCULATED_REQUIREMENT, props);
736 if (edgesForNode.isRight()) {
737 log.debug("updateRelations : failed to fetch edges for instance {} error {}", requirementInstanceData.getUniqueId(), edgesForNode.right().value());
740 Edge edge = edgesForNode.left().value().get(0);
741 String reqId = (String) titanGenericDao.getProperty((TitanVertex) edge.inVertex(), GraphPropertiesDictionary.UNIQUE_ID.getProperty());
742 rel.setRequirementId(reqId);
745 TitanEdge newEdge = (TitanEdge) vertexReqRI.left().value().addEdge(GraphEdgeLabels.CALCULATED_REQUIREMENT_FULLFILLED.getProperty(), edge.inVertex());
746 titanGenericDao.setProperties(newEdge, titanGenericDao.getProperties(edge));
749 log.debug("Edge was changed to CALCULATED_REQUIREMENT_FULLFILLED for relation between {} and {}", reqId, requirementInstanceData.getUniqueId());
754 public boolean updateCapabiltyFieldsInRelation(RelationshipInstData rel) {
755 // update capability parameters
756 Either<ImmutablePair<ComponentInstanceData, GraphEdge>, TitanOperationStatus> capInst = titanGenericDao.getChildByEdgeCriteria(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.RelationshipInst), rel.getUniqueId(),
757 GraphEdgeLabels.CAPABILITY_NODE, NodeTypeEnum.ResourceInstance, ComponentInstanceData.class, null);
758 if (capInst.isRight()) {
759 log.debug("updateRelations : failed to fetch capabilty component instance for relation {}, error {}", rel.getUniqueId(), capInst.right().value());
762 ComponentInstanceData capabiltyInstanceData = capInst.left().value().getLeft();
763 ComponentInstanceDataDefinition capRI = capabiltyInstanceData.getComponentInstDataDefinition();
764 if (capRI.getOriginType().equals(OriginTypeEnum.VF)) {
765 Either<ImmutablePair<ComponentInstanceData, GraphEdge>, TitanOperationStatus> vfcInstInOrigVf = titanGenericDao.getChildByEdgeCriteria(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), capRI.getComponentUid(),
766 GraphEdgeLabels.RESOURCE_INST, NodeTypeEnum.ResourceInstance, ComponentInstanceData.class, null);
767 if (vfcInstInOrigVf.isRight()) {
768 log.debug("updateRelations : failed to fetch VFC instance in origin VF with id " + capRI.getComponentUid() + ", error ", vfcInstInOrigVf.right().value());
771 rel.setCapabilityOwnerId(vfcInstInOrigVf.left().value().getLeft().getUniqueId());
773 rel.setCapabilityOwnerId(capRI.getUniqueId());
777 Either<TitanVertex, TitanOperationStatus> vertexCapRI = titanGenericDao.getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceInstance), capabiltyInstanceData.getUniqueId());
778 if (vertexCapRI.isRight()) {
779 log.debug("updateRelations : failed to fetch veterx for instance {} , error {}", capabiltyInstanceData.getUniqueId(), vertexCapRI.right().value());
782 // String[] splitIds = rel.getUniqueId().split("\\.");
783 String capName = (String) capInst.left().value().getRight().getProperties().get(GraphEdgePropertiesDictionary.NAME.getProperty());// splitIds[splitIds.length
785 Map<String, Object> props = new HashMap<>();
786 props.put(GraphEdgePropertiesDictionary.NAME.getProperty(), capName);
787 Either<List<Edge>, TitanOperationStatus> edgesForNode = titanGenericDao.getOutgoingEdgesByCriteria(vertexCapRI.left().value(), GraphEdgeLabels.CALCULATED_CAPABILITY, props);
788 if (edgesForNode.isRight()) {
789 log.debug("updateRelations : failed to fetch edges for instance {} , error {}", capabiltyInstanceData.getUniqueId(), edgesForNode.right().value());
792 Edge edge = edgesForNode.left().value().get(0);
793 String capId = (String) titanGenericDao.getProperty((TitanVertex) edge.inVertex(), GraphPropertiesDictionary.UNIQUE_ID.getProperty());
794 rel.setCapabiltyId(capId);
799 private Either<List<String>, StorageOperationStatus> handleVfGroup(ResourceMetadataData metadata) {
800 Map<String, Object> props = new HashMap<String, Object>();
801 props.put(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty(), ResourceTypeEnum.VF.name());
802 props.put(GraphPropertiesDictionary.NAME.getProperty(), metadata.getMetadataDataDefinition().getName());
804 List<String> finished = new ArrayList<>();
806 Either<List<ResourceMetadataData>, TitanOperationStatus> allVFByName = titanGenericDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
807 if (allVFByName.isRight()) {
808 log.debug("fixDerivedFv failed fetch all VF resources,error {}", allVFByName.right().value());
809 return Either.right(StorageOperationStatus.GENERAL_ERROR);
811 Set<String> nonDuplicatedId = new HashSet<>();
812 String uuid10 = null;
813 for (ResourceMetadataData mdata : allVFByName.left().value()) {
814 String version = mdata.getMetadataDataDefinition().getVersion();
815 if (version.equals("1.0")) {
816 uuid10 = mdata.getMetadataDataDefinition().getUUID();
819 nonDuplicatedId.add((String) mdata.getUniqueId());
821 if (uuid10 == null) {
822 uuid10 = allVFByName.left().value().get(0).getMetadataDataDefinition().getUUID();
824 props.put(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty(), ResourceTypeEnum.VF.name());
825 props.put(GraphPropertiesDictionary.UUID.getProperty(), uuid10);
827 Either<List<ResourceMetadataData>, TitanOperationStatus> allVFByUUID = titanGenericDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
828 if (allVFByUUID.isRight()) {
829 log.debug("fixDerivedFv failed fetch all VF resources by UUID {} ,error {}", uuid10, allVFByUUID.right().value());
830 return Either.right(StorageOperationStatus.GENERAL_ERROR);
832 for (ResourceMetadataData mdata : allVFByUUID.left().value()) {
833 nonDuplicatedId.add((String) mdata.getUniqueId());
835 Either<TitanGraph, TitanOperationStatus> graph = titanGenericDao.getGraph();
836 if (graph.isRight()) {
837 log.debug("fixDerivedFv failed - No titan graph ,error {}", graph.right().value());
838 return Either.right(StorageOperationStatus.GENERAL_ERROR);
840 // Map<String, String> derivedMapping = new HashMap<>();
841 for (String resourceId : nonDuplicatedId) {
842 // StorageOperationStatus handleSingleVfResult =
843 // handleSingleVf(finished, derivedMapping, resourceId);
844 StorageOperationStatus handleSingleVfResult = handleSingleVf(finished, resourceId);
845 if (!handleSingleVfResult.equals(StorageOperationStatus.OK)) {
846 log.debug("fixDerivedFv failed - handleSingleVfResult failed for resource {} ,error {}", resourceId, handleSingleVfResult);
847 return Either.right(StorageOperationStatus.GENERAL_ERROR);
850 return Either.left(finished);
853 // private StorageOperationStatus handleSingleVf(List<String> finished,
854 // Map<String, String> derivedMapping, String resourceId) {
855 private StorageOperationStatus handleSingleVf(List<String> finished, String resourceId) {
856 Either<TitanVertex, TitanOperationStatus> vertexByProperty = titanGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), resourceId);
857 if (vertexByProperty.isRight()) {
858 log.debug("fixDerivedFv failed to fetch resource by id {} ,error {}", resourceId, vertexByProperty.right().value());
859 return StorageOperationStatus.GENERAL_ERROR;
861 Vertex vertexR = vertexByProperty.left().value();
862 Iterator<Vertex> vertexDIter = vertexR.vertices(Direction.OUT, GraphEdgeLabels.DERIVED_FROM.getProperty());
863 if (vertexDIter != null && vertexDIter.hasNext()) {
866 TitanVertex vertexD = (TitanVertex) vertexDIter.next();
867 String idDerived = (String) titanGenericDao.getProperty(vertexD, GraphPropertiesDictionary.UNIQUE_ID.getProperty());
869 // TODO clone resource
871 // TODO add instance of new resource to VF
873 // add to vf instance of vfc
874 finished.add(resourceId);
876 log.debug("No derived edges for resource id {}", resourceId);
878 return StorageOperationStatus.OK;
881 private boolean updateComponentInstanceType() {
882 log.debug("update component instances type STARTED");
883 Either<List<ComponentInstanceData>, TitanOperationStatus> allInstances = titanGenericDao.getByCriteria(NodeTypeEnum.ResourceInstance, null, ComponentInstanceData.class);
884 if (allInstances.isRight()) {
885 if (allInstances.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
886 log.debug("updateComponentInstanceType: no instances ti update ");
889 log.debug("updateComponentInstanceType failed fetch all resource instances ,error " + allInstances.right().value());
893 List<ComponentInstanceData> listOfInstances = allInstances.left().value();
894 for (ComponentInstanceData instance : listOfInstances) {
895 String originId = instance.getComponentInstDataDefinition().getComponentUid();
896 Either<ComponentMetadataData, TitanOperationStatus> nodeResource = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), originId, ComponentMetadataData.class);
897 if (nodeResource.isRight()) {
898 log.debug("updateComponentInstanceType failed to fetch origin resource with id {} error {}", originId, nodeResource.right().value());
901 ResourceTypeEnum resourceType = ((ResourceMetadataDataDefinition) nodeResource.left().value().getMetadataDataDefinition()).getResourceType();
902 if (resourceType == null) {
903 log.debug("updateComponentInstanceType failed, no resource type for origin resource with id " + originId);
906 OriginTypeEnum originType;
907 switch (resourceType) {
909 originType = OriginTypeEnum.VF;
912 originType = OriginTypeEnum.VFC;
915 originType = OriginTypeEnum.VL;
918 originType = OriginTypeEnum.CP;
921 originType = OriginTypeEnum.CVFC;
924 log.debug("updateComponentInstanceType failed, no supported resource type {} for origin resource with id {}", resourceType, originId);
927 instance.getComponentInstDataDefinition().setOriginType(originType);
929 Either<ComponentInstanceData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(instance, ComponentInstanceData.class);
930 if (updateNode.isRight()) {
931 log.debug("updateComponentInstanceType failed, failed to update component instance node with id " + instance.getUniqueId() + " error " + updateNode.right().value());
934 log.debug("For instance with id {} the origin type was detected as {}", instance.getUniqueId(), originType);
936 log.debug("update component instances type ENDED");
940 private boolean addResourceCounterToResources() {
942 Either<List<ResourceMetadataData>, TitanOperationStatus> allResources = titanGenericDao.getByCriteria(NodeTypeEnum.Resource, null, ResourceMetadataData.class);
943 if (allResources.isRight()) {
944 if (allResources.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
945 log.debug("addResourceCounterToResources - no resources");
948 log.debug("addResourceCounterToResources failed fetch all resources,error {}", allResources.right().value());
951 for (ResourceMetadataData resource : allResources.left().value()) {
952 Either<TitanVertex, TitanOperationStatus> vertexByProperty = titanGenericDao.getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), resource.getUniqueId());
953 if (vertexByProperty.isRight()) {
954 log.error("failed to add instanceCounter to VF {} . error is: {}", resource.getUniqueId(), vertexByProperty.right().value().name());
957 Vertex vfVertex = vertexByProperty.left().value();
958 if (!vfVertex.property(GraphPropertiesDictionary.INSTANCE_COUNTER.getProperty()).isPresent()) {
959 vfVertex.property(GraphPropertiesDictionary.INSTANCE_COUNTER.getProperty(), 0);
965 private boolean fixDerivedVf() {
967 Map<String, Object> props = new HashMap<String, Object>();
968 props.put(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty(), ResourceTypeEnum.VF.name());
969 Either<List<ResourceMetadataData>, TitanOperationStatus> allVF = titanGenericDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
970 if (allVF.isRight()) {
971 if (allVF.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
972 log.debug("fixDerivedVf - no VFs");
975 log.debug("fixDerivedFv failed fetch all VF resources,error {}", allVF.right().value());
979 Map<String, String> vfUuidToVfcUuid = new HashMap<String, String>();
980 for (ResourceMetadataData metadata : allVF.left().value()) {
981 Either<Resource, StorageOperationStatus> eitherResource = resourceOperation.getResource(metadata.getMetadataDataDefinition().getUniqueId(), true);
982 if (eitherResource.isRight()) {
983 log.error("failed to migrate VF {} from version 1602 to version 1604. error is: {}", metadata.getMetadataDataDefinition().getUniqueId(), eitherResource.right().value().name());
986 Resource vfResource = eitherResource.left().value();
987 if (vfResource.getDerivedFrom() == null || vfResource.getDerivedFrom().isEmpty()) {
990 Boolean isVfDeleted = vfResource.getIsDeleted();
991 String vfUUID = vfResource.getUUID();
992 String vfcUUID = vfUuidToVfcUuid.getOrDefault(vfUUID, null);
993 if (vfcUUID == null) {
994 vfcUUID = UUID.randomUUID().toString();
995 vfUuidToVfcUuid.put(vfUUID, vfcUUID);
999 String vfUniqueId = vfResource.getUniqueId();
1000 LifecycleStateEnum vfcTargetState = vfResource.getLifecycleState();
1001 if (vfcTargetState.equals(LifecycleStateEnum.READY_FOR_CERTIFICATION) || vfcTargetState.equals(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS)) {
1002 User user = new User();
1003 user.setUserId(vfResource.getLastUpdaterUserId());
1004 Either<? extends Component, StorageOperationStatus> checkinComponent = lifecycleOperaion.checkinComponent(NodeTypeEnum.Resource, vfResource, user, user, true);
1005 if (checkinComponent.isRight()) {
1006 log.error("failed to checkin VF {}. error={}", vfUniqueId, checkinComponent.right().value().name());
1009 } else if (vfcTargetState.equals(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT)) {
1010 vfcTargetState = LifecycleStateEnum.NOT_CERTIFIED_CHECKIN;
1013 // delete VF Properties
1014 List<PropertyDefinition> properties = vfResource.getProperties();
1015 if (properties != null && !properties.isEmpty()) {
1016 Either<Map<String, PropertyDefinition>, StorageOperationStatus> deleteAllProperties = propertyOperation.deleteAllPropertiesAssociatedToNode(NodeTypeEnum.Resource, vfUniqueId);
1017 if (deleteAllProperties.isRight() && !deleteAllProperties.right().value().equals(StorageOperationStatus.NOT_FOUND) && !deleteAllProperties.right().value().equals(StorageOperationStatus.OK)) {
1018 log.error("failed to delete properties of VF {} . error is: {}", metadata.getMetadataDataDefinition().getUniqueId(), deleteAllProperties.right().value().name());
1022 // delete VF Additional Info
1023 List<AdditionalInformationDefinition> additionalInformation = vfResource.getAdditionalInformation();
1024 if (additionalInformation != null && !additionalInformation.isEmpty()) {
1025 Either<AdditionalInformationDefinition, StorageOperationStatus> deleteAllAdditionalInformationParameters = additionalInformationOperation.deleteAllAdditionalInformationParameters(NodeTypeEnum.Resource, vfUniqueId, true);
1026 if (deleteAllAdditionalInformationParameters.isRight() && !deleteAllAdditionalInformationParameters.right().value().equals(StorageOperationStatus.OK)
1027 && !deleteAllAdditionalInformationParameters.right().value().equals(StorageOperationStatus.NOT_FOUND)) {
1028 log.error("failed to delete properties of VF {} . error is: {}", metadata.getMetadataDataDefinition().getUniqueId(), deleteAllAdditionalInformationParameters.right().value().name());
1032 // delete VF derivedFrom
1033 GraphRelation derivedFromRelation = new GraphRelation(GraphEdgeLabels.DERIVED_FROM.getProperty());
1034 derivedFromRelation.setFrom(new RelationEndPoint(NodeTypeEnum.Resource, UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), vfUniqueId));
1035 Either<GraphRelation, TitanOperationStatus> deleteDerivedFromRelation = titanGenericDao.deleteOutgoingRelation(derivedFromRelation);
1036 if (deleteDerivedFromRelation.isRight()) {
1037 log.error("failed to delete derivedFrom relation of VF {} . error is: {}", metadata.getMetadataDataDefinition().getUniqueId(), deleteDerivedFromRelation.right().value().name());
1042 Either<Resource, StorageOperationStatus> createVFC = createVFC(metadata, vfResource, vfcUUID, vfcTargetState);
1043 if (createVFC.isRight()) {
1044 log.error("failed to split VF {} to VFC. error is: {}", metadata.getMetadataDataDefinition().getUniqueId(), createVFC.right().value().name());
1047 Resource vfcResource = createVFC.left().value();
1048 if (!createVfcInstanceOnVf(vfcResource, vfUniqueId)) {
1051 // update VFC to deleted if required
1052 if (isVfDeleted != null && isVfDeleted) {
1053 Either<Component, StorageOperationStatus> markResourceToDelete = resourceOperation.markComponentToDelete(vfcResource, true);
1054 if (markResourceToDelete.isRight()) {
1055 log.error("failed to mark isDeleted on VFC {} . error is: {}", vfcResource.getUniqueId(), markResourceToDelete.right().value().name());
1064 private Either<Resource, StorageOperationStatus> createVFC(ResourceMetadataData metadata, Resource vfcResource, String uuid, LifecycleStateEnum vfcTargetState) {
1066 Boolean highestVersion = vfcResource.isHighestVersion();
1067 // Resource vfcResource = new Resource((ResourceMetadataDefinition)
1068 // vfResource.getComponentMetadataDefinition());
1069 // String componentName = vfcResource.getName()+"VFC";
1070 // vfcResource.setName(componentName);
1071 // vfcResource.setNormalizedName(ValidationUtils.normaliseComponentName(componentName));
1072 // vfcResource.setSystemName(ValidationUtils.convertToSystemName(componentName));
1073 vfcResource.setUniqueId(null);
1074 vfcResource.setUUID(uuid);
1075 vfcResource.setAllVersions(null);
1076 vfcResource.setArtifacts(null);
1077 vfcResource.setDeploymentArtifacts(null);
1078 vfcResource.setComponentInstances(null);
1079 vfcResource.setComponentInstancesProperties(null);
1080 vfcResource.setComponentInstancesRelations(null);
1081 vfcResource.setResourceType(ResourceTypeEnum.VFC);
1082 vfcResource.setIsDeleted(false);
1084 vfcResource.setLifecycleState(vfcTargetState);
1085 // vfcResource.setDerivedFrom(vfResource.getDerivedFrom());
1086 // vfcResource.setProperties(vfResource.getProperties());
1087 // vfcResource.setAdditionalInformation(vfResource.getAdditionalInformation());
1088 // vfcResource.setCategories(vfResource.getCategories());
1089 // vfcResource.setTags(vfResource.getTags());
1091 Either<Resource, StorageOperationStatus> createResource = resourceOperation.createResource(vfcResource, true);
1092 if (createResource.isRight()) {
1093 return createResource;
1095 Resource afterCreateResource = createResource.left().value();
1096 Either<TitanVertex, TitanOperationStatus> vertexByProperty = titanGenericDao.getVertexByProperty(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Resource), afterCreateResource.getUniqueId());
1097 if (vertexByProperty.isRight()) {
1098 return createResource;
1100 Vertex newVfcVertex = vertexByProperty.left().value();
1101 newVfcVertex.property(GraphPropertiesDictionary.UUID.getProperty(), uuid);
1102 if (!highestVersion) {
1103 newVfcVertex.property(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), false);
1105 return createResource;
1108 private boolean createVfcInstanceOnVf(Resource vfcResource, String vfUniqueId) {
1109 // create VFC instance on VF
1110 ComponentInstance componentInstance = new ComponentInstance();
1111 componentInstance.setComponentUid(vfcResource.getUniqueId());
1112 componentInstance.setPosX("550");
1113 componentInstance.setPosY("300");
1114 componentInstance.setName(vfcResource.getName());
1115 componentInstance.setIcon(vfcResource.getIcon());
1116 componentInstance.setToscaComponentName(vfcResource.getToscaResourceName());
1117 Either<String, Boolean> handleNameLogic = handleNameLogic(componentInstance, vfUniqueId, vfcResource.getName());
1118 if (handleNameLogic.isRight()) {
1119 log.error("failed to create logical name for vfc instance");
1122 Either<ComponentInstance, StorageOperationStatus> createComponentInstance = componentInstanceOperaion.createComponentInstance(vfUniqueId, NodeTypeEnum.Resource, handleNameLogic.left().value(), componentInstance, NodeTypeEnum.Resource, true);
1124 if (createComponentInstance.isRight()) {
1125 log.error("failed to create vfc instance on vf {}. error: {}", vfUniqueId, createComponentInstance.right().value().name());
1131 private Either<String, Boolean> handleNameLogic(ComponentInstance componentInstance, String containerComponentId, String resourceName) {
1133 Either<Integer, StorageOperationStatus> componentInNumberStatus = resourceOperation.increaseAndGetComponentInstanceCounter(containerComponentId, true);
1135 if (componentInNumberStatus.isRight()) {
1136 log.debug("Failed to get component instance number for container component {} ", containerComponentId);
1137 return Either.right(false);
1139 String resourceInNumber = componentInNumberStatus.left().value().toString();
1140 componentInstance.setComponentName(resourceName);
1141 componentInstance.setName(resourceName);
1142 String logicalName = componentInstanceOperaion.createComponentInstLogicalName(resourceInNumber, resourceName);
1144 Boolean eitherValidation = validateComponentInstanceName(logicalName, componentInstance, true);
1145 if (!eitherValidation) {
1146 return Either.right(false);
1149 return Either.left(resourceInNumber);
1152 private Boolean validateComponentInstanceName(String resourceInstanceName, ComponentInstance resourceInstance, boolean isCreate) {
1154 if (!ValidationUtils.validateStringNotEmpty(resourceInstanceName)) {
1157 resourceInstance.setNormalizedName(ValidationUtils.normalizeComponentInstanceName(resourceInstanceName));
1159 if (!ValidationUtils.validateResourceInstanceNameLength(resourceInstanceName)) {
1162 if (!ValidationUtils.validateResourceInstanceName(resourceInstanceName)) {
1171 public boolean migrate1604to1607(String appConfigDir) {
1172 log.debug("Started the migration procedure from version 1604 to version 1607 ...");
1173 log.debug("Getting all resources with resources");
1174 boolean result = false;
1175 Either<Boolean, StorageOperationStatus> resourceEither = null;
1177 Either<List<ResourceMetadataData>, TitanOperationStatus> allResources = titanGenericDao.getByCriteria(NodeTypeEnum.Resource, null, ResourceMetadataData.class);
1178 if (allResources.isRight()) {
1179 log.error("Couldn't get resources from DB, error: {}", allResources.right().value());
1183 List<ResourceMetadataData> resourcesList = allResources.left().value();
1184 if (resourcesList == null) {
1185 log.error("Couldn't get resources from DB, no resources found");
1189 log.debug("Found {} resources", resourcesList.size());
1190 for (ResourceMetadataData resource : resourcesList) {
1191 String resourceName = resource.getMetadataDataDefinition().getName();
1192 log.debug("Checking resource {}", resourceName);
1193 if (isNormative(resourceName)) {
1194 resourceEither = changeNormativeTypeName(resource);
1195 if (resourceEither.isRight()) {
1196 log.error("DB error during name changing");
1201 if (((ResourceMetadataDataDefinition) resource.getMetadataDataDefinition()).getResourceType().name().equals("VF")) {
1202 resourceEither = setVfToscaResourceName(resource);
1203 if (resourceEither.isRight()) {
1204 log.error("DB error during tosca resource name setting");
1210 result = addInvariantUUIDs(appConfigDir);
1213 titanGenericDao.rollback();
1214 log.debug("**********************************************");
1215 log.debug("The migration procedure from version 1604 to version 1607 FAILED!!");
1216 log.debug("**********************************************");
1218 titanGenericDao.commit();
1219 log.debug("**********************************************");
1220 log.debug("The migration procedure from version 1604 to version 1607 ended successfully!");
1221 log.debug("**********************************************");
1228 private boolean addInvariantUUIDs(String appConfigDir) {
1229 log.debug("Started adding of InvariantUUID ...");
1230 log.debug("Getting all resources with highest version");
1232 Map<String, Object> props = new HashMap<>();
1233 props.put(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), true);
1235 List<ComponentMetadataData> fullComponentList = new ArrayList<ComponentMetadataData>();
1237 // getting resources
1238 Either<List<ResourceMetadataData>, TitanOperationStatus> allHighestVersionResources = titanGenericDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
1239 if (allHighestVersionResources.isRight()) {
1240 log.error("Couldn't get resources with highest version from DB, error: {}", allHighestVersionResources.right().value());
1243 List<ResourceMetadataData> allHighestVersionResourcesAL = allHighestVersionResources.left().value();
1244 if (allHighestVersionResourcesAL == null) {
1245 log.error("Couldn't get resources with highest version from DB, no resources found");
1248 log.debug("Found {} resources", allHighestVersionResourcesAL.size());
1249 fullComponentList.addAll(allHighestVersionResourcesAL);
1252 Either<List<ServiceMetadataData>, TitanOperationStatus> allHighestVersionServices = titanGenericDao.getByCriteria(NodeTypeEnum.Service, props, ServiceMetadataData.class);
1253 if (allHighestVersionServices.isRight()) {
1254 log.error("Couldn't get services with highest version from DB, error: {}", allHighestVersionServices.right().value());
1257 List<ServiceMetadataData> allHighestVersionServicesAL = allHighestVersionServices.left().value();
1258 if (allHighestVersionServicesAL == null) {
1259 log.error("Couldn't get services with highest version from DB, no services found");
1262 log.debug("Found {} services", allHighestVersionServicesAL.size());
1263 fullComponentList.addAll(allHighestVersionServicesAL);
1265 List<ComponentMetadataData> reducedComponentsAL = reduceHighestVersionResourcesList(fullComponentList);
1268 Either<List<ProductMetadataData>, TitanOperationStatus> allHighestVersionProducts = titanGenericDao.getByCriteria(NodeTypeEnum.Product, props, ProductMetadataData.class);
1269 if (allHighestVersionProducts.isRight()) {
1270 log.error("Couldn't get products with highest version from DB, error: {}", allHighestVersionProducts.right().value());
1273 List<ProductMetadataData> allHighestVersionProductsAL = allHighestVersionProducts.left().value();
1274 if (allHighestVersionProductsAL == null) {
1275 log.error("Couldn't get products with highest version from DB, no products found");
1278 log.debug("Found {} products", allHighestVersionProductsAL.size());
1280 List<ComponentMetadataData> fullProductList = new ArrayList<ComponentMetadataData>();
1281 fullProductList.addAll(allHighestVersionProductsAL);
1282 List<ComponentMetadataData> reducedProductAL = reduceHighestVersionResourcesList(fullProductList);
1284 for (ComponentMetadataData product : reducedProductAL) {
1285 if (!setProductInvariantUUIDIfExists((ProductMetadataData) product)) {
1289 reducedComponentsAL.addAll(reducedProductAL);
1291 log.debug("Reduced list of Highest Version Components contains {} components", reducedComponentsAL.size());
1292 for (ComponentMetadataData componentMetaData : reducedComponentsAL) {
1294 String invariantUUID = componentMetaData.getMetadataDataDefinition().getInvariantUUID();
1295 log.debug("old invariantUUID {}", invariantUUID);
1296 if (invariantUUID == null || invariantUUID.isEmpty()) {
1297 invariantUUID = UniqueIdBuilder.buildInvariantUUID();
1298 componentMetaData.getMetadataDataDefinition().setInvariantUUID(invariantUUID);
1300 log.debug("new invariantUUID {}", componentMetaData.getMetadataDataDefinition().getInvariantUUID());
1301 Either<ComponentMetadataData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(componentMetaData, ComponentMetadataData.class);
1302 if (updateNode.isRight()) {
1303 log.error("DB error during while updating component {}, error: {}", componentMetaData.getMetadataDataDefinition().getName(), updateNode.right().value());
1306 log.debug("updated invariantUUID {}", updateNode.left().value().getMetadataDataDefinition().getInvariantUUID());
1307 if (!isOnlyVersion(componentMetaData)) {
1308 ComponentOperation componentOperation = null;
1309 switch (NodeTypeEnum.getByName(componentMetaData.getLabel())) {
1311 componentOperation = resourceOperation;
1314 componentOperation = serviceOperation;
1317 componentOperation = productOperation;
1322 Either<Component, StorageOperationStatus> getComponentResult = componentOperation.getComponent((String) componentMetaData.getUniqueId(), true);
1323 if (getComponentResult.isRight()) {
1324 log.error("DB error during while getting component with uniqueID {}, error: {}", componentMetaData.getUniqueId(), getComponentResult.right().value());
1327 Component component = getComponentResult.left().value();
1328 if (component == null) {
1329 log.error("The component received from DB is empty");
1333 Map<String, String> allVersions = component.getAllVersions();
1334 log.debug("found {} versions for component {}", allVersions.size(), component.getName());
1335 Either<Boolean, StorageOperationStatus> resEither = updateAllVersions(allVersions, invariantUUID);
1336 if (resEither.isRight()) {
1337 log.error("DB error during invariantUUID adding");
1345 private boolean isOnlyVersion(ComponentMetadataData componentMetaData) {
1346 String version = componentMetaData.getMetadataDataDefinition().getVersion();
1347 if (version.equals("0.1"))
1352 private boolean setProductInvariantUUIDIfExists(ProductMetadataData product) {
1353 Either<TitanVertex, TitanOperationStatus> getVertexRes = titanGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), product.getUniqueId());
1354 if (getVertexRes.isRight()) {
1355 log.error("DB error during retrieving product vertex {}", product.getMetadataDataDefinition().getName());
1358 Vertex productVertex = getVertexRes.left().value();
1359 String invariantUUID = productVertex.value(GraphPropertiesDictionary.CONSTANT_UUID.getProperty());
1360 if (invariantUUID != null && !invariantUUID.isEmpty()) {
1361 product.getMetadataDataDefinition().setInvariantUUID(invariantUUID);
1366 private Either<Boolean, StorageOperationStatus> updateAllVersions(Map<String, String> allVersions, String invariantUUID) {
1368 if (allVersions != null) {
1369 for (String uniqueID : allVersions.values()) {
1370 Either<ComponentMetadataData, TitanOperationStatus> getNodeResult = titanGenericDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), uniqueID, ComponentMetadataData.class);
1371 if (getNodeResult.isRight()) {
1372 log.error("DB error during while getting component with uniqueID {}, error: {}", uniqueID, getNodeResult.right().value());
1373 return Either.right(StorageOperationStatus.GENERAL_ERROR);
1375 ComponentMetadataData component = getNodeResult.left().value();
1376 component.getMetadataDataDefinition().setInvariantUUID(invariantUUID);
1377 Either<ComponentMetadataData, TitanOperationStatus> updateNodeResult = titanGenericDao.updateNode(component, ComponentMetadataData.class);
1378 log.debug("updated child invariantUUID {}", updateNodeResult.left().value().getMetadataDataDefinition().getInvariantUUID());
1379 if (updateNodeResult.isRight()) {
1380 log.error("DB error during while updating component {}, error: {}", component.getMetadataDataDefinition().getName(), updateNodeResult.right().value());
1381 return Either.right(StorageOperationStatus.GENERAL_ERROR);
1385 return Either.left(true);
1388 private List<ComponentMetadataData> reduceHighestVersionResourcesList(List<ComponentMetadataData> allHighestVersionResources) {
1389 List<ComponentMetadataData> resultList = null;
1390 Map<String, ComponentMetadataData> resultHM = new HashMap<String, ComponentMetadataData>();
1391 for (ComponentMetadataData resource : allHighestVersionResources) {
1392 if (resource.getMetadataDataDefinition().getInvariantUUID() != null && !resource.getMetadataDataDefinition().getInvariantUUID().isEmpty()) {
1393 log.debug("invariantUUID {} ", resource.getMetadataDataDefinition().getInvariantUUID());
1396 String curUUID = resource.getMetadataDataDefinition().getUUID();
1397 if (resultHM.containsKey(curUUID)) {
1398 int isHighest = resultHM.get(curUUID).getMetadataDataDefinition().getVersion().compareTo(resource.getMetadataDataDefinition().getVersion());
1399 if (isHighest > 0) {
1400 log.debug("version {} is great than {} ", resultHM.get(curUUID).getMetadataDataDefinition().getVersion(), resource.getMetadataDataDefinition().getVersion());
1404 resultHM.put(curUUID, resource);
1406 resultList = new ArrayList<ComponentMetadataData>(resultHM.values());
1410 private boolean isNormative(String resourceName) {
1411 for (int i = 0; i < NORMATIVE_OLD_NAMES.length; ++i) {
1412 if (NORMATIVE_OLD_NAMES[i].equals(resourceName))
1418 private Either<Boolean, StorageOperationStatus> changeNormativeTypeName(ResourceMetadataData resource) {
1420 String resourceName = resource.getMetadataDataDefinition().getName();
1422 if (resourceName != null && !resourceName.isEmpty()) {
1423 log.debug("Found normative type to change - {}", resourceName);
1424 String oldName = resourceName;
1425 String[] splitedName = resourceName.split("\\.");
1426 String newName = splitedName[splitedName.length - 1];
1427 String newSystemName = ValidationUtils.convertToSystemName(newName);
1428 String newNormalizedName = ValidationUtils.normaliseComponentName(newName);
1429 log.debug("Setting name to be {}", newName);
1431 resource.getMetadataDataDefinition().setName(newName);
1432 log.debug("Setting system name to be {}", newSystemName);
1433 resource.getMetadataDataDefinition().setSystemName(newSystemName);
1434 log.debug("Setting normalized name to be {}", newNormalizedName);
1435 resource.getMetadataDataDefinition().setNormalizedName(newNormalizedName);
1436 log.debug("Updating tag in metadata to be {}", newName);
1437 resource.getMetadataDataDefinition().getTags().remove(oldName);
1438 resource.getMetadataDataDefinition().getTags().add(newName);
1440 log.debug("Creating tag node with name {}", newName);
1441 TagData tagData = new TagData();
1442 tagData.setName(newName);
1443 Either<TagData, TitanOperationStatus> createNode = titanGenericDao.createNode(tagData, TagData.class);
1444 if (createNode.isRight()) {
1445 log.error("Error while creating tag node {}, error: {}.", newName, createNode.right().value());
1446 return Either.right(StorageOperationStatus.GENERAL_ERROR);
1449 Either<ResourceMetadataData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(resource, ResourceMetadataData.class);
1450 if (updateNode.isRight()) {
1451 log.error("DB error during while updating normative type {}, error: {}", resource.getMetadataDataDefinition().getName(), updateNode.right().value());
1452 return Either.right(StorageOperationStatus.GENERAL_ERROR);
1454 log.debug("Normative type {} was successfully updated", resource.getMetadataDataDefinition().getName());
1455 return Either.left(true);
1458 return Either.left(false);
1461 private Either<Boolean, StorageOperationStatus> generateAndSetToscaResourceName(ResourceMetadataData resource, String toscaResourceName) {
1462 if (toscaResourceName == null) {
1463 toscaResourceName = CommonBeUtils.generateToscaResourceName(((ResourceMetadataDataDefinition) resource.getMetadataDataDefinition()).getResourceType().name(), resource.getMetadataDataDefinition().getSystemName());
1465 Either<Boolean, StorageOperationStatus> validateToscaResourceNameExists = resourceOperation.validateToscaResourceNameExists(toscaResourceName);
1466 if (validateToscaResourceNameExists.isRight()) {
1467 StorageOperationStatus storageOperationStatus = validateToscaResourceNameExists.right().value();
1468 log.error("Couldn't validate toscaResourceName uniqueness - error: {}", storageOperationStatus);
1469 return Either.right(storageOperationStatus);
1471 if (validateToscaResourceNameExists.left().value()) {
1472 log.debug("Setting tosca resource name to be {}", toscaResourceName);
1473 ((ResourceMetadataDataDefinition) resource.getMetadataDataDefinition()).setToscaResourceName(toscaResourceName);
1474 return Either.left(true);
1476 // As agreed with Renana - cannot be fixed automatically
1477 log.warn("toscaResourceName {} is not unique! Cannot set it. Continuing...");
1478 return Either.left(false);
1482 public boolean testRemoveHeatPlaceHolders(String appConfigDir) {
1484 if (!AllowMultipleHeats.removeAndUpdateHeatPlaceHolders(titanGenericDao, log, false)) {
1485 log.error("Failed to update heat place holders");
1491 private Either<Boolean, StorageOperationStatus> setVfToscaResourceName(ResourceMetadataData resource) {
1492 String resourceName = resource.getMetadataDataDefinition().getName();
1493 String resourceType = ((ResourceMetadataDataDefinition) resource.getMetadataDataDefinition()).getResourceType().name();
1494 String toscaResourceName = CommonBeUtils.generateToscaResourceName(resourceType, resource.getMetadataDataDefinition().getSystemName());
1495 log.debug("Setting tosca resource name {} to VF {}", toscaResourceName, resourceName);
1496 ((ResourceMetadataDataDefinition) resource.getMetadataDataDefinition()).setToscaResourceName(toscaResourceName);
1498 Either<ResourceMetadataData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(resource, ResourceMetadataData.class);
1499 if (updateNode.isRight()) {
1500 log.error("DB error during while updating VF tosca resource name {}, error: {}", resource.getMetadataDataDefinition().getName(), updateNode.right().value());
1501 return Either.right(StorageOperationStatus.GENERAL_ERROR);
1503 log.debug("Tosca resource name of VF {} was successfully updated", resource.getMetadataDataDefinition().getName());
1504 return Either.left(true);
1507 public boolean testAddGroupUuids(String appConfigDir) {
1509 if (!AddGroupUuid.addGroupUuids(titanGenericDao, log, false)) {
1510 log.error("Failed to update group UUIDs");