diff options
Diffstat (limited to 'blueprints-processor/plugin')
181 files changed, 0 insertions, 19560 deletions
diff --git a/blueprints-processor/plugin/assignment-provider/pom.xml b/blueprints-processor/plugin/assignment-provider/pom.xml deleted file mode 100644 index e04c175be..000000000 --- a/blueprints-processor/plugin/assignment-provider/pom.xml +++ /dev/null @@ -1,144 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright © 2017-2018 AT&T Intellectual Property. - Modifications Copyright © 2018 IBM. - - 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>binding-parent</artifactId> - <version>1.5.2-SNAPSHOT</version> - <relativePath/> - </parent> - - <groupId>org.onap.ccsdk.features</groupId> - <artifactId>blueprints-assignment-provider</artifactId> - <version>0.7.1-SNAPSHOT</version> - <packaging>bundle</packaging> - - <name>ccsdk-features :: blueprints-processor-plugin :: ${project.artifactId}</name> - <url>http://maven.apache.org</url> - - <dependencies> - <dependency> - <groupId>org.onap.ccsdk.features</groupId> - <artifactId>blueprints-generator-provider</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-jsonSchema</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.sling</groupId> - <artifactId>org.apache.sling.testing.osgi-mock</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.javassist</groupId> - <artifactId>javassist</artifactId> - <version>3.21.0-GA</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>1.10.19</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-module-junit4</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-support</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-reflect</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-core</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <configuration> - <additionalparam>-Xdoclint:none</additionalparam> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Bundle-Name>${project.artifactId}</Bundle-Name> - <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName> - <Export-Package>org.onap.ccsdk.features.assignment, - org.onap.ccsdk.features.assignment.data, - org.onap.ccsdk.features.assignment.service, - org.onap.ccsdk.features.assignment.processor, - org.onap.ccsdk.features.assignment.processor.custom - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/ConfigAssignmentConstants.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/ConfigAssignmentConstants.java deleted file mode 100644 index 3052a8611..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/ConfigAssignmentConstants.java +++ /dev/null @@ -1,37 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment;
-
-@SuppressWarnings("squid:S1118")
-public class ConfigAssignmentConstants {
-
- public static final String OUTPUT_PARAM_STATUS = "status";
- public static final String OUTPUT_PARAM_RESOURCE_ASSIGNMENT_PARAMS = "resource-assignment-params";
- public static final String OUTPUT_PARAM_MASHED_DATA = "mashed-data";
- public static final String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
- public static final String OUTPUT_STATUS_SUCCESS = "success";
- public static final String OUTPUT_STATUS_FAILURE = "failure";
-
- public static final String INPUT_PARAM_REQUEST_ID = "request-id";
- public static final String INPUT_PARAM_RESOURCE_ID = "resource-id";
- public static final String INPUT_PARAM_RESOURCE_TYPE = "resource-type";
- public static final String INPUT_PARAM_ACTION_NAME = "action-name";
- public static final String INPUT_PARAM_TEMPLATE_NAMES = "template-names";
- public static final String INPUT_PARAM_INPUT_DATA = "input-data";
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/data/ResourceAssignmentData.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/data/ResourceAssignmentData.java deleted file mode 100644 index 75a1398bd..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/data/ResourceAssignmentData.java +++ /dev/null @@ -1,163 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.data;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-public class ResourceAssignmentData {
-
- private String requestId;
- private boolean reloadModel;
- private String resourceType;
- private String resourceId;
- private String serviceTemplateName;
- private String serviceTemplateVersion;
- private String actionName;
- private String inputData;
- private SvcLogicContext svcLogicContext;
- private List<String> templateNames;
- private Map<String, List<ResourceAssignment>> templatesResourceAssignments = new HashMap<>();
- private Map<String, String> templatesContents = new HashMap<>();
- private Map<String, String> templatesMashedContents = new HashMap<>();
- private Map<String, String> templatesData = new HashMap<>();
- private Map<String, Object> context = new HashMap<>();
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getResourceType() {
- return resourceType;
- }
-
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public String getServiceTemplateName() {
- return serviceTemplateName;
- }
-
- public void setServiceTemplateName(String serviceTemplateName) {
- this.serviceTemplateName = serviceTemplateName;
- }
-
- public String getServiceTemplateVersion() {
- return serviceTemplateVersion;
- }
-
- public void setServiceTemplateVersion(String serviceTemplateVersion) {
- this.serviceTemplateVersion = serviceTemplateVersion;
- }
-
- public String getActionName() {
- return actionName;
- }
-
- public void setActionName(String actionName) {
- this.actionName = actionName;
- }
-
- public String getInputData() {
- return inputData;
- }
-
- public void setInputData(String inputData) {
- this.inputData = inputData;
- }
-
- public List<String> getTemplateNames() {
- return templateNames;
- }
-
- public void setTemplateNames(List<String> templateNames) {
- this.templateNames = templateNames;
- }
-
- public Map<String, List<ResourceAssignment>> getTemplatesResourceAssignments() {
- return templatesResourceAssignments;
- }
-
- public void setTemplatesResourceAssignments(Map<String, List<ResourceAssignment>> templatesResourceAssignments) {
- this.templatesResourceAssignments = templatesResourceAssignments;
- }
-
- public Map<String, String> getTemplatesContents() {
- return templatesContents;
- }
-
- public void setTemplatesContents(Map<String, String> templatesContents) {
- this.templatesContents = templatesContents;
- }
-
- public Map<String, String> getTemplatesMashedContents() {
- return templatesMashedContents;
- }
-
- public void setTemplatesMashedContents(Map<String, String> templatesMashedContents) {
- this.templatesMashedContents = templatesMashedContents;
- }
-
- public Map<String, String> getTemplatesData() {
- return templatesData;
- }
-
- public void setTemplatesData(Map<String, String> templatesData) {
- this.templatesData = templatesData;
- }
-
- public Map<String, Object> getContext() {
- return context;
- }
-
- public void setContext(Map<String, Object> context) {
- this.context = context;
- }
-
- public SvcLogicContext getSvcLogicContext() {
- return svcLogicContext;
- }
-
- public void setSvcLogicContext(SvcLogicContext svcLogicContext) {
- this.svcLogicContext = svcLogicContext;
- }
-
- public boolean isReloadModel() {
- return reloadModel;
- }
-
- public void setReloadModel(boolean reloadModel) {
- this.reloadModel = reloadModel;
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/DBResourceProcessor.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/DBResourceProcessor.java deleted file mode 100644 index 132d03c4f..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/DBResourceProcessor.java +++ /dev/null @@ -1,267 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.processor;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.assignment.service.ConfigAssignmentUtils;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.data.dict.SourcesDefinition;
-import org.onap.ccsdk.features.model.service.ComponentNode;
-import org.onap.ccsdk.features.model.utils.JsonUtils;
-import org.onap.ccsdk.features.model.utils.ResourceAssignmentUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class DBResourceProcessor implements ComponentNode {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(DBResourceProcessor.class);
- private ConfigResourceService configResourceService;
- private Map<String, ResourceDefinition> dictionaries;
-
- public DBResourceProcessor(ConfigResourceService configResourceService) {
- this.configResourceService = configResourceService;
- }
-
- @Override
- public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- return Boolean.TRUE;
- }
-
- @Override
- public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- // Auto-generated method stub
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
- // Auto-generated method stub
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- try {
- List<ResourceAssignment> batchResourceAssignment =
- (List<ResourceAssignment>) componentContext.get(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS);
- dictionaries =
- (Map<String, ResourceDefinition>) componentContext.get(ConfigModelConstant.PROPERTY_DICTIONARIES);
-
- if (CollectionUtils.isNotEmpty(batchResourceAssignment)) {
- for (ResourceAssignment resourceAssignment : batchResourceAssignment) {
- processResourceAssignment(ctx, componentContext, resourceAssignment);
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(String.format("DBResourceProcessor Exception : (%s)", e), e);
- }
- }
-
- private void processResourceAssignment(SvcLogicContext ctx, Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment) throws SvcLogicException, ConfigModelException {
- if (resourceAssignment != null) {
- try {
- validate(resourceAssignment);
-
- // Check if It has Input
- Object value = ConfigAssignmentUtils.getContextKeyValue(ctx, resourceAssignment.getName());
- if (value != null) {
- logger.info("db source template key ({}) found from input and value is ({})",
- resourceAssignment.getName(), value);
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- return;
- }
-
- ResourceDefinition resourceDefinition = dictionaries.get(resourceAssignment.getDictionaryName());
- SourcesDefinition sourceDb = resourceDefinition.getSources().get("db");
- if (StringUtils.isBlank(sourceDb.getProperties().getQuery())) {
- throw new SvcLogicException("db query property is missing");
- }
-
- String sql = sourceDb.getProperties().getQuery();
- Map<String, String> inputKeyMapping = sourceDb.getProperties().getInputKeyMapping();
-
- logger.info("Db dictionary information : ({}), ({}), ({})", sql, inputKeyMapping,
- sourceDb.getProperties().getOutputKeyMapping());
-
- Map<String, Object> namedParameters = populateNamedParameter(componentContext, inputKeyMapping);
-
- logger.info("Parameter information : ({})", namedParameters);
- List<Map<String, Object>> rows = configResourceService.query(sql, namedParameters);
- if (rows != null && !rows.isEmpty()) {
- processDBResults(ctx, componentContext, resourceAssignment, sourceDb, rows);
- } else {
- logger.warn("Failed to get db result for dictionary name ({}) the query ({})",
- resourceAssignment.getDictionaryName(), sql);
- }
-
- // Check the value has populated for mandatory case
- ResourceAssignmentUtils.assertTemplateKeyValueNotNull(componentContext, resourceAssignment);
- } catch (Exception e) {
- ResourceAssignmentUtils.setFailedResourceDataValue(componentContext, resourceAssignment,
- e.getMessage());
- throw new SvcLogicException(
- String.format("Failed in template key (%s) assignments : (%s)", resourceAssignment, e), e);
- }
- } else {
- // Do Nothing
- }
- }
-
- private void validate(ResourceAssignment resourceAssignment) throws SvcLogicException {
- if (resourceAssignment == null) {
- throw new SvcLogicException("resource assignment is not defined");
- }
-
- if (StringUtils.isBlank(resourceAssignment.getName())) {
- throw new SvcLogicException("resource assignment template key is not defined");
- }
-
- if (StringUtils.isBlank(resourceAssignment.getDictionaryName())) {
- throw new SvcLogicException(
- String.format("resource assignment dictionary name is not defined for template key (%s)",
- resourceAssignment.getName()));
- }
-
- if (!ConfigModelConstant.SOURCE_DB.equalsIgnoreCase(resourceAssignment.getDictionarySource())) {
- throw new SvcLogicException(String.format("resource assignment source is not db, it is (%s)",
- resourceAssignment.getDictionarySource()));
- }
-
- ResourceDefinition resourceDefinition = dictionaries.get(resourceAssignment.getDictionaryName());
- if (resourceDefinition == null) {
- throw new SvcLogicException(String.format("missing resource dictionary definition for name (%s) ",
- resourceAssignment.getDictionaryName()));
- }
-
- if (resourceDefinition.getSources() == null || resourceDefinition.getSources().get("db") == null) {
- throw new SvcLogicException(String.format("missing resource dictionary db source definition for name (%s) ",
- resourceAssignment.getDictionaryName()));
- }
-
- SourcesDefinition sourceDb = resourceDefinition.getSources().get("db");
- if (StringUtils.isBlank(sourceDb.getProperties().getQuery())) {
- throw new SvcLogicException(String.format("Failed to get request Query for dictionary (%s)",
- resourceAssignment.getDictionaryName()));
- }
-
- }
-
- private Map<String, Object> populateNamedParameter(Map<String, Object> componentContext,
- Map<String, String> inputKeyMapping) {
- Map<String, Object> namedParameters = new HashMap<>();
- if (MapUtils.isNotEmpty(inputKeyMapping)) {
-
- for (Map.Entry<String, String> mapping : inputKeyMapping.entrySet()) {
- ResourceDefinition referenceDictionaryDefinition = dictionaries.get(mapping.getValue());
- Object expressionValue =
- ResourceAssignmentUtils.getDictionaryKeyValue(componentContext, referenceDictionaryDefinition);
- logger.trace("Reference dictionary key ({}), value ({})", mapping.getKey(), expressionValue);
- namedParameters.put(mapping.getKey(), expressionValue);
- }
- }
- return namedParameters;
- }
-
- @SuppressWarnings("squid:S3776")
- private void processDBResults(SvcLogicContext ctx, Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment, SourcesDefinition sourceDb, List<Map<String, Object>> rows)
- throws SvcLogicException, ConfigModelException {
-
- Map<String, String> outputKeyMapping = sourceDb.getProperties().getOutputKeyMapping();
- String type = resourceAssignment.getProperty().getType();
- String entrySchema = null;
- logger.info("Response processing type({})", type);
- // Primitive Types
- if (ValidTypes.getPrimitivePropertType().contains(type)) {
-
- Map<String, Object> row = rows.get(0);
- String dbColumnName = outputKeyMapping.get(resourceAssignment.getDictionaryName());
- Object dbColumnValue = row.get(dbColumnName);
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, dbColumnValue);
-
- } else if (ValidTypes.getListPropertType().contains(type)) {
- // Array Types
- if (resourceAssignment.getProperty().getEntrySchema() != null) {
- entrySchema = resourceAssignment.getProperty().getEntrySchema().getType();
- }
-
- if (StringUtils.isNotBlank(entrySchema)) {
- ArrayNode arrayNode = JsonNodeFactory.instance.arrayNode();
-
- for (Map<String, Object> row : rows) {
- if (ValidTypes.getPrimitivePropertType().contains(entrySchema)) {
- String dbColumnName = outputKeyMapping.get(resourceAssignment.getDictionaryName());
- Object dbColumnValue = row.get(dbColumnName);
- // Add Array JSON
- JsonUtils.populatePrimitiveValues(dbColumnValue, entrySchema, arrayNode);
- } else {
- ObjectNode arrayChildNode = JsonNodeFactory.instance.objectNode();
- for (Map.Entry<String, String> mapping : outputKeyMapping.entrySet()) {
- Object dbColumnValue = row.get(mapping.getKey());
- String propertyTypeForDataType =
- ConfigAssignmentUtils.getPropertyType(ctx, entrySchema, mapping.getKey());
- JsonUtils.populatePrimitiveValues(mapping.getKey(), dbColumnValue, propertyTypeForDataType,
- arrayChildNode);
- }
- arrayNode.add(arrayChildNode);
- }
- }
- // Set the List of Complex Values
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, arrayNode);
- } else {
- throw new SvcLogicException(String.format("Entry schema is not defined for dictionary (%s) info",
- resourceAssignment.getDictionaryName()));
- }
- } else {
- // Complex Types
- Map<String, Object> row = rows.get(0);
- ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
- for (Map.Entry<String, String> mapping : outputKeyMapping.entrySet()) {
- Object dbColumnValue = row.get(mapping.getKey());
- String propertyTypeForDataType = ConfigAssignmentUtils.getPropertyType(ctx, type, mapping.getKey());
- JsonUtils.populatePrimitiveValues(mapping.getKey(), dbColumnValue, propertyTypeForDataType, objectNode);
- }
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, objectNode);
- }
- }
-
- @Override
- public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- // Auto-generated method stub
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/DefaultResourceProcessor.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/DefaultResourceProcessor.java deleted file mode 100644 index 563d5b523..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/DefaultResourceProcessor.java +++ /dev/null @@ -1,107 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.processor;
-
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.assignment.service.ConfigAssignmentUtils;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.service.ComponentNode;
-import org.onap.ccsdk.features.model.utils.ResourceAssignmentUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public class DefaultResourceProcessor implements ComponentNode {
-
- public DefaultResourceProcessor(ConfigResourceService configResourceService) {}
-
- @Override
- public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- return Boolean.TRUE;
- }
-
- @Override
- public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- // Auto-generated method stub
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
- // Auto-generated method stub
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- try {
- List<ResourceAssignment> batchResourceAssignment =
- (List<ResourceAssignment>) componentContext.get(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS);
-
- if (batchResourceAssignment != null && !batchResourceAssignment.isEmpty()) {
- for (ResourceAssignment resourceAssignment : batchResourceAssignment) {
- processResourceAssignment(ctx, componentContext, resourceAssignment);
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(String.format("DefaultResourceProcessor Exception : (%s)", e), e);
- }
-
- }
-
- private void processResourceAssignment(SvcLogicContext ctx, Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment) throws ConfigModelException, SvcLogicException {
- if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getName())
- && resourceAssignment.getProperty() != null) {
- try {
- // Check if It has Input
- Object value = ConfigAssignmentUtils.getContextKeyValue(ctx, resourceAssignment.getName());
- if (value == null) {
- value = resourceAssignment.getProperty().getDefaultValue();
- }
-
- // if value is null don't call setResourceDataValue to populate the value
- if (value != null) {
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- }
-
- // Check the value has populated for mandatory case
- ResourceAssignmentUtils.assertTemplateKeyValueNotNull(componentContext, resourceAssignment);
- } catch (Exception e) {
- ResourceAssignmentUtils.setFailedResourceDataValue(componentContext, resourceAssignment,
- e.getMessage());
- throw new SvcLogicException(
- String.format("Failed in template key (%s) assignments with : (%s)", resourceAssignment, e), e);
- }
- }
- }
-
- @Override
- public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- // Auto-generated method stub
-
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/InputResourceProcessor.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/InputResourceProcessor.java deleted file mode 100644 index 6c73b08de..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/InputResourceProcessor.java +++ /dev/null @@ -1,96 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.processor;
-
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.service.ComponentNode;
-import org.onap.ccsdk.features.model.utils.ResourceAssignmentUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public class InputResourceProcessor implements ComponentNode {
-
- public InputResourceProcessor(ConfigResourceService configResourceService) {}
-
- @Override
- public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- return Boolean.TRUE;
- }
-
- @Override
- public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- // Auto-generated method stub
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
- // Auto-generated method stub
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- try {
- List<ResourceAssignment> batchResourceAssignment =
- (List<ResourceAssignment>) componentContext.get(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS);
- if (batchResourceAssignment != null && !batchResourceAssignment.isEmpty()) {
- for (ResourceAssignment resourceAssignment : batchResourceAssignment) {
- processResourceAssignment(ctx, componentContext, resourceAssignment);
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(String.format("InputResourceProcessor Exception : (%s)", e), e);
- }
- }
-
- private void processResourceAssignment(SvcLogicContext ctx, Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment) throws ConfigModelException, SvcLogicException {
- try {
- if (StringUtils.isNotBlank(resourceAssignment.getName())) {
- String value = ctx.getAttribute(resourceAssignment.getName());
- // if value is null don't call setResourceDataValue to populate the value
- if (StringUtils.isNotBlank(value)) {
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- }
- }
-
- // Check the value has populated for mandatory case
- ResourceAssignmentUtils.assertTemplateKeyValueNotNull(componentContext, resourceAssignment);
- } catch (Exception e) {
- ResourceAssignmentUtils.setFailedResourceDataValue(componentContext, resourceAssignment, e.getMessage());
- throw new SvcLogicException(
- String.format("Failed in template key (%s) assignments with : (%s)", resourceAssignment, e), e);
- }
- }
-
- @Override
- public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- // Auto-generated method stub
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/MdsalResourceProcessor.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/MdsalResourceProcessor.java deleted file mode 100644 index dfc041cee..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/MdsalResourceProcessor.java +++ /dev/null @@ -1,239 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.processor;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.assignment.service.ConfigAssignmentUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.data.dict.SourcesDefinition;
-import org.onap.ccsdk.features.model.service.ComponentNode;
-import org.onap.ccsdk.features.model.utils.ResourceAssignmentUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class MdsalResourceProcessor implements ComponentNode {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(MdsalResourceProcessor.class);
- private ConfigRestAdaptorService configRestAdaptorService;
- private Map<String, ResourceDefinition> dictionaries;
-
- public MdsalResourceProcessor(ConfigRestAdaptorService configRestAdaptorService) {
- this.configRestAdaptorService = configRestAdaptorService;
- }
-
- @Override
- public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- return Boolean.TRUE;
- }
-
- @Override
- public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- // Auto-generated method stub
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
- // Auto-generated method stub
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- try {
- List<ResourceAssignment> batchResourceAssignment =
- (List<ResourceAssignment>) componentContext.get(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS);
- dictionaries =
- (Map<String, ResourceDefinition>) componentContext.get(ConfigModelConstant.PROPERTY_DICTIONARIES);
-
- if (CollectionUtils.isNotEmpty(batchResourceAssignment)) {
- for (ResourceAssignment resourceAssignment : batchResourceAssignment) {
- processResourceAssignmnet(ctx, componentContext, resourceAssignment);
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(String.format("MdsalResourceProcessor Exception : (%s) ", e), e);
- }
- }
-
- private void processResourceAssignmnet(SvcLogicContext ctx, Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment) throws ConfigModelException, SvcLogicException {
-
- try {
- // Validating Resource Assignment and Dictionary Definition data
- validate(resourceAssignment);
-
- // Check if It has Input
- Object value = ConfigAssignmentUtils.getContextKeyValue(ctx, resourceAssignment.getName());
- if (value != null) {
- logger.info("mdsal source template key ({}) found from input and value is ({})",
- resourceAssignment.getName(), value);
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- return;
- }
-
- ResourceDefinition resourceDefinition = dictionaries.get(resourceAssignment.getDictionaryName());
- SourcesDefinition sourceMdsal = resourceDefinition.getSources().get("mdsal");
- String urlPath = sourceMdsal.getProperties().getUrlPath();
- String path = sourceMdsal.getProperties().getPath();
- Map<String, String> inputKeyMapping = sourceMdsal.getProperties().getInputKeyMapping();
- Map<String, String> outputKeyMapping = sourceMdsal.getProperties().getOutputKeyMapping();
-
- logger.info(
- "mdsal dictionary information : urlpath ({}), path({}), inputKeyMapping ({}), outputKeyMapping ({})",
- urlPath, path, inputKeyMapping, outputKeyMapping);
-
- // Resolving url Variables
- Map<String, Object> urlVariables = populateUrlVariables(inputKeyMapping, componentContext);
- for (Map.Entry<String, Object> entry : urlVariables.entrySet()) {
- urlPath = urlPath.replaceAll("\\$" + entry.getKey(), entry.getValue().toString());
- }
-
- String restResponse = fetchResourceFromMDSAL(urlPath);
- // if restResponse is null don't call processMdsalResults to populate the value
- if (StringUtils.isNotBlank(restResponse)) {
- // Processing MDSAL Response
- processMdsalResults(ctx, componentContext, resourceAssignment, sourceMdsal, restResponse);
- } else {
- logger.warn("Coudn't get proper mdsal Response content ({}) for Resource Name ({}) for URI ({})",
- restResponse, resourceAssignment.getDictionaryName(), urlPath);
- }
-
- // Check the value has populated for mandatory case
- ResourceAssignmentUtils.assertTemplateKeyValueNotNull(componentContext, resourceAssignment);
- } catch (Exception e) {
- ResourceAssignmentUtils.setFailedResourceDataValue(componentContext, resourceAssignment, e.getMessage());
- throw new SvcLogicException(
- String.format("Failed in assignments for (%s) with (%s)", resourceAssignment, e), e);
- }
- }
-
- private String fetchResourceFromMDSAL(String urlPath) {
- String response = null;
- try {
- response = configRestAdaptorService.getResource(ConfigRestAdaptorConstants.SELECTOR_RESTCONF, urlPath,
- String.class);
- } catch (Exception e) {
- logger.warn("Fetching MDSAL data for URL ({}) failed with Error ({})", urlPath, e);
- }
- return response;
- }
-
- private void validate(ResourceAssignment resourceAssignment) throws SvcLogicException {
- if (resourceAssignment == null) {
- throw new SvcLogicException("resource assignment is not defined");
- }
-
- if (StringUtils.isBlank(resourceAssignment.getName())) {
- throw new SvcLogicException("resource assignment template key is not defined");
- }
-
- if (StringUtils.isBlank(resourceAssignment.getDictionaryName())) {
- throw new SvcLogicException(
- String.format("resource assignment dictionary name is not defined for template key (%s)",
- resourceAssignment.getName()));
- }
-
- if (!ConfigModelConstant.SOURCE_MDSAL.equalsIgnoreCase(resourceAssignment.getDictionarySource())) {
- throw new SvcLogicException(String.format("resource assignment source is not mdsal, it is (%s)",
- resourceAssignment.getDictionarySource()));
- }
-
- ResourceDefinition resourceDefinition = dictionaries.get(resourceAssignment.getDictionaryName());
- if (resourceDefinition == null) {
- throw new SvcLogicException(String.format("missing resource dictionary definition for name (%s) ",
- resourceAssignment.getDictionaryName()));
- }
-
- if (StringUtils.isBlank(resourceDefinition.getProperty().getType())) {
- throw new SvcLogicException(String.format(String.format("Failed to get dictionary (%s) data type info.",
- resourceAssignment.getDictionaryName())));
- }
-
- if (resourceDefinition.getSources() == null || resourceDefinition.getSources().get("mdsal") == null) {
- throw new SvcLogicException(
- String.format("missing resource dictionary mdsal source definition for name (%s) ",
- resourceAssignment.getDictionaryName()));
- }
-
- SourcesDefinition sourceMdsal = resourceDefinition.getSources().get("mdsal");
- if (StringUtils.isBlank(sourceMdsal.getProperties().getUrlPath())) {
- throw new SvcLogicException(String.format("Failed to get request URL Path for dictionary (%s)",
- resourceAssignment.getDictionaryName()));
- }
-
- if (StringUtils.isBlank(sourceMdsal.getProperties().getPath())) {
- throw new SvcLogicException(String.format("Failed to get request Path for dictionary (%s)",
- resourceAssignment.getDictionaryName()));
- }
- }
-
- private Map<String, Object> populateUrlVariables(Map<String, String> inputKeyMapping,
- Map<String, Object> componentContext) {
- Map<String, Object> urlVariables = new HashMap<>();
- if (MapUtils.isNotEmpty(inputKeyMapping)) {
-
- for (Map.Entry<String, String> mapping : inputKeyMapping.entrySet()) {
- ResourceDefinition referenceDictionaryDefinition = dictionaries.get(mapping.getValue());
- Object expressionValue =
- ResourceAssignmentUtils.getDictionaryKeyValue(componentContext, referenceDictionaryDefinition);
- logger.trace("Reference dictionary key ({}), value ({})", mapping.getKey(), expressionValue);
- urlVariables.put(mapping.getKey(), expressionValue);
- }
- }
- return urlVariables;
- }
-
- private void processMdsalResults(SvcLogicContext ctx, Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment, SourcesDefinition sourceMdsal, String restResponse)
- throws SvcLogicException, ConfigModelException {
-
- Map<String, String> outputKeyMapping = sourceMdsal.getProperties().getOutputKeyMapping();
- JsonNode responseNode = TransformationUtils.getJsonNodeForString(restResponse);
- if (StringUtils.isNotBlank(sourceMdsal.getProperties().getPath())) {
- responseNode = responseNode.at(sourceMdsal.getProperties().getPath());
- }
- if (responseNode != null) {
- ConfigAssignmentUtils.populateValueForOutputMapping(ctx, componentContext, resourceAssignment,
- outputKeyMapping, responseNode);
- }
- }
-
- @Override
- public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- // Do Nothing
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/ProcessorFactory.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/ProcessorFactory.java deleted file mode 100644 index bb620a1a3..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/ProcessorFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.processor;
-
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.service.ComponentNode;
-import org.onap.ccsdk.features.model.service.ComponentNodeService;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-
-public class ProcessorFactory {
-
- private ConfigResourceService configResourceService;
- private ConfigRestAdaptorService configRestAdaptorService;
- private ComponentNodeService componentNodeService;
-
- public ProcessorFactory(ConfigResourceService configResourceService,
- ConfigRestAdaptorService configRestAdaptorService, ComponentNodeService componentNodeService) {
- this.componentNodeService = componentNodeService;
- this.configResourceService = configResourceService;
- this.configRestAdaptorService = configRestAdaptorService;
- }
-
- public ComponentNode getInstance(String source) {
-
- if (ConfigModelConstant.SOURCE_DEFAULT.equalsIgnoreCase(source)) {
- return new DefaultResourceProcessor(configResourceService);
- } else if (ConfigModelConstant.SOURCE_DB.equalsIgnoreCase(source)) {
- return new DBResourceProcessor(configResourceService);
- } else if (ConfigModelConstant.SOURCE_MDSAL.equalsIgnoreCase(source)) {
- return new MdsalResourceProcessor(configRestAdaptorService);
- }
- // Default
- return new InputResourceProcessor(configResourceService);
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/ResourceAssignmentProcessor.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/ResourceAssignmentProcessor.java deleted file mode 100644 index 3ee49f085..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/processor/ResourceAssignmentProcessor.java +++ /dev/null @@ -1,120 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.processor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections.CollectionUtils;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.utils.TopologicalSortingUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ResourceAssignmentProcessor {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceAssignmentProcessor.class);
-
- private List<ResourceAssignment> assignments;
- private Map<String, ResourceAssignment> resourceAssignmentMap;
-
- @SuppressWarnings("squid:S1172")
- public ResourceAssignmentProcessor(List<ResourceAssignment> assignments, SvcLogicContext ctx) {
- this.assignments = assignments;
- this.resourceAssignmentMap = new HashMap<>();
- }
-
- @SuppressWarnings("squid:S3776")
- public List<List<ResourceAssignment>> process() {
- List<List<ResourceAssignment>> sequenceBatchResourceAssignment = new ArrayList<>();
- if (this.assignments != null) {
- logger.info("Assignments ({})", this.assignments);
- this.assignments.forEach(resourceMapping -> {
- if (resourceMapping != null) {
- logger.trace("Processing Key ({})", resourceMapping.getName());
- resourceAssignmentMap.put(resourceMapping.getName(), resourceMapping);
- }
- });
-
- TopologicalSortingUtils<ResourceAssignment> topologySorting = new TopologicalSortingUtils<>();
- this.resourceAssignmentMap.forEach((mappingKey, mapping) -> {
- if (mapping != null) {
- if (mapping.getDependencies() != null && !mapping.getDependencies().isEmpty()) {
- for (String dependency : mapping.getDependencies()) {
- topologySorting.add(resourceAssignmentMap.get(dependency), mapping);
- }
- } else {
- topologySorting.add(null, mapping);
- }
- }
- });
-
- List<ResourceAssignment> sequencedResourceAssignments = topologySorting.topSort();
- logger.info("Sorted Sequenced Assignments ({})", sequencedResourceAssignments);
-
- List<ResourceAssignment> batchResourceAssignment = null;
- List<String> batchAssignmentName = null;
- for (int i = 0; i < sequencedResourceAssignments.size(); i++) {
- ResourceAssignment resourceAssignment = sequencedResourceAssignments.get(i);
- ResourceAssignment previousResourceAssignment = null;
-
- if (i > 0) {
- previousResourceAssignment = sequencedResourceAssignments.get(i - 1);
- }
- if (resourceAssignment != null) {
-
- boolean dependencyPresence = false;
- if (batchAssignmentName != null && resourceAssignment.getDependencies() != null) {
- dependencyPresence =
- CollectionUtils.containsAny(batchAssignmentName, resourceAssignment.getDependencies());
- }
-
- logger.trace("({}) -> Checking ({}), with ({}), result ({})", resourceAssignment.getName(),
- batchAssignmentName, resourceAssignment.getDependencies(), dependencyPresence);
-
- if (previousResourceAssignment != null && resourceAssignment.getDictionarySource() != null
- && resourceAssignment.getDictionarySource()
- .equalsIgnoreCase(previousResourceAssignment.getDictionarySource())
- && !dependencyPresence) {
- batchResourceAssignment.add(resourceAssignment);
- batchAssignmentName.add(resourceAssignment.getName());
- } else {
- if (batchResourceAssignment != null) {
- sequenceBatchResourceAssignment.add(batchResourceAssignment);
- logger.trace("Created old Set ({})", batchAssignmentName);
- }
- batchResourceAssignment = new ArrayList<>();
- batchResourceAssignment.add(resourceAssignment);
-
- batchAssignmentName = new ArrayList<>();
- batchAssignmentName.add(resourceAssignment.getName());
- }
- }
-
- if (i == (sequencedResourceAssignments.size() - 1)) {
- logger.trace("Created old Set ({})", batchAssignmentName);
- sequenceBatchResourceAssignment.add(batchResourceAssignment);
- }
- }
- logger.info("Batched Sequence : ({})", sequenceBatchResourceAssignment);
- }
- return sequenceBatchResourceAssignment;
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentNode.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentNode.java deleted file mode 100644 index aaeadcabd..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentNode.java +++ /dev/null @@ -1,231 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.assignment.ConfigAssignmentConstants;
-import org.onap.ccsdk.features.assignment.data.ResourceAssignmentData;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.generator.service.ConfigGeneratorService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.service.ComponentNode;
-import org.onap.ccsdk.features.model.service.ComponentNodeService;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigAssignmentNode implements ComponentNode {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentNode.class);
-
- private ComponentNodeService componentNodeService;
- private ConfigResourceService configResourceService;
- private ConfigModelService configModelService;
- private ConfigRestAdaptorService configRestAdaptorService;
- private ConfigGeneratorService configGeneratorService;
-
- public ConfigAssignmentNode(ConfigResourceService configResourceService,
- ConfigRestAdaptorService configRestAdaptorService, ConfigModelService configModelService,
- ComponentNodeService componentNodeService, ConfigGeneratorService configGeneratorService) {
- logger.info("{} Constrctor Initiated", "ConfigAssignmentNode");
- this.componentNodeService = componentNodeService;
- this.configResourceService = configResourceService;
- this.configModelService = configModelService;
- this.configRestAdaptorService = configRestAdaptorService;
- this.configGeneratorService = configGeneratorService;
- }
-
- @Override
- public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- return Boolean.TRUE;
- }
-
- @Override
- public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- // Auto-generated method stub
- }
-
- /**
- * This method is used to resolve the resources defined in the template. Generic Resource API DG
- * calls this execute node.
- *
- * @param inParams This is the input parameter to process this node
- *
- * <pre>
- request-id (string): Tracking Id
- resource-type (string): Resource Type ( ex : vnf-type)
- resource-id (string): Resource Id
- service-template-name (string): Blueprint Name
- service-template-version (string): Blueprint Version
- action-name (string):
- template-names (List of string): Template Names / Artifact Node Names to resolve. ["template1", "template2"]
- input-data (string): Input Data in JSON String, for the substitution in the Template.
- prifix (string): Return Value selector
- * </pre>
- *
- * @param ctx This is the service logger context, Output will be stored (
- * <responsePrefix>.resource-assignment-params.<template-name> : Output Data in JSON String.
- * <responsePrefix>.status <responsePrefix>.error-message )
- * @throws SvcLogicException On processing error.
- */
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
-
- final String responsePrefix = StringUtils.isNotBlank(inParams.get(ConfigModelConstant.PROPERTY_SELECTOR))
- ? (inParams.get(ConfigModelConstant.PROPERTY_SELECTOR) + ".")
- : "";
- try {
-
- ResourceAssignmentData resourceAssignmentData = populateResourceData(inParams);
- resourceAssignmentData.setSvcLogicContext(ctx);
- Map<String, Object> componentContext = new HashMap<>();
- resourceAssignmentData.setContext(componentContext);
- resourceAssignmentData.setReloadModel(true);
-
- ConfigAssignmentProcessService configAssignmentProcessService =
- new ConfigAssignmentProcessService(configResourceService, configRestAdaptorService,
- configModelService, componentNodeService, configGeneratorService);
- configAssignmentProcessService.resolveResources(resourceAssignmentData);
-
- if (MapUtils.isNotEmpty(resourceAssignmentData.getTemplatesMashedContents())) {
- resourceAssignmentData.getTemplatesMashedContents().forEach((templateName, previewContent) -> {
- logger.debug("For Template name : ({}),\n Preview Content is : ({})", templateName, previewContent);
- ctx.setAttribute(
- responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_MASHED_DATA + "." + templateName,
- previewContent);
- });
- }
- ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_STATUS,
- ConfigAssignmentConstants.OUTPUT_STATUS_SUCCESS);
- } catch (Exception e) {
- ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_STATUS,
- ConfigAssignmentConstants.OUTPUT_STATUS_FAILURE);
- ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
- throw new SvcLogicException(e.getMessage(), e);
- }
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
-
- final String responsePrefix = StringUtils.isNotBlank(inParams.get(ConfigModelConstant.PROPERTY_SELECTOR))
- ? (inParams.get(ConfigModelConstant.PROPERTY_SELECTOR) + ".")
- : "";
- try {
-
- ResourceAssignmentData resourceAssignmentData = populateResourceData(inParams);
- resourceAssignmentData.setSvcLogicContext(ctx);
- resourceAssignmentData.setContext(componentContext);
- resourceAssignmentData.setReloadModel(false);
-
- ConfigAssignmentProcessService configAssignmentProcessService =
- new ConfigAssignmentProcessService(configResourceService, configRestAdaptorService,
- configModelService, componentNodeService, configGeneratorService);
- configAssignmentProcessService.resolveResources(resourceAssignmentData);
- ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_STATUS,
- ConfigAssignmentConstants.OUTPUT_STATUS_SUCCESS);
-
- } catch (Exception e) {
- ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_STATUS,
- ConfigAssignmentConstants.OUTPUT_STATUS_FAILURE);
- ctx.setAttribute(responsePrefix + ConfigAssignmentConstants.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
- throw new SvcLogicException(e.getMessage(), e);
- }
- }
-
- @Override
- public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- // Do Nothing
- }
-
- private ResourceAssignmentData populateResourceData(Map<String, String> inParams) throws SvcLogicException {
- validateInputParams(inParams);
-
- String requestId = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID);
- String resourceId = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID);
- String resourceType = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE);
- String serviceTemplateName = inParams.get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME);
- String serviceTemplateVersion = inParams.get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION);
- String actionName = inParams.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- String inputData = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_INPUT_DATA);
-
- String templateNamesStr = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES);
- List<String> templateNames = TransformationUtils.getListfromJson(templateNamesStr, String.class);
-
- ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData();
- resourceAssignmentData.setRequestId(requestId);
- resourceAssignmentData.setResourceId(resourceId);
- resourceAssignmentData.setResourceType(resourceType);
- resourceAssignmentData.setServiceTemplateName(serviceTemplateName);
- resourceAssignmentData.setServiceTemplateVersion(serviceTemplateVersion);
- resourceAssignmentData.setActionName(actionName);
- resourceAssignmentData.setInputData(inputData);
- resourceAssignmentData.setTemplateNames(templateNames);
-
- return resourceAssignmentData;
- }
-
- private void validateInputParams(Map<String, String> inParams) throws SvcLogicException {
- if (inParams == null) {
- throw new SvcLogicException("Input parameters missing");
- }
-
- String requestId = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID);
- if (StringUtils.isBlank(requestId)) {
- throw new SvcLogicException("Request id parameters missing");
- }
- String resourceId = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID);
- if (StringUtils.isBlank(resourceId)) {
- throw new SvcLogicException("Resource id parameter is missing");
- }
- String resourceType = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE);
- if (StringUtils.isBlank(resourceType)) {
- throw new SvcLogicException("Resource type parameter is missing");
- }
- String recipeName = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_ACTION_NAME);
- if (StringUtils.isBlank(recipeName)) {
- throw new SvcLogicException("Action name is parameter is missing");
- }
- String templateNames = inParams.get(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES);
- if (StringUtils.isBlank(templateNames)) {
- throw new SvcLogicException("Template names parameter missing");
- }
- String serviceTemplateName = inParams.get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME);
- if (StringUtils.isBlank(serviceTemplateName)) {
- throw new SvcLogicException("Service Template name parameter missing");
- }
- String serviceTemplateVersion = inParams.get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION);
- if (StringUtils.isBlank(serviceTemplateVersion)) {
- throw new SvcLogicException("Service Template version parameter missing");
- }
-
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentPersistService.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentPersistService.java deleted file mode 100644 index 44ddf5382..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentPersistService.java +++ /dev/null @@ -1,124 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.util.List;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.data.adaptor.DataAdaptorConstants;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.domain.ResourceAssignmentData;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.utils.ResourceAssignmentUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigAssignmentPersistService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentPersistService.class);
-
- private ConfigResourceService configResourceService;
-
- public ConfigAssignmentPersistService(ConfigResourceService configResourceService) {
- this.configResourceService = configResourceService;
- }
-
- public void saveResourceMapping(
- org.onap.ccsdk.features.assignment.data.ResourceAssignmentData resourceAssignmentData, String templateName,
- List<ResourceAssignment> resourceAssignments) throws SvcLogicException {
- try {
-
- if (resourceAssignmentData == null) {
- throw new SvcLogicException("Resource assignment data is missing");
- }
-
- if (StringUtils.isBlank(resourceAssignmentData.getRequestId())) {
- logger.warn("Request Id ({}) is missing, may be getting request for resource update.",
- resourceAssignmentData.getRequestId());
- }
-
- if (StringUtils.isBlank(resourceAssignmentData.getResourceId())) {
- throw new SvcLogicException("Resource Id is missing");
- }
-
- if (StringUtils.isBlank(resourceAssignmentData.getResourceType())) {
- throw new SvcLogicException("Resource type is missing");
- }
-
- if (StringUtils.isBlank(resourceAssignmentData.getActionName())) {
- throw new SvcLogicException("Action name is missing");
- }
-
- if (StringUtils.isBlank(templateName)) {
- throw new SvcLogicException("template name is missing");
- }
-
- StringBuilder builder = new StringBuilder();
- builder.append("Resource Assignment for Template Name :");
- builder.append(templateName);
- builder.append("\n");
- builder.append(TransformationUtils.getJson(resourceAssignments, true));
-
- configResourceService.save(new TransactionLog(resourceAssignmentData.getRequestId(),
- DataAdaptorConstants.LOG_MESSAGE_TYPE_LOG, builder.toString()));
-
- // Resource Data should be Regenerated based on the new Updates
- String resourceData = ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments);
-
- List<ResourceAssignmentData> resourceAssignmentDataList =
- ConfigAssignmentUtils.convertResoureAssignmentList(resourceAssignments);
-
- ConfigResource configResource = new ConfigResource();
- configResource.setRequestId(resourceAssignmentData.getRequestId());
- configResource.setServiceTemplateName(resourceAssignmentData.getServiceTemplateName());
- configResource.setServiceTemplateVersion(resourceAssignmentData.getServiceTemplateVersion());
- configResource.setRecipeName(resourceAssignmentData.getActionName());
- configResource.setResourceId(resourceAssignmentData.getResourceId());
- configResource.setResourceType(resourceAssignmentData.getResourceType());
- configResource.setResourceData(resourceData);
- configResource.setTemplateName(templateName);
- configResource.setStatus(ConfigModelConstant.STATUS_SUCCESS);
- configResource.setUpdatedBy(ConfigModelConstant.USER_SYSTEM);
-
- if (CollectionUtils.isNotEmpty(resourceAssignmentDataList)) {
- configResource.setResourceAssignments(resourceAssignmentDataList);
- }
- configResource = configResourceService.saveConfigResource(configResource);
- logger.info("Resource data saved successfully for the template ({}) with resource id ({})", templateName,
- configResource.getResourceId());
-
- builder = new StringBuilder();
- builder.append("Resource Data Template Name :");
- builder.append(templateName);
- builder.append("\n");
- builder.append(resourceData);
- configResourceService.save(new TransactionLog(resourceAssignmentData.getRequestId(),
- DataAdaptorConstants.LOG_MESSAGE_TYPE_LOG, builder.toString()));
-
- } catch (Exception e) {
- throw new SvcLogicException("ConfigAssignmentPersistService : " + e.getMessage(), e);
- }
-
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentProcessService.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentProcessService.java deleted file mode 100644 index 61c035960..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentProcessService.java +++ /dev/null @@ -1,238 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.assignment.ConfigAssignmentConstants;
-import org.onap.ccsdk.features.assignment.data.ResourceAssignmentData;
-import org.onap.ccsdk.features.assignment.processor.ProcessorFactory;
-import org.onap.ccsdk.features.assignment.processor.ResourceAssignmentProcessor;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.generator.service.ConfigGeneratorService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.service.ComponentNode;
-import org.onap.ccsdk.features.model.service.ComponentNodeService;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.model.utils.ResourceAssignmentUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigAssignmentProcessService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentProcessService.class);
-
- private ComponentNodeService componentNodeService;
- private ConfigResourceService configResourceService;
- private ConfigModelService configModelService;
- private ConfigRestAdaptorService configRestAdaptorService;
- private ConfigGeneratorService configGeneratorService;
-
- public ConfigAssignmentProcessService(ConfigResourceService configResourceService,
- ConfigRestAdaptorService configRestAdaptorService, ConfigModelService configModelService,
- ComponentNodeService componentNodeService, ConfigGeneratorService configGeneratorService) {
- this.componentNodeService = componentNodeService;
- this.configResourceService = configResourceService;
- this.configModelService = configModelService;
- this.configRestAdaptorService = configRestAdaptorService;
- this.configGeneratorService = configGeneratorService;
- }
-
- @SuppressWarnings("squid:S1141")
- public void resolveResources(ResourceAssignmentData resourceAssignmentData) throws SvcLogicException {
- try {
- validateInputParams(resourceAssignmentData);
-
- String serviceTemplateName = resourceAssignmentData.getServiceTemplateName();
- String serviceTemplateVersion = resourceAssignmentData.getServiceTemplateVersion();
- String actionName = resourceAssignmentData.getActionName();
- String inputData = resourceAssignmentData.getInputData();
- SvcLogicContext svcLogicContext = resourceAssignmentData.getSvcLogicContext();
- List<String> templateNames = resourceAssignmentData.getTemplateNames();
-
- if (resourceAssignmentData.isReloadModel()) {
- Map<String, String> context = new HashMap<>();
- context.put(ConfigModelConstant.PROPERTY_ACTION_NAME, actionName);
- context = configModelService.prepareContext(context, inputData, serviceTemplateName,
- serviceTemplateVersion);
- context.forEach((key, value) -> svcLogicContext.setAttribute(key, value));
- logger.info("List of Resources provided in input: {}", svcLogicContext.toProperties());
- }
-
- Map<String, Object> componentContext = resourceAssignmentData.getContext();
-
- if (CollectionUtils.isNotEmpty(templateNames)) {
- // Get the Resource Assignments for templates and Validate the mappings
- ResourceModelService resourceModelService = new ResourceModelService(configModelService);
-
- // Get the Resource Assignment
- Map<String, List<ResourceAssignment>> templatesResourceAssignments =
- resourceModelService.getTemplatesResourceAssignments(svcLogicContext, templateNames);
-
- // Get the Template Contents
- Map<String, String> templatesContents =
- resourceModelService.getTemplatesContents(svcLogicContext, templateNames);
-
- // Process each template
- for (String templateName : templateNames) {
- List<ResourceAssignment> resourceAssignments = templatesResourceAssignments.get(templateName);
- String templateContent = templatesContents.get(templateName);
- if (resourceAssignments != null) {
- String templateData = null;
- try {
- // Populate the Dictionary
- ResourceDictionaryService resourceDictionaryService =
- new ResourceDictionaryService(configRestAdaptorService);
- Map<String, ResourceDefinition> dictionaries =
- resourceDictionaryService.getDataDictionaryDefinitions(resourceAssignments);
-
- processResourceAssignments(resourceAssignmentData, svcLogicContext, componentContext,
- templateName, resourceAssignments, dictionaries);
-
- logger.info("decrypting config data for templateName {}", templateName);
- templateData =
- ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments);
- } finally {
- saveResourceMapping(resourceAssignmentData, templateName, resourceAssignments);
- }
-
- logger.info("generating config preview for templateName {}", templateName);
- ConfigPreviewService configPreviewService = new ConfigPreviewService(configResourceService,
- configModelService, configGeneratorService);
- String mashedData = configPreviewService.generatePreview(templateContent, templateData);
- resourceAssignmentData.getTemplatesMashedContents().put(templateName, mashedData);
- resourceAssignmentData.getTemplatesData().put(templateName, templateData);
-
- } else {
- // Do nothing for Mapping not found
- logger.warn("No resource Assignment mappings to resolve for templateName {}", templateName);
- }
- }
- }
-
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage(), e);
- }
- }
-
- private void processResourceAssignments(ResourceAssignmentData resourceAssignmentData, SvcLogicContext ctx,
- Map<String, Object> componentContext, String templateName, List<ResourceAssignment> resourceAssignments,
- Map<String, ResourceDefinition> dictionaries) throws SvcLogicException {
-
- String recipeName = resourceAssignmentData.getActionName();
-
- ResourceAssignmentProcessor resourceAssignmentProcessor =
- new ResourceAssignmentProcessor(resourceAssignments, ctx);
- List<List<ResourceAssignment>> sequenceBatchResourceAssignment = resourceAssignmentProcessor.process();
-
- logger.debug("Resource dictionary Info ({})", dictionaries);
-
- if (sequenceBatchResourceAssignment != null) {
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, templateName);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
- for (List<ResourceAssignment> batchResourceAssignment : sequenceBatchResourceAssignment) {
-
- processBatchResourceAssignments(resourceAssignmentData, ctx, componentContext, batchResourceAssignment);
-
- logger.debug("Batch Resource data status ({})", TransformationUtils.getJson(batchResourceAssignment));
- }
- }
- }
-
- private void processBatchResourceAssignments(ResourceAssignmentData resourceAssignmentData, SvcLogicContext ctx,
- Map<String, Object> componentContext, List<ResourceAssignment> batchResourceAssignment)
- throws SvcLogicException {
-
- if (CollectionUtils.isNotEmpty(batchResourceAssignment)) {
-
- ResourceAssignment batchFirstResourceAssignment = batchResourceAssignment.get(0);
- if (batchFirstResourceAssignment != null
- && StringUtils.isNotBlank(batchFirstResourceAssignment.getDictionarySource())) {
- String source = batchFirstResourceAssignment.getDictionarySource();
- // Processing their Source
- logger.info("Processing source ({}) with batch ({}) ", source, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
-
- ProcessorFactory factory =
- new ProcessorFactory(configResourceService, configRestAdaptorService, componentNodeService);
-
- ComponentNode processor = factory.getInstance(source);
-
- Map<String, String> inParams = new HashMap<>();
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID, resourceAssignmentData.getRequestId());
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID, resourceAssignmentData.getResourceId());
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE,
- resourceAssignmentData.getResourceType());
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_ACTION_NAME, resourceAssignmentData.getActionName());
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES,
- resourceAssignmentData.getTemplateNames().toString());
- processor.process(inParams, ctx, componentContext);
- }
- }
- }
-
- private void saveResourceMapping(ResourceAssignmentData resourceAssignmentData, String templateName,
- List<ResourceAssignment> resourceAssignments) throws SvcLogicException {
- if (resourceAssignmentData != null && StringUtils.isNotBlank(templateName)) {
-
- ConfigAssignmentPersistService configAssignmentPersistService =
- new ConfigAssignmentPersistService(configResourceService);
- configAssignmentPersistService.saveResourceMapping(resourceAssignmentData, templateName,
- resourceAssignments);
- }
- }
-
- private void validateInputParams(ResourceAssignmentData resourceAssignmentData) throws SvcLogicException {
- if (resourceAssignmentData == null) {
- throw new SvcLogicException("Input parameters missing");
- }
-
- String requestId = resourceAssignmentData.getRequestId();
- if (StringUtils.isBlank(requestId)) {
- throw new SvcLogicException("Request id parameters missing");
- }
- String resourceId = resourceAssignmentData.getResourceId();
- if (StringUtils.isBlank(resourceId)) {
- throw new SvcLogicException("Resource id parameter is missing");
- }
- String resourceType = resourceAssignmentData.getResourceType();
- if (StringUtils.isBlank(resourceType)) {
- throw new SvcLogicException("Resource type parameter is missing");
- }
- String actionName = resourceAssignmentData.getActionName();
- if (StringUtils.isBlank(actionName)) {
- throw new SvcLogicException("Action name is parameter is missing");
- }
-
- List<String> templatesNames = resourceAssignmentData.getTemplateNames();
- if (CollectionUtils.isEmpty(templatesNames)) {
- throw new SvcLogicException("Template names parameter missing");
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentService.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentService.java deleted file mode 100644 index e3f32171d..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentService.java +++ /dev/null @@ -1,35 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.util.List;
-import org.onap.ccsdk.features.assignment.data.ResourceAssignmentData;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public interface ConfigAssignmentService {
-
- public void resolveResources(ResourceAssignmentData resourceAssignmentData) throws SvcLogicException;
-
- public void saveResourceMapping(ResourceAssignmentData resourceAssignmentData, String templateName,
- List<ResourceAssignment> resourceAssignments) throws SvcLogicException;
-
- public ResourceAssignmentData generateTemplateResourceMash(ResourceAssignmentData resourceAssignmentData)
- throws SvcLogicException;
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentServiceImpl.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentServiceImpl.java deleted file mode 100644 index bb60a23a4..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentServiceImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.util.List;
-import org.onap.ccsdk.features.assignment.data.ResourceAssignmentData;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.generator.service.ConfigGeneratorService;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.service.ComponentNodeService;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigAssignmentServiceImpl implements ConfigAssignmentService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentServiceImpl.class);
-
- private ComponentNodeService componentNodeService;
- private ConfigResourceService configResourceService;
- private ConfigModelService configModelService;
- private ConfigRestAdaptorService configRestAdaptorService;
- private ConfigGeneratorService configGeneratorService;
-
- private static final String CLASS_NAME = "ConfigAssignmentServiceImpl";
-
- public ConfigAssignmentServiceImpl(ConfigResourceService configResourceService,
- ConfigRestAdaptorService configRestAdaptorService, ConfigModelService configModelService,
- ComponentNodeService componentNodeService, ConfigGeneratorService configGeneratorService) {
- logger.info("{} Constuctor Initated...", CLASS_NAME);
- this.componentNodeService = componentNodeService;
- this.configResourceService = configResourceService;
- this.configModelService = configModelService;
- this.configRestAdaptorService = configRestAdaptorService;
- this.configGeneratorService = configGeneratorService;
- }
-
- @Override
- public void resolveResources(ResourceAssignmentData resourceAssignmentData) throws SvcLogicException {
- ConfigAssignmentProcessService configAssignmentProcessService =
- new ConfigAssignmentProcessService(configResourceService, configRestAdaptorService, configModelService,
- componentNodeService, configGeneratorService);
- configAssignmentProcessService.resolveResources(resourceAssignmentData);
- }
-
- @Override
- public void saveResourceMapping(ResourceAssignmentData resourceAssignmentData, String templateName,
- List<ResourceAssignment> resourceAssignments) throws SvcLogicException {
- ConfigAssignmentPersistService configAssignmentPersistService =
- new ConfigAssignmentPersistService(configResourceService);
- configAssignmentPersistService.saveResourceMapping(resourceAssignmentData, templateName, resourceAssignments);
- }
-
- @Override
- public ResourceAssignmentData generateTemplateResourceMash(ResourceAssignmentData resourceAssignmentData)
- throws SvcLogicException {
- ConfigPreviewService configPreviewService =
- new ConfigPreviewService(configResourceService, configModelService, configGeneratorService);
- return configPreviewService.generateTemplateResourceMash(resourceAssignmentData);
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentUtils.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentUtils.java deleted file mode 100644 index 15221ae64..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentUtils.java +++ /dev/null @@ -1,301 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.IteratorUtils;
-import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.data.adaptor.domain.ResourceAssignmentData;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.EntrySchema;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.domain.ResourceDictionary;
-import org.onap.ccsdk.features.model.utils.JsonUtils;
-import org.onap.ccsdk.features.model.utils.ResourceAssignmentUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class ConfigAssignmentUtils {
-
- private ConfigAssignmentUtils() {
-
- }
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentUtils.class);
-
- public static synchronized Object getContextKeyValue(SvcLogicContext context, String key) {
- Object value = null;
- if (context != null && key != null && context.getAttributeKeySet().contains(key)) {
- String strValue = context.getAttribute(key);
- if (StringUtils.isNotBlank(strValue)) {
- value = strValue;
- }
- }
- return value;
- }
-
- /*
- * Populate the Field property type for the Data type
- */
- public static synchronized String getPropertyType(SvcLogicContext ctx, String dataTypeName, String propertyName)
- throws SvcLogicException {
- String type = ValidTypes.DATA_TYPE_STRING;
- try {
- if (ctx != null && StringUtils.isNotBlank(dataTypeName) && StringUtils.isNotBlank(propertyName)) {
- String dataTypeContent = ctx.getAttribute(ConfigModelConstant.PROPERTY_DATA_TYPES_DOT + dataTypeName);
- if (StringUtils.isNotBlank(dataTypeContent)) {
- DataType dataType = TransformationUtils.readValue(dataTypeContent, DataType.class);
- if (dataType != null && dataType.getProperties() != null
- && dataType.getProperties().containsKey(propertyName)) {
- PropertyDefinition propertyDefinition = dataType.getProperties().get(propertyName);
- if (StringUtils.isNotBlank(propertyDefinition.getType())) {
- type = propertyDefinition.getType();
- logger.trace("Data type({})'s property ({}) is ({})", dataTypeName, propertyName, type);
- } else {
- throw new SvcLogicException(String.format("Couldn't get data type (%s) ", dataTypeName));
- }
- }
- } else {
- throw new SvcLogicException(String.format("Couldn't get data type (%s) content", dataTypeName));
- }
- }
- } catch (Exception e) {
- logger.error("couldn't get data type({})'s property ({}), type ({}), error message ({}).", dataTypeName,
- propertyName, type, e.getMessage());
- throw new SvcLogicException(e.getMessage());
- }
- return type;
- }
-
- /*
- * Populate the Field property type for the Data type
- */
- public static synchronized PropertyDefinition getPropertyDefinition(SvcLogicContext ctx, String dataTypeName,
- String propertyName) throws SvcLogicException {
- PropertyDefinition propertyDefinition = null;
- try {
- if (ctx != null && StringUtils.isNotBlank(dataTypeName) && StringUtils.isNotBlank(propertyName)) {
- String dataTypeContent = ctx.getAttribute(ConfigModelConstant.PROPERTY_DATA_TYPES_DOT + dataTypeName);
- if (StringUtils.isNotBlank(dataTypeContent)) {
- DataType dataType = TransformationUtils.readValue(dataTypeContent, DataType.class);
- if (dataType != null && dataType.getProperties() != null
- && dataType.getProperties().containsKey(propertyName)) {
- propertyDefinition = dataType.getProperties().get(propertyName);
- if (propertyDefinition == null) {
- throw new SvcLogicException(String.format("couldn't get data type (%s) ", dataTypeName));
- }
- }
- } else {
- throw new SvcLogicException(String.format("couldn't get data type (%s) content.", dataTypeName));
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- return propertyDefinition;
- }
-
- public static synchronized ResourceDefinition getDictionaryDefinition(Map<String, ResourceDictionary> dictionaries,
- String dictionaryName) {
- ResourceDefinition resourceDefinition = null;
- if (dictionaries != null && StringUtils.isNotBlank(dictionaryName)) {
- ResourceDictionary resourceDictionary = dictionaries.get(dictionaryName);
- if (resourceDictionary != null && resourceDictionary.getDefinition() != null) {
- resourceDefinition =
- TransformationUtils.treeToValue(resourceDictionary.getDefinition(), ResourceDefinition.class);
- }
- }
- return resourceDefinition;
- }
-
- @SuppressWarnings("squid:S3776")
- public static synchronized void populateValueForOutputMapping(SvcLogicContext ctx,
- Map<String, Object> componentContext, ResourceAssignment resourceAssignment,
- Map<String, String> outputKeyMapping, JsonNode responseNode)
- throws ConfigModelException, SvcLogicException {
- if (resourceAssignment == null) {
- throw new SvcLogicException("resourceAssignment is null.");
- }
-
- if (ctx == null) {
- throw new SvcLogicException("service logic context is null.");
- }
-
- if (componentContext == null) {
- throw new SvcLogicException("component context is null.");
- }
-
- logger.info("populating value for output mapping ({}), from json ({})", outputKeyMapping, responseNode);
- String dictionaryName = resourceAssignment.getDictionaryName();
- String type = resourceAssignment.getProperty().getType();
-
- String entrySchema = null;
- if (ValidTypes.getPrimitivePropertType().contains(type)) {
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, responseNode);
- } else if (ValidTypes.getListPropertType().contains(type)) {
- // Array Types
- if (resourceAssignment.getProperty().getEntrySchema() != null) {
- entrySchema = resourceAssignment.getProperty().getEntrySchema().getType();
- }
-
- if (StringUtils.isNotBlank(entrySchema)) {
- ArrayNode arrayNode = JsonNodeFactory.instance.arrayNode();
- if (ValidTypes.getPrimitivePropertType().contains(entrySchema)) {
- arrayNode = (ArrayNode) responseNode;
- } else if (MapUtils.isNotEmpty(outputKeyMapping)) {
- List<JsonNode> responseArrayNode = IteratorUtils.toList(responseNode.elements());
- for (JsonNode responseSingleJsonNode : responseArrayNode) {
- if (responseSingleJsonNode != null) {
- ObjectNode arrayChildNode = JsonNodeFactory.instance.objectNode();
- for (Map.Entry<String, String> mapping : outputKeyMapping.entrySet()) {
- JsonNode responseKeyValue = responseSingleJsonNode.get(mapping.getKey());
-
- String propertyTypeForDataType =
- ConfigAssignmentUtils.getPropertyType(ctx, entrySchema, mapping.getKey());
- logger.info("For List Type Resource: key ({}), value ({}), type ({})",
- mapping.getKey(), responseKeyValue, propertyTypeForDataType);
- JsonUtils.populateJsonNodeValues(mapping.getValue(), responseKeyValue,
- propertyTypeForDataType, arrayChildNode);
- }
- arrayNode.add(arrayChildNode);
- }
- }
- } else {
- arrayNode = (ArrayNode) responseNode;
- }
- // Set the List of Complex Values
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, arrayNode);
- } else {
- throw new SvcLogicException(
- String.format("Entry schema is not defined for dictionary (%s) info", dictionaryName));
- }
- } else {
- // Complex Types
- ObjectNode objectNode = null;
- if (MapUtils.isNotEmpty(outputKeyMapping)) {
- objectNode = JsonNodeFactory.instance.objectNode();
- for (Map.Entry<String, String> mapping : outputKeyMapping.entrySet()) {
- JsonNode responseKeyValue = responseNode.get(mapping.getKey());
- String propertyTypeForDataType =
- ConfigAssignmentUtils.getPropertyType(ctx, entrySchema, mapping.getKey());
- logger.info("For Complex Type Resource: key ({}), value ({}), type ({})", mapping.getKey(),
- responseKeyValue, propertyTypeForDataType);
- JsonUtils.populateJsonNodeValues(mapping.getValue(), responseKeyValue, propertyTypeForDataType,
- objectNode);
- }
- } else {
- objectNode = (ObjectNode) responseNode;
- }
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, objectNode);
- }
- }
-
- @SuppressWarnings("squid:S3776")
- public static synchronized List<ResourceAssignment> convertResoureAssignmentDataList(
- List<ResourceAssignmentData> resourceAssignmentDataList) {
- List<ResourceAssignment> assignments = new ArrayList<>();
- if (CollectionUtils.isNotEmpty(resourceAssignmentDataList)) {
- for (ResourceAssignmentData resourceAssignmentData : resourceAssignmentDataList) {
- if (resourceAssignmentData != null) {
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName(resourceAssignmentData.getTemplateKeyName());
- resourceAssignment.setVersion(resourceAssignmentData.getVersion());
- resourceAssignment.setUpdatedBy(resourceAssignmentData.getUpdatedBy());
- resourceAssignment.setUpdatedDate(resourceAssignmentData.getUpdatedDate());
- resourceAssignment.setDictionaryName(resourceAssignmentData.getResourceName());
- resourceAssignment.setDictionarySource(resourceAssignmentData.getSource());
- resourceAssignment.setStatus(resourceAssignmentData.getStatus());
- resourceAssignment.setMessage(resourceAssignmentData.getMessage());
- PropertyDefinition property = new PropertyDefinition();
- property.setType(resourceAssignmentData.getDataType());
-
- if (StringUtils.isNotBlank(resourceAssignmentData.getResourceValue())) {
- if (ValidTypes.getPrimitivePropertType().contains(resourceAssignmentData.getDataType())) {
- property.setValue(resourceAssignmentData.getResourceValue());
- } else {
- JsonNode valueNode =
- TransformationUtils.getJsonNodeForString(resourceAssignmentData.getResourceValue());
- property.setValue(valueNode);
- }
- }
- if (StringUtils.isNotBlank(resourceAssignmentData.getEntrySchema())) {
- EntrySchema entrySchema = new EntrySchema();
- entrySchema.setType(resourceAssignmentData.getEntrySchema());
- property.setEntrySchema(entrySchema);
- } else {
- property.setEntrySchema(null);
- }
- resourceAssignment.setProperty(property);
- assignments.add(resourceAssignment);
- }
- }
-
- }
- return assignments;
- }
-
- @SuppressWarnings("squid:S3776")
- public static synchronized List<ResourceAssignmentData> convertResoureAssignmentList(
- List<ResourceAssignment> assignments) {
- List<ResourceAssignmentData> resourceAssignmentDataList = new ArrayList<>();
- if (CollectionUtils.isNotEmpty(assignments)) {
- for (ResourceAssignment assignment : assignments) {
- if (assignment != null) {
- ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData();
- resourceAssignmentData.setTemplateKeyName(assignment.getName());
- resourceAssignmentData.setVersion(assignment.getVersion());
- resourceAssignmentData.setUpdatedBy(assignment.getUpdatedBy());
- resourceAssignmentData.setUpdatedDate(assignment.getUpdatedDate());
- if (assignment.getProperty() != null) {
- resourceAssignmentData.setDataType(assignment.getProperty().getType());
- if (assignment.getProperty().getEntrySchema() != null) {
- resourceAssignmentData.setEntrySchema(assignment.getProperty().getEntrySchema().getType());
- }
- if (assignment.getProperty().getValue() != null) {
- String valueContent = TransformationUtils.getJson(assignment.getProperty().getValue());
- resourceAssignmentData.setResourceValue(valueContent);
- }
- }
- resourceAssignmentData.setResourceName(assignment.getDictionaryName());
- resourceAssignmentData.setSource(assignment.getDictionarySource());
- resourceAssignmentData.setStatus(assignment.getStatus());
- resourceAssignmentData.setMessage(assignment.getMessage());
- resourceAssignmentDataList.add(resourceAssignmentData);
- }
- }
- }
- return resourceAssignmentDataList;
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigPreviewService.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigPreviewService.java deleted file mode 100644 index 071b5a548..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigPreviewService.java +++ /dev/null @@ -1,119 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.assignment.data.ResourceAssignmentData;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.generator.data.ConfigGeneratorInfo;
-import org.onap.ccsdk.features.generator.service.ConfigGeneratorService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigPreviewService {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentPersistService.class);
- private ConfigResourceService configResourceService;
- private ConfigModelService configModelService;
- private ConfigGeneratorService configGeneratorService;
-
- public ConfigPreviewService(ConfigResourceService configResourceService, ConfigModelService configModelService,
- ConfigGeneratorService configGeneratorService) {
- this.configResourceService = configResourceService;
- this.configModelService = configModelService;
- this.configGeneratorService = configGeneratorService;
- }
-
- public String generatePreview(String templateContent, String templateData) throws SvcLogicException {
- String mashedData = "";
- ConfigGeneratorInfo configGeneratorInfo =
- configGeneratorService.generateConfiguration(templateContent, templateData);
- if (configGeneratorInfo != null) {
- mashedData = configGeneratorInfo.getMashedData();
- }
- return mashedData;
- }
-
- public ResourceAssignmentData generateTemplateResourceMash(ResourceAssignmentData resourceAssignmentData)
- throws SvcLogicException {
- if (resourceAssignmentData == null) {
- throw new SvcLogicException("Resource assignment data is missing");
- }
- if (StringUtils.isBlank(resourceAssignmentData.getServiceTemplateName())) {
- throw new SvcLogicException("Service template name is missing");
- }
- if (StringUtils.isBlank(resourceAssignmentData.getServiceTemplateVersion())) {
- throw new SvcLogicException("Service template version is missing");
- }
- if (StringUtils.isBlank(resourceAssignmentData.getResourceType())) {
- throw new SvcLogicException("Resource type is missing");
- }
- if (StringUtils.isBlank(resourceAssignmentData.getResourceId())) {
- throw new SvcLogicException("Resource Id is missing");
- }
- if (StringUtils.isBlank(resourceAssignmentData.getActionName())) {
- throw new SvcLogicException("Action name is missing");
- }
-
- String serviceTemplateName = resourceAssignmentData.getServiceTemplateName();
- String serviceTemplateVersion = resourceAssignmentData.getServiceTemplateVersion();
- String actionName = resourceAssignmentData.getActionName();
- String resourceId = resourceAssignmentData.getResourceId();
- String resourceType = resourceAssignmentData.getResourceType();
- String inputData = "{}";
-
- Map<String, String> context = new HashMap<>();
- context.put(ConfigModelConstant.PROPERTY_ACTION_NAME, actionName);
- context = configModelService.prepareContext(context, inputData, serviceTemplateName, serviceTemplateVersion);
-
- ConfigResource configResourceQuery = new ConfigResource();
- configResourceQuery.setServiceTemplateVersion(serviceTemplateName);
- configResourceQuery.setServiceTemplateVersion(serviceTemplateVersion);
- configResourceQuery.setRecipeName(actionName);
- configResourceQuery.setResourceId(resourceId);
- configResourceQuery.setResourceType(resourceType);
-
- List<ConfigResource> configResources = configResourceService.getConfigResource(configResourceQuery);
- if (CollectionUtils.isNotEmpty(configResources)) {
- for (ConfigResource cr : configResources) {
- String templateContent = context
- .get(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + cr.getTemplateName() + ".content");
- String templateData = cr.getResourceData();
- String previewContent = generatePreview(templateContent, templateData);
- resourceAssignmentData.getTemplatesMashedContents().put(cr.getTemplateName(), previewContent);
- logger.info("Preview generated for template name ({}) ", cr.getTemplateName());
- logger.trace("Preview generated for preview ({}) ", previewContent);
- }
- } else {
- logger.info(
- "Couldn't get config resource for service template name ({}) service template version ({})"
- + " action ({}) resource id ({}) resource type ({})",
- serviceTemplateName, serviceTemplateVersion, actionName, resourceId, resourceType);
- }
- return resourceAssignmentData;
-
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ResourceDictionaryService.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ResourceDictionaryService.java deleted file mode 100644 index d8692c4c7..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ResourceDictionaryService.java +++ /dev/null @@ -1,110 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.domain.ResourceDictionary;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ResourceDictionaryService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceDictionaryService.class);
- private ConfigRestAdaptorService configRestAdaptorService;
-
- public ResourceDictionaryService(ConfigRestAdaptorService configRestAdaptorService) {
- this.configRestAdaptorService = configRestAdaptorService;
- }
-
- @SuppressWarnings("squid:S3776")
- public Map<String, ResourceDefinition> getDataDictionaryDefinitions(List<ResourceAssignment> resourceAssignments)
- throws SvcLogicException {
- try {
- Map<String, ResourceDefinition> dictionaries = new HashMap<>();
- if (resourceAssignments != null) {
- List<String> names = new ArrayList<>();
- for (ResourceAssignment resourceAssignment : resourceAssignments) {
- if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getDictionaryName())) {
- if (!names.contains(resourceAssignment.getDictionaryName())) {
- names.add(resourceAssignment.getDictionaryName());
- }
- if (resourceAssignment.getDependencies() != null
- && !resourceAssignment.getDependencies().isEmpty()) {
- List<String> dependencieNames = resourceAssignment.getDependencies();
- for (String dependencieName : dependencieNames) {
- if (StringUtils.isNotBlank(dependencieName) && !names.contains(dependencieName)) {
- names.add(dependencieName);
- }
- }
- }
- }
- }
- queryResourceDictionaryDefinitions(dictionaries, names);
- }
- return dictionaries;
- } catch (Exception e) {
- throw new SvcLogicException("Failed in getting resource data dictionary : " + e.getMessage());
- }
-
- }
-
- @SuppressWarnings("squid:S3776")
- private void queryResourceDictionaryDefinitions(Map<String, ResourceDefinition> dictionaries, List<String> names)
- throws SvcLogicException, ConfigRestAdaptorException {
- logger.info("Getting resource dictionary definition for the names ({})", names);
- if (!names.isEmpty()) {
-
- String dictionaryContents = configRestAdaptorService.postResource(
- ConfigRestAdaptorConstants.SELECTOR_MODEL_SERVICE, "dictionary/by-names", names, String.class);
-
- if (StringUtils.isNotBlank(dictionaryContents)) {
- List<ResourceDictionary> dataDictionaries =
- TransformationUtils.getListfromJson(dictionaryContents, ResourceDictionary.class);
- if (dataDictionaries != null) {
- for (ResourceDictionary dataDictionary : dataDictionaries) {
- if (dataDictionary != null && StringUtils.isNotBlank(dataDictionary.getName())
- && dataDictionary.getDefinition() != null) {
- ResourceDefinition resourceDefinition = TransformationUtils
- .treeToValue(dataDictionary.getDefinition(), ResourceDefinition.class);
- if (resourceDefinition != null && StringUtils.isNotBlank(resourceDefinition.getName())) {
- dictionaries.put(resourceDefinition.getName(), resourceDefinition);
- } else {
- throw new SvcLogicException(
- "Failed in getting resource data dictionary definition for : "
- + dataDictionary.getName());
- }
- }
- }
- }
- } else {
- logger.warn("No resource dictionary definition found for the names ({})", names);
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ResourceModelService.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ResourceModelService.java deleted file mode 100644 index befa36a34..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ResourceModelService.java +++ /dev/null @@ -1,97 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.model.validator.ResourceAssignmentValidator;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ResourceModelService {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceModelService.class);
-
- private ConfigModelService configModelService;
-
- public ResourceModelService(ConfigModelService configModelService) {
- this.configModelService = configModelService;
- }
-
- public Map<String, String> getTemplatesContents(SvcLogicContext ctx, List<String> templateNames)
- throws SvcLogicException {
- Map<String, String> templatesContents = new HashMap<>();
- try {
- if (CollectionUtils.isNotEmpty(templateNames)) {
- for (String templateName : templateNames) {
- String templateContent = this.configModelService.getNodeTemplateContent(ctx, templateName);
- logger.trace("Processing template ({}) with content : {}", templateName, templateContent);
- templatesContents.put(templateName, templateContent);
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- return templatesContents;
- }
-
- public Map<String, List<ResourceAssignment>> getTemplatesResourceAssignments(SvcLogicContext ctx,
- List<String> templateNames) throws SvcLogicException {
- Map<String, List<ResourceAssignment>> templatesResourceAssignments = new HashMap<>();
- try {
- if (CollectionUtils.isNotEmpty(templateNames)) {
- for (String templateName : templateNames) {
- String resourceMappingContent = this.configModelService.getNodeTemplateMapping(ctx, templateName);
- logger.info("Processing template ({}) with resource assignment content : {}", templateName,
- resourceMappingContent);
-
- if (StringUtils.isNotBlank(resourceMappingContent)) {
-
- List<ResourceAssignment> resourceAssignments =
- TransformationUtils.getListfromJson(resourceMappingContent, ResourceAssignment.class);
-
- if (resourceAssignments != null) {
- ResourceAssignmentValidator resourceAssignmentValidator =
- new ResourceAssignmentValidator(resourceAssignments);
- resourceAssignmentValidator.validateResourceAssignment();
- logger.info("Resource assignment validated successfully for the template ({})",
- templateName);
- templatesResourceAssignments.put(templateName, resourceAssignments);
- } else {
- throw new SvcLogicException(String.format(
- "Failed to convert assignment content (%s) to object", resourceMappingContent));
- }
- } else {
- // Do nothing, because som e templates may not have mappings
- }
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
-
- return templatesResourceAssignments;
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/blueprints-processor/plugin/assignment-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml deleted file mode 100644 index f15429dfe..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- 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.
--->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <reference id="componentNodeService"
- interface="org.onap.ccsdk.features.model.service.ComponentNodeService" />
-
- <reference id="configResourceService"
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />
-
- <reference id="configModelService"
- interface="org.onap.ccsdk.features.model.service.ConfigModelService" />
-
- <reference id="configRestAdaptorService"
- interface="org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService" />
-
- <reference id="configGeneratorService"
- interface="org.onap.ccsdk.features.generator.service.ConfigGeneratorService" />
-
- <!-- Expose the Common Component Bean -->
- <bean id="configAssignmentNode"
- class="org.onap.ccsdk.features.assignment.service.ConfigAssignmentNode">
- <argument ref="configResourceService" />
- <argument ref="configRestAdaptorService" />
- <argument ref="configModelService" />
- <argument ref="componentNodeService" />
- <argument ref="configGeneratorService" />
- </bean>
-
- <service ref="configAssignmentNode"
- interface="org.onap.ccsdk.features.assignment.service.ConfigAssignmentNode" />
-
- <bean id="configAssignmentService"
- class="org.onap.ccsdk.features.assignment.service.ConfigAssignmentServiceImpl">
- <argument ref="configResourceService" />
- <argument ref="configRestAdaptorService" />
- <argument ref="configModelService" />
- <argument ref="componentNodeService" />
- <argument ref="configGeneratorService" />
- </bean>
-
- <service ref="configAssignmentService"
- interface="org.onap.ccsdk.features.assignment.service.ConfigAssignmentService" />
-
-</blueprint>
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/blueprints-processor/plugin/assignment-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml deleted file mode 100644 index f15429dfe..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- 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.
--->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <reference id="componentNodeService"
- interface="org.onap.ccsdk.features.model.service.ComponentNodeService" />
-
- <reference id="configResourceService"
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />
-
- <reference id="configModelService"
- interface="org.onap.ccsdk.features.model.service.ConfigModelService" />
-
- <reference id="configRestAdaptorService"
- interface="org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService" />
-
- <reference id="configGeneratorService"
- interface="org.onap.ccsdk.features.generator.service.ConfigGeneratorService" />
-
- <!-- Expose the Common Component Bean -->
- <bean id="configAssignmentNode"
- class="org.onap.ccsdk.features.assignment.service.ConfigAssignmentNode">
- <argument ref="configResourceService" />
- <argument ref="configRestAdaptorService" />
- <argument ref="configModelService" />
- <argument ref="componentNodeService" />
- <argument ref="configGeneratorService" />
- </bean>
-
- <service ref="configAssignmentNode"
- interface="org.onap.ccsdk.features.assignment.service.ConfigAssignmentNode" />
-
- <bean id="configAssignmentService"
- class="org.onap.ccsdk.features.assignment.service.ConfigAssignmentServiceImpl">
- <argument ref="configResourceService" />
- <argument ref="configRestAdaptorService" />
- <argument ref="configModelService" />
- <argument ref="componentNodeService" />
- <argument ref="configGeneratorService" />
- </bean>
-
- <service ref="configAssignmentService"
- interface="org.onap.ccsdk.features.assignment.service.ConfigAssignmentService" />
-
-</blueprint>
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/DBResourceProcessorTest.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/DBResourceProcessorTest.java deleted file mode 100644 index a93e6de2e..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/DBResourceProcessorTest.java +++ /dev/null @@ -1,231 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.processor;
-
-import static org.mockito.Matchers.any;
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Matchers;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.stubbing.Answer;
-import org.onap.ccsdk.features.assignment.service.ConfigResourceAssignmentTestUtils;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(MockitoJUnitRunner.class)
-public class DBResourceProcessorTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(DBResourceProcessorTest.class);
-
- @Mock
- private ConfigResourceService configResourceService;
-
- @SuppressWarnings("unchecked")
- @Before
- public void before() {
- MockitoAnnotations.initMocks(this);
-
- try {
- Mockito.doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- if (args != null) {
- logger.trace("Transaction info " + Arrays.asList(args));
- }
- return null;
- }
- }).when(configResourceService).save(any(TransactionLog.class));
-
- } catch (SvcLogicException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testDbSimpleProcess() throws Exception {
- logger.info(" ******************************* testDbSimpleProcess ***************************");
-
- Mockito.doAnswer(new Answer<List<Map<String, Object>>>() {
- @Override
- public List<Map<String, Object>> answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- List<Map<String, Object>> results = new ArrayList<>();
- if (args != null) {
- logger.info("Query " + Arrays.asList(args));
- Map<String, Object> record = new HashMap<>();
- record.put("country", "US");
- results.add(record);
- }
- return results;
- }
- }).when(configResourceService).query(Matchers.anyString(), Matchers.<Map<String, Object>>any());
-
- String recipeName = "sample-recipe";
-
- String resourceassignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/db/resource-assignments-simple.json"), Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- TransformationUtils.getListfromJson(resourceassignmentContent, ResourceAssignment.class);
-
- String dictionaryContent = FileUtils.readFileToString(new File("src/test/resources/mapping/db/db-simple.json"),
- Charset.defaultCharset());
- Map<String, ResourceDefinition> dictionaries =
- ConfigResourceAssignmentTestUtils.getMapfromJson(dictionaryContent);
- DBResourceProcessor dbResourceProcessor = new DBResourceProcessor(configResourceService);
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, "sample-template");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
-
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".profile_name", "sample");
-
- Map<String, String> inParams = new HashMap<>();
- SvcLogicContext ctx = new SvcLogicContext();
- dbResourceProcessor.process(inParams, ctx, componentContext);
-
- logger.info(" Context " + componentContext);
-
- }
-
- @Test
- public void testDbComplexProcess() throws Exception {
- logger.info(" ******************************* testDbComplexProcess ***************************");
-
- Mockito.doAnswer(new Answer<List<Map<String, Object>>>() {
- @Override
- public List<Map<String, Object>> answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- List<Map<String, Object>> results = new ArrayList<>();
- if (args != null) {
- logger.info("Query " + Arrays.asList(args));
- Map<String, Object> record = new HashMap<>();
- record.put("db-country", "US");
- record.put("db-state", "NJ");
- results.add(record);
- }
- return results;
- }
- }).when(configResourceService).query(Matchers.anyString(), Matchers.<Map<String, Object>>any());
-
- String recipeName = "sample-recipe";
-
- String resourceassignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/db/resource-assignments-complex.json"), Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- TransformationUtils.getListfromJson(resourceassignmentContent, ResourceAssignment.class);
-
- String dictionaryContent = FileUtils.readFileToString(new File("src/test/resources/mapping/db/db-complex.json"),
- Charset.defaultCharset());
- Map<String, ResourceDefinition> dictionaries =
- ConfigResourceAssignmentTestUtils.getMapfromJson(dictionaryContent);
- DBResourceProcessor dbResourceProcessor = new DBResourceProcessor(configResourceService);
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, "sample-template");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".profile_name", "sample");
-
- Map<String, String> inParams = new HashMap<>();
- SvcLogicContext ctx = new SvcLogicContext();
- String datatypeContent = FileUtils.readFileToString(new File("src/test/resources/mapping/db/dt-location.json"),
- Charset.defaultCharset());
- ctx.setAttribute("data_types.dt-location", datatypeContent);
- dbResourceProcessor.process(inParams, ctx, componentContext);
-
- }
-
- @Test
- public void testDbArrayComplexProcess() throws Exception {
- logger.info(" ******************************* testDbArrayComplexProcess ***************************");
- Mockito.doAnswer(new Answer<List<Map<String, Object>>>() {
- @Override
- public List<Map<String, Object>> answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- List<Map<String, Object>> results = new ArrayList<>();
- if (args != null) {
- logger.info("Query " + Arrays.asList(args));
- Map<String, Object> record = new HashMap<>();
- record.put("db-country", "US");
- record.put("db-state", "NJ");
- results.add(record);
-
- Map<String, Object> record2 = new HashMap<>();
- record2.put("db-country", "INDIA");
- record2.put("db-state", "TN");
- results.add(record2);
- }
- return results;
- }
- }).when(configResourceService).query(Matchers.anyString(), Matchers.<Map<String, Object>>any());
-
- String recipeName = "sample-recipe";
-
- String resourceassignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/db/resource-assignments-array.json"), Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- TransformationUtils.getListfromJson(resourceassignmentContent, ResourceAssignment.class);
-
- String dictionaryContent = FileUtils.readFileToString(new File("src/test/resources/mapping/db/db-array.json"),
- Charset.defaultCharset());
- Map<String, ResourceDefinition> dictionaries =
- ConfigResourceAssignmentTestUtils.getMapfromJson(dictionaryContent);
- DBResourceProcessor dbResourceProcessor = new DBResourceProcessor(configResourceService);
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, "sample-template");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".profile_name", "sample");
-
- Map<String, String> inParams = new HashMap<>();
- SvcLogicContext ctx = new SvcLogicContext();
- String datatypeContent = FileUtils.readFileToString(new File("src/test/resources/mapping/db/dt-location.json"),
- Charset.defaultCharset());
- ctx.setAttribute("data_types.dt-location", datatypeContent);
- dbResourceProcessor.process(inParams, ctx, componentContext);
- logger.info("Component Context = ({})", componentContext);
- Assert.assertNotNull("faile dto populate Array Complex response ", componentContext);
-
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/DefaultResourceProcessorTest.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/DefaultResourceProcessorTest.java deleted file mode 100644 index 16fd6c0bd..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/DefaultResourceProcessorTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.processor;
-
-import static org.mockito.Matchers.any;
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.stubbing.Answer;
-import org.onap.ccsdk.features.assignment.service.ConfigResourceAssignmentTestUtils;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(MockitoJUnitRunner.class)
-public class DefaultResourceProcessorTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(DefaultResourceProcessorTest.class);
-
- @Mock
- private ConfigResourceService configResourceService;
-
- @SuppressWarnings("unchecked")
- @Before
- public void before() {
- MockitoAnnotations.initMocks(this);
-
- try {
- Mockito.doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- if (args != null) {
- logger.trace("Transaction info " + Arrays.asList(args));
- }
- return null;
- }
- }).when(configResourceService).save(any(TransactionLog.class));
-
- } catch (SvcLogicException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testDefaultSimpleProcess() throws Exception {
- logger.info(" ******************************* testDefaultSimpleProcess ***************************");
-
- String recipeName = "sample-recipe";
-
- String resourceassignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/default/resource-assignments-simple.json"),
- Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- TransformationUtils.getListfromJson(resourceassignmentContent, ResourceAssignment.class);
-
- String dictionaryContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/default/default-simple.json"), Charset.defaultCharset());
- Map<String, ResourceDefinition> dictionaries =
- ConfigResourceAssignmentTestUtils.getMapfromJson(dictionaryContent);
-
- DefaultResourceProcessor defaultResourceProcessor = new DefaultResourceProcessor(configResourceService);
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, "sample-template");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".profile_name", "sample");
-
- Map<String, String> inParams = new HashMap<>();
- SvcLogicContext ctx = new SvcLogicContext();
- defaultResourceProcessor.process(inParams, ctx, componentContext);
- logger.trace(" componentContext " + componentContext);
-
- Assert.assertEquals("Failed to populate default country value ", "US",
- componentContext.get(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + "sample-recipe.country"));
- Assert.assertEquals("Failed to populate default country value ", "US",
- componentContext.get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + "sample-recipe.country"));
-
- Assert.assertEquals("Failed to populate default port value ", 830,
- componentContext.get(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + "sample-recipe.port"));
- Assert.assertEquals("Failed to populate default port value ", 830,
- componentContext.get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + "sample-recipe.port"));
-
- Assert.assertEquals("Failed to populate default voip-enabled value ", true,
- componentContext.get(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + "sample-recipe.voip-enabled"));
- Assert.assertEquals("Failed to populate default voip-enabled value ", true,
- componentContext.get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + "sample-recipe.voip-enabled"));
-
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/InputResourceProcessorTest.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/InputResourceProcessorTest.java deleted file mode 100644 index add00d3a9..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/InputResourceProcessorTest.java +++ /dev/null @@ -1,178 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.processor;
-
-import static org.mockito.Matchers.any;
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.stubbing.Answer;
-import org.onap.ccsdk.features.assignment.service.ConfigResourceAssignmentTestUtils;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(MockitoJUnitRunner.class)
-public class InputResourceProcessorTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(InputResourceProcessorTest.class);
-
- @Mock
- private ConfigResourceService configResourceService;
-
- @SuppressWarnings("unchecked")
- @Before
- public void before() {
- MockitoAnnotations.initMocks(this);
-
- try {
- Mockito.doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- if (args != null) {
- logger.trace("Transaction info " + Arrays.asList(args));
- }
- return null;
- }
- }).when(configResourceService).save(any(TransactionLog.class));
-
- } catch (SvcLogicException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testInputSimpleProcess() throws Exception {
- logger.info(" ******************************* testInputSimpleProcess ***************************");
-
- String recipeName = "sample-recipe";
-
- String resourceassignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/input/resource-assignments-simple.json"),
- Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- TransformationUtils.getListfromJson(resourceassignmentContent, ResourceAssignment.class);
-
- String dictionaryContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/default/default-simple.json"), Charset.defaultCharset());
- Map<String, ResourceDefinition> dictionaries =
- ConfigResourceAssignmentTestUtils.getMapfromJson(dictionaryContent);
-
- InputResourceProcessor inputResourceProcessor = new InputResourceProcessor(configResourceService);
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, "sample-template");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".profile_name", "sample");
-
- Map<String, String> inParams = new HashMap<>();
- SvcLogicContext ctx = new SvcLogicContext();
- ctx.setAttribute("country", "US");
- ctx.setAttribute("port", "830");
- ctx.setAttribute("voip-enabled", "true");
-
- inputResourceProcessor.process(inParams, ctx, componentContext);
- logger.trace(" componentContext " + componentContext);
-
- Assert.assertEquals("Failed to populate default recipe country value ", "US",
- componentContext.get(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + "sample-recipe.country"));
- Assert.assertEquals("Failed to populate default dictionary country value ", "US",
- componentContext.get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + "sample-recipe.country"));
-
- Assert.assertEquals("Failed to populate default recipe port value ", 830,
- componentContext.get(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + "sample-recipe.port"));
- Assert.assertEquals("Failed to populate default dictionary port value ", 830,
- componentContext.get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + "sample-recipe.port"));
-
- Assert.assertEquals("Failed to populate default recipe voip-enabled value ", true,
- componentContext.get(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + "sample-recipe.voip-enabled"));
- Assert.assertEquals("Failed to populate default dictionary voip-enabled value ", true,
- componentContext.get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + "sample-recipe.voip-enabled"));
-
- }
-
- @Test
- public void testInputComplexProcess() throws Exception {
- logger.info(" ******************************* testInputComplexProcess ***************************");
-
- String recipeName = "sample-recipe";
-
- String resourceassignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/input/resource-assignments-complex.json"),
- Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- TransformationUtils.getListfromJson(resourceassignmentContent, ResourceAssignment.class);
-
- String dictionaryContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/input/input-complex.json"), Charset.defaultCharset());
- Map<String, ResourceDefinition> dictionaries =
- ConfigResourceAssignmentTestUtils.getMapfromJson(dictionaryContent);
-
- InputResourceProcessor inputResourceProcessor = new InputResourceProcessor(configResourceService);
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, "sample-template");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".profile_name", "sample");
-
- Map<String, String> inParams = new HashMap<>();
- SvcLogicContext ctx = new SvcLogicContext();
- String datatypeContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/input/dt-location.json"), Charset.defaultCharset());
- ctx.setAttribute("data_types.dt-location", datatypeContent);
-
- String samplelocation = FileUtils.readFileToString(
- new File("src/test/resources/mapping/input/sample-location.json"), Charset.defaultCharset());
- ctx.setAttribute("location", samplelocation);
-
- inputResourceProcessor.process(inParams, ctx, componentContext);
-
- logger.trace(" componentContext " + componentContext);
- logger.trace(" Resource Mapping " + TransformationUtils.getJson(batchResourceAssignment, true));
-
- Assert.assertNotNull("Failed to populate input recipe location value ",
- componentContext.get(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + "sample-recipe.location"));
- Assert.assertNotNull("Failed to populate input dictionary location value ",
- componentContext.get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + "sample-recipe.location"));
-
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/MdsalResourceProcessorTest.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/MdsalResourceProcessorTest.java deleted file mode 100644 index 10a43538c..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/processor/MdsalResourceProcessorTest.java +++ /dev/null @@ -1,268 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.processor;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Matchers;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.stubbing.Answer;
-import org.onap.ccsdk.features.assignment.service.ConfigResourceAssignmentTestUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(MockitoJUnitRunner.class)
-public class MdsalResourceProcessorTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(MdsalResourceProcessorTest.class);
-
- @Mock
- private ConfigRestAdaptorService configRestAdaptorService;
-
- @SuppressWarnings("unchecked")
- @Before
- public void before() {
-
- }
-
- @Test
- @SuppressWarnings("unchecked")
- public void testMdsalSimpleProcess() throws Exception {
- logger.info(" ******************************* testMdsalSimpleProcess ***************************");
-
- Mockito.doAnswer(new Answer<String>() {
- @Override
- public String answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- String response = null;
- if (args != null) {
- response = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/simple-response.json"),
- Charset.defaultCharset());
- logger.info(" Returning response :" + response);
- }
- return response;
- }
- }).when(configRestAdaptorService).getResource(Matchers.anyString(), Matchers.anyString(),
- Matchers.any(Class.class));
-
- String recipeName = "sample-recipe";
-
- String resourceassignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/resource-assignments-simple.json"),
- Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- TransformationUtils.getListfromJson(resourceassignmentContent, ResourceAssignment.class);
-
- String dictionaryContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/mdsal-simple.json"), Charset.defaultCharset());
- Map<String, ResourceDefinition> dictionaries =
- ConfigResourceAssignmentTestUtils.getMapfromJson(dictionaryContent);
- MdsalResourceProcessor mdsalResourceProcessor = new MdsalResourceProcessor(configRestAdaptorService);
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, "sample-template");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
-
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".profile_name", "sample");
-
- Map<String, String> inParams = new HashMap<>();
- SvcLogicContext ctx = new SvcLogicContext();
- mdsalResourceProcessor.process(inParams, ctx, componentContext);
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testMDSALComplexProcess() throws Exception {
- logger.info(" ******************************* testMDSALComplexProcess ***************************");
-
- Mockito.doAnswer(new Answer<String>() {
- @Override
- public String answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- String response = null;
- if (args != null) {
- response = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/complex-response.json"),
- Charset.defaultCharset());
- }
- return response;
- }
- }).when(configRestAdaptorService).getResource(Matchers.anyString(), Matchers.anyString(),
- Matchers.any(Class.class));
-
- String recipeName = "sample-recipe";
-
- String resourceassignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/resource-assignments-complex.json"),
- Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- TransformationUtils.getListfromJson(resourceassignmentContent, ResourceAssignment.class);
-
- String dictionaryContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/mdsal-complex.json"), Charset.defaultCharset());
- Map<String, ResourceDefinition> dictionaries =
- ConfigResourceAssignmentTestUtils.getMapfromJson(dictionaryContent);
- MdsalResourceProcessor dbResourceProcessor = new MdsalResourceProcessor(configRestAdaptorService);
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, "sample-template");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".profile_name", "sample");
-
- Map<String, String> inParams = new HashMap<>();
- SvcLogicContext ctx = new SvcLogicContext();
- String datatypeContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/dt-location.json"), Charset.defaultCharset());
- ctx.setAttribute("data_types.dt-location", datatypeContent);
- dbResourceProcessor.process(inParams, ctx, componentContext);
-
- }
-
- @Test
- @SuppressWarnings("unchecked")
- public void testMDSALArrayComplexProcess() throws Exception {
- logger.info(" ******************************* testMDSALArrayComplexProcess ***************************");
-
- Mockito.doAnswer(new Answer<String>() {
- @Override
- public String answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- String response = null;
- if (args != null) {
- response = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/array-complex-response.json"),
- Charset.defaultCharset());
- }
- return response;
- }
- }).when(configRestAdaptorService).getResource(Matchers.anyString(), Matchers.anyString(),
- Matchers.any(Class.class));
-
- String recipeName = "sample-recipe";
-
- String resourceassignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/resource-assignments-array.json"), Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- TransformationUtils.getListfromJson(resourceassignmentContent, ResourceAssignment.class);
-
- String dictionaryContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/mdsal-array.json"), Charset.defaultCharset());
-
- Map<String, ResourceDefinition> dictionaries =
- ConfigResourceAssignmentTestUtils.getMapfromJson(dictionaryContent);
- MdsalResourceProcessor dbResourceProcessor = new MdsalResourceProcessor(configRestAdaptorService);
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, "sample-template");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".profile_name", "sample");
-
- Map<String, String> inParams = new HashMap<>();
- SvcLogicContext ctx = new SvcLogicContext();
- String datatypeContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/dt-location.json"), Charset.defaultCharset());
- ctx.setAttribute("data_types.dt-location", datatypeContent);
- dbResourceProcessor.process(inParams, ctx, componentContext);
- logger.info("Component Context = ({})", componentContext);
- Assert.assertNotNull("failed to populate Array Complex response ", componentContext);
-
- }
-
- @Test
- @SuppressWarnings("unchecked")
- public void testMDSALArraySimpleProcess() throws Exception {
- logger.info(" ******************************* testMDSALArrayComplexProcess ***************************");
-
- Mockito.doAnswer(new Answer<String>() {
- @Override
- public String answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- String response = null;
- if (args != null) {
- response = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/array-complex-v4-assigned-response.json"),
- Charset.defaultCharset());
- }
- return response;
- }
- }).when(configRestAdaptorService).getResource(Matchers.anyString(), Matchers.anyString(),
- Matchers.any(Class.class));
-
- String recipeName = "sample-recipe";
-
- String resourceassignmentContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/resource-assignments-complex-simple.json"),
- Charset.defaultCharset());
- List<ResourceAssignment> batchResourceAssignment =
- TransformationUtils.getListfromJson(resourceassignmentContent, ResourceAssignment.class);
-
- String dictionaryContent = FileUtils.readFileToString(
- new File("src/test/resources/mapping/Mdsal/mdsal-array-v4iplist.json"), Charset.defaultCharset());
- Map<String, ResourceDefinition> dictionaries =
- ConfigResourceAssignmentTestUtils.getMapfromJson(dictionaryContent);
- MdsalResourceProcessor mdsalResourceProcessor = new MdsalResourceProcessor(configRestAdaptorService);
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, "sample-template");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".service-instance-id",
- "3c8d5a63-a793-4206-a67c-4b2e8e648196");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".oam-network-role",
- "sample");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".oam-ipv4-ip-type",
- "sample");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".profile_name", "sample");
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".oam-vm-type", "sample");
-
- Map<String, String> inParams = new HashMap<>();
- SvcLogicContext ctx = new SvcLogicContext();
- // String datatypeContent = FileUtils.readFileToString(new
- // File("src/test/resources/mapping/Mdsal/dt-v4-assigned-ip-list.json"), Charset.defaultCharset() );
- // ctx.setAttribute("data_types.dt-v4-assigned-ip-list", datatypeContent);
- mdsalResourceProcessor.process(inParams, ctx, componentContext);
- logger.info("Component Context = ({})", componentContext);
- Assert.assertNotNull("failed to populate Array Complex response ", componentContext);
- Assert.assertEquals("Compare String ", "10.66.1.152",
- componentContext.get(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + ".v4-ip-prefix"));
-
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentNodeTest.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentNodeTest.java deleted file mode 100644 index 0fe6c9261..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentNodeTest.java +++ /dev/null @@ -1,246 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.sling.testing.mock.osgi.MockOsgi;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.ccsdk.features.assignment.ConfigAssignmentConstants;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.generator.service.ConfigGeneratorService;
-import org.onap.ccsdk.features.generator.service.ConfigGeneratorServiceImpl;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.service.ComponentNodeDelegate;
-import org.onap.ccsdk.features.model.service.ComponentNodeService;
-import org.onap.ccsdk.features.model.service.ComponentNodeServiceImpl;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.model.service.ConfigModelServiceImpl;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.osgi.framework.BundleContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ConfigAssignmentNodeTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentNodeTest.class);
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Mock
- private ConfigResourceService configResourceService;
-
- @Mock
- private ConfigRestAdaptorService configRestAdaptorService;
-
- private ConfigModelService configModelService;
-
- private ComponentNodeService componentNodeService;
-
- private ConfigGeneratorService configGeneratorService;
-
- BundleContext bundleContext = MockOsgi.newBundleContext();
-
- @SuppressWarnings("unchecked")
- @Before
- public void before() throws Exception {
- MockitoAnnotations.initMocks(this);
- /*
- * ConfigAssignmentNode configAssignmentNode = new ConfigAssignmentNode(componentNodeService,
- * configResourceService, configModelService, configRestAdaptorService, configGeneratorService);
- * bundleContext.registerService(ConfigAssignmentNode.class, configAssignmentNode, null);
- */
- }
-
- @Test
- public void testResourceAssignment() throws Exception {
- ConfigResourceAssignmentTestUtils.injectTransactionLogSaveMock(configResourceService);
-
- ConfigResourceAssignmentTestUtils.injectConfigModelMock(configRestAdaptorService, "resource_assignment");
-
- ConfigResourceAssignmentTestUtils.injectResourceDictionaryMock(configRestAdaptorService,
- "assignments/empty-dictionary.json");
-
- ConfigResourceAssignmentTestUtils.injectConfigResourceSaveMock(configResourceService);
-
- componentNodeService =
- new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService);
- configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
- configGeneratorService = new ConfigGeneratorServiceImpl(configResourceService);
-
- ConfigAssignmentNode configAssignmentNode = new ConfigAssignmentNode(configResourceService,
- configRestAdaptorService, configModelService, componentNodeService, configGeneratorService);
-
- String inputContent = FileUtils.readFileToString(
- new File("src/test/resources/service_templates/input/input.json"), Charset.defaultCharset());
-
- Map<String, String> inParams = new HashMap<>();
- inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "test");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID, "1234");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID, "resourceid-1234");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE, "vnf-type");
- inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME, "vpe-201802-baseconfig");
- inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION, "1.0.0");
- inParams.put(ConfigModelConstant.PROPERTY_ACTION_NAME, "resource-assignment-action");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_INPUT_DATA, inputContent);
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES, "[\"base-config-template\"]");
-
- // Populate the SvcContext ( Simulation)
- SvcLogicContext svcLogicContext = new SvcLogicContext();
- Map<String, String> context = new HashMap<>();
- context.put(ConfigModelConstant.PROPERTY_ACTION_NAME, "resource-assignment-action");
- context = configModelService.prepareContext(context, inputContent, "vpe-201802-baseconfig", "1.0.0");
- context.forEach((key, value) -> svcLogicContext.setAttribute(key, value));
-
- Map<String, Object> componentContext = new HashMap<>();
- configAssignmentNode.process(inParams, svcLogicContext, componentContext);
- Assert.assertNotNull("Failed to get response status", svcLogicContext.getAttribute("test.status"));
-
- }
-
- @Test
- public void testSimplePreview() throws Exception {
- ConfigResourceAssignmentTestUtils.injectTransactionLogSaveMock(configResourceService);
-
- ConfigResourceAssignmentTestUtils.injectConfigModelMock(configRestAdaptorService, "resource_assignment");
-
- ConfigResourceAssignmentTestUtils.injectResourceDictionaryMock(configRestAdaptorService,
- "assignments/empty-dictionary.json");
-
- ConfigResourceAssignmentTestUtils.injectConfigResourceSaveMock(configResourceService);
-
- componentNodeService =
- new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService);
- configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
- configGeneratorService = new ConfigGeneratorServiceImpl(configResourceService);
-
- ConfigAssignmentNode configAssignmentNode = new ConfigAssignmentNode(configResourceService,
- configRestAdaptorService, configModelService, componentNodeService, configGeneratorService);
-
- String inputContent = FileUtils.readFileToString(
- new File("src/test/resources/service_templates/input/input.json"), Charset.defaultCharset());
-
- Map<String, String> inParams = new HashMap<>();
- inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "test");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID, "1234");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID, "resourceid-1234");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE, "vnf-type");
- inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME, "vpe-201802-baseconfig");
- inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION, "1.0.0");
- inParams.put(ConfigModelConstant.PROPERTY_ACTION_NAME, "resource-assignment-action");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_INPUT_DATA, inputContent);
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES, "[\"base-config-template\"]");
- SvcLogicContext ctx = new SvcLogicContext();
- configAssignmentNode.process(inParams, ctx);
- Assert.assertNotNull("Failed to get response mashed Content",
- ctx.getAttribute("test.mashed-data.base-config-template"));
- }
-
- @Test
- public void testComplexPreview() throws Exception {
- ConfigResourceAssignmentTestUtils.injectTransactionLogSaveMock(configResourceService);
-
- ConfigResourceAssignmentTestUtils.injectConfigModelMock(configRestAdaptorService, "vpe-201802-baseconfig");
-
- ConfigResourceAssignmentTestUtils.injectResourceDictionaryMock(configRestAdaptorService,
- "service_templates/vpe-201802-baseconfig/dict.json");
-
- ConfigResourceAssignmentTestUtils.injectConfigResourceSaveMock(configResourceService);
-
- componentNodeService =
- new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService);
- configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
- configGeneratorService = new ConfigGeneratorServiceImpl(configResourceService);
-
- ConfigAssignmentNode configAssignmentNode = new ConfigAssignmentNode(configResourceService,
- configRestAdaptorService, configModelService, componentNodeService, configGeneratorService);
-
- String inputContent = FileUtils.readFileToString(
- new File("src/test/resources/service_templates/vpe-201802-baseconfig/input-complex.json"),
- Charset.defaultCharset());
-
- Map<String, String> inParams = new HashMap<>();
- inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "complex-test");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID, "request-1234");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID, "resourceid-1234");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_TYPE, "vnf-type");
- inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME, "vpe-201802-baseconfig");
- inParams.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION, "1.0.0");
- inParams.put(ConfigModelConstant.PROPERTY_ACTION_NAME, "resource-assignment-action");
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_INPUT_DATA, inputContent);
- inParams.put(ConfigAssignmentConstants.INPUT_PARAM_TEMPLATE_NAMES, "[\"base-config-template\"]");
- SvcLogicContext ctx = new SvcLogicContext();
- configAssignmentNode.process(inParams, ctx);
- Assert.assertNotNull("Failed to get response mashed Content",
- ctx.getAttribute("complex-test.mashed-data.base-config-template"));
-
- }
-
- @Test
- public void inputValidator() {
- SvcLogicContext ctx = new SvcLogicContext();
- try {
-
- logger.info(" ******************************* inputValidator ***************************");
- String serviceTemplateContent = FileUtils.readFileToString(
- new File("src/test/resources/service_templates/resource_assignment.json"),
- Charset.defaultCharset());
-
- String inputcontent = FileUtils.readFileToString(
- new File("src/test/resources/service_templates/input/inputValidateTest.json"),
- Charset.defaultCharset());
-
- Map<String, String> context = new HashMap<>();
- configModelService.prepareContext(context, inputcontent, serviceTemplateContent);
-
- // TransformationUtils.printMap(context);
-
- context.forEach((name, value) -> {
- if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) {
- ctx.setAttribute(name, value);
- }
- });
-
- ComponentNodeDelegate componentNodeDelegate = new ComponentNodeDelegate(componentNodeService);
- Map<String, String> inParams = new HashMap<>();
- inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "resource-assignment");
- componentNodeDelegate.process(inParams, ctx);
- Assert.fail();
- } catch (Exception e) {
- logger.error("Failed in inputValidator" + e.getMessage());
- logger.info("** ctx.getAttribute Check for **" + ctx.getAttribute("resource-assignment.error-message"));
- }
-
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ConfigPreviewServiceTest.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ConfigPreviewServiceTest.java deleted file mode 100644 index be4ca0381..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ConfigPreviewServiceTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.ccsdk.features.assignment.data.ResourceAssignmentData;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.generator.service.ConfigGeneratorService;
-import org.onap.ccsdk.features.generator.service.ConfigGeneratorServiceImpl;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.model.service.ConfigModelServiceImpl;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ConfigPreviewServiceTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigPreviewServiceTest.class);
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Mock
- private ConfigResourceService configResourceService;
-
- @Mock
- private ConfigRestAdaptorService configRestAdaptorService;
-
- private ConfigModelService configModelService;
- private ConfigGeneratorService configGeneratorService;
-
- @SuppressWarnings("unchecked")
- @Before
- public void before() throws Exception {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testGenerateTemplateResourceMash() throws Exception {
-
- ConfigResourceAssignmentTestUtils.injectTransactionLogSaveMock(configResourceService);
-
- ConfigResourceAssignmentTestUtils.injectConfigModelMock(configRestAdaptorService, "resource_assignment");
-
- ConfigResourceAssignmentTestUtils.injectResourceDictionaryMock(configRestAdaptorService,
- "assignments/empty-dictionary.json");
-
- ConfigResource configResourceQuery = new ConfigResource();
- configResourceQuery.setServiceTemplateVersion("sample-serviceTemplateName");
- configResourceQuery.setServiceTemplateVersion("1.0.0");
- configResourceQuery.setRecipeName("sample-action");
- configResourceQuery.setResourceId("123-resourceId");
- configResourceQuery.setResourceType("sample-resourceType");
- configResourceQuery.setTemplateName("base-config-template");
- String inputContent = FileUtils.readFileToString(
- new File("src/test/resources/service_templates/input/input.json"), Charset.defaultCharset());
- configResourceQuery.setResourceData(inputContent);
-
- ConfigResourceAssignmentTestUtils.injectGetConfigResourceMock(configResourceService, configResourceQuery);
-
- configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
- configGeneratorService = new ConfigGeneratorServiceImpl(configResourceService);
-
- ConfigPreviewService configPreviewService =
- new ConfigPreviewService(configResourceService, configModelService, configGeneratorService);
-
- ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData();
- resourceAssignmentData.setResourceId("123-resourceId");
- resourceAssignmentData.setResourceType("sample-resourceType");
- resourceAssignmentData.setServiceTemplateName("sample-serviceTemplateName");
- resourceAssignmentData.setServiceTemplateVersion("1.0.0");
- resourceAssignmentData.setActionName("sample-action");
-
- resourceAssignmentData = configPreviewService.generateTemplateResourceMash(resourceAssignmentData);
-
- Assert.assertNotNull("Failed to get GenerateTemplateResourceMash response.", resourceAssignmentData);
- Assert.assertNotNull("Failed to get template mashed contents.",
- resourceAssignmentData.getTemplatesMashedContents());
-
- Assert.assertNotNull("Failed to get base-config template mashed contents.",
- resourceAssignmentData.getTemplatesMashedContents().get("base-config-template"));
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ConfigResourceAssignmentTestUtils.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ConfigResourceAssignmentTestUtils.java deleted file mode 100644 index 97082ae0f..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ConfigResourceAssignmentTestUtils.java +++ /dev/null @@ -1,182 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.io.IOUtils;
-import org.mockito.Matchers;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.domain.ConfigModel;
-import org.onap.ccsdk.features.model.domain.ConfigModelContent;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ConfigResourceAssignmentTestUtils {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigResourceAssignmentTestUtils.class);
-
- public static void injectTransactionLogSaveMock(ConfigResourceService configResourceService) throws Exception {
- Mockito.doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- if (args != null) {
- logger.trace("Transaction info " + Arrays.asList(args));
- }
- return null;
- }
- }).when(configResourceService).save(any(TransactionLog.class));
- }
-
- public static void injectConfigModelMock(ConfigRestAdaptorService configRestAdaptorService,
- String serviceTemplateName) throws Exception {
-
- Mockito.doAnswer(new Answer<ConfigModel>() {
- @Override
- public org.onap.ccsdk.features.model.domain.ConfigModel answer(InvocationOnMock invocationOnMock)
- throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- org.onap.ccsdk.features.model.domain.ConfigModel serviceArtifact = null;
- if (args != null && args.length == 3) {
-
- logger.info("Artifact info " + Arrays.asList(args));
- String modelContent = IOUtils.toString(
- ConfigResourceAssignmentTestUtils.class.getClassLoader().getResourceAsStream(
- "service_templates/" + serviceTemplateName + "/" + serviceTemplateName + ".json"),
- Charset.defaultCharset());
-
- ConfigModelContent configModelContent = new ConfigModelContent();
- configModelContent.setContent(modelContent);
- configModelContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON);
-
- List<ConfigModelContent> configModelContents = new ArrayList<>();
- configModelContents.add(configModelContent);
-
- String velocityDir = ConfigResourceAssignmentTestUtils.class.getClassLoader()
- .getResource("service_templates/" + serviceTemplateName + "/velocity").getPath();
-
- Collection<File> templateFiles =
- FileUtils.listFiles(new File(velocityDir), new String[] {"vtl"}, true);
- logger.info("Template Files info " + templateFiles);
- for (File templateFile : templateFiles) {
- String templateContent = FileUtils.readFileToString(templateFile, Charset.defaultCharset());
- ConfigModelContent configModelTemplateContent = new ConfigModelContent();
- configModelTemplateContent.setContent(templateContent);
- configModelTemplateContent.setName(FilenameUtils.getBaseName(templateFile.getName()));
- configModelTemplateContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TEMPLATE);
- configModelContents.add(configModelTemplateContent);
- }
-
- serviceArtifact = new org.onap.ccsdk.features.model.domain.ConfigModel();
- serviceArtifact.setArtifactName(String.valueOf(args[0]));
- serviceArtifact.setArtifactVersion(String.valueOf(args[1]));
- serviceArtifact.setPublished("Y");
- serviceArtifact.setConfigModelContents(configModelContents);
- }
-
- return serviceArtifact;
- }
- }).when(configRestAdaptorService).getResource(anyString(), anyString(), Matchers.any(Class.class));
- }
-
- public static void injectResourceDictionaryMock(ConfigRestAdaptorService configRestAdaptorService,
- String dictionaryFileName) throws Exception {
-
- Mockito.doAnswer(new Answer<String>() {
- @Override
- public String answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- String dictionaties = "[]";
- if (args != null) {
- logger.info("getResourceDictionaryByNames " + Arrays.asList(args));
- dictionaties = IOUtils.toString(
- ConfigAssignmentNodeTest.class.getClassLoader().getResourceAsStream(dictionaryFileName),
- Charset.defaultCharset());
- }
- return dictionaties;
- }
- }).when(configRestAdaptorService).postResource(Matchers.any(), Matchers.any(), Matchers.any(),
- Matchers.any(Class.class));
- }
-
- public static void injectConfigResourceSaveMock(ConfigResourceService configResourceService) throws Exception {
- Mockito.doAnswer(new Answer<ConfigResource>() {
- @Override
- public ConfigResource answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- ConfigResource configResource = null;
- if (args != null) {
- configResource = (ConfigResource) args[0];
- logger.info("Config Resource Save info " + configResource);
- return configResource;
- }
- return configResource;
- }
- }).when(configResourceService).saveConfigResource(any(ConfigResource.class));
- }
-
- public static void injectGetConfigResourceMock(ConfigResourceService configResourceService,
- ConfigResource configResource) throws Exception {
- Mockito.doAnswer(new Answer<List<ConfigResource>>() {
- @Override
- public List<ConfigResource> answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- List<ConfigResource> configResources = new ArrayList<>();
- if (args != null) {
- configResources.add(configResource);
- }
- return configResources;
- }
- }).when(configResourceService).getConfigResource(any(ConfigResource.class));
- }
-
- public static String getFileContent(String filePath) throws Exception {
- return IOUtils.toString(ConfigResourceAssignmentTestUtils.class.getClassLoader().getResourceAsStream(filePath),
- Charset.defaultCharset());
- }
-
- public static Map<String, ResourceDefinition> getMapfromJson(String content) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.readValue(content, new TypeReference<Map<String, ResourceDefinition>>() {});
- } catch (Exception e) {
- logger.info("getMapfromJson Exception ({})", e);
- }
- return null;
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ResourceAssignmentGenerationTest.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ResourceAssignmentGenerationTest.java deleted file mode 100644 index 73f0d0941..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ResourceAssignmentGenerationTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.nio.charset.Charset;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.IOUtils;
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.utils.ResourceAssignmentUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class ResourceAssignmentGenerationTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceAssignmentGenerationTest.class);
-
- @Test
- public void testResourceDataSetting() {
- try {
- logger.info(" **************** testResourceDataSetting *****************");
- String resourceAssignmentContents = IOUtils.toString(TopologicalSortingTest.class.getClassLoader()
- .getResourceAsStream("assignments/alltype-empty-value-mapping.json"), Charset.defaultCharset());
-
- List<ResourceAssignment> assignments =
- TransformationUtils.getListfromJson(resourceAssignmentContents, ResourceAssignment.class);
- if (assignments != null) {
- Map<String, Object> componentContext = new HashMap<>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, "sample-recipe");
- for (ResourceAssignment resourceAssignment : assignments) {
- if (resourceAssignment != null && resourceAssignment.getProperty() != null) {
- String type = resourceAssignment.getProperty().getType();
- Object value = null;
- if (ValidTypes.DATA_TYPE_STRING.equals(type)) {
- value = new String("abcdef");
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(type)) {
- value = new Integer(1234);
- } else if (ValidTypes.DATA_TYPE_BOOLEAN.equals(type)) {
- value = new Boolean(true);
- } else if (ValidTypes.DATA_TYPE_LIST.equals(type)) {
- String entityType = resourceAssignment.getProperty().getEntrySchema().getType();
- if (ValidTypes.DATA_TYPE_STRING.equals(entityType)) {
- value = "[\"abcd-array\"]";
- } else {
- String content = "[{\"name\" : \"abcd-array-complex\"}]";
- JsonNode node = TransformationUtils.getJsonNodeForString(content);
- value = node;
- }
- } else {
- String content = "{\"name\" : \"abcd-complex\"}";
- JsonNode node = TransformationUtils.getJsonNodeForString(content);
- value = node;
- }
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- }
- }
- String generatedData = ResourceAssignmentUtils.generateResourceDataForAssignments(assignments);
- logger.trace("Generated Data " + generatedData);
-
- Assert.assertNotNull("Failed to generate resource data", generatedData);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testGenerateResourceData() {
- try {
- logger.info(" **************** testGenerateResourceData *****************");
- String resourceAssignmentContents = IOUtils.toString(TopologicalSortingTest.class.getClassLoader()
- .getResourceAsStream("assignments/alltype-mapping.json"), Charset.defaultCharset());
-
- List<ResourceAssignment> assignments =
- TransformationUtils.getListfromJson(resourceAssignmentContents, ResourceAssignment.class);
- if (assignments != null) {
-
- String generatedData = ResourceAssignmentUtils.generateResourceDataForAssignments(assignments);
- logger.trace("Generated Data " + generatedData);
-
- Assert.assertNotNull("Failed to generate resource data", generatedData);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ResourceAssignmentValidation.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ResourceAssignmentValidation.java deleted file mode 100644 index 081315639..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/ResourceAssignmentValidation.java +++ /dev/null @@ -1,94 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.List;
-import org.apache.commons.io.IOUtils;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.model.validator.ResourceAssignmentValidator;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ResourceAssignmentValidation {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceAssignmentValidation.class);
-
- @Rule
- public final ExpectedException exception = ExpectedException.none();
-
- @Test
- public void testValidateSuccess() {
- try {
- logger.info(" **************** testValidateSuccess *****************");
- String resourceMapping = IOUtils.toString(
- TopologicalSortingTest.class.getClassLoader().getResourceAsStream("validation/success.json"),
- Charset.defaultCharset());
-
- List<ResourceAssignment> assignments =
- TransformationUtils.getListfromJson(resourceMapping, ResourceAssignment.class);
- if (assignments != null) {
- ResourceAssignmentValidator resourceAssignmentValidator = new ResourceAssignmentValidator(assignments);
-
- boolean result = resourceAssignmentValidator.validateResourceAssignment();
- Assert.assertTrue("Failed to Validate", result);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test(expected = ConfigModelException.class)
- public void testValidateDuplicate() throws IOException, ConfigModelException {
- logger.info(" **************** testValidateDuplicate *****************");
- String resourceMapping = IOUtils.toString(
- TopologicalSortingTest.class.getClassLoader().getResourceAsStream("validation/duplicate.json"),
- Charset.defaultCharset());
-
- List<ResourceAssignment> assignments =
- TransformationUtils.getListfromJson(resourceMapping, ResourceAssignment.class);
- if (assignments != null) {
- ResourceAssignmentValidator resourceAssignmentValidator = new ResourceAssignmentValidator(assignments);
- resourceAssignmentValidator.validateResourceAssignment();
- }
-
- }
-
- @Test(expected = ConfigModelException.class)
- public void testValidateCyclic() throws IOException, ConfigModelException {
- logger.info(" **************** testValidateCyclic *****************");
- String resourceMapping = IOUtils.toString(
- TopologicalSortingTest.class.getClassLoader().getResourceAsStream("validation/cyclic.json"),
- Charset.defaultCharset());
-
- List<ResourceAssignment> assignments =
- TransformationUtils.getListfromJson(resourceMapping, ResourceAssignment.class);
- if (assignments != null) {
- ResourceAssignmentValidator resourceAssignmentValidator = new ResourceAssignmentValidator(assignments);
-
- resourceAssignmentValidator.validateResourceAssignment();
- }
-
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/TopologicalSortingTest.java b/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/TopologicalSortingTest.java deleted file mode 100644 index f6e8871a6..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/features/assignment/service/TopologicalSortingTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.assignment.service;
-
-import java.nio.charset.Charset;
-import java.util.List;
-import org.apache.commons.io.IOUtils;
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.ccsdk.features.assignment.processor.ResourceAssignmentProcessor;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class TopologicalSortingTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(TopologicalSortingTest.class);
-
- @Test
- public void testBulkSequencingMapping() {
- try {
- logger.info(" **************** Bulk Sequencing Default *****************");
- String resourceMapping = IOUtils.toString(
- TopologicalSortingTest.class.getClassLoader().getResourceAsStream("mapping/dependency.json"),
- Charset.defaultCharset());
-
- List<ResourceAssignment> assignments =
- TransformationUtils.getListfromJson(resourceMapping, ResourceAssignment.class);
- if (assignments != null) {
- SvcLogicContext ctx = new SvcLogicContext();
- ResourceAssignmentProcessor resourceAssignmentProcessor =
- new ResourceAssignmentProcessor(assignments, ctx);
- List<List<ResourceAssignment>> sequenceBatchResourceAssignment = resourceAssignmentProcessor.process();
-
- Assert.assertNotNull("Failed to populate Sequence Bulk Mappings", sequenceBatchResourceAssignment);
- Assert.assertNotEquals("Failed to populate Sequence Bulk Mappings size ",
- (sequenceBatchResourceAssignment.size() > 0));
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/assignments/alltype-empty-value-mapping.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/assignments/alltype-empty-value-mapping.json deleted file mode 100644 index a3d65927b..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/assignments/alltype-empty-value-mapping.json +++ /dev/null @@ -1,86 +0,0 @@ -[
- {
- "name": "vnf-id-string",
- "property": {
- "required": true,
- "type": "string"
- },
- "input-param": true,
- "dictionary-name": "vnf-id-string",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- },
- {
- "name": "vnf-id-integer",
- "property": {
- "required": true,
- "type": "integer"
- },
- "input-param": true,
- "dictionary-name": "vnf-id-integer",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- },
- {
- "name": "vnf-boolean",
- "property": {
- "required": true,
- "type": "boolean"
- },
- "input-param": true,
- "dictionary-name": "vnf-boolean",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- },
- {
- "name": "vnf-complex",
- "property": {
- "required": true,
- "type": "dt-complex"
- },
- "input-param": true,
- "dictionary-name": "vnf-complex",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- },
- {
- "name": "vnf-id-array",
- "property": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "input-param": true,
- "dictionary-name": "vnf-id-array",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- },
- {
- "name": "vnf-array-complex",
- "property": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "dt-complex"
- }
- },
- "input-param": true,
- "dictionary-name": "vnf-array-complex",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/assignments/alltype-mapping.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/assignments/alltype-mapping.json deleted file mode 100644 index 36909da99..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/assignments/alltype-mapping.json +++ /dev/null @@ -1,110 +0,0 @@ -[
- {
- "name": "vnf-id-string",
- "property": {
- "required": true,
- "type": "string",
- "value": "123456"
- },
- "input-param": true,
- "dictionary-name": "vnf-id-string",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- },
- {
- "name": "vnf-id-integer",
- "property": {
- "required": true,
- "type": "integer",
- "value": 123456
- },
- "input-param": true,
- "dictionary-name": "vnf-id-integer",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- },
- {
- "name": "vnf-boolean",
- "property": {
- "required": true,
- "type": "boolean",
- "value": true
- },
- "input-param": true,
- "dictionary-name": "vnf-boolean",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- },
- {
- "name": "vnf-complex",
- "property": {
- "required": true,
- "type": "dt-complex",
- "value": {
- "name": "Brinda",
- "location": "Madurai",
- "count": 2
- }
- },
- "input-param": true,
- "dictionary-name": "vnf-complex",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- },
- {
- "name": "vnf-id-array",
- "property": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- },
- "value": [
- "A",
- "B",
- "C"
- ]
- },
- "input-param": true,
- "dictionary-name": "vnf-id-array",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- },
- {
- "name": "vnf-array-complex",
- "property": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "dt-complex"
- },
- "value": [
- {
- "name": "A"
- },
- {
- "name": "B"
- },
- {
- "name": "C"
- }
- ]
- },
- "input-param": true,
- "dictionary-name": "vnf-array-complex",
- "dictionary-source": "input",
- "version": 0,
- "status": "success",
- "updated-by": "System"
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/assignments/empty-dictionary.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/assignments/empty-dictionary.json deleted file mode 100644 index 0637a088a..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/assignments/empty-dictionary.json +++ /dev/null @@ -1 +0,0 @@ -[]
\ No newline at end of file diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/array-complex-response.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/array-complex-response.json deleted file mode 100644 index 2dfe89e29..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/array-complex-response.json +++ /dev/null @@ -1,12 +0,0 @@ -{
- "locations": [
- {
- "mdsal-country": "US",
- "mdsal-state": "NJ"
- },
- {
- "mdsal-country": "INDIA",
- "mdsal-state": "TN"
- }
- ]
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/array-complex-v4-assigned-response.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/array-complex-v4-assigned-response.json deleted file mode 100644 index d7c5546c1..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/array-complex-v4-assigned-response.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "v4-assigned-ip-list": [ - { - "v4-ip-type": "NMLAN", - "ipv4-gateway-prefix": "10.66.1.129", - "v4-ip-prefix": "10.66.1.152", - "v4-ip-prefix-length": 32, - "ip-count": 1, - "v4-ip-source": "EIPAM", - "client-key": "ADIG_19_vnf_name061rej01" - } - ] -} diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/complex-response.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/complex-response.json deleted file mode 100644 index 1a36100fd..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/complex-response.json +++ /dev/null @@ -1,6 +0,0 @@ -{
- "locations": {
- "mdsal-country": "US",
- "mdsal-state": "NJ"
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/default-pointer.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/default-pointer.json deleted file mode 100644 index 47edb1881..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/default-pointer.json +++ /dev/null @@ -1,166 +0,0 @@ -{
- "vnf-topology-information": {
- "vnf-assignments": {
- "availability-zones": [
- {
- "availability-zone": "frkde-esx-az01"
- }
- ],
- "vnf-vms": [
- {
- "vm-type": "vre",
- "vm-count": 1,
- "vm-networks": [
- {
- "network-role": "ADIGOam.OAM",
- "network-name": "ADIGOAM.OAM",
- "v4-assigned-ip-list": [
- {
- "v4-ip-type": "NMLAN",
- "ipv4-gateway-prefix": "10.66.1.129",
- "v4-ip-prefix": "10.66.1.152",
- "v4-ip-prefix-length": 32,
- "ip-count": 1,
- "v4-ip-source": "EIPAM",
- "client-key": "ADIG_19_vnf_name061rej01"
- }
- ],
- "network-id": "VPEADIG1d77c-1086-41ec-b7f3-94bb30936807"
- },
- {
- "network-role": "Internal-Network",
- "network-name": "VMX-INTTERNAL056",
- "v4-assigned-ip-list": [
- {
- "v4-ip-type": "INTERNAL",
- "v4-ip-prefix": "128.0.0.1",
- "ipv4-prefix-block": "128.0.0.0",
- "v4-ip-prefix-length": 24,
- "v4-ip-source": "OTHER"
- }
- ],
- "network-forwarding": "l2",
- "network-id": "VMX-INT1"
- }
- ],
- "vm-names": [
- {
- "vm-name": "ADIG_19_vnf_name061rej",
- "vm-uuid": "50d2032d-fe15-4e82-94f3-8b73c566a345"
- }
- ]
- },
- {
- "vm-type": "vpfe",
- "vm-count": 1,
- "vm-networks": [
- {
- "network-role": "ADIG_SRIOV_3",
- "network-name": "ADIG_SRIOV_3",
- "multicast-allow": true,
- "broadcast-allow": true,
- "network-id": "VPEADIG1d77c-1086-41ec-b7f3-94bb30936810",
- "vlan-filter": "[4013,4014]",
- "network-macs": [
- {
- "mac-address": "dc:38:e1:69:bf:5f"
- }
- ],
- "vlan-strip": false,
- "unicast-allow": true
- },
- {
- "network-role": "ADIG_SRIOV_4",
- "network-name": "ADIG_SRIOV_4",
- "multicast-allow": true,
- "broadcast-allow": true,
- "network-id": "VPEADIG1d77c-1086-41ec-b7f3-94bb30936811",
- "vlan-filter": "[4013,4014]",
- "network-macs": [
- {
- "mac-address": "dc:38:e1:69:bf:5f"
- }
- ],
- "vlan-strip": false,
- "unicast-allow": true
- },
- {
- "network-role": "ADIG_SRIOV_1",
- "network-name": "ADIG_SRIOV_1",
- "multicast-allow": true,
- "broadcast-allow": true,
- "network-id": "VPEADIG1d77c-1086-41ec-b7f3-94bb30936808",
- "vlan-filter": "[4013,4014]",
- "network-macs": [
- {
- "mac-address": "dc:38:e1:69:bf:5f"
- }
- ],
- "vlan-strip": false,
- "unicast-allow": true
- },
- {
- "network-role": "ADIG_SRIOV_2",
- "network-name": "ADIG_SRIOV_2",
- "multicast-allow": true,
- "broadcast-allow": true,
- "network-id": "VPEADIG1d77c-1086-41ec-b7f3-94bb30936809",
- "vlan-filter": "[4013,4014]",
- "network-macs": [
- {
- "mac-address": "dc:38:e1:69:bf:5f"
- }
- ],
- "vlan-strip": false,
- "unicast-allow": true
- },
- {
- "network-role": "Internal-Network",
- "network-name": "VMX-INTTERNAL056",
- "v4-assigned-ip-list": [
- {
- "v4-ip-type": "INTERNAL",
- "v4-ip-prefix": "128.0.0.16",
- "ipv4-prefix-block": "128.0.0.0",
- "v4-ip-prefix-length": 24,
- "v4-ip-source": "OTHER"
- }
- ],
- "network-forwarding": "l2",
- "network-id": "VMX-INT1"
- }
- ],
- "vm-names": [
- {
- "vm-name": "ADIG_19_vnf_name056fej",
- "vm-uuid": "d2ce6023-a3ab-412e-bc63-360307aac165"
- }
- ]
- }
- ],
- "vnf-status": "Deactivated",
- "vnf-networks": [
- {
- "network-role": "ADIGOam.OAM",
- "network-id": "VPEADIG1d77c-1086-41ec-b7f3-94bb30936807"
- },
- {
- "network-role": "ADIG_SRIOV_3",
- "network-id": "VPEADIG1d77c-1086-41ec-b7f3-94bb30936810"
- },
- {
- "network-role": "ADIG_SRIOV_2",
- "network-id": "VPEADIG1d77c-1086-41ec-b7f3-94bb30936809"
- },
- {
- "network-role": "ADIG_SRIOV_4",
- "network-id": "VPEADIG1d77c-1086-41ec-b7f3-94bb30936811"
- },
- {
- "network-role": "ADIG_SRIOV_1",
- "network-id": "VPEADIG1d77c-1086-41ec-b7f3-94bb30936808"
- }
- ]
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/dt-location.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/dt-location.json deleted file mode 100644 index 52e0a7967..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/dt-location.json +++ /dev/null @@ -1,15 +0,0 @@ -{
- "version": "1.0.0",
- "description": "test Data Type",
- "properties": {
- "country": {
- "required": true,
- "type": "string"
- },
- "state": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/dt-v4-assigned-ip-list.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/dt-v4-assigned-ip-list.json deleted file mode 100644 index bc8f1d2c2..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/dt-v4-assigned-ip-list.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "version": "1.0.0", - "description": "This is dt-v4-assigned-ip-list Data Type", - "properties": { - "v4-ip-type": { - "required": true, - "type": "string" - }, - "ipv4-gateway-prefix": { - "required": true, - "type": "string" - }, - "v4-ip-prefix": { - "required": true, - "type": "string" - }, - "v4-ip-prefix-length": { - "required": true, - "type": "string" - }, - "v4-ip-source": { - "required": true, - "type": "string" - } - }, - "derived_from": "tosca.datatypes.Root" -} diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-array-v4iplist.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-array-v4iplist.json deleted file mode 100644 index 387a5ad2d..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-array-v4iplist.json +++ /dev/null @@ -1,76 +0,0 @@ -{
- "v4-ip-prefix": {
- "name": "v4-ip-prefix",
- "property": {
- "type": "string"
- },
- "sources": {
- "mdsal": {
- "type": "source-mdsal",
- "properties": {
- "url-path": "/restconf/config/L3VNF-API:services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$oam-ipv4-ip-type/vm-networks/$oam-network-role/v4-assigned-ip-list/$oam-vm-type",
- "path": "/v4-assigned-ip-list/0/v4-ip-prefix",
- "input-key-mapping": {
- "service-instance-id": "service-instance-id",
- "oam-network-role": "oam-network-role",
- "oam-ipv4-ip-type": "oam-ipv4-ip-type",
- "oam-vm-type": "oam-vm-type"
- },
- "output-key-mapping": {
- "v4-ip-prefix": "v4-ip-prefix"
- },
- "key-dependencies": [
- "service-instance-id",
- "oam-network-role",
- "oam-ipv4-ip-type",
- "oam-vm-type"
- ]
- }
- }
- }
- },
- "service-instance-id": {
- "name": "service-instance-id",
- "property": {
- "type": "string"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- },
- "oam-network-role": {
- "name": "oam-network-role",
- "property": {
- "type": "string"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- },
- "oam-ipv4-ip-type": {
- "name": "oam-ipv4-ip-type",
- "property": {
- "type": "string"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- },
- "oam-vm-type": {
- "name": "oam-vm-type",
- "property": {
- "type": "string"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-array.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-array.json deleted file mode 100644 index 290a15752..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-array.json +++ /dev/null @@ -1,42 +0,0 @@ -{
- "locations": {
- "name": "locations",
- "property": {
- "type": "list",
- "entry_schema": {
- "type": "dt-location"
- }
- },
- "sources": {
- "mdsal": {
- "type": "source-mdsal",
- "properties": {
- "url-path": "/restconf/config/L3VNF-API/services/service-list/$profile_name/12345",
- "path": "/locations",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "mdsal-country": "country",
- "mdsal-state": "state"
- },
- "key-dependencies": [
- "profile_name"
- ]
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "property": {
- "type": "string"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- }
-}
-
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-complex.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-complex.json deleted file mode 100644 index f5a7d7ef6..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-complex.json +++ /dev/null @@ -1,38 +0,0 @@ -{
- "location": {
- "name": "location",
- "property": {
- "type": "dt-location"
- },
- "sources": {
- "mdsal": {
- "type": "source-mdsal",
- "properties": {
- "url-path": "/restconf/config/L3VNF-API/services/service-list/$profile_name/12345",
- "path": "/locations",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "mdsal-country": "country",
- "mdsal-state": "state"
- },
- "key-dependencies": [
- "profile_name"
- ]
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "property": {
- "type": "string"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-simple.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-simple.json deleted file mode 100644 index db7ee7eed..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/mdsal-simple.json +++ /dev/null @@ -1,37 +0,0 @@ -{
- "country": {
- "name": "country",
- "property": {
- "type": "string"
- },
- "sources": {
- "mdsal": {
- "type": "source-mdsal",
- "properties": {
- "url-path": "/restconf/config/L3VNF-API/services/service-list/$profile_name/12345",
- "path": "/locations",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "country": "country"
- },
- "key-dependencies": [
- "profile_name"
- ]
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "property": {
- "type": "string"
- },
- "sources": {
- "input": {
- "type": "source-input"
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-array.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-array.json deleted file mode 100644 index 2b5865326..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-array.json +++ /dev/null @@ -1,15 +0,0 @@ -[
- {
- "name": "locations",
- "input-param": true,
- "property": {
- "type": "list",
- "entry_schema": {
- "type": "dt-location"
- }
- },
- "dictionary-name": "locations",
- "dictionary-source": "mdsal",
- "dependencies": []
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-complex-simple.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-complex-simple.json deleted file mode 100644 index 15881cfd0..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-complex-simple.json +++ /dev/null @@ -1,12 +0,0 @@ -[
- {
- "name": "v4-ip-prefix",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "v4-ip-prefix",
- "dictionary-source": "mdsal",
- "dependencies": []
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-complex.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-complex.json deleted file mode 100644 index e42bd9431..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-complex.json +++ /dev/null @@ -1,12 +0,0 @@ -[
- {
- "name": "location",
- "input-param": true,
- "property": {
- "type": "dt-location"
- },
- "dictionary-name": "location",
- "dictionary-source": "mdsal",
- "dependencies": []
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-simple.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-simple.json deleted file mode 100644 index 6385e6a8b..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/resource-assignments-simple.json +++ /dev/null @@ -1,12 +0,0 @@ -[
- {
- "name": "country",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "country",
- "dictionary-source": "mdsal",
- "dependencies": []
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/simple-response.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/simple-response.json deleted file mode 100644 index 8c2bb898f..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/Mdsal/simple-response.json +++ /dev/null @@ -1,3 +0,0 @@ -{
- "locations": "US"
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/db-array.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/db-array.json deleted file mode 100644 index bab783544..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/db-array.json +++ /dev/null @@ -1,40 +0,0 @@ -{
- "locations": {
- "name": "locations",
- "property": {
- "type": "list",
- "entry_schema": {
- "type": "dt-location"
- }
- },
- "sources": {
- "db": {
- "type": "source-sdnctl-db",
- "properties": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- },
- "key-dependencies": [
- "profile_name"
- ]
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "property": {
- "type": "string"
- },
- "sources": {
- "input": {
- "type": "source-input"
- }
- }
- }
-}
\ No newline at end of file diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/db-complex.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/db-complex.json deleted file mode 100644 index 7310500e3..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/db-complex.json +++ /dev/null @@ -1,37 +0,0 @@ -{
- "location": {
- "name": "location",
- "property": {
- "type": "dt-location"
- },
- "sources": {
- "db": {
- "type": "source-sdnctl-db",
- "properties": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- },
- "key-dependencies": [
- "profile_name"
- ]
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "property": {
- "type": "string"
- },
- "sources": {
- "input": {
- "type": "source-input"
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/db-simple.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/db-simple.json deleted file mode 100644 index 86d29c751..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/db-simple.json +++ /dev/null @@ -1,36 +0,0 @@ -{
- "country": {
- "name": "country",
- "property": {
- "type": "string"
- },
- "sources": {
- "db": {
- "type": "source-sdnctl-db",
- "properties": {
- "query": "SELECT country FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "country": "country"
- },
- "key-dependencies": [
- "profile_name"
- ]
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "property": {
- "type": "string"
- },
- "sources": {
- "input": {
- "type": "source-input"
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/dt-location.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/dt-location.json deleted file mode 100644 index 52e0a7967..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/dt-location.json +++ /dev/null @@ -1,15 +0,0 @@ -{
- "version": "1.0.0",
- "description": "test Data Type",
- "properties": {
- "country": {
- "required": true,
- "type": "string"
- },
- "state": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/resource-assignments-array.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/resource-assignments-array.json deleted file mode 100644 index c82f9addc..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/resource-assignments-array.json +++ /dev/null @@ -1,15 +0,0 @@ -[
- {
- "name": "locations",
- "input-param": true,
- "property": {
- "type": "list",
- "entry_schema": {
- "type": "dt-location"
- }
- },
- "dictionary-name": "locations",
- "dictionary-source": "db",
- "dependencies": []
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/resource-assignments-complex.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/resource-assignments-complex.json deleted file mode 100644 index 4cca99bde..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/resource-assignments-complex.json +++ /dev/null @@ -1,12 +0,0 @@ -[
- {
- "name": "location",
- "input-param": true,
- "property": {
- "type": "dt-location"
- },
- "dictionary-name": "location",
- "dictionary-source": "db",
- "dependencies": []
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/resource-assignments-simple.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/resource-assignments-simple.json deleted file mode 100644 index 02ce68be4..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/db/resource-assignments-simple.json +++ /dev/null @@ -1,12 +0,0 @@ -[
- {
- "name": "country",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "country",
- "dictionary-source": "db",
- "dependencies": []
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/default/default-simple.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/default/default-simple.json deleted file mode 100644 index fca0dde83..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/default/default-simple.json +++ /dev/null @@ -1,35 +0,0 @@ -{
- "country": {
- "name": "country",
- "property": {
- "type": "string"
- },
- "sources": {
- "default": {
- "type": "source-default"
- }
- }
- },
- "port": {
- "name": "port",
- "property": {
- "type": "integer"
- },
- "sources": {
- "default": {
- "type": "source-default"
- }
- }
- },
- "voip-enabled": {
- "name": "voip-enabled",
- "property": {
- "type": "boolean"
- },
- "sources": {
- "default": {
- "type": "source-default"
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/default/resource-assignments-simple.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/default/resource-assignments-simple.json deleted file mode 100644 index fc92710a5..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/default/resource-assignments-simple.json +++ /dev/null @@ -1,35 +0,0 @@ -[
- {
- "name": "country",
- "input-param": true,
- "property": {
- "type": "string",
- "default": "US"
- },
- "dictionary-name": "country",
- "dictionary-source": "default",
- "dependencies": []
- },
- {
- "name": "port",
- "input-param": true,
- "property": {
- "type": "integer",
- "default": 830
- },
- "dictionary-name": "port",
- "dictionary-source": "default",
- "dependencies": []
- },
- {
- "name": "voip-enabled",
- "input-param": true,
- "property": {
- "type": "boolean",
- "default": true
- },
- "dictionary-name": "voip-enabled",
- "dictionary-source": "default",
- "dependencies": []
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/dependency.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/dependency.json deleted file mode 100644 index e08539c0d..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/dependency.json +++ /dev/null @@ -1,110 +0,0 @@ -[
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "service-instance-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "service-instance-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-ip",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id",
- "bundle-id"
- ]
- },
- {
- "name": "managed-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip",
- "dictionary-source": "mdsal",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "vnf-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-name",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "managed-ip1",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "loopback-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "loopback-ip",
- "dictionary-source": "db",
- "dependencies": [
- "bundle-mac"
- ]
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/dt-location.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/dt-location.json deleted file mode 100644 index 52e0a7967..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/dt-location.json +++ /dev/null @@ -1,15 +0,0 @@ -{
- "version": "1.0.0",
- "description": "test Data Type",
- "properties": {
- "country": {
- "required": true,
- "type": "string"
- },
- "state": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/input-complex.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/input-complex.json deleted file mode 100644 index 7eabe440a..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/input-complex.json +++ /dev/null @@ -1,24 +0,0 @@ -{
- "location": {
- "name": "location",
- "property": {
- "type": "dt-location"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "property": {
- "type": "string"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/input-simple.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/input-simple.json deleted file mode 100644 index 7b663f36a..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/input-simple.json +++ /dev/null @@ -1,35 +0,0 @@ -{
- "country": {
- "name": "country",
- "property": {
- "type": "string"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- },
- "port": {
- "name": "port",
- "property": {
- "type": "integer"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- },
- "voip-enabled": {
- "name": "voip-enabled",
- "property": {
- "type": "boolean"
- },
- "sources": {
- "default": {
- "type": "source-input"
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/resource-assignments-complex.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/resource-assignments-complex.json deleted file mode 100644 index 9e17841b4..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/resource-assignments-complex.json +++ /dev/null @@ -1,13 +0,0 @@ -[
- {
- "name": "location",
- "input-param": true,
- "property": {
- "type": "dt-location",
- "required": true
- },
- "dictionary-name": "location",
- "dictionary-source": "input",
- "dependencies": []
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/resource-assignments-simple.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/resource-assignments-simple.json deleted file mode 100644 index e3b2bcc06..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/resource-assignments-simple.json +++ /dev/null @@ -1,32 +0,0 @@ -[
- {
- "name": "country",
- "input-param": true,
- "property": {
- "type": "string",
- "default": "US"
- },
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "port",
- "input-param": true,
- "property": {
- "type": "integer",
- "default": 830
- },
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "voip-enabled",
- "input-param": true,
- "property": {
- "type": "boolean",
- "default": true
- },
- "dictionary-source": "input",
- "dependencies": []
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/sample-location.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/sample-location.json deleted file mode 100644 index 2f3f1c102..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/mapping/input/sample-location.json +++ /dev/null @@ -1,4 +0,0 @@ -{
- "country": "US",
- "state": "NJ"
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/input/input.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/input/input.json deleted file mode 100644 index cd6fac128..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/input/input.json +++ /dev/null @@ -1,18 +0,0 @@ -{
- "api-ver": "2.00",
- "originator-id": "MSO",
- "request-id": "123456",
- "service-instance-id": "ibcx0001vm001",
- "service-type": "AVPN",
- "vnf-type": "vUSP - vDBE-IPX HUB",
- "vnf-id": 123456,
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "action-name": "resource-assignment-action",
- "group-name": "sample group name",
- "bundle-id": "sample bundle id",
- "bundle-mac": [
- "Sample bundle mac",
- "Sample bundle mac"
- ]
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/input/inputValidateTest.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/input/inputValidateTest.json deleted file mode 100644 index 354ca577b..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/input/inputValidateTest.json +++ /dev/null @@ -1,18 +0,0 @@ -{
- "api-ver": "2.00",
- "originator-id": "MSO",
- "request-id": "123456",
- "service-instance-id": "ibcx0001vm001",
- "service-type": "AVPN",
- "vnf-type": "vUSP - vDBE-IPX HUB",
- "vnf-id": "",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "action-name": "resource-assignment-action",
- "group-name": "sample group name",
- "bundle-id": "sample bundle id",
- "bundle-mac": [
- "Sample bundle mac",
- "Sample bundle mac"
- ]
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/resource_assignment.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/resource_assignment.json deleted file mode 100644 index cbea6a82c..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/resource_assignment.json +++ /dev/null @@ -1,407 +0,0 @@ -{
- "metadata": {
- "author": "ks220y@att.com",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "release": "1802",
- "service-type": "AVPN",
- "vnf-type": "VRR"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "required": true,
- "type": "string"
- }
- },
- "node_templates": {
- "base-config-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://base-config-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input"
- },
- {
- "name": "group-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "group-name",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment-action": {
- "type": "dg-resource-assignment",
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
-
- }
- }
- }
- },
- "capabilities": {
- "dg-node": {
-
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- }
- },
- "licence-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://licence-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "input"
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment": {
- "type": "component-resource-assignment",
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "resource-type": "vnf-type",
- "template-names": [
- "base-config-template",
- "licence-template"
- ],
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"vnf-id\" }"
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- }
- }
- },
- "node_types": {
- "dg-resource-assignment": {
- "description": "This is Resource Assignment Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": "false"
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.DG"
- },
- "component-resource-assignment": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": {
- "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "handler-name": {
- "description": "Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
- "required": true,
- "type": "string"
- },
- "resource-type": {
- "required": false,
- "type": "string"
- },
- "template-names": {
- "description": "Name of the Artifact Node Templates, to get the template Content.",
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- },
- "resource-id": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "resource-assignment-params": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "artifact-config-template": {
- "description": "This is Configuration Velocity Template",
- "version": "1.0.0",
- "properties": {
- "action-names": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "content": {
- "required": false,
- "type": "string"
- },
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- },
- "capabilities": {
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "content": {
- "required": true,
- "type": "string"
- }
- }
- },
- "mapping": {
- "type": "tosca.capabilities.Mapping",
- "properties": {
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Artifact"
- }
- },
- "data_types": {
- "datatype-resource-assignment": {
- "version": "1.0.0",
- "description": "This is Resource Assignment Data Type",
- "properties": {
- "property": {
- "required": true,
- "type": "datatype-property"
- },
- "input-param": {
- "required": true,
- "type": "boolean"
- },
- "dictionary-name": {
- "required": false,
- "type": "string"
- },
- "dictionary-source": {
- "required": false,
- "type": "string"
- },
- "dependencies": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "datatype-property": {
- "version": "1.0.0",
- "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
- "properties": {
- "type": {
- "required": true,
- "type": "string"
- },
- "description": {
- "required": false,
- "type": "string"
- },
- "required": {
- "required": false,
- "type": "boolean"
- },
- "default": {
- "required": false,
- "type": "string"
- },
- "entry_schema": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/resource_assignment/resource_assignment.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/resource_assignment/resource_assignment.json deleted file mode 100644 index 4cbb8fa25..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/resource_assignment/resource_assignment.json +++ /dev/null @@ -1,417 +0,0 @@ -{
- "metadata": {
- "author": "ks220y@att.com",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "release": "1802",
- "service-type": "AVPN",
- "vnf-type": "VRR"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "required": true,
- "type": "string"
- }
- },
- "node_templates": {
- "base-config-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://base-config-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input"
- },
- {
- "name": "group-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "group-name",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment-action": {
- "type": "dg-resource-assignment",
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
-
- }
- }
- }
- },
- "capabilities": {
- "dg-node": {
-
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- }
- },
- "licence-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://licence-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "input"
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment": {
- "type": "component-resource-assignment",
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "resource-type": "vnf-type",
- "template-names": [
- "base-config-template",
- "licence-template"
- ],
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"vnf-id\" }"
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- }
- }
- },
- "node_types": {
- "dg-resource-assignment": {
- "description": "This is Resource Assignment Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": "false"
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.DG"
- },
- "component-resource-assignment": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": {
- "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "handler-name": {
- "description": "Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
- "required": true,
- "type": "string"
- },
- "resource-type": {
- "required": false,
- "type": "string"
- },
- "service-template-name": {
- "required": true,
- "type": "string"
- },
- "service-template-version": {
- "required": true,
- "type": "string"
- },
- "template-names": {
- "description": "Name of the Artifact Node Templates, to get the template Content.",
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- },
- "resource-id": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "resource-assignment-params": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "artifact-config-template": {
- "description": "This is Configuration Velocity Template",
- "version": "1.0.0",
- "properties": {
- "action-names": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "content": {
- "required": false,
- "type": "string"
- },
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- },
- "capabilities": {
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "content": {
- "required": true,
- "type": "string"
- }
- }
- },
- "mapping": {
- "type": "tosca.capabilities.Mapping",
- "properties": {
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Artifact"
- }
- },
- "data_types": {
- "datatype-resource-assignment": {
- "version": "1.0.0",
- "description": "This is Resource Assignment Data Type",
- "properties": {
- "property": {
- "required": true,
- "type": "datatype-property"
- },
- "input-param": {
- "required": true,
- "type": "boolean"
- },
- "dictionary-name": {
- "required": false,
- "type": "string"
- },
- "dictionary-source": {
- "required": false,
- "type": "string"
- },
- "dependencies": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "datatype-property": {
- "version": "1.0.0",
- "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
- "properties": {
- "type": {
- "required": true,
- "type": "string"
- },
- "description": {
- "required": false,
- "type": "string"
- },
- "required": {
- "required": false,
- "type": "boolean"
- },
- "default": {
- "required": false,
- "type": "string"
- },
- "entry_schema": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/resource_assignment/velocity/base-config-template.vtl b/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/resource_assignment/velocity/base-config-template.vtl deleted file mode 100644 index 92dba1024..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/resource_assignment/velocity/base-config-template.vtl +++ /dev/null @@ -1,40 +0,0 @@ - <config>
- <configuration>
- <groups>
- <name>${group-name}</name>
- <routing-instances>
- <instance>
- <name><*></name>
- <protocols>
- <pim>
- <dense-groups>
- <dynamic-reject />
- <pim-dense-group-type>
- <name>224.0.1.40/32</name>
- </pim-dense-group-type>
- <pim-dense-group-type>
- <name>224.0.1.39/32</name>
- </pim-dense-group-type>
- <pim-dense-group-type>
- <name>224.0.0.0/4</name>
- <reject />
- </pim-dense-group-type>
- </dense-groups>
- <rp>
- <auto-rp>
- <discovery />
- </auto-rp>
- </rp>
- <interface>
- <name><*></name>
- <disable />
- <priority>1000</priority>
- </interface>
- <reset-tracking-bit />
- </pim>
- </protocols>
- </instance>
- </routing-instances>
- </groups>
- </configuration>
- </config>
\ No newline at end of file diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/dict.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/dict.json deleted file mode 100644 index f7b09d5af..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/dict.json +++ /dev/null @@ -1,172 +0,0 @@ -[
- {
- "name": "adiod-unicast-route-reflectors",
- "resourcePath": "vnf/protocol/adiod-unicast-route-reflectors",
- "resourceType": "ATT",
- "dataType": "list",
- "entrySchema": "dt-adiod-unicast-route-reflectors",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"adiod-unicast-route-reflectors\",\r\n \"description\" : \"dd\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/protocol/adiod-unicast-route-reflectors\",\r\n \"data-type\" : \"list\",\r\n \"entry-schema\" : \"dt-adiod-unicast-route-reflectors\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"complex-code-char8\" : \"complex-code-char8\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"adiod-unicast-route-reflectors\" : \"adiod-unicast-route-reflectors\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"network-resource-discovery\" : {\r\n \"names\" : [ \"complex-code-char8\" ]\r\n }\r\n }\r\n}",
- "description": "dd",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T17:31:38.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "adiod-vpnv4-route-reflectors",
- "resourcePath": "vnf/servers/adiod-vpnv4-route-reflectors",
- "resourceType": "ATT",
- "dataType": "list",
- "entrySchema": "dt-adiod-vpnv4-route-reflectors",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"adiod-vpnv4-route-reflectors\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/servers/adiod-vpnv4-route-reflectors\",\r\n \"data-type\" : \"list\",\r\n \"entry-schema\" : \"dt-adiod-vpnv4-route-reflectors\",\r\n \"source\" : {\r\n \"input\" : { }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T17:31:38.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "asn-region",
- "resourcePath": "vnf/protocols/asn-region",
- "resourceType": "ATT",
- "dataType": "string",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"asn-region\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/protocols/asn-region\",\r\n \"data-type\" : \"string\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"hostname\" : \"hostname\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"asn-region\" : \"asn-region\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"network-resource-discovery\" : {\r\n \"names\" : [ \"hostname\" ]\r\n }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-17T11:31:29.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "bundle-id",
- "resourcePath": "vnf/interface/bundle-id",
- "resourceType": "ATT",
- "dataType": "string",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"bundle-id\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/interface/bundle-id\",\r\n \"data-type\" : \"string\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"hostname\" : \"hostname\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"bundle-id\" : \"bundle-id\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"network-resource-discovery\" : {\r\n \"names\" : [ \"hostname\" ]\r\n }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T17:31:39.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "lo0-local-ipv4-address",
- "resourcePath": "vnf/interface/lo0-local-ipv4",
- "resourceType": "ATT",
- "dataType": "ipv4-address",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"lo0-local-ipv4-address\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/interface/lo0-local-ipv4\",\r\n \"data-type\" : \"string\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"hostname\" : \"hostname\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"lo0-local-ipv4\" : \"lo0-local-ipv4\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"network-resource-discovery\" : {\r\n \"names\" : [ \"hostname\" ]\r\n }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T17:31:40.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "lo10-local-ipv4-address",
- "resourcePath": "vnf/interface/lo10-local-ipv4",
- "resourceType": "ATT",
- "dataType": "ipv4-address",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"lo10-local-ipv4-address\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/interface/lo10-local-ipv4\",\r\n \"data-type\" : \"string\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"hostname\" : \"hostname\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"lo10-local-ipv4\" : \"lo10-local-ipv4\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"network-resource-discovery\" : {\r\n \"names\" : [ \"hostname\" ]\r\n }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T17:31:41.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "oam-remote-ipv4-address",
- "resourcePath": "vnf/oam-remote-ipv4-address",
- "resourceType": "ATT",
- "dataType": "string",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"oam-remote-ipv4-address\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/oam-remote-ipv4-address\",\r\n \"data-type\" : \"string\",\r\n \"source\" : {\r\n \"input\" : {\r\n \"key\" : \"oam-remote-ipv4-address\"\r\n },\r\n \"mdsal\" : {\r\n \"base\" : \"sdnc-gc\",\r\n \"type\" : \"JSON\",\r\n \"url-path\" : \"/restconf/config/L3VNF-API\",\r\n \"path\" : \"/${services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$oam-ipv4-ip-type/vm-networks/$oam-network-role/v4-assigned-ip-list/$oam-vm-type\",\r\n \"input-key-mapping\" : {\r\n \"service-instance-id\" : \"service-instance-id\",\r\n \"oam-network-role\" : \"oam-network-role\",\r\n \"oam-ipv4-ip-type\" : \"oam-ipv4-ip-type\",\r\n \"oam-vm-type\" : \"oam-vm-type\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"oam-remote-ipv4-address\" : \"ipv4-gateway-prefix\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"mdsal\" : {\r\n \"names\" : [ \"service-instance-id\", \"oam-network-role\", \"oam-v4-ip-type \", \"oam-vm-type\" ]\r\n }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T10:52:24.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "ospf-area",
- "resourcePath": "/ospf-area",
- "resourceType": "ATT",
- "dataType": "string",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"ospf-area\",\r\n \"description\" : \"ospf-area\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"/ospf-area\",\r\n \"data-type\" : \"string\",\r\n \"source\" : {\r\n \"input\" : {\r\n \"key\" : \"ospf-area\"\r\n },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"hostname\" : \"mainResource\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"ospf-area\" : \"ospf-area\"\r\n }\r\n }\r\n }\r\n}",
- "description": "ospf-area",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T10:52:24.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "ospf-cost",
- "resourcePath": "/ospf-cost",
- "resourceType": "ATT",
- "dataType": "string",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"ospf-cost\",\r\n \"description\" : \"ospf-cost\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"/ospf-cost\",\r\n \"data-type\" : \"string\",\r\n \"source\" : {\r\n \"input\" : {\r\n \"key\" : \"ospf-cost\"\r\n },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"hostname\" : \"mainResource\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"ospf-cost\" : \"ospf-cost\"\r\n }\r\n }\r\n }\r\n}",
- "description": "ospf-cost",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T10:52:25.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "si-local-ipv4-address",
- "resourcePath": "vnf/interface/si-local-ipv4",
- "resourceType": "ATT",
- "dataType": "string",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"si-local-ipv4-address\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/interface/si-local-ipv4\",\r\n \"data-type\" : \"string\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"hostname\" : \"hostname\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"si-local-ipv4\" : \"si-local-ipv4\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"network-resource-discovery\" : {\r\n \"names\" : [ \"hostname\" ]\r\n }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T10:52:25.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "tacacs-server-ipv4-addresses",
- "resourcePath": "vnf/servers/tacacs-server-ipv4-addresses",
- "resourceType": "ATT",
- "dataType": "list",
- "entrySchema": "dt-tacacs-server-ipv4-addresses",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"tacacs-server-ipv4-addresses\",\r\n \"description\" : \"to be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/servers/tacacs-server-ipv4-addresses\",\r\n \"data-type\" : \"list\",\r\n \"entry-schema\" : \"dt-tacacs-server-ipv4-addresses\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"region\" : \"region\",\r\n \"complex-code-char8\" : \"complex-code-char8\",\r\n \"tacacs-domain-name\" : \"tacacs-domain-name\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"tacacs-server-ipv4-addresses\" : \"tacacs-server-ipv4-addresses\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"network-resource-discovery\" : {\r\n \"names\" : [ \"region\", \"complex-code-char8\", \"tacacs-domain-name\" ]\r\n }\r\n }\r\n}",
- "description": "to be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T17:31:43.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "uplink-1-unit",
- "resourcePath": "vnf/interface/uplink-1-unit",
- "resourceType": "ATT",
- "dataType": "string",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"uplink-1-unit\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/interface/uplink-1-unit\",\r\n \"data-type\" : \"string\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"hostname\" : \"hostname\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"uplink-1-unit\" : \"uplink-1-unit\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"network-resource-discovery\" : {\r\n \"names\" : [ \"hostname\" ]\r\n }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T17:31:44.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "uplink-2-unit",
- "resourcePath": "vnf/interface/uplink-2-unit",
- "resourceType": "ATT",
- "dataType": "string",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"uplink-2-unit\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/interface/uplink-2-unit\",\r\n \"data-type\" : \"string\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"network-resource-discovery\" : {\r\n \"input-key-mapping\" : {\r\n \"hostname\" : \"hostname\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"uplink-2-unit\" : \"uplink-2-unit\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"network-resource-discovery\" : {\r\n \"names\" : [ \"hostname\" ]\r\n }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T17:31:45.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "wan-aggregate-ipv4-addresses",
- "resourcePath": "vnf/wan-aggregate-ipv4-addresses",
- "resourceType": "ATT",
- "dataType": "list",
- "entrySchema": "dt-v4-aggregate",
- "definition": "{\r\n \"tags\" : \"wan-aggregate-ipv4-addresses, tosca.datatypes.Root, data_type, ks220y@att.com\",\r\n \"name\" : \"wan-aggregate-ipv4-addresses\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/wan-aggregate-ipv4-addresses\",\r\n \"data-type\" : \"list\",\r\n \"entry-schema\" : \"dt-v4-aggregate\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"mdsal\" : {\r\n \"base\" : \"sdnc-gc\",\r\n \"type\" : \"JSON\",\r\n \"url-path\" : \"/restconf/config/L3VNF-API\",\r\n \"path\" : \"/${services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$oam-ipv4-ip-type/vm-networks/$oam-network-role/v4-assigned-ip-list/$oam-vm-type\",\r\n \"input-key-mapping\" : {\r\n \"service-instance-id\" : \"service-instance-id\",\r\n \"oam-network-role\" : \"oam-network-role\",\r\n \"oam-ipv4-ip-type\" : \"oam-ipv4-ip-type\",\r\n \"oam-vm-type\" : \"oam-vm-type\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"wan-aggregate-ipv4-addresses\" : \"v4-ip-prefix-length\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"mdsal\" : {\r\n \"names\" : [ \"service-instance-id\", \"oam-network-role\", \"oam-v4-ip-type \", \"oam-vm-type\" ]\r\n }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "wan-aggregate-ipv4-addresses, tosca.datatypes.Root, data_type, ks220y@att.com",
- "creationDate": "2017-11-16T17:31:45.000+0000",
- "updatedBy": "ks220y@att.com"
- },
- {
- "name": "wan-aggregate-ipv6-addresses",
- "resourcePath": "vnf/wan-aggregate-ipv6-addresses",
- "resourceType": "ATT",
- "dataType": "list",
- "entrySchema": "dt-v6-aggregate",
- "definition": "{\r\n \"tags\" : \"ADIOD3\",\r\n \"name\" : \"wan-aggregate-ipv6-addresses\",\r\n \"description\" : \"To be provided\",\r\n \"updated-by\" : \"ks220y@att.com\",\r\n \"resource-type\" : \"ATT\",\r\n \"resource-path\" : \"vnf/wan-aggregate-ipv6-addresses\",\r\n \"data-type\" : \"list\",\r\n \"entry-schema\" : \"dt-v6-aggregate\",\r\n \"source\" : {\r\n \"input\" : { },\r\n \"mdsal\" : {\r\n \"base\" : \"sdnc-gc\",\r\n \"type\" : \"JSON\",\r\n \"url-path\" : \"/restconf/config/L3VNF-API\",\r\n \"path\" : \"/${services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/VCO\",\r\n \"input-key-mapping\" : {\r\n \"service-instance-id\" : \"service-instance-id\",\r\n \"oam-network-role\" : \"oam-network-role\",\r\n \"oam-ipv4-ip-type\" : \"oam-ipv4-ip-type\",\r\n \"oam-vm-type\" : \"oam-vm-type\"\r\n },\r\n \"output-key-mapping\" : {\r\n \"wan-aggregate-ipv6.addresses\" : \"v4-ip-prefix-length\"\r\n }\r\n }\r\n },\r\n \"candidate-dependency\" : {\r\n \"mdsal\" : {\r\n \"names\" : [ \"service-instance-id\", \"oam-network-role\", \"oam-v4-ip-type \", \"oam-vm-type\" ]\r\n }\r\n }\r\n}",
- "description": "To be provided",
- "tags": "ADIOD3",
- "creationDate": "2017-11-16T17:31:46.000+0000",
- "updatedBy": "ks220y@att.com"
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/input-complex.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/input-complex.json deleted file mode 100644 index 70865015c..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/input-complex.json +++ /dev/null @@ -1,49 +0,0 @@ -{
- "request-id": "1234",
- "service-instance-id": "adsfdsf",
- "action-name": "resource-assignment-action",
- "scope-type": "vnf-type",
- "hostname": "sample-host",
- "resource-assignment-request": {
- "uplink-2-unit": "sample-uplink-2-unit",
- "bundle-mac": "sample-bundle-mac",
- "wan-aggregate-ipv6-addresses": [
- {
- "v6-address": "sample-v6-address",
- "v6-plen": "sample-v6-plen"
- }
- ],
- "ospf-area": "sample-ospf-area",
- "ospf-cost": 10.0,
- "bundle-id": "bundle-id",
- "adiod-unicast-route-reflectors": [
- {
- "v4-address": "sample-v4-address",
- "name": "sample-name"
- }
- ],
- "oam-remote-ipv4-address": "",
- "adiod-vpnv4-route-reflectors": [
- {
- "v4-address": "sample-v4-address",
- "name": "sample-name"
- }
- ],
- "lo10-local-ipv4-address": "sample-lo10-local-ipv4-address",
- "wan-aggregate-ipv4-addresses": [
- {
- "v4-address": "sample-v4-address",
- "v4-plen": 0
- }
- ],
- "lo0-local-ipv4-address": "sample-lo0-local-ipv4-address",
- "uplink-1-unit": "sample-uplink-1-unit",
- "tacacs-server-ipv4-addresses": [
- {
- "tacacs-server-ipv4-address": "sample-tacacs-server-ipv4-address"
- }
- ],
- "asn-region": "sample-asn-region",
- "si-local-ipv4-address": "sample-si-local-ipv4-address"
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/velocity/base-config-template.vtl b/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/velocity/base-config-template.vtl deleted file mode 100644 index 92dba1024..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/velocity/base-config-template.vtl +++ /dev/null @@ -1,40 +0,0 @@ - <config>
- <configuration>
- <groups>
- <name>${group-name}</name>
- <routing-instances>
- <instance>
- <name><*></name>
- <protocols>
- <pim>
- <dense-groups>
- <dynamic-reject />
- <pim-dense-group-type>
- <name>224.0.1.40/32</name>
- </pim-dense-group-type>
- <pim-dense-group-type>
- <name>224.0.1.39/32</name>
- </pim-dense-group-type>
- <pim-dense-group-type>
- <name>224.0.0.0/4</name>
- <reject />
- </pim-dense-group-type>
- </dense-groups>
- <rp>
- <auto-rp>
- <discovery />
- </auto-rp>
- </rp>
- <interface>
- <name><*></name>
- <disable />
- <priority>1000</priority>
- </interface>
- <reset-tracking-bit />
- </pim>
- </protocols>
- </instance>
- </routing-instances>
- </groups>
- </configuration>
- </config>
\ No newline at end of file diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/vpe-201802-baseconfig.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/vpe-201802-baseconfig.json deleted file mode 100644 index 7113b70c2..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/service_templates/vpe-201802-baseconfig/vpe-201802-baseconfig.json +++ /dev/null @@ -1,639 +0,0 @@ -{
- "metadata": {
- "author": "ks220y@att.com",
- "service-template-name": "vpe-201802-baseconfig",
- "service-template-version": "1.0.0",
- "release": "1802",
- "service-type": "ADIOD",
- "vnf-type": "VPE"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "required": true,
- "type": "string"
- },
- "resource-assignment-request": {
- "description": "This is Dynamic Data type for the receipe resource-assignment-action.",
- "required": false,
- "type": "dt-resource-assignment-request"
- }
- },
- "node_templates": {
- "base-config-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://base-config-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "wan-aggregate-ipv6-addresses",
- "input-param": true,
- "property": {
- "type": "list",
- "entry_schema": {
- "type": "dt-v6-aggregate"
- }
- },
- "dictionary-name": "wan-aggregate-ipv6-addresses",
- "dictionary-source": "input"
- },
- {
- "name": "wan-aggregate-ipv4-addresses",
- "input-param": true,
- "property": {
- "type": "list",
- "entry_schema": {
- "type": "dt-v4-aggregate"
- }
- },
- "dictionary-name": "wan-aggregate-ipv4-addresses",
- "dictionary-source": "input"
- },
- {
- "name": "tacacs-server-ipv4-addresses",
- "input-param": true,
- "property": {
- "type": "list",
- "entry_schema": {
- "type": "dt-tacacs-server-ipv4"
- }
- },
- "dictionary-name": "tacacs-server-ipv4-addresses",
- "dictionary-source": "input"
- },
- {
- "name": "oam-remote-ipv4-address",
- "property": {
- "type": "string"
- },
- "dictionary-name": "oam-remote-ipv4-address",
- "dictionary-source": "input"
- },
- {
- "name": "si-local-ipv4-address",
- "property": {
- "type": "string"
- },
- "dictionary-name": "si-local-ipv4-address",
- "dictionary-source": "input"
- },
- {
- "name": "lo0-local-ipv4-address",
- "property": {
- "type": "string"
- },
- "dictionary-name": "lo0-local-ipv4-address",
- "dictionary-source": "input"
- },
- {
- "name": "asn-region",
- "property": {
- "type": "string"
- },
- "dictionary-name": "asn-region",
- "dictionary-source": "input"
- },
- {
- "name": "adiod-unicast-route-reflectors",
- "input-param": true,
- "property": {
- "type": "list",
- "entry_schema": {
- "type": "dt-adiod-unicast-route-reflector"
- }
- },
- "dictionary-name": "adiod-unicast-route-reflectors",
- "dictionary-source": "input"
- },
- {
- "name": "adiod-vpnv4-route-reflectors",
- "input-param": true,
- "property": {
- "type": "list",
- "entry_schema": {
- "type": "dt-adiod-vpnv4-route-reflector"
- }
- },
- "dictionary-name": "adiod-vpnv4-route-reflectors",
- "dictionary-source": "input"
- },
- {
- "name": "bundle-id",
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "input"
- },
- {
- "name": "uplink-1-unit",
- "property": {
- "type": "string"
- },
- "dictionary-name": "uplink-1-unit",
- "dictionary-source": "input"
- },
- {
- "name": "uplink-2-unit",
- "property": {
- "type": "string"
- },
- "dictionary-name": "uplink-2-unit",
- "dictionary-source": "input"
- },
- {
- "name": "ospf-area",
- "property": {
- "type": "string"
- },
- "dictionary-name": "ospf-area",
- "dictionary-source": "input"
- },
- {
- "name": "ospf-cost",
- "property": {
- "type": "string"
- },
- "dictionary-name": "ospf-cost",
- "dictionary-source": "input"
- },
- {
- "name": "lo10-local-ipv4-address",
- "property": {
- "type": "string"
- },
- "dictionary-name": "lo10-local-ipv4-address",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment-action": {
- "type": "dg-resource-assignment",
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
-
- }
- }
- }
- },
- "capabilities": {
- "dg-node": {
-
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- }
- },
- "resource-assignment": {
- "type": "component-resource-assignment",
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "resource-type": "vnf-type",
- "template-names": [
- "base-config-template",
- "licence-template"
- ],
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"hostname\" }"
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- }
- }
- },
- "node_types": {
- "dg-resource-assignment": {
- "description": "This is Resource Assignment Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": "false"
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.DG"
- },
- "component-resource-assignment": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": {
- "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "handler-name": {
- "description": "Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
- "required": true,
- "type": "string"
- },
- "resource-type": {
- "required": false,
- "type": "string"
- },
- "template-names": {
- "description": "Name of the Artifact Node Templates, to get the template Content.",
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- },
- "resource-id": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "resource-assignment-params": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "artifact-config-template": {
- "description": "This is Configuration Velocity Template",
- "version": "1.0.0",
- "properties": {
- "action-names": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "capabilities": {
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "content": {
- "required": true,
- "type": "string"
- }
- }
- },
- "mapping": {
- "type": "tosca.capabilities.Mapping",
- "properties": {
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Artifact"
- }
- },
- "data_types": {
- "dt-v4-aggregate": {
- "version": "1.0.0",
- "description": "This is dt-v4-aggregate Data Type",
- "properties": {
- "v4-address": {
- "required": true,
- "type": "string"
- },
- "v4-plen": {
- "required": false,
- "type": "integer"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "dt-tacacs-server-ipv4": {
- "version": "1.0.0",
- "description": "This is dt-tacacs-server-ipv4 Data Type",
- "properties": {
- "tacacs-server-ipv4-address": {
- "required": true,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "dt-adiod-vpnv4-route-reflector": {
- "version": "1.0.0",
- "description": "This is dt-adiod-unicast-route-reflector Data Type",
- "properties": {
- "v4-address": {
- "required": true,
- "type": "string"
- },
- "name": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "datatype-resource-assignment": {
- "version": "1.0.0",
- "description": "This is Resource Assignment Data Type",
- "properties": {
- "property": {
- "required": true,
- "type": "datatype-property"
- },
- "input-param": {
- "required": true,
- "type": "boolean"
- },
- "dictionary-name": {
- "required": false,
- "type": "string"
- },
- "dictionary-source": {
- "required": false,
- "type": "string"
- },
- "dependencies": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "status": {
- "required": false,
- "type": "string"
- },
- "message": {
- "required": false,
- "type": "string"
- },
- "updated-date": {
- "required": false,
- "type": "string"
- },
- "updated-by": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "dt-adiod-unicast-route-reflector": {
- "version": "1.0.0",
- "description": "This is dt-adiod-unicast-route-reflector Data Type",
- "properties": {
- "v4-address": {
- "required": true,
- "type": "string"
- },
- "name": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "datatype-property": {
- "version": "1.0.0",
- "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
- "properties": {
- "type": {
- "required": true,
- "type": "string"
- },
- "description": {
- "required": false,
- "type": "string"
- },
- "required": {
- "required": false,
- "type": "boolean"
- },
- "default": {
- "required": false,
- "type": "string"
- },
- "entry_schema": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "dt-v6-aggregate": {
- "version": "1.0.0",
- "description": "This is dt-v6-aggregate Data Type",
- "properties": {
- "v6-address": {
- "required": true,
- "type": "string"
- },
- "v6-plen": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "dt-resource-assignment-request": {
- "version": "1.0.0",
- "description": "This is Dynamic Data type definition generated from resource mapping for the config template name base-config-template.",
- "properties": {
- "uplink-2-unit": {
- "type": "string"
- },
- "bundle-mac": {
- "required": true,
- "type": "string"
- },
- "wan-aggregate-ipv6-addresses": {
- "type": "list",
- "entry_schema": {
- "type": "dt-v6-aggregate"
- }
- },
- "ospf-area": {
- "type": "string"
- },
- "ospf-cost": {
- "type": "string"
- },
- "bundle-id": {
- "type": "string"
- },
- "adiod-unicast-route-reflectors": {
- "type": "list",
- "entry_schema": {
- "type": "dt-adiod-unicast-route-reflector"
- }
- },
- "oam-remote-ipv4-address": {
- "type": "string"
- },
- "adiod-vpnv4-route-reflectors": {
- "type": "list",
- "entry_schema": {
- "type": "dt-adiod-vpnv4-route-reflector"
- }
- },
- "lo10-local-ipv4-address": {
- "type": "string"
- },
- "wan-aggregate-ipv4-addresses": {
- "type": "list",
- "entry_schema": {
- "type": "dt-v4-aggregate"
- }
- },
- "lo0-local-ipv4-address": {
- "type": "string"
- },
- "uplink-1-unit": {
- "type": "string"
- },
- "tacacs-server-ipv4-addresses": {
- "type": "list",
- "entry_schema": {
- "type": "dt-tacacs-server-ipv4"
- }
- },
- "asn-region": {
- "type": "string"
- },
- "si-local-ipv4-address": {
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Dynamic"
- }
- }
-}
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/validation/cyclic.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/validation/cyclic.json deleted file mode 100644 index fc6357f2d..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/validation/cyclic.json +++ /dev/null @@ -1,111 +0,0 @@ -[
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "service-instance-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "service-instance-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-ip",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id",
- "bundle-id"
- ]
- },
- {
- "name": "managed-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip",
- "dictionary-source": "mdsal",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "vnf-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-name",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "managed-ip1",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "loopback-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "loopback-ip",
- "dictionary-source": "db",
- "dependencies": [
- "bundle-mac",
- "managed-ip1"
- ]
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/validation/duplicate.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/validation/duplicate.json deleted file mode 100644 index 86909a6a4..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/validation/duplicate.json +++ /dev/null @@ -1,110 +0,0 @@ -[
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "service-instance-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "service-instance-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-ip",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id",
- "bundle-id"
- ]
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "vnf-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-name",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "managed-ip1",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "loopback-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "loopback-ip",
- "dictionary-source": "db",
- "dependencies": [
- "bundle-mac"
- ]
- }
-]
diff --git a/blueprints-processor/plugin/assignment-provider/src/test/resources/validation/success.json b/blueprints-processor/plugin/assignment-provider/src/test/resources/validation/success.json deleted file mode 100644 index e08539c0d..000000000 --- a/blueprints-processor/plugin/assignment-provider/src/test/resources/validation/success.json +++ /dev/null @@ -1,110 +0,0 @@ -[
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "service-instance-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "service-instance-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-ip",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
- "dependencies": [
- "vnf-id",
- "bundle-id"
- ]
- },
- {
- "name": "managed-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip",
- "dictionary-source": "mdsal",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "vnf-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-name",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "managed-ip1",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "loopback-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "loopback-ip",
- "dictionary-source": "db",
- "dependencies": [
- "bundle-mac"
- ]
- }
-]
diff --git a/blueprints-processor/plugin/generator-provider/pom.xml b/blueprints-processor/plugin/generator-provider/pom.xml deleted file mode 100644 index d2a700b45..000000000 --- a/blueprints-processor/plugin/generator-provider/pom.xml +++ /dev/null @@ -1,141 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright © 2017-2018 AT&T Intellectual Property. - Modifications Copyright © 2018 IBM. - - 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>binding-parent</artifactId> - <version>1.5.2-SNAPSHOT</version> - <relativePath/> - </parent> - - <groupId>org.onap.ccsdk.features</groupId> - <artifactId>blueprints-generator-provider</artifactId> - <version>0.7.1-SNAPSHOT</version> - <packaging>bundle</packaging> - - <name>ccsdk-features :: blueprints-processor-plugin :: ${project.artifactId}</name> - <url>http://maven.apache.org</url> - - <dependencies> - <dependency> - <groupId>org.onap.ccsdk.features</groupId> - <artifactId>blueprints-model-provider</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.features</groupId> - <artifactId>blueprints-data-adaptor-provider</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-jsonSchema</artifactId> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - <dependency> - <groupId>org.apache.velocity</groupId> - <artifactId>velocity</artifactId> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.javassist</groupId> - <artifactId>javassist</artifactId> - <version>3.21.0-GA</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>1.10.19</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-module-junit4</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-support</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-reflect</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-core</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Bundle-Name>${project.artifactId}</Bundle-Name> - <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName> - <Export-Package> - org.onap.ccsdk.features.generator, - org.onap.ccsdk.features.generator.data, - org.onap.ccsdk.features.generator.service, - org.onap.ccsdk.features.generator.tool - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/ConfigGeneratorConstant.java b/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/ConfigGeneratorConstant.java deleted file mode 100644 index 06c423b5e..000000000 --- a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/ConfigGeneratorConstant.java +++ /dev/null @@ -1,49 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.generator;
-
-public class ConfigGeneratorConstant {
-
- private ConfigGeneratorConstant() {
-
- }
-
- public static final String STRING_ENCODING = "utf-8";
- public static final String Y = "Y";
- public static final String N = "N";
- public static final String DATA_TYPE_TEXT = "TEXT";
- public static final String DATA_TYPE_JSON = "JSON";
- public static final String DATA_TYPE_XML = "XML";
- public static final String DATA_TYPE_SQL = "SQL";
-
- public static final String INPUT_PARAM_REQUEST_ID = "request-id";
- public static final String INPUT_PARAM_RESOURCE_ID = "resource-id";
- public static final String INPUT_PARAM_RESOURCE_TYPE = "resource-type";
- public static final String INPUT_PARAM_ACTION_NAME = "action-name";
- public static final String INPUT_PARAM_TEMPLATE_NAME = "template-name";
- public static final String INPUT_PARAM_TEMPLATE_CONTENT = "template-content";
- public static final String INPUT_PARAM_TEMPLATE_DATA = "template-data";
-
- public static final String OUTPUT_PARAM_GENERATED_CONFIG = "generated-config";
- public static final String OUTPUT_PARAM_MASK_INFO = "mask-info";
- public static final String OUTPUT_PARAM_STATUS = "status";
- public static final String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
- public static final String OUTPUT_STATUS_SUCCESS = "success";
- public static final String OUTPUT_STATUS_FAILURE = "failure";
-
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/data/ConfigGeneratorInfo.java b/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/data/ConfigGeneratorInfo.java deleted file mode 100644 index 0b7ea0435..000000000 --- a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/data/ConfigGeneratorInfo.java +++ /dev/null @@ -1,102 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.generator.data;
-
-public class ConfigGeneratorInfo {
-
- private String requestId;
- private String resourceId;
- private String resourceType;
- private String templateName;
- private String recipeName;
- private String resourceData;
- private String templateContent;
- private String mashedData;
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public String getResourceType() {
- return resourceType;
- }
-
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
- }
-
- public String getTemplateName() {
- return templateName;
- }
-
- public void setTemplateName(String templateName) {
- this.templateName = templateName;
- }
-
- public String getRecipeName() {
- return recipeName;
- }
-
- public void setRecipeName(String recipeName) {
- this.recipeName = recipeName;
- }
-
- public String getResourceData() {
- return resourceData;
- }
-
- public void setResourceData(String resourceData) {
- this.resourceData = resourceData;
- }
-
- public String getTemplateContent() {
- return templateContent;
- }
-
- public void setTemplateContent(String templateContent) {
- this.templateContent = templateContent;
- }
-
- public String getMashedData() {
- return mashedData;
- }
-
- public void setMashedData(String mashedData) {
- this.mashedData = mashedData;
- }
-
- @Override
- public String toString() {
- return "ConfigGeneratorInfo [requestId=" + requestId + ", resourceId=" + resourceId + ", resourceType="
- + resourceType + ", templateName=" + templateName + ", recipeName=" + recipeName + ", resourceData="
- + resourceData + ", templateContent=" + templateContent + ", mashedData=" + mashedData + "]";
- }
-
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorNode.java b/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorNode.java deleted file mode 100644 index 421692b89..000000000 --- a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorNode.java +++ /dev/null @@ -1,140 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.generator.service;
-
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.generator.ConfigGeneratorConstant;
-import org.onap.ccsdk.features.generator.data.ConfigGeneratorInfo;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.service.ComponentNode;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigGeneratorNode implements ComponentNode {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigGeneratorNode.class);
-
- private ConfigModelService configModelService;
- private ConfigResourceService configResourceService;
- private ConfigGeneratorService configGeneratorService;
-
- public ConfigGeneratorNode(ConfigResourceService configResourceService, ConfigModelService configModelService) {
- this.configResourceService = configResourceService;
- this.configModelService = configModelService;
- this.configGeneratorService = new ConfigGeneratorServiceImpl(this.configResourceService);
- }
-
- @Override
- public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.trace("Received generateConfiguration preCondition call with params : ({})", inParams);
- return Boolean.TRUE;
- }
-
- @Override
- public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.trace("Received generateConfiguration preProcess call with params : ({})", inParams);
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
- logger.trace("Received generateConfiguration process call with params : ({})", inParams);
- }
-
- @SuppressWarnings("squid:S3776")
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.trace("Received generateConfiguration process with params : ({})", inParams);
- String prifix = inParams.get(ConfigModelConstant.PROPERTY_SELECTOR);
- try {
- prifix = StringUtils.isNotBlank(prifix) ? (prifix + ".") : "";
-
- String templateContent = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_CONTENT);
- String templateData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA);
- String requestId = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_REQUEST_ID);
- String resourceId = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESOURCE_ID);
- String resourceType = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESOURCE_TYPE);
- String recipeName = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_ACTION_NAME);
- String templateName = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_NAME);
-
- ConfigGeneratorInfo configGeneratorInfo = null;
- if (StringUtils.isNotBlank(templateContent) && StringUtils.isNotBlank(templateData)) {
- configGeneratorInfo = this.configGeneratorService.generateConfiguration(templateContent, templateData);
- } else {
- if (StringUtils.isBlank(requestId)) {
- throw new SvcLogicException("Config Generator Request Id is missing.");
- }
- if (StringUtils.isBlank(resourceId)) {
- throw new SvcLogicException("Config Generator Resource Id is missing.");
- }
- if (StringUtils.isBlank(resourceType)) {
- throw new SvcLogicException("Config Generator Resource Type is missing.");
- }
- if (StringUtils.isBlank(recipeName)) {
- throw new SvcLogicException("Config Generator Action Name is missing.");
- }
- if (StringUtils.isBlank(templateName)) {
- throw new SvcLogicException("Config Generator Template Name Id is missing.");
- }
-
- templateContent = configModelService.getNodeTemplateContent(ctx, templateName);
-
- if (StringUtils.isBlank(templateContent)) {
- throw new SvcLogicException(
- "Failed to get the Template Content for the Temaple Name :" + templateName);
- }
-
- configGeneratorInfo = new ConfigGeneratorInfo();
- configGeneratorInfo.setRequestId(requestId);
- configGeneratorInfo.setResourceId(resourceId);
- configGeneratorInfo.setResourceType(resourceType);
- configGeneratorInfo.setRecipeName(recipeName);
- configGeneratorInfo.setTemplateName(templateName);
- configGeneratorInfo.setTemplateContent(templateContent);
-
- this.configGeneratorService.generateConfiguration(configGeneratorInfo);
- }
- if (configGeneratorInfo != null) {
- ctx.setAttribute(prifix + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG,
- configGeneratorInfo.getMashedData());
- }
- ctx.setAttribute(prifix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS,
- ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
- } catch (Exception e) {
- ctx.setAttribute(prifix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS,
- ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
- ctx.setAttribute(prifix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
- logger.error("Failed in generateConfiguration ({})", e);
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @Override
- public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.info("Received generateConfiguration postProcess with params : ({})", inParams);
- }
-
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorService.java b/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorService.java deleted file mode 100644 index b8a943083..000000000 --- a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorService.java +++ /dev/null @@ -1,33 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.generator.service;
-
-import org.onap.ccsdk.features.generator.data.ConfigGeneratorInfo;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public interface ConfigGeneratorService {
-
- public ConfigGeneratorInfo generateConfiguration(String templateContent, String templateData)
- throws SvcLogicException;
-
- public ConfigGeneratorInfo generateConfiguration(String templateContent, String templateData, boolean ignoreNull)
- throws SvcLogicException;
-
- public ConfigGeneratorInfo generateConfiguration(ConfigGeneratorInfo configGeneratorInfo) throws SvcLogicException;
-
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorServiceImpl.java b/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorServiceImpl.java deleted file mode 100644 index 6292b8def..000000000 --- a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorServiceImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.generator.service;
-
-import java.io.StringWriter;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.generator.data.ConfigGeneratorInfo;
-import org.onap.ccsdk.features.generator.tool.CustomJsonNodeFactory;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ConfigGeneratorServiceImpl implements ConfigGeneratorService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigGeneratorServiceImpl.class);
- private static final String CLASS_NAME = "ConfigGeneratorServiceImpl";
-
- private ConfigResourceService configResourceService;
-
- public ConfigGeneratorServiceImpl(ConfigResourceService configResourceService) {
- logger.info("{} Constuctor Initated...", CLASS_NAME);
- this.configResourceService = configResourceService;
- }
-
- @Override
- public ConfigGeneratorInfo generateConfiguration(ConfigGeneratorInfo configGeneratorInfo) throws SvcLogicException {
-
- if (configGeneratorInfo != null && StringUtils.isNotBlank(configGeneratorInfo.getResourceId())
- && StringUtils.isNotBlank(configGeneratorInfo.getResourceType())
- && StringUtils.isNotBlank(configGeneratorInfo.getRecipeName())
- && StringUtils.isNotBlank(configGeneratorInfo.getTemplateName())
- && StringUtils.isNotBlank(configGeneratorInfo.getTemplateContent())) {
-
- ConfigResource configResourceQuery = new ConfigResource();
- configResourceQuery.setResourceId(configGeneratorInfo.getResourceId());
- configResourceQuery.setResourceType(configGeneratorInfo.getResourceType());
- configResourceQuery.setTemplateName(configGeneratorInfo.getTemplateName());
-
- List<ConfigResource> configResourceList = configResourceService.getConfigResource(configResourceQuery);
-
- if (CollectionUtils.isEmpty(configResourceList)) {
- throw new SvcLogicException("No Config Resource found");
- } else if (configResourceList.size() > 1) {
- throw new SvcLogicException("More than one Config Resource found for specified parameter for"
- + " resourceId " + configGeneratorInfo.getResourceId() + ", resourceType "
- + configGeneratorInfo.getResourceType() + ", recipeName " + configGeneratorInfo.getRecipeName()
- + ", templateName " + configGeneratorInfo.getTemplateName());
- }
-
- ConfigResource configResource = configResourceList.get(0);
-
- if (configResource != null && StringUtils.isNotBlank(configResource.getResourceData())) {
- configGeneratorInfo.setResourceData(configResource.getResourceData());
- logger.debug("Retrieve ConfigResource Data : ({})", configResource.getResourceData());
- ConfigGeneratorInfo generatorInfo = generateConfiguration(configGeneratorInfo.getTemplateContent(),
- configResource.getResourceData());
- if (generatorInfo != null) {
- configGeneratorInfo.setMashedData(generatorInfo.getMashedData());
- }
- } else {
- throw new SvcLogicException(
- "Failed to get the Resource Data for the Resource Id :" + configGeneratorInfo.getResourceId()
- + " of template :" + configGeneratorInfo.getTemplateName());
- }
- }
- return configGeneratorInfo;
- }
-
- @Override
- public ConfigGeneratorInfo generateConfiguration(String templateContent, String templateData)
- throws SvcLogicException {
- return generateConfiguration(templateContent, templateData, true);
- }
-
- @Override
- public ConfigGeneratorInfo generateConfiguration(String templateContent, String templateData, boolean ignoreNull)
- throws SvcLogicException {
- ConfigGeneratorInfo configGeneratorInfo = null;
- try {
- if (StringUtils.isNotBlank(templateContent) && StringUtils.isNotBlank(templateData)) {
- configGeneratorInfo = new ConfigGeneratorInfo();
-
- Velocity.init();
-
- ObjectMapper mapper = new ObjectMapper();
- CustomJsonNodeFactory f = new CustomJsonNodeFactory();
- mapper.setNodeFactory(f);
-
- JsonNode jsonObj = mapper.readValue(templateData, JsonNode.class);
- if (ignoreNull) {
- TransformationUtils.removeJsonNullNode(jsonObj);
- }
-
- VelocityContext context = new VelocityContext();
- context.put("StringUtils", org.apache.commons.lang3.StringUtils.class);
- context.put("BooleanUtils", org.apache.commons.lang3.BooleanUtils.class);
-
- Iterator<String> ii = jsonObj.fieldNames();
- while (ii.hasNext()) {
- String key = ii.next();
- JsonNode node = jsonObj.get(key);
- logger.info("Adding key ({}) with value ({})", key, node);
- context.put(key, node);
- }
-
- StringWriter writer = new StringWriter();
- Velocity.evaluate(context, writer, "TemplateData", templateContent);
- writer.flush();
- configGeneratorInfo.setMashedData(writer.toString());
- }
- } catch (Exception e) {
- logger.error("Failed to generate Configuration ({})", e.getMessage());
- throw new SvcLogicException(e.getMessage(), e);
- }
- return configGeneratorInfo;
- }
-
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/tool/CustomJsonNodeFactory.java b/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/tool/CustomJsonNodeFactory.java deleted file mode 100644 index f20cef2a6..000000000 --- a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/tool/CustomJsonNodeFactory.java +++ /dev/null @@ -1,30 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.generator.tool;
-
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.TextNode;
-
-public class CustomJsonNodeFactory extends JsonNodeFactory {
-
- @Override
- public TextNode textNode(String text) {
- return new CustomTextNode(text);
- }
-
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/tool/CustomTextNode.java b/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/tool/CustomTextNode.java deleted file mode 100644 index 1a62dd6a9..000000000 --- a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/tool/CustomTextNode.java +++ /dev/null @@ -1,42 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.generator.tool;
-
-import com.fasterxml.jackson.core.io.CharTypes;
-import com.fasterxml.jackson.databind.node.TextNode;
-
-public class CustomTextNode extends TextNode {
-
- public CustomTextNode(String v) {
- super(v);
- }
-
- @Override
- public String toString() {
- int len = textValue().length();
- len = len + 2 + (len >> 4);
- StringBuilder sb = new StringBuilder(len);
- appendQuoted(sb, textValue());
- return sb.toString();
- }
-
- protected static void appendQuoted(StringBuilder sb, String content) {
- CharTypes.appendQuoted(sb, content);
- }
-
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/tool/EscapeUtils.java b/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/tool/EscapeUtils.java deleted file mode 100644 index d3246e045..000000000 --- a/blueprints-processor/plugin/generator-provider/src/main/java/org/onap/ccsdk/features/generator/tool/EscapeUtils.java +++ /dev/null @@ -1,82 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.generator.tool;
-
-import org.apache.commons.lang3.StringUtils;
-
-@SuppressWarnings("squid:S1118")
-public class EscapeUtils {
-
- public static String escapeSql(String str) {
- if (str == null) {
- return null;
- }
- String[] searchList = new String[] {"'", "\\"};
- String[] replacementList = new String[] {"''", "\\\\"};
- return StringUtils.replaceEach(str, searchList, replacementList);
- }
-
- // For Generic Purpose
- public static String escapeSequence(String s) {
- if (s == null) {
- return null;
- }
-
- int length = s.length();
- int newLength = length;
- for (int i = 0; i < length; i++) {
- char c = s.charAt(i);
- switch (c) {
- case '\\':
- case '\"':
- case '\'':
- case '\0':
- newLength += 1;
- break;
- default:
- // do nothing
- }
- }
- if (length == newLength) {
- // nothing to escape in the string
- return s;
- }
- StringBuilder sb = new StringBuilder(newLength);
- for (int i = 0; i < length; i++) {
- char c = s.charAt(i);
- switch (c) {
- case '\\':
- sb.append("\\\\");
- break;
- case '\"':
- sb.append("\\\"");
- break;
- case '\'':
- sb.append("\\\'");
- break;
- case '\0':
- sb.append("\\0");
- break;
- default:
- sb.append(c);
- }
- }
- return sb.toString();
- }
-
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/blueprints-processor/plugin/generator-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml deleted file mode 100644 index 78cb28189..000000000 --- a/blueprints-processor/plugin/generator-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- 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.
--->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <reference id="configModelService"
- interface="org.onap.ccsdk.features.model.service.ConfigModelService" />
-
- <reference id="configResourceService"
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />
-
- <!-- Expose the Common Component Bean -->
-
- <bean id="configGeneratorService"
- class="org.onap.ccsdk.features.generator.service.ConfigGeneratorServiceImpl">
- <argument ref="configResourceService" />
- </bean>
-
- <service ref="configGeneratorService"
- interface="org.onap.ccsdk.features.generator.service.ConfigGeneratorService" />
-
- <bean id="configGeneratorNode"
- class="org.onap.ccsdk.features.generator.service.ConfigGeneratorNode">
- <argument ref="configResourceService" />
- <argument ref="configModelService" />
- </bean>
-
- <service ref="configGeneratorNode"
- interface="org.onap.ccsdk.features.generator.service.ConfigGeneratorNode" />
-
-
-</blueprint>
diff --git a/blueprints-processor/plugin/generator-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/blueprints-processor/plugin/generator-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml deleted file mode 100644 index 78cb28189..000000000 --- a/blueprints-processor/plugin/generator-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- 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.
--->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <reference id="configModelService"
- interface="org.onap.ccsdk.features.model.service.ConfigModelService" />
-
- <reference id="configResourceService"
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />
-
- <!-- Expose the Common Component Bean -->
-
- <bean id="configGeneratorService"
- class="org.onap.ccsdk.features.generator.service.ConfigGeneratorServiceImpl">
- <argument ref="configResourceService" />
- </bean>
-
- <service ref="configGeneratorService"
- interface="org.onap.ccsdk.features.generator.service.ConfigGeneratorService" />
-
- <bean id="configGeneratorNode"
- class="org.onap.ccsdk.features.generator.service.ConfigGeneratorNode">
- <argument ref="configResourceService" />
- <argument ref="configModelService" />
- </bean>
-
- <service ref="configGeneratorNode"
- interface="org.onap.ccsdk.features.generator.service.ConfigGeneratorNode" />
-
-
-</blueprint>
diff --git a/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorNodeTest.java b/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorNodeTest.java deleted file mode 100644 index 2054ee681..000000000 --- a/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/features/generator/service/ConfigGeneratorNodeTest.java +++ /dev/null @@ -1,222 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.generator.service;
-
-import static org.mockito.Matchers.any;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.IOUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.stubbing.Answer;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.generator.ConfigGeneratorConstant;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.model.service.ConfigModelServiceImpl;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ConfigGeneratorNodeTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigGeneratorNodeTest.class);
-
- @Mock
- private ConfigResourceService configResourceService;
-
- @Mock
- private ConfigRestAdaptorService configRestAdaptorService;
-
- private ConfigModelService configModelService;
-
- @Before
- public void setUp() throws Exception {
-
- configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
-
- MockitoAnnotations.initMocks(this);
-
- try {
- Mockito.doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- if (args != null) {
- logger.trace("Transaction info " + Arrays.asList(args));
- }
- return null;
- }
- }).when(configResourceService).save(any(TransactionLog.class));
-
- Mockito.doAnswer(new Answer<List<ConfigResource>>() {
- @Override
- public List<ConfigResource> answer(InvocationOnMock invocationOnMock) throws Throwable {
- List<ConfigResource> configResources = new ArrayList<>();
- Object[] args = invocationOnMock.getArguments();
- if (args != null) {
- logger.trace("Transaction info " + Arrays.asList(args));
- String resourceData = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
- .getResourceAsStream("service_templates/configdata.json"), Charset.defaultCharset());
- ConfigResource configResource = (ConfigResource) args[0];
- configResource.setRecipeName("Sample-recipe");
- configResource.setResourceData(resourceData);
- configResources.add(configResource);
- }
- return configResources;
- }
- }).when(configResourceService).getConfigResource(any(ConfigResource.class));
-
- } catch (SvcLogicException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testInputTemplateContentNData() throws Exception {
-
- ConfigGeneratorNode configGeneratorNode = new ConfigGeneratorNode(configResourceService, configModelService);
-
- Map<String, String> inParams = new HashMap<String, String>();
- inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "test");
-
- String jsonData = IOUtils.toString(
- ConfigGeneratorNodeTest.class.getClassLoader().getResourceAsStream("service_templates/configdata.json"),
- Charset.defaultCharset());
- inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA, jsonData);
-
- String templateData = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
- .getResourceAsStream("service_templates/velocity/base-config-template.vtl"), Charset.defaultCharset());
- inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_CONTENT, templateData);
-
- SvcLogicContext ctx = new SvcLogicContext();
- Map<String, Object> componentContext = new HashMap<>();
- configGeneratorNode.process(inParams, ctx, componentContext);
- Assert.assertEquals("Failed to generate Configuration Status as Failure",
- ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS,
- ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));
- Assert.assertNotNull("Failed to generate Configuration",
- ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
-
- logger.trace("Generated Configuration:\n "
- + ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
- logger.trace("Generated Configuration:\n "
- + ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_MASK_INFO));
-
- }
-
- @Test
- public void testInputTemplateWithNullData() throws Exception {
-
- ConfigGeneratorNode configGeneratorNode = new ConfigGeneratorNode(configResourceService, configModelService);
-
- Map<String, String> inParams = new HashMap<String, String>();
- inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "test");
-
- String jsonData = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
- .getResourceAsStream("service_templates/configdata_with_null.json"), Charset.defaultCharset());
- inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA, jsonData);
-
- String templateData = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
- .getResourceAsStream("service_templates/velocity/base-config-template.vtl"), Charset.defaultCharset());
- inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_CONTENT, templateData);
-
- SvcLogicContext ctx = new SvcLogicContext();
- Map<String, Object> componentContext = new HashMap<>();
- configGeneratorNode.process(inParams, ctx, componentContext);
- Assert.assertEquals("Failed to generate Configuration Status as Failure",
- ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS,
- ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));
- Assert.assertNotNull("Failed to generate Configuration",
- ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
-
- logger.trace("Generated Configuration:\n "
- + ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
- logger.trace("Generated Configuration:\n "
- + ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_MASK_INFO));
-
- }
-
- @Test
- public void testDBTemplateContentNData() throws Exception {
-
- String fileContent = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
- .getResourceAsStream("service_templates/generate_configuration.json"), Charset.defaultCharset());
-
- String baseConfigTemplateContent = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
- .getResourceAsStream("service_templates/velocity/base-config-template.vtl"), Charset.defaultCharset());
-
- Map<String, String> context = new HashMap<>();
- context = configModelService.convertServiceTemplate2Properties(fileContent, context);
-
- context.put("node_templates.base-config-template.content", baseConfigTemplateContent);
-
- Assert.assertNotNull("Failed to Prepare Context : ", context);
-
- context.put("request-id", "12345");
- context.put("vnf-id", "vnf12345");
- context.put("action-name", "config-generator-action");
-
- Map<String, String> inparams = new HashMap<String, String>();
- inparams.put(ConfigModelConstant.PROPERTY_SELECTOR, "generate-configuration");
-
- SvcLogicContext inputContext = new SvcLogicContext();
- context.forEach((name, value) -> {
- inputContext.setAttribute(name, value);
- });
-
- TransformationUtils.printMap(context);
- configModelService.assignInParamsFromModel(inputContext, inparams);
- ConfigGeneratorNode configGeneratorNode = new ConfigGeneratorNode(configResourceService, configModelService);
-
- Map<String, Object> componentContext = new HashMap<>();
- configGeneratorNode.process(inparams, inputContext, componentContext);
-
- Assert.assertEquals("Failed to generate Configuration Status as Failure",
- ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS,
- inputContext.getAttribute("generate-configuration." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));
- Assert.assertNotNull("Failed to generate Configuration", inputContext
- .getAttribute("generate-configuration." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
-
- logger.trace("Generated Configuration:\n " + inputContext
- .getAttribute("generate-configuration." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
- }
-
- @Test
- public void testTemplateContentNDataForMask() throws Exception {
-
- }
-
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/features/generator/tool/EscapeUtilsTest.java b/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/features/generator/tool/EscapeUtilsTest.java deleted file mode 100644 index 17dcf7d07..000000000 --- a/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/features/generator/tool/EscapeUtilsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.generator.tool;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class EscapeUtilsTest {
-
- @Test
- public void testEscapeSql() {
- Assert.assertEquals("", EscapeUtils.escapeSql(""));
- Assert.assertEquals("text", EscapeUtils.escapeSql("text"));
-
- Assert.assertEquals("''", EscapeUtils.escapeSql("'"));
- Assert.assertEquals("\\\\", EscapeUtils.escapeSql("\\"));
-
- Assert.assertEquals("text''text", EscapeUtils.escapeSql("text'text"));
- Assert.assertEquals("text\\\\text", EscapeUtils.escapeSql("text\\text"));
- }
-
- @Test
- public void testEscapeSequence() {
- Assert.assertEquals("", EscapeUtils.escapeSequence(""));
- Assert.assertEquals("text", EscapeUtils.escapeSequence("text"));
-
- Assert.assertEquals("\\\'", EscapeUtils.escapeSequence("'"));
- Assert.assertEquals("\\\"", EscapeUtils.escapeSequence("\""));
- Assert.assertEquals("\\\\", EscapeUtils.escapeSequence("\\"));
-
- Assert.assertEquals("text\\\'text", EscapeUtils.escapeSequence("text'text"));
- Assert.assertEquals("text\\\"text", EscapeUtils.escapeSequence("text\"text"));
- Assert.assertEquals("text\\\\text", EscapeUtils.escapeSequence("text\\text"));
- }
-
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata.json b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata.json deleted file mode 100644 index 13d355cbc..000000000 --- a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata.json +++ /dev/null @@ -1,36 +0,0 @@ -{
- "node0_hostname": "appc-host",
- "node0_backup_router_address": "2001:2001:2001:2001:2001:2001:2001:2001",
- "servers": [
- "Server1",
- "Server2",
- "Server3"
- ],
- "tacplus-servers": [
- {
- "tacplus-server-name": "tacplus-server-name1",
- "tacplus-server-source-address": "enc-dsdsasa1"
- },
- {
- "tacplus-server-name": "tacplus-server-name2",
- "tacplus-server-source-address": "enc-dsdsasa2"
- }
- ],
- "classes": [
- {
- "name": "superuser-class",
- "idle-timeout": 5,
- "permissions": "all"
- },
- {
- "name": "tacacs-adv-class",
- "idle-timeout": 5
- },
- {
- "name": "tacacs-base-class",
- "idle-timeout": 5
- }
- ],
- "system-password": "teamops-system-password",
- "root-password": "teamops-root-password"
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata_with_null.json b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata_with_null.json deleted file mode 100644 index d08acb17c..000000000 --- a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata_with_null.json +++ /dev/null @@ -1,36 +0,0 @@ -{
- "node0_hostname": null,
- "node0_backup_router_address": "2001:2001:2001:2001:2001:2001:2001:2001",
- "servers": [
- "Server1",
- "Server2",
- "Server3"
- ],
- "tacplus-servers": [
- {
- "tacplus-server-name": null,
- "tacplus-server-source-address": "enc-dsdsasa1"
- },
- {
- "tacplus-server-name": "tacplus-server-name2",
- "tacplus-server-source-address": "enc-dsdsasa2"
- }
- ],
- "classes": [
- {
- "name": "superuser-class",
- "idle-timeout": 5,
- "permissions": "all"
- },
- {
- "name": "tacacs-adv-class",
- "idle-timeout": 5
- },
- {
- "name": "tacacs-base-class",
- "idle-timeout": 5
- }
- ],
- "system-password": "teamops-system-password",
- "root-password": "teamops-root-password"
-}
\ No newline at end of file diff --git a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/generate_configuration.json b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/generate_configuration.json deleted file mode 100644 index 326d2e8ec..000000000 --- a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/generate_configuration.json +++ /dev/null @@ -1,355 +0,0 @@ -{
- "metadata": {
- "author": "ks220y@att.com",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "service-type": "AVPN",
- "vnf-type": "VRR",
- "action": "Base Configuration",
- "sub-action": "Generate Configuration"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "vnf-id": {
- "required": true,
- "type": "string"
- }
- },
- "node_templates": {
- "base-config-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://base-config-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "mdsal"
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "db"
- }
- ]
- }
- }
- }
- },
- "generate-configuration": {
- "type": "component-config-generator",
- "interfaces": {
- "org-onap-ccsdk-features-generator-service-ConfigGeneratorNode": {
- "operations": {
- "process": {
- "inputs": {
- "resource-type": "vnf-type",
- "request-id": "{ \"get_attribute\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"vnf-id\" }",
- "action-name": "{ \"get_attribute\" : \"action-name\" }",
- "template-name": "base-config-template"
- },
- "outputs": {
- "generated-config": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- },
- "config-generator-action": {
- "type": "dg-config-generator",
- "interfaces": {
- "CONFIG": {
- "operations": {
- "GenerateConfiguration": {
-
- }
- }
- }
- },
- "capabilities": {
- "dg-node": {
-
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "generate-configuration",
- "relationship": "tosca.relationships.DependsOn"
- }
- }
- }
- }
- },
- "node_types": {
- "artifact-config-template": {
- "description": "This is Configuration Velocity Template",
- "version": "1.0.0",
- "properties": {
- "action-names": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "capabilities": {
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "content": {
- "required": true,
- "type": "string"
- }
- }
- },
- "mapping": {
- "type": "tosca.capabilities.Mapping",
- "properties": {
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Artifact"
- },
- "component-config-generator": {
- "description": "This is Generate Configuration Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-onap-ccsdk-features-generator-service-ConfigGeneratorNode": {
- "operations": {
- "process": {
- "inputs": {
- "template-data": {
- "description": "Conditional : JSON string which is used to mash with template. Either template-data or ( resource-id and resource-type ) should be present",
- "required": false,
- "type": "string"
- },
- "template-content": {
- "description": "Conditional : Dynamic Template used to generate Configuration.",
- "required": false,
- "type": "string"
- },
- "resource-type": {
- "description": "Conditional : resource-type used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
- "required": false,
- "type": "string"
- },
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- },
- "resource-id": {
- "description": "Conditional : Id used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
- "required": false,
- "type": "string"
- },
- "action-name": {
- "description": "Conditional : Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "template-name": {
- "description": "Conditional : Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "generated-config": {
- "description": "Generated Configuration for the Template adn Resource Data",
- "required": true,
- "type": "string"
- },
- "mask-info": {
- "description": "If template contains mask encription keys, then this mask-info field will be generated, This JSON Content alligns to the bean org.onap.ccsdk.features.model.data.custom.MaskInfo ",
- "required": false,
- "type": "string"
- },
- "status": {
- "description": "Status of the Component Execution ( success or failure )",
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "dg-config-generator": {
- "description": "This is Activate DG for Config Generator Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": "false"
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-config-generator",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "GenerateConfiguration": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.DG"
- }
- },
- "data_types": {
- "datatype-resource-assignment": {
- "version": "1.0.0",
- "description": "This is Resource Assignment Data Type",
- "properties": {
- "property": {
- "required": true,
- "type": "datatype-property"
- },
- "input-param": {
- "required": true,
- "type": "boolean"
- },
- "dictionary-name": {
- "required": false,
- "type": "string"
- },
- "dictionary-source": {
- "required": false,
- "type": "string"
- },
- "dependencies": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "datatype-property": {
- "version": "1.0.0",
- "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
- "properties": {
- "type": {
- "required": true,
- "type": "string"
- },
- "description": {
- "required": false,
- "type": "string"
- },
- "required": {
- "required": false,
- "type": "boolean"
- },
- "default": {
- "required": false,
- "type": "string"
- },
- "entry_schema": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- }
- }
-}
diff --git a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template.vtl b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template.vtl deleted file mode 100644 index e0ea400c6..000000000 --- a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template.vtl +++ /dev/null @@ -1,61 +0,0 @@ -<configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm"
-xmlns:a="http://xml.juniper.net/junos/15.1X49/junos">
- <version>15.1X49-D50.3</version>
- <groups>
- <name>node0</name>
- <system>
- #foreach($server in ${servers})
- <server-host-name>$StringUtils.upperCase("$server")</server-host-name>
- #end
- </system>
- <system>
- <host-name>${node0_hostname}</host-name>
- <backup-router>
- <address>${node0_backup_router_address}</address>
- <destination>$node0_backup_router_address</destination>
- </backup-router>
- #foreach($tacplus-server in ${tacplus-servers})
- <tacplus-server>
- <name>$tacplus-server.tacplus-server-name</name>
- <source-address>$tacplus-server.tacplus-server-source-address</source-address>
- </tacplus-server>
- #end
- <login>
- <message>AT&T information assets</message>
- #foreach($class in ${classes})
- <class>
- <name>$class.name</name>
- <idle-timeout>$class.idle-timeout</idle-timeout>
- #if ($class.permissions)
- <permissions>$class.permissions</permissions>
- #end
- </class>
- #end
- <user>
- <name>readonly</name>
- <full-name>Read Only Account Access</full-name>
- <uid>1001</uid>
- <class>tacacs-base-class</class>
- </user>
- <user>
- <name>readwrite</name>
- <full-name>Read - Write Account Access</full-name>
- <uid>1002</uid>
- <class>tacacs-adv-class</class>
- <authentication>
- <encrypted-password>${system-password}</encrypted-password>
- </authentication>
- </user>
- <user>
- <name>readwrite</name>
- <full-name>Emergency Access Only</full-name>
- <uid>1000</uid>
- <class>superuser-class</class>
- <authentication>
- <encrypted-password>${root-password}</encrypted-password>
- </authentication>
- </user>
- </login>
- </system>
- </groups>
-</configuration>
\ No newline at end of file diff --git a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template_group.vtl b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template_group.vtl deleted file mode 100644 index 92dba1024..000000000 --- a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template_group.vtl +++ /dev/null @@ -1,40 +0,0 @@ - <config>
- <configuration>
- <groups>
- <name>${group-name}</name>
- <routing-instances>
- <instance>
- <name><*></name>
- <protocols>
- <pim>
- <dense-groups>
- <dynamic-reject />
- <pim-dense-group-type>
- <name>224.0.1.40/32</name>
- </pim-dense-group-type>
- <pim-dense-group-type>
- <name>224.0.1.39/32</name>
- </pim-dense-group-type>
- <pim-dense-group-type>
- <name>224.0.0.0/4</name>
- <reject />
- </pim-dense-group-type>
- </dense-groups>
- <rp>
- <auto-rp>
- <discovery />
- </auto-rp>
- </rp>
- <interface>
- <name><*></name>
- <disable />
- <priority>1000</priority>
- </interface>
- <reset-tracking-bit />
- </pim>
- </protocols>
- </instance>
- </routing-instances>
- </groups>
- </configuration>
- </config>
\ No newline at end of file diff --git a/blueprints-processor/plugin/model-provider/pom.xml b/blueprints-processor/plugin/model-provider/pom.xml deleted file mode 100644 index f1770ae7c..000000000 --- a/blueprints-processor/plugin/model-provider/pom.xml +++ /dev/null @@ -1,166 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright © 2017-2018 AT&T Intellectual Property. - Modifications Copyright © 2018 IBM. - - 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>binding-parent</artifactId> - <version>1.5.2-SNAPSHOT</version> - <relativePath/> - </parent> - - <groupId>org.onap.ccsdk.features</groupId> - <artifactId>blueprints-model-provider</artifactId> - <version>0.7.1-SNAPSHOT</version> - <packaging>bundle</packaging> - - <name>ccsdk-features :: blueprints-processor-plugin :: ${project.artifactId}</name> - <url>http://maven.apache.org</url> - - <dependencies> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-jsonSchema</artifactId> - </dependency> - <dependency> - <groupId>com.jayway.jsonpath</groupId> - <artifactId>json-path</artifactId> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.features</groupId> - <artifactId>blueprints-rest-adaptor-provider</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.features</groupId> - <artifactId>blueprints-data-adaptor-provider</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.javassist</groupId> - <artifactId>javassist</artifactId> - <version>3.21.0-GA</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>1.10.19</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-module-junit4</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-support</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-reflect</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-core</artifactId> - <version>1.6.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-module-junit4</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.sling</groupId> - <artifactId>org.apache.sling.testing.osgi-mock</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <configuration> - <additionalparam>-Xdoclint:none</additionalparam> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Bundle-Name>${project.artifactId}</Bundle-Name> - <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName> - <Export-Package>org.onap.ccsdk.features.model, - org.onap.ccsdk.features.model.data, - org.onap.ccsdk.features.model.data.api, - org.onap.ccsdk.features.model.data.dict, - org.onap.ccsdk.features.model.domain, - org.onap.ccsdk.features.model.service, - org.onap.ccsdk.features.model.utils, - org.onap.ccsdk.features.model.validator - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelConstant.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelConstant.java deleted file mode 100644 index 02e4553b3..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelConstant.java +++ /dev/null @@ -1,145 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model;
-
-public class ConfigModelConstant {
-
- private ConfigModelConstant() {
-
- }
-
- public static final String STATUS_CODE_SUCCESS = "200";
- public static final String STATUS_CODE_FAILURE = "400";
-
- public static final String STATUS_SUCCESS = "success";
- public static final String STATUS_FAILURE = "failure";
- public static final String STATUS_SKIPPED = "skipped";
-
- public static final String CONFIG_STATUS_PENDING = "pending";
- public static final String CONFIG_STATUS_FAILED = "failed";
- public static final String CONFIG_STATUS_SUCCESS = "success";
-
- public static final String USER_SYSTEM = "System";
- public static final String PROTOCOL_NETCONF = "netconf";
-
- public static final String MODEL_CONTENT_TYPE_TOSCA_JSON = "TOSCA_JSON";
- public static final String MODEL_CONTENT_TYPE_TOSCA_YAML = "TOSCA_YAML";
- public static final String MODEL_CONTENT_TYPE_TEMPLATE = "TEMPLATE";
- public static final String MODEL_CONTENT_TYPE_YANG = "YANG";
- public static final String MODEL_CONTENT_TYPE_SCHEMA = "SCHEMA";
-
- public static final String SERVICE_TEMPLATE_KEY_ARTIFACT_AUTHOR = "author";
- public static final String SERVICE_TEMPLATE_KEY_ARTIFACT_NAME = "service-template-name";
- public static final String SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION = "service-template-version";
-
- public static final String MODEL_DEFINITION_TYPE_NODE_TYPE = "node_type";
- public static final String MODEL_DEFINITION_TYPE_CAPABILITY_TYPE = "capability_type";
- public static final String MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE = "relationship_type";
- public static final String MODEL_DEFINITION_TYPE_DATA_TYPE = "data_type";
- public static final String MODEL_DEFINITION_TYPE_ARTIFACT_TYPE = "artifact_type";
-
- public static final String MODEL_TYPE_DATA_TYPE = "tosca.datatypes.Root";
- public static final String MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic";
- public static final String MODEL_TYPE_NODE_TYPE = "tosca.nodes.Root";
-
- public static final String MODEL_TYPE_NODE_DG = "tosca.nodes.DG";
- public static final String MODEL_TYPE_NODE_COMPONENT = "tosca.nodes.Component";
- public static final String MODEL_TYPE_NODE_COMPONENT_PYTHON = "tosca.nodes.Component.Python";
- public static final String MODEL_TYPE_NODE_VNF = "tosca.nodes.Vnf";
- public static final String MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact";
-
- public static final String MODEL_TYPE_ARTIFACT_TEMPLATE = "tosca.artifact.Template";
- public static final String MODEL_TYPE_ARTIFACT_LICENCE = "tosca.artifacts.Licence";
-
- public static final String MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON = "tosca.relationships.DependsOn";
- public static final String MODEL_TYPE_RELATIONSHIPS_HOSTED_ON = "tosca.relationships.HostedOn";
- public static final String MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO = "tosca.relationships.ConnectsTo";
- public static final String MODEL_TYPE_RELATIONSHIPS_ATTACH_TO = "tosca.relationships.AttachesTo";
- public static final String MODEL_TYPE_RELATIONSHIPS_ROUTES_TO = "tosca.relationships.RoutesTo";
-
- public static final String NODE_TEMPLATE_TYPE_ARTIFACT_CONFIG_TEMPLATE = "artifact-config-template";
-
- public static final String CAPABILITY_PROPERTY_MAPPING = "mapping";
- public static final String CAPABILITY_PROPERTY_CONTENT = "content";
-
- public static final String SOURCE_INPUT = "input";
- public static final String SOURCE_DEFAULT = "default";
- public static final String SOURCE_MDSAL = "mdsal";
- public static final String SOURCE_DB = "db";
- public static final String SOURCE_COMPONENT = "component";
-
- public static final String PROPERTY_STATUS = "status";
- public static final String PROPERTY_ERROR_CODE = "error-code";
- public static final String PROPERTY_ERROR_MESSAGE = "error-message";
-
- public static final String PROPERTY_REQUEST_INPUT = "request-input";
- public static final String PROPERTY_REQUEST_HEADER = "request-header";
- public static final String PROPERTY_REQUEST_PAYLOAD = "request-payload";
-
- public static final String PROPERTY_RESPONSE_PAYLOAD = "response-payload";
- public static final String PROPERTY_RESPONSE_JSON_NODE = "response-json-node";
-
- public static final String PROPERTY_PAYLOAD = "payload";
- public static final String PROPERTY_INPUTS = "inputs";
- public static final String PROPERTY_ORGINATOR_ID = "originator-id";
- public static final String PROPERTY_API_VERSION = "api-ver";
- public static final String PROPERTY_REQUEST_ID = "request-id";
- public static final String PROPERTY_SUB_REQUEST_ID = "sub-request-id";
- public static final String PROPERTY_REQUEST = "request";
- public static final String PROPERTY_RECIPE = "action";
-
- public static final String PROPERTY_SELECTOR = "prifix";
- public static final String PROPERTY_NODE_TEMPLATES = "node_templates";
- public static final String PROPERTY_NODE_TYPES = "node_types";
- public static final String PROPERTY_DATA_TYPES = "data_types";
- public static final String PROPERTY_ACTION_NAME = "action-name";
- public static final String PROPERTY_ACTION_PREFIX = "action-prefix";
- public static final String PROPERTY_TEMPLATE_NAME = "template-name";
-
- public static final String PROPERTY_CURRENT_INTERFACE = "current-interface";
- public static final String PROPERTY_CURRENT_OPERATION = "current-operation";
- public static final String PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation";
- public static final String PROPERTY_CURRENT_NODETYPE_DERIVED_FROM = "current-node-type-derived-from";
- public static final String PROPERTY_CURRENT_RESOURCE_ASSIGNMENT = "current-resource-assignment";
- public static final String PROPERTY_CURRENT_DICTIONARY_DEFINITION = "current-dictionary-definition";
- public static final String PROPERTY_RESOURCE_ASSIGNMENTS_DATA = "resource-assignments-data";
-
- public static final String PROPERTY_RECIPE_NAMES = "action-names";
- public static final String PROPERTY_DICTIONARIES = "dictionaries";
- public static final String PROPERTY_RESOURCE_ASSIGNMENTS = "resource-assignments";
- public static final String PROPERTY_RESOURCE_KEY = "resource-key";
- public static final String PROPERTY_RESOURCE_NAME = "resource-name";
- public static final String PROPERTY_RESERVATION_ID = "reservation-id";
-
- public static final String PROPERTY_NODE_TEMPLATES_DOT = "node_templates.";
- public static final String PROPERTY_NODE_TYPES_DOT = "node_types.";
- public static final String PROPERTY_DATA_TYPES_DOT = "data_types.";
- public static final String PROPERTY_INPUTS_DOT = "inputs.";
- public static final String PROPERTY_ARTIFACTS_DOT = "artifacts.";
- public static final String PROPERTY_DICTIONARY_KEY_DOT = "dictionary-key.";
- public static final String PROPERTY_TEMPLATE_KEY_DOT = "template-key.";
- public static final String PROPERTY_RECIPE_KEY_DOT = "recipe-key.";
-
- public static final String PROPERTY_DOT_STATUS = ".status";
- public static final String PROPERTY_DOT_ERROR_MESSAGE = ".error-message";
-
- public static final String EXPRESSION_GET_INPUT = "get_input";
- public static final String EXPRESSION_GET_ATTRIBUTE = "get_attribute";
- public static final String EXPRESSION_SET_VALUE = "set_value";
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelException.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelException.java deleted file mode 100644 index aa71c265a..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelException.java +++ /dev/null @@ -1,50 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model;
-
-/**
- * ConfigGeneratorException.java Purpose: Provide Configuration Generator ConfigGeneratorException
- *
- * @version 1.0
- */
-public class ConfigModelException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * This is a ConfigGeneratorException constructor
- *
- * @param message
- */
- public ConfigModelException(String message) {
- super(message);
- }
-
- /**
- * This is a ConfigGeneratorException constructor
- *
- * @param message
- */
- public ConfigModelException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ValidTypes.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ValidTypes.java deleted file mode 100644 index 1be6089d5..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ValidTypes.java +++ /dev/null @@ -1,105 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * ValidTypes.java Purpose: Provide Configuration Generator ValidTypes
- *
- * @version 1.0
- */
-public class ValidTypes {
-
- public static final String DATA_TYPE_STRING = "string";
- public static final String DATA_TYPE_INTEGER = "integer";
- public static final String DATA_TYPE_FLOAT = "float";
- public static final String DATA_TYPE_BOOLEAN = "boolean";
- public static final String DATA_TYPE_TIMESTAMP = "timestamp";
- public static final String DATA_TYPE_NULL = "null";
- public static final String DATA_TYPE_LIST = "list";
- public static final String DATA_TYPE_LONGTEXT = "longtext";
-
- private ValidTypes() {
-
- }
-
- public static List<String> getValidModelTypes() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(ConfigModelConstant.MODEL_DEFINITION_TYPE_DATA_TYPE);
- validTypes.add(ConfigModelConstant.MODEL_DEFINITION_TYPE_NODE_TYPE);
- validTypes.add(ConfigModelConstant.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE);
- validTypes.add(ConfigModelConstant.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE);
- return validTypes;
- }
-
- public static List<String> getValidNodeTypes() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_DG);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_COMPONENT);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_VNF);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_ARTIFACT);
- return validTypes;
- }
-
- public static List<String> getValidDerivedFrom() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(ConfigModelConstant.MODEL_TYPE_DATA_TYPE_DYNAMIC);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_DATA_TYPE);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_TYPE);
- return validTypes;
- }
-
- public static List<String> getValidDataTypeDerivedFrom() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(ConfigModelConstant.MODEL_TYPE_DATA_TYPE_DYNAMIC);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_DATA_TYPE);
- return validTypes;
- }
-
- public static List<String> getValidPropertType() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(DATA_TYPE_STRING);
- validTypes.add(DATA_TYPE_INTEGER);
- validTypes.add(DATA_TYPE_FLOAT);
- validTypes.add(DATA_TYPE_BOOLEAN);
- validTypes.add(DATA_TYPE_TIMESTAMP);
- validTypes.add(DATA_TYPE_NULL);
- validTypes.add(DATA_TYPE_LIST);
- return validTypes;
- }
-
- public static List<String> getPrimitivePropertType() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(DATA_TYPE_STRING);
- validTypes.add(DATA_TYPE_INTEGER);
- validTypes.add(DATA_TYPE_FLOAT);
- validTypes.add(DATA_TYPE_BOOLEAN);
- validTypes.add(DATA_TYPE_TIMESTAMP);
- validTypes.add(DATA_TYPE_NULL);
- return validTypes;
- }
-
- public static List<String> getListPropertType() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(DATA_TYPE_LIST);
- return validTypes;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactDefinition.java deleted file mode 100644 index a26209425..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactDefinition.java +++ /dev/null @@ -1,105 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * ArtifactDefinition.java Purpose: Provide ArtifactDefinition TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class ArtifactDefinition {
- @JsonIgnore
- private String id;
- private String type;
- private String file;
- private String repository;
- private String description;
- @JsonProperty("deploy_Path")
- private String deployPath;
- // Used for Template Type
- private String content;
- private String mappingContent;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getFile() {
- return file;
- }
-
- public void setFile(String file) {
- this.file = file;
- }
-
- public String getRepository() {
- return repository;
- }
-
- public void setRepository(String repository) {
- this.repository = repository;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getDeployPath() {
- return deployPath;
- }
-
- public void setDeployPath(String deployPath) {
- this.deployPath = deployPath;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public String getMappingContent() {
- return mappingContent;
- }
-
- public void setMappingContent(String mappingContent) {
- this.mappingContent = mappingContent;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactType.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactType.java deleted file mode 100644 index 3add0a3f5..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactType.java +++ /dev/null @@ -1,102 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class ArtifactType {
- @JsonIgnore
- private String id;
- private String description;
- private String version;
- private Map<String, String> metadata;
- @JsonProperty("derived_from")
- private String derivedFrom;
- private Map<String, PropertyDefinition> properties;
- @JsonProperty("mime_type")
- private String mimeType;
- @JsonProperty("file_ext")
- private List<String> fileExt;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public String getDerivedFrom() {
- return derivedFrom;
- }
-
- public void setDerivedFrom(String derivedFrom) {
- this.derivedFrom = derivedFrom;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
- public String getMimeType() {
- return mimeType;
- }
-
- public void setMimeType(String mimeType) {
- this.mimeType = mimeType;
- }
-
- public List<String> getFileExt() {
- return fileExt;
- }
-
- public void setFileExt(List<String> fileExt) {
- this.fileExt = fileExt;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityAssignment.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityAssignment.java deleted file mode 100644 index f40388ce0..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityAssignment.java +++ /dev/null @@ -1,49 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * CapabilityAssignment.java Purpose: Provide CapabilityAssignment TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class CapabilityAssignment {
- @JsonIgnore
- private String id;
- private Map<String, Object> properties;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityDefinition.java deleted file mode 100644 index 467e9bbdc..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityDefinition.java +++ /dev/null @@ -1,88 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * CapabilityDefinition.java Purpose: Provide CapabilityDefinition TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class CapabilityDefinition {
- @JsonIgnore
- private String id;
- private String type;
- private String description;
- private Map<String, PropertyDefinition> properties;
- @JsonProperty("valid_source_types")
- private List<String> validSourceTypes;
- private List<Object> occurrences;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
- public List<String> getValidSourceTypes() {
- return validSourceTypes;
- }
-
- public void setValidSourceTypes(List<String> validSourceTypes) {
- this.validSourceTypes = validSourceTypes;
- }
-
- public List<Object> getOccurrences() {
- return occurrences;
- }
-
- public void setOccurrences(List<Object> occurrences) {
- this.occurrences = occurrences;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ConstraintClause.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ConstraintClause.java deleted file mode 100644 index 2066e8f7a..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ConstraintClause.java +++ /dev/null @@ -1,150 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * ConstraintClause.java Purpose: 3.5.2 Constraint clause.
- *
- * @version 1.0
- */
-public class ConstraintClause {
- @JsonProperty("equal")
- private Object equal;
-
- @JsonProperty("greater_than")
- private Object greaterThan;
-
- @JsonProperty("greater_or_equal")
- private Object greaterOrEqual;
-
- @JsonProperty("less_than")
- private Object lessThan;
-
- @JsonProperty("less_or_equal")
- private Object lessOrEqual;
-
- @JsonProperty("in_range")
- private Object inRange;
-
- @JsonProperty("valid_values")
- private List<Object> validValues;
-
- @JsonProperty("length")
- private Object length;
-
- @JsonProperty("min_length")
- private Object minLength;
-
- @JsonProperty("max_length")
- private Object maxLength;
-
- @JsonProperty("pattern")
- private String pattern;
-
- public Object getEqual() {
- return equal;
- }
-
- public void setEqual(Object equal) {
- this.equal = equal;
- }
-
- public Object getGreaterThan() {
- return greaterThan;
- }
-
- public void setGreaterThan(Object greaterThan) {
- this.greaterThan = greaterThan;
- }
-
- public Object getGreaterOrEqual() {
- return greaterOrEqual;
- }
-
- public void setGreaterOrEqual(Object greaterOrEqual) {
- this.greaterOrEqual = greaterOrEqual;
- }
-
- public Object getLessThan() {
- return lessThan;
- }
-
- public void setLessThan(Object lessThan) {
- this.lessThan = lessThan;
- }
-
- public Object getLessOrEqual() {
- return lessOrEqual;
- }
-
- public void setLessOrEqual(Object lessOrEqual) {
- this.lessOrEqual = lessOrEqual;
- }
-
- public Object getInRange() {
- return inRange;
- }
-
- public void setInRange(Object inRange) {
- this.inRange = inRange;
- }
-
- public List<Object> getValidValues() {
- return validValues;
- }
-
- public void setValidValues(List<Object> validValues) {
- this.validValues = validValues;
- }
-
- public Object getLength() {
- return length;
- }
-
- public void setLength(Object length) {
- this.length = length;
- }
-
- public Object getMinLength() {
- return minLength;
- }
-
- public void setMinLength(Object minLength) {
- this.minLength = minLength;
- }
-
- public Object getMaxLength() {
- return maxLength;
- }
-
- public void setMaxLength(Object maxLength) {
- this.maxLength = maxLength;
- }
-
- public String getPattern() {
- return pattern;
- }
-
- public void setPattern(String pattern) {
- this.pattern = pattern;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/DataType.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/DataType.java deleted file mode 100644 index 6df6ba2a8..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/DataType.java +++ /dev/null @@ -1,88 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * DataType.java Purpose: Provide DataType TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class DataType {
- @JsonIgnore
- private String id;
- private String version;
- private String description;
- @JsonProperty("derived_from")
- private String derivedFrom;
- private List<Map<String, Object>> constraints;
- private Map<String, PropertyDefinition> properties;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getDerivedFrom() {
- return derivedFrom;
- }
-
- public void setDerivedFrom(String derivedFrom) {
- this.derivedFrom = derivedFrom;
- }
-
- public List<Map<String, Object>> getConstraints() {
- return constraints;
- }
-
- public void setConstraints(List<Map<String, Object>> constraints) {
- this.constraints = constraints;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/EntrySchema.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/EntrySchema.java deleted file mode 100644 index 663442161..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/EntrySchema.java +++ /dev/null @@ -1,36 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-/**
- * EntrySchema.java Purpose: Provide EntrySchema TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class EntrySchema {
- private String type;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Implementation.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Implementation.java deleted file mode 100644 index 46facdb69..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Implementation.java +++ /dev/null @@ -1,49 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * Implementation.java Purpose: Provide Operation Implementation TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class Implementation {
- @JsonIgnore
- private String primary;
- private List<String> dependencies;
-
- public String getPrimary() {
- return primary;
- }
-
- public void setPrimary(String primary) {
- this.primary = primary;
- }
-
- public List<String> getDependencies() {
- return dependencies;
- }
-
- public void setDependencies(List<String> dependencies) {
- this.dependencies = dependencies;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceAssignment.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceAssignment.java deleted file mode 100644 index 9007dd027..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceAssignment.java +++ /dev/null @@ -1,58 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * InterfaceAssignment.java Purpose: Provide InterfaceAssignment TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class InterfaceAssignment {
- @JsonIgnore
- private String id;
- private String type;
- private Map<String, OperationAssignment> operations;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, OperationAssignment> getOperations() {
- return operations;
- }
-
- public void setOperations(Map<String, OperationAssignment> operations) {
- this.operations = operations;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceDefinition.java deleted file mode 100644 index bcd0ef375..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceDefinition.java +++ /dev/null @@ -1,58 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * InterfaceAssignment.java Purpose: Provide InterfaceAssignment TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class InterfaceDefinition {
- @JsonIgnore
- private String id;
- private String type;
- private Map<String, OperationDefinition> operations;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, OperationDefinition> getOperations() {
- return operations;
- }
-
- public void setOperations(Map<String, OperationDefinition> operations) {
- this.operations = operations;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeTemplate.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeTemplate.java deleted file mode 100644 index c62b719e3..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeTemplate.java +++ /dev/null @@ -1,112 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * NodeTemplate.java Purpose: Provide NodeTemplate TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class NodeTemplate {
- @JsonIgnore
- private String id;
- private String description;
- private String type;
- private Map<String, String> metadata;
- private Map<String, Object> properties;
- private Map<String, InterfaceAssignment> interfaces;
- private Map<String, ArtifactDefinition> artifacts;
- private Map<String, CapabilityAssignment> capabilities;
- private Map<String, RequirementAssignment> requirements;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
-
- public Map<String, InterfaceAssignment> getInterfaces() {
- return interfaces;
- }
-
- public void setInterfaces(Map<String, InterfaceAssignment> interfaces) {
- this.interfaces = interfaces;
- }
-
- public Map<String, ArtifactDefinition> getArtifacts() {
- return artifacts;
- }
-
- public void setArtifacts(Map<String, ArtifactDefinition> artifacts) {
- this.artifacts = artifacts;
- }
-
- public Map<String, CapabilityAssignment> getCapabilities() {
- return capabilities;
- }
-
- public void setCapabilities(Map<String, CapabilityAssignment> capabilities) {
- this.capabilities = capabilities;
- }
-
- public Map<String, RequirementAssignment> getRequirements() {
- return requirements;
- }
-
- public void setRequirements(Map<String, RequirementAssignment> requirements) {
- this.requirements = requirements;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeType.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeType.java deleted file mode 100644 index f97910995..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeType.java +++ /dev/null @@ -1,114 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * NodeType.java Purpose: Provide NodeType TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class NodeType {
- @JsonIgnore
- private String id;
- private String description;
- private String version;
- private Map<String, String> metadata;
- @JsonProperty("derived_from")
- private String derivedFrom;
- private Map<String, PropertyDefinition> properties;
- private Map<String, CapabilityDefinition> capabilities;
- private Map<String, RequirementDefinition> requirements;
- private Map<String, InterfaceDefinition> interfaces;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public String getDerivedFrom() {
- return derivedFrom;
- }
-
- public void setDerivedFrom(String derivedFrom) {
- this.derivedFrom = derivedFrom;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
- public Map<String, CapabilityDefinition> getCapabilities() {
- return capabilities;
- }
-
- public void setCapabilities(Map<String, CapabilityDefinition> capabilities) {
- this.capabilities = capabilities;
- }
-
- public Map<String, RequirementDefinition> getRequirements() {
- return requirements;
- }
-
- public void setRequirements(Map<String, RequirementDefinition> requirements) {
- this.requirements = requirements;
- }
-
- public Map<String, InterfaceDefinition> getInterfaces() {
- return interfaces;
- }
-
- public void setInterfaces(Map<String, InterfaceDefinition> interfaces) {
- this.interfaces = interfaces;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationAssignment.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationAssignment.java deleted file mode 100644 index cbb14067d..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationAssignment.java +++ /dev/null @@ -1,76 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * OperationAssignment.java Purpose: Provide OperationAssignment TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class OperationAssignment {
- @JsonIgnore
- private String id;
- private String description;
- private String implementation;
- private Map<String, Object> inputs;
- private Map<String, Object> outputs;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getImplementation() {
- return implementation;
- }
-
- public void setImplementation(String implementation) {
- this.implementation = implementation;
- }
-
- public Map<String, Object> getInputs() {
- return inputs;
- }
-
- public void setInputs(Map<String, Object> inputs) {
- this.inputs = inputs;
- }
-
- public Map<String, Object> getOutputs() {
- return outputs;
- }
-
- public void setOutputs(Map<String, Object> outputs) {
- this.outputs = outputs;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationDefinition.java deleted file mode 100644 index eeb333500..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationDefinition.java +++ /dev/null @@ -1,76 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * OperationDefinition.java Purpose: Provide OperationDefinition TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class OperationDefinition {
- @JsonIgnore
- private String id;
- private String description;
- private Implementation implementation;
- private Map<String, PropertyDefinition> inputs;
- private Map<String, PropertyDefinition> outputs;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Implementation getImplementation() {
- return implementation;
- }
-
- public void setImplementation(Implementation implementation) {
- this.implementation = implementation;
- }
-
- public Map<String, PropertyDefinition> getInputs() {
- return inputs;
- }
-
- public void setInputs(Map<String, PropertyDefinition> inputs) {
- this.inputs = inputs;
- }
-
- public Map<String, PropertyDefinition> getOutputs() {
- return outputs;
- }
-
- public void setOutputs(Map<String, PropertyDefinition> outputs) {
- this.outputs = outputs;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/PropertyDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/PropertyDefinition.java deleted file mode 100644 index a300d2386..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/PropertyDefinition.java +++ /dev/null @@ -1,125 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.HashMap;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * PropertyDefinition.java Purpose: Provide PropertyDefinition TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class PropertyDefinition {
- @JsonIgnore
- private String id;
- private String description;
- private Boolean required;
- private String type;
- @JsonProperty("default")
- private Object defaultValue;
- private String status;
- private List<HashMap<String, Object>> constraints;
- @JsonProperty("entry_schema")
- private EntrySchema entrySchema;
- private Object value;
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("[");
- builder.append(" type :" + getType());
- builder.append(", value :" + getValue());
- builder.append("]");
- return builder.toString();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Boolean getRequired() {
- return required;
- }
-
- public void setRequired(Boolean required) {
- this.required = required;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Object getDefaultValue() {
- return defaultValue;
- }
-
- public void setDefaultValue(Object defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public List<HashMap<String, Object>> getConstraints() {
- return constraints;
- }
-
- public void setConstraints(List<HashMap<String, Object>> constraints) {
- this.constraints = constraints;
- }
-
- public EntrySchema getEntrySchema() {
- return entrySchema;
- }
-
- public void setEntrySchema(EntrySchema entrySchema) {
- this.entrySchema = entrySchema;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RelationshipTemplate.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RelationshipTemplate.java deleted file mode 100644 index 172d5a846..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RelationshipTemplate.java +++ /dev/null @@ -1,56 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-
-/**
- * RelationshipTemplate.java Purpose: Provide RelationshipTemplate TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class RelationshipTemplate {
- private String description;
- private String type;
- private Map<String, PropertyDefinition> properties;
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementAssignment.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementAssignment.java deleted file mode 100644 index c26de45e5..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementAssignment.java +++ /dev/null @@ -1,67 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * RequirementAssignment.java Purpose: Provide RequirementAssignment TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class RequirementAssignment {
- @JsonIgnore
- private String id;
- private String capability;
- private String node;
- // Relationship Type or Relationship Template
- private String relationship;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getCapability() {
- return capability;
- }
-
- public void setCapability(String capability) {
- this.capability = capability;
- }
-
- public String getNode() {
- return node;
- }
-
- public void setNode(String node) {
- this.node = node;
- }
-
- public String getRelationship() {
- return relationship;
- }
-
- public void setRelationship(String relationship) {
- this.relationship = relationship;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementDefinition.java deleted file mode 100644 index 623a76031..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementDefinition.java +++ /dev/null @@ -1,85 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * RequirementDefinition.java Purpose: Provide RequirementDefinition TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class RequirementDefinition {
- @JsonIgnore
- private String id;
- private String description;
- private String capability;
- private String node;
- private String relationship;
- private List<Object> occurrences;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getCapability() {
- return capability;
- }
-
- public void setCapability(String capability) {
- this.capability = capability;
- }
-
- public String getNode() {
- return node;
- }
-
- public void setNode(String node) {
- this.node = node;
- }
-
- public String getRelationship() {
- return relationship;
- }
-
- public void setRelationship(String relationship) {
- this.relationship = relationship;
- }
-
- public List<Object> getOccurrences() {
- return occurrences;
- }
-
- public void setOccurrences(List<Object> occurrences) {
- this.occurrences = occurrences;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ResourceAssignment.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ResourceAssignment.java deleted file mode 100644 index 9f852c11c..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ResourceAssignment.java +++ /dev/null @@ -1,165 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Date;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * ResourceAssignment.java Purpose: Provide ResourceAssignment Custom TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class ResourceAssignment {
-
- private String name;
-
- @JsonProperty("property")
- private PropertyDefinition property;
-
- @JsonProperty("input-param")
- private Boolean inputParameter;
-
- @JsonProperty("dictionary-name")
- private String dictionaryName;
-
- @JsonProperty("dictionary-source")
- private String dictionarySource;
-
- @JsonProperty("dependencies")
- private List<String> dependencies;
-
- @JsonProperty("version")
- private int version;
-
- @JsonProperty("status")
- private String status;
-
- @JsonProperty("message")
- private String message;
-
- @JsonProperty("updated-date")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- private Date updatedDate;
-
- @JsonProperty("updated-by")
- private String updatedBy;
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("[");
- builder.append("name = " + name);
- builder.append(", source = " + dictionarySource);
- if (dependencies != null) {
- builder.append(", dependencies = " + dependencies);
- }
- builder.append("]");
- return builder.toString();
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public PropertyDefinition getProperty() {
- return property;
- }
-
- public void setProperty(PropertyDefinition property) {
- this.property = property;
- }
-
- public Boolean getInputParameter() {
- return inputParameter;
- }
-
- public void setInputParameter(Boolean inputParameter) {
- this.inputParameter = inputParameter;
- }
-
- public String getDictionaryName() {
- return dictionaryName;
- }
-
- public void setDictionaryName(String dictionaryName) {
- this.dictionaryName = dictionaryName;
- }
-
- public String getDictionarySource() {
- return dictionarySource;
- }
-
- public void setDictionarySource(String dictionarySource) {
- this.dictionarySource = dictionarySource;
- }
-
- public List<String> getDependencies() {
- return dependencies;
- }
-
- public void setDependencies(List<String> dependencies) {
- this.dependencies = dependencies;
- }
-
- public int getVersion() {
- return version;
- }
-
- public void setVersion(int version) {
- this.version = version;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Date getUpdatedDate() {
- return updatedDate;
- }
-
- public void setUpdatedDate(Date updatedDate) {
- this.updatedDate = updatedDate;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ServiceTemplate.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ServiceTemplate.java deleted file mode 100644 index f66d73727..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ServiceTemplate.java +++ /dev/null @@ -1,118 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * ServiceTemplate.java Purpose: Provide ServiceTemplate TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class ServiceTemplate {
- @JsonIgnore
- private String id;
- @JsonProperty("tosca_definitions_version")
- private String toscaDefinitionsVersion;
- private Map<String, String> metadata;
- private String description;
- @JsonProperty("dsl_definitions")
- private Map<String, Object> dslDefinitions;
- @JsonProperty("topology_template")
- private TopologyTemplate topologyTemplate;
- @JsonProperty("artifact_types")
- private Map<String, ArtifactType> artifactTypes;
- @JsonProperty("node_types")
- private Map<String, NodeType> nodeTypes;
- @JsonProperty("data_types")
- private Map<String, DataType> dataTypes;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getToscaDefinitionsVersion() {
- return toscaDefinitionsVersion;
- }
-
- public void setToscaDefinitionsVersion(String toscaDefinitionsVersion) {
- this.toscaDefinitionsVersion = toscaDefinitionsVersion;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, Object> getDslDefinitions() {
- return dslDefinitions;
- }
-
- public void setDslDefinitions(Map<String, Object> dslDefinitions) {
- this.dslDefinitions = dslDefinitions;
- }
-
- public TopologyTemplate getTopologyTemplate() {
- return topologyTemplate;
- }
-
- public void setTopologyTemplate(TopologyTemplate topologyTemplate) {
- this.topologyTemplate = topologyTemplate;
- }
-
- public Map<String, NodeType> getNodeTypes() {
- return nodeTypes;
- }
-
- public void setNodeTypes(Map<String, NodeType> nodeTypes) {
- this.nodeTypes = nodeTypes;
- }
-
- public Map<String, DataType> getDataTypes() {
- return dataTypes;
- }
-
- public void setDataTypes(Map<String, DataType> dataTypes) {
- this.dataTypes = dataTypes;
- }
-
- public Map<String, ArtifactType> getArtifactTypes() {
- return artifactTypes;
- }
-
- public void setArtifactTypes(Map<String, ArtifactType> artifactTypes) {
- this.artifactTypes = artifactTypes;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/TopologyTemplate.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/TopologyTemplate.java deleted file mode 100644 index 1f609386a..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/TopologyTemplate.java +++ /dev/null @@ -1,97 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * TopologyTemplate.java Purpose: Provide TopologyTemplate TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class TopologyTemplate {
- @JsonIgnore
- private String id;
- private String description;
- private Map<String, PropertyDefinition> inputs;
- @JsonProperty("node_templates")
- private Map<String, NodeTemplate> nodeTemplates;
- @JsonProperty("relationship_templates")
- private Map<String, RelationshipTemplate> relationshipTemplates;
- private Map<String, CapabilityAssignment> capabilities;
- private Map<String, Workflow> workflows;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, PropertyDefinition> getInputs() {
- return inputs;
- }
-
- public void setInputs(Map<String, PropertyDefinition> inputs) {
- this.inputs = inputs;
- }
-
- public Map<String, NodeTemplate> getNodeTemplates() {
- return nodeTemplates;
- }
-
- public void setNodeTemplates(Map<String, NodeTemplate> nodeTemplates) {
- this.nodeTemplates = nodeTemplates;
- }
-
- public Map<String, RelationshipTemplate> getRelationshipTemplates() {
- return relationshipTemplates;
- }
-
- public void setRelationshipTemplates(Map<String, RelationshipTemplate> relationshipTemplates) {
- this.relationshipTemplates = relationshipTemplates;
- }
-
- public Map<String, CapabilityAssignment> getCapabilities() {
- return capabilities;
- }
-
- public void setCapabilities(Map<String, CapabilityAssignment> capabilities) {
- this.capabilities = capabilities;
- }
-
- public Map<String, Workflow> getWorkflows() {
- return workflows;
- }
-
- public void setWorkflows(Map<String, Workflow> workflows) {
- this.workflows = workflows;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Workflow.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Workflow.java deleted file mode 100644 index 09742a3d0..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Workflow.java +++ /dev/null @@ -1,39 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * Workflow.java Purpose: Provide Workflow TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class Workflow {
- @JsonIgnore
- private String id;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/ActionIdentifiers.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/ActionIdentifiers.java deleted file mode 100644 index 2b54a2c8b..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/ActionIdentifiers.java +++ /dev/null @@ -1,62 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class ActionIdentifiers {
- @JsonProperty("service-template-name")
- private String serviceTemplateName;
- @JsonProperty("service-template-version")
- private String serviceTemplateVersion;
- @JsonProperty("action-name")
- private String actionName;
- private String mode;
-
- public String getServiceTemplateName() {
- return serviceTemplateName;
- }
-
- public void setServiceTemplateName(String serviceTemplateName) {
- this.serviceTemplateName = serviceTemplateName;
- }
-
- public String getServiceTemplateVersion() {
- return serviceTemplateVersion;
- }
-
- public void setServiceTemplateVersion(String serviceTemplateVersion) {
- this.serviceTemplateVersion = serviceTemplateVersion;
- }
-
- public String getActionName() {
- return actionName;
- }
-
- public void setActionName(String actionName) {
- this.actionName = actionName;
- }
-
- public String getMode() {
- return mode;
- }
-
- public void setMode(String mode) {
- this.mode = mode;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/CommonHeader.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/CommonHeader.java deleted file mode 100644 index 4a4011ef1..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/CommonHeader.java +++ /dev/null @@ -1,82 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class CommonHeader {
-
- private String timestamp;
- @JsonProperty("api-ver")
- private String apiVer;
- @JsonProperty("originator-id")
- private String originatorId;
- @JsonProperty("request-id")
- private String requestId;
- @JsonProperty("sub-request-id")
- private String subRequestId;
- private Flags flags;
-
- public String getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(String timestamp) {
- this.timestamp = timestamp;
- }
-
- public String getApiVer() {
- return apiVer;
- }
-
- public void setApiVer(String apiVer) {
- this.apiVer = apiVer;
- }
-
- public String getOriginatorId() {
- return originatorId;
- }
-
- public void setOriginatorId(String originatorId) {
- this.originatorId = originatorId;
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getSubRequestId() {
- return subRequestId;
- }
-
- public void setSubRequestId(String subRequestId) {
- this.subRequestId = subRequestId;
- }
-
- public Flags getFlags() {
- return flags;
- }
-
- public void setFlags(Flags flags) {
- this.flags = flags;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Flags.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Flags.java deleted file mode 100644 index b1f2a9399..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Flags.java +++ /dev/null @@ -1,40 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-public class Flags {
- private boolean force;
- private Integer ttl;
-
- public boolean isForce() {
- return force;
- }
-
- public void setForce(boolean force) {
- this.force = force;
- }
-
- public Integer getTtl() {
- return ttl;
- }
-
- public void setTtl(Integer ttl) {
- this.ttl = ttl;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Status.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Status.java deleted file mode 100644 index 2cdd839d6..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Status.java +++ /dev/null @@ -1,61 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class Status {
-
- private Integer code;
- @JsonProperty("error-message")
- private String errorMessage;
- private String message;
- private String completed;
-
- public Integer getCode() {
- return code;
- }
-
- public void setCode(Integer code) {
- this.code = code;
- }
-
- public String getErrorMessage() {
- return errorMessage;
- }
-
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public String getCompleted() {
- return completed;
- }
-
- public void setCompleted(String completed) {
- this.completed = completed;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionRequest.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionRequest.java deleted file mode 100644 index 56148eeef..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionRequest.java +++ /dev/null @@ -1,45 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class TransactionRequest {
-
- @JsonProperty("transaction-request-id")
- private String transactionRequestId;
- @JsonProperty("message-type")
- private String messageType;
-
- public String getTransactionRequestId() {
- return transactionRequestId;
- }
-
- public void setTransactionRequestId(String transactionRequestId) {
- this.transactionRequestId = transactionRequestId;
- }
-
- public String getMessageType() {
- return messageType;
- }
-
- public void setMessageType(String messageType) {
- this.messageType = messageType;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionResponse.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionResponse.java deleted file mode 100644 index cc935e813..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionResponse.java +++ /dev/null @@ -1,46 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class TransactionResponse {
-
- @JsonProperty("transaction-request-id")
- private String transactionRequestId;
- @JsonProperty("event-message")
- private List<String> eventMessage;
-
- public String getTransactionRequestId() {
- return transactionRequestId;
- }
-
- public void setTransactionRequestId(String transactionRequestId) {
- this.transactionRequestId = transactionRequestId;
- }
-
- public List<String> getEventMessage() {
- return eventMessage;
- }
-
- public void setEventMessage(List<String> eventMessage) {
- this.eventMessage = eventMessage;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/ResourceDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/ResourceDefinition.java deleted file mode 100644 index 25605fcd2..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/ResourceDefinition.java +++ /dev/null @@ -1,83 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data.dict;
-
-import java.util.Map;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ResourceDefinition {
-
- @JsonProperty(value = "name", required = true)
- private String name;
-
- @JsonProperty(value = "tags")
- private String tags;
-
- @JsonProperty(value = "property")
- private PropertyDefinition property;
-
- @JsonProperty(value = "updated-by")
- private String updatedBy;
-
- @JsonProperty(value = "sources", required = true)
- private Map<String, SourcesDefinition> sourcesDefinition;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public PropertyDefinition getProperty() {
- return property;
- }
-
- public void setProperty(PropertyDefinition property) {
- this.property = property;
- }
-
- public String getTags() {
- return tags;
- }
-
- public void setTags(String tags) {
- this.tags = tags;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
- public Map<String, SourcesDefinition> getSources() {
- return sourcesDefinition;
- }
-
- public void setSources(Map<String, SourcesDefinition> sourcesDefinition) {
- this.sourcesDefinition = sourcesDefinition;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesDefinition.java deleted file mode 100644 index 0ce7eda37..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesDefinition.java +++ /dev/null @@ -1,48 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data.dict;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class SourcesDefinition {
-
- @JsonProperty(value = "type", required = true)
- private String type;
-
- @JsonProperty(value = "properties", required = true)
- private SourcesProperties properties;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public SourcesProperties getProperties() {
- return properties;
- }
-
- public void setProperties(SourcesProperties properties) {
- this.properties = properties;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesProperties.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesProperties.java deleted file mode 100644 index 696e1516d..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesProperties.java +++ /dev/null @@ -1,127 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.data.dict;
-
-import java.util.List;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class SourcesProperties {
-
- @JsonProperty(value = "key")
- private String key;
-
- @JsonProperty(value = "type")
- private String type;
-
- @JsonProperty(value = "query")
- private String query;
-
- @JsonProperty(value = "url-path")
- private String urlPath;
-
- @JsonProperty(value = "expression-type")
- private String expressionType;
-
- @JsonProperty(value = "path")
- private String path;
-
- @JsonProperty("input-key-mapping")
- private Map<String, String> inputKeyMapping;
-
- @JsonProperty("output-key-mapping")
- private Map<String, String> outputKeyMapping;
-
- @JsonProperty("key-dependencies")
- private List<String> dependencies;
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getQuery() {
- return query;
- }
-
- public void setQuery(String query) {
- this.query = query;
- }
-
- public String getUrlPath() {
- return urlPath;
- }
-
- public void setUrlPath(String urlPath) {
- this.urlPath = urlPath;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setExpressionType(String expressionType) {
- this.expressionType = expressionType;
- }
-
- public String getExpressionType() {
- return expressionType;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public Map<String, String> getInputKeyMapping() {
- return inputKeyMapping;
- }
-
- public void setInputKeyMapping(Map<String, String> inputKeyMapping) {
- this.inputKeyMapping = inputKeyMapping;
- }
-
- public Map<String, String> getOutputKeyMapping() {
- return outputKeyMapping;
- }
-
- public void setOutputKeyMapping(Map<String, String> outputKeyMapping) {
- this.outputKeyMapping = outputKeyMapping;
- }
-
- public List<String> getDependencies() {
- return dependencies;
- }
-
- public void setDependencies(List<String> dependencies) {
- this.dependencies = dependencies;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModel.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModel.java deleted file mode 100644 index 66de05b0e..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModel.java +++ /dev/null @@ -1,231 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.domain;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-public class ConfigModel implements Serializable {
-
- private Long id;
- private String serviceUUID;
- private String distributionId;
- private String serviceName;
- private String serviceDescription;
- private String resourceUUID;
- private String resourceInstanceName;
- private String resourceName;
- private String resourceVersion;
- private String resourceType;
- private String artifactUUId;
- private String artifactType;
- private String artifactVersion;
- private String artifactDescription;
- private Integer internalVersion;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- private Date createdDate = new Date();
- private String artifactName;
- private String published;
- private String updatedBy;
- private String tags;
- @SuppressWarnings("squid:S1948")
- private List<ConfigModelContent> configModelContents;
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder("[");
- buffer.append("id = " + id);
- buffer.append(", artifactType = " + artifactType);
- buffer.append(", artifactVersion = " + artifactVersion);
- buffer.append(", artifactName = " + artifactName);
- buffer.append(", active = " + published);
- buffer.append("]");
- return buffer.toString();
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getServiceUUID() {
- return serviceUUID;
- }
-
- public void setServiceUUID(String serviceUUID) {
- this.serviceUUID = serviceUUID;
- }
-
- public String getDistributionId() {
- return distributionId;
- }
-
- public void setDistributionId(String distributionId) {
- this.distributionId = distributionId;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public String getServiceDescription() {
- return serviceDescription;
- }
-
- public void setServiceDescription(String serviceDescription) {
- this.serviceDescription = serviceDescription;
- }
-
- public String getResourceUUID() {
- return resourceUUID;
- }
-
- public void setResourceUUID(String resourceUUID) {
- this.resourceUUID = resourceUUID;
- }
-
- public String getResourceInstanceName() {
- return resourceInstanceName;
- }
-
- public void setResourceInstanceName(String resourceInstanceName) {
- this.resourceInstanceName = resourceInstanceName;
- }
-
- public String getResourceName() {
- return resourceName;
- }
-
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- public String getResourceVersion() {
- return resourceVersion;
- }
-
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-
- public String getResourceType() {
- return resourceType;
- }
-
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
- }
-
- public String getArtifactUUId() {
- return artifactUUId;
- }
-
- public void setArtifactUUId(String artifactUUId) {
- this.artifactUUId = artifactUUId;
- }
-
- public String getArtifactType() {
- return artifactType;
- }
-
- public void setArtifactType(String artifactType) {
- this.artifactType = artifactType;
- }
-
- public String getArtifactVersion() {
- return artifactVersion;
- }
-
- public void setArtifactVersion(String artifactVersion) {
- this.artifactVersion = artifactVersion;
- }
-
- public String getArtifactDescription() {
- return artifactDescription;
- }
-
- public void setArtifactDescription(String artifactDescription) {
- this.artifactDescription = artifactDescription;
- }
-
- public Integer getInternalVersion() {
- return internalVersion;
- }
-
- public void setInternalVersion(Integer internalVersion) {
- this.internalVersion = internalVersion;
- }
-
- public Date getCreatedDate() {
- return createdDate;
- }
-
- public void setCreatedDate(Date createdDate) {
- this.createdDate = createdDate;
- }
-
- public String getArtifactName() {
- return artifactName;
- }
-
- public void setArtifactName(String artifactName) {
- this.artifactName = artifactName;
- }
-
- public String getPublished() {
- return published;
- }
-
- public void setPublished(String published) {
- this.published = published;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
- public String getTags() {
- return tags;
- }
-
- public void setTags(String tags) {
- this.tags = tags;
- }
-
- public List<ConfigModelContent> getConfigModelContents() {
- return configModelContents;
- }
-
- public void setConfigModelContents(List<ConfigModelContent> configModelContents) {
- this.configModelContents = configModelContents;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModelContent.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModelContent.java deleted file mode 100644 index cba2570ea..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModelContent.java +++ /dev/null @@ -1,91 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.domain;
-
-import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-public class ConfigModelContent {
-
- private Long id;
- private String name;
- private String contentType;
- private String description;
- private String content;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- private Date creationDate = new Date();
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder("[");
- buffer.append("id = " + id);
- buffer.append(", name = " + name);
- buffer.append(", type = " + contentType);
- buffer.append("]");
- return buffer.toString();
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public void setContentType(String type) {
- this.contentType = type;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ResourceDictionary.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ResourceDictionary.java deleted file mode 100644 index d97d3a395..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ResourceDictionary.java +++ /dev/null @@ -1,119 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.domain;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.Serializable;
-import java.util.Date;
-
-public class ResourceDictionary implements Serializable {
- private static final long serialVersionUID = 1L;
- private Long id;
- private String name;
- private String dataType;
- private String entrySchema;
- private JsonNode definition;
- private String description;
- private String tags;
- private Date creationDate;
- private String updatedBy;
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder("[");
- buffer.append("name = " + name);
- buffer.append(", dataType = " + dataType);
- buffer.append(", entrySchema = " + entrySchema);
- buffer.append(", creationDate = " + creationDate);
- buffer.append("]");
- return buffer.toString();
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getEntrySchema() {
- return entrySchema;
- }
-
- public void setEntrySchema(String entrySchema) {
- this.entrySchema = entrySchema;
- }
-
- public JsonNode getDefinition() {
- return definition;
- }
-
- public void setDefinition(JsonNode definition) {
- this.definition = definition;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getTags() {
- return tags;
- }
-
- public void setTags(String tags) {
- this.tags = tags;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNode.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNode.java deleted file mode 100644 index 92ccee223..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNode.java +++ /dev/null @@ -1,41 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-public interface ComponentNode extends SvcLogicJavaPlugin {
-
- public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException;
-
- public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException;
-
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException;
-
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException;
-
- public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException;
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeDelegate.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeDelegate.java deleted file mode 100644 index 4b9743fb7..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeDelegate.java +++ /dev/null @@ -1,42 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ComponentNodeDelegate implements SvcLogicJavaPlugin {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ComponentNodeDelegate.class);
- private ComponentNodeService componentNodeService;
-
- public ComponentNodeDelegate(ComponentNodeService componentNodeService) {
- logger.info("{} Constructor Initiated", "ComponentNodeDelegate");
- this.componentNodeService = componentNodeService;
-
- }
-
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
- this.componentNodeService.process(inParams, ctx, null);
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeService.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeService.java deleted file mode 100644 index 12efc6569..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeService.java +++ /dev/null @@ -1,32 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public interface ComponentNodeService {
-
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException;
-
- public ComponentNode getComponentNodeInterface(String pluginName, String componentType) throws SvcLogicException;
-
- public ComponentNode getComponentNode(SvcLogicContext ctx, String selectorName) throws SvcLogicException;
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeServiceImpl.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeServiceImpl.java deleted file mode 100644 index df0dae10f..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeServiceImpl.java +++ /dev/null @@ -1,174 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.data.adaptor.DataAdaptorConstants;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.InterfaceAssignment;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ComponentNodeServiceImpl implements ComponentNodeService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ComponentNodeServiceImpl.class);
-
- private BundleContext bcontext;
- private ConfigResourceService configResourceService;
- private ConfigModelService configModelService;
-
- public ComponentNodeServiceImpl(BundleContext blueprintBundleContext, ConfigResourceService configResourceService,
- ConfigRestAdaptorService configRestAdaptorService) {
- logger.info("{} Constructor Initiated", "ComponentNodeServiceImpl");
- this.bcontext = blueprintBundleContext;
- this.configResourceService = configResourceService;
- this.configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- String requestId = null;
- String selector = null;
- try {
- selector = inParams.get(ConfigModelConstant.PROPERTY_SELECTOR);
- requestId = ctx.getAttribute(ConfigModelConstant.PROPERTY_REQUEST_ID);
-
- logger.info("Component execution started with input params ({})", inParams);
- configModelService.assignInParamsFromModel(ctx, inParams);
-
- String currentInterface = inParams.get(ConfigModelConstant.PROPERTY_CURRENT_INTERFACE);
- String currentNodeDerivedFrom = inParams.get(ConfigModelConstant.PROPERTY_CURRENT_NODETYPE_DERIVED_FROM);
-
- configResourceService.save(new TransactionLog(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_COMPONENT,
- String.format("Executing Component (%s) derived from (%s) with Params : (%s) ", currentInterface,
- currentNodeDerivedFrom, inParams)));
-
- ComponentNode handler = getComponentNodeInterface(currentInterface, currentNodeDerivedFrom);
-
- if (handler == null) {
- throw new SvcLogicException(
- String.format("Could not find Component for Interface %s", currentInterface));
- }
- if (componentContext == null) {
- componentContext = new HashMap<>();
- }
-
- logger.debug("Executing component ({})", currentInterface);
-
- if (handler.preCondition(inParams, ctx, componentContext)) {
- handler.preProcess(inParams, ctx, componentContext);
- handler.process(inParams, ctx, componentContext);
- handler.postProcess(inParams, ctx, componentContext);
- logger.debug("Executed component ({}) successfully.", currentInterface);
- configResourceService
- .save(new TransactionLog(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_COMPONENT,
- String.format("Component (%s) executed successfully. ", currentInterface)));
-
- ctx.setAttribute(selector + ConfigModelConstant.PROPERTY_DOT_STATUS,
- ConfigModelConstant.STATUS_SUCCESS);
- } else {
- logger.info("Skipped component execution ({})", handler.getClass());
- configResourceService
- .save(new TransactionLog(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_COMPONENT,
- String.format("Skipping component (%s) execution.", handler.getClass())));
- ctx.setAttribute(selector + ConfigModelConstant.PROPERTY_DOT_STATUS,
- ConfigModelConstant.STATUS_SKIPPED);
- }
-
- configModelService.assignOutParamsFromModel(ctx, inParams);
- ctx.setStatus(ConfigModelConstant.STATUS_SUCCESS);
- } catch (Exception e) {
- logger.error(String.format("Failed in component (%s) execution for request id (%s) with error %s", selector,
- requestId, e.getMessage()));
- configResourceService.save(new TransactionLog(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_COMPONENT,
- String.format("Failed in component (%s) execution for request id (%s) with error %s", selector,
- requestId, e.getMessage())));
-
- ctx.setAttribute(selector + ConfigModelConstant.PROPERTY_DOT_STATUS, ConfigModelConstant.STATUS_FAILURE);
- ctx.setAttribute(selector + ConfigModelConstant.PROPERTY_DOT_ERROR_MESSAGE, e.getMessage());
- ctx.setAttribute(ConfigModelConstant.PROPERTY_ERROR_MESSAGE, e.getMessage());
- ctx.setStatus(ConfigModelConstant.STATUS_FAILURE);
- throw new SvcLogicException(e.getMessage(), e);
- }
- }
-
- @Override
- public ComponentNode getComponentNodeInterface(String pluginName, String componentType) throws SvcLogicException {
-
- logger.info("Searching for component node plugin ({}) component type ({})", pluginName, componentType);
-
- if (StringUtils.isBlank(pluginName)) {
- throw new SvcLogicException(
- String.format("Could not get Interface Name from Service Template : %s ", pluginName));
- }
-
- pluginName = pluginName.replace("-", ".");
- ServiceReference sref = bcontext.getServiceReference(pluginName);
-
- if (sref == null) {
- throw new SvcLogicException(
- String.format("Could not find service reference object for plugin %s", pluginName));
- }
- return (ComponentNode) bcontext.getService(sref);
- }
-
- @Override
- public ComponentNode getComponentNode(SvcLogicContext ctx, String componentKey) throws SvcLogicException {
-
- if (StringUtils.isBlank(componentKey)) {
- logger.warn("Can't get node template content for a component key ({})", componentKey);
- return null;
- }
-
- String nodeTemplateContent = ctx.getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + componentKey);
- logger.info("Processing component template : ({})", nodeTemplateContent);
-
- if (StringUtils.isBlank(nodeTemplateContent)) {
- logger.warn("Couldn't get node template content for component key ({})", componentKey);
- return null;
- }
-
- NodeTemplate nodeTemplate = TransformationUtils.readValue(nodeTemplateContent, NodeTemplate.class);
- if (nodeTemplate == null || StringUtils.isBlank(nodeTemplate.getType())) {
- logger.warn("Failed to convert content ({}) to node template.", nodeTemplateContent);
- return null;
- }
-
- ComponentNode componentNode = null;
- for (Map.Entry<String, InterfaceAssignment> nodeTemplateInterface : nodeTemplate.getInterfaces().entrySet()) {
- if (nodeTemplateInterface != null && nodeTemplateInterface.getValue() != null) {
- String pluginName = nodeTemplateInterface.getKey();
- componentNode = getComponentNodeInterface(pluginName, ConfigModelConstant.MODEL_TYPE_NODE_COMPONENT);
- }
- }
- return componentNode;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigBlueprintService.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigBlueprintService.java deleted file mode 100644 index 701dffce9..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigBlueprintService.java +++ /dev/null @@ -1,100 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.domain.ConfigModel;
-import org.onap.ccsdk.features.model.domain.ConfigModelContent;
-import org.onap.ccsdk.features.model.utils.PrepareContextUtils;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigBlueprintService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigBlueprintService.class);
-
- private final ConfigRestAdaptorService configRestAdaptorService;
-
- public ConfigBlueprintService(ConfigRestAdaptorService configRestAdaptorService) {
- this.configRestAdaptorService = configRestAdaptorService;
- }
-
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateName,
- String serviceTemplateVersion) throws SvcLogicException {
- try {
- PrepareContextUtils prepareContextUtils = new PrepareContextUtils();
- String serviceTemplateContent = getServiceModel(context, serviceTemplateName, serviceTemplateVersion);
-
- if (StringUtils.isBlank(serviceTemplateContent)) {
- throw new SvcLogicException(String.format("Failed to get the Service Template (%s), version (%s)",
- serviceTemplateName, serviceTemplateVersion));
- }
-
- return prepareContextUtils.prepareContext(context, input, serviceTemplateContent);
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage(), e);
- }
- }
-
- @SuppressWarnings("squid:S3776")
- private String getServiceModel(Map<String, String> context, String serviceTemplateName,
- String serviceTemplateVersion) throws SvcLogicException, ConfigRestAdaptorException {
- String content = null;
-
- logger.info("Getting service template ({}) of version ({}) ", serviceTemplateName, serviceTemplateVersion);
-
- String path = "config-model/by-name/" + serviceTemplateName + "/version/" + serviceTemplateVersion;
-
- ConfigModel configModel = configRestAdaptorService
- .getResource(ConfigRestAdaptorConstants.SELECTOR_MODEL_SERVICE, path, ConfigModel.class);
-
- if (configModel == null || configModel.getConfigModelContents() == null
- || configModel.getConfigModelContents().isEmpty()) {
- throw new SvcLogicException("Service template model is missing for service template name ("
- + serviceTemplateName + "), service template version (" + serviceTemplateVersion + ") ");
- } else {
- if (configModel.getPublished() == null || !configModel.getPublished().equalsIgnoreCase("Y")) {
- throw new SvcLogicException(String.format(
- "Service template model is not published for service template (%s) ", serviceTemplateName));
- }
-
- List<ConfigModelContent> configModelContents = configModel.getConfigModelContents();
- for (ConfigModelContent configModelContent : configModelContents) {
- if (configModelContent != null) {
- if (ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON.equals(configModelContent.getContentType())) {
- content = configModelContent.getContent();
- } else if (ConfigModelConstant.MODEL_CONTENT_TYPE_TEMPLATE
- .equals(configModelContent.getContentType())) {
- context.put(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + configModelContent.getName()
- + ".content", configModelContent.getContent());
- }
- }
- }
- logger.trace("Service model data : {} ", content);
- }
- return content;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelNode.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelNode.java deleted file mode 100644 index cb652bd68..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelNode.java +++ /dev/null @@ -1,24 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-public class ConfigModelNode implements SvcLogicJavaPlugin {
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelService.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelService.java deleted file mode 100644 index 38ade14de..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelService.java +++ /dev/null @@ -1,55 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.List;
-import java.util.Map;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public interface ConfigModelService {
-
- public Boolean validateServiceTemplate(ServiceTemplate serviceTemplate) throws SvcLogicException;
-
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateName,
- String serviceTemplateVersion) throws SvcLogicException;
-
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateContent)
- throws SvcLogicException;
-
- public Map<String, String> convertJson2properties(Map<String, String> context, String jsonContent,
- List<String> blockKeys) throws SvcLogicException;
-
- public Map<String, String> convertServiceTemplate2Properties(String serviceTemplateContent,
- final Map<String, String> context) throws SvcLogicException;
-
- public Map<String, String> convertServiceTemplate2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) throws SvcLogicException;
-
- public SvcLogicContext assignInParamsFromModel(final SvcLogicContext context, final Map<String, String> inParams)
- throws SvcLogicException;
-
- public SvcLogicContext assignOutParamsFromModel(final SvcLogicContext context, final Map<String, String> inParams)
- throws SvcLogicException;
-
- public String getNodeTemplateContent(final SvcLogicContext context, String templateName) throws SvcLogicException;
-
- public String getNodeTemplateMapping(final SvcLogicContext context, String templateName) throws SvcLogicException;
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelServiceImpl.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelServiceImpl.java deleted file mode 100644 index 231f76af9..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelServiceImpl.java +++ /dev/null @@ -1,244 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.CapabilityAssignment;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.utils.NodePropertyUtils;
-import org.onap.ccsdk.features.model.utils.PrepareContextUtils;
-import org.onap.ccsdk.features.model.utils.ServiceTemplateUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.model.validator.ServiceTemplateValidator;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigModelServiceImpl implements ConfigModelService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigModelServiceImpl.class);
- private static final String CLASS_NAME = "ConfigModelServiceImpl";
-
- private final ConfigRestAdaptorService configRestAdaptorService;
-
- public ConfigModelServiceImpl(ConfigRestAdaptorService configRestAdaptorService) {
- logger.info("{} Constuctor Initated...", CLASS_NAME);
- this.configRestAdaptorService = configRestAdaptorService;
- }
-
- @Override
- public Boolean validateServiceTemplate(ServiceTemplate serviceTemplate) throws SvcLogicException {
- try {
- ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator();
- return serviceTemplateValidator.validateServiceTemplate(serviceTemplate);
- } catch (ConfigModelException e) {
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @Override
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateName,
- String serviceTemplateVersion) throws SvcLogicException {
-
- ConfigBlueprintService configBlueprintService = new ConfigBlueprintService(configRestAdaptorService);
- return configBlueprintService.prepareContext(context, input, serviceTemplateName, serviceTemplateVersion);
- }
-
- @Override
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateContent)
- throws SvcLogicException {
- try {
- PrepareContextUtils prepareContextUtils = new PrepareContextUtils();
- return prepareContextUtils.prepareContext(context, input, serviceTemplateContent);
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @Override
- public Map<String, String> convertJson2properties(Map<String, String> context, String jsonContent,
- List<String> blockKeys) throws SvcLogicException {
- try {
- return TransformationUtils.convertJson2Properties(context, jsonContent, blockKeys);
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @Override
- public Map<String, String> convertServiceTemplate2Properties(String serviceTemplateContent,
- final Map<String, String> context) throws SvcLogicException {
- try {
- ServiceTemplateUtils serviceTemplateUtils = new ServiceTemplateUtils();
- return serviceTemplateUtils.convertServiceTemplate2Properties(serviceTemplateContent, context);
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @Override
- public Map<String, String> convertServiceTemplate2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) throws SvcLogicException {
- try {
- ServiceTemplateUtils serviceTemplateUtils = new ServiceTemplateUtils();
- return serviceTemplateUtils.convertServiceTemplate2Properties(serviceTemplate, context);
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @SuppressWarnings("squid:S3776")
- @Override
- public SvcLogicContext assignInParamsFromModel(final SvcLogicContext context, final Map<String, String> inParams)
- throws SvcLogicException {
- logger.debug("Processing component input param ({})", inParams);
- try {
- if (context != null && inParams != null && inParams.containsKey(ConfigModelConstant.PROPERTY_SELECTOR)) {
- String componentKey = inParams.get(ConfigModelConstant.PROPERTY_SELECTOR);
- if (StringUtils.isNotBlank(componentKey)) {
- String nodeTemplateContent =
- context.getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + componentKey);
- logger.info("Processing node template content ({})", nodeTemplateContent);
- if (StringUtils.isNotBlank(nodeTemplateContent)) {
- NodeTemplate nodeTemplate =
- TransformationUtils.readValue(nodeTemplateContent, NodeTemplate.class);
- if (nodeTemplate != null && StringUtils.isNotBlank(nodeTemplate.getType())) {
- String nodeTypeContent = context
- .getAttribute(ConfigModelConstant.PROPERTY_NODE_TYPES_DOT + nodeTemplate.getType());
- NodeType nodetype = TransformationUtils.readValue(nodeTypeContent, NodeType.class);
- if (nodetype != null) {
- inParams.put(ConfigModelConstant.PROPERTY_CURRENT_NODETYPE_DERIVED_FROM,
- nodetype.getDerivedFrom());
- NodePropertyUtils nodePropertyUtils = new NodePropertyUtils(context, inParams);
- nodePropertyUtils.assignInParamsFromModel(nodetype, nodeTemplate);
- } else {
- throw new SvcLogicException(
- String.format("Failed to get node type (%s) for node template (%s).",
- nodeTemplate.getType(), componentKey));
- }
-
- } else {
- throw new SvcLogicException(String
- .format("Failed to convert content (%s) to node template.", nodeTemplateContent));
- }
- } else {
- throw new SvcLogicException(String
- .format("Couldn't get node template content for component key (%s).", componentKey));
- }
- } else {
- throw new SvcLogicException(
- String.format("Couldn't get component key (prefix) from inparam (%s)", inParams));
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- return context;
- }
-
- @Override
- public SvcLogicContext assignOutParamsFromModel(final SvcLogicContext context, final Map<String, String> inParams)
- throws SvcLogicException {
- try {
- if (context != null && inParams != null && inParams.containsKey(ConfigModelConstant.PROPERTY_SELECTOR)) {
- String componentKey = inParams.get(ConfigModelConstant.PROPERTY_SELECTOR);
- logger.info("Processing component output for prefix key ({})", componentKey);
- if (StringUtils.isNotBlank(componentKey)) {
- String nodeTemplateContent =
- context.getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + componentKey);
- if (StringUtils.isNotBlank(nodeTemplateContent)) {
- NodeTemplate nodeTemplate =
- TransformationUtils.readValue(nodeTemplateContent, NodeTemplate.class);
- if (nodeTemplate != null && StringUtils.isNotBlank(nodeTemplate.getType())) {
- String nodeTypeContent = context
- .getAttribute(ConfigModelConstant.PROPERTY_NODE_TYPES_DOT + nodeTemplate.getType());
- NodeType nodetype = TransformationUtils.readValue(nodeTypeContent, NodeType.class);
- NodePropertyUtils nodePropertyUtils = new NodePropertyUtils(context, inParams);
- nodePropertyUtils.assignOutParamsFromModel(nodetype, nodeTemplate);
- }
- }
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- return context;
- }
-
- @Override
- public String getNodeTemplateContent(final SvcLogicContext context, String templateName) throws SvcLogicException {
- String content = null;
- try {
- if (context != null && StringUtils.isNotBlank(templateName)) {
- logger.info("Processing Artifact Node Template for content : ({})", templateName);
- content = context
- .getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + templateName + ".content");
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- return content;
- }
-
- @SuppressWarnings("squid:S3776")
- @Override
- public String getNodeTemplateMapping(final SvcLogicContext context, String templateName) throws SvcLogicException {
- String mapping = null;
- try {
- if (context != null && StringUtils.isNotBlank(templateName)) {
- logger.info("Processing artifact node template for mapping : ({})", templateName);
- if (StringUtils.isNotBlank(templateName)) {
- String nodeTemplateContent =
- context.getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + templateName);
- if (StringUtils.isNotBlank(nodeTemplateContent)) {
-
- NodeTemplate nodeTemplate =
- TransformationUtils.readValue(nodeTemplateContent, NodeTemplate.class);
-
- if (nodeTemplate != null && nodeTemplate.getCapabilities() != null && nodeTemplate
- .getCapabilities().containsKey(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING)) {
-
- CapabilityAssignment capability =
- nodeTemplate.getCapabilities().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
- if (capability.getProperties() != null) {
- List mappingList = (List) capability.getProperties()
- .get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
- if (mappingList != null) {
- mapping = TransformationUtils.getJson(mappingList);
- }
-
- }
- }
- }
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- return mapping;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ExpressionUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ExpressionUtils.java deleted file mode 100644 index cdc8fc330..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ExpressionUtils.java +++ /dev/null @@ -1,191 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class ExpressionUtils {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ExpressionUtils.class);
-
- private final SvcLogicContext context;
- private final Map<String, String> inParams;
-
- public ExpressionUtils(final SvcLogicContext context, final Map<String, String> inParams) {
- this.context = context;
- this.inParams = inParams;
- }
-
- public void populatePropertAssignmentsWithPrefix(String prefix, Map<String, PropertyDefinition> typeProperties,
- Map<String, Object> templateProperties) throws IOException {
- if (typeProperties != null && templateProperties != null) {
- ObjectMapper mapper = new ObjectMapper();
- String templatejsonContent = mapper.writeValueAsString(templateProperties);
- logger.debug("Expression inputs ({}).", templatejsonContent);
-
- JsonNode rootArray = mapper.readTree(templatejsonContent);
- processJsonExpression(rootArray);
- if (rootArray != null) {
- Map<String, String> prefixParams = new HashMap<>();
- TransformationUtils.convertJson2RootProperties(prefixParams, rootArray);
- logger.info("Resolved inputs ({}).", rootArray);
- prefixParams.forEach((key, value) -> {
- this.inParams.put(prefix + "." + key, value);
- });
- }
- }
- }
-
- public void populatePropertAssignments(Map<String, PropertyDefinition> typeProperties,
- Map<String, Object> templateProperties) throws IOException {
- if (typeProperties != null && templateProperties != null) {
- ObjectMapper mapper = new ObjectMapper();
- String templatejsonContent = mapper.writeValueAsString(templateProperties);
- logger.info("Expression inputs ({}).", templatejsonContent);
-
- JsonNode rootArray = mapper.readTree(templatejsonContent);
- processJsonExpression(rootArray);
- TransformationUtils.convertJson2RootProperties(this.inParams, rootArray);
- logger.info("Resolved inputs ({}).", rootArray);
-
- }
- }
-
- public void populateOutPropertAssignments(Map<String, PropertyDefinition> typeProperties,
- Map<String, Object> templateProperties) throws IOException {
- if (typeProperties != null && templateProperties != null) {
- ObjectMapper mapper = new ObjectMapper();
- String templatejsonContent = mapper.writeValueAsString(templateProperties);
- logger.info("Expression outputs ({}).", templatejsonContent);
-
- JsonNode rootArray = mapper.readTree(templatejsonContent);
- processJsonExpression(rootArray);
- logger.info("Resolved outputs ({}).", rootArray);
- }
- }
-
- public void processJsonExpression(JsonNode rootArray) throws IOException {
- if (rootArray != null) {
- Iterator<Map.Entry<String, JsonNode>> fields = rootArray.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- processJsonNode(rootArray, entry.getKey(), entry.getValue());
- }
- }
- }
-
- private void processJsonNode(JsonNode parentNode, String nodeName, JsonNode node) throws IOException {
- if (node == null) {
- // Do Nothing
- } else if (node.isArray()) {
- String[] a = new String[node.size()];
-
- for (int i = 0; i < a.length; i++) {
- processJsonNode(null, null, node.get(i));
- }
- } else if (node.isObject()) {
-
- Iterator<Map.Entry<String, JsonNode>> fields = node.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- processJsonNode(node, entry.getKey(), entry.getValue());
- }
- } else if (node.isTextual()) {
- boolean expression = checkExpressionContent(node.asText());
- if (expression) {
- processExpressionContent(parentNode, nodeName, node);
- }
- }
- }
-
- private boolean checkExpressionContent(String content) {
- return (StringUtils.isNotBlank(content) && (content.contains(ConfigModelConstant.EXPRESSION_GET_INPUT)
- || content.contains(ConfigModelConstant.EXPRESSION_GET_ATTRIBUTE)
- || content.contains(ConfigModelConstant.EXPRESSION_SET_VALUE)));
- }
-
- @SuppressWarnings("squid:S3776")
- private void processExpressionContent(JsonNode parentNode, String nodeName, JsonNode node) throws IOException {
-
- if (node != null && StringUtils.isNotBlank(node.asText())) {
- String content = node.asText();
- ObjectMapper mapper = new ObjectMapper();
- Map<String, String> expressionMap = mapper.readValue(content, Map.class);
- boolean isExpressionNode = false;
-
- if (expressionMap != null) {
- String expressionValue = null;
- String expressionKey = null;
-
- if (expressionMap.containsKey(ConfigModelConstant.EXPRESSION_GET_INPUT)) {
- isExpressionNode = true;
- expressionKey = expressionMap.get(ConfigModelConstant.EXPRESSION_GET_INPUT);
- expressionValue = resolveGetInputExpression(expressionKey, context);
- if (expressionValue == null) {
- expressionValue = resolveGetInputExpression("inputs." + expressionKey + ".default", context);
- }
- } else if (expressionMap.containsKey(ConfigModelConstant.EXPRESSION_GET_ATTRIBUTE)) {
- isExpressionNode = true;
- expressionValue =
- context.getAttribute(expressionMap.get(ConfigModelConstant.EXPRESSION_GET_ATTRIBUTE));
- } else if (expressionMap.containsKey(ConfigModelConstant.EXPRESSION_SET_VALUE)) {
- isExpressionNode = true;
- expressionKey = expressionMap.get(ConfigModelConstant.EXPRESSION_SET_VALUE);
- expressionValue = context.getAttribute(expressionKey);
-
- if (StringUtils.isNotBlank(expressionKey)) {
- context.setAttribute(expressionKey, expressionValue);
- }
- }
-
- if (isExpressionNode && expressionValue == null) {
- ((ObjectNode) parentNode).put(nodeName, "");
- }
- if (StringUtils.isNotBlank(expressionValue)) {
- if (expressionValue.trim().startsWith("[") || expressionValue.trim().startsWith("{")) {
- JsonNode valueNode = mapper.readTree(expressionValue);
- ((ObjectNode) parentNode).put(nodeName, valueNode);
- } else {
- ((ObjectNode) parentNode).put(nodeName, expressionValue);
- }
- }
- logger.debug("expression ({}), expression key ({}), expression Value ({})", expressionMap,
- expressionKey, expressionValue);
- }
- }
- }
-
- private String resolveGetInputExpression(String key, final SvcLogicContext context) {
- if (StringUtils.isNotBlank(key) && context != null) {
- return context.getAttribute(key);
- }
- return null;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonParserUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonParserUtils.java deleted file mode 100644 index d9cc3507f..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonParserUtils.java +++ /dev/null @@ -1,59 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import static com.jayway.jsonpath.JsonPath.using;
-import java.util.List;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.jayway.jsonpath.Configuration;
-import com.jayway.jsonpath.Option;
-import com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider;
-import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider;
-
-@SuppressWarnings("squid:S1118")
-public class JsonParserUtils {
-
- public static final Configuration JACKSON_JSON_NODE_CONFIGURATION = Configuration.builder()
- .mappingProvider(new JacksonMappingProvider()).jsonProvider(new JacksonJsonNodeJsonProvider()).build();
-
- public static final Configuration PATH_CONFIGURATION = Configuration.builder().options(Option.AS_PATH_LIST).build();
-
- public static List<String> paths(String jsonContent, String expression) {
- return using(PATH_CONFIGURATION).parse(jsonContent).read(expression);
- }
-
- public static List<String> paths(JsonNode jsonNode, String expression) {
- return paths(jsonNode.toString(), expression);
- }
-
- public static JsonNode parse(String jsonContent, String expression) {
- return using(JACKSON_JSON_NODE_CONFIGURATION).parse(jsonContent).read(expression);
- }
-
- public static JsonNode parse(JsonNode jsonNode, String expression) {
- return parse(jsonNode.toString(), expression);
- }
-
- public static JsonNode parseNSet(String jsonContent, String expression, JsonNode value) {
- return using(JACKSON_JSON_NODE_CONFIGURATION).parse(jsonContent).set(expression, value).json();
- }
-
- public static JsonNode parseNSet(JsonNode jsonNode, String expression, JsonNode valueNode) {
- return parseNSet(jsonNode.toString(), expression, valueNode);
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonUtils.java deleted file mode 100644 index 2db4b4875..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonUtils.java +++ /dev/null @@ -1,109 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import org.onap.ccsdk.features.model.ValidTypes;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.NullNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * JsonUtils.java Purpose: Provide Configuration Generator JsonUtils Information
- *
- * @version 1.0
- */
-public class JsonUtils {
-
- private JsonUtils() {
-
- }
-
- public static void populatePrimitiveValues(String key, Object value, String primitiveType, ObjectNode objectNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equals(primitiveType)) {
- objectNode.put(key, (Boolean) value);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(primitiveType)) {
- objectNode.put(key, (Integer) value);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equals(primitiveType)) {
- objectNode.put(key, (Float) value);
- } else if (ValidTypes.DATA_TYPE_TIMESTAMP.equals(primitiveType)) {
- objectNode.put(key, (String) value);
- } else {
- objectNode.put(key, (String) value);
- }
- }
-
- public static void populatePrimitiveValues(Object value, String primitiveType, ArrayNode objectNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equals(primitiveType)) {
- objectNode.add((Boolean) value);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(primitiveType)) {
- objectNode.add((Integer) value);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equals(primitiveType)) {
- objectNode.add((Float) value);
- } else if (ValidTypes.DATA_TYPE_TIMESTAMP.equals(primitiveType)) {
- objectNode.add((String) value);
- } else {
- objectNode.add((String) value);
- }
- }
-
- public static void populatePrimitiveDefaultValues(String key, String primitiveType, ObjectNode objectNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equals(primitiveType)) {
- objectNode.put(key, false);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(primitiveType)) {
- objectNode.put(key, 0);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equals(primitiveType)) {
- objectNode.put(key, 0.0);
- } else {
- objectNode.put(key, "");
- }
- }
-
- public static void populatePrimitiveDefaultValuesForArrayNode(String primitiveType, ArrayNode arrayNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equals(primitiveType)) {
- arrayNode.add(false);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(primitiveType)) {
- arrayNode.add(0);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equals(primitiveType)) {
- arrayNode.add(0.0);
- } else {
- arrayNode.add("");
- }
- }
-
- public static void populateJsonNodeValues(String key, JsonNode nodeValue, String type, ObjectNode objectNode) {
- if (nodeValue == null || nodeValue instanceof NullNode) {
- objectNode.put(key, nodeValue);
- } else if (ValidTypes.getPrimitivePropertType().contains(type)) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equals(type)) {
- objectNode.put(key, nodeValue.asBoolean());
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(type)) {
- objectNode.put(key, nodeValue.asInt());
- } else if (ValidTypes.DATA_TYPE_FLOAT.equals(type)) {
- objectNode.put(key, nodeValue.floatValue());
- } else if (ValidTypes.DATA_TYPE_TIMESTAMP.equals(type)) {
- objectNode.put(key, nodeValue.asText());
- } else {
- objectNode.put(key, nodeValue.asText());
- }
- } else {
- objectNode.set(key, nodeValue);
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/NodePropertyUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/NodePropertyUtils.java deleted file mode 100644 index 0feb8b5a7..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/NodePropertyUtils.java +++ /dev/null @@ -1,187 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.CapabilityAssignment;
-import org.onap.ccsdk.features.model.data.CapabilityDefinition;
-import org.onap.ccsdk.features.model.data.InterfaceAssignment;
-import org.onap.ccsdk.features.model.data.InterfaceDefinition;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.OperationAssignment;
-import org.onap.ccsdk.features.model.data.OperationDefinition;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class NodePropertyUtils {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(NodePropertyUtils.class);
- private final SvcLogicContext context;
- private final Map<String, String> inParams;
- private ExpressionUtils jsonExpressionUtils;
-
- public NodePropertyUtils(final SvcLogicContext context, final Map<String, String> inParams) {
- this.context = context;
- this.inParams = inParams;
- jsonExpressionUtils = new ExpressionUtils(this.context, this.inParams);
- }
-
- @SuppressWarnings("squid:S3776")
- public SvcLogicContext assignInParamsFromModel(NodeType nodetype, NodeTemplate nodeTemplate) throws IOException {
- if (nodeTemplate != null) {
- Map<String, Object> inputs = null;
- // Populate the Type inputs
- Map<String, PropertyDefinition> nodeTypeinputs = new HashMap<>();
- for (Map.Entry<String, InterfaceDefinition> nodeTypeInterface : nodetype.getInterfaces().entrySet()) {
- if (nodeTypeInterface != null && nodeTypeInterface.getValue() != null) {
- for (Map.Entry<String, OperationDefinition> nodeTypeOperation : nodeTypeInterface.getValue()
- .getOperations().entrySet()) {
- nodeTypeinputs = nodeTypeOperation.getValue().getInputs();
- logger.trace("Populated node type input ({}).", nodeTypeinputs);
- }
- }
- }
-
- if (!nodeTypeinputs.isEmpty()) {
- // Populate the Template inputs
- for (Map.Entry<String, InterfaceAssignment> nodeTemplateInterface : nodeTemplate.getInterfaces()
- .entrySet()) {
- if (nodeTemplateInterface != null && nodeTemplateInterface.getValue() != null) {
- this.inParams.put(ConfigModelConstant.PROPERTY_CURRENT_INTERFACE,
- nodeTemplateInterface.getKey());
- for (Map.Entry<String, OperationAssignment> nodeTemplateOperation : nodeTemplateInterface
- .getValue().getOperations().entrySet()) {
- if (nodeTemplateOperation != null) {
- this.inParams.put(ConfigModelConstant.PROPERTY_CURRENT_OPERATION,
- nodeTemplateOperation.getKey());
- if (StringUtils.isNotBlank(nodeTemplateOperation.getValue().getImplementation())) {
- this.inParams.put(ConfigModelConstant.PROPERTY_CURRENT_IMPLEMENTATION,
- nodeTemplateOperation.getValue().getImplementation());
- }
- inputs = nodeTemplateOperation.getValue().getInputs();
- logger.trace("Populated node template input({}).", inputs);
- // Assign Default Values & Types
- jsonExpressionUtils.populatePropertAssignments(nodeTypeinputs, inputs);
- }
- }
- }
- }
- }
-
- if (nodeTemplate.getRequirements() != null && !nodeTemplate.getRequirements().isEmpty()) {
- assignInParamsFromRequirementModel(nodeTemplate, context, inParams);
- }
- }
- return context;
- }
-
- @SuppressWarnings("squid:S3776")
- public SvcLogicContext assignOutParamsFromModel(NodeType nodetype, NodeTemplate nodeTemplate) throws IOException {
-
- if (nodeTemplate != null) {
- Map<String, Object> outputs = null;
- // Populate the Type Outputs
- Map<String, PropertyDefinition> nodeTypeOutputs = new HashMap<>();
-
- for (Map.Entry<String, InterfaceDefinition> nodeTypeInterface : nodetype.getInterfaces().entrySet()) {
- if (nodeTypeInterface != null && nodeTypeInterface.getValue() != null) {
- for (Map.Entry<String, OperationDefinition> nodeTypeOperation : nodeTypeInterface.getValue()
- .getOperations().entrySet()) {
- nodeTypeOutputs = nodeTypeOperation.getValue().getOutputs();
- logger.info("Populated node type output ({}).", nodeTypeOutputs);
- }
- }
- }
-
- if (!nodeTypeOutputs.isEmpty()) {
- // Populate the Template Outputs
- for (Map.Entry<String, InterfaceAssignment> nodeTemplateInterface : nodeTemplate.getInterfaces()
- .entrySet()) {
- if (nodeTemplateInterface != null && nodeTemplateInterface.getValue() != null) {
- for (Map.Entry<String, OperationAssignment> nodeTemplateOperation : nodeTemplateInterface
- .getValue().getOperations().entrySet()) {
- outputs = nodeTemplateOperation.getValue().getOutputs();
- logger.info("Populated node template output ({}).", outputs);
- // Assign Default Values & Types
- jsonExpressionUtils.populateOutPropertAssignments(nodeTypeOutputs, outputs);
- // TO DO
- }
- }
- }
- }
- }
- return context;
- }
-
- @SuppressWarnings({"squid:S3776", "squid:S00112"})
- public SvcLogicContext assignInParamsFromRequirementModel(NodeTemplate nodeTemplate, final SvcLogicContext context,
- final Map<String, String> inParams) {
- if (nodeTemplate != null && nodeTemplate.getRequirements() != null && context != null && inParams != null) {
- nodeTemplate.getRequirements().forEach((requrementKey, requirement) -> {
- if (requirement != null && StringUtils.isNotBlank(requirement.getNode())
- && StringUtils.isNotBlank(requirement.getCapability())) {
- String requirementNodeTemplateContent = context
- .getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + requirement.getNode());
- logger.info("Processing requirement node ({}) template content ({}) ", requirement.getNode(),
- requirementNodeTemplateContent);
- NodeTemplate requirementNodeTemplate =
- TransformationUtils.readValue(requirementNodeTemplateContent, NodeTemplate.class);
- if (requirementNodeTemplate != null && requirementNodeTemplate.getCapabilities() != null) {
- String nodeTypeContent = context.getAttribute(
- ConfigModelConstant.PROPERTY_NODE_TYPES_DOT + requirementNodeTemplate.getType());
- NodeType nodeType = TransformationUtils.readValue(nodeTypeContent, NodeType.class);
- if (nodeType != null && nodeType.getCapabilities() != null
- && nodeType.getCapabilities().containsKey(requirement.getCapability())) {
- CapabilityDefinition capabilityDefinition =
- nodeType.getCapabilities().get(requirement.getCapability());
- if (capabilityDefinition != null) {
- CapabilityAssignment capabilityAssignment =
- requirementNodeTemplate.getCapabilities().get(requirement.getCapability());
- try {
- assignInParamsFromCapabilityModel(requrementKey, capabilityDefinition,
- capabilityAssignment, context);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
- }
- }
- });
- }
- return context;
- }
-
- public SvcLogicContext assignInParamsFromCapabilityModel(String requirementName,
- CapabilityDefinition capabilityDefinition, CapabilityAssignment capabilityAssignment,
- final SvcLogicContext context) throws IOException {
- if (capabilityAssignment != null && capabilityAssignment.getProperties() != null) {
- jsonExpressionUtils.populatePropertAssignmentsWithPrefix(requirementName,
- capabilityDefinition.getProperties(), capabilityAssignment.getProperties());
- }
- return context;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/PrepareContextUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/PrepareContextUtils.java deleted file mode 100644 index 34c465cea..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/PrepareContextUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class PrepareContextUtils {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(PrepareContextUtils.class);
-
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateContent)
- throws Exception {
- if (StringUtils.isNotBlank(serviceTemplateContent)) {
-
- if (context == null) {
- context = new HashMap<>();
- }
- if (StringUtils.isNotBlank(input)) {
- TransformationUtils.convertJson2RootProperties(context, input);
- }
-
- String recipeName = context.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- if (StringUtils.isNotBlank(recipeName)) {
- String recipeInputName =
- recipeName.replace(ConfigModelConstant.PROPERTY_RECIPE, ConfigModelConstant.PROPERTY_REQUEST);
- String recipeInput = context.get(recipeInputName);
- if (StringUtils.isNotBlank(recipeInput)) {
- // Un necessary to hold the Recipe Request, It is already in input
- context.remove(recipeInputName);
- context.remove(ConfigModelConstant.PROPERTY_PAYLOAD);
- TransformationUtils.convertJson2RootProperties(context, recipeInput);
- logger.info("Converted recipe ({}) request inputs to context.", recipeName);
- }
- }
-
- ServiceTemplateUtils serviceTemplateUtils = new ServiceTemplateUtils();
- serviceTemplateUtils.convertServiceTemplate2Properties(serviceTemplateContent, context);
- }
- return context;
-
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtils.java deleted file mode 100644 index c68c52c3f..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtils.java +++ /dev/null @@ -1,302 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.NullNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.base.Preconditions;
-
-public class ResourceAssignmentUtils {
-
- private ResourceAssignmentUtils() {
-
- }
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceAssignmentUtils.class);
-
- public static String getArtifactNodeContent(String nodeTemplateName, Map<String, Object> context) {
- Preconditions.checkArgument(StringUtils.isNotBlank(nodeTemplateName),
- "getArtifactNodeContent missing template name");
- return (String) context.get(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateName + ".content");
- }
-
- public static List<ResourceAssignment> getArtifactNodeMapping(String nodeTemplateName,
- Map<String, Object> context) {
- Preconditions.checkArgument(StringUtils.isNotBlank(nodeTemplateName),
- "getArtifactNodeMapping missing template name");
- List<ResourceAssignment> resourceAssignments = null;
- String resourceMappingContent =
- (String) context.get(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateName + ".mapping");
- if (StringUtils.isNotBlank(resourceMappingContent)) {
- resourceAssignments = TransformationUtils.getListfromJson(resourceMappingContent, ResourceAssignment.class);
-
- } else {
- logger.warn("missing mapping content for node template ({})", nodeTemplateName);
- }
- return resourceAssignments;
- }
-
- // Not used Any whre
- public static synchronized void cleanContextTemplateNDictionaryKeys(Map<String, Object> componentContext) {
- String recipeName = (String) componentContext.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- Set<String> removeSet = new HashSet<>();
- componentContext.forEach((key, value) -> {
- if (StringUtils.isNotBlank(key)
- && (key.startsWith(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".")
- || key.startsWith(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + "."))) {
- removeSet.add(key);
- }
- });
- componentContext.keySet().removeAll(removeSet);
- }
-
- public static synchronized Object getDictionaryKeyValue(Map<String, Object> componentContext,
- ResourceAssignment resourceMapping) {
- Object value = null;
- if (resourceMapping != null && componentContext != null) {
- String recipeName = (String) componentContext.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- String dictionaryKeyName = resourceMapping.getDictionaryName();
- value = componentContext
- .get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryKeyName);
- }
- return value;
- }
-
- public static synchronized Object getDictionaryKeyValue(Map<String, Object> componentContext,
- ResourceDefinition resourceDictionary) {
- Object value = null;
- if (resourceDictionary != null && componentContext != null) {
- String recipeName = (String) componentContext.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- String dictionaryKeyName = resourceDictionary.getName();
- value = componentContext
- .get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryKeyName);
- }
- return value;
- }
-
- public static synchronized Object getTemplateKeyValue(Map<String, Object> componentContext,
- ResourceAssignment resourceMapping) {
- Object value = null;
- if (resourceMapping != null && componentContext != null) {
- String recipeName = (String) componentContext.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- String templateKeyName = resourceMapping.getName();
- value = componentContext
- .get(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + "." + templateKeyName);
- }
- return value;
- }
-
- public static synchronized void setResourceDataValue(Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment, Object value) throws ConfigModelException {
-
- if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getName())
- && resourceAssignment.getProperty() != null) {
-
- String recipeName = (String) componentContext.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- String templateKeyName = resourceAssignment.getName();
- String dictionaryKeyName = resourceAssignment.getDictionaryName();
-
- if (StringUtils.isBlank(dictionaryKeyName)) {
- resourceAssignment.setDictionaryName(templateKeyName);
- dictionaryKeyName = templateKeyName;
- logger.warn("Missing dictionary key, setting with template key ({}) as dictionary key ({})",
- templateKeyName, dictionaryKeyName);
- }
- String type = resourceAssignment.getProperty().getType();
- try {
- if (StringUtils.isNotBlank(type)) {
- Object convertedValue = convertResourceValue(type, value);
-
- componentContext.put(
- ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryKeyName,
- convertedValue);
- componentContext.put(
- ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + "." + templateKeyName,
- convertedValue);
-
- logger.trace("Setting Resource Value ({}) for Resource Name ({}) of type ({}) ", convertedValue,
- dictionaryKeyName, type);
-
- resourceAssignment.getProperty().setValue(convertedValue);
- resourceAssignment.setUpdatedDate(new Date());
- resourceAssignment.setUpdatedBy(ConfigModelConstant.USER_SYSTEM);
- resourceAssignment.setStatus(ConfigModelConstant.STATUS_SUCCESS);
- }
- } catch (Exception e) {
- throw new ConfigModelException(String.format(
- "Failed in setting value for template key (%s) and dictionary key (%s) of type (%s) with error message (%s)",
- templateKeyName, dictionaryKeyName, type, e.getMessage()));
- }
- } else {
- throw new ConfigModelException(
- String.format("Failed in setting resource value for resource mapping (%s)", resourceAssignment));
- }
- }
-
- private static Object convertResourceValue(String type, Object value) {
- Object convertedValue = null;
-
- if (value == null || value instanceof NullNode) {
- logger.info("Returning {} value from convertResourceValue", value);
- return null;
- }
-
- if (ValidTypes.getPrimitivePropertType().contains(type)) {
- convertedValue = convertPrimitiveResourceValue(type, value);
- } else {
- // Case where Resource is non-primitive type
- if (value instanceof JsonNode || value instanceof ObjectNode || value instanceof ArrayNode) {
- convertedValue = value;
- } else if (value instanceof String) {
- convertedValue = TransformationUtils.getJsonNodeForString((String) value);
- } else {
- convertedValue = TransformationUtils.getJsonNodeForObject(value);
- }
- }
- return convertedValue;
- }
-
- @SuppressWarnings("squid:S3776")
- private static Object convertPrimitiveResourceValue(String type, Object value) {
- Object convertedValue = value;
-
- if (value instanceof ArrayNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equalsIgnoreCase(type)) {
- convertedValue = ((ArrayNode) value).asBoolean();
- } else if (ValidTypes.DATA_TYPE_INTEGER.equalsIgnoreCase(type)) {
- convertedValue = ((ArrayNode) value).asInt();
- } else if (ValidTypes.DATA_TYPE_FLOAT.equalsIgnoreCase(type)) {
- convertedValue = Float.valueOf(((ArrayNode) value).toString());
- } else {
- convertedValue = ((ArrayNode) value).toString();
- }
- } else if (value instanceof JsonNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equalsIgnoreCase(type)) {
- convertedValue = ((JsonNode) value).asBoolean();
- } else if (ValidTypes.DATA_TYPE_INTEGER.equalsIgnoreCase(type)) {
- convertedValue = ((JsonNode) value).asInt();
- } else if (ValidTypes.DATA_TYPE_FLOAT.equalsIgnoreCase(type)) {
- convertedValue = Float.valueOf(((JsonNode) value).asText());
- } else {
- convertedValue = ((JsonNode) value).asText();
- }
- } else if (value instanceof String) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equalsIgnoreCase(type)) {
- convertedValue = Boolean.valueOf((String) value);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equalsIgnoreCase(type)) {
- convertedValue = Integer.valueOf((String) value);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equalsIgnoreCase(type)) {
- convertedValue = Float.valueOf((String) value);
- }
- }
- logger.info("Returning value ({}) from convertPrimitiveResourceValue", convertedValue);
- return convertedValue;
- }
-
- @SuppressWarnings("squid:S1172")
- public static synchronized void setFailedResourceDataValue(Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment, String message) {
- setFailedResourceDataValue(resourceAssignment, message);
- }
-
- public static synchronized void setFailedResourceDataValue(ResourceAssignment resourceAssignment, String message) {
- if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getName())
- && resourceAssignment.getProperty() != null) {
- resourceAssignment.setUpdatedDate(new Date());
- resourceAssignment.setStatus(ConfigModelConstant.STATUS_FAILURE);
- resourceAssignment.setUpdatedBy(ConfigModelConstant.USER_SYSTEM);
- resourceAssignment.setMessage(message);
- }
- }
-
- public static synchronized void assertTemplateKeyValueNotNull(Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment) throws ConfigModelException {
- if (resourceAssignment != null && resourceAssignment.getProperty() != null
- && BooleanUtils.isTrue(resourceAssignment.getProperty().getRequired())
- && getTemplateKeyValue(componentContext, resourceAssignment) == null) {
- logger.error("failed to populate mandatory resource mapping ({})", resourceAssignment);
- throw new ConfigModelException(
- String.format("failed to populate mandatory resource mapping (%s)", resourceAssignment));
- }
- }
-
- @SuppressWarnings({"squid:S3776", "squid:S1141"})
- public static synchronized String generateResourceDataForAssignments(List<ResourceAssignment> assignments)
- throws ConfigModelException {
- String result = "{}";
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode root = mapper.readTree(result);
- for (ResourceAssignment resourceMapping : assignments) {
- if (resourceMapping != null && resourceMapping.getName() != null
- && resourceMapping.getProperty() != null) {
-
- String type = resourceMapping.getProperty().getType();
- Object value = resourceMapping.getProperty().getValue();
- logger.info("Generating Resource name ({}), type ({}), value ({})", resourceMapping.getName(), type,
- value);
- if (value == null) {
- ((ObjectNode) root).set(resourceMapping.getName(), null);
- } else if (value instanceof JsonNode) {
- ((ObjectNode) root).put(resourceMapping.getName(), (JsonNode) value);
- } else if (ValidTypes.DATA_TYPE_STRING.equalsIgnoreCase(type)) {
- ((ObjectNode) root).put(resourceMapping.getName(), (String) value);
- } else if (ValidTypes.DATA_TYPE_BOOLEAN.equalsIgnoreCase(type)) {
- ((ObjectNode) root).put(resourceMapping.getName(), (Boolean) value);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equalsIgnoreCase(type)) {
- ((ObjectNode) root).put(resourceMapping.getName(), (Integer) value);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equalsIgnoreCase(type)) {
- ((ObjectNode) root).put(resourceMapping.getName(), (Float) value);
- } else if (ValidTypes.DATA_TYPE_TIMESTAMP.equalsIgnoreCase(type)) {
- ((ObjectNode) root).put(resourceMapping.getName(), (String) value);
- } else {
- JsonNode jsonNode = TransformationUtils.getJsonNodeForObject(value);
- if (jsonNode != null) {
- ((ObjectNode) root).put(resourceMapping.getName(), jsonNode);
- } else {
- ((ObjectNode) root).set(resourceMapping.getName(), null);
- }
- }
- }
- }
- result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(root);
- logger.info("Generated Resource Param Data ({})", result);
- } catch (Exception e) {
- throw new ConfigModelException(e.getMessage(), e);
- }
- return result;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceDictionaryUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceDictionaryUtils.java deleted file mode 100644 index 080171ef6..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceDictionaryUtils.java +++ /dev/null @@ -1,119 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Supplier;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.data.dict.SourcesDefinition;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-/**
- * ResourceDictionaryUtils.java Purpose to provide ResourceDictionaryUtils
- *
- * @version 1.0
- */
-public class ResourceDictionaryUtils {
-
- private ResourceDictionaryUtils() {
- // Do nothing
- }
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceDictionaryUtils.class);
-
- /**
- * This Method is to assign the source name to the Dictionary Definition Check to see if the source
- * definition is not present then assign, if more than one source then assign only one source.
- *
- * @param resourceAssignment
- * @param resourceDefinition
- */
- @SuppressWarnings("squid:S3776")
- public static void populateSourceMapping(ResourceAssignment resourceAssignment,
- ResourceDefinition resourceDefinition) {
-
- if (resourceAssignment != null && resourceDefinition != null
- && StringUtils.isBlank(resourceAssignment.getDictionarySource())) {
-
- setProperty(resourceAssignment, resourceDefinition);
- Map<String, SourcesDefinition> sourcesDefinition = resourceDefinition.getSources();
-
- if (sourcesDefinition != null && MapUtils.isNotEmpty(sourcesDefinition) && sourcesDefinition.size() == 1) {
- if (sourcesDefinition.get("input") != null) {
- resourceAssignment.setDictionarySource(ConfigModelConstant.SOURCE_INPUT);
- } else if (sourcesDefinition.get("default") != null) {
- resourceAssignment.setDictionarySource(ConfigModelConstant.SOURCE_DEFAULT);
- } else if (sourcesDefinition.get("db") != null) {
- resourceAssignment.setDictionarySource(ConfigModelConstant.SOURCE_DB);
- if (resolve(() -> sourcesDefinition.get("db").getProperties().getDependencies()).isPresent()
- && CollectionUtils
- .isNotEmpty(sourcesDefinition.get("db").getProperties().getDependencies())) {
- resourceAssignment
- .setDependencies(sourcesDefinition.get("db").getProperties().getDependencies());
- }
- } else if (sourcesDefinition.get("mdsal") != null) {
- resourceAssignment.setDictionarySource(ConfigModelConstant.SOURCE_MDSAL);
- if (resolve(() -> sourcesDefinition.get("mdsal").getProperties().getDependencies()).isPresent()
- && CollectionUtils
- .isNotEmpty(sourcesDefinition.get("mdsal").getProperties().getDependencies())) {
- resourceAssignment
- .setDependencies(sourcesDefinition.get("mdsal").getProperties().getDependencies());
- }
- }
- logger.info("automapped resourceAssignment : {}", resourceAssignment);
- }
- }
- }
-
- public static <T> Optional<T> resolve(Supplier<T> resolver) {
- try {
- T result = resolver.get();
- return Optional.ofNullable(result);
- } catch (NullPointerException e) {
- return Optional.empty();
- }
- }
-
- /**
- * Overriding ResourceAssignment Properties with properties defined in Dictionary
- */
- private static void setProperty(ResourceAssignment resourceAssignment, ResourceDefinition resourceDefinition) {
- if (StringUtils.isNotBlank(resourceDefinition.getProperty().getType())) {
- PropertyDefinition property = resourceAssignment.getProperty();
- if (property == null) {
- property = new PropertyDefinition();
- }
- if (resourceDefinition.getProperty() != null) {
- property.setType(resourceDefinition.getProperty().getType());
- if (resourceDefinition.getProperty().getEntrySchema() != null) {
- property.setEntrySchema(resourceDefinition.getProperty().getEntrySchema());
- }
- resourceAssignment.setProperty(property);
- }
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtils.java deleted file mode 100644 index c63719875..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtils.java +++ /dev/null @@ -1,277 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.Map;
-import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.InterfaceAssignment;
-import org.onap.ccsdk.features.model.data.InterfaceDefinition;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.OperationAssignment;
-import org.onap.ccsdk.features.model.data.OperationDefinition;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.data.TopologyTemplate;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ServiceTemplateUtils {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ServiceTemplateUtils.class);
-
- public Map<String, String> convertServiceTemplate2Properties(String serviceTemplateContent,
- final Map<String, String> context) {
- if (StringUtils.isNotBlank(serviceTemplateContent)) {
- ServiceTemplate serviceTemplate =
- TransformationUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
- convertServiceTemplate2Properties(serviceTemplate, context);
- }
- return context;
- }
-
- public Map<String, String> convertServiceTemplate2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) {
- if (serviceTemplate != null) {
- convertServiceTemplateMetadata2Properties(serviceTemplate, context);
- convertServiceTemplateInputs2Properties(serviceTemplate, context);
- convertDataTypes2Properties(serviceTemplate, context);
- convertNode2Properties(serviceTemplate, context);
- }
- return context;
- }
-
- public Map<String, String> convertServiceTemplateMetadata2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) {
-
- if (serviceTemplate != null && serviceTemplate.getMetadata() != null) {
- serviceTemplate.getMetadata().forEach((metaDataKey, metadata) -> {
- context.put(metaDataKey, metadata);
- });
- }
- return context;
- }
-
- public Map<String, String> convertServiceTemplateInputs2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) {
-
- if (serviceTemplate != null && serviceTemplate.getTopologyTemplate() != null
- && serviceTemplate.getTopologyTemplate().getInputs() != null) {
-
- serviceTemplate.getTopologyTemplate().getInputs().forEach((paramKey, parameterDefinition) -> {
- if (parameterDefinition != null) {
- context.put(ConfigModelConstant.PROPERTY_INPUTS_DOT + paramKey + ".type",
- parameterDefinition.getType());
- if (parameterDefinition.getRequired()) {
- context.put(ConfigModelConstant.PROPERTY_INPUTS_DOT + paramKey + ".required",
- String.valueOf(parameterDefinition.getRequired()));
- }
- if (parameterDefinition.getDefaultValue() != null) {
- context.put(ConfigModelConstant.PROPERTY_INPUTS_DOT + paramKey + ".default",
- String.valueOf(parameterDefinition.getDefaultValue()));
- }
- }
- });
- }
- return context;
- }
-
- public Map<String, String> convertDataTypes2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) {
- if (serviceTemplate != null && serviceTemplate.getDataTypes() != null) {
- serviceTemplate.getDataTypes().forEach((dataTypeKey, dataType) -> {
- logger.trace("Populating Data Type Key : ({})", dataTypeKey);
- String dataTypeContent = TransformationUtils.getJson(dataType);
- context.put("data_types." + dataTypeKey, dataTypeContent);
- });
- }
- return context;
- }
-
- public Map<String, String> convertNode2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) {
-
- if (serviceTemplate != null && serviceTemplate.getNodeTypes() != null
- && serviceTemplate.getTopologyTemplate() != null
- && serviceTemplate.getTopologyTemplate().getNodeTemplates() != null) {
-
- serviceTemplate.getTopologyTemplate().getNodeTemplates().forEach((nodeTemplateKey, nodeTemplate) -> {
- if (nodeTemplate != null && StringUtils.isNotBlank(nodeTemplate.getType())) {
- String nodeTypeKey = nodeTemplate.getType();
- logger.trace("Populating Node Type Key : ({}) for Node Template : ({})", nodeTypeKey,
- nodeTemplateKey);
- String nodeTemplateContent = TransformationUtils.getJson(nodeTemplate);
- context.put("node_templates." + nodeTemplateKey, nodeTemplateContent);
- if (serviceTemplate.getNodeTypes().containsKey(nodeTypeKey)) {
- NodeType nodeType = serviceTemplate.getNodeTypes().get(nodeTypeKey);
- String nodeTypeContent = TransformationUtils.getJson(nodeType);
- context.put("node_types." + nodeTypeKey, nodeTypeContent);
- String nodeDerivedFrom = nodeType.getDerivedFrom();
- if (ConfigModelConstant.MODEL_TYPE_NODE_DG.equalsIgnoreCase(nodeDerivedFrom)) {
- populateDGNodeProperties(nodeTemplateKey, nodeTemplate, context, nodeDerivedFrom);
- }
- }
- // Populate the Artifact Definitions
- populateNodeTemplateArtifacts(nodeTemplateKey, nodeTemplate, context);
- }
- });
- }
- return context;
- }
-
- @SuppressWarnings("squid:S1172")
- public Map<String, String> populateVnfNodeProperties(String nodeTemplateKey, NodeTemplate nodeTemplate,
- final Map<String, String> context, String nodeDerivedFrom) {
- if (nodeTemplate != null && nodeTemplate.getCapabilities() != null) {
- nodeTemplate.getCapabilities().forEach((capabilityKey, capability) -> {
- capability.getProperties().forEach((propertyKey, property) -> {
- context.put(nodeTemplateKey + "." + capabilityKey + "." + propertyKey, String.valueOf(property));
- });
- });
- }
-
- return context;
- }
-
- public Map<String, String> populateNodeTemplateArtifacts(String nodeTemplateKey, NodeTemplate nodeTemplate,
- final Map<String, String> context) {
- if (MapUtils.isNotEmpty(nodeTemplate.getArtifacts())) {
- nodeTemplate.getArtifacts().forEach((artifactName, artifact) -> {
- if (StringUtils.isNotBlank(artifactName) && artifact != null) {
- logger.trace("Populating Node Template Artifacts ({}) for Node Template ({})", artifactName,
- nodeTemplateKey);
- String fileKeyName = ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateKey + "."
- + ConfigModelConstant.PROPERTY_ARTIFACTS_DOT + artifactName + ".file";
- String deployKeyName = ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateKey + "."
- + ConfigModelConstant.PROPERTY_ARTIFACTS_DOT + artifactName + ".deploy_path";
- String contentKeyName = ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateKey + "."
- + ConfigModelConstant.PROPERTY_ARTIFACTS_DOT + artifactName + ".content";
- context.put(fileKeyName, artifact.getFile());
- context.put(deployKeyName, artifact.getDeployPath());
- context.put(contentKeyName, artifact.getContent());
- }
- });
- }
- return context;
- }
-
- public Map<String, String> populateDGNodeProperties(String nodeTemplateKey, NodeTemplate nodeTemplate,
- final Map<String, String> context, String nodeDerivedFrom) {
- if (nodeTemplate != null && nodeTemplate.getInterfaces() != null) {
-
- if (nodeTemplate.getProperties() != null) {
- nodeTemplate.getProperties().forEach((propKey, propValue) -> {
- if (propKey != null && propValue != null) {
- context.put("dg." + nodeTemplateKey + "." + propKey, String.valueOf(propValue));
- }
- });
- }
-
- nodeTemplate.getInterfaces().forEach((interfaceKey, interfaceDefinition) -> {
-
- interfaceDefinition.getOperations().forEach((operationKey, operation) -> {
- if (ConfigModelConstant.MODEL_TYPE_NODE_DG.equalsIgnoreCase(nodeDerivedFrom)) {
- context.put("dg." + nodeTemplateKey + ".module", interfaceKey);
- context.put("dg." + nodeTemplateKey + ".flow", operationKey);
- }
- });
- });
- }
- return context;
- }
-
- public SvcLogicContext getInterfaceOpertationDefinition(ServiceTemplate serviceTemplate,
- final SvcLogicContext context) {
-
- if (serviceTemplate != null && serviceTemplate.getNodeTypes() != null
- && serviceTemplate.getTopologyTemplate() != null
- && serviceTemplate.getTopologyTemplate().getNodeTemplates() != null) {
-
- TopologyTemplate topologyTemplates = serviceTemplate.getTopologyTemplate();
- // Copy Definition to Template
- copyNodeType2Template(serviceTemplate.getNodeTypes(), topologyTemplates.getNodeTemplates());
-
- topologyTemplates.getNodeTemplates().forEach((templateKey, nodeTemplate) -> {
-
- if (StringUtils.isNotBlank(templateKey) && nodeTemplate != null
- && nodeTemplate.getInterfaces() != null) {
-
- nodeTemplate.getInterfaces().forEach((interfaceKey, interfaceDefinition) -> {
- if (StringUtils.isNotBlank(interfaceKey) && interfaceDefinition != null) {
- interfaceDefinition.getOperations().forEach((operationKey, operation) -> {
- String definitionKey = interfaceKey + "." + operationKey;
- String definitionContent = TransformationUtils.getJson(operation);
- context.setAttribute(definitionKey, definitionContent);
- // Set the Operation & Method Params
- });
- }
- });
- }
- });
- }
- return context;
- }
-
- public void copyNodeType2Template(Map<String, NodeType> nodeTypes, Map<String, NodeTemplate> nodeTemplates) {
- if (nodeTypes != null && nodeTemplates != null) {
-
- nodeTemplates.forEach((templateKey, nodeTemplate) -> {
- if (StringUtils.isNotBlank(templateKey) && nodeTemplate != null) {
- String type = nodeTemplate.getType();
- // Check the Node Template Type is Present
- if (StringUtils.isNotBlank(type) && nodeTypes.containsKey(type)) {
- NodeType nodeType = nodeTypes.get(type);
- logger.trace("Checking Node Type Content : ({})", TransformationUtils.getJson(nodeType));
- copyNodeTypeInterface2Template(nodeType.getInterfaces(), nodeTemplate.getInterfaces());
- }
- }
- });
- }
- }
-
- public void copyNodeTypeInterface2Template(Map<String, InterfaceDefinition> nodeTypeInterfaces,
- Map<String, InterfaceAssignment> nodeTemplateInterfaces) {
- if (nodeTypeInterfaces != null && nodeTemplateInterfaces != null) {
-
- nodeTemplateInterfaces.forEach((interfaceKey, nodeTemplateinterface) -> {
- InterfaceDefinition nodeTypeInterface = nodeTypeInterfaces.get(interfaceKey);
- logger.trace("Checking Interface Type Content : ({})", TransformationUtils.getJson(nodeTypeInterface));
- if (nodeTypeInterface != null && nodeTemplateinterface != null) {
- copyNodeTypeOperation2Template(nodeTypeInterface.getOperations(),
- nodeTemplateinterface.getOperations());
- }
- });
- }
- }
-
- public void copyNodeTypeOperation2Template(Map<String, OperationDefinition> nodeTypeOperations,
- Map<String, OperationAssignment> nodeTemplateOperations) {
- if (nodeTypeOperations != null && nodeTemplateOperations != null) {
-
- nodeTemplateOperations.forEach((operationKey, nodeTemplateOperation) -> {
- OperationDefinition nodeTypeInterfaceOperation = nodeTypeOperations.get(operationKey);
- if (nodeTypeInterfaceOperation != null && nodeTemplateOperation != null) {
- logger.info("Checking Operation Type Content : " + operationKey + " : "
- + TransformationUtils.getJson(nodeTypeInterfaceOperation));
- }
- });
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TopologicalSortingUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TopologicalSortingUtils.java deleted file mode 100644 index 4f16a0c5f..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TopologicalSortingUtils.java +++ /dev/null @@ -1,188 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Stack;
-
-public class TopologicalSortingUtils<V> {
-
- /**
- * The implementation here is basically an adjacency list, but instead of an array of lists, a Map
- * is used to map each vertex to its list of adjacent vertices.
- */
- private Map<V, List<V>> neighbors = new HashMap<>();
-
- /**
- * String representation of graph.
- */
- @Override
- public String toString() {
- StringBuilder s = new StringBuilder();
- neighbors.forEach((v, vs) -> s.append("\n " + v + " -> " + vs));
- return s.toString();
- }
-
- public Map<V, List<V>> getNeighbors() {
- return neighbors;
- }
-
- /**
- * Add a vertex to the graph. Nothing happens if vertex is already in graph.
- */
- public void add(V vertex) {
- if (neighbors.containsKey(vertex))
- return;
- neighbors.put(vertex, new ArrayList<V>());
- }
-
- /**
- * True iff graph contains vertex.
- */
- public boolean contains(V vertex) {
- return neighbors.containsKey(vertex);
- }
-
- /**
- * Add an edge to the graph; if either vertex does not exist, it's added. This implementation allows
- * the creation of multi-edges and self-loops.
- */
- public void add(V from, V to) {
- this.add(from);
- this.add(to);
- neighbors.get(from).add(to);
- }
-
- /**
- * Remove an edge from the graph. Nothing happens if no such edge.
- *
- * @throws IllegalArgumentException if either vertex doesn't exist.
- */
- public void remove(V from, V to) {
- if (!(this.contains(from) && this.contains(to)))
- throw new IllegalArgumentException("Nonexistent vertex");
- neighbors.get(from).remove(to);
- }
-
- /**
- * Report (as a Map) the out-degree of each vertex.
- */
- public Map<V, Integer> outDegree() {
- Map<V, Integer> result = new HashMap<>();
- neighbors.forEach((v, vs) -> result.put(v, vs.size()));
- return result;
- }
-
- /**
- * Report (as a Map) the in-degree of each vertex.
- */
- public Map<V, Integer> inDegree() {
- Map<V, Integer> result = new HashMap<>();
- for (V v : neighbors.keySet())
- result.put(v, 0); // All in-degrees are 0
-
- neighbors.forEach((from, vs) -> vs.forEach(to -> result.put(to, result.get(to) + 1) // Increment in-degree
- ));
-
- return result;
- }
-
- /**
- * Report (as a List) the topological sort of the vertices; null for no such sort.
- */
- @SuppressWarnings({"squid:S1149", "squid:S1168"})
- public List<V> topSort() {
- Map<V, Integer> degree = inDegree();
- // Determine all vertices with zero in-degree
- Stack<V> zeroVerts = new Stack<>(); // Stack as good as any here
-
- degree.forEach((v, vs) -> {
- if (vs == 0)
- zeroVerts.push(v);
- });
-
- // Determine the topological order
- List<V> result = new ArrayList<>();
- while (!zeroVerts.isEmpty()) {
- V v = zeroVerts.pop(); // Choose a vertex with zero in-degree
- result.add(v); // Vertex v is next in topol order
- // "Remove" vertex v by updating its neighbors
- for (V neighbor : neighbors.get(v)) {
- degree.put(neighbor, degree.get(neighbor) - 1);
- // Remember any vertices that now have zero in-degree
- if (degree.get(neighbor) == 0)
- zeroVerts.push(neighbor);
- }
- }
- // Check that we have used the entire graph (if not, there was a cycle)
- if (result.size() != neighbors.size())
- return null;
- return result;
- }
-
- /**
- * True iff graph is a dag (directed acyclic graph).
- */
- public boolean isDag() {
- return topSort() != null;
- }
-
- /**
- * Report (as a Map) the bfs distance to each vertex from the start vertex. The distance is an
- * Integer; the value null is used to represent infinity (implying that the corresponding node
- * cannot be reached).
- */
- public Map bfsDistance(V start) {
- Map<V, Integer> distance = new HashMap<>();
- // Initially, all distance are infinity, except start node
- for (V v : neighbors.keySet())
- distance.put(v, null);
- distance.put(start, 0);
- // Process nodes in queue order
- Queue<V> queue = new LinkedList<>();
- queue.offer(start); // Place start node in queue
- while (!queue.isEmpty()) {
- V v = queue.remove();
- int vDist = distance.get(v);
- // Update neighbors
- for (V neighbor : neighbors.get(v)) {
- if (distance.get(neighbor) != null)
- continue; // Ignore if already done
- distance.put(neighbor, vDist + 1);
- queue.offer(neighbor);
- }
- }
- return distance;
- }
-
- /**
- * Main program (for testing). public static void main (String[] args) { // Create a Graph with
- * Integer nodes TopologicalSortingUtils<String> graph = new TopologicalSortingUtils<String>();
- * graph.add("bundle-id", "bundle-mac"); graph.add("bundle-id", "bundle-ip");
- * graph.add("bundle-mac", "bundle-ip"); graph.add("bundle-ip", "bundle-mac");
- * System.out.println("The current graph: " + graph); System.out.println("In-degrees: " +
- * graph.inDegree()); System.out.println("Out-degrees: " + graph.outDegree()); System.out.println("A
- * topological sort of the vertices: " + graph.topSort()); System.out.println("The graph " +
- * (graph.isDag()?"is":"is not") + " a dag"); }
- */
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TransformationUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TransformationUtils.java deleted file mode 100644 index 138745ccf..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TransformationUtils.java +++ /dev/null @@ -1,429 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TreeMap;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.type.CollectionType;
-import com.fasterxml.jackson.module.jsonSchema.JsonSchema;
-import com.fasterxml.jackson.module.jsonSchema.JsonSchemaGenerator;
-
-/**
- * TransformationUtils.java Purpose: Provide Configuration Generator TransformationUtils Information
- *
- * @version 1.0
- */
-public class TransformationUtils {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(TransformationUtils.class);
-
- private TransformationUtils() {
-
- }
-
- /**
- * This is a getJson method
- *
- * @param configparameters
- * @return String
- */
- public static String getJson(Map<String, Object> configparameters) {
- String jsonContent = null;
- try {
- ObjectMapper mapper = new ObjectMapper();
- jsonContent = mapper.writeValueAsString(configparameters);
- } catch (JsonProcessingException e) {
- logger.warn(e.getMessage());
- }
- return jsonContent;
- }
-
- /**
- * This is a getJsonNode method
- *
- * @param configparameters
- * @return String
- */
- public static JsonNode getJsonNode(Map<String, String> configparameters) {
- JsonNode jsonContent = null;
- try {
- ObjectMapper mapper = new ObjectMapper();
- jsonContent = mapper.valueToTree(configparameters);
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- return jsonContent;
- }
-
- /**
- * This is a getJson method
- *
- * @param instance
- * @param pretty
- * @return Map<String , Object>
- */
- public static String getJson(Object instance, boolean pretty) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- if (pretty) {
- mapper.enable(SerializationFeature.INDENT_OUTPUT);
- }
- return mapper.writeValueAsString(instance);
- } catch (JsonProcessingException e) {
- logger.warn(e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getJson method
- *
- * @param instance
- * @return String
- */
- public static String getJson(Object instance) {
- return getJson(instance, false);
- }
-
- /**
- * This is a getJsonNodeForobject method
- *
- * @param instance
- * @return JsonNode
- */
- public static JsonNode getJsonNodeForObject(Object instance) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- return mapper.convertValue(instance, JsonNode.class);
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getJsonNodeForString method
- *
- * @param content
- * @return JsonNode
- */
- public static JsonNode getJsonNodeForString(String content) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- return mapper.readTree(content);
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getMapfromJson method
- *
- * @param content
- * @return Map<String , Object>
- */
- public static Map<String, Object> getMapfromJson(String content) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.readValue(content, new TypeReference<Map<String, String>>() {});
- } catch (Exception e) {
- logger.warn("failed in getMapfromJson for the content ({}) with error message ({}).", content,
- e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getMapfromJson method
- *
- * @param content
- * @return Map<String , Object>
- */
- public static Map<String, Object> getMapfromJsonString(String content) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.readValue(content, new TypeReference<Map<String, Object>>() {});
- } catch (Exception e) {
- logger.warn("failed in getMapfromJson for the content ({}) with error message ({}).", content,
- e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getListfromJson method
- *
- * @param content
- * @return Map<String , Object>
- */
- @SuppressWarnings("squid:S1168")
- public static <T> List<T> getListfromJson(String content, Class<T> valueType) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- CollectionType javaType = mapper.getTypeFactory().constructCollectionType(List.class, valueType);
- return mapper.readValue(content, javaType);
- } catch (Exception e) {
- logger.warn("failed in getListfromJson for the content ({}) with error message ({}).", content,
- e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getJsonSchema method
- *
- * @param valueType
- * @return String
- */
- public static String getJsonSchema(Class clazz) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonSchemaGenerator schemaGen = new JsonSchemaGenerator(mapper);
- JsonSchema schema = schemaGen.generateSchema(clazz);
- return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(schema);
-
- } catch (Exception e) {
- logger.warn("failed in getJsonSchema with error message ({}).", e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a readValue method
- *
- * @param content
- * @param valueType
- * @return <T>
- */
-
- public static <T> T readValue(String content, Class<T> valueType) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.readValue(content, valueType);
- } catch (Exception e) {
- logger.warn("failed in readValue for the content ({}) with error message ({}).", content, e.getMessage());
- }
- return null;
- }
-
- /**
- * @param node
- * @param valueType
- * @param <T>
- * @return
- */
- public static <T> T treeToValue(JsonNode node, Class<T> valueType) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.treeToValue(node, valueType);
- } catch (Exception e) {
- logger.warn("failed in readValue for the content ({}) with error message ({}).", node, e.getMessage());
- }
- return null;
- }
-
- /**
- * @param node
- * @param valueType
- * @param <T>
- * @return List<T>
- */
- public static <T> List<T> treeToListValue(JsonNode node, Class<T> valueType) {
- List<T> resultList = new ArrayList<>();
- if (node instanceof ArrayNode) {
- for (JsonNode subnode : node) {
- if (subnode != null) {
- resultList.add(treeToValue(subnode, valueType));
- }
- }
- }
- return resultList;
- }
-
- /**
- * This is a removeJsonNullNode method
- *
- * @param node
- */
- public static void removeJsonNullNode(JsonNode node) {
- Iterator<JsonNode> it = node.iterator();
- while (it.hasNext()) {
- JsonNode child = it.next();
- if (child.isNull()) {
- it.remove();
- } else {
- removeJsonNullNode(child);
- }
- }
- }
-
- public static void printProperty(Properties property) {
- if (property != null) {
- Map<String, String> sortedMap = new TreeMap(property);
- StringBuilder buffer = new StringBuilder();
- sortedMap.entrySet().forEach(message -> {
- buffer.append("\n" + message.toString());
- });
- logger.debug("Property : ({})", buffer);
- }
- }
-
- public static void printMap(Map<String, String> map) {
- if (map != null) {
- Map<String, String> sortedMap = new TreeMap(map);
- StringBuilder buffer = new StringBuilder();
- sortedMap.entrySet().forEach(message -> {
- buffer.append("\n" + message.toString());
- });
- logger.debug("Map: ({})", buffer);
- }
- }
-
- @SuppressWarnings("squid:S00112")
- public static Map<String, String> convertJson2RootProperties(Map<String, String> context, String jsonContent)
- throws Exception {
- if (context == null) {
- context = new HashMap<>();
- }
-
- ObjectMapper mapper = new ObjectMapper();
- JsonNode rootArray = mapper.readTree(jsonContent);
- return convertJson2RootProperties(context, rootArray);
- }
-
- public static Map<String, String> convertJson2RootProperties(Map<String, String> context, JsonNode rootArray) {
- Map<String, String> sortedMap = null;
-
- if (context == null) {
- context = new HashMap<>();
- }
- if (rootArray != null) {
- Iterator<Map.Entry<String, JsonNode>> fields = rootArray.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- if (entry != null && entry.getValue() != null) {
- if (entry.getValue().isTextual()) {
- context.put(entry.getKey(), entry.getValue().textValue());
- } else {
- context.put(entry.getKey(), entry.getValue().toString());
- }
- }
- }
- }
- sortedMap = new TreeMap<>(context);
- return sortedMap;
- }
-
- @SuppressWarnings("squid:S00112")
- public static Map<String, String> convertJson2Properties(Map<String, String> context, String jsonContent,
- List<String> blockKeys) throws Exception {
- Map<String, String> sortedMap = null;
-
- if (context == null) {
- context = new HashMap<>();
- }
-
- ObjectMapper mapper = new ObjectMapper();
- JsonNode rootArray = mapper.readTree(jsonContent);
-
- if (rootArray != null) {
- Iterator<Map.Entry<String, JsonNode>> fields = rootArray.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- processJsonNode(context, blockKeys, entry.getKey(), entry.getValue());
- }
- }
- sortedMap = new TreeMap<>(context);
- return sortedMap;
- }
-
- public static Map<String, String> convertJson2Properties(Map<String, String> context, JsonNode rootArray,
- List<String> blockKeys) throws IOException {
- Map<String, String> sortedMap = null;
-
- if (context == null) {
- context = new HashMap<>();
- }
-
- if (blockKeys == null) {
- blockKeys = new ArrayList<>();
- }
-
- if (rootArray != null) {
- Iterator<Map.Entry<String, JsonNode>> fields = rootArray.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- processJsonNode(context, blockKeys, entry.getKey(), entry.getValue());
- }
- }
- sortedMap = new TreeMap<>(context);
- return sortedMap;
- }
-
- private static void processJsonNode(Map<String, String> propertyMap, List<String> blockKeys, String nodeName,
- JsonNode node) throws IOException {
-
- logger.trace("Block Key ({})", nodeName);
- if (node == null) {
- return;
- }
-
- String keyName = null;
- if (blockKeys != null && blockKeys.contains(nodeName)) {
- if (node.isArray() || node.isObject()) {
- propertyMap.put(nodeName, node.toString());
- } else {
- propertyMap.put(nodeName, node.asText());
- }
- } else if (node.isArray()) {
- for (int i = 0; i < node.size(); i++) {
- keyName = nodeName + "[" + i + "]";
- processJsonNode(propertyMap, blockKeys, keyName, node.get(i));
- }
- } else if (node.isObject()) {
- Iterator<Map.Entry<String, JsonNode>> fields = node.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- keyName = nodeName + "." + entry.getKey();
- processJsonNode(propertyMap, blockKeys, keyName, entry.getValue());
- }
- } else {
- propertyMap.put(nodeName, node.asText());
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/DataTypeValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/DataTypeValidator.java deleted file mode 100644 index 32d546eed..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/DataTypeValidator.java +++ /dev/null @@ -1,109 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-
-/**
- * DataTypeValidator.java Purpose: Provide Configuration Generator DataTypeValidator
- *
- * @version 1.0
- */
-public class DataTypeValidator {
-
- private StringBuilder message;
- private Map<String, DataType> stDataTypes;
- private ServiceTemplate serviceTemplate;
- private PropertyDefinitionValidator propertyDefinitionValidator;
-
- /**
- * This is a DataTypeValidator
- *
- * @param serviceTemplate
- * @throws ConfigModelException
- */
- public DataTypeValidator(ServiceTemplate serviceTemplate, StringBuilder message) throws ConfigModelException {
- this.serviceTemplate = serviceTemplate;
- this.message = message;
- propertyDefinitionValidator = new PropertyDefinitionValidator(this.message);
- stDataTypes = new HashMap<>();
- loadInitial();
-
- }
-
- private void loadInitial() {
- if (serviceTemplate != null && serviceTemplate.getDataTypes() != null) {
- message.append("\n DataTypes" + serviceTemplate.getDataTypes());
- serviceTemplate.getDataTypes().forEach((dataTypeKey, dataType) -> {
- stDataTypes.put(dataTypeKey, dataType);
- message.append("\n Data Type (" + dataTypeKey + ") loaded successfully.");
- });
- }
- }
-
- /**
- * This is a validateDataTypes
- *
- * @return boolean
- * @throws ConfigModelException
- */
- @SuppressWarnings("squid:S00112")
- public boolean validateDataTypes() {
- if (serviceTemplate != null && serviceTemplate.getDataTypes() != null) {
-
- serviceTemplate.getDataTypes().forEach((dataTypeKey, dataType) -> {
- if (dataType != null) {
- try {
- String derivedFrom = dataType.getDerivedFrom();
- checkValidDerivedType(dataTypeKey, derivedFrom);
- checkValidProperties(dataTypeKey, dataType.getProperties());
- } catch (ConfigModelException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- });
- }
- return true;
- }
-
- private boolean checkValidDerivedType(String dataTypeName, String derivedFrom) throws ConfigModelException {
-
- if (StringUtils.isBlank(derivedFrom) || !ValidTypes.getValidDataTypeDerivedFrom().contains(derivedFrom)) {
- throw new ConfigModelException(derivedFrom + " is not a valid derived type for Data type " + dataTypeName);
- }
- return true;
- }
-
- private boolean checkValidProperties(String dataTypeName, Map<String, PropertyDefinition> properties) {
- if (properties != null) {
- message.append("\n validation Data Type (" + dataTypeName + ") Property.");
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, properties);
- }
- return true;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/NodeTypeValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/NodeTypeValidator.java deleted file mode 100644 index 4cb9ae14d..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/NodeTypeValidator.java +++ /dev/null @@ -1,237 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.CapabilityDefinition;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.InterfaceDefinition;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.OperationDefinition;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.RequirementDefinition;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-/**
- * NodeTypeValidator.java Purpose: Provide Configuration Generator NodeTypeValidator
- *
- * @version 1.0
- */
-public class NodeTypeValidator {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(NodeTypeValidator.class);
- private StringBuilder message;
- private Map<String, DataType> stDataTypes;
- private Map<String, NodeType> stNodeTypes;
- private ServiceTemplate serviceTemplate;
- private PropertyDefinitionValidator propertyDefinitionValidator;
-
- /**
- * This is a NodeTypeValidator
- *
- * @param serviceTemplate
- * @throws ConfigModelException
- */
- public NodeTypeValidator(ServiceTemplate serviceTemplate, StringBuilder message) throws ConfigModelException {
- this.serviceTemplate = serviceTemplate;
- this.message = message;
- propertyDefinitionValidator = new PropertyDefinitionValidator(this.message);
- stDataTypes = new HashMap<>();
- stNodeTypes = new HashMap<>();
- loadInitial();
-
- }
-
- private void loadInitial() {
- if (serviceTemplate != null) {
-
- if (serviceTemplate.getDataTypes() != null) {
- serviceTemplate.getDataTypes().forEach((dataTypeKey, dataType) -> {
- stDataTypes.put(dataTypeKey, dataType);
- logger.trace("Data Type ({}) loaded successfully.", dataTypeKey);
- });
- }
-
- if (serviceTemplate.getNodeTypes() != null) {
- serviceTemplate.getNodeTypes().forEach((nodeTypeKey, nodeType) -> {
- stNodeTypes.put(nodeTypeKey, nodeType);
- logger.trace("NodeType Type ({}) loaded successfully.", nodeTypeKey);
- });
- }
-
- }
-
- }
-
- /**
- * This is a validateNodeTypes to validate the Node Type
- *
- * @return boolean
- * @throws ConfigModelException
- */
- @SuppressWarnings({"squid:S00112", "squid:S3776"})
- public boolean validateNodeTypes() {
- if (serviceTemplate != null && serviceTemplate.getNodeTypes() != null) {
- serviceTemplate.getNodeTypes().forEach((nodeTypeKey, nodeType) -> {
- if (nodeType != null) {
- message.append("\n ***** Validation Node Type (" + nodeTypeKey + "), derived from ("
- + nodeType.getDerivedFrom() + ")");
- try {
- validateNodeType(ConfigModelConstant.MODEL_DEFINITION_TYPE_NODE_TYPE,
- nodeType.getDerivedFrom());
-
- if (nodeType.getProperties() != null) {
- checkValidProperties(nodeType.getProperties());
- }
-
- if (nodeType.getCapabilities() != null) {
- validateNodeTypeCapabilities(nodeType.getCapabilities());
- }
-
- if (nodeType.getInterfaces() != null) {
- validateNodeTypeInterface(nodeType.getInterfaces());
- }
-
- if (nodeType.getRequirements() != null) {
- validateNodeTypeRequirement(nodeType.getRequirements());
- }
-
- } catch (ConfigModelException e) {
- logger.error(e.getMessage());
- throw new RuntimeException(e.getMessage());
- }
-
- }
- });
- }
- return true;
- }
-
- private boolean validateNodeType(String definitionType, String derivedFrom) throws ConfigModelException {
- boolean valid = true;
- if (!ConfigModelConstant.MODEL_DEFINITION_TYPE_DATA_TYPE.equalsIgnoreCase(definitionType)
- && !ValidTypes.getValidNodeTypes().contains(derivedFrom)) {
- throw new ConfigModelException("Not Valid Model Type (" + derivedFrom + ")");
- }
- return valid;
- }
-
- private boolean checkValidProperties(Map<String, PropertyDefinition> properties) {
- if (properties != null) {
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, properties);
- }
- return true;
- }
-
- @SuppressWarnings("squid:S00112")
- private boolean validateNodeTypeCapabilities(Map<String, CapabilityDefinition> capabilities) {
- if (capabilities != null) {
- capabilities.forEach((capabilityKey, capability) -> {
- if (capability != null) {
- Map<String, PropertyDefinition> properties = capability.getProperties();
- message.append("\n Validation Capability (" + capabilityKey + ") properties :");
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, properties);
- }
- });
- }
- return true;
- }
-
- @SuppressWarnings("squid:S00112")
- private boolean validateNodeTypeInterface(Map<String, InterfaceDefinition> interfaces) {
- if (interfaces != null) {
- interfaces.forEach((interfaceKey, interfaceDefinition) -> {
- if (interfaceDefinition != null && interfaceDefinition.getOperations() != null) {
- validateNodeTypeInterfaceOperation(interfaceDefinition.getOperations());
- }
- });
- }
- return true;
- }
-
- @SuppressWarnings("squid:S00112")
- private boolean validateNodeTypeInterfaceOperation(Map<String, OperationDefinition> operations) {
- if (operations != null) {
- operations.forEach((operationKey, operation) -> {
- if (operation != null) {
- Map<String, PropertyDefinition> inputs = operation.getInputs();
- message.append("\n Validation Operation (" + operationKey + ") Inputs :");
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, inputs);
- message.append("\n Validation Operation (" + operationKey + ") output :");
- Map<String, PropertyDefinition> outputs = operation.getOutputs();
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, outputs);
- }
- });
- }
- return true;
- }
-
- @SuppressWarnings("squid:S00112")
- private boolean validateNodeTypeRequirement(Map<String, RequirementDefinition> requirements) {
- if (requirements != null) {
- requirements.forEach((requirementKey, requirement) -> {
- if (requirement != null) {
- String nodeTypeName = requirement.getNode();
- String capabilityName = requirement.getCapability();
- try {
- checkCapabilityPresentInNodeType(nodeTypeName, capabilityName);
- } catch (ConfigModelException e) {
- throw new RuntimeException(e);
- }
- }
- });
- }
- return true;
- }
-
- private boolean checkCapabilityPresentInNodeType(String nodeTypeName, String capabilityName)
- throws ConfigModelException {
- if (StringUtils.isNotBlank(nodeTypeName) && StringUtils.isNotBlank(capabilityName)) {
-
- if (!stNodeTypes.containsKey(nodeTypeName)) {
- throw new ConfigModelException(nodeTypeName + " Node Type not Defined.");
- } else {
- message.append("\n Node Type (" + nodeTypeName + ") Defined.");
- }
-
- NodeType relationalNodeType = stNodeTypes.get(nodeTypeName);
-
- if (relationalNodeType.getCapabilities() == null) {
- throw new ConfigModelException(
- "Node Type (" + nodeTypeName + "), doesn't have Capability Definitions.");
- }
-
- if (!relationalNodeType.getCapabilities().containsKey(capabilityName)) {
- throw new ConfigModelException("Node Type (" + nodeTypeName + ") doesn't have (" + capabilityName
- + ") Capability Definitions.");
- } else {
- message.append(
- "\n Node Type (" + nodeTypeName + ") has (" + capabilityName + ") Capability Definitions.");
- }
-
- }
- return true;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/PropertyDefinitionValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/PropertyDefinitionValidator.java deleted file mode 100644 index 080fee2b6..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/PropertyDefinitionValidator.java +++ /dev/null @@ -1,89 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-
-/**
- * PropertyDefinitionValidator.java Purpose: Provide Configuration Generator
- * PropertyDefinitionValidator
- *
- * @version 1.0
- */
-public class PropertyDefinitionValidator {
-
- StringBuilder message = new StringBuilder();
-
- public PropertyDefinitionValidator(StringBuilder message) {
- this.message = message;
-
- }
-
- /**
- * This is a validatePropertyDefinition stored in database
- *
- * @param stDataTypes
- * @param properties
- * @return boolean
- * @throws ConfigModelException
- */
- @SuppressWarnings({"squid:S00112", "squid:S3776", "squid:S1192"})
- public boolean validatePropertyDefinition(Map<String, DataType> stDataTypes,
- Map<String, PropertyDefinition> properties) {
-
- if (stDataTypes != null && properties != null) {
- properties.forEach((propertyKey, prop) -> {
- if (propertyKey != null && prop != null) {
- try {
- String propertType = prop.getType();
- message.append("\n Validating (" + propertyKey + ") " + prop);
-
- if (!ValidTypes.getValidPropertType().contains(propertType)
- && !stDataTypes.containsKey(propertType)) {
- throw new ConfigModelException("Data Type (" + propertyKey + ") -> type(" + propertType
- + ") is not a valid type.");
- } else if (ValidTypes.getListPropertType().contains(propertType)) {
- if (prop.getEntrySchema() == null || StringUtils.isBlank(prop.getEntrySchema().getType())) {
- throw new ConfigModelException("Data Type (" + propertyKey + ") -> type (" + propertType
- + ") Entity Schema is not defined.");
- }
-
- String entitySchemaType = prop.getEntrySchema().getType();
-
- if (!ValidTypes.getValidPropertType().contains(entitySchemaType)
- && !stDataTypes.containsKey(entitySchemaType)) {
- message.append("\n Present Data Type " + stDataTypes);
- throw new ConfigModelException("Data Type (" + propertyKey + ") -> type(" + propertType
- + ") -> entitySchema(" + entitySchemaType + ") is not defined.");
- }
- }
- } catch (ConfigModelException e) {
- throw new RuntimeException(e);
- }
- }
- });
- }
- return true;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ResourceAssignmentValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ResourceAssignmentValidator.java deleted file mode 100644 index 8f2efd110..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ResourceAssignmentValidator.java +++ /dev/null @@ -1,163 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.CapabilityAssignment;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.utils.TopologicalSortingUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ResourceAssignmentValidator {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceAssignmentValidator.class);
- private List<ResourceAssignment> assignments;
- private Map<String, ResourceAssignment> resourceAssignmentMap = new HashMap<>();
- private StringBuilder validationMessage = new StringBuilder();
-
- public ResourceAssignmentValidator(NodeTemplate nodeTemplate) throws ConfigModelException {
-
- if (nodeTemplate != null && nodeTemplate.getCapabilities() != null) {
- CapabilityAssignment capabilityAssignment =
- nodeTemplate.getCapabilities().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
- if (capabilityAssignment != null && capabilityAssignment.getProperties() != null) {
- Object mappingObject =
- capabilityAssignment.getProperties().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
- if (mappingObject != null) {
- String mappingContent = TransformationUtils.getJson(mappingObject);
- if (StringUtils.isNotBlank(mappingContent)) {
- this.assignments =
- TransformationUtils.getListfromJson(mappingContent, ResourceAssignment.class);
- } else {
- validationMessage
- .append(String.format("Failed to transform Mapping Content (%s) ", mappingContent));
- throw new ConfigModelException(
- String.format("Failed to transform Mapping Content (%s) ", mappingContent));
- }
- }
- }
- }
- }
-
- public ResourceAssignmentValidator(List<ResourceAssignment> assignments) {
- this.assignments = assignments;
- }
-
- /**
- * This is a validateResourceAssignment to validate the Topology Template
- *
- * @return boolean
- * @throws ConfigModelException
- */
- public boolean validateResourceAssignment() throws ConfigModelException {
- if (assignments != null && !assignments.isEmpty()) {
- validateDuplicateDictionaryKeys();
- validateCyclicDependencty();
- if (validationMessage.length() > 0) {
- logger.error("Resourece Assignment Validation : {}", validationMessage);
- throw new ConfigModelException("Resourece Assignment Validation :" + validationMessage.toString());
- }
- }
- return true;
- }
-
- @SuppressWarnings("squid:S3776")
- private void validateDuplicateDictionaryKeys() {
- this.assignments.forEach(resourceMapping -> {
- if (resourceMapping != null) {
- if (!resourceAssignmentMap.containsKey(resourceMapping.getName())) {
- resourceAssignmentMap.put(resourceMapping.getName(), resourceMapping);
- } else {
- validationMessage.append(String.format("Duplicate Assignment Template Key (%s) is Present",
- resourceMapping.getName()));
- }
- }
- });
-
- if (!assignments.isEmpty()) {
- Set<String> uniqueSet = new HashSet<>();
- for (ResourceAssignment resourceAssignment : assignments) {
- if (resourceAssignment != null) {
- boolean added = uniqueSet.add(resourceAssignment.getDictionaryName());
- if (!added) {
- validationMessage.append(
- String.format("Duplicate Assignment Dictionary Key (%s) present with Template Key (%s)",
- resourceAssignment.getDictionaryName(), resourceAssignment.getName()));
- }
- }
- }
- }
- }
-
- private void validateCyclicDependencty() {
- TopologicalSortingUtils<ResourceAssignment> topologySorting = new TopologicalSortingUtils<>();
- this.resourceAssignmentMap.forEach((mappingKey, mapping) -> {
- if (mapping != null) {
- if (mapping.getDependencies() != null && !mapping.getDependencies().isEmpty()) {
- for (String dependency : mapping.getDependencies()) {
- topologySorting.add(resourceAssignmentMap.get(dependency), mapping);
- }
- } else {
- topologySorting.add(null, mapping);
- }
- }
- });
-
- if (!topologySorting.isDag()) {
- String graph = getTopologicalGraph(topologySorting);
- validationMessage.append("Cyclic Dependency :" + graph);
- }
- }
-
- public String getTopologicalGraph(TopologicalSortingUtils<ResourceAssignment> topologySorting) {
- StringBuilder s = new StringBuilder();
- if (topologySorting != null) {
- Map<ResourceAssignment, List<ResourceAssignment>> neighbors = topologySorting.getNeighbors();
-
- neighbors.forEach((v, vs) -> {
- if (v == null) {
- s.append("\n * -> [");
- List<ResourceAssignment> links = vs;
- for (ResourceAssignment resourceAssignment : links) {
- s.append("(" + resourceAssignment.getDictionaryName() + ":" + resourceAssignment.getName()
- + "),");
- }
- s.append("]");
- } else {
- s.append("\n (" + v.getDictionaryName() + ":" + v.getName() + ") -> [");
- List<ResourceAssignment> links = vs;
- for (ResourceAssignment resourceAssignment : links) {
- s.append("(" + resourceAssignment.getDictionaryName() + ":" + resourceAssignment.getName()
- + "),");
- }
- s.append("]");
- }
- });
- }
- return s.toString();
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidator.java deleted file mode 100644 index f503427c8..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidator.java +++ /dev/null @@ -1,129 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-/**
- * ServiceTemplateValidator.java Purpose: Provide Configuration Generator ServiceTemplateValidator
- *
- * @version 1.0
- */
-
-public class ServiceTemplateValidator {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ServiceTemplateValidator.class);
-
- private Map<String, String> metaData = new HashMap<>();
-
- StringBuilder message = new StringBuilder();
-
- /**
- * This is a validateServiceTemplate
- *
- * @param serviceTemplateContent
- * @return boolean
- * @throws ConfigModelException
- */
- @SuppressWarnings("squid:S00112")
- public boolean validateServiceTemplate(String serviceTemplateContent) throws ConfigModelException {
- if (StringUtils.isNotBlank(serviceTemplateContent)) {
- ServiceTemplate serviceTemplate =
- TransformationUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
- return validateServiceTemplate(serviceTemplate);
- } else {
- throw new ConfigModelException(
- "Service Template Content is (" + serviceTemplateContent + ") not Defined.");
- }
- }
-
- /**
- * This is a validateServiceTemplate
- *
- * @param serviceTemplate
- * @return boolean
- * @throws ConfigModelException
- */
- @SuppressWarnings("squid:S00112")
- public boolean validateServiceTemplate(ServiceTemplate serviceTemplate) throws ConfigModelException {
- if (serviceTemplate != null) {
- try {
- validateMetaData(serviceTemplate);
- (new DataTypeValidator(serviceTemplate, message)).validateDataTypes();
- (new NodeTypeValidator(serviceTemplate, message)).validateNodeTypes();
- (new TopologyTemplateValidator(serviceTemplate, message)).validateTopologyTemplate();
- logger.debug("Validation Message : {}", message);
- } catch (Exception e) {
- throw new ConfigModelException(
- "Validation Failed " + e.toString() + ",Message Trace : \n" + message.toString());
- }
-
- } else {
- throw new ConfigModelException("Service Template is not defined.");
- }
- return true;
- }
-
- /**
- * This is a getMetaData to get the key information during the
- *
- * @return Map<String , String>
- */
- public Map<String, String> getMetaData() {
- return metaData;
- }
-
- private void validateMetaData(ServiceTemplate serviceTemplate) throws ConfigModelException {
- if (serviceTemplate.getMetadata() != null) {
- this.metaData.putAll(serviceTemplate.getMetadata());
-
- String author = serviceTemplate.getMetadata().get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_AUTHOR);
- String serviceTemplateName =
- serviceTemplate.getMetadata().get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME);
- String serviceTemplateVersion =
- serviceTemplate.getMetadata().get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION);
-
- if (StringUtils.isBlank(author)) {
- throw new ConfigModelException("Service Template Metadata (author) Information is missing.");
- }
-
- if (StringUtils.isBlank(serviceTemplateName)) {
- throw new ConfigModelException(
- "Service Template Metadata (service-template-name) Information is missing.");
- }
-
- if (StringUtils.isBlank(serviceTemplateVersion)) {
- throw new ConfigModelException(
- "Service Template Metadata (service-template-version) Information is missing.");
- }
-
- } else {
- throw new ConfigModelException("Service Template Metadata Information is missing.");
- }
-
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/TopologyTemplateValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/TopologyTemplateValidator.java deleted file mode 100644 index c735a54cd..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/TopologyTemplateValidator.java +++ /dev/null @@ -1,203 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.RequirementAssignment;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.data.TopologyTemplate;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-/**
- * TopologyTemplateValidator.java Purpose: Provide Configuration Generator TopologyTemplateValidator
- *
- * @version 1.0
- */
-public class TopologyTemplateValidator {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(TopologyTemplateValidator.class);
- private StringBuilder message;
- private Map<String, DataType> stDataTypes;
- private Map<String, NodeType> stNodeTypes;
- private Map<String, NodeTemplate> stNodeTemplates;
- private ServiceTemplate serviceTemplate;
- private PropertyDefinitionValidator propertyDefinitionValidator;
-
- /**
- * This is a TopologyTemplateValidator
- *
- * @param serviceTemplate
- * @throws ConfigModelException
- */
- public TopologyTemplateValidator(ServiceTemplate serviceTemplate, StringBuilder message) {
- this.serviceTemplate = serviceTemplate;
- this.message = message;
- propertyDefinitionValidator = new PropertyDefinitionValidator(this.message);
- stDataTypes = new HashMap<>();
- stNodeTypes = new HashMap<>();
- stNodeTemplates = new HashMap<>();
- loadInitial();
- }
-
- private void loadInitial() {
- if (serviceTemplate != null) {
-
- if (serviceTemplate.getDataTypes() != null) {
- serviceTemplate.getDataTypes().forEach((dataTypeKey, dataType) -> {
- stDataTypes.put(dataTypeKey, dataType);
- logger.trace("Data Type ({}) loaded successfully.", dataTypeKey);
- });
- }
-
- if (serviceTemplate.getNodeTypes() != null) {
- serviceTemplate.getNodeTypes().forEach((nodeTypeKey, nodeType) -> {
- stNodeTypes.put(nodeTypeKey, nodeType);
- logger.trace("Node Type ({}) loaded successfully.", nodeTypeKey);
- });
- }
-
- if (serviceTemplate.getTopologyTemplate() != null) {
- TopologyTemplate topologyTemplate = serviceTemplate.getTopologyTemplate();
-
- if (topologyTemplate.getNodeTemplates() != null) {
- topologyTemplate.getNodeTemplates().forEach((nodeTemplateKey, nodeTemplate) -> {
- stNodeTemplates.put(nodeTemplateKey, nodeTemplate);
- logger.trace("Node Template ({}) Type loaded successfully.", nodeTemplateKey);
- });
- }
- }
- }
-
- }
-
- /**
- * This is a validateTopologyTemplate to validate the Topology Template
- *
- * @return boolean
- * @throws ConfigModelException
- */
- public boolean validateTopologyTemplate() {
- if (serviceTemplate != null && serviceTemplate.getTopologyTemplate() != null) {
-
- checkValidInputProperties(serviceTemplate.getTopologyTemplate().getInputs());
-
- validateNodeTemplates(serviceTemplate.getTopologyTemplate().getNodeTemplates());
- }
- return true;
- }
-
- private boolean checkValidInputProperties(Map<String, PropertyDefinition> properties) {
- if (properties != null) {
- message.append("\n Validation topology template input properties :");
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, properties);
- }
- return true;
- }
-
- @SuppressWarnings({"squid:S00112", "squid:S3776"})
- private boolean validateNodeTemplates(Map<String, NodeTemplate> nodeTemplates) {
- if (nodeTemplates != null) {
- nodeTemplates.forEach((nodeTemplateKey, nodeTemplate) -> {
- if (nodeTemplate != null) {
- message.append("\n ##### Validation Node Template (" + nodeTemplateKey + "), of type ("
- + nodeTemplate.getType() + ")");
-
- String nodeTypeName = nodeTemplate.getType();
- if (!stNodeTypes.containsKey(nodeTypeName)) {
- throw new RuntimeException("Node Type (" + nodeTypeName + ")not Defined.");
- }
-
- if (nodeTemplate.getRequirements() != null) {
- validateNodeTemplateRequirement(nodeTemplate.getRequirements());
- }
-
- // Validate Resource Assignments
- NodeType nodeType = stNodeTypes.get(nodeTypeName);
- if (nodeType != null
- && ConfigModelConstant.MODEL_TYPE_NODE_ARTIFACT.equals(nodeType.getDerivedFrom())) {
- logger.info("Validating Resource Assignment NodeTemplate ({}).", nodeTemplateKey);
- ResourceAssignmentValidator resourceAssignmentValidator;
- try {
- resourceAssignmentValidator = new ResourceAssignmentValidator(nodeTemplate);
- resourceAssignmentValidator.validateResourceAssignment();
- } catch (ConfigModelException e) {
- throw new RuntimeException(e);
- }
-
- }
- }
- });
- }
- return true;
- }
-
- @SuppressWarnings("squid:S00112")
- private boolean validateNodeTemplateRequirement(Map<String, RequirementAssignment> requirements) {
- if (requirements != null) {
- requirements.forEach((requirementKey, requirement) -> {
- if (requirement != null) {
- String requirementnodeTypeName = requirement.getNode();
- String capabilityName = requirement.getCapability();
- try {
- checkCapabilityPresentInNodeTemplate(requirementnodeTypeName, capabilityName);
- } catch (ConfigModelException e) {
- throw new RuntimeException(e);
- }
- }
- });
- }
- return true;
- }
-
- private boolean checkCapabilityPresentInNodeTemplate(String nodeTemplateName, String capabilityName)
- throws ConfigModelException {
- if (StringUtils.isNotBlank(nodeTemplateName) && StringUtils.isNotBlank(capabilityName)) {
-
- if (!stNodeTemplates.containsKey(nodeTemplateName)) {
- throw new ConfigModelException(nodeTemplateName + " Node Template not Defined.");
- } else {
- message.append("\n Node Template (" + nodeTemplateName + ") Defined.");
- }
-
- NodeTemplate relationalNodeType = stNodeTemplates.get(nodeTemplateName);
-
- if (relationalNodeType.getCapabilities() == null) {
- throw new ConfigModelException(
- "Node Template (" + nodeTemplateName + "), doesn't have Capability Definitions.");
- }
-
- if (!relationalNodeType.getCapabilities().containsKey(capabilityName)) {
- throw new ConfigModelException("Node Type (" + nodeTemplateName + ") doesn't have (" + capabilityName
- + ") Capability Definitions.");
- } else {
- message.append("\n Node Template (" + nodeTemplateName + ") has (" + capabilityName
- + ") Capability Definitions.");
- }
-
- }
- return true;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/blueprints-processor/plugin/model-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml deleted file mode 100644 index 5a07f94c6..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- 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.
--->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <!-- Dependency -->
-
- <reference id="configResourceService"
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />
-
- <reference id="configRestAdaptorService"
- interface="org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService" />
-
- <!-- Expose the Common Component Bean -->
- <bean id="configModelNode"
- class="org.onap.ccsdk.features.model.service.ConfigModelNode">
- </bean>
-
- <service ref="configModelNode"
- interface="org.onap.ccsdk.features.model.service.ConfigModelNode" />
-
- <bean id="configModelService"
- class="org.onap.ccsdk.features.model.service.ConfigModelServiceImpl">
- <argument ref="configRestAdaptorService" />
- </bean>
-
- <service ref="configModelService"
- interface="org.onap.ccsdk.features.model.service.ConfigModelService" />
-
-
- <!-- ComponentNode -->
-
- <bean id="componentNodeService"
- class="org.onap.ccsdk.features.model.service.ComponentNodeServiceImpl">
- <argument ref="blueprintBundleContext" />
- <argument ref="configResourceService" />
- <argument ref="configRestAdaptorService" />
- </bean>
-
- <service ref="componentNodeService"
- interface="org.onap.ccsdk.features.model.service.ComponentNodeService" />
-
- <bean id="componentNodeDelegate"
- class="org.onap.ccsdk.features.model.service.ComponentNodeDelegate">
- <argument ref="componentNodeService" />
- </bean>
-
- <service ref="componentNodeDelegate"
- interface="org.onap.ccsdk.features.model.service.ComponentNodeDelegate" />
-
-</blueprint>
diff --git a/blueprints-processor/plugin/model-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/blueprints-processor/plugin/model-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml deleted file mode 100644 index 5a07f94c6..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- 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.
--->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <!-- Dependency -->
-
- <reference id="configResourceService"
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />
-
- <reference id="configRestAdaptorService"
- interface="org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService" />
-
- <!-- Expose the Common Component Bean -->
- <bean id="configModelNode"
- class="org.onap.ccsdk.features.model.service.ConfigModelNode">
- </bean>
-
- <service ref="configModelNode"
- interface="org.onap.ccsdk.features.model.service.ConfigModelNode" />
-
- <bean id="configModelService"
- class="org.onap.ccsdk.features.model.service.ConfigModelServiceImpl">
- <argument ref="configRestAdaptorService" />
- </bean>
-
- <service ref="configModelService"
- interface="org.onap.ccsdk.features.model.service.ConfigModelService" />
-
-
- <!-- ComponentNode -->
-
- <bean id="componentNodeService"
- class="org.onap.ccsdk.features.model.service.ComponentNodeServiceImpl">
- <argument ref="blueprintBundleContext" />
- <argument ref="configResourceService" />
- <argument ref="configRestAdaptorService" />
- </bean>
-
- <service ref="componentNodeService"
- interface="org.onap.ccsdk.features.model.service.ComponentNodeService" />
-
- <bean id="componentNodeDelegate"
- class="org.onap.ccsdk.features.model.service.ComponentNodeDelegate">
- <argument ref="componentNodeService" />
- </bean>
-
- <service ref="componentNodeDelegate"
- interface="org.onap.ccsdk.features.model.service.ComponentNodeDelegate" />
-
-</blueprint>
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/ResourceDictionaryUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/ResourceDictionaryUtilsTest.java deleted file mode 100644 index 760c245fd..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/ResourceDictionaryUtilsTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.data.dict.SourcesDefinition;
-import org.onap.ccsdk.features.model.data.dict.SourcesProperties;
-import org.onap.ccsdk.features.model.utils.ResourceDictionaryUtils;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ResourceDictionaryUtilsTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceDictionaryUtilsTest.class);
-
- @Test
- public void validateSingleInputSource() {
- try {
- logger.info(" **************** Validating validateSingleInputSource *****************");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("test-input-key");
-
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
-
- SourcesProperties sourcesProp = new SourcesProperties();
- sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
-
- SourcesDefinition sourceDef = new SourcesDefinition();
- sourceDef.setProperties(sourcesProp);
-
- HashMap<String, SourcesDefinition> sources = new HashMap<>();
- sources.put("input", sourceDef);
-
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setProperty(propertyDefinition);
- resourceDefinition.setSources(sources);
-
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
-
- Assert.assertNotNull("Resource assignment input sourceName is missing ",
- resourceAssignment.getDictionarySource());
- Assert.assertNotNull("Resource assignment input sourceName property is missing ",
- resourceAssignment.getProperty());
- Assert.assertNotNull("Resource assignment input sourceName property type is missing ",
- resourceAssignment.getProperty().getType());
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void validateSingleDbSource() {
- try {
- logger.info(" **************** Validating validateSingleDbSource *****************");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("test-db-key");
-
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
-
- SourcesProperties sourcesProp = new SourcesProperties();
- sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
-
- SourcesDefinition sourceDef = new SourcesDefinition();
- sourceDef.setProperties(sourcesProp);
-
- HashMap<String, SourcesDefinition> sources = new HashMap<>();
- sources.put("db", sourceDef);
-
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setProperty(propertyDefinition);
- resourceDefinition.setSources(sources);
-
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertNotNull("Resource assignment db sourceName sourceName is missing ",
- resourceAssignment.getDictionarySource());
- Assert.assertNotNull("Resource assignment db sourceName sourceName property is missing ",
- resourceAssignment.getProperty());
- Assert.assertNotNull("Resource assignment db sourceName sourceName property type is missing ",
- resourceAssignment.getProperty().getType());
-
- Assert.assertNotNull("Resource assignment db dependecy is missing ", resourceAssignment.getDependencies());
- Assert.assertEquals("Resource assignment db dependecy count mismatch ", 2,
- resourceAssignment.getDependencies().size());
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void validateMultiSource() {
- try {
- logger.info(" **************** Validating validateMultiSource *****************");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("test-multi-key");
-
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
-
- SourcesProperties sourcesProp = new SourcesProperties();
- sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
-
- SourcesDefinition sourceDef = new SourcesDefinition();
- sourceDef.setProperties(sourcesProp);
-
- HashMap<String, SourcesDefinition> sources = new HashMap<>();
- sources.put("input", sourceDef);
- sources.put("mdsal", sourceDef);
-
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setProperty(propertyDefinition);
- resourceDefinition.setSources(sources);
-
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertNotNull("Resource assignment db sourceName sourceName property is missing ",
- resourceAssignment.getProperty());
- Assert.assertNotNull("Resource assignment db sourceName sourceName property type is missing ",
- resourceAssignment.getProperty().getType());
- Assert.assertNull("Resource assignment multi sourceName sourceName definition is present ",
- resourceAssignment.getDictionarySource());
- Assert.assertNull("Resource assignment multi sourceName dependecy is present ",
- resourceAssignment.getDependencies());
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testSourceDefault() {
- logger.info(" **************** Validating testSourceDefault *****************");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("test-input-key");
-
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
-
- SourcesProperties sourcesProp = new SourcesProperties();
- sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
-
- SourcesDefinition sourceDef = new SourcesDefinition();
- sourceDef.setProperties(sourcesProp);
-
- HashMap<String, SourcesDefinition> sources = new HashMap<>();
- sources.put("default", sourceDef);
-
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setProperty(propertyDefinition);
- resourceDefinition.setSources(sources);
-
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
-
- Assert.assertNotNull("Resource assignment default sourceName is missing ",
- resourceAssignment.getDictionarySource());
- Assert.assertNotNull("Resource assignment default sourceName property is missing ",
- resourceAssignment.getProperty());
- Assert.assertNotNull("Resource assignment default sourceName property type is missing ",
- resourceAssignment.getProperty().getType());
- }
-
- @Test
- public void testSourceMdsal() {
- logger.info(" **************** Validating testSourceMdsal *****************");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("test-input-key");
-
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
-
- SourcesProperties sourcesProp = new SourcesProperties();
- sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
-
- SourcesDefinition sourceDef = new SourcesDefinition();
- sourceDef.setProperties(sourcesProp);
-
- HashMap<String, SourcesDefinition> sources = new HashMap<>();
- sources.put("mdsal", sourceDef);
-
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setProperty(propertyDefinition);
- resourceDefinition.setSources(sources);
-
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
-
- Assert.assertNotNull("Resource assignment mdsal sourceName is missing ",
- resourceAssignment.getDictionarySource());
- Assert.assertNotNull("Resource assignment mdsal sourceName property is missing ",
- resourceAssignment.getProperty());
- Assert.assertNotNull("Resource assignment mdsal sourceName property type is missing ",
- resourceAssignment.getProperty().getType());
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonParserUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonParserUtilsTest.java deleted file mode 100644 index 8ff1ff8de..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonParserUtilsTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import org.junit.Assert;
-import org.junit.Test;
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class JsonParserUtilsTest {
-
- @Test
- public void testParse() {
- final String jsonExample = "{\"key\":\"value\"}";
-
- JsonNode rootJsonNode = JsonParserUtils.parse(jsonExample, "$");
- Assert.assertEquals(jsonExample, rootJsonNode.toString());
-
- JsonNode keyJsonNode = JsonParserUtils.parse(rootJsonNode, "$['key']");
- Assert.assertEquals("value", keyJsonNode.asText());
-
- Assert.assertEquals(jsonExample,
- JsonParserUtils.parseNSet("{\"key\":\"NOT_VALUE\"}", "$['key']", keyJsonNode).toString());
-
- rootJsonNode = JsonParserUtils.parse("{\"key\":\"NOT_VALUE\"}", "$");
- Assert.assertEquals(jsonExample, JsonParserUtils.parseNSet(rootJsonNode, "$['key']", keyJsonNode).toString());
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonUtilsTest.java deleted file mode 100644 index 96d5f89f5..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonUtilsTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.ValidTypes;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class JsonUtilsTest {
-
- @Test
- public void testPopulatePrimitiveValues() {
- ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
- JsonUtils.populatePrimitiveValues("key1", "value", "", objectNode);
- JsonUtils.populatePrimitiveValues("key2", true, ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
- JsonUtils.populatePrimitiveValues("key3", 1, ValidTypes.DATA_TYPE_INTEGER, objectNode);
- JsonUtils.populatePrimitiveValues("key4", 1.1f, ValidTypes.DATA_TYPE_FLOAT, objectNode);
- JsonUtils.populatePrimitiveValues("key5", "13213123131", ValidTypes.DATA_TYPE_TIMESTAMP, objectNode);
-
- assertTrue("value".equals(objectNode.get("key1").asText()));
- assertTrue(objectNode.get("key2").asBoolean());
- assertTrue(objectNode.get("key3").asInt() == 1);
- assertTrue(objectNode.get("key4").floatValue() == 1.1f);
- assertTrue("13213123131".equals(objectNode.get("key5").asText()));
- }
-
- @Test
- public void testPopulatePrimitiveValuesArrayNode() {
- ArrayNode objectNode = JsonNodeFactory.instance.arrayNode();
- JsonUtils.populatePrimitiveValues("value", "", objectNode);
- JsonUtils.populatePrimitiveValues(true, ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
- JsonUtils.populatePrimitiveValues(1, ValidTypes.DATA_TYPE_INTEGER, objectNode);
- JsonUtils.populatePrimitiveValues(1.1f, ValidTypes.DATA_TYPE_FLOAT, objectNode);
- JsonUtils.populatePrimitiveValues("13213123131", ValidTypes.DATA_TYPE_TIMESTAMP, objectNode);
-
- assertTrue(objectNode.size() == 5);
- }
-
- @Test
- public void testPopulatePrimitiveDefaultValues() {
- ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
- JsonUtils.populatePrimitiveDefaultValues("key1", "", objectNode);
- JsonUtils.populatePrimitiveDefaultValues("key2", ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
- JsonUtils.populatePrimitiveDefaultValues("key3", ValidTypes.DATA_TYPE_INTEGER, objectNode);
- JsonUtils.populatePrimitiveDefaultValues("key4", ValidTypes.DATA_TYPE_FLOAT, objectNode);
-
- assertTrue("".equals(objectNode.get("key1").asText()));
- assertTrue(objectNode.get("key2").asBoolean() == false);
- assertTrue(objectNode.get("key3").asInt() == 0);
- assertTrue(objectNode.get("key4").floatValue() == 0.0f);
- }
-
- @Test
- public void testPopulatePrimitiveDefaultValuesForArrayNode() {
- ArrayNode objectNode = JsonNodeFactory.instance.arrayNode();
- JsonUtils.populatePrimitiveDefaultValuesForArrayNode("", objectNode);
- JsonUtils.populatePrimitiveDefaultValuesForArrayNode(ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
- JsonUtils.populatePrimitiveDefaultValuesForArrayNode(ValidTypes.DATA_TYPE_INTEGER, objectNode);
- JsonUtils.populatePrimitiveDefaultValuesForArrayNode(ValidTypes.DATA_TYPE_FLOAT, objectNode);
-
- assertTrue(objectNode.size() == 4);
- }
-
- @Test
- public void testPopulateJsonNodeValues() {
- ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
- JsonUtils.populateJsonNodeValues("key1", JsonNodeFactory.instance.textNode("value"),
- ValidTypes.DATA_TYPE_STRING, objectNode);
- JsonUtils.populateJsonNodeValues("key2", JsonNodeFactory.instance.booleanNode(true),
- ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
- JsonUtils.populateJsonNodeValues("key3", JsonNodeFactory.instance.numberNode(1), ValidTypes.DATA_TYPE_INTEGER,
- objectNode);
- JsonUtils.populateJsonNodeValues("key4", JsonNodeFactory.instance.numberNode(1.1f), ValidTypes.DATA_TYPE_FLOAT,
- objectNode);
- JsonUtils.populateJsonNodeValues("key5", JsonNodeFactory.instance.textNode("13213123131"),
- ValidTypes.DATA_TYPE_TIMESTAMP, objectNode);
- assertTrue(objectNode.get("key2").asBoolean());
-
- assertTrue("value".equals(objectNode.get("key1").asText()));
- assertTrue(objectNode.get("key2").asBoolean());
- assertTrue(objectNode.get("key3").asInt() == 1);
- assertTrue(objectNode.get("key4").floatValue() == 1.1f);
- assertTrue("13213123131".equals(objectNode.get("key5").asText()));
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtilsTest.java deleted file mode 100644 index 60ef24049..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtilsTest.java +++ /dev/null @@ -1,198 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ResourceAssignmentUtilsTest {
-
- @Test
- public void testGetArtifactNodeContent() {
- String nodeTemplateName = "nodeTemplateNmae";
- String templateContent = "content";
- Map<String, Object> context = new HashMap<String, Object>();
- context.put(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateName + ".content", templateContent);
-
- String retrievedContent = ResourceAssignmentUtils.getArtifactNodeContent(nodeTemplateName, context);
-
- assertTrue(templateContent.equals(retrievedContent));
- }
-
- @Test
- public void testGetArtifactNodeMapping() {
- String nodeTemplateName = "nodeTemplateNmae";
- String templateContent = "[]";
- Map<String, Object> context = new HashMap<String, Object>();
- context.put(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateName + ".mapping", templateContent);
-
- List<ResourceAssignment> map = ResourceAssignmentUtils.getArtifactNodeMapping(nodeTemplateName, context);
- assertTrue(map.size() == 0);
- }
-
- @Test
- public void testCleanContextTemplateNDictionaryKeys() {
- String recipeName = "recipe";
- Map<String, Object> componentContext = new HashMap<String, Object>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".", "value1");
- componentContext.put(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + ".", "value2");
- ResourceAssignmentUtils.cleanContextTemplateNDictionaryKeys(componentContext);
-
- assertTrue(componentContext.size() == 1);
- }
-
- @Test
- public void testGetDictionaryKeyValue() {
- String recipeName = "recipe";
- String dictionaryName = "dictionaryKey";
- Map<String, Object> componentContext = new HashMap<String, Object>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryName,
- "value1");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setDictionaryName(dictionaryName);
-
- String value = (String) ResourceAssignmentUtils.getDictionaryKeyValue(componentContext, resourceAssignment);
- assertTrue("value1".equals(value));
- }
-
- @Test
- public void testGetDictionaryKeyValueWithDictionaryDefinition() {
- String recipeName = "recipe";
- String dictionaryName = "dictionaryKey";
- Map<String, Object> componentContext = new HashMap<String, Object>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryName,
- "value1");
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setName(dictionaryName);
-
- String value = (String) ResourceAssignmentUtils.getDictionaryKeyValue(componentContext, resourceDefinition);
- assertTrue("value1".equals(value));
- }
-
- @Test
- public void testGetTemplateKeyValue() {
- String recipeName = "recipe";
- String templateKeyName = "templateKey";
- Map<String, Object> componentContext = new HashMap<String, Object>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + "." + templateKeyName,
- "value1");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName(templateKeyName);
-
- String value = (String) ResourceAssignmentUtils.getTemplateKeyValue(componentContext, resourceAssignment);
- assertTrue("value1".equals(value));
- }
-
- @Test
- public void testSetResourceDataValue() throws Exception {
- String recipeName = "recipe";
- Map<String, Object> componentContext = new HashMap<String, Object>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
-
- ResourceAssignment resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, null);
- Object value = "value";
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- assertTrue(value.equals(resourceAssignment.getProperty().getValue()));
-
- resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_INTEGER, null);
- value = "1";
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- assertTrue((int) resourceAssignment.getProperty().getValue() == 1);
-
- resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_BOOLEAN, null);
- value = "true";
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- assertTrue((boolean) resourceAssignment.getProperty().getValue());
-
- resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_FLOAT, null);
- value = "1.1";
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- assertTrue((float) resourceAssignment.getProperty().getValue() == 1.1f);
- }
-
- @Test
- public void testSetFailedResourceDataValue() throws Exception {
- ResourceAssignment resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, "value");
- String message = "message";
- ResourceAssignmentUtils.setFailedResourceDataValue(null, resourceAssignment, message);
-
- assertTrue(message.equals(resourceAssignment.getMessage()));
- assertTrue(ConfigModelConstant.STATUS_FAILURE.equals(resourceAssignment.getStatus()));
- }
-
- @Test(expected = ConfigModelException.class)
- public void testAssertTemplateKeyValueNotNull() throws Exception {
- Map<String, Object> componentContext = null;
- ResourceAssignment resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, "value");
- ResourceAssignmentUtils.assertTemplateKeyValueNotNull(componentContext, resourceAssignment);
- }
-
- @Test
- public void testGenerateResourceDataForAssignments() throws Exception {
- List<ResourceAssignment> assignments = new ArrayList<ResourceAssignment>();
- assignments.add(createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, "string"));
- assignments.add(createResourceAssignment("name2", ValidTypes.DATA_TYPE_BOOLEAN, true));
- assignments.add(createResourceAssignment("name3", ValidTypes.DATA_TYPE_INTEGER, 1));
- assignments.add(createResourceAssignment("name4", ValidTypes.DATA_TYPE_FLOAT, 1.1f));
- assignments.add(createResourceAssignment("name5", ValidTypes.DATA_TYPE_TIMESTAMP, "1523908097735"));
- assignments.add(createResourceAssignment("name6", "", new HashMap<String, String>()));
- ResourceAssignmentUtils.generateResourceDataForAssignments(assignments);
- }
-
- public void testResourceAssignmentForNullEmptyValues() throws Exception {
-
- ObjectMapper mapper = new ObjectMapper();
- JsonNode raContent =
- mapper.readTree(new File("src/test/resources/service_templates/ra-content-with-mising-value.json"));
-
- List<ResourceAssignment> assignments =
- mapper.readValue(raContent.toString(), new TypeReference<List<ResourceAssignment>>() {});
-
- ResourceAssignmentUtils.generateResourceDataForAssignments(assignments);
- }
-
- private ResourceAssignment createResourceAssignment(String name, String dataType, Object value) {
- PropertyDefinition property = new PropertyDefinition();
- property.setType(dataType);
- property.setValue(value);
- property.setRequired(true);
- ResourceAssignment ra = new ResourceAssignment();
- ra.setName(name);
- ra.setProperty(property);
- return ra;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtilsTest.java deleted file mode 100644 index 525dda4e1..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtilsTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.data.ArtifactDefinition;
-import org.onap.ccsdk.features.model.data.CapabilityAssignment;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-
-public class ServiceTemplateUtilsTest {
-
- ServiceTemplateUtils serviceTemplateUtils = new ServiceTemplateUtils();
-
- @Test
- public void testPopulateVnfNodeProperties() {
- NodeTemplate nodeTemplate = createNodeTemplate();
-
- String nodeTemplateKey = "nodeTemplateKey";
- Map<String, String> context = new HashMap<String, String>();
-
- Map<String, String> result =
- serviceTemplateUtils.populateVnfNodeProperties(nodeTemplateKey, nodeTemplate, context, null);
-
- Assert.assertTrue(result.size() > 0);
- }
-
- @Test
- public void testPopulateNodeTemplateArtifacts() {
- String nodeTemplateKey = "nodeTemplateKey";
- NodeTemplate nodeTemplate = createNodeTemplate();
- Map<String, String> context = new HashMap<String, String>();
-
- Map<String, String> result =
- serviceTemplateUtils.populateNodeTemplateArtifacts(nodeTemplateKey, nodeTemplate, context);
-
- Assert.assertTrue(result.size() > 0);
- }
-
- private NodeTemplate createNodeTemplate() {
- NodeTemplate nodeTemplate = new NodeTemplate();
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("prop1", "value");
- CapabilityAssignment capabilityAssignment = new CapabilityAssignment();
- capabilityAssignment.setProperties(properties);
- Map<String, CapabilityAssignment> capabilities = new HashMap<String, CapabilityAssignment>();
- capabilities.put("key", capabilityAssignment);
- nodeTemplate.setCapabilities(capabilities);
-
- ArtifactDefinition artifactDefinition = new ArtifactDefinition();
- artifactDefinition.setFile("file");
- artifactDefinition.setDeployPath("deployPath");
- artifactDefinition.setContent("content");
- Map<String, ArtifactDefinition> artifacts = new HashMap<String, ArtifactDefinition>();
- artifacts.put("artifactName1", artifactDefinition);
- nodeTemplate.setArtifacts(artifacts);
-
- return nodeTemplate;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/TransformationUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/TransformationUtilsTest.java deleted file mode 100644 index f73bc1af2..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/TransformationUtilsTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Test;
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class TransformationUtilsTest {
-
- @Test
- public void testGetJson() {
- Map<String, Object> configparameters = new HashMap<String, Object>();
- configparameters.put("key", "value");
- String json = TransformationUtils.getJson(configparameters);
- assertTrue("{\"key\":\"value\"}".equals(json));
- }
-
- @Test
- public void testGetJsonNodeForString() {
- String content = "{\"key\":\"value\"}";
- JsonNode jsonNodeForString = TransformationUtils.getJsonNodeForString(content);
- assertNotNull(jsonNodeForString);
- }
-
- @Test
- public void testGetMapfromJson() {
- String content = "{\"key\":\"value\"}";
- Map<String, Object> mapfromJson = TransformationUtils.getMapfromJson(content);
- assertTrue(mapfromJson.size() == 1);
- assertTrue("value".equals(mapfromJson.get("key")));
- }
-
- @Test
- public void testGetMapfromJsonString() {
- String content = "{\"key\":\"value\"}";
- Map<String, Object> mapfromJson = TransformationUtils.getMapfromJsonString(content);
- assertTrue(mapfromJson.size() == 1);
- assertTrue("value".equals(mapfromJson.get("key")));
- }
-
- @Test
- public void testConvertJson2RootProperties() throws Exception {
- Map<String, String> context = new HashMap<String, String>();
- String jsonContent = "{\"key\":\"value\"}";
- Map<String, String> convertJson2RootProperties =
- TransformationUtils.convertJson2RootProperties(context, jsonContent);
- assertTrue(convertJson2RootProperties.size() == 1);
- assertTrue("value".equals(convertJson2RootProperties.get("key")));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testGetJsonNodeAndTreeToValueAndConvertJson2Properties() throws Exception {
- Map<String, String> configparameters = new HashMap<String, String>();
- configparameters.put("key", "value");
- JsonNode jsonNode = TransformationUtils.getJsonNode(configparameters);
- assertNotNull(jsonNode);
-
- Map<String, String> result = TransformationUtils.treeToValue(jsonNode, HashMap.class);
- assertTrue("value".equals(result.get("key")));
-
- result = TransformationUtils.convertJson2Properties(null, jsonNode, null);
- assertTrue("value".equals(result.get("key")));
- }
-
- @Test
- public void testGetJsonSchema() {
- String jsonSchema = TransformationUtils.getJsonSchema(String.class);
- assertNotNull(jsonSchema);
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidationTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidationTest.java deleted file mode 100644 index 72a49ebc7..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidationTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.nio.charset.Charset;
-import org.apache.commons.io.IOUtils;
-import org.junit.Test;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ServiceTemplateValidationTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ServiceTemplateValidationTest.class);
-
- @Test
- public void validateServiceTemplate() {
- try {
- logger.info(" **************** Validating Default *****************");
- String serviceTemplateContent = IOUtils.toString(ServiceTemplateValidationTest.class.getClassLoader()
- .getResourceAsStream("service_templates/default.json"), Charset.defaultCharset());
- ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator();
- serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent);
- logger.info(" **************** Reqource Assignment *****************");
- serviceTemplateContent = IOUtils.toString(ServiceTemplateValidationTest.class.getClassLoader()
- .getResourceAsStream("service_templates/resource_assignment.json"), Charset.defaultCharset());
- serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ComponentNodeTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ComponentNodeTest.java deleted file mode 100644 index 9c048f48e..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ComponentNodeTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.params.service;
-
-import static org.mockito.Matchers.any;
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.sling.testing.mock.osgi.MockOsgi;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.stubbing.Answer;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.service.ComponentNodeDelegate;
-import org.onap.ccsdk.features.model.service.ComponentNodeServiceImpl;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.model.service.ConfigModelServiceImpl;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.osgi.framework.BundleContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ComponentNodeTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ComponentNodeTest.class);
- @Mock
- private ConfigResourceService configResourceService;
-
- @Mock
- private ConfigRestAdaptorService configRestAdaptorService;
-
- BundleContext bundleContext = MockOsgi.newBundleContext();
-
- @Before
- public void before() {
- MockitoAnnotations.initMocks(this);
-
- MockComponentNode mockSvcLogicPlugin = new MockComponentNode();
- bundleContext.registerService(MockComponentNode.class, mockSvcLogicPlugin, null);
-
- try {
- Mockito.doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
- Object[] args = invocationOnMock.getArguments();
- if (args != null) {
- logger.trace("Transaction info " + Arrays.asList(args));
- }
- return null;
- }
- }).when(configResourceService).save(any(TransactionLog.class));
- } catch (SvcLogicException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @After
- public void after() {
-
- }
-
- @Test
- public void testProcess() {
-
- try {
- String serviceTemplateContent = FileUtils.readFileToString(
- new File("src/test/resources/componentnode/default.json"), Charset.defaultCharset());
- ConfigModelService configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
-
- Map<String, String> map = new HashMap<>();
- configModelService.convertServiceTemplate2Properties(serviceTemplateContent, map);
-
- SvcLogicContext ctx = new SvcLogicContext();
- map.forEach((name, value) -> {
- if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) {
- ctx.setAttribute(name, value);
- }
- });
- ctx.setAttribute("vnf-id", "1234");
-
- ComponentNodeServiceImpl componentNodeService =
- new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService);
-
- ComponentNodeDelegate componentNodeDelegate = new ComponentNodeDelegate(componentNodeService);
- Map<String, String> inParams = new HashMap<>();
- inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "generate-configuration");
-
- componentNodeDelegate.process(inParams, ctx);
- TransformationUtils.printMap(inParams);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- @Test(expected = SvcLogicException.class)
- public void testFailure() throws Exception {
- ComponentNodeServiceImpl componentNodeService =
- new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService);
- ComponentNodeDelegate componentNodeDelegate = new ComponentNodeDelegate(componentNodeService);
-
- Map<String, String> inParams = new HashMap<String, String>();
- inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "generate-configuration");
- SvcLogicContext ctx = new SvcLogicContext();
- componentNodeDelegate.process(inParams, ctx);
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ConfigModelServiceTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ConfigModelServiceTest.java deleted file mode 100644 index 3e62fafd0..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ConfigModelServiceTest.java +++ /dev/null @@ -1,219 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.params.service;
-
-import static org.junit.Assert.fail;
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Matchers;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.domain.ConfigModel;
-import org.onap.ccsdk.features.model.domain.ConfigModelContent;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.model.service.ConfigModelServiceImpl;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ConfigModelServiceTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigModelServiceTest.class);
-
- @Mock
- private ConfigRestAdaptorService configRestAdaptorService;
-
- @Test
- public void testConfigAssignmentInputOutputParams() throws Exception {
-
- String fileContent = FileUtils.readFileToString(
- new File("src/test/resources/service_templates/resource_assignment.json"), Charset.defaultCharset());
-
- Map<String, String> context = new HashMap<>();
- ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
- context = configModelServiceImpl.convertServiceTemplate2Properties(fileContent, context);
-
- Assert.assertNotNull("Failed to Prepare Context : ", context);
-
- context.put("request-id", "12345");
- context.put("vnf-id", "vnf12345");
-
- Map<String, String> inparams = new HashMap<String, String>();
- inparams.put(ConfigModelConstant.PROPERTY_SELECTOR, "resource-assignment");
-
- SvcLogicContext inputContext = new SvcLogicContext();
- context.forEach((name, value) -> {
- inputContext.setAttribute(name, value);
- });
-
- // TransformationUtils.printProperty(inputContext.toProperties());
-
- configModelServiceImpl.assignInParamsFromModel(inputContext, inparams);
- Assert.assertNotNull("In Param is Null : ", inparams);
- Assert.assertNotNull("Failed to get entity-id in Inparms : ", inparams.get("resource-id"));
- Assert.assertEquals("Failed to get entity-id vlaue in Inparms ", String.valueOf("vnf12345"),
- inparams.get("resource-id"));
- Assert.assertNotNull("Failed to get request-id in Inparms : ", inparams.get("request-id"));
- Assert.assertEquals("Failed to get request-id vlaue in Inparms ", String.valueOf("12345"),
- inparams.get("request-id"));
-
- configModelServiceImpl.assignOutParamsFromModel(inputContext, inparams);
- logger.info("*************** Output Params *************");
- // TransformationUtils.printProperty(inputContext.toProperties());
-
- }
-
- @Test
- public void testConvertServiceTemplate2PropertiesComplex() throws Exception {
- String fileContent = FileUtils.readFileToString(
- new File("src/test/resources/service_templates/resource_assignment.json"), Charset.defaultCharset());
-
- Map<String, String> context = new HashMap<>();
- context.put("host-password", "1234");
- context.put("host-ip-address", "[123.23.34.45, 123.23.34.45]");
-
- ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
- configModelServiceImpl.convertServiceTemplate2Properties(fileContent, context);
-
- // TransformationUtils.printMap(context);
-
- Map<String, String> inparams = new HashMap<String, String>();
- inparams.put(ConfigModelConstant.PROPERTY_SELECTOR, "resource-assignment");
- logger.info("Before Input Result: " + inparams);
-
- SvcLogicContext inputContext = new SvcLogicContext();
- context.forEach((name, value) -> {
- inputContext.setAttribute(name, value);
- });
-
- configModelServiceImpl.assignInParamsFromModel(inputContext, inparams);
- logger.info("----------Input Result: " + inparams);
-
- inputContext.setAttribute("assignment-params", "default-assigned");
- configModelServiceImpl.assignOutParamsFromModel(inputContext, inparams);
-
- // TransformationUtils.printProperty(inputContext.toProperties());
-
- }
-
- @Test
- public void testGetNodeTemplateContent() throws Exception {
- String templateContent = "{\"id\":\"id\"}";
- SvcLogicContext context = new SvcLogicContext();
- context.setAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + templateContent + ".content",
- templateContent);
-
- ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
- String content = configModelServiceImpl.getNodeTemplateContent(context, templateContent);
-
- Assert.assertEquals(content, templateContent);
- }
-
- @Test
- public void testGetNodeTemplateMapping() throws Exception {
- String templateContent = "{\"capabilities\":{\"mapping\":{\"properties\":{\"mapping\":[\"test\"]}}}}";
- SvcLogicContext context = new SvcLogicContext();
- context.setAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + templateContent, templateContent);
-
- ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
- configModelServiceImpl.getNodeTemplateMapping(context, templateContent);
- // Assert.assertEquals(content, templateContent);
- }
-
- @Test
- public void testValidateServiceTemplate() throws Exception {
- ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
- ServiceTemplate serviceTemplate = new ServiceTemplate();
-
- try {
- configModelServiceImpl.validateServiceTemplate(null);
- fail("Should have thrown exception");
- } catch (SvcLogicException e) {
- }
-
- try {
- configModelServiceImpl.validateServiceTemplate(serviceTemplate);
- fail("Should have thrown exception");
- } catch (SvcLogicException e) {
- }
-
- Map<String, String> metadata = new HashMap<String, String>();
- metadata.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_AUTHOR, "author");
- metadata.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME, "name");
- metadata.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION, "version");
- serviceTemplate.setMetadata(metadata);
-
- Assert.assertTrue(configModelServiceImpl.validateServiceTemplate(serviceTemplate));
- }
-
- @Test
- public void testPrepareContext() throws Exception {
- Mockito.when(configRestAdaptorService.getResource(Matchers.anyString(), Matchers.anyString(), Matchers.any()))
- .thenReturn(createConfigModel());
-
- String input = "{\"action-name\": \"resource-assignment-action\"}";
- ConfigModelService configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
-
- Map<String, String> ctx =
- configModelService.prepareContext(null, input, "serviceTemplateName", "serviceTemplateVersion");
- Assert.assertEquals("resource-assignment-action", ctx.get(ConfigModelConstant.PROPERTY_ACTION_NAME));
-
- ctx = configModelService.prepareContext(null, input, "{}");
- Assert.assertEquals("resource-assignment-action", ctx.get(ConfigModelConstant.PROPERTY_ACTION_NAME));
- }
-
- @Test
- public void testConvertServiceTemplate2Properties() throws Exception {
- Map<String, String> metadata = new HashMap<String, String>();
- metadata.put("key", "value");
- ServiceTemplate serviceTemplate = new ServiceTemplate();
- serviceTemplate.setMetadata(metadata);
- Map<String, String> context = new HashMap<String, String>();
-
- ConfigModelService configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
- Map<String, String> ctx = configModelService.convertServiceTemplate2Properties(serviceTemplate, context);
-
- Assert.assertEquals("value", ctx.get("key"));
- }
-
- private ConfigModel createConfigModel() {
- ConfigModel configModel = new ConfigModel();
- List<ConfigModelContent> configModelContents = new ArrayList<ConfigModelContent>();
- ConfigModelContent configModelContent = new ConfigModelContent();
- configModelContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON);
- configModelContent.setContent("{\"description\": \"description\"}");
- configModelContents.add(configModelContent);
- configModel.setConfigModelContents(configModelContents);
- configModel.setPublished("Y");
- return configModel;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ExpressionUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ExpressionUtilsTest.java deleted file mode 100644 index a1e273a84..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ExpressionUtilsTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.params.service;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.utils.ExpressionUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ExpressionUtilsTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ExpressionUtilsTest.class);
-
- @Test
- public void testProcessJsonExpression() throws Exception {
- String fileContent = FileUtils.readFileToString(new File("src/test/resources/properties/default.json"),
- Charset.defaultCharset());
-
- SvcLogicContext context = new SvcLogicContext();
- context.setAttribute("host-password", "1234");
- context.setAttribute("host-ip-address", "[\"123.23.34.45\", \"123.23.34.45\"]");
- context.setAttribute("loopback-default", "[\"Sample\", \"Brinda\"]");
-
- Map<String, String> inparams = new HashMap<String, String>();
- ExpressionUtils jsonExpressionUtils = new ExpressionUtils(context, inparams);
- ObjectMapper mapper = new ObjectMapper();
- JsonNode rootArray = mapper.readTree(fileContent);
- jsonExpressionUtils.processJsonExpression(rootArray);
-
- }
-
- @Test
- public void testJson2Property() throws Exception {
- String fileContent = FileUtils.readFileToString(new File("src/test/resources/properties/convert.json"),
- Charset.defaultCharset());
-
- List<String> blockKeys = new ArrayList<String>();
- blockKeys.add(
- "interfaces.ResourceAssignmentService.operations.getResourceAssignment.inputs.assignment-mappings");
- blockKeys.add("interfaces.ResourceAssignmentService.operations.getResourceAssignment.outputs");
- blockKeys.add("type");
-
- Map<String, String> workflowMap = new HashMap<>();
- Map<String, String> propertyMap =
- TransformationUtils.convertJson2Properties(workflowMap, fileContent, blockKeys);
-
- TransformationUtils.printMap(propertyMap);
-
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/MockComponentNode.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/MockComponentNode.java deleted file mode 100644 index e779a361a..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/MockComponentNode.java +++ /dev/null @@ -1,62 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.params.service;
-
-import java.util.Map;
-import org.onap.ccsdk.features.model.service.ComponentNode;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class MockComponentNode implements ComponentNode {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(MockComponentNode.class);
-
- @Override
- public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.info("Received preCondition ");
- componentContext.put("test-key", "test");
- return true;
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
-
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.info("Received Request " + componentContext);
- }
-
- @Override
- public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.info("Received preProcess ");
-
- }
-
- @Override
- public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.info("Received postProcess ");
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ServiceTemplateCreateUtils.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ServiceTemplateCreateUtils.java deleted file mode 100644 index 5c89d45ae..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ServiceTemplateCreateUtils.java +++ /dev/null @@ -1,193 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- */
-
-package org.onap.ccsdk.features.params.service;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.data.TopologyTemplate;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-
-public class ServiceTemplateCreateUtils {
-
- public void createNodeTypes(String serviceTemplateFileName) throws IOException {
- if (StringUtils.isNotBlank(serviceTemplateFileName)) {
- String fileContent =
- FileUtils.readFileToString(new File(serviceTemplateFileName), Charset.defaultCharset());
- if (StringUtils.isNotBlank(fileContent)) {
- // System.out.println("NodeTypeCreateUtils.createNodeTypes()" +fileContent );
- ServiceTemplate serviceTemplate = TransformationUtils.readValue(fileContent, ServiceTemplate.class);
-
- String formattedServiceTemplateContent = TransformationUtils.getJson(serviceTemplate, true);
-
- FileUtils.writeStringToFile(new File("src/test/resources/service_templates/default.json"),
- formattedServiceTemplateContent, Charset.defaultCharset());
-
- createVrrNodeTemplate(serviceTemplate);
- createDictionarySchema();
-
- }
- }
- }
-
- public void createNodeTypes(ServiceTemplate serviceTemplate) throws IOException {
-
- if (serviceTemplate != null && serviceTemplate.getNodeTypes() != null) {
- serviceTemplate.getNodeTypes().forEach((nodeTypeKey, node_types) -> {
-
- if (node_types != null && StringUtils.isNotBlank(node_types.getDerivedFrom())) {
-
- try {
- String fileName = "src/test/resources/node_types/";
- if (ConfigModelConstant.MODEL_TYPE_NODE_VNF.equalsIgnoreCase(node_types.getDerivedFrom())) {
- fileName = fileName + "vnf/" + nodeTypeKey + ".json";
- }
- if (ConfigModelConstant.MODEL_TYPE_NODE_DG.equalsIgnoreCase(node_types.getDerivedFrom())) {
- fileName = fileName + "dg/" + nodeTypeKey + ".json";
- }
- if (ConfigModelConstant.MODEL_TYPE_NODE_COMPONENT
- .equalsIgnoreCase(node_types.getDerivedFrom())) {
- fileName = fileName + "component/" + nodeTypeKey + ".json";
- }
- String content = TransformationUtils.getJson(node_types, true);
- FileUtils.write(new File(fileName), content, Charset.defaultCharset());
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
- System.out.println("NodeTypeCreateUtils.createNodeTypes()" + nodeTypeKey);
- });
- }
-
- }
-
- public void createResourceAssignmentNodeTemplate(ServiceTemplate serviceTemplate) throws IOException {
- if (serviceTemplate != null) {
- ServiceTemplate workingServiceTemplate = new ServiceTemplate();
- workingServiceTemplate.setMetadata(serviceTemplate.getMetadata());
-
- Map<String, DataType> data_types = new HashMap<String, DataType>();
- data_types.put("datatype-property", serviceTemplate.getDataTypes().get("datatype-property"));
- data_types.put("datatype-resource-assignment",
- serviceTemplate.getDataTypes().get("datatype-resource-assignment"));
-
- workingServiceTemplate.setDataTypes(data_types);
-
- TopologyTemplate topology_template = new TopologyTemplate();
- Map<String, NodeTemplate> node_templates = new HashMap<String, NodeTemplate>();
-
- Map<String, NodeTemplate> node_Templates = serviceTemplate.getTopologyTemplate().getNodeTemplates();
-
- node_templates.put("base-config-template", node_Templates.get("base-config-template"));
- node_templates.put("licence-template", node_Templates.get("licence-template"));
-
- node_templates.put("resource-assignment-action", node_Templates.get("resource-assignment-action"));
- node_templates.put("resource-assignment", node_Templates.get("resource-assignment"));
-
- topology_template.setNodeTemplates(node_templates);
- topology_template.setInputs(serviceTemplate.getTopologyTemplate().getInputs());
-
- Map<String, NodeType> node_types = new HashMap<String, NodeType>();
- node_types.put("artifact-config-template", serviceTemplate.getNodeTypes().get("artifact-config-template"));
- node_types.put("dg-resource-assignment", serviceTemplate.getNodeTypes().get("dg-resource-assignment"));
- node_types.put("component-resource-assignment",
- serviceTemplate.getNodeTypes().get("component-resource-assignment"));
-
- workingServiceTemplate.setNodeTypes(node_types);
- workingServiceTemplate.setTopologyTemplate(topology_template);
-
- String workingServiceTemplateConmtent = TransformationUtils.getJson(workingServiceTemplate, true);
-
- FileUtils.writeStringToFile(new File("src/test/resources/service_templates/resource_assignment.json"),
- workingServiceTemplateConmtent, Charset.defaultCharset());
-
- File lcmFile = new File(
- "../../../northbound/selfservice-api/provider/src/test/resources/service_templates/resource_assignment.json");
- FileUtils.writeStringToFile(lcmFile, workingServiceTemplateConmtent, Charset.defaultCharset());
-
- File resourceAssignmetFile = new File(
- "../../../plugin/assignment/provider/src/test/resources/service_templates/resource_assignment.json");
- FileUtils.writeStringToFile(resourceAssignmetFile, workingServiceTemplateConmtent,
- Charset.defaultCharset());
-
- System.out.println("NodeTypeCreateUtils.createNodeTemplate() :" + workingServiceTemplateConmtent);
- }
-
- }
-
- public void createVrrNodeTemplate(ServiceTemplate serviceTemplate) throws IOException {
- if (serviceTemplate != null) {
- ServiceTemplate workingServiceTemplate = new ServiceTemplate();
- workingServiceTemplate.setMetadata(serviceTemplate.getMetadata());
-
- TopologyTemplate topology_template = new TopologyTemplate();
- Map<String, NodeTemplate> node_templates = new HashMap<String, NodeTemplate>();
-
- Map<String, NodeTemplate> node_Templates = serviceTemplate.getTopologyTemplate().getNodeTemplates();
-
- node_templates.put("resource-assignment-action", node_Templates.get("resource-assignment-action"));
- node_templates.put("resource-assignment", node_Templates.get("resource-assignment"));
-
- node_templates.put("activate-action", node_Templates.get("activate-action"));
- node_templates.put("base-config-template", node_Templates.get("base-config-template"));
- node_templates.put("licence-template", node_Templates.get("licence-template"));
- node_templates.put("vrr-netconf-device", node_Templates.get("vrr-netconf-device"));
- node_templates.put("get-netconf-config", node_Templates.get("get-netconf-config"));
- node_templates.put("edit-netconf-config", node_Templates.get("edit-netconf-config"));
- node_templates.put("transaction-netconf-baseconfig", node_Templates.get("transaction-netconf-baseconfig"));
-
- topology_template.setNodeTemplates(node_templates);
- topology_template.setInputs(serviceTemplate.getTopologyTemplate().getInputs());
-
- workingServiceTemplate.setTopologyTemplate(topology_template);
-
- String workingServiceTemplateContent = TransformationUtils.getJson(workingServiceTemplate, true);
-
- FileUtils.writeStringToFile(new File("src/test/resources/service_templates/vrr_config.json"),
- workingServiceTemplateContent, Charset.defaultCharset());
-
- }
- }
-
- public void createDictionarySchema() throws IOException {
- String schema = TransformationUtils.getJsonSchema(ResourceDefinition.class);
- FileUtils.writeStringToFile(new File("src/test/resources/dictionary/dictionary_schema.json"), schema,
- Charset.defaultCharset());
- }
-
- public static void main(String[] args) {
- try {
- ServiceTemplateCreateUtils utils = new ServiceTemplateCreateUtils();
- utils.createNodeTypes("src/test/resources/service_templates/default.json");
- } catch (Exception e) {
- // TODO: handle exception
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json b/blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json deleted file mode 100644 index e538b0c48..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json +++ /dev/null @@ -1,100 +0,0 @@ -{
- "metadata": {
- "author": "ks220y@att.com",
- "vendor": "Juniper",
- "os": "XXX",
- "service-type": "AVPN",
- "vnf-type": "VRR",
- "action": "Base Configuration",
- "sub-action": "Generate Configuration",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0"
- },
- "topology_template": {
- "inputs": {
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "vnf-id": {
- "required": true,
- "type": "string"
- },
- "service": {
- "required": true,
- "type": "string"
- },
- "region": {
- "required": true,
- "type": "string"
- },
- "bundle-id": {
- "required": true,
- "type": "string"
- },
- "bundle-mac": {
- "required": true,
- "type": "string"
- }
- },
- "node_templates": {
- "generate-configuration": {
- "type": "mock-component-generateConfig",
- "interfaces": {
- "org-onap-ccsdk-features-params-service-MockComponentNode": {
- "operations": {
- "process": {
- "inputs": {
- "entity-type": "vnf-type",
- "template-content": "sample-template",
- "entity-id": "{ \"get_input\" : \"vnf-id\" }"
- },
- "outputs": {
- "mergedData": "merged Data",
- "status": "status"
- }
- }
- }
- }
- }
- }
- }
- },
- "node_types": {
- "mock-component-generateConfig": {
- "interfaces": {
- "org-onap-ccsdk-features-params-service-MockComponentNode": {
- "operations": {
- "process": {
- "inputs": {
- "entity-type": {
- "required": false,
- "type": "string"
- },
- "template-content": {
- "required": false,
- "type": "string"
- },
- "entity-id": {
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "generated-config": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- }
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json b/blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json deleted file mode 100644 index 809db7dea..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json +++ /dev/null @@ -1,118 +0,0 @@ -{
- "type": "object",
- "properties": {
- "resource-path": {
- "tags": {
- "type": "string"
- },
- "name": {
- "type": "string",
- "required": true
- },
- "type": "string",
- "required": true
- },
- "property": {
- "type": "object",
- "properties": {
- "default": {
- "type": "any"
- },
- "entry_schema": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string"
- }
- }
- },
- "description": {
- "type": "string"
- },
- "type": {
- "type": "string"
- },
- "constraints": {
- "type": "array",
- "items": {
- "type": "object",
- "additionalProperties": {
- "type": "any"
- }
- }
- },
- "value": {
- "type": "any"
- },
- "required": {
- "type": "boolean"
- },
- "status": {
- "type": "string"
- }
- }
- },
- "resource-type": {
- "type": "string",
- "required": true
- },
- "updated-by": {
- "type": "string"
- },
- "sources": {
- "type": "object",
- "required": true,
- "additionalProperties": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string",
- "required": true
- },
- "properties": {
- "type": "object",
- "required": true,
- "properties": {
- "type": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "key": {
- "type": "string"
- },
- "path": {
- "type": "string"
- },
- "url-path": {
- "type": "string"
- },
- "query": {
- "type": "string"
- },
- "input-key-mapping": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "output-key-mapping": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "key-dependencies": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json b/blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json deleted file mode 100644 index cb7d08e44..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json +++ /dev/null @@ -1,33 +0,0 @@ -{
- "type": "sdnc-component-getResourceAssignment",
- "interfaces": {
- "ResourceAssignmentService": {
- "operations": {
- "getResourceAssignment": {
- "inputs": {
- "assignment-mappings": [
- {
- "name": "service-name",
- "mapping-field": "service",
- "mapping-category": "SDN",
- "required": true
- },
- {
- "name": "region-name",
- "mapping-field": "region",
- "mapping-category": "SDN",
- "required": true
- }
- ],
- "pre-data": "{ \"get_attribute\" : \"get-resource-assignment.config-params\" }",
- "prifix": "get-resource-assignment"
- },
- "outputs": {
- "resource-assignment-status": "success",
- "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params\" }"
- }
- }
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json b/blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json deleted file mode 100644 index 335a68759..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json +++ /dev/null @@ -1,16 +0,0 @@ -{
- "default": "{ \"get_input\" : \"loopback-default\" }",
- "domain": "ethernet",
- "criteria": [
- {
- "value": "dummy301me1",
- "type": "complex",
- "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"
- },
- {
- "value": "{ \"get_input\" : \"host-ip-address\" }",
- "type": "simple",
- "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"
- }
- ]
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json deleted file mode 100644 index e53f0f6cd..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json +++ /dev/null @@ -1,591 +0,0 @@ -{
- "metadata" : {
- "author" : "ks220y@att.com",
- "service-template-name" : "VRR-baseconfiguration",
- "service-template-version" : "1.0.0",
- "release" : "1802",
- "service-type" : "AVPN",
- "vnf-type" : "VRR"
- },
- "tosca_definitions_version" : "sdn_config_1_0_0",
- "topology_template" : {
- "inputs" : {
- "request-id" : {
- "required" : true,
- "type" : "string"
- },
- "service-instance-id" : {
- "required" : true,
- "type" : "string"
- },
- "action-name" : {
- "required" : true,
- "type" : "string"
- },
- "scope-type" : {
- "required" : true,
- "type" : "string"
- },
- "hostname" : {
- "required" : true,
- "type" : "string"
- }
- },
- "node_templates" : {
- "base-config-template" : {
- "type" : "artifact-config-template",
- "properties" : {
- "action-names" : [ "resource-assignment-action" ]
- },
- "capabilities" : {
- "content" : {
- "properties" : {
- "content" : "db://base-config-template"
- }
- },
- "mapping" : {
- "properties" : {
- "mapping" : [ {
- "name" : "vnf-id",
- "input-param" : true,
- "property" : {
- "type" : "string",
- "required" : true
- },
- "dictionary-name" : "vnf-id",
- "dictionary-source" : "input"
- }, {
- "name" : "group-name",
- "input-param" : true,
- "property" : {
- "type" : "string",
- "required" : true
- },
- "dictionary-name" : "group-name",
- "dictionary-source" : "input"
- } ]
- }
- }
- }
- },
- "licence-template" : {
- "type" : "artifact-config-template",
- "properties" : {
- "action-names" : [ "resource-assignment-action" ]
- },
- "capabilities" : {
- "content" : {
- "properties" : {
- "content" : "db://licence-template"
- }
- },
- "mapping" : {
- "properties" : {
- "mapping" : [ {
- "name" : "bundle-id",
- "input-param" : true,
- "property" : {
- "type" : "string"
- },
- "dictionary-name" : "bundle-id",
- "dictionary-source" : "input"
- }, {
- "name" : "bundle-mac",
- "input-param" : true,
- "property" : {
- "type" : "string",
- "required" : true
- },
- "dictionary-name" : "bundle-mac",
- "dictionary-source" : "input"
- } ]
- }
- }
- }
- },
- "resource-assignment-action" : {
- "type" : "dg-resource-assignment",
- "interfaces" : {
- "CONFIG" : {
- "operations" : {
- "ResourceAssignment" : { }
- }
- }
- },
- "capabilities" : {
- "dg-node" : { }
- },
- "requirements" : {
- "component-dependency" : {
- "capability" : "component-node",
- "node" : "resource-assignment",
- "relationship" : "tosca.relationships.DependsOn"
- }
- }
- },
- "config-generator-action" : {
- "type" : "dg-config-generator",
- "interfaces" : {
- "CONFIG" : {
- "operations" : {
- "GenerateConfiguration" : { }
- }
- }
- },
- "capabilities" : {
- "dg-node" : { }
- },
- "requirements" : {
- "component-dependency" : {
- "capability" : "component-node",
- "node" : "generate-configuration",
- "relationship" : "tosca.relationships.DependsOn"
- }
- }
- },
- "resource-assignment" : {
- "type" : "component-resource-assignment",
- "interfaces" : {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode" : {
- "operations" : {
- "process" : {
- "inputs" : {
- "action-name" : "{ \"get_input\" : \"action-name\" }",
- "resource-type" : "vnf-type",
- "template-names" : [ "base-config-template", "licence-template" ],
- "request-id" : "{ \"get_input\" : \"request-id\" }",
- "resource-id" : "{ \"get_input\" : \"vnf-id\" }"
- },
- "outputs" : {
- "resource-assignment-params" : "",
- "status" : ""
- }
- }
- }
- }
- },
- "capabilities" : {
- "component-node" : { }
- }
- },
- "generate-configuration" : {
- "type" : "component-config-generator",
- "interfaces" : {
- "org-onap-ccsdk-features-generator-service-ConfigGeneratorNode" : {
- "operations" : {
- "process" : {
- "inputs" : {
- "action-name" : "{ \"get_input\" : \"action-name\" }",
- "resource-type" : "vnf-type",
- "request-id" : "{ \"get_input\" : \"request-id\" }",
- "resource-id" : "{ \"get_input\" : \"vnf-id\" }",
- "template-name" : "base-config-template"
- },
- "outputs" : {
- "generated-config" : "",
- "status" : ""
- }
- }
- }
- }
- },
- "capabilities" : {
- "component-node" : { }
- }
- }
- }
- },
- "artifact_types" : {
- "artifact-template-velocity" : {
- "description" : " Velocity Template used for Configuration",
- "version" : "1.0.0",
- "derived_from" : "tosca.artifacts.Implementation",
- "file_ext" : [ "vtl" ]
- },
- "artifact-mapping-resource" : {
- "description" : " Velocity Template Resource Mapping File used along with Configuration template",
- "version" : "1.0.0",
- "derived_from" : "tosca.artifacts.Implementation",
- "file_ext" : [ "json" ]
- },
- "artifact-script-python" : {
- "description" : " Python Script Template used for Configuration",
- "version" : "1.0.0",
- "derived_from" : "tosca.artifacts.Implementation",
- "file_ext" : [ "py" ]
- }
- },
- "node_types" : {
- "dg-resource-assignment" : {
- "description" : "This is Resource Assignment Directed Graph",
- "version" : "1.0.0",
- "properties" : {
- "mode" : {
- "required" : false,
- "type" : "string",
- "default" : "sync"
- },
- "version" : {
- "required" : false,
- "type" : "string",
- "default" : "LATEST"
- },
- "is-start-flow" : {
- "required" : false,
- "type" : "boolean",
- "default" : "false"
- }
- },
- "capabilities" : {
- "dg-node" : {
- "type" : "tosca.capabilities.Node"
- },
- "content" : {
- "type" : "tosca.capabilities.Content",
- "properties" : {
- "type" : {
- "required" : false,
- "type" : "string",
- "default" : "json"
- },
- "content" : {
- "required" : true,
- "type" : "string"
- }
- }
- }
- },
- "requirements" : {
- "component-dependency" : {
- "capability" : "component-node",
- "node" : "component-resource-assignment",
- "relationship" : "tosca.relationships.DependsOn"
- }
- },
- "interfaces" : {
- "CONFIG" : {
- "operations" : {
- "ResourceAssignment" : {
- "inputs" : {
- "params" : {
- "required" : false,
- "type" : "list",
- "entry_schema" : {
- "type" : "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from" : "tosca.nodes.DG"
- },
- "dg-config-generator" : {
- "description" : "This is Activate DG for Config Generator Directed Graph",
- "version" : "1.0.0",
- "properties" : {
- "mode" : {
- "required" : false,
- "type" : "string",
- "default" : "sync"
- },
- "version" : {
- "required" : false,
- "type" : "string",
- "default" : "LATEST"
- },
- "is-start-flow" : {
- "required" : false,
- "type" : "boolean",
- "default" : "false"
- }
- },
- "capabilities" : {
- "dg-node" : {
- "type" : "tosca.capabilities.Node"
- },
- "content" : {
- "type" : "tosca.capabilities.Content",
- "properties" : {
- "type" : {
- "required" : false,
- "type" : "string",
- "default" : "json"
- },
- "content" : {
- "required" : true,
- "type" : "string"
- }
- }
- }
- },
- "requirements" : {
- "component-dependency" : {
- "capability" : "component-node",
- "node" : "component-config-generator",
- "relationship" : "tosca.relationships.DependsOn"
- }
- },
- "interfaces" : {
- "CONFIG" : {
- "operations" : {
- "GenerateConfiguration" : {
- "inputs" : {
- "params" : {
- "required" : false,
- "type" : "list",
- "entry_schema" : {
- "type" : "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from" : "tosca.nodes.DG"
- },
- "artifact-config-template" : {
- "description" : "This is Configuration Velocity Template",
- "version" : "1.0.0",
- "properties" : {
- "action-names" : {
- "required" : true,
- "type" : "list",
- "entry_schema" : {
- "type" : "string"
- }
- },
- "content" : {
- "required" : false,
- "type" : "string"
- },
- "mapping" : {
- "required" : false,
- "type" : "list",
- "entry_schema" : {
- "type" : "datatype-resource-assignment"
- }
- }
- },
- "capabilities" : {
- "content" : {
- "type" : "tosca.capabilities.Content",
- "properties" : {
- "content" : {
- "required" : true,
- "type" : "string"
- }
- }
- },
- "mapping" : {
- "type" : "tosca.capabilities.Mapping",
- "properties" : {
- "mapping" : {
- "required" : false,
- "type" : "list",
- "entry_schema" : {
- "type" : "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from" : "tosca.nodes.Artifact"
- },
- "component-resource-assignment" : {
- "description" : "This is Resource Assignment Component API",
- "version" : "1.0.0",
- "capabilities" : {
- "component-node" : {
- "type" : "tosca.capabilities.Node"
- }
- },
- "interfaces" : {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode" : {
- "operations" : {
- "process" : {
- "inputs" : {
- "action-name" : {
- "description" : "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required" : false,
- "type" : "string"
- },
- "handler-name" : {
- "description" : "Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
- "required" : true,
- "type" : "string"
- },
- "resource-type" : {
- "required" : false,
- "type" : "string"
- },
- "template-names" : {
- "description" : "Name of the Artifact Node Templates, to get the template Content.",
- "required" : true,
- "type" : "list",
- "entry_schema" : {
- "type" : "string"
- }
- },
- "request-id" : {
- "description" : "Request Id used to store the generated configuration, in the database along with the template-name",
- "required" : true,
- "type" : "string"
- },
- "resource-id" : {
- "description" : "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required" : true,
- "type" : "string"
- }
- },
- "outputs" : {
- "resource-assignment-params" : {
- "required" : true,
- "type" : "string"
- },
- "status" : {
- "required" : true,
- "type" : "string"
- }
- }
- }
- }
- }
- },
- "derived_from" : "tosca.nodes.Component"
- },
- "component-config-generator" : {
- "description" : "This is Generate Configuration Component API",
- "version" : "1.0.0",
- "capabilities" : {
- "component-node" : {
- "type" : "tosca.capabilities.Node"
- }
- },
- "interfaces" : {
- "org-onap-ccsdk-features-generator-service-ConfigGeneratorNode" : {
- "operations" : {
- "process" : {
- "inputs" : {
- "template-data" : {
- "description" : "Conditional : JSON string which is used to mash with template. Either template-data or ( resource-id and resource-type ) should be present",
- "required" : false,
- "type" : "string"
- },
- "action-name" : {
- "description" : "Conditional : Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required" : false,
- "type" : "string"
- },
- "template-content" : {
- "description" : "Conditional : Dynamic Template used to generate Configuration.",
- "required" : false,
- "type" : "string"
- },
- "resource-type" : {
- "description" : "Conditional : resource-type used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
- "required" : false,
- "type" : "string"
- },
- "request-id" : {
- "description" : "Request Id used to store the generated configuration, in the database along with the template-name",
- "required" : true,
- "type" : "string"
- },
- "resource-id" : {
- "description" : "Conditional : Id used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
- "required" : false,
- "type" : "string"
- },
- "template-name" : {
- "description" : "Conditional : Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
- "required" : true,
- "type" : "string"
- }
- },
- "outputs" : {
- "generated-config" : {
- "description" : "Generated Configuration for the Template adn Resource Data",
- "required" : true,
- "type" : "string"
- },
- "mask-info" : {
- "description" : "If template contains mask encription keys, then this mask-info field will be generated, This JSON Content alligns to the bean org.onap.ccsdk.features.model.data.custom.MaskInfo ",
- "required" : false,
- "type" : "string"
- },
- "status" : {
- "description" : "Status of the Component Execution ( success or failure )",
- "required" : true,
- "type" : "string"
- }
- }
- }
- }
- }
- },
- "derived_from" : "tosca.nodes.Component"
- }
- },
- "data_types" : {
- "datatype-resource-assignment" : {
- "version" : "1.0.0",
- "description" : "This is Resource Assignment Data Type",
- "properties" : {
- "property" : {
- "required" : true,
- "type" : "datatype-property"
- },
- "input-param" : {
- "required" : true,
- "type" : "boolean"
- },
- "dictionary-name" : {
- "required" : false,
- "type" : "string"
- },
- "dictionary-source" : {
- "required" : false,
- "type" : "string"
- },
- "dependencies" : {
- "required" : true,
- "type" : "list",
- "entry_schema" : {
- "type" : "string"
- }
- }
- },
- "derived_from" : "tosca.datatypes.Root"
- },
- "datatype-property" : {
- "version" : "1.0.0",
- "description" : "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
- "properties" : {
- "type" : {
- "required" : true,
- "type" : "string"
- },
- "description" : {
- "required" : false,
- "type" : "string"
- },
- "required" : {
- "required" : false,
- "type" : "boolean"
- },
- "default" : {
- "required" : false,
- "type" : "string"
- },
- "entry_schema" : {
- "required" : false,
- "type" : "string"
- }
- },
- "derived_from" : "tosca.datatypes.Root"
- }
- }
-}
\ No newline at end of file diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json deleted file mode 100644 index 72332d1b3..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json +++ /dev/null @@ -1,265 +0,0 @@ -[
- {
- "name": "security-manager-resource-key",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "security-manager-resource-key",
- "dictionary-source": "input"
- },
- {
- "name": "security-manager-resource-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "security-manager-resource-name",
- "dictionary-source": "input"
- },
- {
- "name": "snmp-server-ipv4-addresses",
- "input-param": true,
- "property": {
- "type": "list",
- "required": true,
- "entry_schema": {
- "type": "string"
- }
- },
- "dictionary-name": "snmp-server-ipv4-addresses",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "asn-region",
- "complex-code"
- ]
- },
- {
- "name": "snmp-community",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "snmp-community",
- "dictionary-source": "nsm",
- "dependencies": [
- "security-manager-resource-name",
- "security-manager-resource-key"
- ],
- "version": 0
- },
- {
- "name": "lo0-local-ipv4-address",
- "property": {
- "description": "",
- "required": true,
- "type": "string",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": ""
- }
- },
- "input-param": false,
- "dictionary-name": "lo0-local-ipv4-address",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "adig-urlb-route-reflectors",
- "property": {
- "description": "",
- "required": true,
- "type": "list",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": "dt-adig-urlb-route-reflectors"
- }
- },
- "input-param": false,
- "dictionary-name": "adig-urlb-route-reflectors",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "region"
- ],
- "version": 0
- },
- {
- "name": "bundle-id",
- "property": {
- "description": "",
- "required": true,
- "type": "string",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": ""
- }
- },
- "input-param": false,
- "dictionary-name": "bundle-id",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "uplink-1-unit",
- "property": {
- "description": "",
- "required": true,
- "type": "integer",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": ""
- }
- },
- "input-param": false,
- "dictionary-name": "uplink-1-unit",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "uplink-2-unit",
- "property": {
- "description": "",
- "required": true,
- "type": "integer",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": ""
- }
- },
- "input-param": false,
- "dictionary-name": "uplink-2-unit",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "lo10-local-ipv4-address",
- "property": {
- "description": "",
- "required": true,
- "type": "string",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": ""
- }
- },
- "input-param": false,
- "dictionary-name": "lo10-local-ipv4-address",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "complex-code",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "complex-code",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "country-code",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "country-code",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "hostname",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "hostname",
- "dictionary-source": "input",
- "version": 0
- },
- {
- "name": "region",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "region",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- }
-]
\ No newline at end of file diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json deleted file mode 100644 index cbea6a82c..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json +++ /dev/null @@ -1,407 +0,0 @@ -{
- "metadata": {
- "author": "ks220y@att.com",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "release": "1802",
- "service-type": "AVPN",
- "vnf-type": "VRR"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "required": true,
- "type": "string"
- }
- },
- "node_templates": {
- "base-config-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://base-config-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input"
- },
- {
- "name": "group-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "group-name",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment-action": {
- "type": "dg-resource-assignment",
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
-
- }
- }
- }
- },
- "capabilities": {
- "dg-node": {
-
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- }
- },
- "licence-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://licence-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "input"
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment": {
- "type": "component-resource-assignment",
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "resource-type": "vnf-type",
- "template-names": [
- "base-config-template",
- "licence-template"
- ],
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"vnf-id\" }"
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- }
- }
- },
- "node_types": {
- "dg-resource-assignment": {
- "description": "This is Resource Assignment Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": "false"
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- },
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.DG"
- },
- "component-resource-assignment": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": {
- "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "handler-name": {
- "description": "Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
- "required": true,
- "type": "string"
- },
- "resource-type": {
- "required": false,
- "type": "string"
- },
- "template-names": {
- "description": "Name of the Artifact Node Templates, to get the template Content.",
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- },
- "resource-id": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "resource-assignment-params": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "artifact-config-template": {
- "description": "This is Configuration Velocity Template",
- "version": "1.0.0",
- "properties": {
- "action-names": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "content": {
- "required": false,
- "type": "string"
- },
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- },
- "capabilities": {
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "content": {
- "required": true,
- "type": "string"
- }
- }
- },
- "mapping": {
- "type": "tosca.capabilities.Mapping",
- "properties": {
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Artifact"
- }
- },
- "data_types": {
- "datatype-resource-assignment": {
- "version": "1.0.0",
- "description": "This is Resource Assignment Data Type",
- "properties": {
- "property": {
- "required": true,
- "type": "datatype-property"
- },
- "input-param": {
- "required": true,
- "type": "boolean"
- },
- "dictionary-name": {
- "required": false,
- "type": "string"
- },
- "dictionary-source": {
- "required": false,
- "type": "string"
- },
- "dependencies": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "datatype-property": {
- "version": "1.0.0",
- "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
- "properties": {
- "type": {
- "required": true,
- "type": "string"
- },
- "description": {
- "required": false,
- "type": "string"
- },
- "required": {
- "required": false,
- "type": "boolean"
- },
- "default": {
- "required": false,
- "type": "string"
- },
- "entry_schema": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- }
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl deleted file mode 100644 index ce7745bb7..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl +++ /dev/null @@ -1 +0,0 @@ -This is sample Base Configuration for ${bundle-id} for ${bundle-mac}
\ No newline at end of file diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/licence-template.vtl b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/licence-template.vtl deleted file mode 100644 index e69de29bb..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/licence-template.vtl +++ /dev/null diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json deleted file mode 100644 index 8c87f2d34..000000000 --- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json +++ /dev/null @@ -1,171 +0,0 @@ -{
- "metadata": {
- "author": "ks220y@att.com",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "release": "1802",
- "service-type": "AVPN",
- "vnf-type": "VRR"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "required": true,
- "type": "string"
- }
- },
- "node_templates": {
- "base-config-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://base-config-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input"
- },
- {
- "name": "group-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "group-name",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment-action": {
- "type": "dg-resource-assignment",
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
-
- }
- }
- }
- },
- "capabilities": {
- "dg-node": {
-
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- }
- },
- "licence-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://licence-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "input"
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment": {
- "type": "component-resource-assignment",
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "resource-type": "vnf-type",
- "template-names": [
- "base-config-template",
- "licence-template"
- ],
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"vnf-id\" }"
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- }
- }
- }
-}
\ No newline at end of file diff --git a/blueprints-processor/plugin/pom.xml b/blueprints-processor/plugin/pom.xml deleted file mode 100644 index f6fe034b2..000000000 --- a/blueprints-processor/plugin/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright © 2017-2018 AT&T Intellectual Property. - Modifications Copyright © 2018 IBM. - - 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>odlparent-lite</artifactId> - <version>1.5.2-SNAPSHOT</version> - <relativePath/> - </parent> - - <groupId>org.onap.ccsdk.features</groupId> - <artifactId>blueprints-processor-plugin</artifactId> - <version>0.7.1-SNAPSHOT</version> - <packaging>pom</packaging> - - <name>ccsdk-features :: ${project.artifactId}</name> - <description>Blueprints Processor Plugins - POM</description> - - <modules> - <module>model-provider</module> - <module>assignment-provider</module> - <module>generator-provider</module> - </modules> -</project> |