aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt332
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt2
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt31
-rwxr-xr-xcomponents/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintCatalogService.kt41
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt86
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt78
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt93
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt271
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt2
-rwxr-xr-xcomponents/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt65
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt70
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt4
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt49
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt37
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt4
-rw-r--r--components/core/src/test/resources/dictionary/dictionary_schema.json4
-rw-r--r--components/model-catalog/api-definition/proto/BluePrintManagement.proto56
-rw-r--r--components/model-catalog/api-definition/proto/BluePrintProcessing.proto49
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json46
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json2
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json2
-rw-r--r--components/model-catalog/proto-definition/pom.xml83
-rw-r--r--components/model-catalog/proto-definition/proto/BluePrintCommon.proto31
-rw-r--r--components/model-catalog/proto-definition/proto/BluePrintManagement.proto25
-rw-r--r--components/model-catalog/proto-definition/proto/BluePrintProcessing.proto24
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/image_name.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/key_name.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/pub_key.json2
-rw-r--r--components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json2
-rw-r--r--components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json2
-rw-r--r--components/parent/pom.xml21
-rw-r--r--components/pom.xml4
-rw-r--r--components/resource-dict/load/resource_dictionary/mdsal-source.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vnf-name.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vnf_name.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json2
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt4
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceAssignmentUtils.kt156
-rw-r--r--components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java2
-rw-r--r--components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java6
-rw-r--r--components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt2
-rw-r--r--components/resource-dict/src/test/resources/validation/cyclic.json10
-rw-r--r--components/resource-dict/src/test/resources/validation/duplicate.json10
-rw-r--r--components/resource-dict/src/test/resources/validation/success.json10
56 files changed, 694 insertions, 1060 deletions
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
index 4c2d6e2f..4ef0e82b 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
@@ -1,172 +1,174 @@
-/*
- * 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"
+/*
+ * 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_PROCESSING: String = "processing"
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"
-
+
+ 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_DOUBLE: String = "double"
+ 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
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt
index 64797ed4..4c35b53a 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt
@@ -103,6 +103,7 @@ object BluePrintTypes {
validTypes.add(BluePrintConstants.DATA_TYPE_STRING)
validTypes.add(BluePrintConstants.DATA_TYPE_INTEGER)
validTypes.add(BluePrintConstants.DATA_TYPE_FLOAT)
+ validTypes.add(BluePrintConstants.DATA_TYPE_DOUBLE)
validTypes.add(BluePrintConstants.DATA_TYPE_BOOLEAN)
validTypes.add(BluePrintConstants.DATA_TYPE_TIMESTAMP)
validTypes.add(BluePrintConstants.DATA_TYPE_NULL)
@@ -117,6 +118,7 @@ object BluePrintTypes {
validTypes.add(BluePrintConstants.DATA_TYPE_STRING)
validTypes.add(BluePrintConstants.DATA_TYPE_INTEGER)
validTypes.add(BluePrintConstants.DATA_TYPE_FLOAT)
+ validTypes.add(BluePrintConstants.DATA_TYPE_DOUBLE)
validTypes.add(BluePrintConstants.DATA_TYPE_BOOLEAN)
validTypes.add(BluePrintConstants.DATA_TYPE_TIMESTAMP)
validTypes.add(BluePrintConstants.DATA_TYPE_NULL)
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt
index 4d1d9b65..11f709c9 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt
@@ -112,25 +112,40 @@ fun MutableMap<String, JsonNode>.getAsDouble(key: String): Double {
// Checks
fun checkNotEmpty(value: String?): Boolean {
- return value != null && value.isNotEmpty()
+ return value != null && value.isNotBlank()
}
-fun checkNotEmptyNThrow(value: String?, message: String? = value.plus(" is null/empty ")): Boolean {
- val notEmpty = value != null && value.isNotEmpty()
+fun checkNotEmptyOrThrow(value: String?, message: String? = value.plus(" is null/empty ")): Boolean {
+ val notEmpty = checkNotEmpty(value)
if (!notEmpty) {
throw BluePrintException(message!!)
}
return notEmpty
}
+fun checkEqualsOrThrow(value1: String?, value2: String?, lazyMessage: () -> Any): Boolean {
+ if (value1.equals(value2, ignoreCase = true)) {
+ return true
+ } else {
+ throw BluePrintException(lazyMessage().toString())
+ }
+}
+
+fun nullToEmpty(value: String?): String {
+ return if (checkNotEmpty(value)) value!! else ""
+}
+
+fun returnNotEmptyOrThrow(value: String?, lazyMessage: () -> Any): String {
+ if (checkNotEmpty(value)) {
+ return value!!
+ } else {
+ throw IllegalStateException(lazyMessage().toString())
+ }
+}
+
fun InputStream.toFile(path: String): File {
val file = File(path)
file.outputStream().use { this.copyTo(it) }
return file
}
-
-
-
-
-
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintCatalogService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
index 9186635e..c99cdf74 100755
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
@@ -16,25 +16,44 @@
package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
-interface BluePrintCatalogService {
+import org.jetbrains.annotations.NotNull
+import org.jetbrains.annotations.Nullable
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import java.io.File
+import java.nio.file.Path
- /**
- * Upload the CBA Zip fle to data base and return the Database identifier
- */
- fun uploadToDataBase(file: String, validate : Boolean): String
+interface BluePrintCatalogService {
/**
- * Download the CBA zip file from the data base and place it in a path and return the CBA zip absolute path
+ * Save the CBA to database.
+ * @param blueprintFile Either a directory, or an archive
+ * @param validate whether to validate blueprint content. Default true.
+ * @return The unique blueprint identifier
+ * @throws BluePrintException if process failed
*/
- fun downloadFromDataBase(name: String, version: String, path: String): String
+ @NotNull
+ @Throws(BluePrintException::class)
+ fun saveToDatabase(@NotNull blueprintFile: File, @Nullable validate: Boolean = true): String
/**
- * Get the Blueprint from Data Base and Download it under working directory and return the path path
+ * Retrieve the CBA from database either archived or extracted.
+ * @param name Name of the blueprint
+ * @param version Version of the blueprint
+ * @param extract true to extract the content, false for archived content. Default to true
+ * @return Path where CBA is located
+ * @throws BluePrintException if process failed
*/
- fun prepareBluePrint(name: String, version: String): String
+ @NotNull
+ @Throws(BluePrintException::class)
+ fun getFromDatabase(@NotNull name: String, @NotNull version: String, @Nullable extract: Boolean = true): Path
/**
- * Get blueprint archive with zip file from Data Base
+ * Delete the CBA from database.
+ * @param name Name of the blueprint
+ * @param version Version of the blueprint
+ * @throws BluePrintException if process failed
*/
- fun downloadFromDataBase(uuid: String, path: String): String
+ @NotNull
+ @Throws(BluePrintException::class)
+ fun deleteFromDatabase(@NotNull name: String, @NotNull version: String)
} \ No newline at end of file
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
deleted file mode 100644
index f7bfb857..00000000
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 8ae09151..00000000
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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
deleted file mode 100644
index bda20a44..00000000
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index bd19ae47..60318659 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -62,20 +62,20 @@ interface BluePrintRuntimeService<T> {
fun setBluePrintError(bluePrintError: BluePrintError)
- /*
- Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
- */
- fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode>
+ fun resolveNodeTemplatePropertyAssignments(nodeTemplateName: String,
+ propertyDefinitions: MutableMap<String, PropertyDefinition>,
+ propertyAssignments: MutableMap<String, JsonNode>): MutableMap<String, JsonNode>
- fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capability: String): MutableMap<String,
- JsonNode>
+ fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode>
- fun resolveNodeTemplateRequirementProperties(nodeTemplateName: String, requirementName: String): MutableMap<String,
+ fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String): MutableMap<String,
JsonNode>
- fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>
+ fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String,
+ operationName: String): MutableMap<String, JsonNode>
- fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>
+ fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String, interfaceName: String,
+ operationName: String): MutableMap<String, JsonNode>
fun resolveNodeTemplateArtifact(nodeTemplateName: String, artifactName: String): String
@@ -89,24 +89,24 @@ interface BluePrintRuntimeService<T> {
fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode)
- fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String, value: JsonNode)
+ fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String, value: JsonNode)
- fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String, value: JsonNode)
+ fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String, value: JsonNode)
- fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String, value: JsonNode)
+ fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String, value: JsonNode)
fun getInputValue(propertyName: String): JsonNode
- fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String): JsonNode
+ fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String): JsonNode
fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode?
fun getNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String): JsonNode?
- fun getNodeTemplateRequirementPropertyValue(nodeTemplateName: String, requirementName: String, propertyName: String): JsonNode?
-
- fun getNodeTemplateCapabilityPropertyValue(nodeTemplateName: String, capabilityName: String, propertyName: String): JsonNode?
-
fun assignInputs(jsonNode: JsonNode)
fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode)
@@ -190,22 +190,17 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
this.bluePrintError = bluePrintError
}
- /*
- Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
- */
- override fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName)
- val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
+ /**
+ * Resolve any property assignments for the node
+ */
+ override fun resolveNodeTemplatePropertyAssignments(nodeTemplateName: String,
+ propertyDefinitions: MutableMap<String, PropertyDefinition>,
+ propertyAssignments: MutableMap<String, JsonNode>)
+ : MutableMap<String, JsonNode> {
- val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
-
- val propertyAssignments: MutableMap<String, JsonNode> = nodeTemplate.properties!!
-
- // Get the Node Type Definitions
- val nodeTypeProperties: MutableMap<String, PropertyDefinition> = bluePrintContext.nodeTypeChainedProperties(nodeTemplate.type)!!
+ val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
- // Iterate Node Type Properties
- nodeTypeProperties.forEach { nodeTypePropertyName, nodeTypeProperty ->
+ propertyDefinitions.forEach { nodeTypePropertyName, nodeTypeProperty ->
// Get the Express or Value for the Node Template
val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
@@ -213,38 +208,61 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
if (propertyAssignment != null) {
// Resolve the Expressing
val propertyAssignmentExpression = PropertyAssignmentService(this)
- resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName, nodeTypePropertyName, propertyAssignment)
+ resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName,
+ nodeTypePropertyName, propertyAssignment)
} else {
// Assign default value to the Operation
- nodeTypeProperty.defaultValue?.let { defaultValue ->
- resolvedValue = defaultValue
+ nodeTypeProperty.defaultValue?.let {
+ resolvedValue = JacksonUtils.jsonNodeFromObject(nodeTypeProperty.defaultValue!!)
}
}
// Set for Return of method
propertyAssignmentValue[nodeTypePropertyName] = resolvedValue
}
- log.info("resolved property definition for node template ({}), values ({})", nodeTemplateName, propertyAssignmentValue)
return propertyAssignmentValue
}
+ override fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode> {
+ log.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName)
+
+ val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
+
+ val propertyAssignments: MutableMap<String, JsonNode> = nodeTemplate.properties!!
+
+ // Get the Node Type Definitions
+ val nodeTypePropertieDefinitions: MutableMap<String, PropertyDefinition> = bluePrintContext
+ .nodeTypeChainedProperties(nodeTemplate.type)!!
+
+ /**
+ * Resolve the NodeTemplate Property Assignment Values.
+ */
+ return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypePropertieDefinitions,
+ propertyAssignments)
+ }
+
override fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String):
MutableMap<String, JsonNode> {
log.info("resolveNodeTemplateCapabilityProperties for node template($nodeTemplateName) capability " +
"($capabilityName)")
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
+ val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
+
+ val propertyAssignments = nodeTemplate.capabilities?.get(capabilityName)?.properties ?: hashMapOf()
- override fun resolveNodeTemplateRequirementProperties(nodeTemplateName: String, requirementName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateRequirementProperties for node template($nodeTemplateName) requirement ($requirementName)")
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ val propertyDefinitions = bluePrintContext.nodeTemplateNodeType(nodeTemplateName)
+ .capabilities?.get(capabilityName)?.properties ?: hashMapOf()
+
+ /**
+ * Resolve the Capability Property Assignment Values.
+ */
+ return resolveNodeTemplatePropertyAssignments(nodeTemplateName, propertyDefinitions,
+ propertyAssignments)
}
override fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,
- interfaceName: String, operationName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateInterfaceOperationInputs for node template ({}),interface name ({}), " +
- "operationName({})", nodeTemplateName, interfaceName, operationName)
-
- val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
+ interfaceName: String,
+ operationName: String): MutableMap<String, JsonNode> {
+ log.info("resolveNodeTemplateInterfaceOperationInputs for node template ($nodeTemplateName),interface name " +
+ "($interfaceName), operationName($operationName)")
val propertyAssignments: MutableMap<String, JsonNode> =
bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
@@ -256,40 +274,22 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
bluePrintContext.nodeTypeInterfaceOperationInputs(nodeTypeName, interfaceName, operationName)
?: hashMapOf()
- log.info("input definition for node template ({}), values ({})", nodeTemplateName, propertyAssignments)
+ log.info("input definition for node template ($nodeTemplateName), values ($propertyAssignments)")
- // Iterate Node Type Properties
- nodeTypeInterfaceOperationInputs.forEach { nodeTypePropertyName, nodeTypeProperty ->
- // Get the Express or Value for the Node Template
- val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
+ /**
+ * Resolve the Property Input Assignment Values.
+ */
+ return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypeInterfaceOperationInputs,
+ propertyAssignments)
- var resolvedValue: JsonNode = NullNode.getInstance()
- if (propertyAssignment != null) {
- // Resolve the Expressing
- val propertyAssignmentExpression = PropertyAssignmentService(this)
- resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName, nodeTypePropertyName, propertyAssignment)
- } else {
- // Assign default value to the Operation
- nodeTypeProperty.defaultValue?.let {
- resolvedValue = JacksonUtils.jsonNodeFromObject(nodeTypeProperty.defaultValue!!)
- }
- }
- // Set for Return of method
- propertyAssignmentValue[nodeTypePropertyName] = resolvedValue
- }
- log.trace("resolved input assignments for node template ({}), values ({})", nodeTemplateName,
- propertyAssignmentValue)
-
- return propertyAssignmentValue
}
override fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String,
- interfaceName: String, operationName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateInterfaceOperationOutputs for node template ({}),interface name ({}), " +
- "operationName({})", nodeTemplateName, interfaceName, operationName)
-
- val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
+ interfaceName: String,
+ operationName: String): MutableMap<String, JsonNode> {
+ log.info("resolveNodeTemplateInterfaceOperationOutputs for node template ($nodeTemplateName),interface name " +
+ "($interfaceName), operationName($operationName)")
val propertyAssignments: MutableMap<String, JsonNode> =
bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
@@ -300,30 +300,15 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val nodeTypeInterfaceOperationOutputs: MutableMap<String, PropertyDefinition> =
bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName)
?: hashMapOf()
-
- // Iterate Node Type Properties
- nodeTypeInterfaceOperationOutputs.forEach { nodeTypePropertyName, nodeTypeProperty ->
-
- // Get the Express or Value for the Node Template
- val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
-
- var resolvedValue: JsonNode = NullNode.getInstance()
- if (propertyAssignment != null) {
- // Resolve the Expressing
- val propertyAssignmentExpression = PropertyAssignmentService(this)
- resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName, nodeTypePropertyName, propertyAssignment)
- } else {
- // Assign default value to the Operation
- nodeTypeProperty.defaultValue?.let {
- resolvedValue = JacksonUtils.jsonNodeFromObject(nodeTypeProperty.defaultValue!!)
- }
- }
- // Set for Return of method
- propertyAssignmentValue[nodeTypePropertyName] = resolvedValue
-
- // Store operation output values into context
- setNodeTemplateOperationOutputValue(nodeTemplateName, interfaceName, operationName, nodeTypePropertyName, resolvedValue)
- log.trace("resolved output assignments for node template ({}), property name ({}), value ({})", nodeTemplateName, nodeTypePropertyName, resolvedValue)
+ /**
+ * Resolve the Property Output Assignment Values.
+ */
+ val propertyAssignmentValue = resolveNodeTemplatePropertyAssignments(nodeTemplateName,
+ nodeTypeInterfaceOperationOutputs, propertyAssignments)
+
+ // Store operation output values into context
+ propertyAssignmentValue.forEach { key, value ->
+ setNodeTemplateOperationOutputValue(nodeTemplateName, interfaceName, operationName, key, value)
}
return propertyAssignmentValue
}
@@ -338,12 +323,11 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
return nodeTemplate.artifacts?.get(artifactName)
- ?: throw BluePrintProcessorException(String.format("failed to get artifat definition {} from the node template"
- , artifactName))
+ ?: throw BluePrintProcessorException("failed to get artifat definition($artifactName) from the node " +
+ "template")
}
-
override fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode) {
val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
@@ -351,8 +335,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
put(path, value)
}
- override fun setWorkflowInputValue(workflowName: String, propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS).append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
+ override fun setWorkflowInputValue(workflowName: String, propertyName: String,
+ propertyDefinition: PropertyDefinition, value: JsonNode) {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
@@ -361,7 +347,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
@@ -369,7 +356,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
.append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
put(path, value)
@@ -377,31 +365,42 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
log.trace("setting operation property path ({}), values ({})", path, value)
put(path, value)
}
- override fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ override fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String,
value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
}
- override fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ override fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String,
value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
@@ -415,47 +414,36 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return getJsonNode(path)
}
- override fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS).append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ override fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String): JsonNode {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return getJsonNode(path)
}
override fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return getJsonNode(path)
}
override fun getNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
.append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
return getJsonNode(path)
}
- override fun getNodeTemplateRequirementPropertyValue(nodeTemplateName: String, requirementName: String, propertyName:
- String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_REQUIREMENTS).append(requirementName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- return getJsonNode(path)
- }
-
- override fun getNodeTemplateCapabilityPropertyValue(nodeTemplateName: String, capabilityName: String, propertyName:
- String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_CAPABILITIES).append(capabilityName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- return getJsonNode(path)
- }
-
override fun assignInputs(jsonNode: JsonNode) {
log.info("assignInputs from input JSON ({})", jsonNode.toString())
bluePrintContext.inputs?.forEach { propertyName, property ->
@@ -493,7 +481,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun getJsonForNodeTemplateAttributeProperties(nodeTemplateName: String, keys: List<String>): JsonNode {
val jsonNode: ObjectNode = jacksonObjectMapper().createObjectNode()
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
.append(BluePrintConstants.PATH_DIVIDER).toString()
store.keys.filter {
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
index 17837370..b33cc3f0 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
@@ -523,7 +523,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
@Throws(BluePrintException::class)
open fun validateImplementation(implementation: Implementation) {
- checkNotEmptyNThrow(implementation.primary)
+ checkNotEmptyOrThrow(implementation.primary)
}
@Throws(BluePrintException::class)
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
index ab5175de..fe7929e8 100755
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
@@ -24,13 +24,18 @@ import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
import org.apache.commons.io.IOUtils
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import java.io.*
+import org.slf4j.LoggerFactory
+import java.io.BufferedInputStream
+import java.io.File
+import java.io.FileInputStream
+import java.io.IOException
import java.nio.charset.Charset
import java.util.zip.ZipFile
class BluePrintArchiveUtils {
companion object {
+ private val log = LoggerFactory.getLogger(BluePrintArchiveUtils::class.java)
fun getFileContent(fileName: String): String = runBlocking {
async {
@@ -51,50 +56,20 @@ class BluePrintArchiveUtils {
/**
* Create a new Zip from a root directory
*
- * @param directory the base directory
- * @param filename the output filename
+ * @param source the base directory
+ * @param destination the output filename
* @param absolute store absolute filepath (from directory) or only filename
* @return True if OK
*/
fun compress(source: File, destination: File, absolute: Boolean): Boolean {
- // recursive call
- val zaos: ZipArchiveOutputStream
try {
- zaos = ZipArchiveOutputStream(FileOutputStream(destination))
- } catch (e: FileNotFoundException) {
- return false
- }
-
- try {
- recurseFiles(source, source, zaos, absolute)
- } catch (e2: IOException) {
- try {
- zaos.close()
- } catch (e: IOException) {
- // ignore
+ ZipArchiveOutputStream(destination).use {
+ recurseFiles(source, source, it, absolute)
}
-
+ } catch (e: Exception) {
+ log.error("Fail to compress folder(:$source) to path(${destination.path}", e)
return false
}
-
- try {
- zaos.finish()
- } catch (e1: IOException) {
- // ignore
- }
-
- try {
- zaos.flush()
- } catch (e: IOException) {
- // ignore
- }
-
- try {
- zaos.close()
- } catch (e: IOException) {
- // ignore
- }
-
return true
}
@@ -113,21 +88,19 @@ class BluePrintArchiveUtils {
if (file.isDirectory) {
// recursive call
val files = file.listFiles()
- for (file2 in files!!) {
- recurseFiles(root, file2, zaos, absolute)
+ for (fileChild in files!!) {
+ recurseFiles(root, fileChild, zaos, absolute)
}
} else if (!file.name.endsWith(".zip") && !file.name.endsWith(".ZIP")) {
- var filename: String? = null
- if (absolute) {
- filename = file.absolutePath.substring(root.absolutePath.length)
+ val filename = if (absolute) {
+ file.absolutePath.substring(root.absolutePath.length)
} else {
- filename = file.name
+ file.name
}
val zae = ZipArchiveEntry(filename)
- zae.setSize(file.length())
+ zae.size = file.length()
zaos.putArchiveEntry(zae)
- val fis = FileInputStream(file)
- IOUtils.copy(fis, zaos)
+ FileInputStream(file).use { IOUtils.copy(it, zaos) }
zaos.closeArchiveEntry()
}
}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
index 6321a838..2e5a040c 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
@@ -33,9 +33,11 @@ import kotlinx.coroutines.withContext
import org.apache.commons.io.IOUtils
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
import java.io.File
import java.nio.charset.Charset
+import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType
/**
*
@@ -174,8 +176,13 @@ class JacksonUtils {
return getMapFromJson(content, valueType)
}
+ fun <T> getInstanceFromMap(properties: MutableMap<String, JsonNode>, classType: Class<T>): T {
+ return readValue(getJson(properties), classType)
+ ?: throw BluePrintProcessorException("failed to transform content ($properties) to type ($classType)")
+ }
+
fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean {
- if (BluePrintTypes.validPrimitiveTypes().contains(type)) {
+ if (BluePrintTypes.validPrimitiveTypes().contains(type.toLowerCase())) {
return checkJsonNodeValueOfPrimitiveType(type, jsonNode)
} else if (BluePrintTypes.validCollectionTypes().contains(type)) {
return checkJsonNodeValueOfCollectionType(type, jsonNode)
@@ -183,59 +190,76 @@ class JacksonUtils {
return false
}
+ fun checkIfPrimitiveType(primitiveType: String): Boolean {
+ return when (primitiveType.toLowerCase()) {
+ BluePrintConstants.DATA_TYPE_STRING -> true
+ BluePrintConstants.DATA_TYPE_BOOLEAN -> true
+ BluePrintConstants.DATA_TYPE_INTEGER -> true
+ BluePrintConstants.DATA_TYPE_FLOAT -> true
+ BluePrintConstants.DATA_TYPE_DOUBLE -> true
+ BluePrintConstants.DATA_TYPE_TIMESTAMP -> true
+ else -> false
+ }
+ }
+
fun checkJsonNodeValueOfPrimitiveType(primitiveType: String, jsonNode: JsonNode): Boolean {
- when (primitiveType) {
- BluePrintConstants.DATA_TYPE_STRING -> return jsonNode.isTextual
- BluePrintConstants.DATA_TYPE_BOOLEAN -> return jsonNode.isBoolean
- BluePrintConstants.DATA_TYPE_INTEGER -> return jsonNode.isInt
- BluePrintConstants.DATA_TYPE_FLOAT -> return jsonNode.isDouble
- BluePrintConstants.DATA_TYPE_TIMESTAMP -> return jsonNode.isTextual
- else -> return false
+ return when (primitiveType.toLowerCase()) {
+ BluePrintConstants.DATA_TYPE_STRING -> jsonNode.isTextual
+ BluePrintConstants.DATA_TYPE_BOOLEAN -> jsonNode.isBoolean
+ BluePrintConstants.DATA_TYPE_INTEGER -> jsonNode.isInt
+ BluePrintConstants.DATA_TYPE_FLOAT -> jsonNode.isDouble
+ BluePrintConstants.DATA_TYPE_DOUBLE -> jsonNode.isDouble
+ BluePrintConstants.DATA_TYPE_TIMESTAMP -> jsonNode.isTextual
+ else -> false
}
}
fun checkJsonNodeValueOfCollectionType(type: String, jsonNode: JsonNode): Boolean {
- when (type) {
- BluePrintConstants.DATA_TYPE_LIST -> return jsonNode.isArray
- BluePrintConstants.DATA_TYPE_MAP -> return jsonNode.isContainerNode
- else -> return false
+ return when (type.toLowerCase()) {
+ BluePrintConstants.DATA_TYPE_LIST -> jsonNode.isArray
+ BluePrintConstants.DATA_TYPE_MAP -> jsonNode.isContainerNode
+ else -> false
}
}
fun populatePrimitiveValues(key: String, value: Any, primitiveType: String, objectNode: ObjectNode) {
- when (primitiveType) {
+ when (primitiveType.toLowerCase()) {
BluePrintConstants.DATA_TYPE_BOOLEAN -> objectNode.put(key, value as Boolean)
BluePrintConstants.DATA_TYPE_INTEGER -> objectNode.put(key, value as Int)
BluePrintConstants.DATA_TYPE_FLOAT -> objectNode.put(key, value as Float)
+ BluePrintConstants.DATA_TYPE_DOUBLE -> objectNode.put(key, value as Double)
BluePrintConstants.DATA_TYPE_TIMESTAMP -> objectNode.put(key, value as String)
else -> objectNode.put(key, value as String)
}
}
fun populatePrimitiveValues(value: Any, primitiveType: String, arrayNode: ArrayNode) {
- when (primitiveType) {
+ when (primitiveType.toLowerCase()) {
BluePrintConstants.DATA_TYPE_BOOLEAN -> arrayNode.add(value as Boolean)
BluePrintConstants.DATA_TYPE_INTEGER -> arrayNode.add(value as Int)
BluePrintConstants.DATA_TYPE_FLOAT -> arrayNode.add(value as Float)
+ BluePrintConstants.DATA_TYPE_DOUBLE -> arrayNode.add(value as Double)
BluePrintConstants.DATA_TYPE_TIMESTAMP -> arrayNode.add(value as String)
else -> arrayNode.add(value as String)
}
}
fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) {
- when (primitiveType) {
+ when (primitiveType.toLowerCase()) {
BluePrintConstants.DATA_TYPE_BOOLEAN -> objectNode.put(key, false)
BluePrintConstants.DATA_TYPE_INTEGER -> objectNode.put(key, 0)
BluePrintConstants.DATA_TYPE_FLOAT -> objectNode.put(key, 0.0)
+ BluePrintConstants.DATA_TYPE_DOUBLE -> objectNode.put(key, 0.0)
else -> objectNode.put(key, "")
}
}
fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) {
- when (primitiveType) {
+ when (primitiveType.toLowerCase()) {
BluePrintConstants.DATA_TYPE_BOOLEAN -> arrayNode.add(false)
BluePrintConstants.DATA_TYPE_INTEGER -> arrayNode.add(0)
BluePrintConstants.DATA_TYPE_FLOAT -> arrayNode.add(0.0)
+ BluePrintConstants.DATA_TYPE_DOUBLE -> arrayNode.add(0.0)
else -> arrayNode.add("")
}
}
@@ -250,13 +274,15 @@ class JacksonUtils {
}
}
- fun convertPrimitiveResourceValue(type: String, value: String): JsonNode? {
- when (type) {
- BluePrintConstants.DATA_TYPE_BOOLEAN -> return JacksonUtils.getJsonNode(value as Boolean)
- BluePrintConstants.DATA_TYPE_INTEGER -> return JacksonUtils.getJsonNode(value as Int)
- BluePrintConstants.DATA_TYPE_FLOAT -> return JacksonUtils.getJsonNode(value as Float)
- else -> return JacksonUtils.getJsonNode(value)
+ fun convertPrimitiveResourceValue(type: String, value: String): JsonNode {
+ return when (type.toLowerCase()) {
+ BluePrintConstants.DATA_TYPE_BOOLEAN -> jsonNodeFromObject(java.lang.Boolean.valueOf(value))
+ BluePrintConstants.DATA_TYPE_INTEGER -> jsonNodeFromObject(Integer.valueOf(value))
+ BluePrintConstants.DATA_TYPE_FLOAT -> jsonNodeFromObject(java.lang.Float.valueOf(value))
+ BluePrintConstants.DATA_TYPE_DOUBLE -> jsonNodeFromObject(java.lang.Double.valueOf(value))
+ else -> getJsonNode(value)
}
}
+
}
} \ No newline at end of file
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt
index 2e4a733a..1077f347 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt
@@ -20,7 +20,7 @@ import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyNThrow
+import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyOrThrow
import org.onap.ccsdk.apps.controllerblueprints.core.data.*
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
@@ -149,7 +149,7 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
}
open fun validateImplementation(implementation: Implementation) {
- checkNotEmptyNThrow(implementation.primary)
+ checkNotEmptyOrThrow(implementation.primary)
}
} \ 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
deleted file mode 100644
index 5c5ad3ba..00000000
--- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
index c01b14b3..02148f08 100644
--- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
+++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
@@ -39,7 +39,7 @@ class BluePrintRuntimeServiceTest {
private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
@Test
- fun testResolveNodeTemplateProperties() {
+ fun `test Resolve NodeTemplate Properties`() {
log.info("************************ testResolveNodeTemplateProperties **********************")
val bluePrintRuntimeService = getBluePrintRuntimeService()
@@ -49,25 +49,31 @@ class BluePrintRuntimeServiceTest {
val inputNode: JsonNode = JacksonUtils.jsonNodeFromFile(inputDataPath)
bluePrintRuntimeService.assignInputs(inputNode)
- val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process")
+ val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService
+ .resolveNodeTemplateProperties("activate-process")
assertNotNull(propContext, "Failed to populate interface property values")
}
@Test
- fun testResolveNodeTemplateCapabilityProperties() {
+ fun `test resolve NodeTemplate Capability Properties`() {
log.info("************************ testResolveNodeTemplateRequirementProperties **********************")
- //TODO
- }
+ val bluePrintRuntimeService = getBluePrintRuntimeService()
- @Test
- fun testResolveNodeTemplateRequirementProperties() {
- log.info("************************ testResolveNodeTemplateRequirementProperties **********************")
- //TODO
+ val executionContext = bluePrintRuntimeService.getExecutionContext()
+
+ BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(),
+ "data/default-context.json", executionContext)
+
+ val capProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device",
+ "netconf")
+ assertNotNull(capProperties, "Failed to populate capability property values")
+ assertEquals(capProperties["target-ip-address"], JacksonUtils.jsonNodeFromObject("localhost"), "Failed to populate parameter target-ip-address")
+ assertEquals(capProperties["port-number"], JacksonUtils.jsonNodeFromObject(830), "Failed to populate parameter port-number")
}
@Test
- fun testResolveNodeTemplateInterfaceOperationInputs() {
+ fun `test Resolve NodeTemplate Interface Operation Inputs`() {
log.info("************************ testResolveNodeTemplateInterfaceOperationInputs **********************")
val bluePrintRuntimeService = getBluePrintRuntimeService()
@@ -77,16 +83,17 @@ class BluePrintRuntimeServiceTest {
BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(),
"data/default-context.json", executionContext)
- val inContext: MutableMap<String, JsonNode> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment",
- "ResourceAssignmentComponent", "process")
+ val inContext: MutableMap<String, JsonNode> = bluePrintRuntimeService
+ .resolveNodeTemplateInterfaceOperationInputs("resource-assignment",
+ "ResourceAssignmentComponent", "process")
assertNotNull(inContext, "Failed to populate interface input property values")
assertEquals(inContext["action-name"], JacksonUtils.jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
assertEquals(inContext["request-id"], JacksonUtils.jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
- }
+ }
@Test
- fun testResolveNodeTemplateInterfaceOperationOutputs() {
+ fun `test Resolve NodeTemplate Interface Operation Outputs`() {
log.info("************************ testResolveNodeTemplateInterfaceOperationOutputs **********************")
val bluePrintRuntimeService = getBluePrintRuntimeService()
@@ -107,7 +114,7 @@ class BluePrintRuntimeServiceTest {
}
@Test
- fun testNodeTemplateContextProperty() {
+ fun `test NodeTemplate Context Property`() {
log.info("************************ testNodeTemplateContextProperty **********************")
val bluePrintRuntimeService = getBluePrintRuntimeService()
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
index 143c4a84..59a03719 100644
--- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
+++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
@@ -27,7 +27,7 @@ class BluePrintFileUtilsTest {
@Test
fun testNewBlueprint() = runBlocking {
- val targetPath: String = Paths.get("target").toUri().toURL().path.plus("bp-new-test")
+ val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-new-test")
BluePrintFileUtils.createEmptyBluePrint(targetPath)
}
@@ -36,7 +36,7 @@ class BluePrintFileUtilsTest {
fun testBlueprintCopy() = runBlocking {
val sourcePath: String = "./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration"
- val targetPath: String = Paths.get("target").toUri().toURL().path.plus("bp-copy-test")
+ val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-copy-test")
val targetDir = File(targetPath)
targetDir.deleteOnExit()
diff --git a/components/core/src/test/resources/dictionary/dictionary_schema.json b/components/core/src/test/resources/dictionary/dictionary_schema.json
index f9ef9eee..51db5f51 100644
--- a/components/core/src/test/resources/dictionary/dictionary_schema.json
+++ b/components/core/src/test/resources/dictionary/dictionary_schema.json
@@ -54,7 +54,7 @@
"aai": {
"type": "any"
},
- "mdsal": {
+ "primary-config-data": {
"type": "object",
"properties": {
"path": {
@@ -188,7 +188,7 @@
}
}
},
- "mdsal": {
+ "primary-config-data": {
"type": "object",
"properties": {
"names": {
diff --git a/components/model-catalog/api-definition/proto/BluePrintManagement.proto b/components/model-catalog/api-definition/proto/BluePrintManagement.proto
deleted file mode 100644
index 55f9466e..00000000
--- a/components/model-catalog/api-definition/proto/BluePrintManagement.proto
+++ /dev/null
@@ -1,56 +0,0 @@
-syntax = "proto3";
-option java_multiple_files = true;
-package org.onap.ccsdk.apps.controllerblueprints.management.api;
-
-message BluePrintUploadInput {
- CommonHeader commonHeader = 1;
- string blueprintName = 2;
- string blueprintVersion = 3;
- FileChunk fileChunk = 4;
-}
-
-message FileChunk {
- bytes chunk = 1;
-}
-
-message BluePrintUploadOutput {
- CommonHeader commonHeader = 1;
- Status status = 3;
-}
-
-message BluePrintRemoveInput {
- CommonHeader commonHeader = 1;
- string blueprintName = 2;
- string blueprintVersion = 3;
-}
-
-message BluePrintRemoveOutput {
- CommonHeader commonHeader = 1;
- Status status = 3;
-}
-
-message CommonHeader {
- string timestamp = 1;
- string originatorId = 23;
- string requestId = 3;
- string subRequestId = 4;
-}
-
-message ActionIdentifiers {
- string blueprintName = 1;
- string blueprintVersion = 2;
- string actionName = 3;
- string mode = 4;
-}
-
-message Status {
- string timestamp = 1;
- int32 code = 2;
- string message = 3;
- string errorMessage = 4;
-}
-
-service BluePrintManagementService {
- rpc uploadBlueprint (BluePrintUploadInput) returns (BluePrintUploadOutput);
- rpc removeBlueprint (BluePrintRemoveInput) returns (BluePrintRemoveOutput);
-}
diff --git a/components/model-catalog/api-definition/proto/BluePrintProcessing.proto b/components/model-catalog/api-definition/proto/BluePrintProcessing.proto
deleted file mode 100644
index 8fa4a13f..00000000
--- a/components/model-catalog/api-definition/proto/BluePrintProcessing.proto
+++ /dev/null
@@ -1,49 +0,0 @@
-syntax = "proto3";
-import "google/protobuf/struct.proto";
-option java_multiple_files = true;
-package org.onap.ccsdk.apps.controllerblueprints.processing.api;
-
-message ExecutionServiceInput {
- CommonHeader commonHeader = 1;
- ActionIdentifiers actionIdentifiers = 2;
- google.protobuf.Struct payload = 3;
-}
-
-message ExecutionServiceOutput {
- CommonHeader commonHeader = 1;
- ActionIdentifiers actionIdentifiers = 2;
- Status status = 3;
- google.protobuf.Struct payload = 4;
-}
-
-message CommonHeader {
- string timestamp = 1;
- string originatorId = 23;
- string requestId = 3;
- string subRequestId = 4;
- Flag flag = 5;
-}
-
-message Flag {
- bool isForce = 1;
- int32 ttl = 2;
-}
-
-message ActionIdentifiers {
- string blueprintName = 1;
- string blueprintVersion = 2;
- string actionName = 3;
- string mode = 4;
-}
-
-message Status {
- int32 code = 1;
- string errorMessage = 2;
- string message = 3;
- string eventType = 4;
- string timestamp = 5;
-}
-
-service BluePrintProcessingService {
- rpc process (ExecutionServiceInput) returns (stream ExecutionServiceOutput);
-}
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
index 13847bbb..4484d550 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
+++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
@@ -667,7 +667,7 @@
},
"input-param": false,
"dictionary-name": "vnf-name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -982,7 +982,7 @@
},
"input-param": false,
"dictionary-name": "image_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1007,7 +1007,7 @@
},
"input-param": false,
"dictionary-name": "key_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1032,7 +1032,7 @@
},
"input-param": false,
"dictionary-name": "pub_key",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1057,7 +1057,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_net_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1082,7 +1082,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_subnet_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1462,7 +1462,7 @@
},
"input-param": false,
"dictionary-name": "vnf-name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1777,7 +1777,7 @@
},
"input-param": false,
"dictionary-name": "image_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1802,7 +1802,7 @@
},
"input-param": false,
"dictionary-name": "key_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1827,7 +1827,7 @@
},
"input-param": false,
"dictionary-name": "pub_key",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1852,7 +1852,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_net_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1877,7 +1877,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_subnet_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1950,7 +1950,7 @@
},
"input-param": false,
"dictionary-name": "vfw_private_ip_0",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1975,7 +1975,7 @@
},
"input-param": false,
"dictionary-name": "vsn_private_ip_0",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2050,7 +2050,7 @@
},
"input-param": false,
"dictionary-name": "vpg_private_ip_0",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2284,7 +2284,7 @@
},
"input-param": false,
"dictionary-name": "vnf-name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2574,7 +2574,7 @@
},
"input-param": false,
"dictionary-name": "image_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2625,7 +2625,7 @@
},
"input-param": false,
"dictionary-name": "key_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2650,7 +2650,7 @@
},
"input-param": false,
"dictionary-name": "pub_key",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2675,7 +2675,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_net_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2700,7 +2700,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_subnet_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2848,7 +2848,7 @@
},
"input-param": false,
"dictionary-name": "vfw_private_ip_1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -3250,7 +3250,7 @@
},
"input-param": false,
"dictionary-name": "vnf-name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json
index c457086c..67d2a914 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json
@@ -27,7 +27,7 @@
"type": "string"
},
"dictionary-name": "vnf_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json
index 557f6efc..c8871214 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json
@@ -38,7 +38,7 @@
"type": "string"
},
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/proto-definition/pom.xml b/components/model-catalog/proto-definition/pom.xml
new file mode 100644
index 00000000..c9289392
--- /dev/null
+++ b/components/model-catalog/proto-definition/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2019 Bell Canada
+ * Modifications 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.components</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+
+ <artifactId>proto-definition</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Controller Blueprints Proto Definition</name>
+ <description>Controller Blueprints Proto Definition</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-protobuf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-stub</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java-util</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ <version>1.6.1</version>
+ </extension>
+ </extensions>
+ <plugins>
+ <plugin>
+ <groupId>org.xolstice.maven.plugins</groupId>
+ <artifactId>protobuf-maven-plugin</artifactId>
+ <version>0.6.1</version>
+ <configuration>
+ <protocArtifact>
+ com.google.protobuf:protoc:3.6.1:exe:${os.detected.classifier}
+ </protocArtifact>
+ <pluginId>grpc-java</pluginId>
+ <pluginArtifact>
+ io.grpc:protoc-gen-grpc-java:1.18.0:exe:${os.detected.classifier}
+ </pluginArtifact>
+ <protoSourceRoot>proto</protoSourceRoot>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>compile-custom</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/components/model-catalog/proto-definition/proto/BluePrintCommon.proto b/components/model-catalog/proto-definition/proto/BluePrintCommon.proto
new file mode 100644
index 00000000..0f17783a
--- /dev/null
+++ b/components/model-catalog/proto-definition/proto/BluePrintCommon.proto
@@ -0,0 +1,31 @@
+syntax = "proto3";
+option java_multiple_files = true;
+package org.onap.ccsdk.apps.controllerblueprints.common.api;
+
+message CommonHeader {
+ string timestamp = 1;
+ string originatorId = 23;
+ string requestId = 3;
+ string subRequestId = 4;
+ Flag flag = 5;
+}
+
+message Flag {
+ bool isForce = 1;
+ int32 ttl = 2;
+}
+
+message ActionIdentifiers {
+ string blueprintName = 1;
+ string blueprintVersion = 2;
+ string actionName = 3;
+ string mode = 4;
+}
+
+message Status {
+ int32 code = 1;
+ string errorMessage = 2;
+ string message = 3;
+ string eventType = 4;
+ string timestamp = 5;
+} \ No newline at end of file
diff --git a/components/model-catalog/proto-definition/proto/BluePrintManagement.proto b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto
new file mode 100644
index 00000000..658cbbbd
--- /dev/null
+++ b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto
@@ -0,0 +1,25 @@
+syntax = "proto3";
+import "BluePrintCommon.proto";
+option java_multiple_files = true;
+package org.onap.ccsdk.apps.controllerblueprints.management.api;
+
+message BluePrintManagementInput {
+ org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1;
+ string blueprintName = 2;
+ string blueprintVersion = 3;
+ FileChunk fileChunk = 4;
+}
+
+message BluePrintManagementOutput {
+ org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.Status status = 3;
+}
+
+message FileChunk {
+ bytes chunk = 1;
+}
+
+service BluePrintManagementService {
+ rpc uploadBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput);
+ rpc removeBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput);
+}
diff --git a/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto b/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto
new file mode 100644
index 00000000..5b91f46b
--- /dev/null
+++ b/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto
@@ -0,0 +1,24 @@
+syntax = "proto3";
+import "google/protobuf/struct.proto";
+import "BluePrintCommon.proto";
+option java_multiple_files = true;
+package org.onap.ccsdk.apps.controllerblueprints.processing.api;
+
+
+message ExecutionServiceInput {
+ org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers actionIdentifiers = 2;
+ google.protobuf.Struct payload = 3;
+}
+
+message ExecutionServiceOutput {
+ org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers actionIdentifiers = 2;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.Status status = 3;
+ google.protobuf.Struct payload = 4;
+}
+
+
+service BluePrintProcessingService {
+ rpc process (stream ExecutionServiceInput) returns (stream ExecutionServiceOutput);
+}
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json
index 37ef5ae1..57a0ef39 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json
@@ -10,7 +10,7 @@
"input": {
"type": "source-input"
},
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json
index 1f1b3e65..6eb8d929 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json
@@ -10,7 +10,7 @@
"input": {
"type": "source-input"
},
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json
index 300a71f1..67661ecd 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json
@@ -7,7 +7,7 @@
},
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json
index bb70fe3c..3dd74f7d 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json
@@ -10,7 +10,7 @@
"input": {
"type": "source-input"
},
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json
index d38ceb49..6cb22c3d 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json
@@ -10,7 +10,7 @@
"input": {
"type": "source-input"
},
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json b/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json
index ce6c2f2a..fe172caf 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json
@@ -10,7 +10,7 @@
"input": {
"type": "source-input"
},
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json
index 5834dd49..c0f78ac5 100644
--- a/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json
@@ -11,7 +11,7 @@
},
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json
index 25464d3f..75d7ca05 100644
--- a/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json
@@ -7,7 +7,7 @@
},
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json
index 71a4df2c..4c227f91 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json
@@ -12,7 +12,7 @@
"properties" : {
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json
index 481edae8..0df08c00 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json
@@ -12,7 +12,7 @@
"properties" : {
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json
index 89b3dc1c..4c0320ac 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json
@@ -7,7 +7,7 @@
"type" : "string"
},
"sources" : {
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json
index c55f1c18..e9d8a3b4 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json
@@ -7,7 +7,7 @@
"type" : "string"
},
"sources" : {
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json
index 13d89993..586aa0c9 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json
@@ -12,7 +12,7 @@
"properties" : {
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json
index fcd6d8d5..1fe47971 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json
@@ -12,7 +12,7 @@
"properties" : {
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/parent/pom.xml b/components/parent/pom.xml
index 8ecb2c1a..6d5c2c14 100644
--- a/components/parent/pom.xml
+++ b/components/parent/pom.xml
@@ -29,12 +29,12 @@
<name>Components Parent</name>
<packaging>pom</packaging>
<properties>
- <spring.boot.version>2.1.1.RELEASE</spring.boot.version>
- <spring.version>5.1.3.RELEASE</spring.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>
+ <spring.boot.version>2.1.2.RELEASE</spring.boot.version>
+ <spring.version>5.1.4.RELEASE</spring.version>
+ <kotlin.version>1.3.20</kotlin.version>
+ <kotlin.maven.version>1.3.20</kotlin.maven.version>
+ <kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
+ <grpc.version>1.18.0</grpc.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>
<guava.version>27.0.1-jre</guava.version>
@@ -117,6 +117,11 @@
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib-common</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-scripting-jvm-host</artifactId>
<version>${kotlin.version}</version>
</dependency>
@@ -302,10 +307,6 @@
<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>
diff --git a/components/pom.xml b/components/pom.xml
index 5b8768ce..95ffd5c0 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -14,7 +14,8 @@
~ 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/maven-v4_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/maven-v4_0_0.xsd">
<parent>
<groupId>org.onap.ccsdk.apps</groupId>
<artifactId>ccsdk-apps</artifactId>
@@ -37,5 +38,6 @@
<module>parent</module>
<module>core</module>
<module>resource-dict</module>
+ <module>model-catalog/proto-definition</module>
</modules>
</project>
diff --git a/components/resource-dict/load/resource_dictionary/mdsal-source.json b/components/resource-dict/load/resource_dictionary/mdsal-source.json
index b38986a4..fa72e5dc 100644
--- a/components/resource-dict/load/resource_dictionary/mdsal-source.json
+++ b/components/resource-dict/load/resource_dictionary/mdsal-source.json
@@ -7,7 +7,7 @@
},
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
index 7c8d4f4e..59f51516 100644
--- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
+++ b/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
@@ -13,7 +13,7 @@
"key" : "vfw_private_ip_0"
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json b/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
index 0553b8c3..6dda72f7 100644
--- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
+++ b/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
@@ -13,7 +13,7 @@
"key" : "vfw_private_ip_1"
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vnf-name.json b/components/resource-dict/load/resource_dictionary/vnf-name.json
index 47371d18..708030ee 100644
--- a/components/resource-dict/load/resource_dictionary/vnf-name.json
+++ b/components/resource-dict/load/resource_dictionary/vnf-name.json
@@ -7,7 +7,7 @@
"type" : "string"
},
"sources" : {
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vnf_name.json b/components/resource-dict/load/resource_dictionary/vnf_name.json
index 4617a264..3164367c 100644
--- a/components/resource-dict/load/resource_dictionary/vnf_name.json
+++ b/components/resource-dict/load/resource_dictionary/vnf_name.json
@@ -7,7 +7,7 @@
"type" : "string"
},
"sources" : {
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
index 912cfb9a..9bef3c79 100644
--- a/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
+++ b/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
@@ -13,7 +13,7 @@
"key" : "vpg_private_ip_0"
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
index bf987382..52a4542c 100644
--- a/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
+++ b/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
@@ -13,7 +13,7 @@
"key" : "vsn_private_ip_0"
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
index e4219c13..aa06c9da 100644
--- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
+++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
@@ -15,6 +15,7 @@
*/
package org.onap.ccsdk.apps.controllerblueprints.resource.dict
+
/**
* ResourceDictionaryConstants
*
@@ -23,7 +24,8 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict
object ResourceDictionaryConstants {
const val SOURCE_INPUT = "input"
const val SOURCE_DEFAULT = "default"
- const val SOURCE_DB = "primary-db"
+ const val SOURCE_PRIMARY_CONFIG_DATA = "primary-config-data"
+ const val SOURCE_PRIMARY_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
deleted file mode 100644
index a234a89e..00000000
--- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceAssignmentUtils.kt
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
index 3f5aef43..f11638e3 100644
--- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
+++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
@@ -28,7 +28,7 @@ public class ResourceSourceMappingFactoryTest {
ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-db", "source-primary-db");
ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");
ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest");
+ ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-config-data", "source-rest");
String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("primary-db");
Assert.notNull(nodeTypeName, "Failed to get primary-db mapping");
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
index fa241380..92bfa730 100644
--- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
+++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
@@ -59,9 +59,9 @@ public class ResourceDictionaryUtilsTest {
Assert.assertEquals("Expected First source Default, but.", ResourceDictionaryConstants.SOURCE_DEFAULT, resourceAssignment.getDictionarySource());
// To Check Assigned Source
- resourceAssignment.setDictionarySource(ResourceDictionaryConstants.SOURCE_DB);
+ resourceAssignment.setDictionarySource(ResourceDictionaryConstants.SOURCE_PRIMARY_DB);
ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertEquals("Expected Assigned source DB, but.", ResourceDictionaryConstants.SOURCE_DB, resourceAssignment.getDictionarySource());
+ Assert.assertEquals("Expected Assigned source DB, but.", ResourceDictionaryConstants.SOURCE_PRIMARY_DB, resourceAssignment.getDictionarySource());
}
@@ -78,7 +78,7 @@ public class ResourceDictionaryUtilsTest {
Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, inputFirstSource);
// TO check the multiple Source
- sources.put(ResourceDictionaryConstants.SOURCE_DB, new NodeTemplate());
+ sources.put(ResourceDictionaryConstants.SOURCE_PRIMARY_DB, new NodeTemplate());
String multipleFirstSource = ResourceDictionaryUtils.findFirstSource(sources);
Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, multipleFirstSource);
diff --git a/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
index 50e5c329..74ef6d6d 100644
--- a/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
+++ b/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
@@ -25,6 +25,6 @@ object ResourceDictionaryTestUtils {
ResourceSourceMappingFactory.registerSourceMapping("primary-db", "source-primary-db")
ResourceSourceMappingFactory.registerSourceMapping("input", "source-input")
ResourceSourceMappingFactory.registerSourceMapping("default", "source-default")
- ResourceSourceMappingFactory.registerSourceMapping("mdsal", "source-rest")
+ ResourceSourceMappingFactory.registerSourceMapping("primary-config-data", "source-rest")
}
} \ No newline at end of file
diff --git a/components/resource-dict/src/test/resources/validation/cyclic.json b/components/resource-dict/src/test/resources/validation/cyclic.json
index 7e6472f5..98cd1444 100644
--- a/components/resource-dict/src/test/resources/validation/cyclic.json
+++ b/components/resource-dict/src/test/resources/validation/cyclic.json
@@ -29,7 +29,7 @@
"required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@
"required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@
"type": "string"
},
"dictionary-name": "managed-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@
"type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
diff --git a/components/resource-dict/src/test/resources/validation/duplicate.json b/components/resource-dict/src/test/resources/validation/duplicate.json
index 28ab71fc..7581ff64 100644
--- a/components/resource-dict/src/test/resources/validation/duplicate.json
+++ b/components/resource-dict/src/test/resources/validation/duplicate.json
@@ -29,7 +29,7 @@
"required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@
"required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@
"type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
diff --git a/components/resource-dict/src/test/resources/validation/success.json b/components/resource-dict/src/test/resources/validation/success.json
index 5d0e8980..486251d6 100644
--- a/components/resource-dict/src/test/resources/validation/success.json
+++ b/components/resource-dict/src/test/resources/validation/success.json
@@ -29,7 +29,7 @@
"required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@
"required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@
"type": "string"
},
"dictionary-name": "managed-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@
"type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]