diff options
64 files changed, 1504 insertions, 339 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) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandler.java index 6738b87853..e6d15b8d5e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandler.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.components.distribution.engine; import java.io.IOException; +import java.net.MalformedURLException; import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.Collection; @@ -31,8 +32,10 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.att.nsa.cambria.client.*; import org.apache.http.HttpStatus; import org.openecomp.sdc.be.config.BeEcompErrorManager; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; import org.openecomp.sdc.common.config.EcompErrorName; import org.slf4j.Logger; @@ -40,16 +43,12 @@ import org.slf4j.LoggerFactory; import com.att.nsa.apiClient.http.HttpException; import com.att.nsa.apiClient.http.HttpObjectNotFoundException; -import com.att.nsa.cambria.client.CambriaBatchingPublisher; import com.att.nsa.cambria.client.CambriaClient.CambriaApiException; import com.att.nsa.cambria.client.CambriaClientBuilders.TopicManagerBuilder; import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder; import com.att.nsa.cambria.client.CambriaClientBuilders.ConsumerBuilder; import com.att.nsa.cambria.client.CambriaClientBuilders.IdentityManagerBuilder; -import com.att.nsa.cambria.client.CambriaConsumer; -import com.att.nsa.cambria.client.CambriaIdentityManager; import com.att.nsa.cambria.client.CambriaPublisher.message; -import com.att.nsa.cambria.client.CambriaTopicManager; import com.google.gson.Gson; import fj.data.Either; @@ -63,6 +62,8 @@ public class CambriaHandler { private Gson gson = new Gson(); + public static boolean useHttpsWithDmaap = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration().isUseHttpsWithDmaap(); + public static void main(String[] args) { // String userBodyJson ="{\"artifactName\":\"myartifact\", @@ -86,18 +87,18 @@ public class CambriaHandler { String key = "sSJc5qiBnKy2qrlc"; String secret = "4ZRPzNJfEUK0sSNBvccd2m7X"; - createTopicManager = new TopicManagerBuilder().usingHttps().usingHosts(servers).authenticatedBy(key, secret).build(); + createTopicManager = buildCambriaClient(new TopicManagerBuilder().usingHosts(servers).authenticatedBy(key, secret)); String topicName = "ASDC-DISTR-NOTIF-TOPIC-PRODesofer"; String clientKey1 = "CGGoorrGPXPx2B1C"; String clientSecret1 = "OTHk2mcCSbskEtHhDw8h5oUa"; - CambriaTopicManager createStatusTopicManager = new TopicManagerBuilder().usingHttps().usingHosts(servers).authenticatedBy(key, secret).build(); + CambriaTopicManager createStatusTopicManager = buildCambriaClient(new TopicManagerBuilder().usingHosts(servers).authenticatedBy(key, secret)); String reportTopic = "ASDC-DISTR-STATUS-TOPIC-PRODESOFER"; createStatusTopicManager.allowProducer(reportTopic, clientKey1); - CambriaBatchingPublisher createSimplePublisher = new PublisherBuilder().onTopic(reportTopic).usingHttps().usingHosts(servers).build(); + CambriaBatchingPublisher createSimplePublisher = new PublisherBuilder().onTopic(reportTopic).usingHttps(useHttpsWithDmaap).usingHosts(servers).build(); createSimplePublisher.setApiCredentials(clientKey1, clientSecret1); DistributionStatusNotification distributionStatusNotification = new DistributionStatusNotification(); @@ -126,20 +127,20 @@ public class CambriaHandler { String clientKey2 = "TAIEPO0aDU4VzM0G"; - CambriaConsumer createConsumer1 = new ConsumerBuilder().authenticatedBy("asdc1", "consumerId1").onTopic(topicName).usingHttps().usingHosts(servers).build(); + CambriaConsumer createConsumer1 = new ConsumerBuilder().authenticatedBy("asdc1", "consumerId1").onTopic(topicName).usingHttps(useHttpsWithDmaap).usingHosts(servers).build(); createConsumer1.setApiCredentials(clientKey1, "OTHk2mcCSbskEtHhDw8h5oUa"); createTopicManager.allowConsumer(topicName, clientKey1); CambriaConsumer createConsumer2 = null; if (true) { - createConsumer2 = new ConsumerBuilder().authenticatedBy("asdc2", "consumerId3").onTopic(topicName).usingHttps().usingHosts(servers).build(); + createConsumer2 = new ConsumerBuilder().authenticatedBy("asdc2", "consumerId3").onTopic(topicName).usingHttps(useHttpsWithDmaap).usingHosts(servers).build(); createConsumer2.setApiCredentials(clientKey2, "FSlNJbmGWWBvBLJetQMYxPP6"); createTopicManager.allowConsumer(topicName, clientKey2); } - createSimplePublisher = new PublisherBuilder().onTopic(topicName).usingHttps().usingHosts(servers).build(); + createSimplePublisher = new PublisherBuilder().onTopic(topicName).usingHttps(useHttpsWithDmaap).usingHosts(servers).build(); createSimplePublisher.setApiCredentials(key, secret); createTopicManager.allowProducer(topicName, key); @@ -284,7 +285,7 @@ public class CambriaHandler { CambriaTopicManager createTopicManager = null; try { - createTopicManager = new TopicManagerBuilder().usingHttps().usingHosts(hostSet).build(); + createTopicManager = buildCambriaClient(new TopicManagerBuilder().usingHosts(hostSet)); Set<String> topics = createTopicManager.getTopics(); @@ -318,7 +319,6 @@ public class CambriaHandler { * * set Cambria status and http code in case we succeed to fetch it * - * @param errorMessage * @return */ private CambriaErrorResponse processError(Exception e) { @@ -415,8 +415,6 @@ public class CambriaHandler { * - list of U-EB servers * @param apiKey * @param secretKey - * @param topicsList - * - list of exists topics * @param topicName * - topic to create * @param partitionCount @@ -428,7 +426,7 @@ public class CambriaHandler { CambriaTopicManager createTopicManager = null; try { - createTopicManager = new TopicManagerBuilder().usingHttps().usingHosts(hostSet).authenticatedBy(apiKey, secretKey).build(); + createTopicManager = buildCambriaClient(new TopicManagerBuilder().usingHosts(hostSet).authenticatedBy(apiKey, secretKey)); createTopicManager.createTopic(topicName, "ASDC distribution notification topic", partitionCount, replicationCount); @@ -458,7 +456,7 @@ public class CambriaHandler { public CambriaErrorResponse unRegisterFromTopic(Collection<String> hostSet, String topicName, String managerApiKey, String managerSecretKey, String subscriberApiKey, SubscriberTypeEnum subscriberTypeEnum) { CambriaTopicManager createTopicManager = null; try { - createTopicManager = new TopicManagerBuilder().usingHttps().usingHosts(hostSet).authenticatedBy(managerApiKey, managerSecretKey).build(); + createTopicManager = buildCambriaClient(new TopicManagerBuilder().usingHosts(hostSet).authenticatedBy(managerApiKey, managerSecretKey)); if (subscriberTypeEnum == SubscriberTypeEnum.PRODUCER) { createTopicManager.revokeProducer(topicName, subscriberApiKey); @@ -513,7 +511,7 @@ public class CambriaHandler { CambriaTopicManager createTopicManager = null; try { - createTopicManager = new TopicManagerBuilder().usingHttps().usingHosts(hostSet).authenticatedBy(managerApiKey, managerSecretKey).build(); + createTopicManager = buildCambriaClient(new TopicManagerBuilder().usingHosts(hostSet).authenticatedBy(managerApiKey, managerSecretKey)); if (subscriberTypeEnum == SubscriberTypeEnum.PRODUCER) { createTopicManager.allowProducer(topicName, subscriberApiKey); @@ -567,7 +565,7 @@ public class CambriaHandler { */ public CambriaConsumer createConsumer(Collection<String> hostSet, String topicName, String apiKey, String secretKey, String consumerId, String consumerGroup, int timeoutMS) throws Exception { - CambriaConsumer consumer = new ConsumerBuilder().authenticatedBy(apiKey, secretKey).knownAs(consumerGroup, consumerId).onTopic(topicName).usingHttps().usingHosts(hostSet).withSocketTimeout(timeoutMS).build(); + CambriaConsumer consumer = new ConsumerBuilder().authenticatedBy(apiKey, secretKey).knownAs(consumerGroup, consumerId).onTopic(topicName).usingHttps(useHttpsWithDmaap).usingHosts(hostSet).withSocketTimeout(timeoutMS).build(); consumer.setApiCredentials(apiKey, secretKey); return consumer; } @@ -638,7 +636,7 @@ public class CambriaHandler { String json = gson.toJson(data); logger.trace("Before sending notification data {} to topic {}", json, topicName); - createSimplePublisher = new PublisherBuilder().onTopic(topicName).usingHttps().usingHosts(uebServers).build(); + createSimplePublisher = new PublisherBuilder().onTopic(topicName).usingHttps(useHttpsWithDmaap).usingHosts(uebServers).build(); createSimplePublisher.setApiCredentials(uebPublicKey, uebSecretKey); int result = createSimplePublisher.send(PARTITION_KEY, json); @@ -700,7 +698,7 @@ public class CambriaHandler { String json = gson.toJson(data); logger.debug("Before sending notification data {} to topic {}", json, topicName); - createSimplePublisher = new PublisherBuilder().onTopic(topicName).usingHttps().usingHosts(uebServers).build(); + createSimplePublisher = new PublisherBuilder().onTopic(topicName).usingHttps(useHttpsWithDmaap).usingHosts(uebServers).build(); createSimplePublisher.setApiCredentials(uebPublicKey, uebSecretKey); int result = createSimplePublisher.send(PARTITION_KEY, json); @@ -761,7 +759,7 @@ public class CambriaHandler { hostSet.add(server); CambriaIdentityManager createIdentityManager = null; try { - createIdentityManager = new IdentityManagerBuilder().usingHttps().usingHosts(hostSet).build(); + createIdentityManager = buildCambriaClient(new IdentityManagerBuilder().usingHosts(hostSet)); createIdentityManager.getApiKey(apiKey); response = new CambriaErrorResponse(CambriaOperationStatus.OK, 200); @@ -775,4 +773,10 @@ public class CambriaHandler { return response; } + private static <T extends CambriaClient> T buildCambriaClient(CambriaClientBuilders.AbstractAuthenticatedManagerBuilder<? extends CambriaClient> client) throws MalformedURLException, GeneralSecurityException { + if (useHttpsWithDmaap) { + client.usingHttps(); + } + return (T)client.build(); + } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java index 887ce12c3c..003fe66d9d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java @@ -2660,7 +2660,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { if (!artifactUniqueId.equals(artifactId)) { // need to update the generated id in heat env Map<String, ArtifactDefinition> deploymentArtifacts = parent.getDeploymentArtifacts(); - Optional<Entry<String, ArtifactDefinition>> findFirst = deploymentArtifacts.entrySet().stream().filter(a -> a.getValue().getGeneratedFromId().equals(artifactId)).findFirst(); + Optional<Entry<String, ArtifactDefinition>> findFirst = deploymentArtifacts.entrySet().stream().filter(a -> a.getValue().getGeneratedFromId()!=null && a.getValue().getGeneratedFromId().equals(artifactId)).findFirst(); if (findFirst.isPresent()) { ArtifactDefinition artifactEnvInfo = findFirst.get().getValue(); artifactEnvInfo.setArtifactChecksum(null); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java index a2809b44cf..c3471e46e1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java @@ -21,38 +21,26 @@ package org.openecomp.sdc.be.components.impl; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.UUID; import java.util.Map.Entry; import java.util.function.BiConsumer; -import java.util.function.Predicate; import java.util.stream.Collectors; -import java.util.stream.Stream; import org.json.simple.JSONObject; +import org.openecomp.sdc.be.components.validation.ComponentValidations; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; -import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; -import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; -import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.ComponentInstInputsMap; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; @@ -66,27 +54,17 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; -import org.openecomp.sdc.be.model.operations.impl.InputsOperation; -import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.model.tosca.converters.PropertyValueConverter; -import org.openecomp.sdc.be.resources.data.InputValueData; -import org.openecomp.sdc.be.resources.data.InputsData; -import org.openecomp.sdc.be.resources.data.PropertyValueData; -import org.openecomp.sdc.be.resources.data.UniqueIdData; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor; import org.springframework.stereotype.Component; import org.yaml.snakeyaml.Yaml; import com.google.gson.Gson; -import com.thinkaurelius.titan.core.TitanVertex; -import fj.Function; import fj.data.Either; @Component("inputsBusinessLogic") @@ -97,15 +75,6 @@ public class InputsBusinessLogic extends BaseBusinessLogic { private static Logger log = LoggerFactory.getLogger(InputsBusinessLogic.class.getName()); - - - @javax.annotation.Resource - private PropertyOperation propertyOperation = null; - - - @Autowired - private ComponentsUtils componentsUtils; - private static final String GET_INPUT = "get_input"; private static String ASSOCIATING_INPUT_TO_PROP = "AssociatingInputToComponentInstanceProperty"; @@ -148,7 +117,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } - public Either<List<ComponentInstanceInput>, ResponseFormat> getComponentInstanceInputs(String userId, String componentId, String componentInstanceId,String fromName, int amount) { + public Either<List<ComponentInstanceInput>, ResponseFormat> getComponentInstanceInputs(String userId, String componentId, String componentInstanceId) { Either<User, ResponseFormat> resp = validateUserExists(userId, "get Inputs", false); @@ -171,15 +140,14 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } org.openecomp.sdc.be.model.Component component = getComponentEither.left().value(); - Map<String, List<ComponentInstanceInput>> ciInputs = component.getComponentInstancesInputs(); - if(!ciInputs.containsKey(componentInstanceId)){ + + if(!ComponentValidations.validateComponentInstanceExist(component, componentInstanceId)){ ActionStatus actionStatus = ActionStatus.COMPONENT_INSTANCE_NOT_FOUND; log.debug("Failed to found component instance inputs {}, error: {}", componentInstanceId, actionStatus.name()); return Either.right(componentsUtils.getResponseFormat(actionStatus)); } - - return Either.left(ciInputs.get(componentInstanceId)); - + Map<String, List<ComponentInstanceInput>> ciInputs = Optional.ofNullable(component.getComponentInstancesInputs()).orElse(Collections.emptyMap()); + return Either.left(ciInputs.getOrDefault(componentInstanceId, Collections.emptyList())); } /** diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java new file mode 100644 index 0000000000..b50c8ef9d1 --- /dev/null +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java @@ -0,0 +1,18 @@ +package org.openecomp.sdc.be.components.validation; + +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; + +import java.util.Optional; +import java.util.stream.Collectors; + +public class ComponentValidations { + + public static boolean validateComponentInstanceExist(Component component, String instanceId) { + return Optional.ofNullable(component.getComponentInstances()) + .map(componentInstances -> componentInstances.stream().map(ComponentInstance::getUniqueId).collect(Collectors.toList())) + .filter(instancesIds -> instancesIds.contains(instanceId)) + .isPresent(); + } + +} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java index 67f0e74b50..05f4b15621 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java @@ -56,6 +56,9 @@ import org.springframework.web.context.WebApplicationContext; import com.jcabi.aspects.Loggable; import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiResponse; +import com.wordnik.swagger.annotations.ApiResponses; import fj.data.Either; @@ -80,6 +83,8 @@ public class DistributionServlet extends BeGenericServlet { @Path("/distributionUebCluster") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "UEB Server List", httpMethod = "GET", notes = "return the available UEB Server List", response = String.class) + @ApiResponses(value = { @ApiResponse(code = 200, message = "UEB server list fetched successfully"), @ApiResponse(code = 500, message = "One or more BE components (Titan, ES, BE) are down") }) public Response getUebServerList(@Context final HttpServletRequest request, @HeaderParam(value = Constants.X_ECOMP_INSTANCE_ID_HEADER) String instanceId, @HeaderParam(value = Constants.X_ECOMP_REQUEST_ID_HEADER) String requestId, @HeaderParam(value = Constants.AUTHORIZATION_HEADER) String authorization, @HeaderParam(value = Constants.ACCEPT_HEADER) String accept) { init(request); @@ -134,6 +139,8 @@ public class DistributionServlet extends BeGenericServlet { @Path("/artifactTypes") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Artifact types list", httpMethod = "GET", notes = "Fetches available artifact types list", response = String.class) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Artifact types list fetched successfully"), @ApiResponse(code = 500, message = "One or more BE components (Titan, ES, BE) are down") }) public Response getValidArtifactTypes(@Context final HttpServletRequest request, @HeaderParam(value = Constants.X_ECOMP_INSTANCE_ID_HEADER) String instanceId, @HeaderParam(value = Constants.X_ECOMP_REQUEST_ID_HEADER) String requestId, @HeaderParam(value = Constants.AUTHORIZATION_HEADER) String authorization, @HeaderParam(value = Constants.ACCEPT_HEADER) String accept) { init(request); @@ -156,6 +163,8 @@ public class DistributionServlet extends BeGenericServlet { @Path("/registerForDistribution") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Subscription status", httpMethod = "POST", notes = "Subscribes for distribution notifications", response = String.class) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Subscribed for distribution notifications successfull"), @ApiResponse(code = 500, message = "One or more BE components (Titan, ES, BE) are down") }) public Response registerForDistribution(@Context final HttpServletRequest request, String requestJson) { String url = request.getMethod() + " " + request.getRequestURI(); log.debug("Start handle request of {}", url); @@ -187,6 +196,8 @@ public class DistributionServlet extends BeGenericServlet { @Path("/unRegisterForDistribution") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Subscription status", httpMethod = "POST", notes = "Removes from subscription for distribution notifications", response = String.class) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully removed from subscription for distribution notifications"), @ApiResponse(code = 500, message = "One or more BE components (Titan, ES, BE) are down") }) public Response unRegisterForDistribution(@Context final HttpServletRequest request, String requestJson) { String url = request.getMethod() + " " + request.getRequestURI(); log.debug("Start handle request of {}", url); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java index 51b0a1dff7..7a83726cc3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java @@ -34,7 +34,6 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.openecomp.sdc.be.components.impl.DistributionMonitoringBusinessLogic; import org.openecomp.sdc.be.components.impl.HealthCheckBusinessLogic; import org.openecomp.sdc.be.components.impl.MonitoringBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -42,9 +41,9 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; -import org.openecomp.sdc.common.api.HealthCheckWrapper; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckComponent; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; +import org.openecomp.sdc.common.api.HealthCheckWrapper; import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.monitoring.MonitoringEvent; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java index 580b2bdb8b..8bef822f26 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java @@ -179,8 +179,7 @@ public class InputsServlet extends AbstractValidationsServlet { @ApiOperation(value = "Get Inputs only", httpMethod = "GET", notes = "Returns Inputs list", response = Resource.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Component found"), @ApiResponse(code = 403, message = "Restricted operation"), @ApiResponse(code = 404, message = "Component not found") }) public Response getComponentInstanceInputs(@PathParam("componentType") final String componentType, @PathParam("componentId") final String componentId, @PathParam("instanceId") final String instanceId, - @PathParam("originComponentUid") final String originComonentUid, @Context final HttpServletRequest request, @QueryParam("fromName") String fromName, @QueryParam("amount") int amount, - @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { + @PathParam("originComponentUid") final String originComonentUid, @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { ServletContext context = request.getSession().getServletContext(); String url = request.getMethod() + " " + request.getRequestURI(); @@ -190,7 +189,7 @@ public class InputsServlet extends AbstractValidationsServlet { try { InputsBusinessLogic businessLogic = getInputBL(context); - Either<List<ComponentInstanceInput>, ResponseFormat> inputsResponse = businessLogic.getComponentInstanceInputs(userId, componentId, instanceId, fromName, amount); + Either<List<ComponentInstanceInput>, ResponseFormat> inputsResponse = businessLogic.getComponentInstanceInputs(userId, componentId, instanceId); if (inputsResponse.isRight()) { log.debug("failed to get component instance inputs {}", componentType); return buildErrorResponse(inputsResponse.right().value()); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ProductServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ProductServlet.java index f4ac921cb7..4b450cbe7b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ProductServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ProductServlet.java @@ -72,7 +72,7 @@ public class ProductServlet extends BeGenericServlet { @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Create product", httpMethod = "POST", notes = "Returns created product", response = Product.class) @ApiResponses(value = { @ApiResponse(code = 201, message = "Product created"), @ApiResponse(code = 403, message = "Restricted operation / Empty USER_ID header"), @ApiResponse(code = 400, message = "Invalid/missing content"), - @ApiResponse(code = 409, message = "Product already exists / User not found / Wrong user role") }) + @ApiResponse(code = 409, message = "Product already exists / User not found / Wrong user role") }) public Response createProduct(@ApiParam(value = "Product object to be created", required = true) String data, @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) @ApiParam(value = "USER_ID of product strategist user", required = true) String userId) { diff --git a/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml b/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml index 5d93601ea0..60886cf40f 100644 --- a/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml +++ b/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml @@ -43,4 +43,6 @@ createTopic: partitionCount: 1 replicationCount: 1 -startDistributionEngine: true
\ No newline at end of file +startDistributionEngine: true + +useHttpsWithDmaap: true
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java index fd7717a769..1ff6f853d9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java @@ -8,14 +8,12 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; - import java.util.Collections; import java.util.Map; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; - public class ArtifactResolverTest { private ArtifactResolverImpl testInstance = new ArtifactResolverImpl(); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java new file mode 100644 index 0000000000..97b425db05 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java @@ -0,0 +1,109 @@ +package org.openecomp.sdc.be.components.impl; + +import fj.data.Either; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; +import org.openecomp.sdc.be.user.IUserBusinessLogic; +import org.openecomp.sdc.exception.ResponseFormat; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class InputsBusinessLogicTest { + + private static final String COMPONENT_INSTANCE_ID = "instanceId"; + private static final String COMPONENT_ID = "componentId"; + private static final String USER_ID = "userId"; + public static final String INSTANCE_INPUT_ID = "inputId"; + @Mock + private ComponentsUtils componentsUtilsMock; + + @Mock + private IUserBusinessLogic userAdminMock; + + @Mock + private ToscaOperationFacade toscaOperationFacadeMock; + + @InjectMocks + private InputsBusinessLogic testInstance; + + private Service service; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + service = new Service(); + service.setUniqueId(COMPONENT_INSTANCE_ID); + ComponentInstance componentInstance = new ComponentInstance(); + componentInstance.setUniqueId(COMPONENT_INSTANCE_ID); + service.setComponentInstances(Collections.singletonList(componentInstance)); + + Map<String, List<ComponentInstanceInput>> instanceInputMap = new HashMap<>(); + ComponentInstanceInput componentInstanceInput = new ComponentInstanceInput(); + componentInstanceInput.setInputId(INSTANCE_INPUT_ID); + instanceInputMap.put(COMPONENT_INSTANCE_ID, Collections.singletonList(componentInstanceInput)); + instanceInputMap.put("someInputId", Collections.singletonList(new ComponentInstanceInput())); + service.setComponentInstancesInputs(instanceInputMap); + + Mockito.when(userAdminMock.getUser(USER_ID, false)).thenReturn(Either.left(new User())); + } + + @Test + public void getComponentInstanceInputs_ComponentInstanceNotExist() throws Exception { + Mockito.when(toscaOperationFacadeMock.getToscaElement(Mockito.eq(COMPONENT_ID), Mockito.any(ComponentParametersView.class))).thenReturn(Either.left(service)); + Either<List<ComponentInstanceInput>, ResponseFormat> componentInstanceInputs = testInstance.getComponentInstanceInputs(USER_ID, COMPONENT_ID, "nonExisting"); + assertTrue(componentInstanceInputs.isRight()); + Mockito.verify(componentsUtilsMock).getResponseFormat(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND); + } + + @Test + public void getComponentInstanceInputs_emptyInputsMap() throws Exception { + service.setComponentInstancesInputs(Collections.emptyMap()); + getComponents_emptyInputs(service); + } + + @Test + public void getComponentInstanceInputs_nullInputsMap() throws Exception { + service.setComponentInstancesInputs(null); + getComponents_emptyInputs(service); + } + + @Test + public void getComponentInstanceInputs_instanceHasNoInputs() throws Exception { + service.setComponentInstancesInputs(Collections.singletonMap("someInputId", new ArrayList<>())); + getComponents_emptyInputs(service); + } + + @Test + public void getComponentInstanceInputs() throws Exception { + Mockito.when(toscaOperationFacadeMock.getToscaElement(Mockito.eq(COMPONENT_ID), Mockito.any(ComponentParametersView.class))).thenReturn(Either.left(service)); + Either<List<ComponentInstanceInput>, ResponseFormat> componentInstanceInputs = testInstance.getComponentInstanceInputs(USER_ID, COMPONENT_ID, COMPONENT_INSTANCE_ID); + assertEquals("inputId", componentInstanceInputs.left().value().get(0).getInputId()); + } + + private void getComponents_emptyInputs(Service service) { + Mockito.when(toscaOperationFacadeMock.getToscaElement(Mockito.eq(COMPONENT_ID), Mockito.any(ComponentParametersView.class))).thenReturn(Either.left(service)); + Either<List<ComponentInstanceInput>, ResponseFormat> componentInstanceInputs = testInstance.getComponentInstanceInputs(USER_ID, COMPONENT_ID, COMPONENT_INSTANCE_ID); + assertEquals(Collections.emptyList(), componentInstanceInputs.left().value()); + } + +} diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java index 985870b5e3..8718f72f8a 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java @@ -2,11 +2,8 @@ package org.openecomp.sdc.be.model.jsontitan.operations; import fj.data.Either; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.ImmutableTriple; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; @@ -15,40 +12,20 @@ import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.MapCapabiltyProperty; import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DerivedNodeTypeResolver; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType; -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.datamodel.ToscaElementTypeEnum; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; -import org.openecomp.sdc.be.resources.data.AttributeData; -import org.openecomp.sdc.be.resources.data.AttributeValueData; -import org.openecomp.sdc.be.resources.data.CapabilityData; -import org.openecomp.sdc.be.resources.data.CapabilityTypeData; -import org.openecomp.sdc.be.resources.data.DataTypeData; -import org.openecomp.sdc.be.resources.data.GroupData; -import org.openecomp.sdc.be.resources.data.GroupTypeData; -import org.openecomp.sdc.be.resources.data.InputValueData; -import org.openecomp.sdc.be.resources.data.InputsData; -import org.openecomp.sdc.be.resources.data.PolicyTypeData; -import org.openecomp.sdc.be.resources.data.PropertyData; -import org.openecomp.sdc.be.resources.data.PropertyValueData; -import org.openecomp.sdc.be.resources.data.RelationshipInstData; -import org.openecomp.sdc.be.resources.data.RelationshipTypeData; -import org.openecomp.sdc.be.resources.data.RequirementData; -import org.openecomp.sdc.be.resources.data.ResourceMetadataData; import org.openecomp.sdc.common.jsongraph.util.CommonUtility; import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum; import org.slf4j.Logger; @@ -57,11 +34,10 @@ import org.springframework.beans.factory.annotation.Qualifier; import java.util.ArrayList; import java.util.Collection; +import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.function.Function; import java.util.regex.Pattern; @org.springframework.stereotype.Component("node-type-operation") @@ -748,34 +724,17 @@ public class NodeTypeOperation extends ToscaElementOperation { } - private StorageOperationStatus updateDataFromNewDerived(List<GraphVertex> newDerived, GraphVertex nodeTypeV, NodeType nodeToUpdate) { - - StorageOperationStatus status = updateDataByType(newDerived, nodeTypeV, EdgeLabelEnum.CAPABILITIES, nodeToUpdate); - if (status != StorageOperationStatus.OK) { - return status; - } - - status = updateDataByType(newDerived, nodeTypeV, EdgeLabelEnum.REQUIREMENTS, nodeToUpdate); - if (status != StorageOperationStatus.OK) { - return status; - } - - status = updateDataByType(newDerived, nodeTypeV, EdgeLabelEnum.PROPERTIES, nodeToUpdate); - if (status != StorageOperationStatus.OK) { - return status; - } - - status = updateDataByType(newDerived, nodeTypeV, EdgeLabelEnum.ATTRIBUTES, nodeToUpdate); - if (status != StorageOperationStatus.OK) { - return status; - } - - status = updateDataByType(newDerived, nodeTypeV,EdgeLabelEnum.CAPABILITIES_PROPERTIES, nodeToUpdate); - if (status != StorageOperationStatus.OK) { - return status; + private StorageOperationStatus updateDataFromNewDerived(List<GraphVertex> newDerived, GraphVertex nodeTypeV, NodeType nodeToUpdate) { + EnumSet<EdgeLabelEnum> edgeLabels = EnumSet.of(EdgeLabelEnum.CAPABILITIES, EdgeLabelEnum.REQUIREMENTS, EdgeLabelEnum.PROPERTIES, EdgeLabelEnum.ATTRIBUTES, EdgeLabelEnum.CAPABILITIES_PROPERTIES, EdgeLabelEnum.ADDITIONAL_INFORMATION); + StorageOperationStatus status = null; + for (EdgeLabelEnum edge : edgeLabels){ + status = updateDataByType(newDerived, nodeTypeV, edge, nodeToUpdate); + if (status != StorageOperationStatus.OK) { + break; + } } - status = updateDataByType(newDerived, nodeTypeV, EdgeLabelEnum.ADDITIONAL_INFORMATION, nodeToUpdate); return status; + } private <T extends ToscaDataDefinition> StorageOperationStatus updateDataByType(List<GraphVertex> newDerivedList, GraphVertex nodeTypeV, EdgeLabelEnum label, NodeType nodeElement) { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java index 1397e81f9c..ca0a51cbbc 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java @@ -992,6 +992,11 @@ public class ToscaElementLifecycleOperation extends BaseOperation { } return result; } + + //TODO remove after jsonModelMigration + public void resolveToscaComponentName(ComponentInstanceDataDefinition vfInst, Map<String, ToscaElement> origCompMap) { + fixToscaComponentName(vfInst, origCompMap); + } private boolean fixToscaComponentName(ComponentInstanceDataDefinition vfInst, Map<String, ToscaElement> origCompMap) { if (vfInst.getToscaComponentName() == null || vfInst.getToscaComponentName().isEmpty()) { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/migration/MigrationMalformedDataLogger.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/migration/MigrationMalformedDataLogger.java index 2d4ca635e7..2e5e520af0 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/migration/MigrationMalformedDataLogger.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/migration/MigrationMalformedDataLogger.java @@ -35,7 +35,10 @@ public class MigrationMalformedDataLogger { Set<String> serviceInstances = componentInstances.stream().map(ComponentInstance::getComponentUid).collect(Collectors.toSet()); serviceInstances.retainAll(malformedVFs); if (!serviceInstances.isEmpty()) { - log.error(String.format("Service %s is using malformed VFs: %s", service.getUniqueId(), StringUtils.join(serviceInstances, ','))); + log.error(String.format("Service %s with id %s and version %s is using malformed VFs: %s", service.getName(), + service.getVersion(), + service.getUniqueId(), + StringUtils.join(serviceInstances, ','))); } } } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceMetadata.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceMetadata.java index b68704eeea..96671766eb 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceMetadata.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceMetadata.java @@ -10,16 +10,6 @@ public class UiServiceMetadata extends UiComponentMetadata { private String distributionStatus; private Boolean ecompGeneratedNaming; private String namingPolicy; - private UiServiceMetadata metadata; - - - public UiServiceMetadata getMetadata() { - return metadata; - } - - public void setMetadata(UiServiceMetadata metadata) { - this.metadata = metadata; - } public UiServiceMetadata(List<CategoryDefinition> categories, ServiceMetadataDataDefinition metadata) { super(categories, metadata); diff --git a/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts b/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts index 03c923c228..4f3417186c 100644 --- a/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts +++ b/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts @@ -27,9 +27,10 @@ export class InputFEModel extends InputBEModel { this.instanceId = input.inputs[0].componentInstanceId; this.propertyName = input.inputs[0].name; }else{ - if (input.inputPath) { + if (input.inputPath && input.inputPath.indexOf('#') > -1) { this.propertyName = input.inputPath.substring(0, input.inputPath.indexOf('#')) } else { + this.inputPath = undefined; //input path may be populated even if its a parent - ensure its empty this.propertyName = this.name.substring(propNameIndex + 1); } } diff --git a/catalog-ui/src/app/ng2/components/inputs-table/inputs-table.component.html b/catalog-ui/src/app/ng2/components/inputs-table/inputs-table.component.html index 8d3f6d1836..5467c94de7 100644 --- a/catalog-ui/src/app/ng2/components/inputs-table/inputs-table.component.html +++ b/catalog-ui/src/app/ng2/components/inputs-table/inputs-table.component.html @@ -14,7 +14,7 @@ <div class="inner-cell-div" tooltip="{{input.name}}"><span class="property-name">{{input.name}}</span></div> <span *ngIf="input.description" class="property-description-icon sprite-new show-desc" - tooltip="{{input.description}}"></span> + tooltip="{{input.description}}" tooltipDelay="0"></span> </div> <div class="table-cell col2"> <div class="inner-cell-div" tooltip="{{input.type | contentAfterLastDot}}"> diff --git a/catalog-ui/src/app/ng2/components/properties-table/dynamic-property/dynamic-property.component.html b/catalog-ui/src/app/ng2/components/properties-table/dynamic-property/dynamic-property.component.html index 2df17971e2..5aa0052cc3 100644 --- a/catalog-ui/src/app/ng2/components/properties-table/dynamic-property/dynamic-property.component.html +++ b/catalog-ui/src/app/ng2/components/properties-table/dynamic-property/dynamic-property.component.html @@ -4,8 +4,8 @@ (click)="onClickPropertyRow(property, $event)"> <!-- LEFT CELL --> <ng-container *ngIf="!isPropertyFEModel"> - <div class="table-cell" *ngIf="canBeDeclared" [ngClass]="{'filtered':property.name === propertyNameSearchText}"> <!-- simple children of complex type --> - <checkbox [(checked)]="property.isSelected" [disabled]="property.isDisabled ||property.isDeclared || readonly" (checkedChange)="checkProperty.emit(property.propertiesName)"></checkbox> + <div class="table-cell" *ngIf="canBeDeclared" [ngClass]="{'filtered':property.name === propertyNameSearchText}" [class.round-checkbox]="property.isDeclared"> <!-- simple children of complex type [@checkEffect]="property.isDeclared"--> + <checkbox [(checked)]="property.isSelected" [disabled]="property.isDisabled ||property.isDeclared || readonly" (checkedChange)="checkProperty.emit(property.propertiesName)" ></checkbox> <div class="inner-cell-div" tooltip="{{property.name}}"><span>{{property.name}}</span></div> </div> <div class="table-cell" *ngIf="!canBeDeclared && !property.isChildOfListOrMap">{{property.name}}</div> <!-- simple children of complex type within map or list --> diff --git a/catalog-ui/src/app/ng2/components/properties-table/properties-table.component.html b/catalog-ui/src/app/ng2/components/properties-table/properties-table.component.html index dc8fe70244..f3259ab3a2 100644 --- a/catalog-ui/src/app/ng2/components/properties-table/properties-table.component.html +++ b/catalog-ui/src/app/ng2/components/properties-table/properties-table.component.html @@ -17,8 +17,8 @@ (click)="onClickPropertyRow(property, instanceName, $event)" [ngClass]="{'selected': selectedPropertyId && selectedPropertyId === property.name }"> - <div class="table-cell col1" [ngClass]="{'filtered':property.name === propertyNameSearchText}"> - <div class="property-name cut-inner-long-text"> + <div class="table-cell col1" [ngClass]="{'filtered':property.name === propertyNameSearchText}" [class.round-checkbox]="property.isDeclared"> + <div class="property-name"> <checkbox [(checked)]="property.isSelected" [disabled]="property.isDisabled || property.isDeclared || readonly" (checkedChange)="propertyChecked(property)"></checkbox> diff --git a/catalog-ui/src/app/ng2/components/properties-table/properties-table.component.less b/catalog-ui/src/app/ng2/components/properties-table/properties-table.component.less index a525021b04..41ff5ede13 100644 --- a/catalog-ui/src/app/ng2/components/properties-table/properties-table.component.less +++ b/catalog-ui/src/app/ng2/components/properties-table/properties-table.component.less @@ -1,4 +1,5 @@ @import './../../../../assets/styles/variables.less'; +@import '../../../../assets/styles/sprite'; @smaller-screen: ~"only screen and (max-width: 1580px)"; :host /deep/ input { width:100%;} @@ -108,10 +109,6 @@ margin-left: 5px; flex: 0 0 auto; } - - /deep/ .checkbox-container { - margin-right: 10px; - } } &.col2 { flex: 0 0 150px; @@ -130,6 +127,27 @@ display: flex; @media @smaller-screen { flex: 1 0 40%;} } + + + /deep/ .checkbox-container { + margin-right: 10px; + } + + /deep/ &.round-checkbox { + .checkbox-container input[type=checkbox].checkbox-hidden { + &:checked ~ .checkbox-icon::before { + .sprite-new; + .round-checked-icon; + } + &[disabled] ~ .checkbox-icon::before { + .sprite-new; + .round-checked-icon.disabled; + background-color:inherit; + border:none; + //animation: addDisabledCheck 4s linear; + } + } + } } .filtered { diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.less b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.less index 7f9b4e7d58..8df479ffa6 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.less +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.less @@ -46,6 +46,13 @@ background-color: white; padding-top:9px; } + + .tab-indication { + background-color:#4ca90c; + border:solid 2px #fff; + border-radius:50%; + font-size:12px; + } } .header { diff --git a/catalog-ui/src/app/view-models/admin-dashboard/category-management/category-management-view-model.ts b/catalog-ui/src/app/view-models/admin-dashboard/category-management/category-management-view-model.ts index ba390c4bee..61558252e0 100644 --- a/catalog-ui/src/app/view-models/admin-dashboard/category-management/category-management-view-model.ts +++ b/catalog-ui/src/app/view-models/admin-dashboard/category-management/category-management-view-model.ts @@ -98,7 +98,7 @@ export class CategoryManagementViewModel { }; let modalOptions:ng.ui.bootstrap.IModalSettings = { - template: 'src/app/view-models/admin-dashboard/add-category-modal/add-category-modal-view.html', + templateUrl: '../add-category-modal/add-category-modal-view.html', controller: 'Sdc.ViewModels.AddCategoryModalViewModel', size: 'sdc-xsm', backdrop: 'static', diff --git a/catalog-ui/src/app/view-models/workspace/tabs/activity-log/activity-log.ts b/catalog-ui/src/app/view-models/workspace/tabs/activity-log/activity-log.ts index ed583dc4c0..f41364dbfd 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/activity-log/activity-log.ts +++ b/catalog-ui/src/app/view-models/workspace/tabs/activity-log/activity-log.ts @@ -88,11 +88,11 @@ export class ActivityLogViewModel { private initSortedTableScope = ():void => { this.$scope.tableHeadersList = [ - {title: 'Date', property: 'logDate'}, - {title: 'Action', property: 'logAction'}, - {title: 'Comment', property: 'logComment'}, - {title: 'Username', property: 'logUsername'}, - {title: 'Status', property: 'logStatus'} + {title: 'Date', property: 'dateFormat'}, + {title: 'Action', property: 'ACTION'}, + {title: 'Comment', property: 'COMMENT'}, + {title: 'Username', property: 'MODIFIER'}, + {title: 'Status', property: 'STATUS'} ]; this.$scope.sort = (sortBy:string):void => { diff --git a/catalog-ui/src/app/view-models/workspace/tabs/composition/composition-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/composition/composition-view-model.ts index 670655ea4b..d0eefdfd11 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/composition/composition-view-model.ts +++ b/catalog-ui/src/app/view-models/workspace/tabs/composition/composition-view-model.ts @@ -20,7 +20,7 @@ 'use strict'; import {Component, Product, ComponentInstance, IAppMenu} from "app/models"; import {SharingService, CacheService, EventListenerService, LeftPaletteLoaderService} from "app/services"; -import {ModalsHandler, GRAPH_EVENTS, ComponentFactory, ChangeLifecycleStateHandler, MenuHandler} from "app/utils"; +import {ModalsHandler, GRAPH_EVENTS, ComponentFactory, ChangeLifecycleStateHandler, MenuHandler, EVENTS} from "app/utils"; import {IWorkspaceViewModelScope} from "../../workspace-view-model"; import {ComponentServiceNg2} from "app/ng2/services/component-services/component.service"; import {ComponentGenericResponse} from "app/ng2/services/responses/component-generic-response"; @@ -240,7 +240,13 @@ export class CompositionViewModel { this.$scope.currentComponent = component; this.$scope.setComponent(this.$scope.currentComponent); this.$scope.updateSelectedComponent(); - } + }; + + this.$scope.reload = (component:Component):void => { + this.$state.go(this.$state.current.name,{id:component.uniqueId},{reload:true}); + }; + + this.eventListenerService.registerObserverCallback(EVENTS.ON_CHECKOUT, this.$scope.reload); } } diff --git a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts index 507181c98c..4300c33412 100644 --- a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts +++ b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts @@ -424,7 +424,6 @@ export class WorkspaceViewModel { //when checking out a major(certified) version this.components.unshift(component); } - this.EventListenerService.notifyObservers(EVENTS.ON_CHECKOUT, component); // this.$state.go(this.$state.current.name, { // id: component.uniqueId, // type: component.componentType.toLowerCase(), @@ -434,7 +433,7 @@ export class WorkspaceViewModel { this.initChangeLifecycleStateButtons(); this.initVersionObject(); this.$scope.isLoading = false; - + this.EventListenerService.notifyObservers(EVENTS.ON_CHECKOUT, component); this.Notification.success({ message: this.$filter('translate')("CHECKOUT_SUCCESS_MESSAGE_TEXT"), title: this.$filter('translate')("CHECKOUT_SUCCESS_MESSAGE_TITLE") diff --git a/catalog-ui/src/assets/styles/images/resource-icons/vl.png b/catalog-ui/src/assets/styles/images/resource-icons/vl.png Binary files differindex 1fb2fc07ce..061c6386a8 100644 --- a/catalog-ui/src/assets/styles/images/resource-icons/vl.png +++ b/catalog-ui/src/assets/styles/images/resource-icons/vl.png diff --git a/catalog-ui/src/assets/styles/images/welcome/002.png b/catalog-ui/src/assets/styles/images/welcome/002.png Binary files differindex f3e7a7c3ed..e76c480ad8 100644 --- a/catalog-ui/src/assets/styles/images/welcome/002.png +++ b/catalog-ui/src/assets/styles/images/welcome/002.png diff --git a/catalog-ui/src/assets/styles/images/welcome/sprite.png b/catalog-ui/src/assets/styles/images/welcome/sprite.png Binary files differindex 3bb7542446..4a7fb39518 100644 --- a/catalog-ui/src/assets/styles/images/welcome/sprite.png +++ b/catalog-ui/src/assets/styles/images/welcome/sprite.png diff --git a/catalog-ui/src/assets/styles/sprite.less b/catalog-ui/src/assets/styles/sprite.less index fd2b6c87e0..62defccca8 100644 --- a/catalog-ui/src/assets/styles/sprite.less +++ b/catalog-ui/src/assets/styles/sprite.less @@ -232,7 +232,8 @@ .filter-icon { background-position: -48px -1040px; width: 19px; height: 20px;} .filter-icon:hover { background-position: -99px -1040px; width: 19px; height: 20px;} .filled-checkbox-icon { background-position: -100px -1079px; width: 14px; height: 14px;} - +.round-checked-icon { background-position: -50px -1119px; width: 20px; height: 20px;} +.round-checked-icon.disabled { background-position: -100px -1119px; width: 20px; height: 20px;} .round-expand-icon { background-position: -50px -1188px; width: 15px; height: 15px; } .round-expand-icon:hover { background-position: -100px -1188px; width: 15px; height: 15px; } .round-expand-icon.open { background-position: -50px -1216px; width: 15px; height: 15px; } diff --git a/catalog-ui/webpack.config.js b/catalog-ui/webpack.config.js index 4f03b7c87c..71fc3ab9f7 100644 --- a/catalog-ui/webpack.config.js +++ b/catalog-ui/webpack.config.js @@ -5,12 +5,14 @@ const merge = require('webpack-merge'); const webpack = require('webpack'); const ServerConfig = require('./webpack.server'); const webpackCommonConfig = require('./webpack.common'); -const { BaseHrefWebpackPlugin} = require('@angular/cli/plugins/webpack'); +const {BaseHrefWebpackPlugin} = require('@angular/cli/plugins/webpack'); const CopyWebpackPlugin = require('copy-webpack-plugin'); // Print server configuration //process.stdout.write('webpack.server: ' + JSON.stringify(ServerConfig) + '\n'); //process.stdout.write('webpack.common: ' + JSON.stringify(webpackCommonConfig) + '\n'); +var currentTime = new Date().getTime(); + const params = { // entryPoints: [ // '/scripts/inline', @@ -23,32 +25,37 @@ const params = { // ] }; -module.exports = function(env) { +module.exports = function (env) { const webpackDevConfig = { devtool: "source-map", devServer: ServerConfig(env), module: { rules: [ - { test: /\.(eot|svg)$/, loader: "file-loader?name=scripts/fonts/[name].[hash:20].[ext]" }, - { test: /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/, loader: "url-loader?name=scripts/images/[name].[hash:20].[ext]&limit=10000" } + {test: /\.(eot|svg)$/, loader: "file-loader?name=scripts/fonts/[name].[hash:20].[ext]"}, + { + test: /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/, + loader: "url-loader?name=scripts/images/[name].[hash:20].[ext]&limit=10000" + } ] }, output: { path: path.join(process.cwd(), "dist"), - filename: "[name].bundle.js", + filename: "[name]." + currentTime + ".bundle.js", chunkFilename: "[id].chunk.js" //publicPath: "/" }, plugins: [ + // Replace /sdc1 inside index.html with '' (because /sdc1 is used only in production). new CopyWebpackPlugin([ - { - from: './src/index.html', transform: function(content, path) { - content = (content+'').replace(/\/sdc1/g,''); - return content; - } - } + { + from: './src/index.html', transform: function (content, path) { + content = (content + '').replace(/\/sdc1/g, ''); + content = (content + '').replace(/\.bundle/g, '.' + currentTime + '.bundle'); + return content; + } + } ]), new webpack.DefinePlugin({ __DEBUG__: JSON.stringify(true), @@ -61,4 +68,4 @@ module.exports = function(env) { }; return merge(webpackDevConfig, webpackCommonConfig(params)); -}
\ No newline at end of file +} diff --git a/catalog-ui/webpack.production.js b/catalog-ui/webpack.production.js index b93b8f2663..db33a94f3e 100644 --- a/catalog-ui/webpack.production.js +++ b/catalog-ui/webpack.production.js @@ -8,6 +8,8 @@ const webpackCommonConfig = require('./webpack.common'); const {GlobCopyWebpackPlugin, BaseHrefWebpackPlugin} = require('@angular/cli/plugins/webpack'); const CopyWebpackPlugin = require('copy-webpack-plugin'); +var currentTime = new Date().getTime(); + const params = { // entryPoints: [ // '/sdc1/scripts/inline', @@ -22,26 +24,35 @@ const params = { const webpackProdConfig = { module: { - rules: [ - { test: /\.(eot|svg)$/, loader: "file-loader?name=/scripts/fonts/[name].[hash:20].[ext]" }, - { test: /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/, loader: "url-loader?name=/scripts/images/[name].[hash:20].[ext]&limit=10000" } - ] + rules: [ + {test: /\.(eot|svg)$/, loader: "file-loader?name=/scripts/fonts/[name].[hash:20].[ext]"}, + { + test: /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/, + loader: "url-loader?name=/scripts/images/[name].[hash:20].[ext]&limit=10000" + } + ] }, output: { path: path.join(process.cwd(), "dist"), - filename: "[name].bundle.js", + filename: "[name]." + currentTime + ".bundle.js", chunkFilename: "[id].chunk.js", publicPath: "/sdc1" }, - plugins: [ + plugins: [ new webpack.DefinePlugin({ __DEBUG__: JSON.stringify(false), __ENV__: JSON.stringify('prod') }), + new CopyWebpackPlugin([ - { from: './src/index.html'} + { + from: './src/index.html', transform: function (content, path) { + content = (content + '').replace(/\.bundle/g, '.' + currentTime + '.bundle'); + return content; + } + } ]), - new webpack.optimize.UglifyJsPlugin({ + new webpack.optimize.UglifyJsPlugin({ beautify: false, mangle: { screw_ie8: true, @@ -53,7 +64,7 @@ const webpackProdConfig = { }, comments: false }) - ] + ] }; module.exports = merge(webpackProdConfig, webpackCommonConfig(params)); diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java index 56e26ce55e..1bef188d0d 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java @@ -64,6 +64,8 @@ public class DistributionEngineConfiguration extends BasicConfiguration { private Integer defaultArtifactInstallationTimeout = 60; + private boolean useHttpsWithDmaap; + public static class DistribNotifServiceArtifacts { Map<String, Object> service; @@ -260,6 +262,14 @@ public class DistributionEngineConfiguration extends BasicConfiguration { this.defaultArtifactInstallationTimeout = defaultArtifactInstallationTimeout; } + public boolean isUseHttpsWithDmaap() { + return useHttpsWithDmaap; + } + + public void setUseHttpsWithDmaap(boolean useHttpsWithDmaap) { + this.useHttpsWithDmaap = useHttpsWithDmaap; + } + public static class CreateTopicConfig { private Integer partitionCount; @@ -28,7 +28,6 @@ <jersey-bom.version>2.24</jersey-bom.version> <servlet-api.version>2.5</servlet-api.version> - <!--<ecomp.version>3.3.6</ecomp.version>--> <artifact-generator-api.version>1.1.0-SNAPSHOT</artifact-generator-api.version> <artifact-generator-core.version>1.1.0-SNAPSHOT</artifact-generator-core.version> <ecomp.version>1.1.0-SNAPSHOT</ecomp.version> diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_setup_configuration.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_setup_configuration.rb index 2c4a786d34..44c9f2d454 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_setup_configuration.rb +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_setup_configuration.rb @@ -19,6 +19,7 @@ end template "catalog-be-config" do path "/var/lib/jetty/config/catalog-be/configuration.yaml" source "BE-configuration.yaml.erb" + cookbook "sdc-os-common" owner "jetty" group "jetty" mode "0755" @@ -28,7 +29,8 @@ template "catalog-be-config" do :ssl_port => node['BE'][:https_port], :cassandra_ip => node['Nodes']['CS'], :rep_factor => 1, - :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment + :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment, + :titan_Path => "/var/lib/jetty/config/catalog-be/" }) end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb index e71f6a9e23..7972d746ab 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb @@ -42,3 +42,5 @@ createTopic: startDistributionEngine: true +#This is false by default, since ONAP Dmaap currently doesn't support https +useHttpsWithDmaap: false
\ No newline at end of file diff --git a/sdc-os-chef/sdc-os-common/.gitignore b/sdc-os-chef/sdc-os-common/.gitignore new file mode 100644 index 0000000000..febee30092 --- /dev/null +++ b/sdc-os-chef/sdc-os-common/.gitignore @@ -0,0 +1,21 @@ +.vagrant +*~ +*# +.#* +\#*# +.*.sw[a-z] +*.un~ + +# Bundler +Gemfile.lock +bin/* +.bundle/* + +# test kitchen +.kitchen/ +.kitchen.local.yml + +# Chef +Berksfile.lock +.zero-knife.rb +Policyfile.lock.json diff --git a/sdc-os-chef/sdc-os-common/.kitchen.yml b/sdc-os-chef/sdc-os-common/.kitchen.yml new file mode 100644 index 0000000000..8df250ec0c --- /dev/null +++ b/sdc-os-chef/sdc-os-common/.kitchen.yml @@ -0,0 +1,26 @@ +--- +driver: + name: vagrant + +provisioner: + name: chef_zero + # You may wish to disable always updating cookbooks in CI or other testing environments. + # For example: + # always_update_cookbooks: <%= !ENV['CI'] %> + always_update_cookbooks: true + +verifier: + name: inspec + +platforms: + - name: ubuntu-16.04 + - name: centos-7.3 + +suites: + - name: default + run_list: + - recipe[sdc-os-common::default] + verifier: + inspec_tests: + - test/smoke/default + attributes: diff --git a/sdc-os-chef/sdc-os-common/Berksfile b/sdc-os-chef/sdc-os-common/Berksfile new file mode 100644 index 0000000000..34fea2166b --- /dev/null +++ b/sdc-os-chef/sdc-os-common/Berksfile @@ -0,0 +1,3 @@ +source 'https://supermarket.chef.io' + +metadata diff --git a/sdc-os-chef/sdc-os-common/README.md b/sdc-os-chef/sdc-os-common/README.md new file mode 100644 index 0000000000..eada81117d --- /dev/null +++ b/sdc-os-chef/sdc-os-common/README.md @@ -0,0 +1,4 @@ +# sdc-os-common + +TODO: Enter the cookbook description here. + diff --git a/sdc-os-chef/sdc-os-common/chefignore b/sdc-os-chef/sdc-os-common/chefignore new file mode 100644 index 0000000000..38e7379bb8 --- /dev/null +++ b/sdc-os-chef/sdc-os-common/chefignore @@ -0,0 +1,107 @@ +# Put files/directories that should be ignored in this file when uploading +# to a chef-server or supermarket. +# Lines that start with '# ' are comments. + +# OS generated files # +###################### +.DS_Store +Icon? +nohup.out +ehthumbs.db +Thumbs.db + +# SASS # +######## +.sass-cache + +# EDITORS # +########### +\#* +.#* +*~ +*.sw[a-z] +*.bak +REVISION +TAGS* +tmtags +*_flymake.* +*_flymake +*.tmproj +.project +.settings +mkmf.log + +## COMPILED ## +############## +a.out +*.o +*.pyc +*.so +*.com +*.class +*.dll +*.exe +*/rdoc/ + +# Testing # +########### +.watchr +.rspec +spec/* +spec/fixtures/* +test/* +features/* +examples/* +Guardfile +Procfile +.kitchen* +.rubocop.yml +spec/* +Rakefile +.travis.yml +.foodcritic +.codeclimate.yml + +# SCM # +####### +.git +*/.git +.gitignore +.gitmodules +.gitconfig +.gitattributes +.svn +*/.bzr/* +*/.hg/* +*/.svn/* + +# Berkshelf # +############# +Berksfile +Berksfile.lock +cookbooks/* +tmp + +# Policyfile # +############## +Policyfile.rb +Policyfile.lock.json + +# Cookbooks # +############# +CONTRIBUTING* +CHANGELOG* +TESTING* +MAINTAINERS.toml + +# Strainer # +############ +Colanderfile +Strainerfile +.colander +.strainer + +# Vagrant # +########### +.vagrant +Vagrantfile diff --git a/sdc-os-chef/sdc-os-common/metadata.rb b/sdc-os-chef/sdc-os-common/metadata.rb new file mode 100644 index 0000000000..ff2506dfc9 --- /dev/null +++ b/sdc-os-chef/sdc-os-common/metadata.rb @@ -0,0 +1,20 @@ +name 'sdc-os-common' +maintainer 'The Authors' +maintainer_email 'you@example.com' +license 'All Rights Reserved' +description 'Installs/Configures sdc-os-common' +long_description 'Installs/Configures sdc-os-common' +version '0.1.0' +chef_version '>= 12.1' if respond_to?(:chef_version) + +# The `issues_url` points to the location where issues for this cookbook are +# tracked. A `View Issues` link will be displayed on this cookbook's page when +# uploaded to a Supermarket. +# +# issues_url 'https://github.com/<insert_org_here>/sdc-os-common/issues' + +# The `source_url` points to the development reposiory for this cookbook. A +# `View Source` link will be displayed on this cookbook's page when uploaded to +# a Supermarket. +# +# source_url 'https://github.com/<insert_org_here>/sdc-os-common' diff --git a/sdc-os-chef/sdc-os-common/recipes/default.rb b/sdc-os-chef/sdc-os-common/recipes/default.rb new file mode 100644 index 0000000000..4799ba4470 --- /dev/null +++ b/sdc-os-chef/sdc-os-common/recipes/default.rb @@ -0,0 +1,5 @@ +# +# Cookbook:: sdc-os-common +# Recipe:: default +# +# Copyright:: 2017, The Authors, All Rights Reserved. diff --git a/sdc-os-chef/sdc-os-common/spec/spec_helper.rb b/sdc-os-chef/sdc-os-common/spec/spec_helper.rb new file mode 100644 index 0000000000..1dd5126bf6 --- /dev/null +++ b/sdc-os-chef/sdc-os-common/spec/spec_helper.rb @@ -0,0 +1,2 @@ +require 'chefspec' +require 'chefspec/berkshelf' diff --git a/sdc-os-chef/sdc-os-common/spec/unit/recipes/default_spec.rb b/sdc-os-chef/sdc-os-common/spec/unit/recipes/default_spec.rb new file mode 100644 index 0000000000..bd9841f76e --- /dev/null +++ b/sdc-os-chef/sdc-os-common/spec/unit/recipes/default_spec.rb @@ -0,0 +1,22 @@ +# +# Cookbook:: sdc-os-common +# Spec:: default +# +# Copyright:: 2017, The Authors, All Rights Reserved. + +require 'spec_helper' + +describe 'sdc-os-common::default' do + context 'When all attributes are default, on an Ubuntu 16.04' do + let(:chef_run) do + # for a complete list of available platforms and versions see: + # https://github.com/customink/fauxhai/blob/master/PLATFORMS.md + runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') + runner.converge(described_recipe) + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + end +end diff --git a/sdc-os-chef/sdc-os-common/templates/default/BE-configuration.yaml.erb b/sdc-os-chef/sdc-os-common/templates/default/BE-configuration.yaml.erb new file mode 100644 index 0000000000..b26cd9019c --- /dev/null +++ b/sdc-os-chef/sdc-os-common/templates/default/BE-configuration.yaml.erb @@ -0,0 +1,589 @@ +identificationHeaderFields: + - HTTP_IV_USER + - HTTP_CSP_FIRSTNAME + - HTTP_CSP_LASTNAME + - HTTP_IV_REMOTE_ADDRESS + - HTTP_CSP_WSTYPE + + +# catalog backend hostname +beFqdn: <%= @host_ip %> + +# catalog backend http port +beHttpPort: <%= @catalog_port %> + +# catalog backend http context +beContext: /sdc/rest/config/get + +# catalog backend protocol +beProtocol: http + +# catalog backend ssl port +beSslPort: <%= @ssl_port %> +version: 1.0 +released: 2012-11-30 +toscaConformanceLevel: 3.0 +minToscaConformanceLevel: 3.0 + +titanCfgFile: <%= @titan_Path %>/titan.properties +titanInMemoryGraph: false +titanLockTimeout: 1800 +# The interval to try and reconnect to titan DB when it is down during ASDC startup: +titanReconnectIntervalInSeconds: 3 + +# The read timeout towards Titan DB when health check is invoked: +titanHealthCheckReadTimeout: 1 + +# The interval to try and reconnect to Elasticsearch when it is down during ASDC startup: + +esReconnectIntervalInSeconds: 3 +uebHealthCheckReconnectIntervalInSeconds: 15 +uebHealthCheckReadTimeout: 4 + +# Protocols +protocols: + - http + - https + +# Default imports +defaultImports: + - nodes: + file: nodes.yml + - datatypes: + file: data.yml + - capabilities: + file: capabilities.yml + - relationships: + file: relationships.yml + - groups: + file: groups.yml + - policies: + file: policies.yml +# Users +users: + tom: passwd + bob: passwd + + +cassandraConfig: + cassandraHosts: [<%= @cassandra_ip %>] + localDataCenter: + reconnectTimeout : 30000 + authenticate: true + username: asdc_user + password: Aa1234%^! + ssl: false + truststorePath : /config/.truststore + truststorePassword : Aa123456 + keySpaces: + - { name: dox, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']} + - { name: sdcaudit, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']} + - { name: sdcartifact, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']} + - { name: sdccomponent, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']} + +#Application-specific settings of ES +elasticSearch: + # Mapping of index prefix to time-based frame. For example, if below is configured: + # + # - indexPrefix: auditingevents + # creationPeriod: minute + # + # then ES object of type which is mapped to "auditingevents-*" template, and created on 2015-12-23 13:24:54, will enter "auditingevents-2015-12-23-13-24" index. + # Another object created on 2015-12-23 13:25:54, will enter "auditingevents-2015-12-23-13-25" index. + # If creationPeriod: month, both of the above will enter "auditingevents-2015-12" index. + # + # PLEASE NOTE: the timestamps are created in UTC/GMT timezone! This is needed so that timestamps will be correctly presented in Kibana. + # + # Legal values for creationPeriod - year, month, day, hour, minute, none (meaning no time-based behaviour). + # + # If no creationPeriod is configured for indexPrefix, default behavour is creationPeriod: month. + + indicesTimeFrequency: + - indexPrefix: auditingevents + creationPeriod: month + - indexPrefix: monitoring_events + creationPeriod: month +artifactTypes: + - CHEF + - PUPPET + - SHELL + - YANG + - YANG_XML + - HEAT + - BPEL + - DG_XML + - MURANO_PKG + - WORKFLOW + - NETWORK_CALL_FLOW + - TOSCA_TEMPLATE + - TOSCA_CSAR + - AAI_SERVICE_MODEL + - AAI_VF_MODEL + - AAI_VF_MODULE_MODEL + - AAI_VF_INSTANCE_MODEL + - OTHER + - SNMP_POLL + - SNMP_TRAP + - GUIDE + + +licenseTypes: + - User + - Installation + - CPU + +#Deployment artifacts placeHolder +resourceTypes: &allResourceTypes + - VFC + - CP + - VL + - VF + - VFCMT + - Abstract + +# validForResourceTypes usage +# validForResourceTypes: +# - VF +# - VL +deploymentResourceArtifacts: + + +deploymentResourceInstanceArtifacts: + heatEnv: + displayName: "HEAT ENV" + type: HEAT_ENV + description: "Auto-generated HEAT Environment deployment artifact" + fileExtension: "env" + VfHeatEnv: + displayName: "VF HEAT ENV" + type: HEAT_ENV + description: "VF Auto-generated HEAT Environment deployment artifact" + fileExtension: "env" + +#tosca artifacts placeholders +toscaArtifacts: + assetToscaTemplate: + artifactName: -template.yml + displayName: Tosca Template + type: TOSCA_TEMPLATE + description: TOSCA representation of the asset + assetToscaCsar: + artifactName: -csar.csar + displayName: Tosca Model + type: TOSCA_CSAR + description: TOSCA definition package of the asset + +#Informational artifacts placeHolder +excludeResourceCategory: + - Generic +informationalResourceArtifacts: + features: + displayName: Features + type: OTHER + capacity: + displayName: Capacity + type: OTHER + vendorTestResult: + displayName: Vendor Test Result + type: OTHER + testScripts: + displayName: Test Scripts + type: OTHER + CloudQuestionnaire: + displayName: Cloud Questionnaire (completed) + type: OTHER + HEATTemplateFromVendor: + displayName: HEAT Template from Vendor + type: HEAT + resourceSecurityTemplate: + displayName: Resource Security Template + type: OTHER + +excludeServiceCategory: + +informationalServiceArtifacts: + serviceArtifactPlan: + displayName: Service Artifact Plan + type: OTHER + summaryOfImpactsToECOMPElements: + displayName: Summary of impacts to ECOMP elements,OSSs, BSSs + type: OTHER + controlLoopFunctions: + displayName: Control Loop Functions + type: OTHER + dimensioningInfo: + displayName: Dimensioning Info + type: OTHER + affinityRules: + displayName: Affinity Rules + type: OTHER + operationalPolicies: + displayName: Operational Policies + type: OTHER + serviceSpecificPolicies: + displayName: Service-specific Policies + type: OTHER + engineeringRules: + displayName: Engineering Rules (ERD) + type: OTHER + distributionInstructions: + displayName: Distribution Instructions + type: OTHER + certificationTestResults: + displayName: TD Certification Test Results + type: OTHER + deploymentVotingRecord: + displayName: Deployment Voting Record + type: OTHER + serviceQuestionnaire: + displayName: Service Questionnaire + type: OTHER + serviceSecurityTemplate: + displayName: Service Security Template + type: OTHER + +serviceApiArtifacts: + configuration: + displayName: Configuration + type: OTHER + instantiation: + displayName: Instantiation + type: OTHER + monitoring: + displayName: Monitoring + type: OTHER + reporting: + displayName: Reporting + type: OTHER + logging: + displayName: Logging + type: OTHER + testing: + displayName: Testing + type: OTHER + + +additionalInformationMaxNumberOfKeys: 50 + +systemMonitoring: + enabled: true + isProxy: false + probeIntervalInSeconds: 15 +defaultHeatArtifactTimeoutMinutes: 60 + +serviceDeploymentArtifacts: + YANG_XML: + acceptedTypes: + - xml + VNF_CATALOG: + acceptedTypes: + - xml + MODEL_INVENTORY_PROFILE: + acceptedTypes: + - xml + MODEL_QUERY_SPEC: + acceptedTypes: + - xml + AAI_SERVICE_MODEL: + acceptedTypes: + - xml + AAI_VF_MODULE_MODEL: + acceptedTypes: + - xml + AAI_VF_INSTANCE_MODEL: + acceptedTypes: + - xml + OTHER: + acceptedTypes: + + +resourceDeploymentArtifacts: + HEAT: + acceptedTypes: + - yaml + - yml + validForResourceTypes: *allResourceTypes + HEAT_VOL: + acceptedTypes: + - yaml + - yml + validForResourceTypes: *allResourceTypes + HEAT_NET: + acceptedTypes: + - yaml + - yml + validForResourceTypes: *allResourceTypes + HEAT_NESTED: + acceptedTypes: + - yaml + - yml + validForResourceTypes: *allResourceTypes + HEAT_ARTIFACT: + acceptedTypes: + validForResourceTypes: *allResourceTypes + YANG_XML: + acceptedTypes: + - xml + validForResourceTypes: *allResourceTypes + VNF_CATALOG: + acceptedTypes: + - xml + validForResourceTypes: *allResourceTypes + VF_LICENSE: + acceptedTypes: + - xml + validForResourceTypes: *allResourceTypes + VENDOR_LICENSE: + acceptedTypes: + - xml + validForResourceTypes: *allResourceTypes + MODEL_INVENTORY_PROFILE: + acceptedTypes: + - xml + validForResourceTypes: *allResourceTypes + MODEL_QUERY_SPEC: + acceptedTypes: + - xml + validForResourceTypes: *allResourceTypes + LIFECYCLE_OPERATIONS: + acceptedTypes: + - yaml + - yml + validForResourceTypes: + - VF + - VFC + VES_EVENTS: + acceptedTypes: + - yaml + - yml + validForResourceTypes: *allResourceTypes + PERFORMANCE_COUNTER: + acceptedTypes: + - csv + validForResourceTypes: *allResourceTypes + APPC_CONFIG: + acceptedTypes: + validForResourceTypes: + - VF + #DCAE Artifacts + DCAE_TOSCA: + acceptedTypes: + - yml + - yaml + validForResourceTypes: + - VF + - VFCMT + DCAE_JSON: + acceptedTypes: + - json + validForResourceTypes: + - VF + - VFCMT + DCAE_POLICY: + acceptedTypes: + - emf + validForResourceTypes: + - VF + - VFCMT + DCAE_DOC: + acceptedTypes: + validForResourceTypes: + - VF + - VFCMT + DCAE_EVENT: + acceptedTypes: + validForResourceTypes: + - VF + - VFCMT +#AAI Artifacts + AAI_VF_MODEL: + acceptedTypes: + - xml + validForResourceTypes: + - VF + AAI_VF_MODULE_MODEL: + acceptedTypes: + - xml + validForResourceTypes: + - VF + OTHER: + acceptedTypes: + validForResourceTypes: *allResourceTypes + SNMP_POLL: + acceptedTypes: + validForResourceTypes: *allResourceTypes + SNMP_TRAP: + acceptedTypes: + validForResourceTypes: *allResourceTypes + +resourceInstanceDeploymentArtifacts: + HEAT_ENV: + acceptedTypes: + - env + VF_MODULES_METADATA: + acceptedTypes: + - json + VES_EVENTS: + acceptedTypes: + - yaml + - yml + PERFORMANCE_COUNTER: + acceptedTypes: + - csv +#DCAE_VF Instance Artifacts + DCAE_INVENTORY_TOSCA: + acceptedTypes: + - yml + - yaml + DCAE_INVENTORY_JSON: + acceptedTypes: + - json + DCAE_INVENTORY_POLICY: + acceptedTypes: + - emf + DCAE_INVENTORY_DOC: + acceptedTypes: + DCAE_INVENTORY_BLUEPRINT: + acceptedTypes: + DCAE_INVENTORY_EVENT: + acceptedTypes: + SNMP_POLL: + acceptedTypes: + validForResourceTypes: *allResourceTypes + SNMP_TRAP: + acceptedTypes: + validForResourceTypes: *allResourceTypes + +resourceInformationalArtifacts: + CHEF: + acceptedTypes: + validForResourceTypes: *allResourceTypes + PUPPET: + acceptedTypes: + validForResourceTypes: *allResourceTypes + SHELL: + acceptedTypes: + validForResourceTypes: *allResourceTypes + YANG: + acceptedTypes: + validForResourceTypes: *allResourceTypes + YANG_XML: + acceptedTypes: + validForResourceTypes: *allResourceTypes + HEAT: + acceptedTypes: + validForResourceTypes: *allResourceTypes + BPEL: + acceptedTypes: + validForResourceTypes: *allResourceTypes + DG_XML: + acceptedTypes: + validForResourceTypes: *allResourceTypes + MURANO_PKG: + acceptedTypes: + validForResourceTypes: *allResourceTypes + OTHER: + acceptedTypes: + validForResourceTypes: *allResourceTypes + SNMP_POLL: + acceptedTypes: + validForResourceTypes: *allResourceTypes + SNMP_TRAP: + acceptedTypes: + validForResourceTypes: *allResourceTypes + GUIDE: + acceptedTypes: + validForResourceTypes: + - VF + - VFC + +resourceInformationalDeployedArtifacts: + + +requirementsToFulfillBeforeCert: + +capabilitiesToConsumeBeforeCert: + +unLoggedUrls: + - /sdc2/rest/healthCheck + +cleanComponentsConfiguration: + cleanIntervalInMinutes: 1440 + componentsToClean: + - Resource + - Service + +artifactsIndex: resources + +heatEnvArtifactHeader: + "" +heatEnvArtifactFooter: + "" + +onboarding: + protocol: http + host: <%= @host_ip %> + port: <%= @catalog_port %> + downloadCsarUri: "/onboarding-api/v1.0/vendor-software-products/packages" + + +# #GSS IDNS +switchoverDetector: + gBeFqdn: + gFeFqdn: + beVip: 1.2.3.4 + feVip: 1.2.3.4 + beResolveAttempts: 3 + feResolveAttempts: 3 + enabled: false + interval: 60 + changePriorityUser: ecompasdc + changePriorityPassword: ecompasdc123 + publishNetworkUrl: + publishNetworkBody: '{"note":"comment"}' + groups: + beSet: { changePriorityUrl: "", changePriorityBody: '{"name":"","uri":"","no_ad_redirection":false,"v4groups":{"failover_groups":["","","failover_policy":["FAILALL"]},"comment":"","intended_app_proto":"DNS"}'} + feSet: { changePriorityUrl: "", changePriorityBody: '{"name":"","uri":"","no_ad_redirection":false,"v4groups":{"failover_groups":["",""],"failover_policy":["FAILALL"]},"comment":"","intended_app_proto":"DNS"}'} + +applicationL1Cache: + datatypes: + enabled: true + firstRunDelay: 10 + pollIntervalInSec: 60 + +applicationL2Cache: + enabled: true + catalogL1Cache: + enabled: true + resourcesSizeInCache: 300 + servicesSizeInCache: 200 + productsSizeInCache: 100 + queue: + syncIntervalInSecondes: 43200 + waitOnShutDownInMinutes: 10 + numberOfCacheWorkers: 4 + +toscaValidators: + stringMaxLength: 2500 + +disableAudit: false + +vfModuleProperties: + min_vf_module_instances: + forBaseModule: 1 + forNonBaseModule: 0 + max_vf_module_instances: + forBaseModule: 1 + forNonBaseModule: + initial_count: + forBaseModule: 1 + forNonBaseModule: 0 + vf_module_type: + forBaseModule: Base + forNonBaseModule: Expansion + +genericAssetNodeTypes: + VFC: org.openecomp.resource.abstract.nodes.VFC + VF : org.openecomp.resource.abstract.nodes.VF + Service: org.openecomp.resource.abstract.nodes.service + diff --git a/sdc-os-chef/sdc-os-common/test/smoke/default/default_test.rb b/sdc-os-chef/sdc-os-common/test/smoke/default/default_test.rb new file mode 100644 index 0000000000..a1f2595aab --- /dev/null +++ b/sdc-os-chef/sdc-os-common/test/smoke/default/default_test.rb @@ -0,0 +1,18 @@ +# # encoding: utf-8 + +# Inspec test for recipe sdc-os-common::default + +# The Inspec reference, with examples and extensive documentation, can be +# found at http://inspec.io/docs/reference/resources/ + +unless os.windows? + # This is an example test, replace with your own test. + describe user('root'), :skip do + it { should exist } + end +end + +# This is an example test, replace it with your own test. +describe port(80), :skip do + it { should_not be_listening } +end diff --git a/test-apis-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh b/test-apis-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh index 48560792ae..1b6f0258d6 100644 --- a/test-apis-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh +++ b/test-apis-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh @@ -46,12 +46,12 @@ function addUser () firstName=`echo $user|awk '{print $3}'` lastName=`echo $user|awk '{print $4}'` email=`echo $user|awk '{print $5}'` - curl -i -X post -d '{ "userId" : "'${userId}'", "role" : "'${role}'", "firstName" : "'${firstName}'", "lastName" : "'${lastName}'", "email" : "'${email}'" }' -H "Content-Type: application/json" -H "USER_ID: jh0003" http://${IP}:8080/sdc2/rest/v1/user + curl --noproxy '*' -i -X post -d '{ "userId" : "'${userId}'", "role" : "'${role}'", "firstName" : "'${firstName}'", "lastName" : "'${lastName}'", "email" : "'${email}'" }' -H "Content-Type: application/json" -H "USER_ID: jh0003" http://${IP}:8080/sdc2/rest/v1/user else echo "Host" $IP "Is Unreachable" fi done -curl -i -X post -d '{"consumerName": "ci","consumerSalt": "2a1f887d607d4515d4066fe0f5452a50","consumerPassword": "0a0dc557c3bf594b1a48030e3e99227580168b21f44e285c69740b8d5b13e33b"}' -H "Content-Type: application/json" -H "USER_ID: jh0003" -H "Authorization:Basic Y2k6MTIzNDU2" http://${IP}:8080/sdc2/rest/v1/consumers +curl --noproxy '*' -i -X post -d '{"consumerName": "ci","consumerSalt": "2a1f887d607d4515d4066fe0f5452a50","consumerPassword": "0a0dc557c3bf594b1a48030e3e99227580168b21f44e285c69740b8d5b13e33b"}' -H "Content-Type: application/json" -H "USER_ID: jh0003" -H "Authorization:Basic Y2k6MTIzNDU2" http://${IP}:8080/sdc2/rest/v1/consumers } diff --git a/test-apis-ci/src/main/resources/ci/scripts/userList.txt b/test-apis-ci/src/main/resources/ci/scripts/userList.txt index 92d140842c..1a2026f291 100644 --- a/test-apis-ci/src/main/resources/ci/scripts/userList.txt +++ b/test-apis-ci/src/main/resources/ci/scripts/userList.txt @@ -1 +1 @@ -export USER_LIST=( "m99121 DESIGNER" "cs0008 DESIGNER Carlos Santana" "kb0004 TESTER" "af0006 OPS" "ah0002 GOVERNOR" "m08740 DESIGNER" "m99124 TESTER" "m08743 TESTER" "m99123 OPS" "m08742 OPS" "m99125 GOVERNOR" "m08744 GOVERNOR" "m99122 ADMIN" "m08741 ADMIN" "m99126 PRODUCT_STRATEGIST" "m08745 PRODUCT_STRATEGIST" "m99127 PRODUCT_MANAGER" "m08746 PRODUCT_MANAGER" "md9897 DESIGNER" "m08748 DESIGNER" "m08749 TESTER" "be0695 DESIGNER" "er434w DESIGNER" "ya107f DESIGNER" "ds200p DESIGNER" "ak0333 ADMIN" "th0695 DESIGNER" "al714h DESIGNER" "ys9693 DESIGNER" "ss8214 DESIGNER" "bt750h DESIGNER" "rp955r DESIGNER" "ez6451 DESIGNER" "ia901h DESIGNER" "ah7840 DESIGNER" "ea394r DESIGNER" "ms656r DESIGNER" "ml636r DESIGNER" "it1721 DESIGNER" "sg473v DESIGNER" "sa997j DESIGNER" "az2497 DESIGNER" "ys189e DESIGNER" "ig642y DESIGNER" ) +export USER_LIST=( "m99121 DESIGNER Carlos Santana carlos@email.com" "cs0008 DESIGNER Carlos Santana carlos@email.com" "kb0004 TESTER Carlos Santana carlos@email.com" "af0006 OPS Carlos Santana carlos@email.com" "ah0002 GOVERNOR Carlos Santana carlos@email.com" "m08740 DESIGNER Carlos Santana carlos@email.com" "m99124 TESTER Carlos Santana carlos@email.com" "m08743 TESTER Carlos Santana carlos@email.com" "m99123 OPS Carlos Santana carlos@email.com" "m08742 OPS" "m99125 GOVERNOR Carlos Santana carlos@email.com" "m08744 GOVERNOR Carlos Santana carlos@email.com" "m99122 ADMIN Carlos Santana carlos@email.com" "m08741 ADMIN Carlos Santana carlos@email.com" "m99126 PRODUCT_STRATEGIST Carlos Santana carlos@email.com" "m08745 PRODUCT_STRATEGISTCarlos Santana carlos@email.com" "m99127 PRODUCT_MANAGER Carlos Santana carlos@email.com" "m08746 PRODUCT_MANAGER Carlos Santana carlos@email.com" "md9897 DESIGNER Carlos Santana carlos@email.com" "m08748 DESIGNER Carlos Santana carlos@email.com" "m08749 TESTER Carlos Santana carlos@email.com" "be0695 DESIGNER Carlos Santana carlos@email.com" "er434w DESIGNER Carlos Santana carlos@email.com" "ya107f DESIGNER Carlos Santana carlos@email.com" "ds200p DESIGNER Carlos Santana carlos@email.com" "ak0333 ADMIN Carlos Santana carlos@email.com" "th0695 DESIGNER Carlos Santana carlos@email.com" "al714h DESIGNER Carlos Santana carlos@email.com" "ys9693 DESIGNER Carlos Santana carlos@email.com" "ss8214 DESIGNER Carlos Santana carlos@email.com" "bt750h DESIGNER Carlos Santana carlos@email.com" "rp955r DESIGNER Carlos Santana carlos@email.com" "ez6451 DESIGNER Carlos Santana carlos@email.com" "ia901h DESIGNER Carlos Santana carlos@email.com" "ah7840 DESIGNER Carlos Santana carlos@email.com" "ea394r DESIGNER Carlos Santana carlos@email.com" "ms656r DESIGNER Carlos Santana carlos@email.com" "ml636r DESIGNER Carlos Santana carlos@email.com" "it1721 DESIGNER Carlos Santana carlos@email.com" "sg473v DESIGNER Carlos Santana carlos@email.com" "sa997j DESIGNER Carlos Santana carlos@email.com" "az2497 DESIGNER Carlos Santana carlos@email.com" "ys189e DESIGNER Carlos Santana carlos@email.com" "ig642y DESIGNER Carlos Santana carlos@email.com")
\ No newline at end of file diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java index 710188af43..b1cd09c6d8 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java @@ -58,8 +58,17 @@ public class AdminUserManagment extends SetupCDTest { @DataProvider(name = "searchValues") private final Object[][] searchString(){ User newUser = createNewUserUsingAPI(); + GeneralUIUtils.getDriver().navigate().refresh(); return new Object[][]{{newUser.getUserId(), newUser}, {newUser.getFirstName(), newUser}, {newUser.getLastName(), newUser}, {newUser.getEmail(), newUser}}; } + + //TC915101 + @Test(dataProvider = "searchValues") + public void searchUserByCriterionsTest(String searchCriterion, User user) throws IOException{ + setLog(searchCriterion); + AdminWorkspaceUIUtilies.searchForUser(searchCriterion); + UserManagementVerificator.validateFirstRowDisplayedCorrectly(user); + } //TC915100 @Test @@ -137,13 +146,7 @@ public class AdminUserManagment extends SetupCDTest { Assert.assertEquals(inputErrors.size() - 1 , inputErrorsSize, "Did not find an error : " + expectedErrorMsg); } - //TC915101 - @Test(dataProvider = "searchValues") - public void searchUserByCriterionsTest(String searchCriterion, User user) throws IOException{ - setLog(searchCriterion); - AdminWorkspaceUIUtilies.searchForUser(searchCriterion); - UserManagementVerificator.validateFirstRowDisplayedCorrectly(user); - } + //TC915101 @Test @@ -253,7 +256,7 @@ public class AdminUserManagment extends SetupCDTest { private User createNewUserUsingAPI() { UserRoleEnum role = UserRoleEnum.DESIGNER; String userId = generateValidUserId(); - User userByEnv = new User("Tzemer", "Gefen", userId, "userId@intl.sdc.com", role.name(), null); + User userByEnv = new User(generateValidUserId(), generateValidUserId(), userId, generateValidUserId()+"@intl.sdc.com", role.name(), null); User adminUser = getUserByEnv(UserRoleEnum.ADMIN); try { RestResponse createUserResp = UserRestUtils.createUser(userByEnv, adminUser); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java index 05cef22706..fddb97ace3 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java @@ -28,16 +28,12 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; import java.util.stream.Collectors; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; -import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager; @@ -65,9 +61,8 @@ import org.testng.annotations.Optional; import org.testng.annotations.Parameters; import org.testng.annotations.Test; -import com.clearspring.analytics.util.Pair; import com.aventstack.extentreports.Status; -import com.aventstack.extentreports.ExtentTest; +import com.clearspring.analytics.util.Pair; public class Onboard extends SetupCDTest { @@ -113,9 +108,9 @@ public class Onboard extends SetupCDTest { @Test public void onboardVNFTestSanity() throws Exception, Throwable { -// String filepath = getFilePath(); -// String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; String filepath = getFilePath(); +// String vnfFile = "2016-012_vMX_AV_30_1072_e2e.zip"; +// String filepath = getFilePath(); Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); String vnfFile = fileNamesFromFolder[0].toString(); runOnboardToDistributionFlow(filepath, vnfFile); @@ -159,6 +154,9 @@ public class Onboard extends SetupCDTest { GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); GovernorOperationPage.approveSerivce(serviceMetadata.getName()); + if (makeDistributionValue.equals("true")){ + + reloginWithNewRole(UserRoleEnum.OPS); GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); OpsOperationPage.distributeService(); @@ -171,6 +169,8 @@ public class Onboard extends SetupCDTest { // validateInputArtsVSouput(serviceMetadata.getName()); + } + getExtendTest().log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile)); } @@ -255,7 +255,7 @@ public class Onboard extends SetupCDTest { GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); GovernorOperationPage.approveSerivce(serviceMetadata.getName()); - if (!makeDistributionValue.equals("true")){ + reloginWithNewRole(UserRoleEnum.OPS); GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); @@ -266,7 +266,7 @@ public class Onboard extends SetupCDTest { AssertJUnit.assertEquals(1, rowsFromMonitorTable.size()); OpsOperationPage.waitUntilArtifactsDistributed(0); - } + getExtendTest().log(Status.INFO, String.format("onboarding %s test is passed ! ", vnfFile)); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java index 63e6e086d6..d5920a22ca 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java @@ -293,12 +293,7 @@ public class Service extends SetupCDTest { } @Test - public void ManagmentWorkflowTest() throws Exception{ - - if(true){ - throw new SkipException("Open bug 287416"); - } - + public void ManagmentWorkflowTest() throws Exception{ String descriptionText = DESCRIPTION, descriptionTextEdit = "kuku2"; @@ -578,12 +573,7 @@ public class Service extends SetupCDTest { } @Test - public void deploymentViewServiceTest() throws Exception{ - - if(true){ - throw new SkipException("Open bug 295220, 295180"); - } - + public void deploymentViewServiceTest() throws Exception{ String fileName2 = "vSeGW.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); @@ -607,7 +597,7 @@ public class Service extends SetupCDTest { String instanceModuleText = instanceModule.getText(); ResourceUIUtils.clickOnElementByText(instanceModuleText, "instance"); - ServiceVerificator.verifyDeploymentPageSubElements(instanceModuleText.split("\\.\\.")[1], new DeploymentViewVerificator(filePath + fileName2)); + ServiceVerificator.verifyDeploymentPageSubElements(instanceModuleText.split("\\.\\.")[2], new DeploymentViewVerificator(filePath + fileName2)); ServiceVerificator.verifyDisabledServiceProperties(); String isBaseValue = ServiceVerificator.getVFModulePropertieValue(serviceMetadata, "isBase", instanceModuleText); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java index 0fc9ef59b7..22396ec9c7 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java @@ -65,7 +65,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); } @@ -86,7 +86,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName,folder, deploymentArtifacts, null); } @@ -105,7 +105,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); @@ -127,7 +127,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); @@ -156,7 +156,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); @@ -183,7 +183,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1")); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); } @@ -202,7 +202,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); informationalArtifacts.add(new ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1")); @@ -266,8 +266,8 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); - deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "4")); importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); @@ -289,8 +289,8 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); - deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "4")); ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"); deploymentArtifacts.add(artifactInfo); @@ -316,8 +316,8 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); - deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "4")); ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"); deploymentArtifacts.add(artifactInfo); @@ -346,7 +346,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); @@ -374,7 +374,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"); @@ -408,7 +408,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"); @@ -438,7 +438,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1")); deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); @@ -541,7 +541,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); @@ -572,7 +572,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); @@ -601,7 +601,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); @@ -680,7 +680,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); @@ -725,7 +725,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); } @@ -741,8 +741,8 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { String updatedCsarFileName = "UpdateTC1444533.csar"; List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); - deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); - deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "4")); updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, updatedCsarFileName, deploymentArtifacts, null, null, null); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java index dfb4b74fac..95fbefa040 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java @@ -35,6 +35,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.UUID; +import java.util.stream.Collectors; import org.apache.commons.io.IOUtils; import org.apache.http.HttpEntity; @@ -766,19 +767,37 @@ public class OnboardingUtils { LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment")); ArtifactsCorrelationManager.addVNFartifactDetails(vspName, deploymentArtifacts); + List<String> heatEnvFilesFromCSAR = deploymentArtifacts.stream().filter(e -> e.getType().equals("HEAT_ENV")). + map(e -> e.getFileName()). + collect(Collectors.toList()); + + validateDeploymentArtifactsVersion(deploymentArtifacts, heatEnvFilesFromCSAR); + + DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); + return createVendorSoftwareProduct; + } + + public static void validateDeploymentArtifactsVersion(LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts, + List<String> heatEnvFilesFromCSAR) { + String artifactVersion; + String artifactName; + for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) { + artifactVersion = "1"; + if(deploymentArtifact.getType().equals("HEAT_ENV")) { continue; } else if(deploymentArtifact.getFileName().contains(".")) { - ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")), "1", deploymentArtifact.getType()); + artifactName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")); } else { - ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim(), "1", deploymentArtifact.getType()); + artifactName = deploymentArtifact.getFileName().trim(); } + if (heatEnvFilesFromCSAR.contains(artifactName + ".env")){ + artifactVersion = "2"; + } + ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType()); } - - DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); - return createVendorSoftwareProduct; } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java index 2c1f59fe9f..2c133e6246 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java @@ -60,6 +60,7 @@ import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; +import org.testng.SkipException; import com.aventstack.extentreports.Status; @@ -269,6 +270,11 @@ public class ServiceVerificator { } else if (propertyName.equals("max_vf_module_instances")) { actualNumber = baseNumber + 1; } else if (propertyName.equals("min_vf_module_instances")){ + + if(true){ + throw new SkipException("Open bug 305331"); + } + actualNumber = baseNumber - 1; } diff --git a/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh b/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh index 48560792ae..1b6f0258d6 100644 --- a/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh +++ b/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh @@ -46,12 +46,12 @@ function addUser () firstName=`echo $user|awk '{print $3}'` lastName=`echo $user|awk '{print $4}'` email=`echo $user|awk '{print $5}'` - curl -i -X post -d '{ "userId" : "'${userId}'", "role" : "'${role}'", "firstName" : "'${firstName}'", "lastName" : "'${lastName}'", "email" : "'${email}'" }' -H "Content-Type: application/json" -H "USER_ID: jh0003" http://${IP}:8080/sdc2/rest/v1/user + curl --noproxy '*' -i -X post -d '{ "userId" : "'${userId}'", "role" : "'${role}'", "firstName" : "'${firstName}'", "lastName" : "'${lastName}'", "email" : "'${email}'" }' -H "Content-Type: application/json" -H "USER_ID: jh0003" http://${IP}:8080/sdc2/rest/v1/user else echo "Host" $IP "Is Unreachable" fi done -curl -i -X post -d '{"consumerName": "ci","consumerSalt": "2a1f887d607d4515d4066fe0f5452a50","consumerPassword": "0a0dc557c3bf594b1a48030e3e99227580168b21f44e285c69740b8d5b13e33b"}' -H "Content-Type: application/json" -H "USER_ID: jh0003" -H "Authorization:Basic Y2k6MTIzNDU2" http://${IP}:8080/sdc2/rest/v1/consumers +curl --noproxy '*' -i -X post -d '{"consumerName": "ci","consumerSalt": "2a1f887d607d4515d4066fe0f5452a50","consumerPassword": "0a0dc557c3bf594b1a48030e3e99227580168b21f44e285c69740b8d5b13e33b"}' -H "Content-Type: application/json" -H "USER_ID: jh0003" -H "Authorization:Basic Y2k6MTIzNDU2" http://${IP}:8080/sdc2/rest/v1/consumers } diff --git a/ui-ci/src/main/resources/ci/scripts/userList.txt b/ui-ci/src/main/resources/ci/scripts/userList.txt index 92d140842c..1a2026f291 100644 --- a/ui-ci/src/main/resources/ci/scripts/userList.txt +++ b/ui-ci/src/main/resources/ci/scripts/userList.txt @@ -1 +1 @@ -export USER_LIST=( "m99121 DESIGNER" "cs0008 DESIGNER Carlos Santana" "kb0004 TESTER" "af0006 OPS" "ah0002 GOVERNOR" "m08740 DESIGNER" "m99124 TESTER" "m08743 TESTER" "m99123 OPS" "m08742 OPS" "m99125 GOVERNOR" "m08744 GOVERNOR" "m99122 ADMIN" "m08741 ADMIN" "m99126 PRODUCT_STRATEGIST" "m08745 PRODUCT_STRATEGIST" "m99127 PRODUCT_MANAGER" "m08746 PRODUCT_MANAGER" "md9897 DESIGNER" "m08748 DESIGNER" "m08749 TESTER" "be0695 DESIGNER" "er434w DESIGNER" "ya107f DESIGNER" "ds200p DESIGNER" "ak0333 ADMIN" "th0695 DESIGNER" "al714h DESIGNER" "ys9693 DESIGNER" "ss8214 DESIGNER" "bt750h DESIGNER" "rp955r DESIGNER" "ez6451 DESIGNER" "ia901h DESIGNER" "ah7840 DESIGNER" "ea394r DESIGNER" "ms656r DESIGNER" "ml636r DESIGNER" "it1721 DESIGNER" "sg473v DESIGNER" "sa997j DESIGNER" "az2497 DESIGNER" "ys189e DESIGNER" "ig642y DESIGNER" ) +export USER_LIST=( "m99121 DESIGNER Carlos Santana carlos@email.com" "cs0008 DESIGNER Carlos Santana carlos@email.com" "kb0004 TESTER Carlos Santana carlos@email.com" "af0006 OPS Carlos Santana carlos@email.com" "ah0002 GOVERNOR Carlos Santana carlos@email.com" "m08740 DESIGNER Carlos Santana carlos@email.com" "m99124 TESTER Carlos Santana carlos@email.com" "m08743 TESTER Carlos Santana carlos@email.com" "m99123 OPS Carlos Santana carlos@email.com" "m08742 OPS" "m99125 GOVERNOR Carlos Santana carlos@email.com" "m08744 GOVERNOR Carlos Santana carlos@email.com" "m99122 ADMIN Carlos Santana carlos@email.com" "m08741 ADMIN Carlos Santana carlos@email.com" "m99126 PRODUCT_STRATEGIST Carlos Santana carlos@email.com" "m08745 PRODUCT_STRATEGISTCarlos Santana carlos@email.com" "m99127 PRODUCT_MANAGER Carlos Santana carlos@email.com" "m08746 PRODUCT_MANAGER Carlos Santana carlos@email.com" "md9897 DESIGNER Carlos Santana carlos@email.com" "m08748 DESIGNER Carlos Santana carlos@email.com" "m08749 TESTER Carlos Santana carlos@email.com" "be0695 DESIGNER Carlos Santana carlos@email.com" "er434w DESIGNER Carlos Santana carlos@email.com" "ya107f DESIGNER Carlos Santana carlos@email.com" "ds200p DESIGNER Carlos Santana carlos@email.com" "ak0333 ADMIN Carlos Santana carlos@email.com" "th0695 DESIGNER Carlos Santana carlos@email.com" "al714h DESIGNER Carlos Santana carlos@email.com" "ys9693 DESIGNER Carlos Santana carlos@email.com" "ss8214 DESIGNER Carlos Santana carlos@email.com" "bt750h DESIGNER Carlos Santana carlos@email.com" "rp955r DESIGNER Carlos Santana carlos@email.com" "ez6451 DESIGNER Carlos Santana carlos@email.com" "ia901h DESIGNER Carlos Santana carlos@email.com" "ah7840 DESIGNER Carlos Santana carlos@email.com" "ea394r DESIGNER Carlos Santana carlos@email.com" "ms656r DESIGNER Carlos Santana carlos@email.com" "ml636r DESIGNER Carlos Santana carlos@email.com" "it1721 DESIGNER Carlos Santana carlos@email.com" "sg473v DESIGNER Carlos Santana carlos@email.com" "sa997j DESIGNER Carlos Santana carlos@email.com" "az2497 DESIGNER Carlos Santana carlos@email.com" "ys189e DESIGNER Carlos Santana carlos@email.com" "ig642y DESIGNER Carlos Santana carlos@email.com")
\ No newline at end of file |