aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-08-10 12:08:45 +0300
committerMichael Lando <ml636r@att.com>2017-08-10 12:08:45 +0300
commit46f9fd57f24428f6a6fd0d290b0463e188975231 (patch)
tree7805037b80cbabf61bafc719e2d63b0dfff8f751
parent7f7925e39cf2f428061d161bc4ffe67cad80c76e (diff)
[SDC] code sync
Change-Id: Ia33a7874802b8ac2f49aed9199e109ea509e950e Signed-off-by: Michael Lando <ml636r@att.com>
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java159
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/CsarInfo.java17
-rw-r--r--catalog-ui/src/app/directives/file-opener/file-opener.ts5
-rw-r--r--catalog-ui/src/app/ng2/components/properties-table/dynamic-property/dynamic-property.component.html3
-rw-r--r--catalog-ui/src/app/ng2/components/properties-table/dynamic-property/dynamic-property.component.ts42
-rw-r--r--catalog-ui/src/app/services/onboarding-service.ts16
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts56
-rw-r--r--catalog-ui/src/assets/styles/global.less1
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java27
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaParameterConstants.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java8
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java146
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java66
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java6
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java140
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java30
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java7
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java77
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java9
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java17
23 files changed, 522 insertions, 320 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
index 383f1eb2ec..82382f961d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
@@ -526,11 +526,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
String yamlFileName = toscaYamlCsarStatus.left().value().getKey();
String yamlFileContents = toscaYamlCsarStatus.left().value().getValue();
- CsarInfo csarInfo = new CsarInfo(newRresource.getName(), user, csarUUID, csar.left().value(), true);
- Map<String, NodeTypeInfo> nodeTypesInfo = extractNodeTypesInfo(csar.left().value(), yamlFileContents);
- Either<Resource, ResponseFormat> result =null;
+ CsarInfo csarInfo = new CsarInfo(newRresource.getName(), user, csarUUID, csar.left().value(), yamlFileContents, true);
+ Map<String, NodeTypeInfo> nodeTypesInfo = extractNodeTypesInfo(csarInfo);
+ Either<Resource, ResponseFormat> result = null;
- Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandleRes = findNodeTypesArtifactsToHandle(nodeTypesInfo, csarInfo.getCsar(), csarInfo.getCsarUUID(), yamlFileName, oldRresource, csarInfo.getModifier());
+ Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandleRes = findNodeTypesArtifactsToHandle(nodeTypesInfo, csarInfo, oldRresource);
if (findNodeTypesArtifactsToHandleRes.isRight()) {
log.debug("failed to find node types for update with artifacts during import csar {}. ", csarInfo.getCsarUUID());
result = Either.right(findNodeTypesArtifactsToHandleRes.right().value());
@@ -566,14 +566,14 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
private Either<Resource, ResponseFormat> updateResourceFromYaml(Resource oldRresource, Resource newRresource, AuditingActionEnum updateResource, List<ArtifactDefinition> createdArtifacts,
boolean isUpdateYaml, String yamlFileName, String yamlFileContent, CsarInfo csarInfo, Map<String, NodeTypeInfo> nodeTypesInfo,
Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle, String nodeName) {
- Either<Resource, ResponseFormat> result = null;
+ Either<Resource, ResponseFormat> result;
Either<Map<String, Resource>, ResponseFormat> parseNodeTypeInfoYamlEither;
boolean inTransaction = true;
boolean shouldLock = false;
- Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> prepareForUpdate = null;
- Resource preparedResource = null;
- Either<ParsedToscaYamlInfo, ResponseFormat> uploadComponentInstanceInfoMap = parseResourceInfoFromYaml(yamlFileName, newRresource, yamlFileContent, csarInfo.getModifier(), csarInfo.getCreatedNodesToscaResourceNames(), nodeTypesInfo, nodeName);
+ Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> prepareForUpdate;
+ Resource preparedResource;
+ Either<ParsedToscaYamlInfo, ResponseFormat> uploadComponentInstanceInfoMap = parseResourceInfoFromYaml(yamlFileName, newRresource, yamlFileContent, csarInfo.getCreatedNodesToscaResourceNames(), nodeTypesInfo, nodeName);
if (uploadComponentInstanceInfoMap.isRight()) {
ResponseFormat responseFormat = uploadComponentInstanceInfoMap.right().value();
componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), newRresource, "", "", updateResource, null);
@@ -687,18 +687,18 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
return result;
}
- private Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandle(Map<String, NodeTypeInfo> nodeTypesInfo, Map<String, byte[]> csar, String csarUUID, String yamlFileName, Resource oldResource, User user) {
+ private Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandle(Map<String, NodeTypeInfo> nodeTypesInfo, CsarInfo csarInfo, Resource oldResource) {
- Map<String, List<ArtifactDefinition>> extractedVfcsArtifacts = CsarUtils.extractVfcsArtifactsFromCsar(csar);
+ Map<String, List<ArtifactDefinition>> extractedVfcsArtifacts = CsarUtils.extractVfcsArtifactsFromCsar(csarInfo.getCsar());
Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = new HashMap<>();
Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> nodeTypesArtifactsToHandleRes;
try {
nodeTypesArtifactsToHandleRes = Either.left(nodeTypesArtifactsToHandle);
- Map<String, String> extractedVfcToscaNames = extractVfcToscaNames(nodeTypesInfo, yamlFileName, oldResource.getName());
+ Map<String, String> extractedVfcToscaNames = extractVfcToscaNames(nodeTypesInfo, oldResource.getName(), csarInfo);
Either<EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>, ResponseFormat> curNodeTypeArtifactsToHandleRes;
EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>> curNodeTypeArtifactsToHandle = null;
- log.debug("Going to fetch node types for resource with name {} during import csar with UUID {}. ", oldResource.getName(), csarUUID);
+ log.debug("Going to fetch node types for resource with name {} during import csar with UUID {}. ", oldResource.getName(), csarInfo.getCsarUUID());
for (Entry<String, String> currVfcToscaNameEntry : extractedVfcToscaNames.entrySet()) {
String currVfcToscaName = currVfcToscaNameEntry.getValue();
@@ -709,8 +709,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
Resource curNodeType = null;
if (curVfcRes.isRight() && curVfcRes.right().value() != StorageOperationStatus.NOT_FOUND) {
log.debug("Error occured during fetching node type with tosca name {}, error: {}", currVfcToscaName, curVfcRes.right().value());
- ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(curVfcRes.right().value()), csarUUID);
- componentsUtils.auditResource(responseFormat, user, oldResource, "", "", AuditingActionEnum.CREATE_RESOURCE, null);
+ ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(curVfcRes.right().value()), csarInfo.getCsarUUID());
+ componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), oldResource, "", "", AuditingActionEnum.CREATE_RESOURCE, null);
nodeTypesArtifactsToHandleRes = Either.right(responseFormat);
break;
} else if (curVfcRes.isLeft()) {
@@ -905,10 +905,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
return handleNodeTypeArtifactsRes;
}
- private Map<String, String> extractVfcToscaNames(Map<String, NodeTypeInfo> nodeTypesInfo, String yamlFileName, String vfResourceName) {
+ private Map<String, String> extractVfcToscaNames(Map<String, NodeTypeInfo> nodeTypesInfo, String vfResourceName, CsarInfo csarInfo) {
Map<String, String> vfcToscaNames = new HashMap<>();
- Map<String, Object> nodes = extractAllNodes(nodeTypesInfo);
+ Map<String, Object> nodes = extractAllNodes(nodeTypesInfo, csarInfo);
if (!nodes.isEmpty()) {
Iterator<Entry<String, Object>> nodesNameEntry = nodes.entrySet().iterator();
while (nodesNameEntry.hasNext()) {
@@ -920,17 +920,22 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
return vfcToscaNames;
}
- private Map<String, Object> extractAllNodes(Map<String, NodeTypeInfo> nodeTypesInfo) {
+ private Map<String, Object> extractAllNodes(Map<String, NodeTypeInfo> nodeTypesInfo, CsarInfo csarInfo) {
Map<String, Object> nodes = new HashMap<>();
for(NodeTypeInfo nodeTypeInfo: nodeTypesInfo.values()){
- Either<Map<String, Object>, ResultStatusEnum> eitherNodeTypes = ImportUtils.findFirstToscaMapElement(nodeTypeInfo.getMappedToscaTemplate(), ToscaTagNamesEnum.NODE_TYPES);
- if (eitherNodeTypes.isLeft()) {
- nodes.putAll(eitherNodeTypes.left().value());
- }
+ extractNodeTypes(nodes, nodeTypeInfo.getMappedToscaTemplate());
}
+ extractNodeTypes(nodes, csarInfo.getMappedToscaMainTemplate());
return nodes;
}
+ private void extractNodeTypes(Map<String, Object> nodes, Map<String, Object> mappedToscaTemplate) {
+ Either<Map<String, Object>, ResultStatusEnum> eitherNodeTypes = ImportUtils.findFirstToscaMapElement(mappedToscaTemplate, ToscaTagNamesEnum.NODE_TYPES);
+ if (eitherNodeTypes.isLeft()) {
+ nodes.putAll(eitherNodeTypes.left().value());
+ }
+ }
+
public Either<Resource, ResponseFormat> createResourceFromCsar(Resource resource, User user, Either<Map<String, byte[]>, StorageOperationStatus> csarUIPayload, String csarUUID) {
log.trace("************* created successfully from YAML, resource TOSCA ");
@@ -956,9 +961,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
String yamlFileContents = toscaYamlCsarStatus.left().value().getValue();
log.trace("YAML topology file found in CSAR, file name: {}, contents: {}", yamlFileName, yamlFileContents);
- Map<String, NodeTypeInfo> nodeTypesInfo = extractNodeTypesInfo(csar.left().value(), yamlFileContents);
- CsarInfo csarInfo = new CsarInfo(resource.getName(), user, csarUUID, csar.left().value(), false);
- Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandleRes = findNodeTypesArtifactsToHandle(nodeTypesInfo, csarInfo.getCsar(), csarInfo.getCsarUUID(), yamlFileName, resource, csarInfo.getModifier());
+ CsarInfo csarInfo = new CsarInfo(resource.getName(), user, csarUUID, csar.left().value(), yamlFileContents, false);
+ Map<String, NodeTypeInfo> nodeTypesInfo = extractNodeTypesInfo(csarInfo);
+ Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandleRes = findNodeTypesArtifactsToHandle(nodeTypesInfo, csarInfo, resource);
if (findNodeTypesArtifactsToHandleRes.isRight()) {
log.debug("failed to find node types for update with artifacts during import csar {}. ", csarInfo.getCsarUUID());
return Either.right(findNodeTypesArtifactsToHandleRes.right().value());
@@ -974,60 +979,69 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
return Either.left(vfResource);
}
- @SuppressWarnings("unchecked")
- private Map<String, NodeTypeInfo> extractNodeTypesInfo(Map<String, byte[]> csar, String yamlFileContent) {
+ private Map<String, NodeTypeInfo> extractNodeTypesInfo(CsarInfo csarInfo) {
Map<String, NodeTypeInfo> nodeTypesInfo = new HashMap<>();
List<Entry<String, byte[]>> globalSubstitutes = new ArrayList<>();
- for (Map.Entry<String, byte[]> entry : csar.entrySet()) {
- if (Pattern.compile(CsarUtils.SERVICE_TEMPLATE_PATH_PATTERN).matcher(entry.getKey()).matches()) {
- if (!isGlobalSubstitute(entry.getKey())) {
- String yamlFileContents = new String(entry.getValue());
- Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(yamlFileContents);
- Either<Object, ResultStatusEnum> substitutionMappingsEither = ImportUtils.findToscaElement(mappedToscaTemplate, ToscaTagNamesEnum.SUBSTITUTION_MAPPINGS, ToscaElementTypeEnum.MAP);
- if (substitutionMappingsEither.isLeft()) {
- Map<String, Object> substitutionMappings = (Map<String, Object>) substitutionMappingsEither.left().value();
- if (substitutionMappings.containsKey(ToscaTagNamesEnum.NODE_TYPE.getElementName())) {
- NodeTypeInfo nodeTypeInfo = new NodeTypeInfo();
- nodeTypeInfo.setType((String) substitutionMappings.get(ToscaTagNamesEnum.NODE_TYPE.getElementName()));
- nodeTypeInfo.setTemplateFileName(entry.getKey());
- nodeTypeInfo.setMappedToscaTemplate(mappedToscaTemplate);
- nodeTypesInfo.put(nodeTypeInfo.getType(), nodeTypeInfo);
+ for (Map.Entry<String, byte[]> entry : csarInfo.getCsar().entrySet()) {
+ extractNodeTypeInfo(nodeTypesInfo, globalSubstitutes, entry);
+ }
+ if (CollectionUtils.isNotEmpty(globalSubstitutes)) {
+ setDerivedFrom(nodeTypesInfo, globalSubstitutes);
+ }
+ markNestedVfc(csarInfo.getMappedToscaMainTemplate(), nodeTypesInfo);
+ return nodeTypesInfo;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void setDerivedFrom(Map<String, NodeTypeInfo> nodeTypesInfo, List<Entry<String, byte[]>> globalSubstitutes) {
+ for (Map.Entry<String, byte[]> entry : globalSubstitutes) {
+ String yamlFileContents = new String(entry.getValue());
+ Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(yamlFileContents);
+ Either<Object, ResultStatusEnum> nodeTypesEither = ImportUtils.findToscaElement(mappedToscaTemplate, ToscaTagNamesEnum.NODE_TYPES, ToscaElementTypeEnum.MAP);
+ if (nodeTypesEither.isLeft()) {
+ Map<String, Object> nodeTypes = (Map<String, Object>) nodeTypesEither.left().value();
+ for (Entry<String, Object> nodeType : nodeTypes.entrySet()) {
+ Map<String, Object> nodeTypeMap = (Map<String, Object>) nodeType.getValue();
+ if (nodeTypeMap.containsKey(ToscaTagNamesEnum.DERIVED_FROM.getElementName())) {
+ if (nodeTypesInfo.containsKey(nodeType.getKey())) {
+ NodeTypeInfo nodeTypeInfo = nodeTypesInfo.get(nodeType.getKey());
+ List<String> derivedFrom = new ArrayList<>();
+ derivedFrom.add((String) nodeTypeMap.get(ToscaTagNamesEnum.DERIVED_FROM.getElementName()));
+ nodeTypeInfo.setDerivedFrom(derivedFrom);
}
}
- } else {
- globalSubstitutes.add(entry);
}
}
}
- if (CollectionUtils.isNotEmpty(globalSubstitutes)) {
- for (Map.Entry<String, byte[]> entry : globalSubstitutes) {
+ }
+
+ @SuppressWarnings("unchecked")
+ private void extractNodeTypeInfo(Map<String, NodeTypeInfo> nodeTypesInfo,
+ List<Entry<String, byte[]>> globalSubstitutes, Map.Entry<String, byte[]> entry) {
+ if (Pattern.compile(CsarUtils.SERVICE_TEMPLATE_PATH_PATTERN).matcher(entry.getKey()).matches()) {
+ if (!isGlobalSubstitute(entry.getKey())) {
String yamlFileContents = new String(entry.getValue());
Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(yamlFileContents);
- Either<Object, ResultStatusEnum> nodeTypesEither = ImportUtils.findToscaElement(mappedToscaTemplate, ToscaTagNamesEnum.NODE_TYPES, ToscaElementTypeEnum.MAP);
- if (nodeTypesEither.isLeft()) {
- Map<String, Object> nodeTypes = (Map<String, Object>) nodeTypesEither.left().value();
- for (Entry<String, Object> nodeType : nodeTypes.entrySet()) {
- Map<String, Object> nodeTypeMap = (Map<String, Object>) nodeType.getValue();
- if (nodeTypeMap.containsKey(ToscaTagNamesEnum.DERIVED_FROM.getElementName())) {
- if (nodeTypesInfo.containsKey(nodeType.getKey())) {
- NodeTypeInfo nodeTypeInfo = nodeTypesInfo.get(nodeType.getKey());
- List<String> derivedFrom = new ArrayList<>();
- derivedFrom.add((String) nodeTypeMap.get(ToscaTagNamesEnum.DERIVED_FROM.getElementName()));
- nodeTypeInfo.setDerivedFrom(derivedFrom);
- }
- }
+ Either<Object, ResultStatusEnum> substitutionMappingsEither = ImportUtils.findToscaElement(mappedToscaTemplate, ToscaTagNamesEnum.SUBSTITUTION_MAPPINGS, ToscaElementTypeEnum.MAP);
+ if (substitutionMappingsEither.isLeft()) {
+ Map<String, Object> substitutionMappings = (Map<String, Object>) substitutionMappingsEither.left().value();
+ if (substitutionMappings.containsKey(ToscaTagNamesEnum.NODE_TYPE.getElementName())) {
+ NodeTypeInfo nodeTypeInfo = new NodeTypeInfo();
+ nodeTypeInfo.setType((String) substitutionMappings.get(ToscaTagNamesEnum.NODE_TYPE.getElementName()));
+ nodeTypeInfo.setTemplateFileName(entry.getKey());
+ nodeTypeInfo.setMappedToscaTemplate(mappedToscaTemplate);
+ nodeTypesInfo.put(nodeTypeInfo.getType(), nodeTypeInfo);
}
}
+ } else {
+ globalSubstitutes.add(entry);
}
}
- markNestedVfc(yamlFileContent, nodeTypesInfo);
- return nodeTypesInfo;
}
@SuppressWarnings("unchecked")
- private void markNestedVfc(String yamlFileContent, Map<String, NodeTypeInfo> nodeTypesInfo) {
- Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(yamlFileContent);
+ private void markNestedVfc(Map<String, Object> mappedToscaTemplate, Map<String, NodeTypeInfo> nodeTypesInfo) {
Either<Object, ResultStatusEnum> nodeTemplatesEither = ImportUtils.findToscaElement(mappedToscaTemplate, ToscaTagNamesEnum.NODE_TEMPLATES, ToscaElementTypeEnum.MAP);
if (nodeTemplatesEither.isLeft()) {
Map<String, Object> nodeTemplates = (Map<String, Object>) nodeTemplatesEither.left().value();
@@ -1110,7 +1124,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
List<ArtifactDefinition> createdArtifacts = new ArrayList<ArtifactDefinition>();
log.trace("************* createResourceFromYaml before parse yaml ");
- Either<ParsedToscaYamlInfo, ResponseFormat> parseResourceInfoFromYamlEither = parseResourceInfoFromYaml(yamlName, resource, topologyTemplateYaml, csarInfo.getModifier(), csarInfo.getCreatedNodesToscaResourceNames(), nodeTypesInfo, nodeName);
+ Either<ParsedToscaYamlInfo, ResponseFormat> parseResourceInfoFromYamlEither = parseResourceInfoFromYaml(yamlName, resource, topologyTemplateYaml, csarInfo.getCreatedNodesToscaResourceNames(), nodeTypesInfo, nodeName);
if (parseResourceInfoFromYamlEither.isRight()) {
ResponseFormat responseFormat = parseResourceInfoFromYamlEither.right().value();
componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), resource, "", "", AuditingActionEnum.IMPORT_RESOURCE, null);
@@ -1134,7 +1148,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
- public Either<Map<String, Resource>, ResponseFormat> createResourcesFromYamlNodeTypesList(String yamlName, Resource resource, String resourceYml, Map<String, Object> mappedToscaTemplate, boolean needLock,
+ public Either<Map<String, Resource>, ResponseFormat> createResourcesFromYamlNodeTypesList(String yamlName, Resource resource, Map<String, Object> mappedToscaTemplate, boolean needLock,
Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts,
Map<String, NodeTypeInfo> nodeTypesInfo, CsarInfo csarInfo) {
@@ -1187,11 +1201,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
Either<Resource, ResponseFormat> handleNestedVfcRes = Either.left(resource);
String yamlName = nodesInfo.get(nodeName).getTemplateFileName();
- String yamlContent = new String(csarInfo.getCsar().get(yamlName));
Map<String, Object> nestedVfcJsonMap = nodesInfo.get(nodeName).getMappedToscaTemplate();
log.debug("************* Going to create node types from yaml {}", yamlName);
- Either<Map<String, Resource>, ResponseFormat> createNodeTypesRes = createResourcesFromYamlNodeTypesList(yamlName, resource, yamlContent,
+ Either<Map<String, Resource>, ResponseFormat> createNodeTypesRes = createResourcesFromYamlNodeTypesList(yamlName, resource,
nestedVfcJsonMap, false, nodesArtifactsToHandle, createdArtifacts, nodesInfo, csarInfo);
if (createNodeTypesRes.isRight()) {
log.debug("Failed to create node types from yaml {}. Status is {}", yamlName, createNodeTypesRes.right().value());
@@ -1201,13 +1214,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
if (nestedVfcJsonMap.containsKey(ToscaTagNamesEnum.TOPOLOGY_TEMPLATE.getElementName())) {
log.debug("************* Going to handle complex VFC from yaml {}", yamlName);
- handleNestedVfcRes = handleComplexVfc(resource, nodesArtifactsToHandle, createdArtifacts, nodesInfo, csarInfo, nodeName, yamlName, yamlContent);
+ handleNestedVfcRes = handleComplexVfc(resource, nodesArtifactsToHandle, createdArtifacts, nodesInfo, csarInfo, nodeName, yamlName);
}
return handleNestedVfcRes;
}
private Either<Resource, ResponseFormat> handleComplexVfc(Resource resource, Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodesArtifactsToHandle, List<ArtifactDefinition> createdArtifacts,
- Map<String, NodeTypeInfo> nodesInfo, CsarInfo csarInfo, String nodeName, String yamlName, String yamlContent) {
+ Map<String, NodeTypeInfo> nodesInfo, CsarInfo csarInfo, String nodeName, String yamlName) {
Either<Resource, ResponseFormat> result = null;
Resource oldComplexVfc = null;
@@ -1229,7 +1242,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
}
if(result == null){
- result = handleComplexVfc(nodesArtifactsToHandle, createdArtifacts, nodesInfo, csarInfo, nodeName, yamlName, yamlContent, oldComplexVfc, newComplexVfc);
+ result = handleComplexVfc(nodesArtifactsToHandle, createdArtifacts, nodesInfo, csarInfo, nodeName, yamlName, oldComplexVfc, newComplexVfc);
}
if(result.isLeft()){
newComplexVfc = result.left().value();
@@ -1249,11 +1262,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
private Either<Resource, ResponseFormat> handleComplexVfc(Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodesArtifactsToHandle, List<ArtifactDefinition> createdArtifacts, Map<String, NodeTypeInfo> nodesInfo,
- CsarInfo csarInfo, String nodeName, String yamlName, String yamlContent, Resource oldComplexVfc, Resource newComplexVfc) {
+ CsarInfo csarInfo, String nodeName, String yamlName, Resource oldComplexVfc, Resource newComplexVfc) {
Either<Resource, ResponseFormat> handleComplexVfcRes;
+ Map<String, Object> mappedToscaTemplate = nodesInfo.get(nodeName).getMappedToscaTemplate();
+ String yamlContent = new String(csarInfo.getCsar().get(yamlName));
Map<String, NodeTypeInfo> newNodeTypesInfo = nodesInfo.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().getUnmarkedCopy()));
- markNestedVfc(yamlContent, newNodeTypesInfo);
+ markNestedVfc(mappedToscaTemplate, newNodeTypesInfo);
if(oldComplexVfc == null){
handleComplexVfcRes = createResourceFromYaml(newComplexVfc, yamlContent, yamlName, newNodeTypesInfo, csarInfo, nodesArtifactsToHandle, false, true, nodeName);
if (handleComplexVfcRes.isRight()) {
@@ -1929,7 +1944,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
mappedToscaTemplate = (Map<String, Object>) new Yaml().load(topologyTemplateYaml);
}
- Either<Map<String, Resource>, ResponseFormat> createdNodeTypeFromMainTemplateEither = createResourcesFromYamlNodeTypesList(yamlName, resource, topologyTemplateYaml, mappedToscaTemplate, needLock, nodeTypesArtifactsToHandle,
+ Either<Map<String, Resource>, ResponseFormat> createdNodeTypeFromMainTemplateEither = createResourcesFromYamlNodeTypesList(yamlName, resource, mappedToscaTemplate, needLock, nodeTypesArtifactsToHandle,
nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo);
if (createdNodeTypeFromMainTemplateEither.isRight()) {
ResponseFormat responseFormat = createdNodeTypeFromMainTemplateEither.right().value();
@@ -4206,7 +4221,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
@SuppressWarnings("unchecked")
- public Either<ParsedToscaYamlInfo, ResponseFormat> parseResourceInfoFromYaml(String yamlFileName, Resource resource, String resourceYml, User user, Map<String, String> createdNodesToscaResourceNames, Map<String, NodeTypeInfo> nodeTypesInfo, String nodeName) {
+ public Either<ParsedToscaYamlInfo, ResponseFormat> parseResourceInfoFromYaml(String yamlFileName, Resource resource, String resourceYml, Map<String, String> createdNodesToscaResourceNames, Map<String, NodeTypeInfo> nodeTypesInfo, String nodeName) {
Map<String, Object> mappedToscaTemplate;
if(nodeTypesInfo != null && nodeName != null && nodeTypesInfo.containsKey(nodeName)){
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java
index f9505fc027..5867e39360 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java
@@ -29,6 +29,6 @@ import com.datastax.driver.mapping.annotations.Query;
@Accessor
public interface SdcSchemaFilesAccessor {
- @Query("SELECT * FROM sdcartifact.sdcschemafiles WHERE SDCRELEASENUM = :sdcreleasenum AND CONFORMANCELEVEL = :conformancelevel")
+ @Query("SELECT * FROM sdcartifact.sdcschemafiles WHERE SDCRELEASENUM = :sdcreleasenum AND CONFORMANCELEVEL = :conformancelevel ORDER BY timestamp DESC")
Result<SdcSchemaFilesData> getSpecificSdcSchemaFiles(@Param("sdcreleasenum") String sdcreleasenum, @Param("conformancelevel") String conformancelevel);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/CsarInfo.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/CsarInfo.java
index 575cc68f7f..9d231a7d27 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/CsarInfo.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/CsarInfo.java
@@ -5,21 +5,28 @@ import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
+import org.yaml.snakeyaml.Yaml;
+
public class CsarInfo {
String vfResourceName;
User modifier;
String csarUUID;
Map<String, byte[]> csar;
+ String mainTemplateContent;
+ Map<String, Object> mappedToscaMainTemplate;
Map<String, String> createdNodesToscaResourceNames;
Queue<String> cvfcToCreateQueue;
boolean isUpdate;
Map<String, Resource> createdNodes;
- public CsarInfo(String vfResourceName, User modifier, String csarUUID, Map<String, byte[]> csar, boolean isUpdate){
+ @SuppressWarnings("unchecked")
+ public CsarInfo(String vfResourceName, User modifier, String csarUUID, Map<String, byte[]> csar, String mainTemplateContent, boolean isUpdate){
this.vfResourceName = vfResourceName;
this.modifier = modifier;
this.csarUUID = csarUUID;
this.csar = csar;
+ this.mainTemplateContent = mainTemplateContent;
+ this.mappedToscaMainTemplate = (Map<String, Object>) new Yaml().load(mainTemplateContent);
this.createdNodesToscaResourceNames = new HashMap<>();
this.cvfcToCreateQueue = new PriorityQueue<>();
this.isUpdate = isUpdate;
@@ -58,6 +65,14 @@ public class CsarInfo {
this.csar = csar;
}
+ public String getMainTemplateContent() {
+ return mainTemplateContent;
+ }
+
+ public Map<String, Object> getMappedToscaMainTemplate() {
+ return mappedToscaMainTemplate;
+ }
+
public Map<String, String> getCreatedNodesToscaResourceNames() {
return createdNodesToscaResourceNames;
}
diff --git a/catalog-ui/src/app/directives/file-opener/file-opener.ts b/catalog-ui/src/app/directives/file-opener/file-opener.ts
index c09d6fc553..4abd2573bb 100644
--- a/catalog-ui/src/app/directives/file-opener/file-opener.ts
+++ b/catalog-ui/src/app/directives/file-opener/file-opener.ts
@@ -51,8 +51,9 @@ export class FileOpenerDirective implements ng.IDirective {
scope.onFileSelect = () => {
scope.onFileUpload({file: scope.importFile});
- element.html('app/directives/file-opener/file-opener.html');
- this.$compile(element.contents())(scope);
+ // fix bug 311261
+ // element.html('app/directives/file-opener/file-opener.html');
+ // this.$compile(element.contents())(scope);
};
scope.getExtensionsWithDot = ():string => {
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 57da7d90e4..3ffc9c16be 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
@@ -38,7 +38,7 @@
<ng-container *ngIf="!property.isDeclared">
<a *ngIf="(propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && !property.isChildOfListOrMap" class="property-icon add-item" (click)="createNewChildProperty();" [ngClass]="{'disabled':readonly || preventInsertItem(property)}">Add value to list</a>
<span *ngIf="property.isChildOfListOrMap" (click)="deleteItem.emit(property);" class="property-icon sprite-new delete-item-icon" [ngClass]="{'disabled':readonly}"></span>
- <span *ngIf="!isPropertyFEModel && (propType == derivedPropertyTypes.COMPLEX || ((propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && hasChildren()))" (click)="expandChildById(propPath)" class="property-icon sprite-new round-expand-icon" [class.open]="expandedChildId.indexOf(propPath) == 0"></span>
+ <span *ngIf="!isPropertyFEModel && (propType == derivedPropertyTypes.COMPLEX || ((propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && hasChildren))" (click)="expandChildById(propPath)" class="property-icon sprite-new round-expand-icon" [class.open]="expandedChildId.indexOf(propPath) == 0"></span>
</ng-container>
</div>
@@ -52,6 +52,7 @@
[expandedChildId]="expandedChildId"
[propertyNameSearchText]="propertyNameSearchText"
[readonly]="readonly"
+ [hasChildren]="getHasChildren(prop)"
(valueChanged)="childValueChanged(prop)"
(mapKeyChanged)="removeValueFromParent(prop, $event)"
(expandChild)="expandChildById($event)"
diff --git a/catalog-ui/src/app/ng2/components/properties-table/dynamic-property/dynamic-property.component.ts b/catalog-ui/src/app/ng2/components/properties-table/dynamic-property/dynamic-property.component.ts
index 3982e4e8dc..9cf043098b 100644
--- a/catalog-ui/src/app/ng2/components/properties-table/dynamic-property/dynamic-property.component.ts
+++ b/catalog-ui/src/app/ng2/components/properties-table/dynamic-property/dynamic-property.component.ts
@@ -46,6 +46,7 @@ export class DynamicPropertyComponent {
@Input() selectedPropertyId: string;
@Input() propertyNameSearchText: string;
@Input() readonly: boolean;
+ @Input() hasChildren: boolean;
@Output() valueChanged: EventEmitter<any> = new EventEmitter<any>();
@Output() expandChild: EventEmitter<string> = new EventEmitter<string>();
@@ -83,8 +84,10 @@ export class DynamicPropertyComponent {
this.checkProperty.emit(propName);
}
- hasChildren = (): number => {
- return (this.property.valueObj && typeof this.property.valueObj == 'object') ? Object.keys(this.property.valueObj).length : 0;
+ getHasChildren = (property:DerivedFEProperty): boolean => {// enter to this function only from base property (PropertyFEModel) and check for child property if it has children
+ return _.filter((<PropertyFEModel>this.property).flattenedChildren,(prop:DerivedFEProperty)=>{
+ return _.startsWith(prop.propertiesName + '#', property.propertiesName);
+ }).length > 1;
}
createNewChildProperty = (): void => {
@@ -106,15 +109,26 @@ export class DynamicPropertyComponent {
if(!newProps[0].schema.property.isSimpleType){
- angular.forEach(newProps, (prop:DerivedFEProperty):void => { //Update parent PropertyFEModel with value for each child, including nested props
+ if ( newProps[0].mapKey ) {//prevent update the new item value on parent property valueObj and saving on BE if it is map item, it will be updated and saved only after user enter key (when it is list item- the map key is the es type)
+ this.updateMapKeyValueOnMainParent(newProps);
+ if (this.property.getParentNamesArray(newProps[0].propertiesName, []).indexOf('') === -1) {
+ this.valueChanged.emit(this.property.name);
+ }
+ }
+ }
+ }
+ }
+
+ updateMapKeyValueOnMainParent(childrenProps: Array<DerivedFEProperty>){
+ if (this.property instanceof PropertyFEModel) {
+ //Update only if all this property parents has key name
+ if (this.property.getParentNamesArray(childrenProps[0].propertiesName, []).indexOf('') === -1){
+ angular.forEach(childrenProps, (prop:DerivedFEProperty):void => { //Update parent PropertyFEModel with value for each child, including nested props
(<PropertyFEModel>this.property).childPropUpdated(prop);
},this);
//grab the cumulative value for the new item from parent PropertyFEModel and assign that value to DerivedFEProp[0] (which is the list or map parent with UUID of the set we just added)
- let parentNames = (<PropertyFEModel>this.property).getParentNamesArray(newProps[0].propertiesName, []);
- newProps[0].valueObj = _.get(this.property.valueObj, parentNames.join('.'));
- if ( newProps[0].mapKey ) {//prevent saving if it is map item, whem it is list item- the map key is the es type (it will be saved only after user enter key)
- this.valueChanged.emit(this.property.name);
- }
+ let parentNames = (<PropertyFEModel>this.property).getParentNamesArray(childrenProps[0].propertiesName, []);
+ childrenProps[0].valueObj = _.get(this.property.valueObj, parentNames.join('.'));
}
}
}
@@ -122,9 +136,9 @@ export class DynamicPropertyComponent {
childValueChanged = (property: DerivedFEProperty) => { //value of child property changed
if (this.property instanceof PropertyFEModel) { // will always be the case
- this.property.childPropUpdated(property);
- this.dataTypeService.checkForCustomBehavior(this.property);
if (this.property.getParentNamesArray(property.propertiesName, []).indexOf('') === -1) {//If one of the parents is empty key -don't save
+ this.property.childPropUpdated(property);
+ this.dataTypeService.checkForCustomBehavior(this.property);
this.valueChanged.emit(this.property.name);
}
}
@@ -156,6 +170,14 @@ export class DynamicPropertyComponent {
target.setCustomValidity('');
_.set(itemParent.valueObj, replaceKey, itemParent.valueObj[oldKey]);
item.mapKey = replaceKey;
+ //If the map key was empty its valueObj was not updated on its prent property valueObj, and now we should update it.
+ if(!oldKey && !item.schema.property.isSimpleType){
+ //Search this map item children and update these value on parent property valueOBj
+ let mapKeyFlattenChildren:Array<DerivedFEProperty> = _.filter(this.property.flattenedChildren, (prop:DerivedFEProperty) => {
+ return _.startsWith(prop.propertiesName, item.propertiesName);
+ });
+ this.updateMapKeyValueOnMainParent(mapKeyFlattenChildren);
+ }
}
}
delete itemParent.valueObj[oldKey];
diff --git a/catalog-ui/src/app/services/onboarding-service.ts b/catalog-ui/src/app/services/onboarding-service.ts
index db6c72699a..3dd7269326 100644
--- a/catalog-ui/src/app/services/onboarding-service.ts
+++ b/catalog-ui/src/app/services/onboarding-service.ts
@@ -44,11 +44,21 @@ export class OnboardingService implements IOnboardingService {
this.api = sdcConfig.api;
}
- getOnboardingComponents = ():ng.IPromise<Array<IComponent>> => {
- let defer = this.$q.defer<Array<IComponent>>();
+ getOnboardingVSPs = ():ng.IPromise<Array<ICsarComponent>> =>{
+ let defer = this.$q.defer<Array<ICsarComponent>>();
this.$http.get(this.api.GET_onboarding)
.then((response:any) => {
- let onboardingComponents:Array<ICsarComponent> = response.data.results;
+ defer.resolve(response.data.results);
+ },(response) => {
+ defer.reject(response);
+ });
+
+ return defer.promise;
+ };
+
+ getOnboardingComponents = ():ng.IPromise<Array<IComponent>> => {
+ let defer = this.$q.defer<Array<IComponent>>();
+ this.getOnboardingVSPs().then((onboardingComponents:Array<ICsarComponent>) => {
let componentsList:Array<IComponent> = new Array();
onboardingComponents.forEach((obc:ICsarComponent) => {
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
index 98539d6a3b..48fc9dbb42 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
@@ -21,9 +21,10 @@
'use strict';
import {ModalsHandler, ValidationUtils, EVENTS, CHANGE_COMPONENT_CSAR_VERSION_FLAG, ComponentType, DEFAULT_ICON,
ResourceType} from "app/utils";
-import {CacheService, EventListenerService, ProgressService} from "app/services";
-import {IAppConfigurtaion, IValidate, IMainCategory, Resource, ISubCategory,Service} from "app/models";
+import {CacheService, EventListenerService, ProgressService, OnboardingService} from "app/services";
+import {IAppConfigurtaion, IValidate, IMainCategory, Resource, ISubCategory,Service, ICsarComponent} from "app/models";
import {IWorkspaceViewModelScope} from "app/view-models/workspace/workspace-view-model";
+import {Dictionary} from "lodash";
export class Validation {
componentNameValidationPattern:RegExp;
@@ -91,7 +92,8 @@ export class GeneralViewModel {
'Sdc.Services.ProgressService',
'$interval',
'$filter',
- '$timeout'
+ '$timeout',
+ 'Sdc.Services.OnboardingService'
];
constructor(private $scope:IGeneralScope,
@@ -113,7 +115,8 @@ export class GeneralViewModel {
private progressService:ProgressService,
protected $interval:any,
private $filter:ng.IFilterService,
- private $timeout:ng.ITimeoutService) {
+ private $timeout:ng.ITimeoutService,
+ private onBoardingService:OnboardingService) {
this.initScopeValidation();
this.initScopeMethods();
@@ -135,6 +138,40 @@ export class GeneralViewModel {
this.$scope.validation.projectCodeValidationPattern = this.ProjectCodeValidationPattern;
};
+ private initImportedToscaBrowseFile = ():void =>{
+ // Init the decision if to show onboarding
+ this.$scope.isShowOnboardingSelectionBrowse = false;
+ if (this.$scope.component.isResource() &&
+ this.$scope.isEditMode() &&
+ (<Resource>this.$scope.component).resourceType == ResourceType.VF &&
+ (<Resource>this.$scope.component).csarUUID) {
+ this.$scope.isShowOnboardingSelectionBrowse = true;
+ let onboardCsarFilesMap:Dictionary<string> = this.cacheService.get('onboardCsarFilesMap');
+ // The onboardCsarFilesMap in cache contains map of [packageId]:[vsp display name for brows]
+ // if the map is empty - Do request to BE
+ if(onboardCsarFilesMap) {
+ this.$scope.importedToscaBrowseFileText = onboardCsarFilesMap[(<Resource>this.$scope.component).csarUUID];
+ }
+ if(!onboardCsarFilesMap || !this.$scope.importedToscaBrowseFileText){
+
+ let onSuccess = (vsps:Array<ICsarComponent>): void =>{
+ onboardCsarFilesMap = {};
+ _.each(vsps, (vsp:ICsarComponent)=>{
+ onboardCsarFilesMap[vsp.packageId] = vsp.vspName + " (" + vsp.version + ")";
+ });
+ this.cacheService.set('onboardCsarFilesMap', onboardCsarFilesMap);
+ this.$scope.importedToscaBrowseFileText = onboardCsarFilesMap[(<Resource>this.$scope.component).csarUUID];
+ };
+
+ let onError = (): void =>{
+ console.log("Error getting onboarding list");
+ };
+
+ this.onBoardingService.getOnboardingVSPs().then(onSuccess, onError);
+ }
+ }
+ };
+
private initScope = ():void => {
// Work around to change the csar version
@@ -142,7 +179,6 @@ export class GeneralViewModel {
(<Resource>this.$scope.component).csarVersion = this.cacheService.get(CHANGE_COMPONENT_CSAR_VERSION_FLAG);
}
- this.$scope.importedToscaBrowseFileText = this.$scope.component.name + " (" + (<Resource>this.$scope.component).csarVersion + ")";
this.$scope.importCsarProgressKey = "importCsarProgressKey";
this.$scope.browseFileLabel = this.$scope.component.isResource() && (<Resource>this.$scope.component).resourceType === ResourceType.VF ? "Upload file" : "Upload VFC";
this.$scope.progressService = this.progressService;
@@ -167,16 +203,8 @@ export class GeneralViewModel {
this.$scope.isShowFileBrowse = true;
}
}
- ;
- // Init the decision if to show onboarding
- this.$scope.isShowOnboardingSelectionBrowse = false;
- if (this.$scope.component.isResource() &&
- this.$scope.isEditMode() &&
- (<Resource>this.$scope.component).resourceType == ResourceType.VF &&
- (<Resource>this.$scope.component).csarUUID) {
- this.$scope.isShowOnboardingSelectionBrowse = true;
- }
+ this.initImportedToscaBrowseFile();
//init file extensions based on the file that was imported.
if (this.$scope.component.isResource() && (<Resource>this.$scope.component).importedFile) {
diff --git a/catalog-ui/src/assets/styles/global.less b/catalog-ui/src/assets/styles/global.less
index 9faf4aeb0e..29e244e1a0 100644
--- a/catalog-ui/src/assets/styles/global.less
+++ b/catalog-ui/src/assets/styles/global.less
@@ -7,6 +7,7 @@ body {
height: 100%;
margin: auto;
position: relative;
+ user-select: text;
}
* {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java
index a2683eafc8..c9064a41eb 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java
@@ -30,9 +30,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
@@ -54,6 +51,11 @@ public class AndreyTest {
public static void main(String[] args) throws Exception {
ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition;
File filesFolder = new File("C:/Users/al714h/Downloads/Design/");
+ File genericFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/heat-types/");
+ File genericVF = new File ("/Generic_VF/Generic_VF.yml");
+ File genericVFC = new File ("/Generic_VFC/Generic_VFC.yml");
+ File genericPNF = new File ("/Generic_PNF/Generic_PNF.yml");
+ File genericService = new File ("/Generic_Service/Generic_Service.yml");
File amdocsCsarFileName = new File("/77e6b842669f441db20a83489da3f4be.csar");
File VfCsarFileName = new File("/resource-Civfonboarded2016012VmxAv301072E2e1424cb9d-csar.csar");
File serviceCsarFileName = new File("/service-Ciservicefeba0521131d-csar.csar");
@@ -68,16 +70,19 @@ public class AndreyTest {
toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + amdocsCsarFileName));
toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName));
toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + serviceCsarFileName));
- Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, "Generic_VF", "1.0");
- ToscaTopologyTemplateDefinition topology_template = toscaMainAmdocsDefinition.getTopology_template();
- Map<String, Object> newInput = new HashMap<String, Object>();
- for (PropertyDefinition property : resource.getProperties()) {
- newInput.put(property.getLabel(),property);
- }
- topology_template.setInputs(newInput);
+// Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, "Generic_VF", "1.0");
+ ToscaTopologyTemplateDefinition topologyTemplate = toscaMainAmdocsDefinition.getTopology_template();
+// FileHandling.parseYamlFileToMapByPattern("","");
+// Map<String, Object> newInput = new HashMap<String, Object>();
+// for (PropertyDefinition property : resource.getProperties()) {
+// newInput.put(property.getName(),property);
+// }
- List<PropertyDefinition> properties = resource.getProperties();
+// topologyTemplate.addInputs(newInput);
+//
+//
+// List<PropertyDefinition> properties = resource.getProperties();
// File path = new File("C:/Data/FileToParse/Definitions/resource-Civfonboarded2016006VvmVvm301607E2100a9b04-template.yml");
// File csarPath = new File("C:/Data/D2.0/TOSCA_Ex/Nested.csar");
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaParameterConstants.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaParameterConstants.java
index 18d7d7d97b..9f1d544738 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaParameterConstants.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaParameterConstants.java
@@ -6,4 +6,6 @@ public interface ToscaParameterConstants {
public static final String TOSCA_META_PATH = "TOSCA-Metadata/TOSCA.meta";
public static final String HEAT_META_PATH = "Artifacts/HEAT.meta";
public static final String IMPORT_STRUCTURE = "importStructure";
+ public static final String NODE_TYPES = "node_types";
+ public static final String PROPERTIES = "properties";
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java
index 539c9b4d63..66672b1d07 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java
@@ -68,6 +68,10 @@ public class ToscaTopologyTemplateDefinition {
this.inputs = inputs;
}
+ public void addInputs(Map<String, Object> inputs) {
+ this.inputs.putAll(inputs);
+ }
+
public Map<String, ToscaNodeTemplatesTopologyTemplateDefinition> getNode_templates() {
return node_templates;
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
index 4e4192fe7e..9ea1b7239c 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
@@ -75,7 +75,7 @@ public class MIBsArtifactsOnResourceInstance extends SetupCDTest {
// TODO: Change download validation from download artifact via external API to UI
@Test(dataProvider="mibsArtifactCRUDUi")
public void mibsArtifactCRUDUi(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
- setLog("mibsArtifactCRUDUi");
+ setLog(fileName);
String filePath = FileHandling.getFilePath(folder);
// import Resource
@@ -144,8 +144,12 @@ public class MIBsArtifactsOnResourceInstance extends SetupCDTest {
// Import VFC/VL/CP, upload MIBs artifacts then drag it on VF & verify that deployment artifact have only download option
@Test(dataProvider="mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption")
public void mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
+
+ if(resourceTypeEnum.equals(ResourceTypeEnum.CP)){
+ throw new SkipException("Open bug 322930");
+ }
- setLog("mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption");
+ setLog(fileName);
String filePath = FileHandling.getFilePath(folder);
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
index 089ad9580f..4e9770cbea 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
@@ -21,11 +21,17 @@
package org.openecomp.sdc.ci.tests.US;
import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaParameterConstants;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
import org.testng.Assert;
@@ -36,40 +42,40 @@ import org.testng.Assert;
public class Testing {
- public static void main(String[] args) throws Exception {
- // TODO Auto-generated method stub
-
- File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml");
- ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
-
- Map<String, Object> vl_us831517_1 = new HashMap<String, Object>();
- vl_us831517_1.put("property_1", true);
- vl_us831517_1.put("property_2", "init_value_2");
- vl_us831517_1.put("property_3", "init_value_3");
-
-
- Map<String, Object> vl_us831517_2 = new HashMap<String, Object>();
- vl_us831517_2.put("property_1", false);
- vl_us831517_2.put("property_2", "init_value_2");
- vl_us831517_2.put("property_3", "new_value_3");
-
- Map<String, Object> vl_us831517_3 = new HashMap<String, Object>();
- vl_us831517_3.put("property_1", true);
- vl_us831517_3.put("property_2", "init_value_2");
- vl_us831517_3.put("property_3", "init_value_3");
- vl_us831517_3.put("property_4", false);
- vl_us831517_3.put("property_5", "init_value_5");
-
- Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>();
- predefinedProperties.put("VL_US831517_1", vl_us831517_1);
- predefinedProperties.put("VL_US831517_2", vl_us831517_2);
- predefinedProperties.put("VL_US831517_3", vl_us831517_3);
-
- validateNodeTemplatesProperties(predefinedProperties, toscaDefinition);
-
-
-
- }
+// public static void main(String[] args) throws Exception {
+// // TODO Auto-generated method stub
+//
+// File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml");
+// ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
+//
+// Map<String, Object> vl_us831517_1 = new HashMap<String, Object>();
+// vl_us831517_1.put("property_1", true);
+// vl_us831517_1.put("property_2", "init_value_2");
+// vl_us831517_1.put("property_3", "init_value_3");
+//
+//
+// Map<String, Object> vl_us831517_2 = new HashMap<String, Object>();
+// vl_us831517_2.put("property_1", false);
+// vl_us831517_2.put("property_2", "init_value_2");
+// vl_us831517_2.put("property_3", "new_value_3");
+//
+// Map<String, Object> vl_us831517_3 = new HashMap<String, Object>();
+// vl_us831517_3.put("property_1", true);
+// vl_us831517_3.put("property_2", "init_value_2");
+// vl_us831517_3.put("property_3", "init_value_3");
+// vl_us831517_3.put("property_4", false);
+// vl_us831517_3.put("property_5", "init_value_5");
+//
+// Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>();
+// predefinedProperties.put("VL_US831517_1", vl_us831517_1);
+// predefinedProperties.put("VL_US831517_2", vl_us831517_2);
+// predefinedProperties.put("VL_US831517_3", vl_us831517_3);
+//
+// validateNodeTemplatesProperties(predefinedProperties, toscaDefinition);
+//
+//
+//
+// }
@@ -121,5 +127,77 @@ public class Testing {
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ public static void main(String[] args) throws Exception {
+ ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition;
+ File filesFolder = new File("C:/Users/al714h/Downloads/Design/");
+ File importToscaFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/");
+
+ File dataTypesLocation = new File(importToscaFilesFolder.getPath() + "/data-types/dataTypes.yml");
+
+ File genericVfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VF/Generic_VF.yml");
+ File genericVfcFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_VFC/Generic_VFC.yml");
+ File genericPnfFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_PNF/Generic_PNF.yml");
+ File genericServiceFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_Service/Generic_Service.yml");
+
+ File amdocsCsarFileName = new File("/77e6b842669f441db20a83489da3f4be.csar");
+ File VfCsarFileName = new File("/resource-Civfonboarded2016012VmxAv301072E2e1424cb9d-csar.csar");
+ File serviceCsarFileName = new File("/service-Ciservicefeba0521131d-csar.csar");
+
+ Map<String, DataTypeDefinition> parseDataTypesYaml = FileHandling.parseDataTypesYaml(dataTypesLocation.getAbsoluteFile().toString());
+ System.out.println("start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
+
+ toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + amdocsCsarFileName));
+ toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName));
+ toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + serviceCsarFileName));
+ ToscaTopologyTemplateDefinition topologyTemplate = toscaMainAmdocsDefinition.getTopology_template();
+ ToscaDefinition objectHelper = ToscaParserUtils.parseToscaYamlToJavaObject(genericVfFileLocation);
+
+ Map<String, Object> additionalInputs = new HashMap<>();
+ Set<String> keySet = objectHelper.getNode_types().keySet();
+ if(keySet != null){
+ for(String key: keySet){
+ additionalInputs = objectHelper.getNode_types().get(key).getProperties();
+ }
+ }
+ topologyTemplate.addInputs(additionalInputs);
+
+
+
+
+// toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
+ System.out.println("listTypeHeatMetaDefinition start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
+// List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition = CsarParserUtils.getListTypeHeatMetaDefinition(csarPath);
+ System.out.println("get service start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
+// System.out.println(listTypeHeatMetaDefinition);
+// for(TypeHeatMetaDefinition typeHeatMetaDefinition : listTypeHeatMetaDefinition){
+// for(GroupHeatMetaDefinition groupHeatMetaDefinition : typeHeatMetaDefinition.getGroupHeatMetaDefinition()){
+// List<HeatMetaFirstLevelDefinition> artifactList = groupHeatMetaDefinition.getArtifactList();
+// boolean isBase = groupHeatMetaDefinition.getPropertyHeatMetaDefinition().getValue();
+// }
+//
+// }
+ System.out.println("Finished");
+ System.out.println("get service start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
+ }
+
+
+
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java
new file mode 100644
index 0000000000..f63be6c8c3
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java
@@ -0,0 +1,66 @@
+package org.openecomp.sdc.ci.tests.dataProvider;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.testng.annotations.DataProvider;
+
+public class OnbordingDataProviders {
+
+ protected static String filepath = FileHandling.getVnfRepositoryPath();
+
+ @DataProvider(name = "randomVNF_List", parallel = false)
+ private static final Object[][] randomVnfList() throws Exception {
+ int randomElementNumber = 3; //how many VNFs to onboard randomly
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
+ List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder);
+ System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size()));
+ return provideData(newRandomFileNamesFromFolder, filepath);
+ }
+
+ @DataProvider(name = "VNF_List" , parallel = true)
+ private static final Object[][] VnfList() throws Exception {
+
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
+
+ System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
+ return provideData(fileNamesFromFolder, filepath);
+ }
+
+
+// -----------------------methods-----------------------------------------
+ public static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) {
+
+ Object[][] arObject = new Object[fileNamesFromFolder.size()][];
+ int index = 0;
+ for (Object obj : fileNamesFromFolder) {
+ arObject[index++] = new Object[] { filepath, obj };
+ }
+ return arObject;
+ }
+
+ private static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) {
+ if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){
+ return null;
+ }else{
+ List<Integer> indexList = new ArrayList<>();
+ List<String> newRandomFileNamesFromFolder = new ArrayList<>();
+ for(int i = 0; i < fileNamesFromFolder.size(); i++){
+ indexList.add(i);
+ }
+ Collections.shuffle(indexList);
+ Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]);
+ for(int i = 0; i < randomArray.length; i++){
+ newRandomFileNamesFromFolder.add(fileNamesFromFolder.get(randomArray[i]));
+ }
+ return newRandomFileNamesFromFolder;
+ }
+ }
+
+
+
+
+}
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 b1cd09c6d8..f842136425 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
@@ -48,6 +48,7 @@ import org.openecomp.sdc.ci.tests.verificator.UserManagementVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
+import org.testng.SkipException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -104,6 +105,11 @@ public class AdminUserManagment extends SetupCDTest {
//TC922253
@Test
public void createInvalidMacIdTest(){
+
+ if(true){
+ throw new SkipException("Open bug 324032");
+ }
+
String macId = generateValidMacId();
StringBuilder invalidMacId = new StringBuilder(macId);
invalidMacId.setCharAt(0, 'a');
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 0c4802af64..e6d1177425 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
@@ -34,6 +34,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
@@ -78,124 +79,9 @@ public class Onboard extends SetupCDTest {
makeDistributionValue = makeDistributionReadValue;
}
-// public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) {
-// Object[][] arObject = new Object[fileNamesFromFolder.length][];
-//
-// int index = 0;
-// for (Object obj : fileNamesFromFolder) {
-// arObject[index++] = new Object[] { filepath, obj };
-// }
-// return arObject;
-// }
-
- public static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) {
- Object[][] arObject = new Object[fileNamesFromFolder.size()][];
-
- int index = 0;
- for (Object obj : fileNamesFromFolder) {
- arObject[index++] = new Object[] { filepath, obj };
- }
- return arObject;
- }
-
- @DataProvider(name = "VNF_List" , parallel = true)
- private static final Object[][] VnfList() throws Exception {
-
- List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
- List<String> exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip",
- "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip",
- "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip",
- "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip");
- fileNamesFromFolder.removeAll(exludeVnfList);
-
- System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
- return provideData(fileNamesFromFolder, filepath);
- }
-
-
-// @DataProvider(name = "randomVNF_List", parallel = false)
-// private static final Object[][] randomVnfList() throws Exception {
-// int randomElementNumber = 3; //how many VNFs to onboard randomly
-// String filepath = getFilePath();
-// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
-// Object[] newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder);
-// System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.length));
-// return provideData(newRandomFileNamesFromFolder, filepath);
-// }
-
- @DataProvider(name = "randomVNF_List", parallel = false)
- private static final Object[][] randomVnfList() throws Exception {
- int randomElementNumber = 3; //how many VNFs to onboard randomly
- List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
- List<String> exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip",
- "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip",
- "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip",
- "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip");
- fileNamesFromFolder.removeAll(exludeVnfList);
- List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder);
- System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size()));
- return provideData(newRandomFileNamesFromFolder, filepath);
- }
-
- private static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) {
- if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){
- return null;
- }else{
- List<Integer> indexList = new ArrayList<>();
- List<String> newRandomFileNamesFromFolder = new ArrayList<>();
- for(int i = 0; i < fileNamesFromFolder.size(); i++){
- indexList.add(i);
- }
- Collections.shuffle(indexList);
- Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]);
- for(int i = 0; i < randomArray.length; i++){
- newRandomFileNamesFromFolder.add(fileNamesFromFolder.get(randomArray[i]));
- }
- return newRandomFileNamesFromFolder;
- }
- }
-
-// private static Object[] getRandomElements(int randomElementNumber, Object[] fileNamesFromFolder) {
-// if(fileNamesFromFolder.length == 0 || fileNamesFromFolder.length < randomElementNumber){
-// return null;
-// }else{
-// List<Integer> indexList = new ArrayList<>();
-// Object[] newRandomFileNamesFromFolder = new Object[randomElementNumber];
-// for(int i = 0; i < fileNamesFromFolder.length; i++){
-// indexList.add(i);
-// }
-// Collections.shuffle(indexList);
-// Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]);
-// for(int i = 0; i < randomArray.length; i++){
-// newRandomFileNamesFromFolder[i] = fileNamesFromFolder[randomArray[i]];
-// }
-// return newRandomFileNamesFromFolder;
-// }
-// }
-
-// public static String getFilePath() {
-// String filepath = System.getProperty("filepath");
-// if (filepath == null && System.getProperty("os.name").contains("Windows")) {
-// filepath = FileHandling.getResourcesFilesPath() +"VNFs";
-// }
-//
-// else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
-// filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator +"VNFs";
-// }
-// return filepath;
-// }
-
@Test
public void onboardVNFTestSanity() throws Exception, Throwable {
-// String vnfFile = "2016-012_vMX_AV_30_1072_e2e.zip";
-// String filepath = getFilePath();
-// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
- List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
- List<String> exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip",
- "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip",
- "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip",
- "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip");
- fileNamesFromFolder.removeAll(exludeVnfList);
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
String vnfFile = fileNamesFromFolder.get(0).toString();
runOnboardToDistributionFlow(filepath, vnfFile);
}
@@ -217,7 +103,7 @@ public class Onboard extends SetupCDTest {
assertNotNull(vfElement);
ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
- ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile ,"The service topology is as follows : ");
+ ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile ,"The service topology is as follows: ");
ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
@@ -265,35 +151,21 @@ public class Onboard extends SetupCDTest {
}
-
-
-// protected synchronized void validateInputArtsVSouput(String serviceName) {
-//
-//
-// String filepath = System.getProperty("filepath");
-// if (filepath == null && System.getProperty("os.name").contains("Windows")) {
-// filepath = FileHandling.getResourcesFilesPath() + folder + File.separator;
-// }
-//
-// Set<Entry<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>>> serviceArtifactCorrelationMap = ArtifactsCorrelationManager.getServiceArtifactCorrelationMap(serviceName);
-//
-// }
-
- @Test(dataProvider = "VNF_List")
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
public void onboardVNFTest(String filepath, String vnfFile) throws Exception, Throwable {
setLog(vnfFile);
System.out.println("printttttttttttttt - >" + makeDistributionValue);
runOnboardToDistributionFlow(filepath, vnfFile);
}
- @Test(dataProvider = "VNF_List")
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
public void onboardVNFShotFlow(String filepath, String vnfFile) throws Exception, Throwable {
setLog(vnfFile);
System.out.println("printttttttttttttt - >" + makeDistributionValue);
onboardAndCertify(filepath, vnfFile);
}
- @Test(dataProvider = "randomVNF_List")
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
public void onboardRandomVNFsTest(String filepath, String vnfFile) throws Exception, Throwable {
setLog(vnfFile);
System.out.println("printttttttttttttt - >" + makeDistributionValue);
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
index 2ce944d273..c9dcf2a08e 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
@@ -28,7 +28,6 @@ import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -40,6 +39,7 @@ import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
@@ -53,7 +53,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.clearspring.analytics.util.Pair;
@@ -68,31 +67,6 @@ public class OnboardViaApis{
private static final String FULL_PATH = "C://tmp//CSARs//";
- public static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) {
- Object[][] arObject = new Object[fileNamesFromFolder.size()][];
-
- int index = 0;
- for (Object obj : fileNamesFromFolder) {
- arObject[index++] = new Object[] { filepath, obj };
- }
- return arObject;
- }
-
- @DataProvider(name = "VNF_List" , parallel = false)
- private static final Object[][] VnfList() throws Exception {
- String filepath = FileHandling.getVnfRepositoryPath();
-
-// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
- List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
- List<String> exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip",
- "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip",
- "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip",
- "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip");
- fileNamesFromFolder.removeAll(exludeVnfList);
- System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
- return provideData(fileNamesFromFolder, filepath);
- }
-
//-------------------------------------------------------------------------------------------------------
User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
@@ -109,7 +83,7 @@ public class OnboardViaApis{
resourceDetails = ElementFactory.getDefaultResource();
}
- @Test(dataProvider = "VNF_List")
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
public void onboardVNFTestViaApis(String filepath, String vnfFile) throws Exception, Throwable {
Service service = null;
String fullFileName = FULL_PATH + vnfFile + ".csar";
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 9b4d97e0a7..339f9290e8 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
@@ -264,12 +264,7 @@ public class Service extends SetupCDTest {
}
@Test
- public void addAPIArtifactInCompositionScreenTest() throws Exception{
-
- if(true){
- throw new SkipException("Open bug 292017");
- }
-
+ public void addAPIArtifactInCompositionScreenTest() throws Exception{
String fileName = HEAT_FILE_YAML_NAME,
descriptionText = DESCRIPTION,
url = "http://kuku.com";
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java
new file mode 100644
index 0000000000..293547f392
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class ToscaValidation{
+
+
+ @BeforeClass
+ public void precondition(){
+
+ Map<String, Map<String, Object>> expected = new HashMap<String, Map<String, Object>>();
+
+ //import amdocs VNF and download csar
+
+ //parse downloaded csar and add it to expected object
+
+ //create VF base on VNF imported from previous step - declare all inputs
+
+ //certify VF and download csar
+
+ //parse downloaded csar and add it to expected object
+
+ //create service add VF - declare all inputs
+
+ //certify service and download csar
+
+ //parse downloaded csar and add it to expected object
+
+
+ }
+
+ @Test
+ public void validateMetaData(){
+
+
+
+
+ }
+
+ @Test
+ public void validatePropertiesInputs(){
+
+
+
+ }
+
+
+
+
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java
index 9eee0e9096..c96c66982c 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java
@@ -67,7 +67,7 @@ public class VFCArtifacts extends SetupCDTest {
private String filePath;
@BeforeClass
public void beforeClass(){
- filePath = FileHandling.getFilePath("");
+ filePath = FileHandling.getFilePath("VFCArtifacts");
}
@Test
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
index 3c141d3a43..4fe1938af8 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
@@ -26,6 +26,7 @@ import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.FilenameFilter;
@@ -44,7 +45,9 @@ import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.common.util.GeneralUtility;
@@ -88,6 +91,12 @@ public class FileHandling {
return objectMap;
}
+
+ public static Map<String, DataTypeDefinition> parseDataTypesYaml(String filePath) throws Exception {
+ @SuppressWarnings("unchecked")
+ Map<String, DataTypeDefinition> dataTypesMap = (Map<String, DataTypeDefinition>) parseYamlFile(filePath);
+ return dataTypesMap;
+ }
// -------------------------------------------------------------------------------------------------
public static String getFilePath(String folder) {
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 eed4f765c5..398e1f18db 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
@@ -77,6 +77,11 @@ import com.clearspring.analytics.util.Pair;
public class OnboardingUtils {
+ protected static List<String> exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip",
+ "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip",
+ "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip",
+ "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip");
+
public OnboardingUtils() {
}
@@ -790,6 +795,18 @@ public class OnboardingUtils {
ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType());
}
}
+
+
+ /**
+ * @return
+ * The method returns VNF names list from Files directory under sdc-vnfs repository
+ */
+ public static List<String> getVnfNamesFileList() {
+ String filepath = FileHandling.getVnfRepositoryPath();
+ List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ fileNamesFromFolder.removeAll(exludeVnfList);
+ return fileNamesFromFolder;
+ }
}