Merge "added test case to VlanTagTest.java"
authorDan Timoney <dtimoney@att.com>
Thu, 17 Jan 2019 13:42:45 +0000 (13:42 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 17 Jan 2019 13:42:45 +0000 (13:42 +0000)
137 files changed:
components/core/pom.xml
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt [new file with mode: 0644]
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt [new file with mode: 0644]
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt [new file with mode: 0644]
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateService.kt [new file with mode: 0644]
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt
components/core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory [new file with mode: 0644]
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt [new file with mode: 0644]
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt [moved from ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceResolutionUtils.kt with 52% similarity]
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt [deleted file]
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt
components/core/src/test/resources/dictionary/dictionary_schema.json
components/core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts [new file with mode: 0644]
components/core/src/test/resources/templates/base-config-data.json [new file with mode: 0755]
components/core/src/test/resources/templates/base-config-template.vtl [new file with mode: 0755]
components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json
components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-kotlin.json [new file with mode: 0644]
components/model-catalog/definition-type/starter-type/node_type/source-capability.json
components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/nf-role.json
components/model-catalog/resource-dictionary/starter-dictionary/nfc-naming-code.json
components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_cidr.json
components/model-catalog/resource-dictionary/starter-dictionary/primary-db-source.json [moved from components/resource-dict/load/resource_dictionary/db-source.json with 85% similarity]
components/model-catalog/resource-dictionary/starter-dictionary/private-prefix-id.json
components/model-catalog/resource-dictionary/starter-dictionary/protected-prefix-id.json
components/model-catalog/resource-dictionary/starter-dictionary/protected_private_net_cidr.json
components/model-catalog/resource-dictionary/starter-dictionary/sample-primary-db-source.json [moved from components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json with 79% similarity]
components/model-catalog/resource-dictionary/starter-dictionary/unprotected-prefix-id.json
components/model-catalog/resource-dictionary/starter-dictionary/unprotected_private_net_cidr.json
components/model-catalog/resource-dictionary/starter-dictionary/vf-module-label.json
components/model-catalog/resource-dictionary/starter-dictionary/vf-module-type.json
components/model-catalog/resource-dictionary/starter-dictionary/vf-naming-policy.json
components/model-catalog/resource-dictionary/starter-dictionary/vf-nf-code.json
components/model-catalog/resource-dictionary/starter-dictionary/vfccustomizationuuid.json
components/model-catalog/resource-dictionary/starter-dictionary/vm-type.json
components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-invariant-uuid.json
components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-version.json
components/parent/pom.xml
components/pom.xml
components/resource-dict/load/model_type/node_type/source-primary-db.json [moved from components/resource-dict/load/model_type/node_type/source-db.json with 100% similarity]
components/resource-dict/load/resource_dictionary/nf-role.json
components/resource-dict/load/resource_dictionary/nfc-naming-code.json
components/resource-dict/load/resource_dictionary/onap_private_net_cidr.json
components/resource-dict/load/resource_dictionary/primary-db-source.json [moved from components/model-catalog/resource-dictionary/starter-dictionary/db-source.json with 82% similarity, mode: 0644]
components/resource-dict/load/resource_dictionary/private-prefix-id.json
components/resource-dict/load/resource_dictionary/protected-prefix-id.json
components/resource-dict/load/resource_dictionary/protected_private_net_cidr.json
components/resource-dict/load/resource_dictionary/unprotected-prefix-id.json
components/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json
components/resource-dict/load/resource_dictionary/vf-module-label.json
components/resource-dict/load/resource_dictionary/vf-module-type.json
components/resource-dict/load/resource_dictionary/vf-naming-policy.json
components/resource-dict/load/resource_dictionary/vf-nf-code.json
components/resource-dict/load/resource_dictionary/vfccustomizationuuid.json
components/resource-dict/load/resource_dictionary/vm-type.json
components/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json
components/resource-dict/load/resource_dictionary/vnfc-model-version.json
components/resource-dict/pom.xml
components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceAssignmentUtils.kt [new file with mode: 0644]
components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java
components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java
components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java
components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt [moved from components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt with 90% similarity]
components/resource-dict/src/test/resources/validation/cyclic.json
components/resource-dict/src/test/resources/validation/duplicate.json
components/resource-dict/src/test/resources/validation/success.json
ms/blueprintsprocessor/application/pom.xml
ms/blueprintsprocessor/functions/netconf-executor/pom.xml
ms/blueprintsprocessor/functions/pom.xml
ms/blueprintsprocessor/functions/python-executor/pom.xml
ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/utils/PythonExecutorUtils.kt
ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/utils/PythonExecutorUtilsTest.kt
ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json [new file with mode: 0644]
ms/blueprintsprocessor/functions/resource-resolution/pom.xml
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentProcessorScriptConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt [new file with mode: 0644]
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceAssignmentProcessor.kt
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceAssignmentProcessor.kt
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt [moved from ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DataBaseResourceAssignmentProcessor.kt with 82% similarity]
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json [moved from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/dt-location.json with 100% similarity]
ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json [moved from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/db-array.json with 88% similarity]
ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json [moved from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/db-complex.json with 91% similarity]
ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json [moved from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/db-simple.json with 90% similarity]
ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json [moved from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/resource-assignments-simple.json with 85% similarity]
ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/requests/sample-resourceresolution-request.json
ms/blueprintsprocessor/modules/commons/core/pom.xml
ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
ms/blueprintsprocessor/modules/commons/pom.xml
ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
ms/blueprintsprocessor/modules/inbounds/pom.xml
ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
ms/blueprintsprocessor/modules/outbounds/pom.xml
ms/blueprintsprocessor/modules/pom.xml
ms/blueprintsprocessor/modules/services/execution-service/pom.xml
ms/blueprintsprocessor/modules/services/pom.xml
ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
ms/blueprintsprocessor/parent/pom.xml
ms/blueprintsprocessor/pom.xml
ms/controllerblueprints/application/pom.xml
ms/controllerblueprints/distribution/pom.xml
ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml
ms/controllerblueprints/modules/blueprint-validation/pom.xml
ms/controllerblueprints/modules/db-resources/pom.xml
ms/controllerblueprints/modules/pom.xml
ms/controllerblueprints/modules/service/pom.xml
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/SchemaGeneratorService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaJsonNodeConverter.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeReactRepositoryTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
ms/controllerblueprints/modules/service/src/test/resources/application.properties
ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
ms/controllerblueprints/parent/pom.xml
ms/controllerblueprints/pom.xml
ms/neng/pom.xml
ms/pom.xml
ms/vlantag-api/pom.xml
ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlantagapi/core/extinf/pm/model/PolicyConfigTest.java
pom.xml
version.properties

index 8b6c524..03d46f4 100644 (file)
@@ -1,63 +1,78 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-  ~ Copyright Â© 2017-2018 AT&T Intellectual Property.\r
-  ~ Modifications Copyright Â© 2018 IBM.\r
-  ~\r
-  ~ Licensed under the Apache License, Version 2.0 (the "License");\r
-  ~ you may not use this file except in compliance with the License.\r
-  ~ You may obtain a copy of the License at\r
-  ~\r
-  ~     http://www.apache.org/licenses/LICENSE-2.0\r
-  ~\r
-  ~ Unless required by applicable law or agreed to in writing, software\r
-  ~ distributed under the License is distributed on an "AS IS" BASIS,\r
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-  ~ See the License for the specific language governing permissions and\r
-  ~ limitations under the License.\r
-  -->\r
-\r
-<project\r
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"\r
-  xmlns="http://maven.apache.org/POM/4.0.0"\r
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
-    <modelVersion>4.0.0</modelVersion>\r
-    <parent>\r
-        <groupId>org.onap.ccsdk.apps.components</groupId>\r
-        <artifactId>parent</artifactId>\r
-        <version>0.4.0-SNAPSHOT</version>\r
-        <relativePath>../parent</relativePath>\r
-    </parent>\r
-    <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>\r
-    <artifactId>core</artifactId>\r
-    <name>Controller Blueprints Core</name>\r
-\r
-    <dependencies>\r
-        <dependency>\r
-            <groupId>com.fasterxml.jackson.dataformat</groupId>\r
-            <artifactId>jackson-dataformat-xml</artifactId>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>com.fasterxml.jackson.dataformat</groupId>\r
-            <artifactId>jackson-dataformat-yaml</artifactId>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>com.fasterxml.jackson.module</groupId>\r
-            <artifactId>jackson-module-jsonSchema</artifactId>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>io.projectreactor</groupId>\r
-            <artifactId>reactor-core</artifactId>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>org.yaml</groupId>\r
-            <artifactId>snakeyaml</artifactId>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>org.jetbrains.kotlin</groupId>\r
-            <artifactId>kotlin-test-junit</artifactId>\r
-            <scope>test</scope>\r
-        </dependency>\r
-    </dependencies>\r
-\r
-</project>\r
-\r
+<?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
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+  xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onap.ccsdk.apps.components</groupId>
+        <artifactId>parent</artifactId>
+        <version>0.4.1-SNAPSHOT</version>
+        <relativePath>../parent</relativePath>
+    </parent>
+    <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+    <artifactId>core</artifactId>
+    <name>Controller Blueprints Core</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.fasterxml.jackson.dataformat</groupId>
+            <artifactId>jackson-dataformat-xml</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.dataformat</groupId>
+            <artifactId>jackson-dataformat-yaml</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.module</groupId>
+            <artifactId>jackson-module-jsonSchema</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.projectreactor</groupId>
+            <artifactId>reactor-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.yaml</groupId>
+            <artifactId>snakeyaml</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity</artifactId>
+        </dependency>
+        <!--Testing dependencies-->
+        <dependency>
+            <groupId>org.jetbrains.kotlin</groupId>
+            <artifactId>kotlin-test-junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.mockk</groupId>
+            <artifactId>mockk</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jetbrains.kotlinx</groupId>
+            <artifactId>kotlinx-coroutines-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
+
index 102e2eb..4c2d6e2 100644 (file)
-/*\r
- * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright Â© 2018 IBM.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.core\r
-\r
-/**\r
- * BluePrintConstants\r
- *\r
- * @author Brinda Santh\r
- */\r
-object BluePrintConstants {\r
-\r
-    const val RESPONSE_HEADER_TRANSACTION_ID: String = "X-ONAP-RequestID"\r
-    const val RESPONSE_HEADER_MINOR_VERSION: String = "X-MinorVersion"\r
-    const val RESPONSE_HEADER_PATCH_VERSION: String = "X-PatchVersion"\r
-    const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion"\r
-\r
-    const val STATUS_SUCCESS: String = "success"\r
-    const val STATUS_FAILURE: String = "failure"\r
-\r
-    const val TYPE_DEFAULT: String = "default"\r
-\r
-    const val DATA_TYPE_STRING: String = "string"\r
-    const val DATA_TYPE_INTEGER: String = "integer"\r
-    const val DATA_TYPE_FLOAT: String = "float"\r
-    const val DATA_TYPE_BOOLEAN: String = "boolean"\r
-    const val DATA_TYPE_TIMESTAMP: String = "timestamp"\r
-    const val DATA_TYPE_NULL: String = "null"\r
-    const val DATA_TYPE_LIST: String = "list"\r
-    const val DATA_TYPE_MAP: String = "map"\r
-\r
-    const val USER_SYSTEM: String = "System"\r
-\r
-    const val PATH_DIVIDER: String = "/"\r
-    const val PATH_SERVICE_TEMPLATE: String = "service_template"\r
-    const val PATH_TOPOLOGY_TEMPLATE: String = "topology_template"\r
-    const val PATH_METADATA: String = "metadata"\r
-    const val PATH_NODE_TYPES: String = "node_types"\r
-    const val PATH_POLICY_TYPES: String = "policy_types"\r
-    const val PATH_RELATIONSHIP_TYPES: String = "relationship_types"\r
-    const val PATH_ARTIFACT_TYPES: String = "artifact_types"\r
-    const val PATH_DATA_TYPES: String = "data_types"\r
-    const val PATH_INPUTS: String = "inputs"\r
-    const val PATH_NODE_WORKFLOWS: String = "workflows"\r
-    const val PATH_NODE_TEMPLATES: String = "node_templates"\r
-    const val PATH_CAPABILITIES: String = "capabilities"\r
-    const val PATH_REQUIREMENTS: String = "requirements"\r
-    const val PATH_INTERFACES: String = "interfaces"\r
-    const val PATH_OPERATIONS: String = "operations"\r
-    const val PATH_OUTPUTS: String = "outputs"\r
-    const val PATH_PROPERTIES: String = "properties"\r
-    const val PATH_ATTRIBUTES: String = "attributes"\r
-    const val PATH_ARTIFACTS: String = "artifacts"\r
-\r
-    const val MODEL_DIR_MODEL_TYPE: String = "definition-type"\r
-\r
-    const val MODEL_DEFINITION_TYPE_NODE_TYPE: String = "node_type"\r
-    const val MODEL_DEFINITION_TYPE_ARTIFACT_TYPE: String = "artifact_type"\r
-    const val MODEL_DEFINITION_TYPE_CAPABILITY_TYPE: String = "capability_type"\r
-    const val MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE: String = "relationship_type"\r
-    const val MODEL_DEFINITION_TYPE_DATA_TYPE: String = "data_type"\r
-\r
-    const val MODEL_TYPE_DATATYPES_ROOT: String = "tosca.datatypes.Root"\r
-    const val MODEL_TYPE_NODES_ROOT: String = "tosca.nodes.Root"\r
-    const val MODEL_TYPE_GROUPS_ROOT: String = "tosca.groups.Root"\r
-    const val MODEL_TYPE_RELATIONSHIPS_ROOT: String = "tosca.relationships.Root"\r
-    const val MODEL_TYPE_ARTIFACTS_ROOT: String = "tosca.artifacts.Root"\r
-    const val MODEL_TYPE_CAPABILITIES_ROOT: String = "tosca.capabilities.Root"\r
-    const val MODEL_TYPE_INTERFACES_ROOT: String = "tosca.interfaces.Root"\r
-\r
-    const val MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON = "tosca.relationships.DependsOn"\r
-    const val MODEL_TYPE_RELATIONSHIPS_HOSTED_ON = "tosca.relationships.HostedOn"\r
-    const val MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO = "tosca.relationships.ConnectsTo"\r
-    const val MODEL_TYPE_RELATIONSHIPS_ATTACH_TO = "tosca.relationships.AttachesTo"\r
-    const val MODEL_TYPE_RELATIONSHIPS_ROUTES_TO = "tosca.relationships.RoutesTo"\r
-\r
-    const val MODEL_TYPE_NODE_DG = "tosca.nodes.DG"\r
-    const val MODEL_TYPE_NODE_COMPONENT = "tosca.nodes.Component"\r
-    const val MODEL_TYPE_NODE_VNF = "tosca.nodes.Vnf"\r
-    @Deprecated("Artifacts will be attached to Node Template")\r
-    const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact"\r
-    const val MODEL_TYPE_NODE_RESOURCE_SOURCE = "tosca.nodes.ResourceSource"\r
-\r
-    const val MODEL_TYPE_NODES_COMPONENT_JAVA: String = "tosca.nodes.component.Java"\r
-    const val MODEL_TYPE_NODES_COMPONENT_BUNDLE: String = "tosca.nodes.component.Bundle"\r
-    const val MODEL_TYPE_NODES_COMPONENT_SCRIPT: String = "tosca.nodes.component.Script"\r
-    const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python"\r
-    const val MODEL_TYPE_NODES_COMPONENT_JYTHON: String = "tosca.nodes.component.Jython"\r
-    const val MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript"\r
-\r
-    const val MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION = "tosca.artifacts.Implementation"\r
-\r
-    const val MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic"\r
-\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_NODE = "tosca.capabilities.Node"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_COMPUTE = "tosca.capabilities.Compute"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_NETWORK = "tosca.capabilities.Network"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_STORAGE = "tosca.capabilities.Storage"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT = "tosca.capabilities.Endpoint"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC = "tosca.capabilities.Endpoint.Public"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN = "tosca.capabilities.Endpoint.Admin"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE = "tosca.capabilities.Endpoint.Database"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT = "tosca.capabilities.Attachment"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM = "tosca.capabilities.OperatingSystem"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_BINDABLE = "tosca.capabilities.network.Bindable"\r
-    // Custom capabilities\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_CONTENT = "tosca.capabilities.Content"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_MAPPING = "tosca.capabilities.Mapping"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_NETCONF = "tosca.capabilities.Netconf"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_SSH = "tosca.capabilities.Ssh"\r
-    const val MODEL_TYPE_CAPABILITY_TYPE_SFTP = "tosca.capabilities.Sftp"\r
-\r
-    const val EXPRESSION_GET_INPUT: String = "get_input"\r
-    const val EXPRESSION_GET_ATTRIBUTE: String = "get_attribute"\r
-    const val EXPRESSION_GET_ARTIFACT: String = "get_artifact"\r
-    const val EXPRESSION_GET_PROPERTY: String = "get_property"\r
-    const val EXPRESSION_GET_OPERATION_OUTPUT: String = "get_operation_output"\r
-    const val EXPRESSION_GET_NODE_OF_TYPE: String = "get_nodes_of_type"\r
-\r
-    const val PROPERTY_BLUEPRINT_PROCESS_ID: String = "blueprint-process-id"\r
-    const val PROPERTY_BLUEPRINT_BASE_PATH: String = "blueprint-basePath"\r
-    const val PROPERTY_BLUEPRINT_RUNTIME: String = "blueprint-runtime"\r
-    const val PROPERTY_BLUEPRINT_INPUTS_DATA: String = "blueprint-inputs-data"\r
-    const val PROPERTY_BLUEPRINT_CONTEXT: String = "blueprint-context"\r
-    const val PROPERTY_BLUEPRINT_NAME: String = "template_name"\r
-    const val PROPERTY_BLUEPRINT_VERSION: String = "template_version"\r
-\r
-    const val TOSCA_METADATA_DIR: String = "TOSCA-Metadata"\r
-    const val TOSCA_METADATA_ENTRY_DEFINITION_FILE: String = "TOSCA-Metadata/TOSCA.meta"\r
-    const val TOSCA_DEFINITIONS_DIR: String = "Definitions"\r
-    const val TOSCA_PLANS_DIR: String = "Plans"\r
-    const val TOSCA_SCRIPTS_DIR: String = "Scripts"\r
-    const val TOSCA_MAPPINGS_DIR: String = "Mappings"\r
-    const val TOSCA_TEMPLATES_DIR: String = "Templates"\r
-\r
-    const val METADATA_USER_GROUPS = "user-groups"\r
-    const val METADATA_TEMPLATE_NAME = "template_name"\r
-    const val METADATA_TEMPLATE_VERSION = "template_version"\r
-    const val METADATA_TEMPLATE_AUTHOR = "template_author"\r
-    const val METADATA_TEMPLATE_TAGS = "template_tags"\r
-    const val METADATA_WORKFLOW_NAME = "workflow_name"\r
-\r
-    const val PAYLOAD_DATA = "payload-data"\r
-    const val PROPERTY_CURRENT_STEP = "current-step"\r
-    const val PROPERTY_CURRENT_NODE_TEMPLATE = "current-node-template"\r
-    const val PROPERTY_CURRENT_INTERFACE = "current-interface"\r
-    const val PROPERTY_CURRENT_OPERATION = "current-operation"\r
-    const val PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation"\r
-    const val PROPERTY_EXECUTION_REQUEST = "execution-request"\r
-\r
-    const val OPERATION_PROCESS = "process"\r
-    const val OPERATION_PREPARE = "prepare"\r
-\r
-    const val BLUEPRINT_RETRIEVE_TYPE_DB = "db"\r
-    const val BLUEPRINT_RETRIEVE_TYPE_FILE = "file"\r
-    const val BLUEPRINT_RETRIEVE_TYPE_REPO = "repo"\r
-\r
+/*
+ * 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
+
+/**
+ * BluePrintConstants
+ *
+ * @author Brinda Santh
+ */
+object BluePrintConstants {
+
+    const val RESPONSE_HEADER_TRANSACTION_ID: String = "X-ONAP-RequestID"
+    const val RESPONSE_HEADER_MINOR_VERSION: String = "X-MinorVersion"
+    const val RESPONSE_HEADER_PATCH_VERSION: String = "X-PatchVersion"
+    const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion"
+
+    const val STATUS_SUCCESS: String = "success"
+    const val STATUS_FAILURE: String = "failure"
+
+    const val TYPE_DEFAULT: String = "default"
+
+    const val DATA_TYPE_STRING: String = "string"
+    const val DATA_TYPE_INTEGER: String = "integer"
+    const val DATA_TYPE_FLOAT: String = "float"
+    const val DATA_TYPE_BOOLEAN: String = "boolean"
+    const val DATA_TYPE_TIMESTAMP: String = "timestamp"
+    const val DATA_TYPE_NULL: String = "null"
+    const val DATA_TYPE_LIST: String = "list"
+    const val DATA_TYPE_MAP: String = "map"
+
+    const val USER_SYSTEM: String = "System"
+
+    const val PATH_DIVIDER: String = "/"
+    const val PATH_SERVICE_TEMPLATE: String = "service_template"
+    const val PATH_TOPOLOGY_TEMPLATE: String = "topology_template"
+    const val PATH_METADATA: String = "metadata"
+    const val PATH_NODE_TYPES: String = "node_types"
+    const val PATH_POLICY_TYPES: String = "policy_types"
+    const val PATH_RELATIONSHIP_TYPES: String = "relationship_types"
+    const val PATH_ARTIFACT_TYPES: String = "artifact_types"
+    const val PATH_DATA_TYPES: String = "data_types"
+    const val PATH_INPUTS: String = "inputs"
+    const val PATH_NODE_WORKFLOWS: String = "workflows"
+    const val PATH_NODE_TEMPLATES: String = "node_templates"
+    const val PATH_CAPABILITIES: String = "capabilities"
+    const val PATH_REQUIREMENTS: String = "requirements"
+    const val PATH_INTERFACES: String = "interfaces"
+    const val PATH_OPERATIONS: String = "operations"
+    const val PATH_OUTPUTS: String = "outputs"
+    const val PATH_PROPERTIES: String = "properties"
+    const val PATH_ATTRIBUTES: String = "attributes"
+    const val PATH_ARTIFACTS: String = "artifacts"
+
+    const val MODEL_DIR_MODEL_TYPE: String = "definition-type"
+
+    const val MODEL_DEFINITION_TYPE_NODE_TYPE: String = "node_type"
+    const val MODEL_DEFINITION_TYPE_ARTIFACT_TYPE: String = "artifact_type"
+    const val MODEL_DEFINITION_TYPE_CAPABILITY_TYPE: String = "capability_type"
+    const val MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE: String = "relationship_type"
+    const val MODEL_DEFINITION_TYPE_DATA_TYPE: String = "data_type"
+
+    const val MODEL_TYPE_DATATYPES_ROOT: String = "tosca.datatypes.Root"
+    const val MODEL_TYPE_NODES_ROOT: String = "tosca.nodes.Root"
+    const val MODEL_TYPE_GROUPS_ROOT: String = "tosca.groups.Root"
+    const val MODEL_TYPE_RELATIONSHIPS_ROOT: String = "tosca.relationships.Root"
+    const val MODEL_TYPE_ARTIFACTS_ROOT: String = "tosca.artifacts.Root"
+    const val MODEL_TYPE_CAPABILITIES_ROOT: String = "tosca.capabilities.Root"
+    const val MODEL_TYPE_INTERFACES_ROOT: String = "tosca.interfaces.Root"
+
+    const val MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON = "tosca.relationships.DependsOn"
+    const val MODEL_TYPE_RELATIONSHIPS_HOSTED_ON = "tosca.relationships.HostedOn"
+    const val MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO = "tosca.relationships.ConnectsTo"
+    const val MODEL_TYPE_RELATIONSHIPS_ATTACH_TO = "tosca.relationships.AttachesTo"
+    const val MODEL_TYPE_RELATIONSHIPS_ROUTES_TO = "tosca.relationships.RoutesTo"
+
+    const val MODEL_TYPE_NODE_DG = "tosca.nodes.DG"
+    const val MODEL_TYPE_NODE_COMPONENT = "tosca.nodes.Component"
+    const val MODEL_TYPE_NODE_VNF = "tosca.nodes.Vnf"
+    @Deprecated("Artifacts will be attached to Node Template")
+    const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact"
+    const val MODEL_TYPE_NODE_RESOURCE_SOURCE = "tosca.nodes.ResourceSource"
+
+    const val MODEL_TYPE_NODES_COMPONENT_JAVA: String = "tosca.nodes.component.Java"
+    const val MODEL_TYPE_NODES_COMPONENT_BUNDLE: String = "tosca.nodes.component.Bundle"
+    const val MODEL_TYPE_NODES_COMPONENT_SCRIPT: String = "tosca.nodes.component.Script"
+    const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python"
+    const val MODEL_TYPE_NODES_COMPONENT_JYTHON: String = "tosca.nodes.component.Jython"
+    const val MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript"
+
+    const val MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION = "tosca.artifacts.Implementation"
+
+    const val MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic"
+
+    const val MODEL_TYPE_CAPABILITY_TYPE_NODE = "tosca.capabilities.Node"
+    const val MODEL_TYPE_CAPABILITY_TYPE_COMPUTE = "tosca.capabilities.Compute"
+    const val MODEL_TYPE_CAPABILITY_TYPE_NETWORK = "tosca.capabilities.Network"
+    const val MODEL_TYPE_CAPABILITY_TYPE_STORAGE = "tosca.capabilities.Storage"
+    const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT = "tosca.capabilities.Endpoint"
+    const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC = "tosca.capabilities.Endpoint.Public"
+    const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN = "tosca.capabilities.Endpoint.Admin"
+    const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE = "tosca.capabilities.Endpoint.Database"
+    const val MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT = "tosca.capabilities.Attachment"
+    const val MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM = "tosca.capabilities.OperatingSystem"
+    const val MODEL_TYPE_CAPABILITY_TYPE_BINDABLE = "tosca.capabilities.network.Bindable"
+    // Custom capabilities
+    const val MODEL_TYPE_CAPABILITY_TYPE_CONTENT = "tosca.capabilities.Content"
+    const val MODEL_TYPE_CAPABILITY_TYPE_MAPPING = "tosca.capabilities.Mapping"
+    const val MODEL_TYPE_CAPABILITY_TYPE_NETCONF = "tosca.capabilities.Netconf"
+    const val MODEL_TYPE_CAPABILITY_TYPE_SSH = "tosca.capabilities.Ssh"
+    const val MODEL_TYPE_CAPABILITY_TYPE_SFTP = "tosca.capabilities.Sftp"
+
+    const val EXPRESSION_GET_INPUT: String = "get_input"
+    const val EXPRESSION_GET_ATTRIBUTE: String = "get_attribute"
+    const val EXPRESSION_GET_ARTIFACT: String = "get_artifact"
+    const val EXPRESSION_GET_PROPERTY: String = "get_property"
+    const val EXPRESSION_GET_OPERATION_OUTPUT: String = "get_operation_output"
+    const val EXPRESSION_GET_NODE_OF_TYPE: String = "get_nodes_of_type"
+
+    const val PROPERTY_BLUEPRINT_PROCESS_ID: String = "blueprint-process-id"
+    const val PROPERTY_BLUEPRINT_BASE_PATH: String = "blueprint-basePath"
+    const val PROPERTY_BLUEPRINT_RUNTIME: String = "blueprint-runtime"
+    const val PROPERTY_BLUEPRINT_INPUTS_DATA: String = "blueprint-inputs-data"
+    const val PROPERTY_BLUEPRINT_CONTEXT: String = "blueprint-context"
+    const val PROPERTY_BLUEPRINT_NAME: String = "template_name"
+    const val PROPERTY_BLUEPRINT_VERSION: String = "template_version"
+
+    const val TOSCA_METADATA_DIR: String = "TOSCA-Metadata"
+    const val TOSCA_METADATA_ENTRY_DEFINITION_FILE: String = "TOSCA-Metadata/TOSCA.meta"
+    const val TOSCA_DEFINITIONS_DIR: String = "Definitions"
+    const val TOSCA_PLANS_DIR: String = "Plans"
+    const val TOSCA_SCRIPTS_DIR: String = "Scripts"
+    const val TOSCA_MAPPINGS_DIR: String = "Mappings"
+    const val TOSCA_TEMPLATES_DIR: String = "Templates"
+
+    const val METADATA_USER_GROUPS = "user-groups"
+    const val METADATA_TEMPLATE_NAME = "template_name"
+    const val METADATA_TEMPLATE_VERSION = "template_version"
+    const val METADATA_TEMPLATE_AUTHOR = "template_author"
+    const val METADATA_TEMPLATE_TAGS = "template_tags"
+    const val METADATA_WORKFLOW_NAME = "workflow_name"
+
+    const val PAYLOAD_DATA = "payload-data"
+    const val PROPERTY_CURRENT_STEP = "current-step"
+    const val PROPERTY_CURRENT_NODE_TEMPLATE = "current-node-template"
+    const val PROPERTY_CURRENT_INTERFACE = "current-interface"
+    const val PROPERTY_CURRENT_OPERATION = "current-operation"
+    const val PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation"
+    const val PROPERTY_EXECUTION_REQUEST = "execution-request"
+
+    const val OPERATION_PROCESS = "process"
+    const val OPERATION_PREPARE = "prepare"
+
+    const val BLUEPRINT_RETRIEVE_TYPE_DB = "db"
+    const val BLUEPRINT_RETRIEVE_TYPE_FILE = "file"
+    const val BLUEPRINT_RETRIEVE_TYPE_REPO = "repo"
+
 }
\ No newline at end of file
index 9767b2e..663c1fe 100644 (file)
@@ -502,7 +502,7 @@ class InterfaceAssignment {
 A Node Template specifies the occurrence of a manageable software component as part of an application’s topology model which is defined in a TOSCA Service Template.  A Node template is an instance of a specified Node Type and can provide customized properties, constraints or operations which override the defaults provided by its Node Type and its implementations.\r
  */\r
 \r
-class NodeTemplate {\r
+open class NodeTemplate {
     @get:JsonIgnore\r
     var id: String? = null\r
     var description: String? = null\r
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt
new file mode 100644 (file)
index 0000000..f7bfb85
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * 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.script
+
+import org.jetbrains.kotlin.script.util.LocalFilesResolver
+import java.io.File
+import kotlin.script.dependencies.ScriptContents
+import kotlin.script.dependencies.ScriptDependenciesResolver
+import kotlin.script.experimental.annotations.KotlinScript
+import kotlin.script.experimental.api.*
+import kotlin.script.experimental.jvm.JvmDependency
+import kotlin.script.experimental.jvm.dependenciesFromCurrentContext
+import kotlin.script.experimental.jvm.jvm
+
+
+@KotlinScript(fileExtension = "kts",
+        compilationConfiguration = ComponentScriptConfiguration::class)
+abstract class ComponentScript {
+
+}
+
+object ComponentScriptConfiguration : ScriptCompilationConfiguration(
+        {
+           // defaultImports(DependsOn::class, Repository::class)
+            jvm {
+                dependenciesFromCurrentContext(
+                        wholeClasspath = true
+                )
+            }
+//            refineConfiguration {
+//                onAnnotations(DependsOn::class, Repository::class, handler = ::configureLocalFileDepsOnAnnotations)
+//            }
+        }
+)
+
+
+private val resolver = LocalFilesResolver()
+
+fun configureLocalFileDepsOnAnnotations(context: ScriptConfigurationRefinementContext):
+        ResultWithDiagnostics<ScriptCompilationConfiguration> {
+
+    val annotations = context.collectedData?.get(ScriptCollectedData.foundAnnotations)?.takeIf { it.isNotEmpty() }
+            ?: return context.compilationConfiguration.asSuccess()
+
+    val scriptContents = object : ScriptContents {
+        override val annotations: Iterable<Annotation> = annotations
+        override val file: File? = null
+        override val text: CharSequence? = null
+    }
+
+    val diagnostics = arrayListOf<ScriptDiagnostic>()
+
+    fun report(severity: ScriptDependenciesResolver.ReportSeverity, message: String, position: ScriptContents.Position?) {
+        //TODO
+    }
+
+    return try {
+        val newDepsFromResolver = resolver.resolve(scriptContents, emptyMap(), ::report, null).get()
+                ?: return context.compilationConfiguration.asSuccess(diagnostics)
+
+        val resolvedClasspath = newDepsFromResolver.classpath.toList().takeIf { it.isNotEmpty() }
+                ?: return context.compilationConfiguration.asSuccess(diagnostics)
+
+        ScriptCompilationConfiguration(context.compilationConfiguration) {
+            dependencies.append(JvmDependency(resolvedClasspath))
+
+        }.asSuccess(diagnostics)
+
+    } catch (e: Throwable) {
+        ResultWithDiagnostics.Failure(*diagnostics.toTypedArray(), e.asDiagnostics())
+    }
+}
\ No newline at end of file
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt
new file mode 100644 (file)
index 0000000..8ae0915
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * 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.script
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+import java.io.File
+import java.io.InputStream
+import java.io.Reader
+import javax.script.ScriptEngineManager
+import kotlin.script.experimental.api.ResultValue
+import kotlin.script.experimental.api.ResultWithDiagnostics
+import kotlin.script.experimental.api.resultOrNull
+import kotlin.script.experimental.host.toScriptSource
+import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
+
+
+open class BluePrintScriptService(classLoader: ClassLoader? = Thread.currentThread().contextClassLoader) {
+
+    /**
+     * Get the Script Class instance
+     */
+    inline fun <reified T> scriptClassNewInstance(scriptFile: File, scriptClassName: String): T {
+
+        val compilationConfiguration = createJvmCompilationConfigurationFromTemplate<ComponentScript>()
+
+        val scriptEvaluator = BluePrintScriptEvaluator(scriptClassName)
+
+        val evalResponse = BlueprintScriptingHost(scriptEvaluator).eval(scriptFile.toScriptSource(), compilationConfiguration,
+                null)
+
+        when (evalResponse) {
+            is ResultWithDiagnostics.Success -> {
+                val returnValue = evalResponse.resultOrNull()?.returnValue as ResultValue.Value
+                return returnValue.value.castOrError()
+            }
+            is ResultWithDiagnostics.Failure -> {
+                throw BluePrintProcessorException(evalResponse.reports.joinToString("\n"))
+            }
+            else -> {
+                throw BluePrintProcessorException("Failed to process script ${scriptFile.absolutePath}")
+            }
+        }
+
+    }
+
+    val engine = ScriptEngineManager(classLoader).getEngineByExtension("kts")
+
+    inline fun <R> safeEval(evaluation: () -> R?) = try {
+        evaluation()
+    } catch (e: Exception) {
+        throw BluePrintProcessorException("Cannot load script", e)
+    }
+
+    inline fun <reified T> Any?.castOrError() = takeIf { it is T }?.let { it as T }
+            ?: throw IllegalArgumentException("Cannot cast $this to expected type ${T::class}")
+
+    inline fun <reified T> load(script: String): T = safeEval { engine.eval(script) }.castOrError()
+
+    inline fun <reified T> load(reader: Reader): T = safeEval { engine.eval(reader) }.castOrError()
+
+    inline fun <reified T> load(inputStream: InputStream): T = load(inputStream.reader())
+
+    inline fun <reified T> loadAll(vararg inputStream: InputStream): List<T> = inputStream.map(::load)
+}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt
new file mode 100644 (file)
index 0000000..bda20a4
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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.script
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+import org.slf4j.LoggerFactory
+import kotlin.script.experimental.api.*
+import kotlin.script.experimental.host.BasicScriptingHost
+import kotlin.script.experimental.jvm.defaultJvmScriptingHostConfiguration
+import kotlin.script.experimental.jvmhost.JvmScriptCompiler
+
+val defaultBlueprintScriptCompiler = JvmScriptCompiler(defaultJvmScriptingHostConfiguration)
+
+open class BlueprintScriptingHost(evaluator: ScriptEvaluator
+) : BasicScriptingHost(defaultBlueprintScriptCompiler, evaluator) {
+
+    override fun eval(
+            script: SourceCode,
+            scriptCompilationConfiguration: ScriptCompilationConfiguration,
+            configuration: ScriptEvaluationConfiguration?
+    ): ResultWithDiagnostics<EvaluationResult> =
+
+            runInCoroutineContext {
+
+                compiler(script, scriptCompilationConfiguration)
+                        .onSuccess {
+                            evaluator(it, configuration)
+                        }
+            }
+}
+
+
+open class BluePrintScriptEvaluator(private val scriptClassName: String) : ScriptEvaluator {
+
+    val log = LoggerFactory.getLogger(BluePrintScriptEvaluator::class.java)!!
+
+    override suspend operator fun invoke(
+            compiledScript: CompiledScript<*>,
+            scriptEvaluationConfiguration: ScriptEvaluationConfiguration?
+    ): ResultWithDiagnostics<EvaluationResult> =
+            try {
+                val res = compiledScript.getClass(scriptEvaluationConfiguration)
+                when (res) {
+                    is ResultWithDiagnostics.Failure -> res
+                    is ResultWithDiagnostics.Success -> {
+                        val scriptClass = res.value
+                        val args = ArrayList<Any?>()
+                        scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.providedProperties)?.forEach {
+                            args.add(it.value)
+                        }
+                        scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.implicitReceivers)?.let {
+                            args.addAll(it)
+                        }
+                        scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.constructorArgs)?.let {
+                            args.addAll(it)
+                        }
+
+                        val completeScriptClass = "Script\$$scriptClassName"
+                        log.info("Searching for class type($completeScriptClass)")
+                        /**
+                         * Search for Class Name
+                         */
+                        val instanceClass = scriptClass.java.classes
+                                .single { it.name == completeScriptClass }
+                                //.single { it.name == "Script\$SampleBlueprintsFunctionNode" }
+
+
+                        val instance = instanceClass.newInstance()
+                                ?: throw BluePrintProcessorException("failed to create instance from the script")
+
+                        ResultWithDiagnostics.Success(EvaluationResult(ResultValue.Value(completeScriptClass,
+                                instance, instance.javaClass.typeName),
+                                scriptEvaluationConfiguration))
+                    }
+                }
+            } catch (e: Throwable) {
+                ResultWithDiagnostics.Failure(e.asDiagnostics("Error evaluating script"))
+            }
+}
\ No newline at end of file
index bc1f4b4..1a6d096 100644 (file)
@@ -148,7 +148,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
     val nodeTemplates: MutableMap<String, NodeTemplate>? = serviceTemplate.topologyTemplate?.nodeTemplates\r
 \r
     fun nodeTemplateByName(name: String): NodeTemplate =\r
-            nodeTemplates?.get(name) ?: throw BluePrintException("could't get node template for the name($name) ")\r
+            nodeTemplates?.get(name) ?: throw BluePrintException("could't get node template for the name($name)")
 \r
     fun nodeTemplateForNodeType(name: String): MutableMap<String, NodeTemplate>? {\r
         return nodeTemplates?.filterValues { nodeTemplate -> nodeTemplate.type == name }?.toMutableMap()\r
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateService.kt
new file mode 100644 (file)
index 0000000..d175fdd
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * 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.core.io.CharTypes
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.node.JsonNodeFactory
+import com.fasterxml.jackson.databind.node.TextNode
+import org.apache.commons.lang3.BooleanUtils
+import org.apache.commons.lang3.StringUtils
+import org.apache.velocity.VelocityContext
+import org.apache.velocity.app.Velocity
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import java.io.StringWriter
+
+open class BluePrintTemplateService {
+
+    companion object {
+
+        /**
+         * Generate Content from Velocity Template and JSON Content.
+         */
+        fun generateContent(template: String, json: String,
+                            ignoreJsonNull: Boolean = false,
+                            additionalContext: MutableMap<String, Any> = hashMapOf()): String {
+            Velocity.init()
+            val mapper = ObjectMapper()
+            val nodeFactory = BluePrintJsonNodeFactory()
+            mapper.setNodeFactory(nodeFactory)
+
+            val jsonNode = mapper.readValue<JsonNode>(json, JsonNode::class.java)
+                    ?: throw BluePrintProcessorException("couldn't get json node from json")
+
+            if (ignoreJsonNull)
+                JacksonUtils.removeJsonNullNode(jsonNode)
+
+            val velocityContext = VelocityContext()
+            velocityContext.put("StringUtils", StringUtils::class.java)
+            velocityContext.put("BooleanUtils", BooleanUtils::class.java)
+            /**
+             * Add the Custom Velocity Context API
+             */
+            additionalContext.forEach { name, value -> velocityContext.put(name, value) }
+            /**
+             * Add the JSON Data to the context
+             */
+            jsonNode.fields().forEach { entry ->
+                velocityContext.put(entry.key, entry.value)
+            }
+
+            val stringWriter = StringWriter()
+            Velocity.evaluate(velocityContext, stringWriter, "TemplateData", template)
+            stringWriter.flush()
+            return stringWriter.toString()
+        }
+    }
+}
+
+/**
+ * Customise JsonNodeFactory adn TextNode, Since it introduces quotes for string data.
+ */
+open class BluePrintJsonNodeFactory : JsonNodeFactory() {
+    override fun textNode(text: String): TextNode {
+        return BluePrintTextNode(text)
+    }
+}
+
+open class BluePrintTextNode(v: String) : TextNode(v) {
+    override fun toString(): String {
+        var len = this._value.length
+        len = len + 2 + (len shr 4)
+        val sb = StringBuilder(len)
+        CharTypes.appendQuoted(sb, this._value)
+        return sb.toString()
+    }
+
+}
+
index 0187445..6321a83 100644 (file)
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
  */\r
-\r
 package org.onap.ccsdk.apps.controllerblueprints.core.utils\r
 \r
 import com.att.eelf.configuration.EELFLogger\r
@@ -23,6 +22,9 @@ import com.fasterxml.jackson.annotation.JsonInclude
 import com.fasterxml.jackson.core.type.TypeReference\r
 import com.fasterxml.jackson.databind.JsonNode\r
 import com.fasterxml.jackson.databind.SerializationFeature\r
+import com.fasterxml.jackson.databind.node.ArrayNode\r
+import com.fasterxml.jackson.databind.node.NullNode\r
+import com.fasterxml.jackson.databind.node.ObjectNode\r
 import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper\r
 import kotlinx.coroutines.Dispatchers\r
 import kotlinx.coroutines.async\r
@@ -40,241 +42,221 @@ import java.nio.charset.Charset
  *\r
  * @author Brinda Santh\r
  */\r
-object JacksonUtils {\r
-    private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())\r
-\r
-    inline fun <reified T : Any> readValue(content: String): T =\r
-            jacksonObjectMapper().readValue(content, T::class.java)\r
+class JacksonUtils {\r
+    companion object {\r
+        private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())\r
+        inline fun <reified T : Any> readValue(content: String): T =\r
+                jacksonObjectMapper().readValue(content, T::class.java)\r
 \r
-    @JvmStatic\r
-    fun <T> readValue(content: String, valueType: Class<T>): T? {\r
-        return jacksonObjectMapper().readValue(content, valueType)\r
-    }\r
+        fun <T> readValue(content: String, valueType: Class<T>): T? {\r
+            return jacksonObjectMapper().readValue(content, valueType)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun <T> readValue(node: JsonNode, valueType: Class<T>): T? {\r
-        return jacksonObjectMapper().treeToValue(node, valueType)\r
-    }\r
+        fun <T> readValue(node: JsonNode, valueType: Class<T>): T? {\r
+            return jacksonObjectMapper().treeToValue(node, valueType)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun getContent(fileName: String): String = runBlocking {\r
-        async {\r
-            try {\r
-                File(fileName).readText(Charsets.UTF_8)\r
-            } catch (e: Exception) {\r
-                throw BluePrintException("couldn't get file ($fileName) content : ${e.message}")\r
+        fun removeJsonNullNode(node: JsonNode) {\r
+            val it = node.iterator()\r
+            while (it.hasNext()) {\r
+                val child = it.next()\r
+                if (child.isNull) {\r
+                    it.remove()\r
+                } else {\r
+                    removeJsonNullNode(child)\r
+                }\r
             }\r
-        }.await()\r
-    }\r
+        }\r
 \r
-    @JvmStatic\r
-    fun getClassPathFileContent(fileName: String): String {\r
-        return runBlocking {\r
-            withContext(Dispatchers.Default) {\r
-                IOUtils.toString(JacksonUtils::class.java.classLoader\r
-                        .getResourceAsStream(fileName), Charset.defaultCharset())\r
+        fun getContent(fileName: String): String = runBlocking {\r
+            async {\r
+                try {\r
+                    File(fileName).readText(Charsets.UTF_8)\r
+                } catch (e: Exception) {\r
+                    throw BluePrintException("couldn't get file ($fileName) content : ${e.message}")\r
+                }\r
+            }.await()\r
+        }\r
+\r
+        fun getClassPathFileContent(fileName: String): String {\r
+            return runBlocking {\r
+                withContext(Dispatchers.Default) {\r
+                    IOUtils.toString(JacksonUtils::class.java.classLoader\r
+                            .getResourceAsStream(fileName), Charset.defaultCharset())\r
+                }\r
             }\r
         }\r
-    }\r
 \r
-    @JvmStatic\r
-    fun <T> readValueFromFile(fileName: String, valueType: Class<T>): T? {\r
-        val content: String = getContent(fileName)\r
-        return readValue(content, valueType)\r
-    }\r
+        fun <T> readValueFromFile(fileName: String, valueType: Class<T>): T? {\r
+            val content: String = getContent(fileName)\r
+            return readValue(content, valueType)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun <T> readValueFromClassPathFile(fileName: String, valueType: Class<T>): T? {\r
-        val content: String = getClassPathFileContent(fileName)\r
-        return readValue(content, valueType)\r
-    }\r
+        fun <T> readValueFromClassPathFile(fileName: String, valueType: Class<T>): T? {\r
+            val content: String = getClassPathFileContent(fileName)\r
+            return readValue(content, valueType)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun jsonNodeFromObject(from: kotlin.Any): JsonNode = jacksonObjectMapper().convertValue(from, JsonNode::class.java)\r
+        fun jsonNodeFromObject(from: kotlin.Any): JsonNode {\r
+            return jacksonObjectMapper().convertValue(from, JsonNode::class.java)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun jsonNodeFromClassPathFile(fileName: String): JsonNode {\r
-        val content: String = getClassPathFileContent(fileName)\r
-        return jsonNode(content)\r
-    }\r
+        fun jsonNodeFromClassPathFile(fileName: String): JsonNode {\r
+            val content: String = getClassPathFileContent(fileName)\r
+            return jsonNode(content)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun jsonNodeFromFile(fileName: String): JsonNode {\r
-        val content: String = getContent(fileName)\r
-        return jsonNode(content)\r
-    }\r
+        fun jsonNodeFromFile(fileName: String): JsonNode {\r
+            val content: String = getContent(fileName)\r
+            return jsonNode(content)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun jsonNode(content: String): JsonNode {\r
-        return jacksonObjectMapper().readTree(content)\r
-    }\r
+        fun jsonNode(content: String): JsonNode {\r
+            return jacksonObjectMapper().readTree(content)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun getJson(any: kotlin.Any): String {\r
-        return getJson(any, false)\r
-    }\r
+        fun getJson(any: kotlin.Any): String {\r
+            return getJson(any, false)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun getWrappedJson(wrapper: String, any: kotlin.Any, pretty: Boolean = false): String {\r
-        val wrapperMap = hashMapOf<String, Any>()\r
-        wrapperMap[wrapper] = any\r
-        return getJson(wrapperMap, pretty)\r
-    }\r
+        fun getWrappedJson(wrapper: String, any: kotlin.Any, pretty: Boolean = false): String {\r
+            val wrapperMap = hashMapOf<String, Any>()\r
+            wrapperMap[wrapper] = any\r
+            return getJson(wrapperMap, pretty)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun getJson(any: kotlin.Any, pretty: Boolean = false): String {\r
-        val objectMapper = jacksonObjectMapper()\r
-        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)\r
-        if (pretty) {\r
-            objectMapper.enable(SerializationFeature.INDENT_OUTPUT)\r
+        fun getJson(any: kotlin.Any, pretty: Boolean = false): String {\r
+            val objectMapper = jacksonObjectMapper()\r
+            objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)\r
+            if (pretty) {\r
+                objectMapper.enable(SerializationFeature.INDENT_OUTPUT)\r
+            }\r
+            return objectMapper.writeValueAsString(any)\r
         }\r
-        return objectMapper.writeValueAsString(any)\r
-    }\r
 \r
-    @JvmStatic\r
-    fun <T> getListFromJsonNode(node: JsonNode, valueType: Class<T>): List<T>? {\r
-        return getListFromJson(node.toString(), valueType)\r
-    }\r
+        fun getJsonNode(any: kotlin.Any?, pretty: Boolean = false): JsonNode {\r
+            val objectMapper = jacksonObjectMapper()\r
+            objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)\r
+            if (pretty) {\r
+                objectMapper.enable(SerializationFeature.INDENT_OUTPUT)\r
+            }\r
+            return objectMapper.valueToTree(any)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun <T> getListFromJson(content: String, valueType: Class<T>): List<T>? {\r
-        val objectMapper = jacksonObjectMapper()\r
-        val javaType = objectMapper.typeFactory.constructCollectionType(List::class.java, valueType)\r
-        return objectMapper.readValue<List<T>>(content, javaType)\r
-    }\r
+        fun <T> getListFromJsonNode(node: JsonNode, valueType: Class<T>): List<T>? {\r
+            return getListFromJson(node.toString(), valueType)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun <T> getListFromFile(fileName: String, valueType: Class<T>): List<T>? {\r
-        val content: String = getContent(fileName)\r
-        return getListFromJson(content, valueType)\r
-    }\r
+        fun <T> getListFromJson(content: String, valueType: Class<T>): List<T>? {\r
+            val objectMapper = jacksonObjectMapper()\r
+            val javaType = objectMapper.typeFactory.constructCollectionType(List::class.java, valueType)\r
+            return objectMapper.readValue<List<T>>(content, javaType)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun <T> getListFromClassPathFile(fileName: String, valueType: Class<T>): List<T>? {\r
-        val content: String = getClassPathFileContent(fileName)\r
-        return getListFromJson(content, valueType)\r
-    }\r
+        fun <T> getListFromFile(fileName: String, valueType: Class<T>): List<T>? {\r
+            val content: String = getContent(fileName)\r
+            return getListFromJson(content, valueType)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun <T> getMapFromJson(content: String, valueType: Class<T>): MutableMap<String, T>? {\r
-        val objectMapper = jacksonObjectMapper()\r
-        val typeRef = object : TypeReference<MutableMap<String, T>>() {}\r
-        return objectMapper.readValue(content, typeRef)\r
-    }\r
+        fun <T> getListFromClassPathFile(fileName: String, valueType: Class<T>): List<T>? {\r
+            val content: String = getClassPathFileContent(fileName)\r
+            return getListFromJson(content, valueType)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun <T> getMapFromFile(fileName: String, valueType: Class<T>): MutableMap<String, T>? {\r
-        val content: String = getContent(fileName)\r
-        return getMapFromJson(content, valueType)\r
-    }\r
+        fun <T> getMapFromJson(content: String, valueType: Class<T>): MutableMap<String, T>? {\r
+            val objectMapper = jacksonObjectMapper()\r
+            val typeRef = object : TypeReference<MutableMap<String, T>>() {}\r
+            return objectMapper.readValue(content, typeRef)\r
+        }\r
 \r
-    @JvmStatic\r
-    fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean {\r
-        if (BluePrintTypes.validPrimitiveTypes().contains(type)) {\r
-            return checkJsonNodeValueOfPrimitiveType(type, jsonNode)\r
-        } else if (BluePrintTypes.validCollectionTypes().contains(type)) {\r
-            return checkJsonNodeValueOfCollectionType(type, jsonNode)\r
+        fun <T> getMapFromFile(fileName: String, valueType: Class<T>): MutableMap<String, T>? {\r
+            val content: String = getContent(fileName)\r
+            return getMapFromJson(content, valueType)\r
         }\r
-        return false\r
-    }\r
 \r
-    @JvmStatic\r
-    fun checkJsonNodeValueOfPrimitiveType(primitiveType: String, jsonNode: JsonNode): Boolean {\r
-        when (primitiveType) {\r
-            BluePrintConstants.DATA_TYPE_STRING -> return jsonNode.isTextual\r
-            BluePrintConstants.DATA_TYPE_BOOLEAN -> return jsonNode.isBoolean\r
-            BluePrintConstants.DATA_TYPE_INTEGER -> return jsonNode.isInt\r
-            BluePrintConstants.DATA_TYPE_FLOAT -> return jsonNode.isDouble\r
-            BluePrintConstants.DATA_TYPE_TIMESTAMP -> return jsonNode.isTextual\r
-            else -> return false\r
+        fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean {\r
+            if (BluePrintTypes.validPrimitiveTypes().contains(type)) {\r
+                return checkJsonNodeValueOfPrimitiveType(type, jsonNode)\r
+            } else if (BluePrintTypes.validCollectionTypes().contains(type)) {\r
+                return checkJsonNodeValueOfCollectionType(type, jsonNode)\r
+            }\r
+            return false\r
         }\r
-    }\r
 \r
-    @JvmStatic\r
-    fun checkJsonNodeValueOfCollectionType(type: String, jsonNode: JsonNode): Boolean {\r
-        when (type) {\r
-            BluePrintConstants.DATA_TYPE_LIST -> return jsonNode.isArray\r
-            BluePrintConstants.DATA_TYPE_MAP -> return jsonNode.isContainerNode\r
-            else -> return false\r
+        fun checkJsonNodeValueOfPrimitiveType(primitiveType: String, jsonNode: JsonNode): Boolean {\r
+            when (primitiveType) {\r
+                BluePrintConstants.DATA_TYPE_STRING -> return jsonNode.isTextual\r
+                BluePrintConstants.DATA_TYPE_BOOLEAN -> return jsonNode.isBoolean\r
+                BluePrintConstants.DATA_TYPE_INTEGER -> return jsonNode.isInt\r
+                BluePrintConstants.DATA_TYPE_FLOAT -> return jsonNode.isDouble\r
+                BluePrintConstants.DATA_TYPE_TIMESTAMP -> return jsonNode.isTextual\r
+                else -> return false\r
+            }\r
         }\r
 \r
-    }\r
-/*\r
-    @JvmStatic\r
-    fun populatePrimitiveValues(key: String, value: Any, primitiveType: String, objectNode: ObjectNode) {\r
-        if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {\r
-            objectNode.put(key, value as Boolean)\r
-        } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {\r
-            objectNode.put(key, value as Int)\r
-        } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {\r
-            objectNode.put(key, value as Float)\r
-        } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP == primitiveType) {\r
-            objectNode.put(key, value as String)\r
-        } else {\r
-            objectNode.put(key, value as String)\r
+        fun checkJsonNodeValueOfCollectionType(type: String, jsonNode: JsonNode): Boolean {\r
+            when (type) {\r
+                BluePrintConstants.DATA_TYPE_LIST -> return jsonNode.isArray\r
+                BluePrintConstants.DATA_TYPE_MAP -> return jsonNode.isContainerNode\r
+                else -> return false\r
+            }\r
         }\r
-    }\r
 \r
-    @JvmStatic\r
-    fun populatePrimitiveValues(value: Any, primitiveType: String, objectNode: ArrayNode) {\r
-        if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {\r
-            objectNode.add(value as Boolean)\r
-        } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {\r
-            objectNode.add(value as Int)\r
-        } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {\r
-            objectNode.add(value as Float)\r
-        } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP == primitiveType) {\r
-            objectNode.add(value as String)\r
-        } else {\r
-            objectNode.add(value as String)\r
+        fun populatePrimitiveValues(key: String, value: Any, primitiveType: String, objectNode: ObjectNode) {\r
+            when (primitiveType) {\r
+                BluePrintConstants.DATA_TYPE_BOOLEAN -> objectNode.put(key, value as Boolean)\r
+                BluePrintConstants.DATA_TYPE_INTEGER -> objectNode.put(key, value as Int)\r
+                BluePrintConstants.DATA_TYPE_FLOAT -> objectNode.put(key, value as Float)\r
+                BluePrintConstants.DATA_TYPE_TIMESTAMP -> objectNode.put(key, value as String)\r
+                else -> objectNode.put(key, value as String)\r
+            }\r
         }\r
-    }\r
 \r
-    @JvmStatic\r
-    fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) {\r
-        if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {\r
-            objectNode.put(key, false)\r
-        } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {\r
-            objectNode.put(key, 0)\r
-        } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {\r
-            objectNode.put(key, 0.0)\r
-        } else {\r
-            objectNode.put(key, "")\r
+        fun populatePrimitiveValues(value: Any, primitiveType: String, arrayNode: ArrayNode) {\r
+            when (primitiveType) {\r
+                BluePrintConstants.DATA_TYPE_BOOLEAN -> arrayNode.add(value as Boolean)\r
+                BluePrintConstants.DATA_TYPE_INTEGER -> arrayNode.add(value as Int)\r
+                BluePrintConstants.DATA_TYPE_FLOAT -> arrayNode.add(value as Float)\r
+                BluePrintConstants.DATA_TYPE_TIMESTAMP -> arrayNode.add(value as String)\r
+                else -> arrayNode.add(value as String)\r
+            }\r
         }\r
-    }\r
 \r
-    @JvmStatic\r
-    fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) {\r
-        if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {\r
-            arrayNode.add(false)\r
-        } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {\r
-            arrayNode.add(0)\r
-        } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {\r
-            arrayNode.add(0.0)\r
-        } else {\r
-            arrayNode.add("")\r
+        fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) {\r
+            when (primitiveType) {\r
+                BluePrintConstants.DATA_TYPE_BOOLEAN -> objectNode.put(key, false)\r
+                BluePrintConstants.DATA_TYPE_INTEGER -> objectNode.put(key, 0)\r
+                BluePrintConstants.DATA_TYPE_FLOAT -> objectNode.put(key, 0.0)\r
+                else -> objectNode.put(key, "")\r
+            }\r
+        }\r
+\r
+        fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) {\r
+            when (primitiveType) {\r
+                BluePrintConstants.DATA_TYPE_BOOLEAN -> arrayNode.add(false)\r
+                BluePrintConstants.DATA_TYPE_INTEGER -> arrayNode.add(0)\r
+                BluePrintConstants.DATA_TYPE_FLOAT -> arrayNode.add(0.0)\r
+                else -> arrayNode.add("")\r
+            }\r
         }\r
-    }\r
 \r
-    @JvmStatic\r
-    fun populateJsonNodeValues(key: String, nodeValue: JsonNode?, type: String, objectNode: ObjectNode) {\r
-        if (nodeValue == null || nodeValue is NullNode) {\r
-            objectNode.set(key, nodeValue)\r
-        } else if (BluePrintTypes.validPrimitiveTypes().contains(type)) {\r
-            if (BluePrintConstants.DATA_TYPE_BOOLEAN == type) {\r
-                objectNode.put(key, nodeValue.asBoolean())\r
-            } else if (BluePrintConstants.DATA_TYPE_INTEGER == type) {\r
-                objectNode.put(key, nodeValue.asInt())\r
-            } else if (BluePrintConstants.DATA_TYPE_FLOAT == type) {\r
-                objectNode.put(key, nodeValue.floatValue())\r
-            } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP == type) {\r
-                objectNode.put(key, nodeValue.asText())\r
+        fun populateJsonNodeValues(key: String, nodeValue: JsonNode?, type: String, objectNode: ObjectNode) {\r
+            if (nodeValue == null || nodeValue is NullNode) {\r
+                objectNode.set(key, nodeValue)\r
+            } else if (BluePrintTypes.validPrimitiveTypes().contains(type)) {\r
+                populatePrimitiveValues(key, nodeValue, type, objectNode)\r
             } else {\r
-                objectNode.put(key, nodeValue.asText())\r
+                objectNode.set(key, nodeValue)\r
+            }\r
+        }\r
+\r
+        fun convertPrimitiveResourceValue(type: String, value: String): JsonNode? {\r
+            when (type) {\r
+                BluePrintConstants.DATA_TYPE_BOOLEAN -> return JacksonUtils.getJsonNode(value as Boolean)\r
+                BluePrintConstants.DATA_TYPE_INTEGER -> return JacksonUtils.getJsonNode(value as Int)\r
+                BluePrintConstants.DATA_TYPE_FLOAT -> return JacksonUtils.getJsonNode(value as Float)\r
+                else -> return JacksonUtils.getJsonNode(value)\r
             }\r
-        } else {\r
-            objectNode.set(key, nodeValue)\r
         }\r
     }\r
-    */\r
 }
\ No newline at end of file
index 1a138c3..f55449e 100644 (file)
@@ -19,7 +19,10 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation
 import com.att.eelf.configuration.EELFLogger
 import com.att.eelf.configuration.EELFManager
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
 import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow
+import org.onap.ccsdk.apps.controllerblueprints.core.format
 import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
 import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
 import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
@@ -42,14 +45,35 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
 
         // Step Validation Start
         paths.add("steps")
-        workflow.steps?.forEach { stepName, _ ->
+        workflow.steps?.forEach { stepName, step ->
             paths.add(stepName)
             paths.joinToString(BluePrintConstants.PATH_DIVIDER)
-            // TODO("Step Validation")
+
+            // Validate target
+            step.target?.let {
+                try {
+                    val nodeTemplate = bluePrintRuntimeService.bluePrintContext().nodeTemplateByName(it)
+
+                    val nodeTypeDerivedFrom = bluePrintRuntimeService.bluePrintContext().nodeTemplateNodeType(it).derivedFrom
+
+                    check(nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_DG) {
+                        "NodeType(${nodeTemplate.type}) derived from is '$nodeTypeDerivedFrom', Expected is " +
+                                "'${BluePrintConstants.MODEL_TYPE_NODE_DG}'"
+                    }
+                } catch (e: Exception) {
+                    bluePrintRuntimeService.getBluePrintError()
+                            .addError("Failed to validate Workflow($workflowName)'s step($stepName)'s " +
+                                    "definition", paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!)
+                }
+            }
             paths.removeAt(paths.lastIndex)
         }
         paths.removeAt(paths.lastIndex)
         // Step Validation Ends
         paths.removeAt(paths.lastIndex)
+
+        workflow.inputs?.let {
+            bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, workflow.inputs!!)
+        }
     }
 }
\ No newline at end of file
diff --git a/components/core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory b/components/core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
new file mode 100644 (file)
index 0000000..89838f4
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# 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.
+#
+
+org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory
\ No newline at end of file
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt
new file mode 100644 (file)
index 0000000..5c5ad3b
--- /dev/null
@@ -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.script
+
+import org.junit.Ignore
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import java.io.File
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+
+class BluePrintScriptServiceTest {
+
+    @Test
+    fun `invoke script`() {
+        val scriptContent = "11 + 11"
+        val value = BluePrintScriptService()
+                .load<Int>(scriptContent)
+        assertEquals(22, value, "failed to execute command")
+    }
+
+    @Test
+    @Ignore
+    fun `invoke script component node`() {
+
+        //println(classpathFromClasspathProperty()?.joinToString("\n"))
+
+        val scriptFile = File("src/test/resources/scripts/SampleBlueprintFunctionNode.kts")
+
+        val functionNode = BluePrintScriptService()
+                .scriptClassNewInstance<BlueprintFunctionNode<String, String>>(scriptFile,
+                        "SampleBlueprintFunctionNode")
+        assertNotNull(functionNode, "failed to get instance from script")
+    }
+}
\ No newline at end of file
index 1dfb89a..c01b14b 100644 (file)
@@ -26,8 +26,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
 import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintRuntimeUtils\r
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils.jsonNodeFromFile\r
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils.jsonNodeFromObject\r
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils\r
 import kotlin.test.assertEquals\r
 import kotlin.test.assertNotNull\r
 \r
@@ -47,7 +46,7 @@ class BluePrintRuntimeServiceTest {
 \r
         val inputDataPath = "src/test/resources/data/default-context.json"\r
 \r
-        val inputNode: JsonNode = jsonNodeFromFile(inputDataPath)\r
+        val inputNode: JsonNode = JacksonUtils.jsonNodeFromFile(inputDataPath)\r
         bluePrintRuntimeService.assignInputs(inputNode)\r
 \r
         val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process")\r
@@ -82,9 +81,9 @@ class BluePrintRuntimeServiceTest {
                 "ResourceAssignmentComponent", "process")\r
 \r
         assertNotNull(inContext, "Failed to populate interface input property values")\r
-        assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")\r
-        assertEquals(inContext["request-id"], jsonNodeFromObject("12345"), "Failed to populate parameter action-name")\r
-    }\r
+        assertEquals(inContext["action-name"], JacksonUtils.jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")\r
+        assertEquals(inContext["request-id"], JacksonUtils.jsonNodeFromObject("12345"), "Failed to populate parameter action-name")\r
+      }\r
 \r
     @Test\r
     fun testResolveNodeTemplateInterfaceOperationOutputs() {\r
@@ -113,9 +112,9 @@ class BluePrintRuntimeServiceTest {
         val bluePrintRuntimeService = getBluePrintRuntimeService()\r
 \r
         bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context1",\r
-                jsonNodeFromObject("context1-value"))\r
+                JacksonUtils.jsonNodeFromObject("context1-value"))\r
         bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context2",\r
-                jsonNodeFromObject("context2-value"))\r
+                JacksonUtils.jsonNodeFromObject("context2-value"))\r
 \r
         val keys = listOf("context1", "context2")\r
 \r
  * limitations under the License.
  */
 
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils
+package org.onap.ccsdk.apps.controllerblueprints.core.service
 
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+import org.junit.Test
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import kotlin.test.assertNotNull
 
-class ResourceResolutionUtils {
-    companion object {
+class BluePrintTemplateServiceTest {
+
+    @Test
+    fun testGenerateContent() {
+
+        val template = JacksonUtils.getClassPathFileContent("templates/base-config-template.vtl")
+        val json = JacksonUtils.getClassPathFileContent("templates/base-config-data.json")
+
+        val content = BluePrintTemplateService.generateContent(template, json)
+        assertNotNull(content, "failed to generate content for velocity template")
 
-        fun <T> transformResourceSource(properties: MutableMap<String, JsonNode>, classType: Class<T>): T {
-            val content = JacksonUtils.getJson(properties)
-            return JacksonUtils.readValue(content, classType)
-                    ?: throw BluePrintProcessorException("failed to transform content($content) to type($classType)")
-        }
     }
 }
\ 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
deleted file mode 100644 (file)
index ad55c77..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*\r
- *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
- *\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *  You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.core.utils\r
-\r
-import com.att.eelf.configuration.EELFLogger\r
-import com.att.eelf.configuration.EELFManager\r
-import org.junit.Test\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate\r
-import kotlin.test.assertEquals\r
-import kotlin.test.assertNotNull\r
-\r
-@Deprecated("Reactor will be replacecd by coroutines by default.")\r
-class JacksonReactorUtilsTest {\r
-    private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())\r
-    @Test\r
-    fun testReadValues() {\r
-\r
-        val serviceTemplate = JacksonReactorUtils.readValueFromFile("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json",\r
-                ServiceTemplate::class.java).block()\r
-\r
-        assertNotNull(serviceTemplate, "Failed to simple transform Service Template")\r
-        assertEquals(true, serviceTemplate is ServiceTemplate, "failed to get Service Template instance")\r
-\r
-        val jsonContent = JacksonReactorUtils.getJson(serviceTemplate, true).block()\r
-        assertNotNull(jsonContent, "Failed to get json content")\r
-\r
-        val jsonNode = JacksonReactorUtils.jsonNodeFromFile("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json")\r
-                .block()\r
-        assertNotNull(jsonContent, "Failed to get json Node")\r
-    }\r
-\r
-    @Test(expected = BluePrintException::class)\r
-    fun testReadValuesFailure() {\r
-        JacksonReactorUtils.jsonNodeFromFile("load/blueprints/not-found.json")\r
-                .block()\r
-    }\r
-}
\ No newline at end of file
index c98f2ac..344b0cc 100644 (file)
 
 package org.onap.ccsdk.apps.controllerblueprints.core.validation
 
+import io.mockk.every
+import io.mockk.mockk
+import org.junit.Ignore
 import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.apps.controllerblueprints.core.data.Step
+import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow
 import org.onap.ccsdk.apps.controllerblueprints.core.mock.MockBluePrintTypeValidatorService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.DefaultBluePrintRuntimeService
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
+import kotlin.test.assertEquals
 import kotlin.test.assertTrue
 
 class BluePrintValidatorServiceImplTest {
 
-    val blueprintBasePath: String = ("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
-
+    private val blueprintBasePath: String = ("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
+    private val bluePrintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
+    private val mockBluePrintTypeValidatorService = MockBluePrintTypeValidatorService()
+    private val defaultBluePrintValidatorService = BluePrintValidatorServiceImpl(mockBluePrintTypeValidatorService)
+    private val workflowValidator = BluePrintWorkflowValidatorImpl(mockBluePrintTypeValidatorService)
 
     @Test
     fun testValidateOfType() {
-        val bluePrintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
+        val valid = defaultBluePrintValidatorService.validateBluePrints(bluePrintRuntime)
+        assertTrue(valid, "failed in blueprint Validation")
+    }
+
+    @Test
+    fun testValidateWorkflowFailToFoundNodeTemplate() {
+        val workflowName = "resource-assignment"
 
-        val mockBluePrintTypeValidatorService = MockBluePrintTypeValidatorService()
+        val step = Step()
+        step.target = "TestCaseFailNoNodeTemplate"
+        val workflow = Workflow()
+        workflow.steps = mutableMapOf("test" to step)
+        workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
 
-        val defaultBluePrintValidatorService = BluePrintValidatorServiceImpl(mockBluePrintTypeValidatorService)
+        assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size)
+        assertEquals("Failed to validate Workflow(resource-assignment)'s step(test)'s definition : resource-assignment/steps/test : could't get node template for the name(TestCaseFailNoNodeTemplate)", bluePrintRuntime.getBluePrintError().errors[0])
+    }
 
-        val valid = defaultBluePrintValidatorService.validateBluePrints(bluePrintRuntime)
+    @Test
+    fun testValidateWorkflowFailNodeTemplateNotDgGeneric() {
+        val workflowName = "resource-assignment"
+        val nodeTemplateName = "resource-assignment-process"
 
-        assertTrue(valid, "failed in blueprint Validation")
+        val nodeTemplate = mockk<NodeTemplate>()
+        every { nodeTemplate.type } returns "TestNodeType"
 
+        val nodeType = mockk<NodeType>()
+        every { nodeType.derivedFrom } returns "tosca.nodes.TEST"
+
+        val blueprintContext = mockk<BluePrintContext>()
+        every { blueprintContext.nodeTemplateByName(nodeTemplateName) } returns nodeTemplate
+        every { blueprintContext.nodeTemplateNodeType(nodeTemplateName) } returns nodeType
+
+        val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234")
+
+        every { bluePrintRuntime.getBluePrintError() } returns BluePrintError()
+        every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
+
+        val step = Step()
+        step.target = nodeTemplateName
+        val workflow = Workflow()
+        workflow.steps = mutableMapOf("test" to step)
+        workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
+
+        assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size)
+        assertEquals("Failed to validate Workflow(resource-assignment)'s step(test)'s definition : resource-assignment/steps/test : NodeType(TestNodeType) derived from is 'tosca.nodes.TEST', Expected is 'tosca.nodes.DG'", bluePrintRuntime.getBluePrintError().errors[0])
     }
+
+    @Test
+    fun testValidateWorkflowSuccess() {
+        val workflowName = "resource-assignment"
+        workflowValidator.validate(bluePrintRuntime, workflowName, bluePrintRuntime.bluePrintContext().workflowByName(workflowName))
+    }
+
 }
 
index d031700..f9ef9ee 100644 (file)
                                                }\r
                                        }\r
                                },\r
-                               "db": {\r
+                               "primary-db": {\r
                                        "type": "object",\r
                                        "properties": {\r
                                                "query": {\r
                                                }\r
                                        }\r
                                },\r
-                               "db": {\r
+                               "primary-db": {\r
                                        "type": "object",\r
                                        "properties": {\r
                                                "names": {\r
diff --git a/components/core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts b/components/core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts
new file mode 100644 (file)
index 0000000..44cc957
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
+
+open class SampleBlueprintFunctionNode : BlueprintFunctionNode<String, String>{
+
+    override fun getName(): String {
+        return "Kotlin-Script-Function-Node"
+    }
+
+    override fun prepareRequest(executionRequest: String): String {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun process(executionRequest: String) {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun recover(runtimeException: RuntimeException, executionRequest: String) {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun prepareResponse(): String {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun apply(t: String): String {
+        return "$t-status"
+    }
+}
\ No newline at end of file
diff --git a/components/core/src/test/resources/templates/base-config-data.json b/components/core/src/test/resources/templates/base-config-data.json
new file mode 100755 (executable)
index 0000000..2acc6fc
--- /dev/null
@@ -0,0 +1,36 @@
+{
+       "node0_hostname": "sdnc-host",
+       "node0_backup_router_address": "2001:1890:1253::192:168:100:1",
+       "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/components/core/src/test/resources/templates/base-config-template.vtl b/components/core/src/test/resources/templates/base-config-template.vtl
new file mode 100755 (executable)
index 0000000..f7b1269
--- /dev/null
@@ -0,0 +1,61 @@
+<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>ONAP 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
index 1137c1d..13847bb 100644 (file)
                   },
                   "input-param": false,
                   "dictionary-name": "nf-role",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vnf-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "protected-prefix-id",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "unprotected-prefix-id",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vf-nf-code",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vnf-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vf-module-type",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vf-module-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vfccustomizationuuid",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vf-module-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vm-type",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vnfc-model-invariant-uuid",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vfccustomizationuuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vnfc-model-version",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vfccustomizationuuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "nfc-naming-code",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vfccustomizationuuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "unprotected_private_net_cidr",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "protected_private_net_cidr",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "onap_private_net_cidr",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vf-module-label",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vf-module-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "private-prefix-id",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vf-module-type",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vf-module-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vfccustomizationuuid",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vf-module-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vm-type",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vnfc-model-invariant-uuid",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vfccustomizationuuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vnfc-model-version",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vfccustomizationuuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "nfc-naming-code",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vfccustomizationuuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "unprotected_private_net_cidr",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "onap_private_net_cidr",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vf-module-label",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vf-module-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "private-prefix-id",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vf-module-type",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vf-module-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vfccustomizationuuid",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vf-module-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vm-type",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vnfc-model-invariant-uuid",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vfccustomizationuuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vnfc-model-version",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vfccustomizationuuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "nfc-naming-code",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vfccustomizationuuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "unprotected_private_net_cidr",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "protected_private_net_cidr",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "onap_private_net_cidr",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vf-module-label",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vf-module-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "private-prefix-id",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "protected-prefix-id",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "vf-module-type",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vf-module-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "nf-role",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     "vnf-model-customization-uuid"
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "unprotected_private_net_cidr",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
                   },
                   "input-param": false,
                   "dictionary-name": "protected_private_net_cidr",
-                  "dictionary-source": "db",
+                  "dictionary-source": "primary-db",
                   "dependencies": [
                     
                   ],
index 7d850f2..6d771cd 100644 (file)
           "required": true,
           "type": "string"
         },
+        "service-instance-id": {
+          "required": true,
+          "type": "string"
+        },
+        "vnf-id": {
+          "required": true,
+          "type": "string"
+        },
         "action-name": {
           "required": true,
           "type": "string"
         "hostname": {
           "required": true,
           "type": "string"
+        },
+        "vnf_name": {
+          "required": true,
+          "type": "string"
         }
       },
       "derived_from": "tosca.datatypes.Dynamic"
diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-kotlin.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-kotlin.json
new file mode 100644 (file)
index 0000000..cf19ac6
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "description": "Kotlin Script file",
+  "version": "1.0.0",
+  "file_ext": [
+    "kts"
+  ],
+  "derived_from": "tosca.artifacts.Implementation"
+}
\ No newline at end of file
index 241b699..e4eb90e 100644 (file)
@@ -5,10 +5,11 @@
     "type": {
       "required": true,
       "type": "string",
-      "default": "JAVA-COMPONENT",
+      "default": "KOTLIN-COMPONENT",
       "constraints": [
         {
           "valid_values": [
+            "KOTLIN-COMPONENT",
             "JAVA-COMPONENT",
             "JYTHON-COMPONENT"
           ]
diff --git a/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json b/components/model-catalog/definition-type/starter-type/node_type/tosca.nodes.component.Kotlin.json
new file mode 100644 (file)
index 0000000..381ed59
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "description": "This is Kotlin Component",
+  "version": "1.0.0",
+  "derived_from": "tosca.nodes.Root"
+}
\ No newline at end of file
index 819c7e6..6da5ea2 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.VF_MODEL.nf_role as vf_model_role from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnfmodelcustomizationuuid",
index b827918..4e1ba2b 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid",
index cee0601..42765ee 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"private\"",
@@ -1,24 +1,24 @@
-{\r
-  "name": "db-source",\r
-  "property" :{\r
-    "description": "name of the ",\r
-    "type": "string"\r
-  },\r
-  "updated-by": "brindasanth@onap.com",\r
-  "tags": "bundle-id, brindasanth@onap.com",\r
-  "sources": {\r
-    "db": {\r
-      "type": "source-db",\r
-      "properties": {\r
-        "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",\r
-        "input-key-mapping": {\r
-          "profile_name": "profile_name"\r
-        },\r
-        "output-key-mapping": {\r
-          "db-country": "country",\r
-          "db-state": "state"\r
-        }\r
-      }\r
-    }\r
-  }\r
+{
+  "name": "primary-db-source",
+  "property" :{
+    "description": "name of the ",
+    "type": "string"
+  },
+  "updated-by": "brindasanth@onap.com",
+  "tags": "bundle-id, brindasanth@onap.com",
+  "sources": {
+    "primary-db": {
+      "type": "source-primary-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"
+        }
+      }
+    }
+  }
 }
\ No newline at end of file
index 5dea3e3..0685401 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"private\"",
index fb57274..f6120f3 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"protected\"",
index 261920f..bb477dc 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"protected\"",
@@ -5,10 +5,10 @@
     "type": "string"\r
   },\r
   "updated-by": "brindasanth@onap.com",\r
-  "tags": "db-source, brindasanth@onap.com",\r
+  "tags": "primary-db-source, brindasanth@onap.com",\r
   "sources": {\r
-    "db": {\r
-      "type": "source-db",\r
+    "primary-db": {\r
+      "type": "source-primary-db",\r
       "properties": {\r
         "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",\r
         "input-key-mapping": {\r
index 3cb7320..c1fc541 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"unprotected\"",
index d2a339e..6048755 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"unprotected\"",
index ac5e21a..faa7ea4 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid",
index 147425c..dbd51bb 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid",
index f68cc37..70792f8 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid",
index 1865d47..a21982c 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.VF_MODEL.nf_code as vf_nf_code from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:customizationid",
index 463f848..9f3e7cf 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.VF_MODULE_TO_VFC_MAPPING.vfc_customization_uuid as vnf_customid from sdnctl.VF_MODULE_TO_VFC_MAPPING where vm_count = 1 and sdnctl.VF_MODULE_TO_VFC_MAPPING.vf_module_customization_uuid=:vfmodulecustomizationuuid",
index 0204c64..9744316 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select VFC_MODEL.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
index c894fb5..3d89d9d 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select VFC_MODEL.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
index 45eb07f..d7fb501 100755 (executable)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select VFC_MODEL.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
index 1c49aed..8ecb2c1 100644 (file)
   ~ 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">
+<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.apps</groupId>
         <artifactId>components</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.ccsdk.apps.components</groupId>
     <artifactId>parent</artifactId>
     <properties>
         <spring.boot.version>2.1.1.RELEASE</spring.boot.version>
         <spring.version>5.1.3.RELEASE</spring.version>
-        <kotlin.version>1.3.10</kotlin.version>
-        <kotlin.maven.version>1.3.10</kotlin.maven.version>
-        <kotlin.couroutines.version>1.0.1</kotlin.couroutines.version>
-        <grpc.version>1.16.1</grpc.version>
+        <kotlin.version>1.3.11</kotlin.version>
+        <kotlin.maven.version>1.3.11</kotlin.maven.version>
+        <kotlin.couroutines.version>1.1.0</kotlin.couroutines.version>
+        <grpc.version>1.17.1</grpc.version>
         <protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
         <eelf.version>1.0.0</eelf.version>
-        <guava.version>26.0-jre</guava.version>
+        <guava.version>27.0.1-jre</guava.version>
         <springfox.swagger2.version>2.9.2</springfox.swagger2.version>
         <h2database.version>1.4.197</h2database.version>
         <onap.logger.slf4j>1.2.2</onap.logger.slf4j>
-        <powermock.version>1.7.4</powermock.version>
+        <mockk.version>1.9</mockk.version>
     </properties>
     <dependencyManagement>
         <dependencies>
@@ -76,6 +77,7 @@
                 <version>${springfox.swagger2.version}</version>
             </dependency>
 
+            <!-- Common Utils Dependencies -->
             <dependency>
                 <groupId>org.apache.commons</groupId>
                 <artifactId>commons-lang3</artifactId>
                 <artifactId>kotlin-stdlib</artifactId>
                 <version>${kotlin.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-scripting-jvm-host</artifactId>
+                <version>${kotlin.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-compiler-embeddable</artifactId>
+                <version>${kotlin.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-script-util</artifactId>
+                <version>${kotlin.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-script-runtime</artifactId>
+                <version>${kotlin.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.jetbrains.kotlinx</groupId>
                 <artifactId>kotlinx-coroutines-core</artifactId>
 
             <!-- Testing Dependencies -->
             <dependency>
-                <groupId>org.powermock</groupId>
-                <artifactId>powermock-api-mockito2</artifactId>
-                <version>${powermock.version}</version>
+                <groupId>io.mockk</groupId>
+                <artifactId>mockk</artifactId>
+                <version>${mockk.version}</version>
                 <scope>test</scope>
             </dependency>
             <dependency>
                 <version>${kotlin.version}</version>
                 <scope>test</scope>
             </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlinx</groupId>
+                <artifactId>kotlinx-coroutines-test</artifactId>
+                <version>${kotlin.couroutines.version}</version>
+                <scope>test</scope>
+            </dependency>
             <dependency>
                 <groupId>io.grpc</groupId>
                 <artifactId>grpc-testing</artifactId>
             <groupId>org.jetbrains.kotlin</groupId>
             <artifactId>kotlin-stdlib</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.jetbrains.kotlin</groupId>
+            <artifactId>kotlin-script-util</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.jetbrains.kotlin</groupId>
             <artifactId>kotlin-stdlib-jdk8</artifactId>
             <groupId>com.fasterxml.jackson.module</groupId>
             <artifactId>jackson-module-kotlin</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.jetbrains.kotlin</groupId>
+            <artifactId>kotlin-scripting-jvm-host</artifactId>
+        </dependency>
         <!-- GRPC Dependencies -->
         <dependency>
             <groupId>io.grpc</groupId>
index 6310c58..5b8768c 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps</groupId>
         <artifactId>ccsdk-apps</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>components</artifactId>
index 0e108c5..df6b5df 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select sdnctl.VF_MODEL.nf_role as vf_model_role from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnfmodelcustomizationuuid",\r
index f0f2b7f..7c521a7 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid",\r
index 07c5cbc..f2067a1 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = private",\r
@@ -1,24 +1,24 @@
-{
-  "name": "db-source",
-  "property" :{
-    "description": "name of the ",
-    "type": "string"
-  },
-  "updated-by": "brindasanth@onap.com",
-  "tags": "bundle-id, brindasanth@onap.com",
-  "sources": {
-    "db": {
-      "type": "source-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"
-        }
-      }
-    }
-  }
+{\r
+  "name": "primary-db-source",\r
+  "property" :{\r
+    "description": "name of the ",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "brindasanth@onap.com",\r
+  "tags": "bundle-id, brindasanth@onap.com",\r
+  "sources": {\r
+    "primary-db": {\r
+      "type": "source-primary-db",\r
+      "properties": {\r
+        "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",\r
+        "input-key-mapping": {\r
+          "profile_name": "profile_name"\r
+        },\r
+        "output-key-mapping": {\r
+          "db-country": "country",\r
+          "db-state": "state"\r
+        }\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
index a95bae3..309647d 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = private",\r
index 56b0d6d..816405b 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = protected",\r
index db0a43d..bf46fb3 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = protected",\r
index a0d966a..8a09b14 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = unprotected",\r
index 8f9385d..241147c 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"
   },
   "sources" : {
-    "db" : {
-      "type" : "source-db",
+    "primary-db" : {
+      "type" : "source-primary-db",
       "properties" : {
         "type" : "SQL",
         "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = unprotected",
index a954372..01355c2 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid",\r
index 805d834..ead69d4 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid",\r
index ceed318..cde861f 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid",\r
index 0d25d0e..adbd22a 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select sdnctl.VF_MODEL.nf_code as vf_nf_code from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:customizationid",\r
index a34a9a7..b348579 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select sdnctl.VF_MODULE_TO_VFC_MAPPING.vfc_customization_uuid as vnf_customid from sdnctl.VF_MODULE_TO_VFC_MAPPING where vm_count = 1 and sdnctl.VF_MODULE_TO_VFC_MAPPING.vf_module_customization_uuid=:vfmodulecustomizationuuid",\r
index 7bb5ef1..e559f9b 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select vfc_model.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid",\r
index b2ccd45..9eb94cf 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select vfc_model.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid",\r
index fb59eea..e4e6622 100644 (file)
@@ -7,8 +7,8 @@
     "type" : "string"\r
   },\r
   "sources" : {\r
-    "db" : {\r
-      "type" : "source-db",\r
+    "primary-db" : {\r
+      "type" : "source-primary-db",\r
       "properties" : {\r
         "type" : "SQL",\r
         "query" : "select vfc_model.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid",\r
index 0fd2cc5..a3602ac 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.components</groupId>
         <artifactId>parent</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
index a39139e..e4219c1 100644 (file)
@@ -23,7 +23,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict
 object ResourceDictionaryConstants {
     const val SOURCE_INPUT = "input"
     const val SOURCE_DEFAULT = "default"
-    const val SOURCE_DB = "db"
+    const val SOURCE_DB = "primary-db"
 
     const val MODEL_DIR_RESOURCE_DEFINITION: String = "resource_dictionary"
 
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceAssignmentUtils.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceAssignmentUtils.kt
new file mode 100644 (file)
index 0000000..a234a89
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * 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.resource.dict.utils
+
+import java.util.Date
+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.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import org.onap.ccsdk.apps.controllerblueprints.core.*
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+
+class ResourceAssignmentUtils {
+    companion object {
+
+        private val logger: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentUtils::class.toString())
+
+        @Synchronized
+        @Throws(BluePrintProcessorException::class)
+        fun setResourceDataValue(resourceAssignment: ResourceAssignment, value: Any?) {
+
+            val resourceProp = checkNotNull(resourceAssignment.property) { "Failed in setting resource value for resource mapping $resourceAssignment" }
+            checkNotEmptyNThrow(resourceAssignment.name, "Failed in setting resource value for resource mapping $resourceAssignment")
+
+            if (checkNotEmpty(resourceAssignment.dictionaryName)) {
+                resourceAssignment.dictionaryName = resourceAssignment.name
+                logger.warn("Missing dictionary key, setting with template key (${resourceAssignment.name}) as dictionary key (${resourceAssignment.dictionaryName})")
+            }
+
+            try {
+                if (checkNotEmpty(resourceProp.type)) {
+                    val convertedValue = convertResourceValue(resourceProp.type, value)
+                    logger.info("Setting Resource Value ($convertedValue) for Resource Name (${resourceAssignment.dictionaryName}) of type (${resourceProp.type})")
+                    resourceProp.value = convertedValue
+                    resourceAssignment.updatedDate = Date()
+                    resourceAssignment.updatedBy = BluePrintConstants.USER_SYSTEM
+                    resourceAssignment.status = BluePrintConstants.STATUS_SUCCESS
+                }
+            } catch (e: Exception) {
+                throw BluePrintProcessorException("Failed in setting value for template key (%s) and " +
+                        "dictionary key (${resourceAssignment.name}) of type (${resourceProp.type}) with error message (${e.message})", e)
+            }
+        }
+
+        private fun convertResourceValue(type: String, value: Any?): JsonNode? {
+            var convertedValue: JsonNode?
+
+            if (value == null || value is NullNode) {
+                logger.info("Returning {} value from convertResourceValue", value)
+                return null
+            } else if (BluePrintTypes.validPrimitiveTypes().contains(type) && value is String) {
+                convertedValue = JacksonUtils.convertPrimitiveResourceValue(type, value)
+            } else {
+                // Case where Resource is non-primitive type
+                if (value is String) {
+                    convertedValue = JacksonUtils.jsonNode(value)
+                } else {
+                    convertedValue = JacksonUtils.getJsonNode(value)
+                }
+            }
+            return convertedValue
+        }
+
+        @Synchronized
+        fun setFailedResourceDataValue(resourceAssignment: ResourceAssignment, message: String?) {
+            if (checkNotEmpty(resourceAssignment.name)) {
+                resourceAssignment.updatedDate = Date()
+                resourceAssignment.updatedBy = BluePrintConstants.USER_SYSTEM
+                resourceAssignment.status = BluePrintConstants.STATUS_FAILURE
+                resourceAssignment.message = message
+            }
+        }
+
+        @Synchronized
+        @Throws(BluePrintProcessorException::class)
+        fun assertTemplateKeyValueNotNull(resourceAssignment: ResourceAssignment) {
+            val resourceProp = checkNotNull(resourceAssignment.property) { "Failed to populate mandatory resource resource mapping $resourceAssignment" }
+            if (resourceProp.required != null && resourceProp.required!! && (resourceProp.value == null || resourceProp.value !is NullNode)) {
+                logger.error("failed to populate mandatory resource mapping ($resourceAssignment)")
+                throw BluePrintProcessorException("failed to populate mandatory resource mapping ($resourceAssignment)")
+            }
+        }
+
+        @Synchronized
+        @Throws(BluePrintProcessorException::class)
+        fun generateResourceDataForAssignments(assignments: List<ResourceAssignment>): String {
+            var result = "{}"
+            try {
+                val mapper = ObjectMapper()
+                val root = mapper.readTree(result)
+
+                assignments.forEach {
+                    if (checkNotEmpty(it.name) && it.property != null) {
+
+                        val type = it.property?.type
+                        val value = it.property?.value
+                        logger.info("Generating Resource name ({}), type ({}), value ({})", it.name, type,
+                                value)
+                        if (value == null) {
+                            (root as ObjectNode).set(it.name, null)
+                        } else if (value is JsonNode) {
+                            (root as ObjectNode).put(it.name, value as JsonNode)
+                        } else if (BluePrintConstants.DATA_TYPE_STRING.equals(type, ignoreCase = true)) {
+                            (root as ObjectNode).put(it.name, value as String)
+                        } else if (BluePrintConstants.DATA_TYPE_BOOLEAN.equals(type, ignoreCase = true)) {
+                            (root as ObjectNode).put(it.name, value as Boolean)
+                        } else if (BluePrintConstants.DATA_TYPE_INTEGER.equals(type, ignoreCase = true)) {
+                            (root as ObjectNode).put(it.name, value as Int)
+                        } else if (BluePrintConstants.DATA_TYPE_FLOAT.equals(type, ignoreCase = true)) {
+                            (root as ObjectNode).put(it.name, value as Float)
+                        } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP.equals(type, ignoreCase = true)) {
+                            (root as ObjectNode).put(it.name, value as String)
+                        } else {
+                            val jsonNode = JacksonUtils.getJsonNode(value)
+                            if (jsonNode != null) {
+                                (root as ObjectNode).put(it.name, jsonNode)
+                            } else {
+                                (root as ObjectNode).set(it.name, null)
+                            }
+                        }
+                    }
+                }
+                result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(root)
+                logger.info("Generated Resource Param Data ({})", result)
+            } catch (e: Exception) {
+                throw BluePrintProcessorException("kapil is failing with $e.message", e)
+            }
+
+            return result
+        }
+
+        fun <T> transformResourceSource(properties: MutableMap<String, JsonNode>, classType: Class<T>): T {
+            val content = JacksonUtils.getJson(properties)
+            return JacksonUtils.readValue(content, classType)
+                    ?: throw BluePrintProcessorException("failed to transform content($content) to type($classType)")
+        }
+
+    }
+}
\ No newline at end of file
index fde8000..1ed306e 100644 (file)
@@ -31,7 +31,7 @@ public class ResourceDefinitionTest {
     public void testDictionaryDefinitionInputSource(){\r
 \r
         String fileName = basePath + "/input-source.json";\r
-        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);\r
+        ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);\r
         Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition);\r
     }\r
 \r
@@ -39,22 +39,22 @@ public class ResourceDefinitionTest {
     public void testDictionaryDefinitionDefaultSource(){\r
 \r
         String fileName = basePath + "/default-source.json";\r
-        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);\r
+        ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);\r
         Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition);\r
     }\r
 \r
     @Test\r
     public void testDictionaryDefinitionDBSource(){\r
 \r
-        String fileName = basePath + "/db-source.json";\r
-        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);\r
-        Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", resourceDefinition);\r
+        String fileName = basePath + "/primary-db-source.json";\r
+        ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);\r
+        Assert.assertNotNull("Failed to populate dictionaryDefinition for primary-db type", resourceDefinition);\r
     }\r
 \r
     @Test\r
     public void testDictionaryDefinitionMDSALSource(){\r
         String fileName = basePath + "/mdsal-source.json";\r
-        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);\r
+        ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);\r
         Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition);\r
     }\r
 }\r
index b67aa79..3f5aef4 100644 (file)
@@ -25,13 +25,13 @@ public class ResourceSourceMappingFactoryTest {
     @Test\r
     public void testRegisterResourceMapping() {\r
 \r
-        ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("db", "source-db");\r
+        ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-db", "source-primary-db");\r
         ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");\r
         ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");\r
         ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest");\r
 \r
-        String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("db");\r
-        Assert.notNull(nodeTypeName, "Failed to get db mapping");\r
+        String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("primary-db");\r
+        Assert.notNull(nodeTypeName, "Failed to get primary-db mapping");\r
 \r
         ResourceSourceMapping resourceSourceMapping = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping();\r
         Assert.notNull(resourceSourceMapping, "Failed to get resource source mapping");\r
index 2b68585..7f040b2 100644 (file)
@@ -30,10 +30,10 @@ public class ResourceDefinitionValidationServiceTest {
     @Test
     public void testValidateSource() throws Exception {
 
-        String inputFileName = dictionaryPath + "/db-source.json";
+        String inputFileName = dictionaryPath + "/input-source.json";
         testValidate(inputFileName);
 
-        String dbFileName = dictionaryPath + "/db-source.json";
+        String dbFileName = dictionaryPath + "/primary-db-source.json";
         testValidate(dbFileName);
 
         String defaultFileName = dictionaryPath + "/default-source.json";
@@ -45,7 +45,7 @@ public class ResourceDefinitionValidationServiceTest {
 
     private void testValidate(String fileName) throws Exception {
 
-        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+        ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
         Assert.assertNotNull("Failed to populate dictionaryDefinition for  type", resourceDefinition);
 
         ResourceDefinitionValidationService resourceDictionaryValidationService =
index c7444db..a2c2310 100644 (file)
@@ -30,7 +30,7 @@ public class BulkResourceSequencingUtilsTest {
 \r
     @Test\r
     public void testProcess(){\r
-        List<ResourceAssignment> assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment.class);\r
+        List<ResourceAssignment> assignments = JacksonUtils.Companion.getListFromClassPathFile("validation/success.json", ResourceAssignment.class);\r
         Assert.assertNotNull("failed to get ResourceAssignment from validation/success.json ", assignments);\r
         BulkResourceSequencingUtils.process(assignments);\r
     }\r
index 13bf819..fa24138 100644 (file)
@@ -86,7 +86,7 @@ public class ResourceDictionaryUtilsTest {
 \r
     @Test\r
     public void testAssignInputs() {\r
-        JsonNode data = JacksonUtils.jsonNodeFromClassPathFile("data/resource-assignment-input.json");\r
+        JsonNode data = JacksonUtils.Companion.jsonNodeFromClassPathFile("data/resource-assignment-input.json");\r
         Map<String, Object> context = new HashMap<>();\r
         ResourceDictionaryUtils.assignInputs(data, context);\r
         String path = BluePrintConstants.PATH_INPUTS.concat(BluePrintConstants.PATH_DIVIDER).concat("mapValue");\r
@@ -22,7 +22,7 @@ object ResourceDictionaryTestUtils {
 \r
     @JvmStatic\r
     fun setUpResourceSourceMapping() {\r
-        ResourceSourceMappingFactory.registerSourceMapping("db", "source-db")\r
+        ResourceSourceMappingFactory.registerSourceMapping("primary-db", "source-primary-db")\r
         ResourceSourceMappingFactory.registerSourceMapping("input", "source-input")\r
         ResourceSourceMappingFactory.registerSourceMapping("default", "source-default")\r
         ResourceSourceMappingFactory.registerSourceMapping("mdsal", "source-rest")\r
index d837dc5..7e6472f 100644 (file)
       "type": "string"\r
     },\r
     "dictionary-name": "loopback-ip",\r
-    "dictionary-source": "db",\r
+    "dictionary-source": "primary-db",\r
     "dependencies": [\r
       "bundle-mac",\r
       "managed-ip1"\r
index 330324c..28ab71f 100644 (file)
       "type": "string"\r
     },\r
     "dictionary-name": "loopback-ip",\r
-    "dictionary-source": "db",\r
+    "dictionary-source": "primary-db",\r
     "dependencies": [\r
       "bundle-mac"\r
     ]\r
index 3215d06..5d0e898 100644 (file)
       "type": "string"\r
     },\r
     "dictionary-name": "loopback-ip",\r
-    "dictionary-source": "db",\r
+    "dictionary-source": "primary-db",\r
     "dependencies": [\r
       "bundle-mac"\r
     ]\r
index 1920807..679a8b9 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>parent</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <artifactId>application</artifactId>
index 3128b64..51c6250 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>functions</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
index 4de42be..2a952f8 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>parent</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
index ba97d22..120ded7 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <artifactId>functions</artifactId>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
index 66c919d..341ede5 100644 (file)
@@ -20,6 +20,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractCompon
 import org.python.core.PyObject
 import org.python.util.PythonInterpreter
 import org.slf4j.LoggerFactory
+import java.io.File
 import java.util.*
 
 class PythonExecutorUtils {
@@ -61,9 +62,9 @@ class PythonExecutorUtils {
             sb.append(System.getProperty("java.class.path"))
 
             for (p in pythonPath) {
-                sb.append(":").append(p)
+                sb.append(File.pathSeparator).append(p)
             }
-            log.debug("Paths : $sb")
+            log.debug("Python Paths : $sb")
 
             props["python.import.site"] = "true"
             props.setProperty("python.path", sb.toString())
index 431c6b8..c4fd546 100644 (file)
@@ -30,7 +30,7 @@ class PythonExecutorUtilsTest {
     @Test
     fun testGetPythonComponent() {
 
-        val pythonPath: MutableList<String> = arrayListOf()
+        val pythonPath: MutableList<String> = mutableListOf()
         pythonPath.add("./../../../../components/scripts/python/ccsdk_blueprints")
 
         val properties: MutableMap<String, Any> = hashMapOf()
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json
new file mode 100644 (file)
index 0000000..7142f04
--- /dev/null
@@ -0,0 +1,31 @@
+{\r
+  "actionIdentifiers": {\r
+    "actionName": "activate",\r
+    "blueprintName": "baseconfiguration",\r
+    "blueprintVersion": "1.0.0",\r
+    "mode": "sync"\r
+  },\r
+  "commonHeader": {\r
+    "flags": {\r
+      "force": true,\r
+      "ttl": 3600\r
+    },\r
+    "originatorId": "sdnc",\r
+    "requestId": "123456-1000",\r
+    "subRequestId": "sub-123456-1000",\r
+    "timestamp": "2012-04-23T18:25:43.511Z"\r
+  },\r
+  "payload": {\r
+    "resource-assignment-request": {\r
+      "resource-assignment-properties": {\r
+        "request-id": "1234",\r
+        "service-instance-id": "siid_1234",\r
+        "vnf-id": "vnf_1234",\r
+        "action-name": "assign-activate",\r
+        "scope-type": "vnf-type",\r
+        "hostname": "localhost",\r
+        "vnf_name": "temp_vnf"\r
+      }\r
+    }\r
+  }\r
+}\r
index 07ae44b..2f08c58 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>functions</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
     <artifactId>resource-resolution</artifactId>
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentProcessorScriptConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentProcessorScriptConfiguration.kt
new file mode 100644 (file)
index 0000000..ffe09e4
--- /dev/null
@@ -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.blueprintsprocessor.functions.resource.resolution
+
+import org.jetbrains.kotlin.script.util.DependsOn
+import org.jetbrains.kotlin.script.util.Repository
+import kotlin.script.experimental.annotations.KotlinScript
+import kotlin.script.experimental.api.ScriptCompilationConfiguration
+import kotlin.script.experimental.api.defaultImports
+import kotlin.script.experimental.jvm.dependenciesFromCurrentContext
+import kotlin.script.experimental.jvm.jvm
+
+@KotlinScript(fileExtension = "resourceassignmentprocessor.kts",
+        compilationConfiguration = ResourceAssignmentProcessorScriptConfiguration::class)
+abstract class ResourceAssignmentProcessorScript {
+
+}
+
+object ResourceAssignmentProcessorScriptConfiguration : ScriptCompilationConfiguration(
+        {
+            defaultImports(DependsOn::class, Repository::class)
+            jvm {
+                dependenciesFromCurrentContext(
+                        wholeClasspath = true
+                )
+            }
+        }
+)
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt
new file mode 100644 (file)
index 0000000..9d6f4a6
--- /dev/null
@@ -0,0 +1,58 @@
+package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution\r
+\r
+import com.fasterxml.jackson.databind.JsonNode\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException\r
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext\r
+import org.onap.ccsdk.apps.controllerblueprints.core.service.DefaultBluePrintRuntimeService\r
+\r
+class ResourceAssignmentRuntimeService(private var id: String, private var bluePrintContext: BluePrintContext)\r
+    : DefaultBluePrintRuntimeService(id, bluePrintContext){\r
+\r
+    private var resourceResolutionStore: MutableMap<String, JsonNode> = hashMapOf()\r
+\r
+    override fun getExecutionContext(): MutableMap<String, JsonNode> {\r
+        return resourceResolutionStore\r
+    }\r
+\r
+    @Suppress("UNCHECKED_CAST")\r
+    override fun setExecutionContext(executionContext: MutableMap<String, JsonNode>) {\r
+        this.resourceResolutionStore = executionContext\r
+    }\r
+\r
+    override fun put(key: String, value: JsonNode) {\r
+        resourceResolutionStore[key] = value\r
+    }\r
+\r
+    override fun get(key: String): JsonNode {\r
+        return resourceResolutionStore[key] ?: throw BluePrintProcessorException("failed to get execution property($key)")\r
+    }\r
+\r
+    override fun check(key: String): Boolean {\r
+        return resourceResolutionStore.containsKey(key)\r
+    }\r
+\r
+    override fun cleanRuntime() {\r
+        resourceResolutionStore.clear()\r
+    }\r
+\r
+    private fun getJsonNode(key: String): JsonNode {\r
+        return get(key)\r
+    }\r
+\r
+    override fun getAsString(key: String): String? {\r
+        return get(key).asText()\r
+    }\r
+\r
+    override fun getAsBoolean(key: String): Boolean? {\r
+        return get(key).asBoolean()\r
+    }\r
+\r
+    override fun getAsInt(key: String): Int? {\r
+        return get(key).asInt()\r
+    }\r
+\r
+    override fun getAsDouble(key: String): Double? {\r
+        return get(key).asDouble()\r
+    }\r
+\r
+}\r
index f1de8f7..9933849 100644 (file)
@@ -17,9 +17,9 @@
 package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
 
 import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.CapabilityResourceSource
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceResolutionUtils
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceAssignmentUtils
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.context.ApplicationContext
 import org.springframework.stereotype.Service
@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service
 open class CapabilityResourceAssignmentProcessor : ResourceAssignmentProcessor() {
 
     companion object {
+        const val CAPABILITY_TYPE_KOTLIN_COMPONENT = "KOTLIN-COMPONENT"
         const val CAPABILITY_TYPE_JAVA_COMPONENT = "JAVA-COMPONENT"
         const val CAPABILITY_TYPE_JYTHON_COMPONENT = "JYTHON-COMPONENT"
     }
@@ -49,7 +50,7 @@ open class CapabilityResourceAssignmentProcessor : ResourceAssignmentProcessor()
 
         checkNotNull(resourceSource.properties) { "failed to get ${executionRequest.dictionarySource} properties" }
 
-        val capabilityResourceSourceProperty = ResourceResolutionUtils.transformResourceSource(resourceSource.properties!!, CapabilityResourceSource::class.java)
+        val capabilityResourceSourceProperty = ResourceAssignmentUtils.transformResourceSource(resourceSource.properties!!, CapabilityResourceSource::class.java)
 
         val instanceType = capabilityResourceSourceProperty.type
         val instanceName = capabilityResourceSourceProperty.instanceName
@@ -58,6 +59,9 @@ open class CapabilityResourceAssignmentProcessor : ResourceAssignmentProcessor()
         var componentResourceAssignmentProcessor: ResourceAssignmentProcessor? = null
 
         when (instanceType) {
+            CAPABILITY_TYPE_KOTLIN_COMPONENT ->{
+                TODO("NO implementation")
+            }
             CAPABILITY_TYPE_JAVA_COMPONENT -> {
                 // Initialize Capability Resource Assignment Processor
                 componentResourceAssignmentProcessor = applicationContext.getBean(instanceName, ResourceAssignmentProcessor::class.java)
index 9d47600..bd9c188 100644 (file)
 
 package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
 
+import org.onap.ccsdk.apps.controllerblueprints.core.*
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
 import org.springframework.stereotype.Service
+import com.fasterxml.jackson.databind.node.NullNode
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceAssignmentUtils
 
 /**
  * InputResourceAssignmentProcessor
@@ -33,6 +36,20 @@ open class InputResourceAssignmentProcessor : ResourceAssignmentProcessor() {
     }
 
     override fun process(executionRequest: ResourceAssignment) {
+        try {
+            if (checkNotEmpty(executionRequest.name)) {
+                val value = bluePrintRuntimeService!!.getInputValue(executionRequest.name)
+                // if value is null don't call setResourceDataValue to populate the value
+                if (value != null && value !is NullNode) {
+                    ResourceAssignmentUtils.setResourceDataValue(executionRequest, value)
+                }
+            }
+            // Check the value has populated for mandatory case
+            ResourceAssignmentUtils.assertTemplateKeyValueNotNull(executionRequest)
+        } catch (e: Exception) {
+            ResourceAssignmentUtils.setFailedResourceDataValue(executionRequest, e.message)
+            throw BluePrintProcessorException("Failed in template key ($executionRequest) assignments with : (${e.message})", e)
+        }
     }
 
     override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
@@ -21,15 +21,15 @@ import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
 import org.springframework.stereotype.Service
 
 /**
- * DataBaseResourceAssignmentProcessor
+ * PrimaryDataResourceAssignmentProcessor
  *
  * @author Brinda Santh
  */
-@Service("resource-assignment-processor-db")
-open class DataBaseResourceAssignmentProcessor : ResourceAssignmentProcessor(){
+@Service("resource-assignment-processor-primary-db")
+open class PrimaryDataResourceAssignmentProcessor : ResourceAssignmentProcessor(){
 
     override fun getName(): String {
-        return "resource-assignment-processor-db"
+        return "resource-assignment-processor-primary-db"
     }
 
     override fun process(executionRequest: ResourceAssignment) {
index ef84960..8adde86 100644 (file)
@@ -34,7 +34,7 @@ import org.springframework.test.context.junit4.SpringRunner
 @RunWith(SpringRunner::class)
 @ContextConfiguration(classes = [ResourceResolutionComponent::class, ResourceResolutionService::class,
     InputResourceAssignmentProcessor::class, DefaultResourceAssignmentProcessor::class,
-    DataBaseResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class,
+    PrimaryDataResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class,
     CapabilityResourceAssignmentProcessor::class])
 class ResourceResolutionComponentTest {
 
index 7f41ba1..6c68675 100644 (file)
@@ -19,8 +19,11 @@ package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
 import org.junit.Assert
 import org.junit.Test
 import org.junit.runner.RunWith
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.utils.PayloadUtils
 import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.*
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
 import org.slf4j.LoggerFactory
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.test.context.ContextConfiguration
@@ -36,7 +39,7 @@ import kotlin.test.assertTrue
 @RunWith(SpringRunner::class)
 @ContextConfiguration(classes = [ResourceResolutionService::class,
     InputResourceAssignmentProcessor::class, DefaultResourceAssignmentProcessor::class,
-    DataBaseResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class,
+    PrimaryDataResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class,
     CapabilityResourceAssignmentProcessor::class])
 class ResourceResolutionServiceTest {
 
@@ -50,7 +53,7 @@ class ResourceResolutionServiceTest {
     fun testRegisteredSource() {
         val sources = resourceResolutionService.registeredResourceSources()
         assertNotNull(sources, "failed to get registered sources")
-        assertTrue(sources.containsAll(arrayListOf("input", "default", "db", "mdsal")), "failed to get registered sources")
+        assertTrue(sources.containsAll(arrayListOf("input", "default", "primary-db", "mdsal")), "failed to get registered sources")
     }
 
     @Test
@@ -62,6 +65,12 @@ class ResourceResolutionServiceTest {
         val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
                 "./../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
 
+        val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
+                ExecutionServiceInput::class.java)!!
+
+        // Prepare Inputs
+        PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService, executionServiceInput.payload, "resource-assignment")
+
         resourceResolutionService.resolveResources(bluePrintRuntimeService, "resource-assignment", "baseconfig")
 
     }
@@ -4,7 +4,7 @@
                "data-type": "list",\r
                "entry-schema": "dt-location",\r
                "source": {\r
-                       "db": {\r
+                       "primary-db": {\r
                                "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",\r
                                "input-key-mapping": {\r
                                        "profile_name": "profile_name"\r
@@ -16,7 +16,7 @@
                        }\r
                },\r
                "candidate-dependency": {\r
-                       "db": {\r
+                       "primary-db": {\r
                                "names": [\r
                                        "profile_name"\r
                                ]\r
@@ -3,7 +3,7 @@
                "name": "location",\r
                "data-type": "dt-location",\r
                "source": {\r
-                       "db": {\r
+                       "primary-db": {\r
                                "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",\r
                                "input-key-mapping": {\r
                                        "profile_name": "profile_name"\r
@@ -3,7 +3,7 @@
                "name": "country",\r
                "data-type": "string",\r
                "source": {\r
-                       "db": {\r
+                       "primary-db": {\r
                                "query": "SELECT country FROM DEVICE_PROFILE WHERE profile_name = :profile_name",\r
                                "input-key-mapping": {\r
                                        "profile_name": "profile_name"\r
index 7889a7e..c4fe4ea 100644 (file)
     "resource-assignment-request": {\r
       "resource-assignment-properties": {\r
         "request-id": "1234",\r
+        "service-instance-id": "siid_1234",\r
+        "vnf-id": "vnf_1234",\r
         "action-name": "assign-activate",\r
         "scope-type": "vnf-type",\r
-        "hostname": "localhost"\r
+        "hostname": "localhost",\r
+        "vnf_name": "temp_vnf"\r
       }\r
     }\r
   }\r
index bc6019d..42710b5 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>commons</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>core</artifactId>
index cf265fc..53c9b18 100644 (file)
   ~  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">
+<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.apps.blueprintsprocessor</groupId>
         <artifactId>commons</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>db-lib</artifactId>
index 0c027d4..4df8985 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>modules</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>commons</artifactId>
index 2300014..82e8cd7 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>commons</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>rest-lib</artifactId>
index 695c54e..1384b8a 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>modules</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>inbounds</artifactId>
index ece5172..6395963 100644 (file)
@@ -19,7 +19,7 @@
        <parent>
                <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
                <artifactId>inbounds</artifactId>
-               <version>0.4.0-SNAPSHOT</version>
+               <version>0.4.1-SNAPSHOT</version>
        </parent>
 
        <artifactId>resource-api</artifactId>
index 2c6da2e..db6fdd2 100644 (file)
   ~  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">
+<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.apps.blueprintsprocessor</groupId>
         <artifactId>inbounds</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>selfservice-api</artifactId>
index e7e4d7c..e957c88 100644 (file)
@@ -19,7 +19,7 @@
        <parent>
                <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
                <artifactId>modules</artifactId>
-               <version>0.4.0-SNAPSHOT</version>
+               <version>0.4.1-SNAPSHOT</version>
        </parent>
 
        <artifactId>outbounds</artifactId>
index 2103207..5cc31c4 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>parent</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
 
index 1b86faf..035f14d 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>services</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>execution-service</artifactId>
index ae434fb..8cb3c6f 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>modules</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>services</artifactId>
index f681ba5..6e3dade 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
         <artifactId>services</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
index 935ed64..401fef0 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps</groupId>
         <artifactId>blueprintsprocessor</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
     <artifactId>parent</artifactId>
     <properties>
         <spring.boot.version>2.1.1.RELEASE</spring.boot.version>
         <spring.version>5.1.3.RELEASE</spring.version>
-        <kotlin.version>1.3.10</kotlin.version>
-        <kotlin.maven.version>1.3.10</kotlin.maven.version>
-        <kotlin.couroutines.version>1.0.1</kotlin.couroutines.version>
-        <grpc.version>1.16.1</grpc.version>
+        <kotlin.version>1.3.11</kotlin.version>
+        <kotlin.maven.version>1.3.11</kotlin.maven.version>
+        <kotlin.couroutines.version>1.1.0</kotlin.couroutines.version>
+        <grpc.version>1.17.1</grpc.version>
         <protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
         <eelf.version>1.0.0</eelf.version>
-        <sli.version>0.4.0-SNAPSHOT</sli.version>
-        <guava.version>26.0-jre</guava.version>
+        <sli.version>0.4.1-SNAPSHOT</sli.version>
+        <guava.version>27.0.1-jre</guava.version>
         <jython.version>2.7.1</jython.version>
         <springfox.swagger2.version>2.9.2</springfox.swagger2.version>
         <h2database.version>1.4.197</h2database.version>
                 <version>${onap.logger.slf4j}</version>
             </dependency>
 
+            <!--Swagger Dependencies -->
+            <dependency>
+                <groupId>io.springfox</groupId>
+                <artifactId>springfox-swagger2</artifactId>
+                <version>${springfox.swagger2.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>io.springfox</groupId>
+                <artifactId>springfox-swagger-ui</artifactId>
+                <version>${springfox.swagger2.version}</version>
+            </dependency>
+
+            <!-- Common Utils Dependencies -->
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-lang3</artifactId>
+                <version>3.2.1</version>
+            </dependency>
+            <dependency>
+                <groupId>commons-collections</groupId>
+                <artifactId>commons-collections</artifactId>
+                <version>3.2.2</version>
+            </dependency>
+            <dependency>
+                <groupId>commons-io</groupId>
+                <artifactId>commons-io</artifactId>
+                <version>2.6</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-compress</artifactId>
+                <version>1.15</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.velocity</groupId>
+                <artifactId>velocity</artifactId>
+                <version>1.7</version>
+            </dependency>
+            <dependency>
+                <groupId>com.google.guava</groupId>
+                <artifactId>guava</artifactId>
+                <version>${guava.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.python</groupId>
+                <artifactId>jython-standalone</artifactId>
+                <version>${jython.version}</version>
+            </dependency>
+
             <!-- Kotlin Dependencies -->
             <dependency>
                 <groupId>org.jetbrains.kotlin</groupId>
                 <artifactId>kotlin-stdlib</artifactId>
                 <version>${kotlin.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-scripting-jvm-host</artifactId>
+                <version>${kotlin.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-compiler-embeddable</artifactId>
+                <version>${kotlin.version}</version>
+                <scope>runtime</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-script-util</artifactId>
+                <version>${kotlin.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-script-runtime</artifactId>
+                <version>${kotlin.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.jetbrains.kotlinx</groupId>
                 <artifactId>kotlinx-coroutines-core</artifactId>
                 <version>${project.version}</version>
             </dependency>
 
-            <!--Swagger Dependencies -->
-            <dependency>
-                <groupId>io.springfox</groupId>
-                <artifactId>springfox-swagger2</artifactId>
-                <version>${springfox.swagger2.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.springfox</groupId>
-                <artifactId>springfox-swagger-ui</artifactId>
-                <version>${springfox.swagger2.version}</version>
-            </dependency>
-
-            <!-- Common Libs -->
-            <dependency>
-                <groupId>org.apache.commons</groupId>
-                <artifactId>commons-lang3</artifactId>
-                <version>3.2.1</version>
-            </dependency>
-            <dependency>
-                <groupId>commons-collections</groupId>
-                <artifactId>commons-collections</artifactId>
-                <version>3.2.2</version>
-            </dependency>
-            <dependency>
-                <groupId>commons-io</groupId>
-                <artifactId>commons-io</artifactId>
-                <version>2.6</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.velocity</groupId>
-                <artifactId>velocity</artifactId>
-                <version>1.7</version>
-            </dependency>
-            <dependency>
-                <groupId>com.google.guava</groupId>
-                <artifactId>guava</artifactId>
-                <version>${guava.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.python</groupId>
-                <artifactId>jython-standalone</artifactId>
-                <version>${jython.version}</version>
-            </dependency>
-
             <!-- Database -->
             <dependency>
                 <groupId>com.h2database</groupId>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-compress</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.jayway.jsonpath</groupId>
             <artifactId>json-path</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
         <dependency>
             <groupId>io.springfox</groupId>
             <artifactId>springfox-swagger2</artifactId>
             <groupId>org.jetbrains.kotlin</groupId>
             <artifactId>kotlin-stdlib</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.jetbrains.kotlin</groupId>
+            <artifactId>kotlin-script-util</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.jetbrains.kotlin</groupId>
             <artifactId>kotlin-stdlib-jdk8</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.jetbrains.kotlinx</groupId>
+            <artifactId>kotlinx-coroutines-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jetbrains.kotlinx</groupId>
+            <artifactId>kotlinx-coroutines-reactor</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.module</groupId>
             <artifactId>jackson-module-kotlin</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.jetbrains.kotlin</groupId>
+            <artifactId>kotlin-scripting-jvm-host</artifactId>
+        </dependency>
         <!-- GRPC Dependencies -->
         <dependency>
             <groupId>io.grpc</groupId>
index 2020781..df4932c 100644 (file)
@@ -19,7 +19,7 @@
        <parent>
                <groupId>org.onap.ccsdk.apps</groupId>
                <artifactId>ccsdk-apps-ms</artifactId>
-               <version>0.4.0-SNAPSHOT</version>
+               <version>0.4.1-SNAPSHOT</version>
        </parent>
        <artifactId>blueprintsprocessor</artifactId>
        <packaging>pom</packaging>
index bd244e0..a01a613 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
         <artifactId>parent</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <artifactId>application</artifactId>
index afbc661..3057129 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
         <artifactId>parent</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <artifactId>distribution</artifactId>
index dd21908..eae2470 100644 (file)
@@ -1,37 +1,37 @@
-version: '3.3'\r
-\r
-services:\r
-   db:\r
-     image: mariadb:latest\r
-     container_name: cb-mariadb\r
-     ports:\r
-       - "3306:3306"\r
-     volumes:\r
-       - ~/vm_mysql:/var/lib/mysql\r
-     restart: always\r
-     environment:\r
-       MYSQL_ROOT_PASSWORD: sdnctl\r
-       MYSQL_DATABASE: sdnctl\r
-       MYSQL_USER: sdnctl\r
-       MYSQL_PASSWORD: sdnctl\r
-   controller-blueprints:\r
-     depends_on:\r
-       - db\r
-     image: onap/ccsdk-controllerblueprints:latest\r
-     container_name: cb-rest\r
-     ports:\r
-       - "8080:8080"\r
-     restart: always\r
-     volumes:\r
-       - ~/share/vm_ms/controllerblueprints/config:/opt/app/onap/config\r
-       - ~/share/vm_ms/controllerblueprints/logs:/logs\r
-     environment:\r
-       APPLICATIONNAME : ControllerBluePrints\r
-       BUNDLEVERSION: 1.0.0\r
-       APP_CONFIG_HOME: /opt/app/onap/config\r
-       DB_URL: jdbc:mysql://db:3306/sdnctl\r
-       DB_USER: sdnctl\r
-       DB_PASSWORD: sdnctl\r
-       INIT_DATA_LOAD: "true"\r
-       STICKYSELECTORKEY:\r
+version: '3.3'
+
+services:
+   db:
+     image: mariadb:latest
+     container_name: cb-mariadb
+     ports:
+       - "3306:3306"
+     volumes:
+       - ~/vm_mysql:/var/lib/mysql
+     restart: always
+     environment:
+       MYSQL_ROOT_PASSWORD: sdnctl
+       MYSQL_DATABASE: sdnctl
+       MYSQL_USER: sdnctl
+       MYSQL_PASSWORD: sdnctl
+   controller-blueprints:
+     depends_on:
+       - db
+     image: onap/ccsdk-controllerblueprints:latest
+     container_name: cb-rest
+     ports:
+       - "8080:8080"
+     restart: always
+     volumes:
+       - ~/share/vm_ms/controllerblueprints/config:/opt/app/onap/config
+       - ~/share/vm_ms/controllerblueprints/logs:/logs
+     environment:
+       APPLICATIONNAME : ControllerBluePrints
+       BUNDLEVERSION: 1.0.0
+       APP_CONFIG_HOME: /opt/app/onap/config
+       DB_URL: jdbc:mysql://db:3306/sdnctl
+       DB_USER: sdnctl
+       DB_PASSWORD: sdnctl
+       INIT_DATA_LOAD: "true"
+       STICKYSELECTORKEY:
        ENVCONTEXT: DEV
\ No newline at end of file
index 0cafc9a..d175eec 100644 (file)
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-
-<project
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-  xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<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.apps.controllerblueprints</groupId>
         <artifactId>modules</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <artifactId>blueprint-validation</artifactId>
     <name>Controller Blueprints Validation Service</name>
@@ -49,4 +45,3 @@
         </dependency>
     </dependencies>
 </project>
-
index 69e322e..c09d96c 100644 (file)
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-
-<project
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-  xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<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.apps.controllerblueprints</groupId>
         <artifactId>modules</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <artifactId>db-resources</artifactId>
     <name>Controller Blueprints DB Resources</name>
@@ -44,4 +40,3 @@
         </dependency>
     </dependencies>
 </project>
-
index 9a53eeb..3857ef5 100644 (file)
@@ -1,54 +1,49 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-  ~ Copyright Â© 2017-2018 AT&T Intellectual Property.\r
-  ~\r
-  ~ Licensed under the Apache License, Version 2.0 (the "License");\r
-  ~ you may not use this file except in compliance with the License.\r
-  ~ You may obtain a copy of the License at\r
-  ~\r
-  ~     http://www.apache.org/licenses/LICENSE-2.0\r
-  ~\r
-  ~ Unless required by applicable law or agreed to in writing, software\r
-  ~ distributed under the License is distributed on an "AS IS" BASIS,\r
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-  ~ See the License for the specific language governing permissions and\r
-  ~ limitations under the License.\r
-  -->\r
-\r
-<project\r
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"\r
-  xmlns="http://maven.apache.org/POM/4.0.0"\r
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
-    <modelVersion>4.0.0</modelVersion>\r
-    <parent>\r
-        <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>\r
-        <artifactId>parent</artifactId>\r
-        <version>0.4.0-SNAPSHOT</version>\r
-        <relativePath>../parent</relativePath>\r
-    </parent>\r
-    <artifactId>modules</artifactId>\r
-    <name>Controller Blueprints Modules</name>\r
-    <packaging>pom</packaging>\r
-\r
-    <modules>\r
-        <module>service</module>\r
-        <module>blueprint-validation</module>\r
-        <module>db-resources</module>\r
-    </modules>\r
-\r
-    <build>\r
-        <plugins>\r
-            <plugin>\r
-                <artifactId>maven-compiler-plugin</artifactId>\r
-                <version>3.1</version>\r
-                <configuration>\r
-                    <!-- <skip>${skip.compile}</skip>-->\r
-                    <source>1.8</source>\r
-                    <target>1.8</target>\r
-                </configuration>\r
-            </plugin>\r
-        </plugins>\r
-    </build>\r
-\r
-</project>\r
-\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<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.apps.controllerblueprints</groupId>
+        <artifactId>parent</artifactId>
+        <version>0.4.1-SNAPSHOT</version>
+        <relativePath>../parent</relativePath>
+    </parent>
+    <artifactId>modules</artifactId>
+    <name>Controller Blueprints Modules</name>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>service</module>
+        <module>blueprint-validation</module>
+        <module>db-resources</module>
+    </modules>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <!-- <skip>${skip.compile}</skip>-->
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
index 91a9eab..9868b17 100644 (file)
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-
-<project
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-  xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<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.apps.controllerblueprints</groupId>
         <artifactId>modules</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <artifactId>service</artifactId>
     <name>Controller Blueprints Service</name>
@@ -93,4 +89,3 @@
         </dependency>
     </dependencies>
 </project>
-
index 89af9e9..3a1535a 100644 (file)
@@ -59,7 +59,7 @@ public class SchemaGeneratorService {
      */\r
     public String generateSchema(String serviceTemplateContent) throws BluePrintException {\r
         if (StringUtils.isNotBlank(serviceTemplateContent)) {\r
-            ServiceTemplate serviceTemplate = JacksonUtils.readValue(serviceTemplateContent,\r
+            ServiceTemplate serviceTemplate = JacksonUtils.Companion.readValue(serviceTemplateContent,\r
                     ServiceTemplate.class);\r
             return generateSchema(serviceTemplate);\r
         } else {\r
index 23d3a97..074483a 100644 (file)
@@ -30,11 +30,11 @@ public class JpaJsonNodeConverter implements
 \r
     @Override\r
     public String convertToDatabaseColumn(JsonNode node) {\r
-        return JacksonUtils.getJson(node, true);\r
+        return JacksonUtils.Companion.getJson(node, true);\r
     }\r
 \r
     @Override\r
     public JsonNode convertToEntityAttribute(String dbData) {\r
-        return JacksonUtils.jsonNode(dbData);\r
+        return JacksonUtils.Companion.jsonNode(dbData);\r
     }\r
 }
\ No newline at end of file
index 18672f1..e28cdcd 100644 (file)
@@ -29,11 +29,11 @@ public class JpaResourceDefinitionConverter implements
         AttributeConverter<ResourceDefinition, String> {\r
     @Override\r
     public String convertToDatabaseColumn(ResourceDefinition resourceDefinition) {\r
-        return JacksonUtils.getJson(resourceDefinition);\r
+        return JacksonUtils.Companion.getJson(resourceDefinition);\r
     }\r
 \r
     @Override\r
     public ResourceDefinition convertToEntityAttribute(String content) {\r
-        return JacksonUtils.readValue(content, ResourceDefinition.class);\r
+        return JacksonUtils.Companion.readValue(content, ResourceDefinition.class);\r
     }\r
 }\r
index 6d02544..5d15e08 100644 (file)
@@ -58,7 +58,7 @@ public class ServiceTemplateValidator extends BluePrintValidatorDefaultService {
     public boolean validateServiceTemplate(String serviceTemplateContent) throws BluePrintException {\r
         if (StringUtils.isNotBlank(serviceTemplateContent)) {\r
             ServiceTemplate serviceTemplate =\r
-                    JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);\r
+                    JacksonUtils.Companion.readValue(serviceTemplateContent, ServiceTemplate.class);\r
             return validateServiceTemplate(serviceTemplate);\r
         } else {\r
             throw new BluePrintException(\r
@@ -131,11 +131,11 @@ public class ServiceTemplateValidator extends BluePrintValidatorDefaultService {
                 Object mappingObject =\r
                         capabilityAssignment.getProperties().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);\r
                 if (mappingObject != null) {\r
-                    String mappingContent = JacksonUtils.getJson(mappingObject);\r
+                    String mappingContent = JacksonUtils.Companion.getJson(mappingObject);\r
                     Preconditions.checkArgument(StringUtils.isNotBlank(mappingContent),\r
                             String.format("Failed to get capability mapping property (%s) ", ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING));\r
 \r
-                    resourceAssignment = JacksonUtils.getListFromJson(mappingContent, ResourceAssignment.class);\r
+                    resourceAssignment = JacksonUtils.Companion.getListFromJson(mappingContent, ResourceAssignment.class);\r
 \r
                     Preconditions.checkNotNull(resourceAssignment,\r
                             String.format("Failed to get resource assignment info from the content (%s) ", mappingContent));\r
index 412e960..42c6365 100644 (file)
@@ -56,12 +56,12 @@ public class ModelTypeServiceTest {
     public void test01SaveModelType() throws Exception {
         log.info("**************** test01SaveModelType  ********************");
 
-        String content = JacksonUtils.getClassPathFileContent("model_type/data_type/datatype-property.json");
+        String content = JacksonUtils.Companion.getClassPathFileContent("model_type/data_type/datatype-property.json");
         ModelType modelType = new ModelType();
         modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
         modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);
         modelType.setDescription("Definition for Sample Datatype ");
-        modelType.setDefinition(JacksonUtils.jsonNode(content));
+        modelType.setDefinition(JacksonUtils.Companion.jsonNode(content));
         modelType.setModelName(modelName);
         modelType.setVersion("1.0.0");
         modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
index 7549b78..739ce51 100644 (file)
@@ -54,12 +54,12 @@ public class ModelTypeReactRepositoryTest {
     @Test
     @Commit
     public void test01Save() {
-        String content = JacksonUtils.getClassPathFileContent("model_type/data_type/datatype-property.json");
+        String content = JacksonUtils.Companion.getClassPathFileContent("model_type/data_type/datatype-property.json");
         ModelType modelType = new ModelType();
         modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
         modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);
         modelType.setDescription("Definition for Sample Datatype ");
-        modelType.setDefinition(JacksonUtils.jsonNode(content));
+        modelType.setDefinition(JacksonUtils.Companion.jsonNode(content));
         modelType.setModelName(modelName);
         modelType.setVersion("1.0.0");
         modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
index 2a63683..330eaa8 100644 (file)
@@ -55,7 +55,7 @@ public class ResourceDictionaryReactRepositoryTest {
     @Test
     @Commit
     public void test01Save() {
-        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile("./../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json", ResourceDefinition.class);
+        ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile("./../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-primary-db-source.json", ResourceDefinition.class);
         Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition);
         resourceDefinition.setName(sourceName);
 
index bf5db34..64c87e0 100644 (file)
@@ -53,12 +53,12 @@ public class ModelTypeRestTest {
     public void test01SaveModelType() throws Exception {\r
         log.info("**************** test01SaveModelType  ********************");\r
 \r
-        String content = JacksonUtils.getClassPathFileContent("model_type/data_type/datatype-property.json");\r
+        String content = JacksonUtils.Companion.getClassPathFileContent("model_type/data_type/datatype-property.json");\r
         ModelType modelType = new ModelType();\r
         modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);\r
         modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);\r
         modelType.setDescription("Definition for Sample Datatype ");\r
-        modelType.setDefinition(JacksonUtils.jsonNode(content));\r
+        modelType.setDefinition(JacksonUtils.Companion.jsonNode(content));\r
         modelType.setModelName(modelName);\r
         modelType.setVersion("1.0.0");\r
         modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","\r
index 29bb2b9..24cb23a 100755 (executable)
@@ -20,7 +20,7 @@ logging.level.org.springframework.web=INFO
 logging.level.org.hibernate.SQL=warn
 logging.level.org.hibernate.type.descriptor.sql=debug
 # Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
 # Controller Blueprints Core Configuration
 controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
 controllerblueprints.blueprintArchivePath=./target/blueprints/archive
index 3715bec..1c81b74 100644 (file)
@@ -7,7 +7,7 @@
       "required": true\r
     },\r
     "dictionary-name": "sample-db-source",\r
-    "dictionary-source": "db",\r
+    "dictionary-source": "primary-db",\r
     "dependencies": [\r
       "input-source"\r
     ]\r
index b066dad..42978f8 100644 (file)
                   },\r
                   "input-param": false,\r
                   "dictionary-name": "sample-db-source",\r
-                  "dictionary-source": "db",\r
+                  "dictionary-source": "primary-db",\r
                   "dependencies": [\r
                     "hostname"\r
                   ],\r
index b13932b..66f18f8 100644 (file)
                 },
                 "input-param" : false,
                 "dictionary-name" : "sample-db-source",
-                "dictionary-source" : "db",
+                "dictionary-source" : "primary-db",
                 "dependencies" : [ "hostname" ],
                 "version" : 0
               }, {
index ec6f252..9042318 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.apps</groupId>
         <artifactId>controllerblueprints</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
     <artifactId>parent</artifactId>
     <properties>
         <spring.boot.version>2.1.1.RELEASE</spring.boot.version>
         <spring.version>5.1.3.RELEASE</spring.version>
-        <kotlin.version>1.3.10</kotlin.version>
-        <kotlin.maven.version>1.3.10</kotlin.maven.version>
-        <kotlin.couroutines.version>1.0.1</kotlin.couroutines.version>
-        <grpc.version>1.16.1</grpc.version>
+        <kotlin.version>1.3.11</kotlin.version>
+        <kotlin.maven.version>1.3.11</kotlin.maven.version>
+        <kotlin.couroutines.version>1.1.0</kotlin.couroutines.version>
+        <grpc.version>1.17.1</grpc.version>
         <protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
         <eelf.version>1.0.0</eelf.version>
-        <guava.version>26.0-jre</guava.version>
+        <guava.version>27.0.1-jre</guava.version>
         <springfox.swagger2.version>2.9.2</springfox.swagger2.version>
         <h2database.version>1.4.197</h2database.version>
         <onap.logger.slf4j>1.2.2</onap.logger.slf4j>
                 <artifactId>kotlin-stdlib</artifactId>
                 <version>${kotlin.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-scripting-jvm-host</artifactId>
+                <version>${kotlin.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-compiler-embeddable</artifactId>
+                <version>${kotlin.version}</version>
+                <scope>runtime</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-script-util</artifactId>
+                <version>${kotlin.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-script-runtime</artifactId>
+                <version>${kotlin.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.jetbrains.kotlin</groupId>
                 <artifactId>kotlinx-couroutines-core</artifactId>
index d88956f..6d6dae6 100644 (file)
     <parent>
         <groupId>org.onap.ccsdk.apps</groupId>
         <artifactId>ccsdk-apps-ms</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>controllerblueprints</artifactId>
     <name>Controller Blueprints Root</name>
-    <version>0.4.0-SNAPSHOT</version>
+    <version>0.4.1-SNAPSHOT</version>
     <properties>
         <service.name>ControllerBlueprints</service.name>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
index 3cdcdf6..ed68afb 100644 (file)
@@ -23,7 +23,7 @@
 
     <groupId>org.onap.ccsdk.apps</groupId>
     <artifactId>ccsdk-apps-ms-neng</artifactId>
-    <version>0.4.0-SNAPSHOT</version>
+    <version>0.4.1-SNAPSHOT</version>
     <name>Naming Generation</name>
 
     <properties>
 
     <parent>
         <groupId>org.onap.ccsdk.parent</groupId>
-        <artifactId>odlparent-lite</artifactId>
-        <version>1.2.0</version>
+        <artifactId>spring-boot-1-starter-parent</artifactId>
+        <version>1.2.1-SNAPSHOT</version>
         <relativePath/>
     </parent>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-starter-parent</artifactId>
-                <version>${springboot.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
+
 
     <dependencies>
         <dependency>
index 7aabdb8..0a9aa7e 100644 (file)
     <parent>
         <groupId>org.onap.ccsdk.apps</groupId>
         <artifactId>ccsdk-apps</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>ccsdk-apps-ms</artifactId>
-    <version>0.4.0-SNAPSHOT</version>
+    <version>0.4.1-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>Micro-services Root</name>
index 149eced..f5da9a6 100644 (file)
@@ -4,7 +4,7 @@
 
        <groupId>org.onap.ccsdk.apps.ms.vlantagapi</groupId>
        <artifactId>vlantag-api</artifactId>
-       <version>0.4.0-SNAPSHOT</version>
+       <version>0.4.1-SNAPSHOT</version>
        <packaging>jar</packaging>
 
        <name>Vlantag API</name>
@@ -39,7 +39,7 @@
        <parent>
                <groupId>org.onap.ccsdk.parent</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
-               <version>1.2.0</version>
+               <version>1.2.1-SNAPSHOT</version>
                <relativePath/>
        </parent>
 
index cf928ce..a0d18b4 100644 (file)
@@ -104,6 +104,12 @@ public class PolicyConfigTest {
         assertEquals("TemplateVersion", policyConfig.getTemplateVersion());
     }
     
+    @Test
+    public void testGetSetRiskType() {
+        policyConfig.setRiskType("RiskType");
+        assertEquals("RiskType", policyConfig.getRiskType());
+    }
+    
     @Test
     public void testToString()
     {
diff --git a/pom.xml b/pom.xml
index 3175b87..54fd6f2 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
@@ -5,13 +5,13 @@
        <parent>
                <groupId>org.onap.ccsdk.parent</groupId>
                <artifactId>odlparent-lite</artifactId>
-               <version>1.2.0</version>
+               <version>1.2.1-SNAPSHOT</version>
                <relativePath/>
        </parent>
 
        <groupId>org.onap.ccsdk.apps</groupId>
        <artifactId>ccsdk-apps</artifactId>
-       <version>0.4.0-SNAPSHOT</version>
+       <version>0.4.1-SNAPSHOT</version>
        <packaging>pom</packaging>
 
        <name>ccsdk-apps</name>
index ffee02f..b1967d0 100644 (file)
@@ -6,7 +6,7 @@
 
 release_name=0
 sprint_number=4
-feature_revision=0
+feature_revision=1
 
 base_version=${release_name}.${sprint_number}.${feature_revision}