From 594b5e1c919089c110e6aa9b9d1c00b96a9e96f9 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 4 Sep 2018 20:24:35 +0000 Subject: Controller Blueprints Microservice Refactor controller blueprint core and resource dictionary modules to components module. Change-Id: If5ba5e35e9c95bc19bc78fb10bd62d6551ba7aca Issue-ID: CCSDK-514 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/CustomFunctionsTest.kt | 35 +++ .../core/service/BluePrintContextTest.kt | 70 ++++++ .../core/service/BluePrintEnhancerServiceTest.kt | 41 ++++ .../core/service/BluePrintExpressionServiceTest.kt | 109 +++++++++ .../core/service/BluePrintParserFactoryTest.kt | 42 ++++ .../core/service/BluePrintRepoFileServiceTest.kt | 57 +++++ .../core/service/BluePrintRuntimeServiceTest.kt | 131 +++++++++++ .../BluePrintValidatorDefaultServiceTest.kt | 49 ++++ .../core/utils/BluePrintMetadataUtilsTest.kt | 40 ++++ .../core/utils/JacksonReactorUtilsTest.kt | 51 ++++ .../core/utils/JacksonUtilsTest.kt | 93 ++++++++ .../core/utils/TopologicalSortingUtilsTest.kt | 36 +++ .../src/test/resources/componentnode/default.json | 100 ++++++++ .../core/src/test/resources/data/alltype-data.json | 10 + .../src/test/resources/data/default-context.json | 5 + .../resources/dictionary/dictionary_schema.json | 261 +++++++++++++++++++++ .../src/test/resources/properties/convert.json | 33 +++ .../src/test/resources/properties/default.json | 16 ++ 18 files changed, 1179 insertions(+) create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt create mode 100644 components/core/src/test/resources/componentnode/default.json create mode 100644 components/core/src/test/resources/data/alltype-data.json create mode 100644 components/core/src/test/resources/data/default-context.json create mode 100644 components/core/src/test/resources/dictionary/dictionary_schema.json create mode 100644 components/core/src/test/resources/properties/convert.json create mode 100644 components/core/src/test/resources/properties/default.json (limited to 'components/core/src/test') diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt new file mode 100644 index 00000000..128b7f57 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt @@ -0,0 +1,35 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.apps.controllerblueprints.core + +import org.junit.Test +import kotlin.test.assertEquals +/** + * + * + * @author Brinda Santh + */ +class CustomFunctionsTest { + @Test + fun testFormat(): Unit { + val returnValue : String = format("This is {} for times {}", "test", 2) + assertEquals("This is test for times 2", returnValue, "Failed to format String") + + val returnValue1 : String = format("This is test for times 2") + assertEquals("This is test for times 2", returnValue1, "Failed to format empty args") + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt new file mode 100644 index 00000000..7a74ca47 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt @@ -0,0 +1,70 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.apps.controllerblueprints.core.service + + +import org.apache.commons.io.FileUtils +import org.junit.Before +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager +import java.io.File +import java.nio.charset.Charset +import kotlin.test.assertNotNull +/** + * + * + * @author Brinda Santh + */ +class BluePrintContextTest { + + private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) + + lateinit var bluePrintContext: BluePrintContext + + @Before + fun setUp() { + + val basepath = "load/blueprints" + + bluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!! + .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath) + assertNotNull(bluePrintContext, "Failed to populate Blueprint context") + } + + @Test + fun testBluePrintContextFromContent() { + val fileName = "load/blueprints/baseconfiguration/Definitions/activation-blueprint.json" + val content : String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset()) + val bpContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!! + .readBlueprint(content) + assertNotNull(bpContext, "Failed to get blueprint content") + assertNotNull(bpContext.serviceTemplate, "Failed to get blueprint content's service template") + } + + @Test + fun testChainedProperty() { + val nodeType = bluePrintContext.nodeTypeChained("component-resource-assignment") + assertNotNull(nodeType, "Failed to get chained node type") + log.trace("Properties {}", JacksonUtils.getJson(nodeType, true)) + } + + +} diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt new file mode 100644 index 00000000..8e6d5efd --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt @@ -0,0 +1,41 @@ +/* + * 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.apps.controllerblueprints.core.service + +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.utils.ServiceTemplateUtils + +/** + * BluePrintEnhancerServiceTest + * @author Brinda Santh + * + */ + +class BluePrintEnhancerServiceTest { + val basePath = "load/model_type" + + @Test + fun testEnrichBlueprint() { + val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath) + val bluePrintEnhancerService: BluePrintEnhancerService = BluePrintEnhancerDefaultService(bluePrintEnhancerRepoFileService) + + val serviceTemplate = ServiceTemplateUtils.getServiceTemplate("load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json") + bluePrintEnhancerService.enhance(serviceTemplate) + + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt new file mode 100644 index 00000000..911a891a --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt @@ -0,0 +1,109 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.apps.controllerblueprints.core.service + +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.data.ExpressionData +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +/** + * + * + * @author Brinda Santh + */ +class BluePrintExpressionServiceTest { + @Test + fun testInputExpression() { + val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_input\" : \"input-name\" }") + val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node) + assertNotNull(expressionData, " Failed to populate expression data") + assertEquals(expressionData.isExpression, true, "Failed to identify as expression") + assertNotNull(expressionData.inputExpression, " Failed to populate input expression data") + assertEquals("input-name", expressionData.inputExpression?.propertyName, "Failed to get propertyName from expression data") + } + + @Test + fun testPropertyExpression() { + val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_property\" : [\"SELF\", \"property-name\"] }") + val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node) + assertNotNull(expressionData, " Failed to populate expression data") + assertEquals(expressionData.isExpression, true, "Failed to identify as expression") + assertNotNull(expressionData.propertyExpression, " Failed to populate property expression data") + assertEquals("SELF", expressionData.propertyExpression?.modelableEntityName, " Failed to get expected modelableEntityName") + assertEquals("property-name", expressionData.propertyExpression?.propertyName, " Failed to get expected propertyName") + + val node1 : JsonNode = jacksonObjectMapper().readTree("{ \"get_property\" : [\"SELF\", \"\",\"property-name\", \"resource\", \"name\"] }") + val expressionData1 : ExpressionData = BluePrintExpressionService.getExpressionData(node1) + assertNotNull(expressionData1, " Failed to populate expression data") + assertEquals(expressionData1.isExpression, true, "Failed to identify as nested property expression") + assertNotNull(expressionData1.propertyExpression, " Failed to populate nested property expression data") + assertEquals("SELF", expressionData1.propertyExpression?.modelableEntityName, " Failed to get expected modelableEntityName") + assertEquals("property-name", expressionData1.propertyExpression?.propertyName, " Failed to get expected propertyName") + assertEquals("resource/name",expressionData1.propertyExpression?.subPropertyName, " Failed to populate nested subPropertyName expression data") + } + + @Test + fun testAttributeExpression() { + val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }") + val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node) + assertNotNull(expressionData, " Failed to populate expression data") + assertEquals(expressionData.isExpression, true, "Failed to identify as expression") + assertNotNull(expressionData.attributeExpression, " Failed to populate attribute expression data") + assertEquals("SELF", expressionData.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName") + assertEquals("attribute-name", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName") + assertEquals("resource/name",expressionData.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data") + } + + + @Test + fun testOutputOperationExpression() { + val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_operation_output\": [\"SELF\", \"interface-name\", \"operation-name\", \"output-property-name\"] }") + val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node) + assertNotNull(expressionData, " Failed to populate expression data") + assertEquals(expressionData.isExpression, true, "Failed to identify as expression") + assertNotNull(expressionData.operationOutputExpression, " Failed to populate output expression data") + assertEquals("SELF", expressionData.operationOutputExpression?.modelableEntityName, " Failed to get expected modelableEntityName") + assertEquals("interface-name", expressionData.operationOutputExpression?.interfaceName, " Failed to get expected interfaceName") + assertEquals("operation-name", expressionData.operationOutputExpression?.operationName, " Failed to get expected operationName") + assertEquals("output-property-name", expressionData.operationOutputExpression?.propertyName, " Failed to get expected propertyName") + } + + + @Test + fun testArtifactExpression() { + val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_artifact\" : [\"SELF\", \"artifact-template\"] }") + val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node) + assertNotNull(expressionData, " Failed to populate expression data") + assertEquals(expressionData.isExpression, true, "Failed to identify as expression") + assertNotNull(expressionData.artifactExpression, " Failed to populate Artifact expression data") + assertEquals("SELF", expressionData.artifactExpression?.modelableEntityName, " Failed to get expected modelableEntityName") + assertEquals("artifact-template", expressionData.artifactExpression?.artifactName, " Failed to get expected artifactName") + + + val node1 : JsonNode = jacksonObjectMapper().readTree("{ \"get_artifact\" : [\"SELF\", \"artifact-template\", \"location\", true] }") + val expressionData1 : ExpressionData = BluePrintExpressionService.getExpressionData(node1) + assertNotNull(expressionData1, " Failed to populate expression data") + assertEquals(expressionData1.isExpression, true, "Failed to identify as expression") + assertNotNull(expressionData1.artifactExpression, " Failed to populate Artifact expression data") + assertEquals("SELF", expressionData1.artifactExpression?.modelableEntityName, " Failed to get expected modelableEntityName") + assertEquals("artifact-template", expressionData1.artifactExpression?.artifactName, " Failed to get expected artifactName") + assertEquals("location", expressionData1.artifactExpression?.location, " Failed to get expected location") + assertEquals(true, expressionData1.artifactExpression?.remove, " Failed to get expected remove") + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt new file mode 100644 index 00000000..5a5557d7 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt @@ -0,0 +1,42 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.apps.controllerblueprints.core.service + +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager +import kotlin.test.assertNotNull + +/** + * + * + * @author Brinda Santh + */ +class BluePrintParserFactoryTest { + private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) + + @Test + fun testBluePrintJson() { + val basepath = "load/blueprints" + + val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.TYPE_DEFAULT)!! + .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath) + assertNotNull(bluePrintContext, "Failed to populate Blueprint context") + log.trace("Blue Print {}",bluePrintContext.blueprintJson(true)) + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt new file mode 100644 index 00000000..88aea919 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt @@ -0,0 +1,57 @@ +/* + * 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.apps.controllerblueprints.core.service + +import org.junit.Test +import java.io.FileNotFoundException +import kotlin.test.assertNotNull + +/** + * BluePrintRepoFileServiceTest + * @author Brinda Santh + * + */ +class BluePrintRepoFileServiceTest { + + private val basePath = "load/model_type" + private val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath) + + @Test + fun testGetDataType() { + val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate")?.block() + assertNotNull(dataType, "Failed to get DataType from repo") + } + + @Test + fun testGetNodeType() { + val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment")?.block() + assertNotNull(nodeType, "Failed to get NodeType from repo") + } + + @Test + fun testGetArtifactType() { + val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity")?.block() + assertNotNull(nodeType, "Failed to get ArtifactType from repo") + } + + @Test(expected = FileNotFoundException::class) + fun testModelNotFound() { + val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found")?.block() + assertNotNull(dataType, "Failed to get DataType from repo") + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt new file mode 100644 index 00000000..5d24b072 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -0,0 +1,131 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.apps.controllerblueprints.core.service + +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.node.NullNode +import org.junit.Before +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory +import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintRuntimeUtils +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils.jsonNodeFromFile +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils.jsonNodeFromObject +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager +import kotlin.test.assertEquals +import kotlin.test.assertNotNull + +/** + * + * + * @author Brinda Santh + */ +class BluePrintRuntimeServiceTest { + private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) + val basepath = "load/blueprints" + + + @Before + fun setUp(): Unit { + + } + + @Test + fun testResolveNodeTemplateProperties() { + log.info("************************ testResolveNodeTemplateProperties **********************") + val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!! + .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath) + + val context: MutableMap = hashMapOf() + context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig") + val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context) + + val inputDataPath = "src/test/resources/data/default-context.json" + + val inputNode: JsonNode = jsonNodeFromFile(inputDataPath) + bluePrintRuntimeService.assignInputs(inputNode) + + val propContext: MutableMap = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process") + log.info("Context {}" ,bluePrintRuntimeService.context) + + assertNotNull(propContext, "Failed to populate interface property values") + assertEquals(propContext.get("process-name"), jsonNodeFromObject("sample-action"), "Failed to populate parameter process-name") + assertEquals(propContext.get("version"), jsonNodeFromObject("sample-action"), "Failed to populate parameter version") + } + + @Test + fun testResolveNodeTemplateInterfaceOperationInputs() { + log.info("************************ testResolveNodeTemplateInterfaceOperationInputs **********************") + val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!! + .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath) + assertNotNull(bluePrintContext, "Failed to populate Blueprint context") + + val context: MutableMap = hashMapOf() + context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig") + + val inputDataPath = "src/test/resources/data/default-context.json" + BluePrintRuntimeUtils.assignInputsFromFile(bluePrintContext, inputDataPath, context) + + + val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context) + + log.info("Prepared Context {}" ,context) + + val inContext: MutableMap = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment", + "DefaultComponentNode", "process") + + log.trace("In Context {}" ,inContext) + + assertNotNull(inContext, "Failed to populate interface input property values") + assertEquals(inContext.get("action-name"), jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name") + assertEquals(inContext.get("request-id"), jsonNodeFromObject("12345"), "Failed to populate parameter action-name") + assertEquals(inContext.get("template-content"), jsonNodeFromObject("This is Sample Velocity Template"), "Failed to populate parameter action-name") + + } + + @Test + fun testResolveNodeTemplateInterfaceOperationOutputs() { + log.info("************************ testResolveNodeTemplateInterfaceOperationOutputs **********************") + val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!! + .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath) + assertNotNull(bluePrintContext, "Failed to populate Blueprint context") + + val context: MutableMap = hashMapOf() + context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig") + + val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context) + + val componentContext: MutableMap = hashMapOf() + val successValue : JsonNode= jsonNodeFromObject("Success") + componentContext["resource-assignment.DefaultComponentNode.process.status"] = successValue + componentContext["resource-assignment.DefaultComponentNode.process.resource-assignment-params"] = null + + bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment", + "DefaultComponentNode", "process", componentContext) + + assertEquals(NullNode.instance, + context.get("node_templates/resource-assignment/interfaces/DefaultComponentNode/operations/process/properties/resource-assignment-params"), + "Failed to get operation property resource-assignment-params") + + assertEquals(successValue, + context.get("node_templates/resource-assignment/interfaces/DefaultComponentNode/operations/process/properties/status"), + "Failed to get operation property status") + + + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt new file mode 100644 index 00000000..b05fcb61 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt @@ -0,0 +1,49 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.apps.controllerblueprints.core.service + +import org.junit.Before +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager + +/** + * + * + * @author Brinda Santh + */ +class BluePrintValidatorDefaultServiceTest { + private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) + val basepath = "load/blueprints" + + @Before + fun setUp(): Unit { + + } + + @Test + fun testValidateBluePrint() { + val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!! + .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath) + val properties : MutableMap = hashMapOf() + val validatorService = BluePrintValidatorDefaultService() + validatorService.validateBlueprint(bluePrintContext.serviceTemplate,properties) + log.info("Validation Message {}", properties) + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt new file mode 100644 index 00000000..ddb39a2d --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt @@ -0,0 +1,40 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.apps.controllerblueprints.core.utils + + +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.data.ToscaMetaData +import kotlin.test.assertNotNull + +class BluePrintMetadataUtilsTest { + + @Test + fun testToscaMetaData(){ + + val basePath : String = "load/blueprints/baseconfiguration" + + val toscaMetaData : ToscaMetaData = BluePrintMetadataUtils.toscaMetaData(basePath) + assertNotNull(toscaMetaData, "Missing Tosca Definition Object") + assertNotNull(toscaMetaData.toscaMetaFileVersion, "Missing Tosca Metadata Version") + assertNotNull(toscaMetaData.csarVersion, "Missing CSAR version") + assertNotNull(toscaMetaData.createdBy, "Missing Created by") + assertNotNull(toscaMetaData.entityDefinitions, "Missing Tosca Entity Definition") + assertNotNull(toscaMetaData.templateTags, "Missing Template Tags") + + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt new file mode 100644 index 00000000..d13caa52 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt @@ -0,0 +1,51 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.apps.controllerblueprints.core.utils + +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate +import java.io.FileNotFoundException +import kotlin.test.assertEquals +import kotlin.test.assertNotNull + +class JacksonReactorUtilsTest { + private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) + @Test + fun testReadValues() { + + val serviceTemplate = JacksonReactorUtils.readValueFromFile("load/blueprints/baseconfiguration/Definitions/activation-blueprint.json", + ServiceTemplate::class.java).block() + + assertNotNull(serviceTemplate, "Failed to simple transform Service Template") + assertEquals(true, serviceTemplate is ServiceTemplate, "failed to get Service Template instance") + + val jsonContent = JacksonReactorUtils.getJson(serviceTemplate!!, true).block() + assertNotNull(jsonContent, "Failed to get json content") + + val jsonNode = JacksonReactorUtils.jsonNodeFromFile("load/blueprints/baseconfiguration/Definitions/activation-blueprint.json") + .block() + assertNotNull(jsonContent, "Failed to get json Node") + } + + @Test(expected = FileNotFoundException::class) + fun testReadValuesFailure() { + JacksonReactorUtils.jsonNodeFromFile("load/blueprints/not-found.json") + .block() + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt new file mode 100644 index 00000000..a5a630e3 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt @@ -0,0 +1,93 @@ +/* + * 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.apps.controllerblueprints.core.utils + +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate +import com.att.eelf.configuration.EELFLogger +import com.att.eelf.configuration.EELFManager +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue + +/** + * JacksonUtilsTest + * @author Brinda Santh + * ${DATA} + */ +class JacksonUtilsTest { + + private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString()) + + val basePath = "load/blueprints" + + @Test + fun testReadValues() { + val content = ResourceResolverUtils.getFileContent("baseconfiguration/Definitions/activation-blueprint.json", basePath) + val serviceTemplate = JacksonUtils.readValue(content, ServiceTemplate::class.java) + assertNotNull(serviceTemplate, "Failed to simple transform Service Template") + assertEquals(true, serviceTemplate is ServiceTemplate, "failed to get Service Template instance") + + val jsonContent = JacksonUtils.getJson(serviceTemplate!!, true) + assertNotNull(jsonContent, "Failed to get json content") + } + + @Test + fun testJsonNodeFromClassPathFile() { + val filePath = "data/default-context.json" + JacksonUtils.jsonNodeFromClassPathFile(filePath) + } + + @Test + fun testJsonNodeFromFile() { + val filePath = basePath + "/baseconfiguration/Definitions/activation-blueprint.json" + JacksonUtils.jsonNodeFromFile(filePath) + } + + @Test + fun testGetListFromJson() { + val content = "[\"good\",\"boy\" ]" + val nodeType = JacksonUtils.getListFromJson(content, String::class.java) + assertNotNull(nodeType, "Failed to get String array from content") + } + + + @Test + fun testJsonValue() { + val filePath = "data/alltype-data.json" + val rootJson = JacksonUtils.jsonNodeFromClassPathFile(filePath) + assertNotNull(rootJson, "Failed to get all type data json node") + val intValue = rootJson.get("intValue") + assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_INTEGER, intValue), "Failed to get as int value") + val floatValue = rootJson.get("floatValue") + assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_FLOAT, floatValue), "Failed to get as float value") + val stringValue = rootJson.get("stringValue") + assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_STRING, stringValue), "Failed to get as string value") + val booleanValue = rootJson.get("booleanValue") + assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_BOOLEAN, booleanValue), "Failed to get as boolean value") + val arrayStringValue = rootJson.get("arrayStringValue") + assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_LIST, arrayStringValue), "Failed to get as List value") + val mapValue = rootJson.get("mapValue") + assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_MAP, mapValue), "Failed to get as Map value") + + assertTrue(!JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_LIST, stringValue), "Negative type failed") + + + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt new file mode 100644 index 00000000..3fa4f75d --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt @@ -0,0 +1,36 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.apps.controllerblueprints.core.utils + +import org.junit.Test + +class TopologicalSortingUtilsTest { + + @Test + fun testSorting(): Unit { + val graph: TopologicalSortingUtils = TopologicalSortingUtils() + graph.add("bundle-id", "bundle-mac") + graph.add("bundle-id", "bundle-ip") + graph.add("bundle-mac", "bundle-ip") + graph.add("bundle-ip", "bundle-mac") + + println("The current graph: " + graph) + println("In-degrees: " + graph.inDegree()) + println("Out-degrees: " + graph.outDegree()) + println("A topological sort of the vertices: " + graph.topSort()) + } +} \ No newline at end of file diff --git a/components/core/src/test/resources/componentnode/default.json b/components/core/src/test/resources/componentnode/default.json new file mode 100644 index 00000000..b7265fcd --- /dev/null +++ b/components/core/src/test/resources/componentnode/default.json @@ -0,0 +1,100 @@ +{ + "metadata": { + "template_author": "bs2796", + "vendor": "Juniper", + "os": "XXX", + "service-type": "AVPN", + "vnf-type": "VRR", + "action": "Base Configuration", + "sub-action": "Generate Configuration", + "template_name": "VRR-baseconfiguration", + "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-openecomp-sdnc-config-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-openecomp-sdnc-config-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/components/core/src/test/resources/data/alltype-data.json b/components/core/src/test/resources/data/alltype-data.json new file mode 100644 index 00000000..055b0965 --- /dev/null +++ b/components/core/src/test/resources/data/alltype-data.json @@ -0,0 +1,10 @@ +{ + "intValue" : 1, + "floatValue" : 1.34, + "booleanValue" : true, + "stringValue" : "sample-String", + "timeValue" : "2018-09-29", + "arrayStringValue" : ["one", "two"], + "mapValue" : {"profile_name1":"profile_name1", + "profile_name2":"profile_name2"} +} \ No newline at end of file diff --git a/components/core/src/test/resources/data/default-context.json b/components/core/src/test/resources/data/default-context.json new file mode 100644 index 00000000..fcd4cbe2 --- /dev/null +++ b/components/core/src/test/resources/data/default-context.json @@ -0,0 +1,5 @@ +{ + "request-id" : "12345", + "hostname" : "localhost", + "action-name" : "sample-action" +} \ No newline at end of file diff --git a/components/core/src/test/resources/dictionary/dictionary_schema.json b/components/core/src/test/resources/dictionary/dictionary_schema.json new file mode 100644 index 00000000..d0317005 --- /dev/null +++ b/components/core/src/test/resources/dictionary/dictionary_schema.json @@ -0,0 +1,261 @@ +{ + "type": "object", + "properties": { + "resource-path": { + "type": "string", + "required": true + }, + "description": { + "type": "string" + }, + "updated-by": { + "type": "string" + }, + "data-type": { + "type": "string", + "required": true + }, + "source": { + "type": "object", + "required": true, + "properties": { + "input": { + "type": "object", + "properties": { + "key": { + "type": "string" + } + } + }, + "component": { + "type": "object", + "properties": { + "name": { + "type": "string", + "required": true + }, + "input-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "output-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "default": { + "type": "any" + }, + "aai": { + "type": "any" + }, + "mdsal": { + "type": "object", + "properties": { + "path": { + "type": "string", + "required": true + }, + "url-path": { + "type": "string", + "required": true + }, + "input-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "type": { + "type": "string", + "required": true + }, + "output-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "base": { + "type": "string", + "required": true + } + } + }, + "network-resource-discovery": { + "type": "object", + "properties": { + "input-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "output-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "db": { + "type": "object", + "properties": { + "query": { + "type": "string", + "required": true + }, + "input-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "type": { + "type": "string", + "required": true + }, + "output-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "base": { + "type": "string", + "required": true + } + } + }, + "policy": { + "type": "object", + "properties": { + "input-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "output-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "candidate-dependency": { + "type": "object", + "properties": { + "input": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "component": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "aai": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "mdsal": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "network-resource-discovery": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "db": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "policy": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + }, + "tags": { + "type": "string" + }, + "default": { + "type": "any" + }, + "name": { + "type": "string", + "required": true + }, + "valid-values": { + "type": "string" + }, + "resource-type": { + "type": "string", + "required": true + }, + "sample-value": { + "type": "string" + }, + "entry-schema": { + "type": "string" + } + } +} diff --git a/components/core/src/test/resources/properties/convert.json b/components/core/src/test/resources/properties/convert.json new file mode 100644 index 00000000..cb7d08e4 --- /dev/null +++ b/components/core/src/test/resources/properties/convert.json @@ -0,0 +1,33 @@ +{ + "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/components/core/src/test/resources/properties/default.json b/components/core/src/test/resources/properties/default.json new file mode 100644 index 00000000..0ac97f90 --- /dev/null +++ b/components/core/src/test/resources/properties/default.json @@ -0,0 +1,16 @@ +{ + "default": "{ \"get_input\" : \"loopback-default\" }", + "domain": "ethernet", + "criteria": [ + { + "value": "attga301me1", + "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" + } + ] +} -- cgit