aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules
diff options
context:
space:
mode:
Diffstat (limited to 'ms/controllerblueprints/modules')
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json411
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json3
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn66
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py8
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Scripts/__init__.py0
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta8
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl1
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/__init__.py0
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Definitions/sample-nodetype.json34
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json345
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Mappings/baseconfig-mapping.json3
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Plans/ActivateProcess.bpmn66
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Scripts/SamplePythonComponentNode.py8
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Scripts/__init__.py0
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/TOSCA-Metadata/TOSCA.meta8
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/base-config-template.vtl40
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/baseconfig-template.vtl1
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/licence-template.vtl4
-rw-r--r--ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/__init__.py0
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-mapping-resource.json8
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-script-python.json8
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-template-velocity.json8
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/artifact_type/tosca.artifacts.Implementation.json5
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/data_type/datatype-property.json27
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/data_type/datatype-resource-assignment.json46
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/data_type/dt-license-key.json11
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/data_type/dt-v4-aggregate.json15
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/data_type/tosca.datatypes.Credential.json31
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/node_type/artifact-config-template.json37
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/node_type/component-config-generator.json72
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/node_type/component-netconf-executor.json79
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/node_type/component-resource-assignment.json68
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/node_type/dg-activate-netconf.json66
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/node_type/dg-config-generator.json65
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/node_type/dg-resource-assign-activate.json70
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/node_type/dg-resource-assignment.json65
-rw-r--r--ms/controllerblueprints/modules/core/load/model_type/node_type/vnf-netconf-device.json42
-rw-r--r--ms/controllerblueprints/modules/core/pom.xml109
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt125
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintException.kt49
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt91
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt52
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt75
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/OrchestratorException.kt48
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintExpressionData.kt70
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt604
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintEnhancerFactory.kt45
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintParserFactory.kt51
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintValidatorFactory.kt45
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintChainedService.kt117
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt177
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoService.kt92
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt240
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt174
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserService.kt62
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt274
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt353
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt198
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt95
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt55
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt179
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ResourceResolverUtils.kt62
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt44
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtils.kt131
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt35
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt70
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoFileServiceTest.kt51
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt40
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt109
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt42
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt131
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt48
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt40
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt71
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt36
-rw-r--r--ms/controllerblueprints/modules/core/src/test/resources/componentnode/default.json100
-rw-r--r--ms/controllerblueprints/modules/core/src/test/resources/data/default-context.json5
-rw-r--r--ms/controllerblueprints/modules/core/src/test/resources/dictionary/dictionary_schema.json261
-rw-r--r--ms/controllerblueprints/modules/core/src/test/resources/properties/convert.json33
-rw-r--r--ms/controllerblueprints/modules/core/src/test/resources/properties/default.json16
-rw-r--r--ms/controllerblueprints/modules/pom.xml54
-rw-r--r--ms/controllerblueprints/modules/resource-dict/pom.xml47
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java167
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DecryptionRule.java67
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java181
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java36
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java83
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java36
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java37
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java97
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.java129
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/validator/ResourceAssignmentValidator.java164
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java165
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json411
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json3
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn66
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py8
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py0
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta8
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl1
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py0
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json742
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/vrr-test/TOSCA-Metadata/TOSCA.meta5
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Templates/base-config-template.vtl40
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Templates/licence-template.vtl4
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/vrr-test/__init__.py0
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-mapping-resource.json8
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-script-python.json8
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-template-velocity.json8
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/data_type/datatype-property.json27
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/data_type/datatype-resource-assignment.json46
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/data_type/dt-license-key.json11
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/data_type/dt-v4-aggregate.json15
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/artifact-config-template.json37
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/component-config-generator.json72
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-edit.json95
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-executor.json79
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-get.json61
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/component-resource-assignment.json68
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/component-transaction-netconf.json93
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/dg-activate-netconf.json66
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/dg-config-generator.json65
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assign-activate.json70
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assignment.json65
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/vnf-netconf-device.json42
-rw-r--r--ms/controllerblueprints/modules/service/load/resource_dictionary/action-name.json17
-rw-r--r--ms/controllerblueprints/modules/service/load/resource_dictionary/bundle-id.json32
-rw-r--r--ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json14
-rw-r--r--ms/controllerblueprints/modules/service/pom.xml96
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java211
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerRepoDBService.java100
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java207
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java339
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelService.java247
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelValidatorService.java67
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java325
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeService.java178
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java169
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/SchemaGeneratorService.java116
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java140
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ApplicationConstants.java33
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java63
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java42
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java187
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java291
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java175
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java171
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java170
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java207
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/model/AutoMapResponse.java53
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelContentRepository.java95
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelRepository.java90
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelSearchRepository.java43
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.java98
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryRepository.java68
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java179
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java116
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java125
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java87
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java126
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java91
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java134
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java94
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtils.java124
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java200
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java88
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java123
-rw-r--r--ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json890
-rw-r--r--ms/controllerblueprints/modules/service/src/main/resources/sql/data.sql0
-rw-r--r--ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql87
-rw-r--r--ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql82
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java61
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java69
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestApplication.java34
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java36
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java50
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceTemplateValidationTest.java56
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java172
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java130
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java113
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java155
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtilsTest.java33
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/application.properties67
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json345
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json824
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json11
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json19
187 files changed, 18686 insertions, 0 deletions
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
new file mode 100644
index 000000000..635e177a1
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
@@ -0,0 +1,411 @@
+{
+ "metadata": {
+ "template_author": "Brinda Santh Muthuramalingam",
+ "author-email": "brindasanth@gmail.com",
+ "user-groups" : "ADMIN, OPERATION",
+ "template_name": "baseconfiguration",
+ "template_version": "1.0.0",
+ "template_tags": "brinda, tosca"
+ },
+ "topology_template": {
+ "inputs": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "node_templates": {
+ "activate-process": {
+ "type": "bpmn-activate",
+ "properties": {
+ "process-name": { "get_input" : "action-name" },
+ "version" : { "get_property" : ["SELF", "process-name"] },
+ "content": { "get_artifact" : ["SELF", "activate-process"] }
+ },
+ "artifacts": {
+ "activate-process": {
+ "type": "artifact-bpmn-camunda",
+ "file": "Plans/ActivateProcess.bpmn"
+ }
+ }
+ },
+ "resource-assignment": {
+ "type": "component-resource-assignment",
+ "properties":{
+ "request-id": ["1234", "1234"]
+ },
+ "interfaces": {
+ "DefaultComponentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": { "get_input" : "action-name" },
+ "resource-type": "vnf-type",
+ "request-id": { "get_input" : "request-id" },
+ "resource-id": { "get_input" : "hostname" },
+ "template-content": { "get_artifact" : ["SELF", "baseconfig-template"] },
+ "mapping-content": { "get_artifact" : ["SELF", "baseconfig-mapping"] }
+ },
+ "outputs": {
+ "resource-assignment-params": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "artifacts": {
+ "baseconfig-template": {
+ "type": "artifact-template-velocity",
+ "file": "Templates/baseconfig-template.vtl"
+ },
+ "baseconfig-mapping": {
+ "type": "artifact-mapping-resource",
+ "file": "Mappings/baseconfig-mapping.json"
+ }
+ }
+ },
+ "resource-assignment-py": {
+ "type": "component-resource-assignment",
+ "properties":{
+ "request-id": ["1234", "1234"]
+ },
+ "interfaces": {
+ "DefaultComponentNode": {
+ "operations": {
+ "process": {
+ "implementation" :{
+ "primary" : "component-script"
+ },
+ "inputs": {
+ "action-name": { "get_input" : "action-name" }
+ },
+ "outputs": {
+ "resource-assignment-params": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "artifacts": {
+ "component-script": {
+ "type": "artifact-script-python",
+ "file": "Scripts/baseconfig-template.vtl"
+ }
+ }
+ }
+ },
+ "workflows":{
+ "activate-process":{
+ "steps" : {
+ "call-resource-assignment" : {
+ "description" : "Invoke Resource Assignment Component",
+ "target" : "resource-assignment",
+ "activities" : [
+ {
+ "call_operation": "ResourceAssignmentNode.process"
+ }
+ ],
+ "on_success" : [
+ "download-baseconfig"
+ ]
+ },
+ "download-baseconfig" : {
+ "description" : "Call Download Base Config Component",
+ "target" : "activate-netconf",
+ "activities" : [
+ {
+ "call_operation": "NetconfTransactionNode.process"
+ }
+ ],
+ "on_success" : [
+ "download-licence"
+ ]
+ },
+ "download-licence" : {
+ "description" : "Call Download Licence Component",
+ "target" : "activate-netconf",
+ "activities" : [
+ {
+ "call_operation": "NetconfTransactionNode.process"
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "artifact_types": {
+ "artifact-template-velocity": {
+ "description": " Velocity Template used for Configuration",
+ "version": "1.0.0",
+ "file_ext": [
+ "vtl"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ },
+ "artifact-mapping-resource": {
+ "description": " Velocity Template Resource Mapping File used along with Configuration template",
+ "version": "1.0.0",
+ "file_ext": [
+ "json"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ },
+ "artifact-script-kotlin": {
+ "description": " Kotlin Script Template used for Configuration",
+ "version": "1.0.0",
+ "file_ext": [
+ "kt"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ },
+ "artifact-script-python": {
+ "description": " Kotlin Script Template used for Configuration",
+ "version": "1.0.0",
+ "file_ext": [
+ "py"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ },
+ "artifact-bpmn-camunda": {
+ "description": " Camunda BPM File",
+ "version": "1.0.0",
+ "file_ext": [
+ "bpmn"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ },
+ "artifact-component-jar": {
+ "description": "Component Jar",
+ "version": "1.0.0",
+ "file_ext": [
+ "jar"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ }
+ },
+ "node_types": {
+ "bpmn-activate": {
+ "description": "This is BPMN Activate node type",
+ "version": "1.0.0",
+ "properties": {
+ "content": {
+ "required": false,
+ "type": "string"
+ },
+ "process-name": {
+ "required": false,
+ "type": "string"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default" : "LATEST"
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ },
+ "tosca.nodes.Component": {
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "properties": {
+ "type": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": false,
+ "type": "string"
+ }
+ },
+ "interfaces": {
+ "DefaultOperation": {
+ "operations": {
+ "validate": {
+ "inputs": {
+ "action-name": {
+ "description": "validate for action",
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "artifacts" :{
+ "component-jar": {
+ "description": "Component Jar",
+ "type": "artifact-component-jar",
+ "file": "Component/basecomponent.jar"
+ }
+ },
+ "derived_from": "tosca.nodes.Root"
+ },
+ "tosca.nodes.component.Python": {
+ "description": "This is Resource Assignment Python Component API",
+ "version": "1.0.0",
+ "properties": {
+ "type": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": false,
+ "type": "string"
+ }
+ },
+ "interfaces": {
+ "DefaultOperation": {
+ "operations": {
+ "validate": {
+ "inputs": {
+ "action-name": {
+ "description": "validate for action",
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "artifacts" :{
+ "component-jar": {
+ "description": "Component Jar",
+ "type": "artifact-component-jar",
+ "file": "Component/basecomponent.jar"
+ }
+ },
+ "derived_from": "tosca.nodes.Root"
+ },
+ "component-resource-assignment": {
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "properties": {
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "interfaces": {
+ "DefaultComponentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": {
+ "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "resource-type": {
+ "required": false,
+ "type": "string"
+ },
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "required": true,
+ "type": "string"
+ },
+ "template-content": {
+ "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "required": true,
+ "type": "string"
+ },
+ "mapping-content": {
+ "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "resource-assignment-params": {
+ "required": true,
+ "type": "string"
+ },
+ "status": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ },
+ "component-resource-assignment-python": {
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "properties": {
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "interfaces": {
+ "DefaultComponentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": {
+ "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "resource-assignment-params": {
+ "required": true,
+ "type": "string"
+ },
+ "status": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.component.Python"
+ }
+ },
+ "data_types": {
+ "sample-property" : {
+ "description": "This is sample data type",
+ "version": "1.0.0",
+ "properties": {
+ "content": {
+ "required": false,
+ "type": "string"
+ },
+ "process-name": {
+ "required": false,
+ "type": "string"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default" : "LATEST"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json
new file mode 100644
index 000000000..6abfb51bd
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json
@@ -0,0 +1,3 @@
+{
+ "assignments": "Sample Assignments"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn
new file mode 100644
index 000000000..5e94c0f8e
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
+ xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+ xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
+ xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1"
+ targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.2">
+ <bpmn:process id="ActivateProcess" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_0l0dq58</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1pr0kil">
+ <bpmn:incoming>SequenceFlow_1ay0k6p</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0l0dq58" sourceRef="StartEvent_1" targetRef="activate_device_task"/>
+ <bpmn:sequenceFlow id="SequenceFlow_1ay0k6p" sourceRef="activate_device_task" targetRef="EndEvent_1pr0kil"/>
+ <bpmn:serviceTask id="activate_device_task" name="Activate Device"
+ camunda:delegateExpression="${componentDelegateService}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="selector"><![CDATA[resource-assignment
+]]></camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0l0dq58</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ay0k6p</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateProcess">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="175" y="143" width="36" height="36"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="148" y="179" width="90" height="20"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1pr0kil_di" bpmnElement="EndEvent_1pr0kil">
+ <dc:Bounds x="575" y="114" width="36" height="36"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="593" y="154" width="0" height="12"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0l0dq58_di" bpmnElement="SequenceFlow_0l0dq58">
+ <di:waypoint xsi:type="dc:Point" x="211" y="161"/>
+ <di:waypoint xsi:type="dc:Point" x="273" y="161"/>
+ <di:waypoint xsi:type="dc:Point" x="273" y="149"/>
+ <di:waypoint xsi:type="dc:Point" x="334" y="149"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="288" y="149" width="0" height="12"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ay0k6p_di" bpmnElement="SequenceFlow_1ay0k6p">
+ <di:waypoint xsi:type="dc:Point" x="434" y="149"/>
+ <di:waypoint xsi:type="dc:Point" x="505" y="149"/>
+ <di:waypoint xsi:type="dc:Point" x="505" y="132"/>
+ <di:waypoint xsi:type="dc:Point" x="575" y="132"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="520" y="134.5" width="0" height="12"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0e8ek4f_di" bpmnElement="activate_device_task">
+ <dc:Bounds x="334" y="109" width="100" height="80"/>
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py
new file mode 100644
index 000000000..eb198c79a
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py
@@ -0,0 +1,8 @@
+from com.brvith.orchestrator.core.interfaces import ComponentNode
+
+class SamplePythonComponentNode(ComponentNode):
+ def prepare(self, context, componentContext):
+ return None
+
+ def prepare(self, context, componentContext):
+ return None \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Scripts/__init__.py b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Scripts/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Scripts/__init__.py
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta
new file mode 100644
index 000000000..fb38c1594
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta
@@ -0,0 +1,8 @@
+TOSCA-Meta-File-Version: 1.0.0
+CSAR-Version: 1.0
+Created-By: Brinda Santh M
+Entry-Definitions: Definitions/activation-blueprint.json
+Template-Tags: Brinda Santh, activation-blueprint
+
+Name: Plans/ActivateProcess.bpmn
+Content-Type: application/vnd.oasis.bpmn
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl
new file mode 100644
index 000000000..026c59176
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl
@@ -0,0 +1 @@
+This is Sample Velocity Template \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/__init__.py b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/baseconfiguration/__init__.py
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Definitions/sample-nodetype.json b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Definitions/sample-nodetype.json
new file mode 100644
index 000000000..6d469ea84
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Definitions/sample-nodetype.json
@@ -0,0 +1,34 @@
+{
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "properties": {
+ "type": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": false,
+ "type": "string"
+ }
+ },
+ "interfaces": {
+ "DefaultOperation": {
+ "operations": {
+ "validate": {
+ "inputs": {
+ "action-name": {
+ "description": "validate for action",
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "artifacts" :{
+ "component-jar": {
+ "description": "Component Jar",
+ "type": "artifact-component-jar",
+ "file": "Component/basecomponent.jar"
+ }
+ },
+ "derived_from": "tosca.nodes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json
new file mode 100644
index 000000000..e78f32f02
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json
@@ -0,0 +1,345 @@
+{
+ "metadata": {
+ "template_author": "Brinda Santh",
+ "template_name": "simple-baseconfig",
+ "template_version": "1.0.0",
+ "service-type": "Sample Service",
+ "release": "1806",
+ "vnf-type": "VPE"
+ },
+ "topology_template": {
+ "inputs": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "node_templates": {
+ "vpe-netconf-device": {
+ "capabilities": {
+ "netconf": {
+ "properties": {
+ "login-key": "sdnc",
+ "login-account": "sndc-local",
+ "source": "local",
+ "target-ip-address": "{\"get_attribute\":\"lo0-local-ipv4-address\"}",
+ "port-number": 22,
+ "connection-time-out": 30
+ }
+ }
+ },
+ "type": "vnf-netconf-device"
+ },
+ "activate-netconf-component": {
+ "capabilities": {
+ "component-node": {}
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vpe-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": "{ \"get_input\" : \"action-name\" }",
+ "service-template-name": "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
+ "resource-type": "vnf-type",
+ "request-id": "{ \"get_input\" : \"request-id\" }",
+ "resource-id": "{ \"get_input\" : \"hostname\" }",
+ "execution-script": "execution-script"
+ },
+ "outputs": {
+ "response-data": "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",
+ "status": "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"
+ },
+ "implementation" : {
+ "primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
+ }
+ }
+ }
+ }
+ },
+ "type": "component-netconf-executor"
+ },
+ "resource-assignment-ra-component": {
+ "capabilities": {
+ "component-node": {}
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "template-names": [
+ "base-config-template",
+ "licence-template"
+ ],
+ "action-name": "{ \"get_input\" : \"action-name\" }",
+ "service-template-name": "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
+ "resource-type": "vnf-type",
+ "request-id": "{ \"get_input\" : \"request-id\" }",
+ "resource-id": "{ \"get_input\" : \"hostname\" }"
+ },
+ "outputs": {
+ "resource-assignment-params": "success",
+ "status": "status"
+ }
+ }
+ }
+ }
+ },
+ "type": "component-resource-assignment"
+ },
+ "resource-assignment-action": {
+ "properties": {
+ "mode": "sync",
+ "version": "LATEST",
+ "is-start-flow": "false"
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "resource-assignment-ra-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {},
+ "content": {
+ "properties": {
+ "type": "json"
+ }
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {
+ "inputs": {
+ "params": []
+ }
+ }
+ }
+ }
+ },
+ "type": "dg-resource-assignment"
+ },
+ "activate-action": {
+ "properties": {
+ "mode": "sync",
+ "version": "LATEST",
+ "is-start-flow": "false"
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "activate-netconf-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {},
+ "content": {
+ "properties": {
+ "type": "json"
+ }
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {
+ "inputs": {
+ "params": []
+ }
+ }
+ }
+ }
+ },
+ "type": "dg-activate-netconf"
+ },
+ "base-config-template": {
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://base-config-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "bundle-mac",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "string",
+ "status": "",
+ "constraints": [
+ {}
+ ],
+ "entry_schema": {
+ "type": ""
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "bundle-mac",
+ "dictionary-source": "db",
+ "dependencies": [
+ "hostname"
+ ],
+ "version": 0
+ },
+ {
+ "name": "wan-aggregate-ipv4-addresses",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "list",
+ "status": "",
+ "constraints": [
+ {}
+ ],
+ "entry_schema": {
+ "type": "dt-v4-aggregate"
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "wan-aggregate-ipv4-addresses",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "service-instance-id",
+ "oam-network-role",
+ "oam-v4-ip-type ",
+ "oam-vm-type"
+ ],
+ "version": 0
+ },
+ {
+ "name": "hostname",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "hostname",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ },
+ {
+ "name": "service",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ },
+ {
+ "name": "service-instance-id",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ }
+ ]
+ }
+ }
+ },
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "type": "artifact-config-template"
+ },
+ "licence-template": {
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://licence-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "licenses",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "list",
+ "status": "",
+ "constraints": [
+ {}
+ ],
+ "entry_schema": {
+ "type": "dt-license-key"
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "licenses",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "service-instance-id"
+ ],
+ "version": 0
+ },
+ {
+ "name": "service-instance-id",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ }
+ ]
+ }
+ }
+ },
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "type": "artifact-config-template"
+ }
+ }
+ },
+ "node_types": {
+ },
+ "data_types": {
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Mappings/baseconfig-mapping.json b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Mappings/baseconfig-mapping.json
new file mode 100644
index 000000000..6abfb51bd
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Mappings/baseconfig-mapping.json
@@ -0,0 +1,3 @@
+{
+ "assignments": "Sample Assignments"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Plans/ActivateProcess.bpmn b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Plans/ActivateProcess.bpmn
new file mode 100644
index 000000000..5e94c0f8e
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Plans/ActivateProcess.bpmn
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
+ xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+ xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
+ xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1"
+ targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.2">
+ <bpmn:process id="ActivateProcess" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_0l0dq58</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1pr0kil">
+ <bpmn:incoming>SequenceFlow_1ay0k6p</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0l0dq58" sourceRef="StartEvent_1" targetRef="activate_device_task"/>
+ <bpmn:sequenceFlow id="SequenceFlow_1ay0k6p" sourceRef="activate_device_task" targetRef="EndEvent_1pr0kil"/>
+ <bpmn:serviceTask id="activate_device_task" name="Activate Device"
+ camunda:delegateExpression="${componentDelegateService}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="selector"><![CDATA[resource-assignment
+]]></camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0l0dq58</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ay0k6p</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateProcess">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="175" y="143" width="36" height="36"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="148" y="179" width="90" height="20"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1pr0kil_di" bpmnElement="EndEvent_1pr0kil">
+ <dc:Bounds x="575" y="114" width="36" height="36"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="593" y="154" width="0" height="12"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0l0dq58_di" bpmnElement="SequenceFlow_0l0dq58">
+ <di:waypoint xsi:type="dc:Point" x="211" y="161"/>
+ <di:waypoint xsi:type="dc:Point" x="273" y="161"/>
+ <di:waypoint xsi:type="dc:Point" x="273" y="149"/>
+ <di:waypoint xsi:type="dc:Point" x="334" y="149"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="288" y="149" width="0" height="12"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ay0k6p_di" bpmnElement="SequenceFlow_1ay0k6p">
+ <di:waypoint xsi:type="dc:Point" x="434" y="149"/>
+ <di:waypoint xsi:type="dc:Point" x="505" y="149"/>
+ <di:waypoint xsi:type="dc:Point" x="505" y="132"/>
+ <di:waypoint xsi:type="dc:Point" x="575" y="132"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="520" y="134.5" width="0" height="12"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0e8ek4f_di" bpmnElement="activate_device_task">
+ <dc:Bounds x="334" y="109" width="100" height="80"/>
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Scripts/SamplePythonComponentNode.py b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Scripts/SamplePythonComponentNode.py
new file mode 100644
index 000000000..eb198c79a
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Scripts/SamplePythonComponentNode.py
@@ -0,0 +1,8 @@
+from com.brvith.orchestrator.core.interfaces import ComponentNode
+
+class SamplePythonComponentNode(ComponentNode):
+ def prepare(self, context, componentContext):
+ return None
+
+ def prepare(self, context, componentContext):
+ return None \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Scripts/__init__.py b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Scripts/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Scripts/__init__.py
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/TOSCA-Metadata/TOSCA.meta b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/TOSCA-Metadata/TOSCA.meta
new file mode 100644
index 000000000..d7ae5e8a2
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/TOSCA-Metadata/TOSCA.meta
@@ -0,0 +1,8 @@
+TOSCA-Meta-File-Version: 1.0.0
+CSAR-Version: 1.0
+Created-By: Brinda Santh M
+Entry-Definitions: Definitions/simple-baseconfig.json
+Template-Tags: vrr-test, Brinda Santh
+
+Name: Plans/ActivateProcess.bpmn
+Content-Type: application/vnd.oasis.bpmn
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/base-config-template.vtl b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/base-config-template.vtl
new file mode 100644
index 000000000..92dba1024
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/base-config-template.vtl
@@ -0,0 +1,40 @@
+ <config>
+ <configuration>
+ <groups>
+ <name>${group-name}</name>
+ <routing-instances>
+ <instance>
+ <name>&lt;*&gt;</name>
+ <protocols>
+ <pim>
+ <dense-groups>
+ <dynamic-reject />
+ <pim-dense-group-type>
+ <name>224.0.1.40/32</name>
+ </pim-dense-group-type>
+ <pim-dense-group-type>
+ <name>224.0.1.39/32</name>
+ </pim-dense-group-type>
+ <pim-dense-group-type>
+ <name>224.0.0.0/4</name>
+ <reject />
+ </pim-dense-group-type>
+ </dense-groups>
+ <rp>
+ <auto-rp>
+ <discovery />
+ </auto-rp>
+ </rp>
+ <interface>
+ <name>&lt;*&gt;</name>
+ <disable />
+ <priority>1000</priority>
+ </interface>
+ <reset-tracking-bit />
+ </pim>
+ </protocols>
+ </instance>
+ </routing-instances>
+ </groups>
+ </configuration>
+ </config> \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/baseconfig-template.vtl b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/baseconfig-template.vtl
new file mode 100644
index 000000000..026c59176
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/baseconfig-template.vtl
@@ -0,0 +1 @@
+This is Sample Velocity Template \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/licence-template.vtl b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/licence-template.vtl
new file mode 100644
index 000000000..626974f27
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/Templates/licence-template.vtl
@@ -0,0 +1,4 @@
+ <config>
+ <configuration>
+ </configuration>
+ </config>
diff --git a/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/__init__.py b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/blueprints/simple-baseconfig/__init__.py
diff --git a/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-mapping-resource.json b/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-mapping-resource.json
new file mode 100644
index 000000000..0a3261b09
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-mapping-resource.json
@@ -0,0 +1,8 @@
+{
+ "description": " Velocity Template Resource Mapping File used along with Configuration template",
+ "version": "1.0.0",
+ "file_ext": [
+ "json"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-script-python.json b/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-script-python.json
new file mode 100644
index 000000000..b48d2b628
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-script-python.json
@@ -0,0 +1,8 @@
+{
+ "description": " Kotlin Script Template used for Configuration",
+ "version": "1.0.0",
+ "file_ext": [
+ "py"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-template-velocity.json b/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-template-velocity.json
new file mode 100644
index 000000000..9395d3970
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-template-velocity.json
@@ -0,0 +1,8 @@
+{
+ "description": " Velocity Template used for Configuration",
+ "version": "1.0.0",
+ "file_ext": [
+ "vtl"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/artifact_type/tosca.artifacts.Implementation.json b/ms/controllerblueprints/modules/core/load/model_type/artifact_type/tosca.artifacts.Implementation.json
new file mode 100644
index 000000000..5a7c95684
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/artifact_type/tosca.artifacts.Implementation.json
@@ -0,0 +1,5 @@
+{
+ "description": "TOSCA base type for implementation artifacts",
+ "version": "1.0.0",
+ "derived_from": "tosca.artifacts.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/data_type/datatype-property.json b/ms/controllerblueprints/modules/core/load/model_type/data_type/datatype-property.json
new file mode 100644
index 000000000..5584b10ea
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/data_type/datatype-property.json
@@ -0,0 +1,27 @@
+{
+ "version": "1.0.0",
+ "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
+ "properties": {
+ "type": {
+ "required": true,
+ "type": "string"
+ },
+ "description": {
+ "required": false,
+ "type": "string"
+ },
+ "required": {
+ "required": false,
+ "type": "boolean"
+ },
+ "default": {
+ "required": false,
+ "type": "string"
+ },
+ "entry_schema": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/data_type/datatype-resource-assignment.json b/ms/controllerblueprints/modules/core/load/model_type/data_type/datatype-resource-assignment.json
new file mode 100644
index 000000000..cc9816ebb
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/data_type/datatype-resource-assignment.json
@@ -0,0 +1,46 @@
+{
+ "version": "1.0.0",
+ "description": "This is Resource Assignment Data Type",
+ "properties": {
+ "property": {
+ "required": true,
+ "type": "datatype-property"
+ },
+ "input-param": {
+ "required": true,
+ "type": "boolean"
+ },
+ "dictionary-name": {
+ "required": false,
+ "type": "string"
+ },
+ "dictionary-source": {
+ "required": false,
+ "type": "string"
+ },
+ "dependencies": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "status": {
+ "required": false,
+ "type": "string"
+ },
+ "message": {
+ "required": false,
+ "type": "string"
+ },
+ "updated-date": {
+ "required": false,
+ "type": "string"
+ },
+ "updated-by": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/data_type/dt-license-key.json b/ms/controllerblueprints/modules/core/load/model_type/data_type/dt-license-key.json
new file mode 100644
index 000000000..e9c312b79
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/data_type/dt-license-key.json
@@ -0,0 +1,11 @@
+{
+ "version": "1.0.0",
+ "description": "This is dt-plicense-key Data Type",
+ "properties": {
+ "license-key": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/data_type/dt-v4-aggregate.json b/ms/controllerblueprints/modules/core/load/model_type/data_type/dt-v4-aggregate.json
new file mode 100644
index 000000000..842a7f805
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/data_type/dt-v4-aggregate.json
@@ -0,0 +1,15 @@
+{
+ "version": "1.0.0",
+ "description": "This is dt-v4-aggregate Data Type",
+ "properties": {
+ "ipv4-address": {
+ "required": true,
+ "type": "string"
+ },
+ "ipv4-plen": {
+ "required": false,
+ "type": "integer"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/data_type/tosca.datatypes.Credential.json b/ms/controllerblueprints/modules/core/load/model_type/data_type/tosca.datatypes.Credential.json
new file mode 100644
index 000000000..820a55168
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/data_type/tosca.datatypes.Credential.json
@@ -0,0 +1,31 @@
+{
+ "version": "1.0.0",
+ "description": "Credential",
+ "properties": {
+ "protocol": {
+ "required": false,
+ "type": "string"
+ },
+ "token_type": {
+ "required": true,
+ "type": "string",
+ "default" : "password"
+ },
+ "token": {
+ "required": false,
+ "type": "string"
+ },
+ "keys": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "user": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/node_type/artifact-config-template.json b/ms/controllerblueprints/modules/core/load/model_type/node_type/artifact-config-template.json
new file mode 100644
index 000000000..be9bbfc0e
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/node_type/artifact-config-template.json
@@ -0,0 +1,37 @@
+{
+ "description": "This is Configuration Velocity Template",
+ "version": "1.0.0",
+ "properties": {
+ "action-names": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "capabilities": {
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ },
+ "mapping": {
+ "type": "tosca.capability.Mapping",
+ "properties": {
+ "mapping": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-resource-assignment"
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Artifact"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/node_type/component-config-generator.json b/ms/controllerblueprints/modules/core/load/model_type/node_type/component-config-generator.json
new file mode 100644
index 000000000..764f9e890
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/node_type/component-config-generator.json
@@ -0,0 +1,72 @@
+{
+ "description": "This is Generate Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-config-generator-service-ConfigGeneratorNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "template-data": {
+ "description": "Conditional : JSON string which is used to mash with template. Either template-data or ( resource-id and resource-type ) should be present",
+ "required": false,
+ "type": "string"
+ },
+ "template-content": {
+ "description": "Conditional : Dynamic Template used to generate Configuration.",
+ "required": false,
+ "type": "string"
+ },
+ "resource-type": {
+ "description": "Conditional : resource-type used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
+ "required": false,
+ "type": "string"
+ },
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Conditional : Id used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
+ "required": false,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Conditional : Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "template-name": {
+ "description": "Conditional : Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "generated-config": {
+ "description": "Generated Configuration for the Template adn Resource Data",
+ "required": true,
+ "type": "string"
+ },
+ "mask-info": {
+ "description": "If template contains mask encription keys, then this mask-info field will be generated, This JSON Content alligns to the bean org.onap.ccsdk.apps.controllerblueprints.core.data.custom.MaskInfo ",
+ "required": false,
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/node_type/component-netconf-executor.json b/ms/controllerblueprints/modules/core/load/model_type/node_type/component-netconf-executor.json
new file mode 100644
index 000000000..aed667aaf
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/node_type/component-netconf-executor.json
@@ -0,0 +1,79 @@
+{
+ "description": "This is Netconf Transaction Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vnf-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "service-template-name": {
+ "description": "Service Template Name",
+ "required": true,
+ "type": "string"
+ },
+ "service-template-version": {
+ "description": "Service Template Version",
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "resource-type": {
+ "description": "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "reservation-id": {
+ "description": "Reservation Id used to send to NPM",
+ "required": false,
+ "type": "string"
+ },
+ "execution-script": {
+ "description": "Python Script to Execute for this Component action, It should refer any one of Prython Artifact Definition for this Node Template.",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "response-data": {
+ "description": "Execution Response Data in JSON format.",
+ "required": false,
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/node_type/component-resource-assignment.json b/ms/controllerblueprints/modules/core/load/model_type/node_type/component-resource-assignment.json
new file mode 100644
index 000000000..34c028482
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/node_type/component-resource-assignment.json
@@ -0,0 +1,68 @@
+{
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "service-template-name": {
+ "description": "Service Template Name.",
+ "required": true,
+ "type": "string"
+ },
+ "service-template-version": {
+ "description": "Service Template Version.",
+ "required": true,
+ "type": "string"
+ },
+ "resource-type": {
+ "description": "Request type.",
+ "required": true,
+ "type": "string"
+ },
+ "template-names": {
+ "description": "Name of the artifact Node Templates, to get the template Content.",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "request-id": {
+ "description": "Request Id, Unique Id for the request.",
+ "required": true,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Resource Id.",
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Action Name of the process",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "resource-assignment-params": {
+ "required": true,
+ "type": "string"
+ },
+ "status": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-activate-netconf.json b/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-activate-netconf.json
new file mode 100644
index 000000000..c638df00c
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-activate-netconf.json
@@ -0,0 +1,66 @@
+{
+ "description": "This is Download Netconf Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-netconf-executor",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+
+ "derived_from": "tosca.nodes.DG"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-config-generator.json b/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-config-generator.json
new file mode 100644
index 000000000..28bace0f0
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-config-generator.json
@@ -0,0 +1,65 @@
+{
+ "description": "This is Activate DG for Config Generator Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-config-generator",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "GenerateConfiguration": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-resource-assign-activate.json b/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-resource-assign-activate.json
new file mode 100644
index 000000000..e98fa5a67
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-resource-assign-activate.json
@@ -0,0 +1,70 @@
+{
+ "description": "This is Resource Assign and Activate Netconf Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "ra-component": {
+ "capability": "component-node",
+ "node": "component-resource-assignment",
+ "relationship": "tosca.relationships.DependsOn"
+ },
+ "netconf-component": {
+ "capability": "component-node",
+ "node": "component-netconf-executor",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignAndActivate": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-resource-assignment.json b/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-resource-assignment.json
new file mode 100644
index 000000000..36fbb6861
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/node_type/dg-resource-assignment.json
@@ -0,0 +1,65 @@
+{
+ "description": "This is Resource Assignment Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-resource-assignment",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/node_type/vnf-netconf-device.json b/ms/controllerblueprints/modules/core/load/model_type/node_type/vnf-netconf-device.json
new file mode 100644
index 000000000..54573bade
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/load/model_type/node_type/vnf-netconf-device.json
@@ -0,0 +1,42 @@
+{
+ "description": "This is VNF Device with Netconf Capability",
+ "version": "1.0.0",
+ "capabilities": {
+ "netconf": {
+ "type": "tosca.capability.Netconf",
+ "properties": {
+ "login-key": {
+ "required": true,
+ "type": "string",
+ "default": "sdnc"
+ },
+ "login-account": {
+ "required": true,
+ "type": "string",
+ "default": "sdnc-tacacs"
+ },
+ "source": {
+ "required": true,
+ "type": "string",
+ "default": "npm"
+ },
+ "target-ip-address": {
+ "required": true,
+ "type": "string"
+ },
+ "port-number": {
+ "required": true,
+ "type": "integer",
+ "default": 830
+ },
+ "connection-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Vnf"
+
+}
diff --git a/ms/controllerblueprints/modules/core/pom.xml b/ms/controllerblueprints/modules/core/pom.xml
new file mode 100644
index 000000000..0e88dd293
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/pom.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps</groupId>
+ <artifactId>controllerblueprints-modules</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>controllerblueprints-core</artifactId>
+ <name>Controller Blueprints Core</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-reflect</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.module</groupId>
+ <artifactId>jackson-module-kotlin</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-yaml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.module</groupId>
+ <artifactId>jackson-module-jsonSchema</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.jsonpath</groupId>
+ <artifactId>json-path</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+<!-- <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </dependency>-->
+ </dependencies>
+
+</project>
+
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
new file mode 100644
index 000000000..1bdd53073
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
@@ -0,0 +1,125 @@
+/*
+ * 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
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+object BluePrintConstants {
+
+ 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 MODEL_CONTENT_TYPE_JSON: String = "JSON"
+ const val MODEL_CONTENT_TYPE_YAML: String = "YAML"
+ const val MODEL_CONTENT_TYPE_YANG: String = "YANG"
+ const val MODEL_CONTENT_TYPE_SCHEMA: String = "SCHEMA"
+
+ const val PATH_DIVIDER: String = "/"
+ 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_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_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_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript"
+
+ 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_ENTRY_DEFINITION_FILE: String = "TOSCA-Metadata/TOSCA.meta"
+ 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 PAYLOAD_CONTENT = "payload-content"
+ const val PAYLOAD_DATA = "payload-data"
+ const val SELECTOR = "selector"
+ const val PROPERTY_CURRENT_INTERFACE = "current-interface"
+ const val PROPERTY_CURRENT_OPERATION = "current-operation"
+ const val PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation"
+
+ const val PROPERTY_ACTION_NAME = "action"
+
+ 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/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintException.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintException.kt
new file mode 100644
index 000000000..5c386c214
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintException.kt
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class BluePrintException : Exception {
+
+ var code: Int = 100
+
+ constructor(cause: Throwable) : super(cause)
+ constructor(message: String) : super(message)
+ constructor(message: String, cause: Throwable) : super(message, cause)
+ constructor(cause: Throwable, message: String, vararg args: Any?) : super(String.format(message, *args), cause)
+
+ constructor(code: Int, cause: Throwable) : super(cause) {
+ this.code = code
+ }
+
+ constructor(code: Int, message: String) : super(message) {
+ this.code = code
+ }
+
+ constructor(code: Int, message: String, cause: Throwable) : super(message, cause) {
+ this.code = code
+ }
+
+ constructor(code: Int, cause: Throwable, message: String, vararg args: Any?)
+ : super(String.format(message, *args), cause) {
+ this.code = code
+ }
+}
+
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt
new file mode 100644
index 000000000..33c811f4a
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt
@@ -0,0 +1,91 @@
+/*
+ * 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
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+object BluePrintTypes {
+
+ @JvmStatic
+ fun validModelTypes(): List<String> {
+ val validTypes: MutableList<String> = arrayListOf()
+ validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE)
+ validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE)
+ validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE)
+ validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE)
+ return validTypes
+ }
+
+ @JvmStatic
+ fun validPropertyTypes(): List<String> {
+ val validTypes: MutableList<String> = arrayListOf()
+ validTypes.add(BluePrintConstants.DATA_TYPE_STRING)
+ validTypes.add(BluePrintConstants.DATA_TYPE_INTEGER)
+ validTypes.add(BluePrintConstants.DATA_TYPE_FLOAT)
+ validTypes.add(BluePrintConstants.DATA_TYPE_BOOLEAN)
+ validTypes.add(BluePrintConstants.DATA_TYPE_TIMESTAMP)
+ validTypes.add(BluePrintConstants.DATA_TYPE_NULL)
+ validTypes.add(BluePrintConstants.DATA_TYPE_LIST)
+ return validTypes
+ }
+
+ @JvmStatic
+ fun validPrimitiveTypes(): List<String> {
+ val validTypes: MutableList<String> = arrayListOf()
+ validTypes.add(BluePrintConstants.DATA_TYPE_STRING)
+ validTypes.add(BluePrintConstants.DATA_TYPE_INTEGER)
+ validTypes.add(BluePrintConstants.DATA_TYPE_FLOAT)
+ validTypes.add(BluePrintConstants.DATA_TYPE_BOOLEAN)
+ validTypes.add(BluePrintConstants.DATA_TYPE_TIMESTAMP)
+ validTypes.add(BluePrintConstants.DATA_TYPE_NULL)
+ return validTypes
+ }
+
+ @JvmStatic
+ fun validCollectionTypes(): List<String> {
+ val validTypes: MutableList<String> = arrayListOf()
+ validTypes.add(BluePrintConstants.DATA_TYPE_LIST)
+ validTypes.add(BluePrintConstants.DATA_TYPE_MAP)
+ return validTypes
+ }
+
+ @JvmStatic
+ fun validCommands(): List<String> {
+ return listOf(BluePrintConstants.EXPRESSION_GET_INPUT,
+ BluePrintConstants.EXPRESSION_GET_ATTRIBUTE,
+ BluePrintConstants.EXPRESSION_GET_PROPERTY,
+ BluePrintConstants.EXPRESSION_GET_ARTIFACT,
+ BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT,
+ BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE)
+ }
+
+ @JvmStatic
+ fun rootNodeTypes(): List<String> {
+ return listOf(BluePrintConstants.MODEL_TYPE_NODES_ROOT)
+ }
+
+ @JvmStatic
+ fun rootDataTypes(): List<String> {
+ return listOf(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)
+ }
+
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
new file mode 100644
index 000000000..bb5a78fd9
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
@@ -0,0 +1,52 @@
+/*
+ * 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
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+object ConfigModelConstant {
+
+ const val MODEL_CONTENT_TYPE_TOSCA_JSON = "TOSCA_JSON"
+ const val MODEL_CONTENT_TYPE_TEMPLATE = "TEMPLATE"
+
+ const val MODEL_TYPE_DATA_TYPE = "tosca.datatypes.Root"
+ const val MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic"
+
+ 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"
+ const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact"
+
+ const val MODEL_TYPE_CAPABILITY_NETCONF = "tosca.capability.Netconf"
+ const val MODEL_TYPE_CAPABILITY_SSH = "tosca.capability.Ssh"
+ const val MODEL_TYPE_CAPABILITY_SFTP = "tosca.capability.Sftp"
+ const val MODEL_TYPE_CAPABILITY_CHEF = "tosca.capability.Chef"
+ const val MODEL_TYPE_CAPABILITY_ANSIBLEF = "tosca.capability.Ansible"
+
+ const val CAPABILITY_PROPERTY_MAPPING = "mapping"
+
+ const val SOURCE_INPUT = "input"
+ const val SOURCE_DEFAULT = "default"
+ const val SOURCE_MDSAL = "mdsal"
+ const val SOURCE_DB = "db"
+
+ const val PROPERTY_RECIPE_NAMES = "action-names"
+
+}
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt
new file mode 100644
index 000000000..7302f2b96
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt
@@ -0,0 +1,75 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core
+
+import org.slf4j.helpers.MessageFormatter
+import java.io.File
+import java.io.InputStream
+import kotlin.reflect.KClass
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+
+fun format(message: String, vararg args: Any?) : String{
+ if(args != null && args.isNotEmpty()){
+ return MessageFormatter.arrayFormat(message, args).message
+ }
+ return message
+}
+
+fun <T : Any> MutableMap<String, *>.getCastOptionalValue(key: String, valueType: KClass<T>): T? {
+ if (containsKey(key)) {
+ return get(key) as? T
+ } else {
+ return null
+ }
+}
+
+fun <T : Any> MutableMap<String, *>.getCastValue(key: String, valueType: KClass<T>): T {
+ if (containsKey(key)) {
+ return get(key) as T
+ } else {
+ throw BluePrintException("couldn't find the key " + key)
+ }
+}
+
+fun checkNotEmpty(value : String?) : Boolean{
+ return value != null && value.isNotEmpty()
+}
+
+fun checkNotEmptyNThrow(value : String?, message : String? = value.plus(" is null/empty ")) : Boolean{
+ val notEmpty = value != null && value.isNotEmpty()
+ if(!notEmpty){
+ throw BluePrintException(message!!)
+ }
+ return notEmpty
+}
+
+fun InputStream.toFile(path: String) : File {
+ val file = File(path)
+ file.outputStream().use { this.copyTo(it) }
+ return file
+}
+
+
+
+
+
+
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/OrchestratorException.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/OrchestratorException.kt
new file mode 100644
index 000000000..68abad154
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/OrchestratorException.kt
@@ -0,0 +1,48 @@
+/*
+ * 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
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class OrchestratorException : Exception {
+ var code: Int = 100
+
+ constructor(message: String, cause: Throwable) : super(message, cause)
+ constructor(message: String) : super(message)
+ constructor(cause: Throwable) : super(cause)
+ constructor(cause: Throwable, message: String, vararg args: Any?) : super(format(message, *args), cause)
+
+ constructor(code: Int, cause: Throwable) : super(cause) {
+ this.code = code
+ }
+
+ constructor(code: Int, message: String) : super(message) {
+ this.code = code
+ }
+
+ constructor(code: Int, message: String, cause: Throwable) : super(message, cause) {
+ this.code = code
+ }
+
+ constructor(code: Int, cause: Throwable, message: String, vararg args: Any?)
+ : super(String.format(message, *args), cause) {
+ this.code = code
+ }
+}
+
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintExpressionData.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintExpressionData.kt
new file mode 100644
index 000000000..c0eb13f92
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintExpressionData.kt
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.data
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+data class ExpressionData(
+ var isExpression: Boolean = false,
+ var valueNode: JsonNode,
+ var expressionNode: ObjectNode? = null,
+ var inputExpression: InputExpression? = null,
+ var propertyExpression: PropertyExpression? = null,
+ var attributeExpression: AttributeExpression? = null,
+ var artifactExpression: ArtifactExpression? = null,
+ var operationOutputExpression: OperationOutputExpression? = null,
+ var command: String? = null
+)
+
+data class InputExpression(
+ var propertyName: String
+)
+
+data class PropertyExpression(
+ var modelableEntityName: String = "SELF",
+ var reqOrCapEntityName: String? = null,
+ var propertyName: String,
+ var subPropertyName: String? = null
+)
+
+data class AttributeExpression(
+ var modelableEntityName: String = "SELF",
+ var reqOrCapEntityName: String? = null,
+ var attributeName: String,
+ var subAttributeName: String? = null
+)
+
+data class ArtifactExpression(
+ val modelableEntityName: String = "SELF",
+ val artifactName: String,
+ val location: String? = "LOCAL_FILE",
+ val remove: Boolean? = false
+)
+
+data class OperationOutputExpression(
+ val modelableEntityName: String = "SELF",
+ val interfaceName: String,
+ val operationName: String,
+ val propertyName: String
+)
+
+
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
new file mode 100644
index 000000000..6d677ffae
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
@@ -0,0 +1,604 @@
+/*
+ * 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.data
+
+import com.fasterxml.jackson.annotation.JsonIgnore
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.fasterxml.jackson.databind.JsonNode
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+open class EntityType {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ var version: String = "1.0.0"
+ var metadata: MutableMap<String, String>? = null
+ @get:JsonProperty("derived_from")
+ lateinit var derivedFrom: String
+ var attributes: MutableMap<String, AttributeDefinition>? = null
+ var properties: MutableMap<String, PropertyDefinition>? = null
+}
+
+/*
+ 5.3.2 tosca.datatypes.org.onap.ccsdk.apps.controllerblueprints.core.data.Credential
+ The org.onap.ccsdk.apps.controllerblueprints.core.data.Credential type is a complex TOSCA data Type used when describing
+ authorization credentials used to access network accessible resources.
+ */
+class Credential {
+ @get:JsonIgnore
+ var id: String? = null
+ var protocol: String? = null
+ @get:JsonProperty("token_type")
+ lateinit var tokenType: String
+ lateinit var token: String
+ var keys: MutableMap<String, String>? = null
+ lateinit var user: String
+}
+
+/*
+3.5.2 Constraint clause
+A constraint clause defines an operation along with one or more compatible values that can be used to define a constraint on a property or parameter’s allowed values when it is defined in a TOSCA Service Template or one of its entities.
+ */
+class ConstraintClause {
+ @get:JsonProperty("equal")
+ var equal: Any? = null
+ @get:JsonProperty("greater_than")
+ var greaterThan: Any? = null
+ @get:JsonProperty("greater_or_equal")
+ var greaterOrEqual: Any? = null
+ @get:JsonProperty("less_than")
+ var lessThan: Any? = null
+ @get:JsonProperty("less_or_equal")
+ var lessOrEqual: Any? = null
+ @get:JsonProperty("in_range")
+ var inRange: Any? = null
+ @get:JsonProperty("valid_values")
+ var validValues: MutableList<Any>? = null
+ @get:JsonProperty("length")
+ var length: Any? = null
+ @get:JsonProperty("min_length")
+ var minLength: Any? = null
+ @get:JsonProperty("max_length")
+ var maxLength: Any? = null
+ @get:JsonProperty("pattern")
+ var pattern: String? = null
+}
+
+/*
+3.5.4 Node Filter definition
+A node filter definition defines criteria for selection of a TOSCA Node Template based upon the template’s property values, capabilities and capability properties.
+ */
+
+class NodeFilterDefinition {
+ var properties: MutableMap<String, PropertyDefinition>? = null
+ var capabilities : MutableList<String>? = null
+}
+
+/*
+3.5.5 Repository definition
+ A repository definition defines a named external repository which contains deployment
+ and implementation artifacts that are referenced within the TOSCA Service Template.
+*/
+class RepositoryDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ lateinit var url: String
+ var credential: Credential? = null
+}
+
+
+/*
+3.5.6 Artifact definition
+An artifact definition defines a named, typed file that can be associated with Node Type
+or Node Template and used by orchestration engine to facilitate deployment and implementation of interface operations.
+ */
+class ArtifactDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ var type: String? = null
+ var file: String? = null
+ var repository: String? = null
+ var description: String? = null
+ @get:JsonProperty("deploy_Path")
+ var deployPath: String? = null
+ var properties: MutableMap<String, JsonNode>? = null
+ var content: String? = null
+ @Deprecated("Mapping content is define by the Type")
+ var mappingContent: String? = null
+}
+
+
+/*
+3.5.7 Import definition
+An import definition is used within a TOSCA Service Template to locate and uniquely name
+another TOSCA Service Template file which has type and template definitions to be imported (included)
+and referenced within another Service Template.
+ */
+class ImportDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ lateinit var file: String
+ var repository: String? = null
+ @get:JsonProperty("namespace_uri")
+ var namespaceUri: String? = null
+ @get:JsonProperty("namespace_prefix")
+ var namespacePrefix: String? = null
+}
+
+/*
+3.5.8 Property definition A property definition defines a named, typed value and related data that can be associated with an
+entity defined in this specification (e.g., Node Types, Relationship Types, Capability Types, etc.).
+Properties are used by template authors to provide input values to TOSCA entities which indicate their “desired state†when they are
+instantiated. The value of a property can be retrieved using the get_property function within TOSCA Service Templates.
+ */
+class PropertyDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ var required: Boolean? = null
+ var type: String? = null
+ @get:JsonProperty("default")
+ var defaultValue: Any? = null
+ var status: String? = null
+ var constraints: MutableList<ConstraintClause>? = null
+ @get:JsonProperty("entry_schema")
+ var entrySchema: EntrySchema? = null
+ var value: Any? = null
+}
+
+
+/*
+3.5.10 Attribute definition
+
+An attribute definition defines a named, typed value that can be associated with an entity defined in this
+specification (e.g., a Node, Relationship or Capability Type). Specifically, it is used to expose the
+“actual state†of some property of a TOSCA entity after it has been deployed and instantiated
+(as set by the TOSCA orchestrator). Attribute values can be retrieved via the get_attribute function
+from the instance model and used as values to other entities within TOSCA Service Templates.
+ */
+
+class AttributeDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ lateinit var type: String
+ @JsonProperty("default")
+ var _default: Any? = null
+ var status: String? = null
+ @JsonProperty("entry_schema")
+ var entry_schema: String? = null
+}
+
+/*
+3.5.13 Operation definition
+An operation definition defines a named function or procedure that can be bound to an implementation artifact (e.g., a script).
+ */
+class OperationDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ var implementation: Implementation? = null
+ var inputs: MutableMap<String, PropertyDefinition>? = null
+ var outputs: MutableMap<String, PropertyDefinition>? = null
+}
+
+class Implementation {
+ var primary: String? = null
+ var dependencies: MutableList<String>? = null
+}
+
+/*
+3.5.14 Interface definition
+An interface definition defines a named interface that can be associated with a Node or Relationship Type
+ */
+class InterfaceDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ var type: String? = null
+ var operations: MutableMap<String, OperationDefinition>? = null
+ var inputs: MutableMap<String, PropertyDefinition>? = null
+}
+
+/*
+3.5.15 Event Filter definition
+An event filter definition defines criteria for selection of an attribute, for the purpose of monitoring it, within a TOSCA entity, or one its capabilities.
+ */
+class EventFilterDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ lateinit var node: String
+ var requirement: String? = null
+ var capability: String? = null
+}
+
+/*
+3.5.16 Trigger definition TODO
+A trigger definition defines the event, condition and action that is used to “trigger†a policy it is associated with.
+ */
+class TriggerDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ @get:JsonProperty("event_type")
+ lateinit var eventType: String
+ lateinit var action: String
+}
+
+/*
+ 3.5.17 org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow activity definition
+ A workflow activity defines an operation to be performed in a TOSCA workflow. Activities allows to:
+ · Delegate the workflow for a node expected to be provided by the orchestrator
+ · Set the state of a node
+ · Call an operation defined on a TOSCA interface of a node, relationship or group
+ · Inline another workflow defined in the topology (to allow reusability)
+ */
+class Activity {
+ var delegate: String? = null
+ @get:JsonProperty("set_state")
+ var setState: String? = null
+ @get:JsonProperty("call_operation")
+ var callOperation: String? = null
+ var inlines: ArrayList<String>? = null
+}
+
+/*
+3.5.20 org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow precondition definition
+A workflow condition can be used as a filter or precondition to check if a workflow can be processed or not based on the state of the instances of a TOSCA topology deployment. When not met, the workflow will not be triggered.
+ */
+class PreConditionDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ lateinit var target: String
+ @get:JsonProperty("target_relationship")
+ lateinit var targetRelationship: String
+ lateinit var condition: ArrayList<ConditionClause>
+}
+
+/*
+3.5.21 org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow step definition
+A workflow step allows to define one or multiple sequenced activities in a workflow and how they are connected to other steps in the workflow. They are the building blocks of a declarative workflow.
+ */
+class Step {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ var target: String? = null
+ @JsonProperty("target_relationship")
+ var targetRelationship: String? = null
+ @JsonProperty("operation_host")
+ var operationHost: String? = null
+ var activities: ArrayList<Activity>? = null
+ @get:JsonProperty("on_success")
+ var onSuccess: ArrayList<String>? = null
+ @get:JsonProperty("on_failure")
+ var onFailure: ArrayList<String>? = null
+}
+
+/*
+3.6.2 Capability definition
+A capability definition defines a named, typed set of data that can be associated with Node Type or Node Template to describe a transparent capability or feature of the software component the node describes.
+ */
+
+class CapabilityDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ var type: String? = null
+ var description: String? = null
+ var properties: MutableMap<String, PropertyDefinition>? = null
+ @get:JsonProperty("valid_source_types")
+ var validSourceTypes: MutableList<String>? = null
+ var occurrences: MutableList<Any>? = null
+}
+
+/*
+3.6.3 Requirement definition
+The Requirement definition describes a named requirement (dependencies) of a TOSCA Node Type or Node template which needs to be fulfilled by a matching Capability definition declared by another TOSCA modelable entity. The requirement definition may itself include the specific name of the fulfilling entity (explicitly) or provide an abstract type, along with additional filtering characteristics, that a TOSCA orchestrator can use to fulfill the capability at runtime (implicitly).
+ */
+class RequirementDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ var capability: String? = null
+ var node: String? = null
+ var relationship: String? = null
+ var occurrences: MutableList<Any>? = null
+}
+
+/*
+3.6.4 Artifact Type
+An Artifact Type is a reusable entity that defines the type of one or more files that are used to define implementation or deployment artifacts that are referenced by nodes or relationships on their operations.
+ */
+class ArtifactType : EntityType() {
+ @get:JsonProperty("mime_type")
+ var mimeType: String? = null
+ @get:JsonProperty("file_ext")
+ var fileExt: MutableList<String>? = null
+
+}
+
+/*
+3.6.6 Data Type
+A Data Type definition defines the schema for new named datatypes in TOSCA.
+ */
+
+class DataType : EntityType(){
+ var constraints: MutableList<MutableMap<String, Any>>? = null
+}
+
+/*
+3.6.9 Node Type
+A Node Type is a reusable entity that defines the type of one or more Node Templates. As such, a Node Type defines the structure of observable properties via a Properties Definition, the Requirements and Capabilities of the node as well as its supported interfaces.
+
+ */
+
+class NodeType : EntityType() {
+ var capabilities: MutableMap<String, CapabilityDefinition>? = null
+ var requirements: MutableMap<String, RequirementDefinition>? = null
+ var interfaces: MutableMap<String, InterfaceDefinition>? = null
+ var artifacts: MutableMap<String, ArtifactDefinition>? = null
+}
+
+/*
+3.6.8 Requirement Type
+A Requirement Type is a reusable entity that describes a kind of requirement that a Node Type can declare to expose. The TOSCA Simple Profile seeks to simplify the need for declaring specific Requirement Types from nodes and instead rely upon nodes declaring their features sets using TOSCA Capability Types along with a named Feature notation.
+ */
+
+class RequirementType : EntityType() {
+ var requirements: MutableMap<String, RequirementDefinition>? = null
+ var capabilities: MutableMap<String, CapabilityDefinition>? = null
+ var interfaces: MutableMap<String, InterfaceDefinition>? = null
+ var artifacts: MutableMap<String, ArtifactDefinition>? = null
+}
+
+/*
+3.6.10 Relationship Type
+A Relationship Type is a reusable entity that defines the type of one or more relationships between Node Types or Node Templates.
+*/
+
+class RelationshipType : EntityType() {
+ var interfaces: MutableMap<String, InterfaceDefinition>? = null
+ @get:JsonProperty("valid_target_types")
+ var validTargetTypes: ArrayList<String>? = null
+}
+
+/*
+3.6.11 Group Type
+A Group Type defines logical grouping types for nodes, typically for different management purposes.
+Groups can effectively be viewed as logical nodes that are not part of the physical deployment topology
+ of an application, yet can have capabilities and the ability to attach policies and interfaces
+ that can be applied (depending on the group type) to its member nodes.
+ */
+
+class GroupType : EntityType() {
+ var members: MutableList<String>? = null
+ var requirements: ArrayList<RequirementDefinition>? = null
+ var capabilities: MutableMap<String, CapabilityDefinition>? = null
+ var interfaces: MutableMap<String, InterfaceDefinition>? = null
+
+}
+
+/*
+ 3.6.12 Policy Type
+ A Policy Type defines a type of requirement that affects or governs an application or service’s
+ topology at some stage of its lifecycle, but is not explicitly part of the topology itself
+ (i.e., it does not prevent the application or service from being deployed or run if it did not exist).
+ */
+class PolicyType : EntityType(){
+ lateinit var targets: MutableList<String>
+}
+
+/*
+3.7.1 Capability assignment
+A capability assignment allows node template authors to assign values to properties and attributes for a named capability definition that is part of a Node Template’s type definition.
+ */
+class CapabilityAssignment {
+ @get:JsonIgnore
+ var id: String? = null
+ var attributes: MutableMap<String, JsonNode>? = null
+ var properties: MutableMap<String, JsonNode>? = null
+}
+
+/*
+3.7.4 Relationship Template
+A Relationship Template specifies the occurrence of a manageable relationship between node templates as part of an application’s topology model that is defined in a TOSCA Service Template. A Relationship template is an instance of a specified Relationship Type and can provide customized properties, constraints or operations which override the defaults provided by its Relationship Type and its implementations.
+ */
+class GroupDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ lateinit var type: String
+ var description: String? = null
+ var metadata : MutableMap<String, String>? = null
+ var properties : MutableMap<String, JsonNode>? = null
+ var members = ArrayList<String>()
+ var interfaces : MutableMap<String, InterfaceDefinition>?= null
+}
+
+/*
+3.7.6 Policy definition
+A policy definition defines a policy that can be associated with a TOSCA topology or top-level entity definition (e.g., group definition, node template, etc.).
+ */
+class PolicyDefinition {
+ @get:JsonIgnore
+ var id: String? = null
+ lateinit var type: String
+ var description: String? = null
+ var metadata: MutableMap<String, String>? = null
+ var properties: MutableMap<String, JsonNode>? = null
+ var targets: MutableList<String>? = null
+}
+
+
+/*
+3.8 Topology Template definition
+This section defines the topology template of a cloud application. The main ingredients of the topology template are node templates representing components of the application and relationship templates representing links between the components. These elements are defined in the nested node_templates section and the nested relationship_templates sections, respectively. Furthermore, a topology template allows for defining input parameters, output parameters as well as grouping of node templates.
+ */
+class TopologyTemplate {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ var inputs: MutableMap<String, PropertyDefinition>? = null
+ @get:JsonProperty("node_templates")
+ var nodeTemplates: MutableMap<String, NodeTemplate>? = null
+ @get:JsonProperty("relationship_templates")
+ var relationshipTemplates: MutableMap<String, RelationshipTemplate>? = null
+ var policies: MutableMap<String, PolicyDefinition>? = null
+ var outputs: MutableMap<String, PropertyDefinition>? = null
+ @get:JsonProperty("substitution_mappings")
+ var substitutionMappings: Any? = null
+ var workflows: MutableMap<String, Workflow>? = null
+}
+
+class SubstitutionMapping {
+ @get:JsonProperty("node_type")
+ lateinit var nodeType: String
+ lateinit var capabilities: ArrayList<String>
+ lateinit var requirements: ArrayList<String>
+}
+
+class EntrySchema {
+ lateinit var type: String
+ var constraints: MutableList<MutableMap<String, Any>>? = null
+}
+
+class InterfaceAssignment {
+ @get:JsonIgnore
+ var id: String? = null
+ var operations: MutableMap<String, OperationAssignment>? = null
+ var inputs: MutableMap<String, JsonNode>? = null
+}
+
+/*
+3.7.3 Node Template
+A Node Template specifies the occurrence of a manageable software component as part of an application’s topology model which is defined in a TOSCA Service Template. A Node template is an instance of a specified Node Type and can provide customized properties, constraints or operations which override the defaults provided by its Node Type and its implementations.
+ */
+
+class NodeTemplate {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ lateinit var type: String
+ var metadata: MutableMap<String, String>? = null
+ var directives: MutableList<String>? = null
+ //@get:JsonSerialize(using = PropertyDefinitionValueSerializer::class)
+ var properties: MutableMap<String, JsonNode>? = null
+ var attributes: MutableMap<String, JsonNode>? = null
+ var capabilities: MutableMap<String, CapabilityAssignment>? = null
+ var requirements: MutableMap<String, RequirementAssignment>? = null
+ var interfaces: MutableMap<String, InterfaceAssignment>? = null
+ var artifacts: MutableMap<String, ArtifactDefinition>? = null
+ @get:JsonProperty("node_filter")
+ var nodeFilter: NodeFilterDefinition? = null
+ var copy: String? = null
+}
+
+class OperationAssignment {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ var implementation: Implementation? = null
+ var inputs: MutableMap<String, JsonNode>? = null
+ var outputs: MutableMap<String, JsonNode>? = null
+}
+
+/*
+3.7.4 Relationship Template
+A Relationship Template specifies the occurrence of a manageable relationship between node templates as part of an application’s topology model that is defined in a TOSCA Service Template. A Relationship template is an instance of a specified Relationship Type and can provide customized properties, constraints or operations which override the defaults provided by its Relationship Type and its implementations.
+ */
+
+class RelationshipTemplate {
+ var type: String? = null
+ var description: String? = null
+ var metadata: MutableMap<String, String>? = null
+ var properties: MutableMap<String, PropertyDefinition>? = null
+ var attributes: MutableMap<String, JsonNode>? = null
+ var interfaces: MutableMap<String, InterfaceDefinition>? = null
+ var copy: String? = null
+}
+
+/*
+3.7.2 Requirement assignment
+A Requirement assignment allows template authors to provide either concrete names of TOSCA templates or provide abstract selection criteria for providers to use to find matching TOSCA templates that are used to fulfill a named requirement’s declared TOSCA Node Type.
+ */
+
+class RequirementAssignment {
+ @get:JsonIgnore
+ var id: String? = null
+ var capability: String? = null
+ var node: String? = null
+ //Relationship Type or Relationship Template
+ var relationship: String? = null
+}
+
+
+class Workflow {
+ @get:JsonIgnore
+ var id: String? = null
+ var description: String? = null
+ var steps: MutableMap<String, Step>? = null
+ var preconditions: ArrayList<PreConditionDefinition>? = null
+ var inputs: MutableMap<String, PropertyDefinition>? = null
+}
+
+
+class ConditionClause {
+ var and: ArrayList<MutableMap<String, Any>>? = null
+ var or: ArrayList<MutableMap<String, Any>>? = null
+ @get:JsonProperty("assert")
+ var assertConditions: ArrayList<MutableMap<String, Any>>? = null
+}
+
+/*
+3.9 Service Template definition
+A TOSCA Service Template (YAML) document contains element definitions of building blocks for cloud application, or complete models of cloud applications. This section describes the top-level structural elements (TOSCA keynames) along with their grammars, which are allowed to appear in a TOSCA Service Template document.
+ */
+
+class ServiceTemplate {
+ @get:JsonIgnore
+ var id: String? = null
+ @get:JsonProperty("tosca_definitions_version")
+ var toscaDefinitionsVersion: String = "controller_blueprint_1_0_0"
+ var metadata: MutableMap<String, String>? = null
+ var description: String? = null
+ @get:JsonProperty("dsl_definitions")
+ var dslDefinitions: MutableMap<String, Any>? = null
+ var repositories: MutableMap<String, RepositoryDefinition>? = null
+ var imports: MutableList<ImportDefinition>? = null
+ @get:JsonProperty("artifact_types")
+ var artifactTypes: MutableMap<String, ArtifactType>? = null
+ @get:JsonProperty("data_types")
+ var dataTypes: MutableMap<String, DataType>? = null
+ @get:JsonProperty("node_types")
+ var nodeTypes: MutableMap<String, NodeType>? = null
+ @get:JsonProperty("policy_types")
+ var policyTypes: PolicyType? = null
+ @get:JsonProperty("topology_template")
+ var topologyTemplate: TopologyTemplate? = null
+}
+
+class ToscaMetaData {
+ lateinit var toscaMetaFileVersion: String
+ lateinit var csarVersion: String
+ lateinit var createdBy: String
+ lateinit var entityDefinitions: String
+ var templateTags: String? = null
+}
+
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintEnhancerFactory.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintEnhancerFactory.kt
new file mode 100644
index 000000000..2a2963599
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintEnhancerFactory.kt
@@ -0,0 +1,45 @@
+/*
+ * 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.factory
+
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerService
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+
+/**
+ * BluePrintEnhancerFactory
+ * @author Brinda Santh
+ *
+ */
+
+object BluePrintEnhancerFactory {
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ var bluePrintEnhancerServices: MutableMap<String, BluePrintEnhancerService> = HashMap()
+
+ fun register(key: String, bluePrintEnhancerService: BluePrintEnhancerService) {
+ bluePrintEnhancerServices[key] = bluePrintEnhancerService
+ }
+
+ /**
+ * Called by clients to get a Blueprint Parser for the Blueprint parser type
+ */
+ fun instance(key: String): BluePrintEnhancerService? {
+ return bluePrintEnhancerServices.get(key)
+ }
+}
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintParserFactory.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintParserFactory.kt
new file mode 100644
index 000000000..10eb0e678
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintParserFactory.kt
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.factory
+
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintParserDefaultService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintParserService
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+/**
+ *
+ * BluePrintParserFactory
+ * @author Brinda Santh
+ */
+
+object BluePrintParserFactory {
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ var bluePrintParserServices: MutableMap<String, BluePrintParserService> = HashMap()
+
+ init {
+ logger.info("Initialised default BluePrintParser Service ")
+ bluePrintParserServices.put(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.TYPE_DEFAULT, BluePrintParserDefaultService())
+ }
+
+ fun register(key:String, bluePrintParserService: BluePrintParserService){
+ bluePrintParserServices.put(key, bluePrintParserService)
+ }
+
+ /**
+ * Called by clients to get a Blueprint Parser for the Blueprint parser type
+ */
+ fun instance(key : String) : BluePrintParserService? {
+ return bluePrintParserServices.get(key)
+ }
+}
+
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintValidatorFactory.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintValidatorFactory.kt
new file mode 100644
index 000000000..63f788a2f
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintValidatorFactory.kt
@@ -0,0 +1,45 @@
+/*
+ * 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.factory
+
+
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintValidatorDefaultService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintValidatorService
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+
+object BluePrintValidatorFactory {
+
+ var bluePrintValidatorServices: MutableMap<String, BluePrintValidatorService> = HashMap()
+
+ init {
+ bluePrintValidatorServices[org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.TYPE_DEFAULT] = BluePrintValidatorDefaultService()
+ }
+
+ fun register(key:String, bluePrintValidatorService: BluePrintValidatorService){
+ bluePrintValidatorServices[key] = bluePrintValidatorService
+ }
+
+ fun instance(key : String) : BluePrintValidatorService?{
+ return bluePrintValidatorServices[key]
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintChainedService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintChainedService.kt
new file mode 100644
index 000000000..065176342
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintChainedService.kt
@@ -0,0 +1,117 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class BluePrintChainedService {
+ var bpc : BluePrintContext
+
+ constructor(bpc : BluePrintContext){
+ this.bpc = bpc
+ }
+
+ fun nodeTypeChained(nodeTypeName: String): NodeType {
+
+ val nodeType: NodeType = bpc.nodeTypeByName(nodeTypeName)
+ val attributes = hashMapOf<String, AttributeDefinition>()
+ val properties = hashMapOf<String, PropertyDefinition>()
+ val requirements = hashMapOf<String, RequirementDefinition>()
+ val capabilities = hashMapOf<String, CapabilityDefinition>()
+ val interfaces = hashMapOf<String, InterfaceDefinition>()
+ val artifacts = hashMapOf<String, ArtifactDefinition>()
+
+ recNodeTypesChained(nodeTypeName).forEach { nodeType ->
+
+ val subAttributes = bpc.nodeTypeByName(nodeType.id!!).attributes
+ if (subAttributes != null) {
+ attributes.putAll(subAttributes)
+ }
+
+ val subProperties = bpc.nodeTypeByName(nodeType.id!!).properties
+ if (subProperties != null) {
+ properties.putAll(subProperties)
+ }
+
+ val subRequirements = bpc.nodeTypeByName(nodeType.id!!).requirements
+ if (subRequirements != null) {
+ requirements.putAll(subRequirements)
+ }
+ val subCapabilities = bpc.nodeTypeByName(nodeType.id!!).capabilities
+ if (subCapabilities != null) {
+ capabilities.putAll(subCapabilities)
+ }
+ val subInterfaces = bpc.nodeTypeByName(nodeType.id!!).interfaces
+ if (subInterfaces != null) {
+ interfaces.putAll(subInterfaces)
+ }
+
+ val subArtifacts = bpc.nodeTypeByName(nodeType.id!!).artifacts
+ if (subArtifacts != null) {
+ artifacts.putAll(subArtifacts)
+ }
+ }
+ nodeType.attributes = attributes
+ nodeType.properties = properties
+ nodeType.requirements = requirements
+ nodeType.capabilities = capabilities
+ nodeType.interfaces = interfaces
+ nodeType.artifacts = artifacts
+ return nodeType
+ }
+
+ fun nodeTypeChainedProperties(nodeTypeName: String): MutableMap<String, PropertyDefinition>? {
+ val nodeType = bpc.nodeTypeByName(nodeTypeName)
+ val properties = hashMapOf<String, PropertyDefinition>()
+
+ recNodeTypesChained(nodeTypeName).forEach { nodeType ->
+ val subProperties = bpc.nodeTypeByName(nodeType.id!!).properties
+ if (subProperties != null) {
+ properties.putAll(subProperties)
+ }
+ }
+ return properties
+ }
+
+ private fun recNodeTypesChained(nodeTypeName: String, nodeTypes: MutableList<NodeType>? = arrayListOf()): MutableList<NodeType> {
+ val nodeType: NodeType = bpc.nodeTypeByName(nodeTypeName)
+ nodeType.id = nodeTypeName
+ val derivedFrom: String = nodeType.derivedFrom
+ if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
+ recNodeTypesChained(derivedFrom, nodeTypes)
+ }
+ nodeTypes!!.add(nodeType)
+ return nodeTypes
+ }
+
+ private fun recDataTypesChained(dataTypeName: String, dataTypes: MutableList<DataType>? = arrayListOf()): MutableList<DataType> {
+ val dataType: DataType = bpc.dataTypeByName(dataTypeName)!!
+ dataType.id = dataTypeName
+ val derivedFrom: String = dataType.derivedFrom
+ if (!BluePrintTypes.rootDataTypes().contains(derivedFrom)) {
+ recDataTypesChained(derivedFrom, dataTypes)
+ }
+ dataTypes!!.add(dataType)
+ return dataTypes
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
new file mode 100644
index 000000000..dde1d58c7
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
@@ -0,0 +1,177 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class BluePrintContext(serviceTemplate: ServiceTemplate) {
+
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ val serviceTemplate: ServiceTemplate = serviceTemplate
+
+ val imports: List<ImportDefinition>? = serviceTemplate.imports
+
+ val metadata: MutableMap<String, String>? = serviceTemplate.metadata
+
+ val dataTypes: MutableMap<String, DataType>? = serviceTemplate.dataTypes
+
+ val inputs: MutableMap<String, PropertyDefinition>? = serviceTemplate.topologyTemplate?.inputs
+
+ val workflows: MutableMap<String, Workflow>? = serviceTemplate.topologyTemplate?.workflows
+
+ fun blueprintJson(pretty: Boolean = false): String = print("json", pretty)
+
+ fun blueprintYaml(pretty: Boolean = false): String = print("yaml", pretty)
+
+ private fun print(type: String? = "json", pretty: Boolean = false): String {
+ return JacksonUtils.getJson(serviceTemplate, pretty)
+ }
+
+ // Workflow
+ fun workflowByName(name: String): Workflow? = workflows?.get(name)
+
+ // Data Type
+ fun dataTypeByName(name: String): DataType? = dataTypes?.get(name)
+
+ // Artifact Type
+ val artifactTypes: MutableMap<String, ArtifactType>? = serviceTemplate.artifactTypes
+
+ // Node Type Methods
+ val nodeTypes: MutableMap<String, NodeType>? = serviceTemplate.nodeTypes
+
+ fun nodeTypeByName(name: String): NodeType =
+ nodeTypes?.get(name) ?: throw BluePrintException(String.format("Failed to get node type for the name : %s", name))
+
+ fun nodeTypeDerivedFrom(name: String): MutableMap<String, NodeType>? {
+ return nodeTypes?.filterValues { nodeType -> nodeType.derivedFrom == name }?.toMutableMap()
+ }
+
+ fun nodeTypeInterface(nodeTypeName: String, interfaceName: String): InterfaceDefinition? {
+ return nodeTypeByName(nodeTypeName).interfaces?.values?.first()
+ }
+
+ fun nodeTypeInterfaceOperation(nodeTypeName: String, interfaceName: String, operationName: String): OperationDefinition? {
+ return nodeTypeInterface(nodeTypeName, interfaceName)?.operations?.get(operationName)
+ }
+
+ fun interfaceNameForNodeType(nodeTypeName: String): String? {
+ return nodeTypeByName(nodeTypeName).interfaces?.keys?.first()
+ }
+
+ fun nodeTypeInterfaceOperationInputs(nodeTypeName: String, interfaceName: String, operationName: String): MutableMap<String, PropertyDefinition>? {
+ return nodeTypeInterfaceOperation(nodeTypeName, interfaceName, operationName)?.inputs
+ }
+
+ fun nodeTypeInterfaceOperationOutputs(nodeTypeName: String, interfaceName: String, operationName: String): MutableMap<String, PropertyDefinition>? {
+ return nodeTypeInterfaceOperation(nodeTypeName, interfaceName, operationName)?.outputs
+ }
+
+ // Node Template Methods
+ val nodeTemplates: MutableMap<String, NodeTemplate>? = serviceTemplate.topologyTemplate?.nodeTemplates
+
+ fun nodeTemplateByName(name: String): NodeTemplate =
+ nodeTemplates?.get(name) ?: throw BluePrintException("Failed to get node template for the name " + name)
+
+ fun nodeTemplateForNodeType(name: String): MutableMap<String, NodeTemplate>? {
+ return nodeTemplates?.filterValues { nodeTemplate -> nodeTemplate.type == name }?.toMutableMap()
+ }
+
+ fun nodeTemplateNodeType(nodeTemplateName: String): NodeType {
+ val nodeTemplateType: String = nodeTemplateByName(nodeTemplateName).type
+ return nodeTypeByName(nodeTemplateType)
+ }
+
+ fun nodeTemplateProperty(nodeTemplateName: String, propertyName: String): Any? {
+ return nodeTemplateByName(nodeTemplateName).properties?.get(propertyName)
+ }
+
+ fun nodeTemplateArtifacts(nodeTemplateName: String): MutableMap<String, ArtifactDefinition>? {
+ return nodeTemplateByName(nodeTemplateName).artifacts
+ }
+
+ fun nodeTemplateArtifact(nodeTemplateName: String, artifactName: String): ArtifactDefinition? {
+ return nodeTemplateArtifacts(nodeTemplateName)?.get(artifactName)
+ }
+
+ fun nodeTemplateFirstInterface(nodeTemplateName: String): InterfaceAssignment? {
+ return nodeTemplateByName(nodeTemplateName).interfaces?.values?.first()
+ }
+
+ fun nodeTemplateFirstInterfaceName(nodeTemplateName: String): String? {
+ return nodeTemplateByName(nodeTemplateName).interfaces?.keys?.first()
+ }
+
+ fun nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName: String): String? {
+ return nodeTemplateFirstInterface(nodeTemplateName)?.operations?.keys?.first()
+ }
+
+ fun nodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>? {
+ return nodeTemplateByName(nodeTemplateName).interfaces?.get(interfaceName)?.operations?.get(operationName)?.inputs
+ }
+
+ fun nodeTemplateInterfaceOperationOutputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>? {
+ return nodeTemplateByName(nodeTemplateName).interfaces?.get(interfaceName)?.operations?.get(operationName)?.outputs
+ }
+
+ fun nodeTemplateInterface(nodeTemplateName: String, interfaceName: String): InterfaceAssignment? {
+ return nodeTemplateByName(nodeTemplateName).interfaces?.get(interfaceName)
+ }
+
+
+ fun nodeTemplateInterfaceOperation(nodeTemplateName: String, interfaceName: String, operationName: String): OperationAssignment? {
+ return nodeTemplateInterface(nodeTemplateName, interfaceName)?.operations?.get(operationName)
+ }
+
+ fun nodeTemplateCapability(nodeTemplateName: String, capabilityName: String): CapabilityAssignment? {
+ return nodeTemplateByName(nodeTemplateName).capabilities?.get(capabilityName)
+ }
+
+ fun nodeTemplateRequirement(nodeTemplateName: String, requirementName: String): RequirementAssignment? {
+ return nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)
+ }
+
+ fun nodeTemplateRequirementNode(nodeTemplateName: String, requirementName: String): NodeTemplate {
+ val nodeTemplateName: String = nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)?.node
+ ?: throw BluePrintException(String.format("failed to get node name for node template's (%s) requirement's (%s) " + nodeTemplateName, requirementName))
+ return nodeTemplateByName(nodeTemplateName)
+ }
+
+ fun nodeTemplateCapabilityProperty(nodeTemplateName: String, capabilityName: String, propertyName: String): Any? {
+ return nodeTemplateCapability(nodeTemplateName, capabilityName)?.properties?.get(propertyName)
+ }
+
+ // Chained Functions
+
+ fun nodeTypeChained(nodeTypeName: String): NodeType {
+ return BluePrintChainedService(this).nodeTypeChained(nodeTypeName)
+ }
+
+ fun nodeTypeChainedProperties(nodeTypeName: String): MutableMap<String, PropertyDefinition>? {
+ return BluePrintChainedService(this).nodeTypeChainedProperties(nodeTypeName)
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoService.kt
new file mode 100644
index 000000000..5369d509b
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoService.kt
@@ -0,0 +1,92 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import org.apache.commons.io.FileUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import java.io.File
+import java.io.Serializable
+import java.nio.charset.Charset
+
+/**
+ * BluePrintEnhancerRepoFileService
+ * @author Brinda Santh
+ *
+ */
+
+interface BluePrintEnhancerRepoService : Serializable {
+
+ @Throws(BluePrintException::class)
+ fun getNodeType(nodeTypeName: String): NodeType?
+
+ @Throws(BluePrintException::class)
+ fun getDataType(dataTypeName: String): DataType?
+
+ @Throws(BluePrintException::class)
+ fun getArtifactType(artifactTypeName: String): ArtifactType?
+
+ @Throws(BluePrintException::class)
+ fun getRelationshipType(relationshipTypeName: String): RelationshipType?
+
+ @Throws(BluePrintException::class)
+ fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition?
+
+}
+
+
+class BluePrintEnhancerRepoFileService(val basePath: String) : BluePrintEnhancerRepoService {
+
+ val dataTypePath = basePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ val nodeTypePath = basePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE)
+ val artifactTypePath = basePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE)
+ val capabilityTypePath = basePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE)
+ val relationshipTypePath = basePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE)
+ val extension = ".json"
+
+ override fun getDataType(dataTypeName: String): DataType? {
+ val content = FileUtils.readFileToString(File(dataTypePath.plus(BluePrintConstants.PATH_DIVIDER)
+ .plus(dataTypeName).plus(extension)), Charset.defaultCharset())
+ return JacksonUtils.readValue(content)
+ }
+
+ override fun getNodeType(nodeTypeName: String): NodeType? {
+ val content = FileUtils.readFileToString(File(nodeTypePath.plus(BluePrintConstants.PATH_DIVIDER)
+ .plus(nodeTypeName).plus(extension)), Charset.defaultCharset())
+ return JacksonUtils.readValue(content)
+ }
+
+ override fun getArtifactType(artifactTypeName: String): ArtifactType? {
+ val content = FileUtils.readFileToString(File(artifactTypePath.plus(BluePrintConstants.PATH_DIVIDER)
+ .plus(artifactTypeName).plus(extension)), Charset.defaultCharset())
+ return JacksonUtils.readValue(content)
+ }
+
+ override fun getRelationshipType(relationshipTypeName: String): RelationshipType? {
+ val content = FileUtils.readFileToString(File(relationshipTypePath.plus(BluePrintConstants.PATH_DIVIDER)
+ .plus(relationshipTypeName).plus(extension)), Charset.defaultCharset())
+ return JacksonUtils.readValue(content)
+ }
+
+ override fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition? {
+ val content = FileUtils.readFileToString(File(capabilityTypePath.plus(BluePrintConstants.PATH_DIVIDER)
+ .plus(capabilityDefinitionName).plus(extension)), Charset.defaultCharset())
+ return JacksonUtils.readValue(content)
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt
new file mode 100644
index 000000000..8f1728762
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt
@@ -0,0 +1,240 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*
+import org.onap.ccsdk.apps.controllerblueprints.core.format
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.io.Serializable
+
+/**
+ * BluePrintEnhancerService
+ * @author Brinda Santh
+ *
+ */
+interface BluePrintEnhancerService : Serializable {
+
+ @Throws(BluePrintException::class)
+ fun enhance(content: String): ServiceTemplate
+
+ @Throws(BluePrintException::class)
+ fun enhance(serviceTemplate: ServiceTemplate): ServiceTemplate
+
+ /**
+ * Read Blueprint from CSAR structure Directory
+ */
+ @Throws(BluePrintException::class)
+ fun enhance(fileName: String, basePath: String): ServiceTemplate
+}
+
+open class BluePrintEnhancerDefaultService(val bluePrintEnhancerRepoService: BluePrintEnhancerRepoService) : BluePrintEnhancerService {
+
+ private val log: Logger = LoggerFactory.getLogger(BluePrintEnhancerDefaultService::class.java)
+
+ lateinit var serviceTemplate: ServiceTemplate
+
+ override fun enhance(content: String): ServiceTemplate {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun enhance(fileName: String, basePath: String): ServiceTemplate {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun enhance(serviceTemplate: ServiceTemplate): ServiceTemplate {
+ this.serviceTemplate = serviceTemplate
+ initialCleanUp()
+ enrichTopologyTemplate(serviceTemplate)
+
+ // log.info("Enriched Blueprint :\n {}", JacksonUtils.getJson(serviceTemplate, true))
+ return this.serviceTemplate
+ }
+
+ open fun initialCleanUp() {
+ serviceTemplate.artifactTypes?.clear()
+ serviceTemplate.nodeTypes?.clear()
+ serviceTemplate.dataTypes?.clear()
+
+ serviceTemplate.artifactTypes = HashMap()
+ serviceTemplate.nodeTypes = HashMap()
+ serviceTemplate.dataTypes = HashMap()
+
+ }
+
+ open fun enrichTopologyTemplate(serviceTemplate: ServiceTemplate) {
+ serviceTemplate.topologyTemplate?.let { topologyTemplate ->
+ enrichTopologyTemplateInputs(topologyTemplate)
+ enrichTopologyTemplateNodeTemplates(topologyTemplate)
+ }
+ }
+
+ open fun enrichTopologyTemplateInputs(topologyTemplate: TopologyTemplate) {
+ topologyTemplate.inputs?.let { inputs ->
+ enrichPropertyDefinitions(inputs)
+ }
+ }
+
+ open fun enrichTopologyTemplateNodeTemplates(topologyTemplate: TopologyTemplate) {
+ topologyTemplate.nodeTemplates?.forEach { nodeTemplateName, nodeTemplate ->
+ enrichNodeTemplate(nodeTemplateName, nodeTemplate)
+ }
+ }
+
+ @Throws(BluePrintException::class)
+ open fun enrichNodeTemplate(nodeTemplateName: String, nodeTemplate: NodeTemplate) {
+ val nodeTypeName = nodeTemplate.type
+ // Get NodeType from Repo and Update Service Template
+ val nodeType = populateNodeType(nodeTypeName)
+
+ // Enrich NodeType
+ enrichNodeType(nodeTypeName, nodeType)
+
+ //Enrich Node Template Artifacts
+ enrichNodeTemplateArtifactDefinition(nodeTemplateName, nodeTemplate)
+ }
+
+ open fun enrichNodeType(nodeTypeName: String, nodeType: NodeType) {
+
+ // NodeType Property Definitions
+ enrichNodeTypeProperties(nodeTypeName, nodeType)
+
+ //NodeType Requirement
+ enrichNodeTypeRequirements(nodeTypeName, nodeType)
+
+ //NodeType Capability
+ enrichNodeTypeCapabilityProperties(nodeTypeName, nodeType)
+
+ //NodeType Interface
+ enrichNodeTypeInterfaces(nodeTypeName, nodeType)
+ }
+
+ open fun enrichNodeTypeProperties(nodeTypeName: String, nodeType: NodeType) {
+ nodeType.properties?.let { enrichPropertyDefinitions(nodeType.properties!!) }
+ }
+
+ open fun enrichNodeTypeRequirements(nodeTypeName: String, nodeType: NodeType) {
+
+ nodeType.requirements?.forEach { requirementDefinitionName, requirementDefinition ->
+ // Populate Requirement Node
+ requirementDefinition.node?.let { requirementNodeTypeName ->
+ // Get Requirement NodeType from Repo and Update Service Template
+ val requirementNodeType = populateNodeType(requirementNodeTypeName)
+
+ enrichNodeType(requirementNodeTypeName, requirementNodeType)
+ }
+ }
+ }
+
+ open fun enrichNodeTypeCapabilityProperties(nodeTypeName: String, nodeType: NodeType) {
+ nodeType.capabilities?.forEach { capabilityDefinitionName, capabilityDefinition ->
+ capabilityDefinition.properties?.let { properties ->
+ enrichPropertyDefinitions(properties)
+ }
+ }
+ }
+
+ open fun enrichNodeTypeInterfaces(nodeTypeName: String, nodeType: NodeType) {
+ nodeType.interfaces?.forEach { interfaceName, interfaceObj ->
+ // Populate Node type Interface Operation
+ log.info("*** ** Enriching NodeType: {} Interface {}", nodeTypeName, interfaceName)
+ populateNodeTypeInterfaceOperation(nodeTypeName, interfaceName, interfaceObj)
+
+ }
+ }
+
+ open fun populateNodeTypeInterfaceOperation(nodeTypeName: String, interfaceName: String, interfaceObj: InterfaceDefinition) {
+
+ interfaceObj.operations?.forEach { operationName, operation ->
+ enrichNodeTypeInterfaceOperationInputs(nodeTypeName, operationName, operation)
+ enrichNodeTypeInterfaceOperationOputputs(nodeTypeName, operationName, operation)
+ }
+ }
+
+ open fun enrichNodeTypeInterfaceOperationInputs(nodeTypeName: String, operationName: String, operation: OperationDefinition) {
+ operation.inputs?.let { inputs ->
+ enrichPropertyDefinitions(inputs)
+ }
+ }
+
+ open fun enrichNodeTypeInterfaceOperationOputputs(nodeTypeName: String, operationName: String, operation: OperationDefinition) {
+ operation.outputs?.let { inputs ->
+ enrichPropertyDefinitions(inputs)
+ }
+ }
+
+ open fun enrichPropertyDefinitions(properties: MutableMap<String, PropertyDefinition>) {
+
+ properties.forEach { propertyName, propertyDefinition ->
+ enrichPropertyDefinition(propertyName, propertyDefinition)
+ }
+ }
+
+ open fun enrichPropertyDefinition(propertyName: String, propertyDefinition: PropertyDefinition) {
+ val propertyType = propertyDefinition.type
+ ?: throw BluePrintException(format("Property type is missing for property : {}", propertyName))
+ if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
+
+ } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
+ val entrySchema = propertyDefinition.entrySchema
+ ?: throw BluePrintException(format("Entry Schema is missing for collection property : {}", propertyName))
+
+ if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema.type)) {
+ populateDataTypes(entrySchema.type)
+ }
+ } else {
+ populateDataTypes(propertyType)
+ }
+
+ }
+
+ open fun enrichNodeTemplateArtifactDefinition(nodeTemplateName: String, nodeTemplate: NodeTemplate) {
+
+ nodeTemplate.artifacts?.forEach { artifactDefinitionName, artifactDefinition ->
+ val artifactTypeName = artifactDefinition.type
+ ?: throw BluePrintException(format("Artifact type is missing for NodeTemplate({}) artifact({})", nodeTemplateName, artifactDefinitionName))
+
+ // Populate Artifact Type
+ populateArtifactType(artifactTypeName)
+ }
+ }
+
+ open fun populateNodeType(nodeTypeName: String): NodeType {
+ val nodeType = bluePrintEnhancerRepoService.getNodeType(nodeTypeName)
+ ?: throw BluePrintException(format("Couldn't get NodeType({}) from repo.", nodeTypeName))
+ serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
+ return nodeType
+ }
+
+ open fun populateArtifactType(artifactTypeName: String): ArtifactType {
+ val artifactType = bluePrintEnhancerRepoService.getArtifactType(artifactTypeName)
+ ?: throw BluePrintException(format("Couldn't get ArtifactType({}) from repo.", artifactTypeName))
+ serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)
+ return artifactType
+ }
+
+ open fun populateDataTypes(dataTypeName: String): DataType {
+ val dataType = bluePrintEnhancerRepoService.getDataType(dataTypeName)
+ ?: throw BluePrintException(format("Couldn't get DataType({}) from repo.", dataTypeName))
+ serviceTemplate.dataTypes?.put(dataTypeName, dataType)
+ return dataType
+ }
+
+}
+
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
new file mode 100644
index 000000000..36959c46d
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
@@ -0,0 +1,174 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+object BluePrintExpressionService {
+ val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ @JvmStatic
+ fun getExpressionData(propertyAssignment: Any): ExpressionData {
+ val propertyAssignmentNode: JsonNode = JacksonUtils.jsonNodeFromObject(propertyAssignment)
+ return getExpressionData(propertyAssignmentNode)
+ }
+
+ @JvmStatic
+ fun getExpressionData(propertyAssignmentNode: JsonNode): ExpressionData {
+ logger.trace("Assignment Data/Expression : {}", propertyAssignmentNode)
+ val expressionData = ExpressionData(valueNode = propertyAssignmentNode)
+ if (propertyAssignmentNode is ObjectNode) {
+
+ val commands: Set<String> = propertyAssignmentNode.fieldNames().asSequence().toList().intersect(BluePrintTypes.validCommands())
+ if (commands.isNotEmpty()) {
+ expressionData.isExpression = true
+ expressionData.command = commands.first()
+ expressionData.expressionNode = propertyAssignmentNode
+
+ when (expressionData.command) {
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_INPUT -> {
+ expressionData.inputExpression = populateInputExpression(propertyAssignmentNode)
+ }
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> {
+ expressionData.attributeExpression = populateAttributeExpression(propertyAssignmentNode)
+ }
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_PROPERTY -> {
+ expressionData.propertyExpression = populatePropertyExpression(propertyAssignmentNode)
+ }
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> {
+ expressionData.operationOutputExpression = populateOperationOutputExpression(propertyAssignmentNode)
+ }
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ARTIFACT -> {
+ expressionData.artifactExpression = populateArtifactExpression(propertyAssignmentNode)
+ }
+ }
+ }
+ }
+ return expressionData
+ }
+
+ @JvmStatic
+ fun populateInputExpression(jsonNode: JsonNode): InputExpression {
+ return InputExpression(propertyName = jsonNode.first().textValue())
+ }
+
+ @JvmStatic
+ fun populatePropertyExpression(jsonNode: JsonNode): PropertyExpression {
+ val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
+ check(arrayNode.size() >= 2) {
+ throw BluePrintException(String.format("missing property expression, " +
+ "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <property_name>, " +
+ "<nested_property_name_or_index_1>, ..., <nested_property_name_or_index_n> ] , but present {}", jsonNode))
+ }
+ var reqOrCapEntityName: String? = null
+ var propertyName = ""
+ var subProperty: String? = null
+ if (arrayNode.size() == 2) {
+ propertyName = arrayNode[1].textValue()
+ } else if (arrayNode.size() == 3) {
+ reqOrCapEntityName = arrayNode[1].textValue()
+ propertyName = arrayNode[2].textValue()
+ } else if (arrayNode.size() > 3) {
+ reqOrCapEntityName = arrayNode[1].textValue()
+ propertyName = arrayNode[2].textValue()
+ val propertyPaths: List<String> = arrayNode.filterIndexed { index, obj ->
+ index >= 3
+ }.map { it.textValue() }
+ subProperty = propertyPaths.joinToString("/")
+ }
+
+ return PropertyExpression(modelableEntityName = arrayNode[0].asText(),
+ reqOrCapEntityName = reqOrCapEntityName,
+ propertyName = propertyName,
+ subPropertyName = subProperty
+ )
+ }
+
+ @JvmStatic
+ fun populateAttributeExpression(jsonNode: JsonNode): AttributeExpression {
+ val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
+ check(arrayNode.size() >= 3) {
+ throw BluePrintException(String.format("missing attribute expression, " +
+ "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +
+ " <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}", jsonNode))
+ }
+
+ var reqOrCapEntityName: String? = null
+ var propertyName: String = ""
+ var subProperty: String? = null
+ if (arrayNode.size() == 2) {
+ propertyName = arrayNode[1].textValue()
+ } else if (arrayNode.size() == 3) {
+ reqOrCapEntityName = arrayNode[1].textValue()
+ propertyName = arrayNode[2].textValue()
+ } else if (arrayNode.size() > 3) {
+ reqOrCapEntityName = arrayNode[1].textValue()
+ propertyName = arrayNode[2].textValue()
+ val propertyPaths: List<String> = arrayNode.filterIndexed { index, obj ->
+ index >= 3
+ }.map { it.textValue() }
+ subProperty = propertyPaths.joinToString("/")
+ }
+ return AttributeExpression(modelableEntityName = arrayNode[0].asText(),
+ reqOrCapEntityName = reqOrCapEntityName,
+ attributeName = propertyName,
+ subAttributeName = subProperty
+ )
+ }
+
+ @JvmStatic
+ fun populateOperationOutputExpression(jsonNode: JsonNode): OperationOutputExpression {
+ val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
+
+ check(arrayNode.size() >= 4) {
+ throw BluePrintException(String.format("missing operation output expression, " +
+ "it should be (<modelable_entity_name>, <interface_name>, <operation_name>, <output_variable_name>) , but present {}", jsonNode))
+ }
+ return OperationOutputExpression(modelableEntityName = arrayNode[0].asText(),
+ interfaceName = arrayNode[1].asText(),
+ operationName = arrayNode[2].asText(),
+ propertyName = arrayNode[3].asText()
+ )
+ }
+
+ @JvmStatic
+ fun populateArtifactExpression(jsonNode: JsonNode): ArtifactExpression {
+ val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
+
+ check(arrayNode.size() >= 2) {
+ throw BluePrintException(String.format("missing artifact expression, " +
+ "it should be [ <modelable_entity_name>, <artifact_name>, <location>, <remove> ] , but present {}", jsonNode))
+ }
+ return ArtifactExpression(modelableEntityName = arrayNode[0].asText(),
+ artifactName = arrayNode[1].asText(),
+ location = arrayNode[2]?.asText() ?: "LOCAL_FILE",
+ remove = arrayNode[3]?.asBoolean() ?: false
+ )
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserService.kt
new file mode 100644
index 000000000..3b917202f
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserService.kt
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.ServiceTemplateUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.io.File
+import java.io.Serializable
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+interface BluePrintParserService : Serializable {
+ fun readBlueprint(content: String) : BluePrintContext
+ fun readBlueprintFile(fileName: String) : BluePrintContext
+ /**
+ * Read Blueprint from CSAR structure Directory
+ */
+ fun readBlueprintFile(fileName: String, basePath : String) : BluePrintContext
+}
+
+class BluePrintParserDefaultService : BluePrintParserService {
+
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ var basePath : String = javaClass.classLoader.getResource(".").path
+
+ override fun readBlueprint(content: String): BluePrintContext {
+ return BluePrintContext(ServiceTemplateUtils.getServiceTemplateFromContent(content))
+ }
+
+ override fun readBlueprintFile(fileName: String): BluePrintContext {
+ return readBlueprintFile(fileName, basePath )
+ }
+
+ override fun readBlueprintFile(fileName: String, basePath : String): BluePrintContext {
+ val rootFilePath: String = StringBuilder().append(basePath).append(File.separator).append(fileName).toString()
+ val rootServiceTemplate : ServiceTemplate = ServiceTemplateUtils.getServiceTemplate(rootFilePath)
+ // TODO("Nested Lookup Implementation based on Import files")
+ return BluePrintContext(rootServiceTemplate)
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
new file mode 100644
index 000000000..213f5f401
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -0,0 +1,274 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.NullNode
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.OrchestratorException
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var context: MutableMap<String, Any> = hashMapOf()) {
+
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ /*
+ Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
+ */
+ fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, Any?> {
+ logger.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName)
+ val propertyAssignmentValue: MutableMap<String, Any?> = hashMapOf()
+
+ val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
+
+ val propertyAssignments: MutableMap<String, Any?> =
+ nodeTemplate.properties as MutableMap<String, Any?>
+
+ // Get the Node Type Definitions
+ val nodeTypeProperties: MutableMap<String, PropertyDefinition> =
+ bluePrintContext.nodeTypeChainedProperties(nodeTemplate.type)!!
+
+ // Iterate Node Type Properties
+ nodeTypeProperties.forEach { nodeTypePropertyName, nodeTypeProperty ->
+ // Get the Express or Value for the Node Template
+ val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName]
+
+ var resolvedValue: JsonNode = NullNode.getInstance()
+ if (propertyAssignment != null) {
+ // Resolve the Expressing
+ val propertyAssignmentExpression = PropertyAssignmentService(context, 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
+ }
+ logger.info("resolved property definition for node template ({}), values ({})", nodeTemplateName, propertyAssignmentValue)
+ return propertyAssignmentValue
+ }
+
+ fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,
+ interfaceName: String, operationName: String): MutableMap<String, Any?> {
+ logger.info("nodeTemplateInterfaceOperationInputsResolvedExpression for node template ({}),interface name ({}), " +
+ "operationName({})", nodeTemplateName, interfaceName, operationName)
+
+ val propertyAssignmentValue: MutableMap<String, Any?> = hashMapOf()
+
+ val propertyAssignments: MutableMap<String, Any> =
+ bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName) as? MutableMap<String, Any>
+ ?: throw BluePrintException(String.format("failed to get input definitions for node template (%s), " +
+ "interface name (%s), operationName(%s)", nodeTemplateName, interfaceName, operationName))
+
+ val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
+
+ val nodeTypeInterfaceOperationInputs: MutableMap<String, PropertyDefinition> =
+ bluePrintContext.nodeTypeInterfaceOperationInputs(nodeTypeName, interfaceName, operationName)
+ ?: throw BluePrintException(String.format("failed to get input definitions for node type (%s), " +
+ "interface name (%s), operationName(%s)", nodeTypeName, interfaceName, operationName))
+
+ logger.info("input definition for node template ({}), values ({})", nodeTemplateName, propertyAssignments)
+
+ // Iterate Node Type Properties
+ nodeTypeInterfaceOperationInputs.forEach { nodeTypePropertyName, nodeTypeProperty ->
+ // Get the Express or Value for the Node Template
+ val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName]
+
+ var resolvedValue: JsonNode = NullNode.getInstance()
+ if (propertyAssignment != null) {
+ // Resolve the Expressing
+ val propertyAssignmentExpression = PropertyAssignmentService( context, 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
+ }
+ logger.info("resolved input assignments for node template ({}), values ({})", nodeTemplateName, propertyAssignmentValue)
+
+ return propertyAssignmentValue
+ }
+
+
+ fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String,
+ interfaceName: String, operationName: String, componentContext: MutableMap<String, Any?>): Unit {
+ logger.info("nodeTemplateInterfaceOperationInputsResolvedExpression for node template ({}),interface name ({}), " +
+ "operationName({})", nodeTemplateName, interfaceName, operationName)
+
+ val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
+
+ val nodeTypeInterfaceOperationOutputs: MutableMap<String, PropertyDefinition> =
+ bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName)
+ ?: throw BluePrintException(String.format("failed to get input definitions for node type (%s), " +
+ "interface name (%s), operationName(%s)", nodeTypeName, interfaceName, operationName))
+
+ // Iterate Node Type Properties
+ nodeTypeInterfaceOperationOutputs.forEach { nodeTypePropertyName, nodeTypeProperty ->
+
+ val operationOutputPropertyName: String = StringBuilder().append(nodeTemplateName)
+ .append(".").append(interfaceName)
+ .append(".").append(operationName)
+ .append(".").append(nodeTypePropertyName).toString()
+ // Get the Value from component context
+ val resolvedValue: JsonNode = componentContext[operationOutputPropertyName] as? JsonNode
+ ?: NullNode.getInstance()
+ // Store operation output values into context
+ setNodeTemplateOperationPropertyValue(nodeTemplateName, interfaceName, operationName, nodeTypePropertyName, resolvedValue)
+ logger.debug("resolved output assignments for node template ({}), property name ({}), value ({})", nodeTemplateName, nodeTypePropertyName, resolvedValue)
+ }
+ }
+
+ fun resolveNodeTemplateArtifact(nodeTemplateName: String,
+ artifactName: String): String {
+ val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
+
+ val artifactDefinition: ArtifactDefinition = nodeTemplate.artifacts?.get(artifactName)
+ ?: throw OrchestratorException(String.format("failed to get artifat definition {} from the node template"
+ , artifactName))
+ val propertyAssignmentExpression = PropertyAssignmentService( context, this)
+ return propertyAssignmentExpression.artifactContent(artifactDefinition)
+ }
+
+
+ fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode): Unit {
+ val path = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INPUTS)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ logger.trace("setting input path ({}), values ({})", path, value)
+ context[path] = value
+ }
+
+ fun setWorkflowInputValue(workflowName: String, propertyName: String, value: JsonNode): Unit {
+ val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_WORKFLOWS).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(workflowName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INPUTS)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ context[path] = value
+ }
+
+ fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode): Unit {
+
+ val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ context[path] = value
+ }
+
+ fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ value: JsonNode): Unit {
+ val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INTERFACES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_OPERATIONS).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ logger.trace("setting operation property path ({}), values ({})", path, value)
+ context[path] = value
+ }
+
+ fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ value: JsonNode): Unit {
+ val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INTERFACES).append(interfaceName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_OPERATIONS).append(operationName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INPUTS)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ context[path] = value
+ }
+
+ fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ value: JsonNode): Unit {
+ val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INTERFACES).append(interfaceName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_OPERATIONS).append(operationName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_OUTPUTS)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ context[path] = value
+ }
+
+
+ fun getInputValue(propertyName: String): JsonNode {
+ val path = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INPUTS)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ return context[path] as? JsonNode ?: NullNode.instance
+ }
+
+ fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String): JsonNode {
+ val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INTERFACES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_OPERATIONS).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ return context[path] as JsonNode
+ }
+
+ fun getPropertyValue(nodeTemplateName: String, propertyName: String): JsonNode? {
+ val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ return context[path] as JsonNode
+ }
+
+ fun getRequirementPropertyValue(nodeTemplateName: String, requirementName: String, propertyName: String): JsonNode? {
+ val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_REQUIREMENTS).append(requirementName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ return context[path] as JsonNode
+ }
+
+ fun getCapabilityPropertyValue(nodeTemplateName: String, capabilityName: String, propertyName: String): JsonNode? {
+ val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_CAPABILITIES).append(capabilityName)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
+ .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ return context[path] as JsonNode
+ }
+
+ fun assignInputs(jsonNode: JsonNode): Unit {
+ logger.info("assignInputs from input JSON ({})", jsonNode.toString())
+ bluePrintContext.inputs?.forEach { propertyName, property ->
+ val valueNode: JsonNode = jsonNode.at("/" + propertyName) ?: NullNode.getInstance()
+ setInputValue(propertyName, property, valueNode)
+ }
+ }
+
+ fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode): Unit {
+ logger.info("assign workflow {} input value ({})", workflowName, jsonNode.toString())
+ bluePrintContext.workflowByName(workflowName)?.inputs?.forEach { propertyName, property ->
+ val valueNode: JsonNode = jsonNode.at("/" + propertyName) ?: NullNode.getInstance()
+ setWorkflowInputValue(workflowName, propertyName, valueNode)
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
new file mode 100644
index 000000000..2383a6520
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
@@ -0,0 +1,353 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.google.common.base.Preconditions
+import org.apache.commons.lang3.StringUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.*
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.io.Serializable
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+interface BluePrintValidatorService : Serializable {
+
+ @Throws(BluePrintException::class)
+ fun validateBlueprint(bluePrintContext: BluePrintContext, properties: MutableMap<String, Any>)
+
+ @Throws(BluePrintException::class)
+ fun validateBlueprint(serviceTemplate: ServiceTemplate, properties: MutableMap<String, Any>)
+}
+
+open class BluePrintValidatorDefaultService : BluePrintValidatorService {
+
+ val logger: Logger = LoggerFactory.getLogger(BluePrintValidatorDefaultService::class.toString())
+
+ lateinit var bluePrintContext: BluePrintContext
+ lateinit var serviceTemplate: ServiceTemplate
+ lateinit var properties: MutableMap<String, Any>
+ var message: StringBuilder = StringBuilder()
+ val seperator: String = "/"
+ var paths: MutableList<String> = arrayListOf()
+
+ @Throws(BluePrintException::class)
+ override fun validateBlueprint(bluePrintContext: BluePrintContext, properties: MutableMap<String, Any>) {
+ validateBlueprint(bluePrintContext.serviceTemplate,properties)
+ }
+
+ @Throws(BluePrintException::class)
+ override fun validateBlueprint(serviceTemplate: ServiceTemplate, properties: MutableMap<String, Any>) {
+ this.bluePrintContext = BluePrintContext(serviceTemplate)
+ this.serviceTemplate = serviceTemplate
+ this.properties = properties
+ try {
+ message.appendln("-> Config Blueprint")
+ serviceTemplate.metadata?.let { validateMetadata(serviceTemplate.metadata!!) }
+ serviceTemplate.artifactTypes?.let { validateArtifactTypes(serviceTemplate.artifactTypes!!) }
+ serviceTemplate.dataTypes?.let { validateDataTypes(serviceTemplate.dataTypes!!) }
+ serviceTemplate.nodeTypes?.let { validateNodeTypes(serviceTemplate.nodeTypes!!) }
+ serviceTemplate.topologyTemplate?.let { validateTopologyTemplate(serviceTemplate.topologyTemplate!!) }
+ } catch (e: Exception) {
+ logger.error("validation failed in the path : {}", paths.joinToString(seperator), e)
+ logger.error("validation trace message :{} ", message)
+ throw BluePrintException(e,
+ format("failed to validate blueprint on path ({}) with message {}"
+ , paths.joinToString(seperator), e.message))
+ }
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateMetadata(metaDataMap: MutableMap<String, String>) {
+ paths.add("metadata")
+ Preconditions.checkArgument(StringUtils.isNotBlank(metaDataMap[BluePrintConstants.METADATA_TEMPLATE_NAME]), "failed to get template name metadata")
+ Preconditions.checkArgument(StringUtils.isNotBlank(metaDataMap[BluePrintConstants.METADATA_TEMPLATE_VERSION]), "failed to get template version metadata")
+ Preconditions.checkArgument(StringUtils.isNotBlank(metaDataMap[BluePrintConstants.METADATA_TEMPLATE_TAGS]), "failed to get template tags metadata")
+ Preconditions.checkArgument(StringUtils.isNotBlank(metaDataMap[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]), "failed to get template author metadata")
+ Preconditions.checkArgument(StringUtils.isNotBlank(metaDataMap[BluePrintConstants.METADATA_USER_GROUPS]), "failed to get user groups metadata")
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateArtifactTypes(artifactTypes: MutableMap<String, ArtifactType>) {
+ paths.add("artifact_types")
+ artifactTypes.forEach { artifactName, artifactType ->
+ paths.add(artifactName)
+ message.appendln("--> Artifact Type :" + paths.joinToString(seperator))
+ artifactType.properties?.let { validatePropertyDefinitions(artifactType.properties!!) }
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateDataTypes(dataTypes: MutableMap<String, DataType>) {
+ paths.add("dataTypes")
+ dataTypes.forEach { dataTypeName, dataType ->
+ paths.add(dataTypeName)
+ message.appendln("--> Data Type :" + paths.joinToString(seperator))
+ dataType.properties?.let { validatePropertyDefinitions(dataType.properties!!) }
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateNodeTypes(nodeTypes: MutableMap<String, NodeType>) {
+ paths.add("nodeTypes")
+ nodeTypes.forEach { nodeTypeName, nodeType ->
+ // Validate Single Node Type
+ validateNodeType(nodeTypeName,nodeType)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateNodeType(nodeTypeName: String, nodeType: NodeType) {
+ paths.add(nodeTypeName)
+ message.appendln("--> Node Type :" + paths.joinToString(seperator))
+ val derivedFrom: String = nodeType.derivedFrom
+ //Check Derived From
+ checkValidNodeTypesDerivedFrom(derivedFrom)
+
+ nodeType.properties?.let { validatePropertyDefinitions(nodeType.properties!!) }
+ nodeType.interfaces?.let { validateInterfaceDefinitions(nodeType.interfaces!!) }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateTopologyTemplate(topologyTemplate: TopologyTemplate) {
+ paths.add("topology")
+ message.appendln("--> Topology Template")
+ topologyTemplate.inputs?.let { validateInputs(topologyTemplate.inputs!!) }
+ topologyTemplate.nodeTemplates?.let { validateNodeTemplates(topologyTemplate.nodeTemplates!!) }
+ topologyTemplate.workflows?.let { validateWorkFlows(topologyTemplate.workflows!!) }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateInputs(inputs: MutableMap<String, PropertyDefinition>) {
+ paths.add("inputs")
+ message.appendln("---> Input :" + paths.joinToString(seperator))
+ validatePropertyDefinitions(inputs)
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateNodeTemplates(nodeTemplates: MutableMap<String, NodeTemplate>) {
+ paths.add("nodeTemplates")
+ nodeTemplates.forEach { nodeTemplateName, nodeTemplate ->
+ validateNodeTemplate(nodeTemplateName, nodeTemplate)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateNodeTemplate(nodeTemplateName : String, nodeTemplate: NodeTemplate) {
+ paths.add(nodeTemplateName)
+ message.appendln("---> Node Template :" + paths.joinToString(seperator))
+ val type: String = nodeTemplate.type
+
+ val nodeType: NodeType = serviceTemplate.nodeTypes?.get(type)
+ ?: throw BluePrintException(format("Failed to get node type definition for node template : {}", nodeTemplateName))
+
+ nodeTemplate.artifacts?.let { validateArtifactDefinitions(nodeTemplate.artifacts!!) }
+ nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) }
+ nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeTemplate.capabilities!!) }
+ nodeTemplate.requirements?.let { validateRequirementAssignments(nodeTemplate.requirements!!) }
+ nodeTemplate.interfaces?.let { validateInterfaceAssignments(nodeTemplate.interfaces!!) }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateWorkFlows(workflows: MutableMap<String, Workflow>) {
+ paths.add("workflows")
+ workflows.forEach { workflowName, workflow ->
+
+ // Validate Single workflow
+ validateWorkFlow(workflowName, workflow)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateWorkFlow(workflowName:String, workflow: Workflow) {
+ paths.add(workflowName)
+ message.appendln("---> Workflow :" + paths.joinToString(seperator))
+ // Step Validation Start
+ paths.add("steps")
+ workflow.steps?.forEach { stepName, step ->
+ paths.add(stepName)
+ message.appendln("----> Steps :" + paths.joinToString(seperator))
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ // Step Validation Ends
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validatePropertyDefinitions(properties: MutableMap<String, PropertyDefinition>) {
+ paths.add("properties")
+ properties.forEach { propertyName, propertyDefinition ->
+ paths.add(propertyName)
+ val dataType: String = propertyDefinition.type!!
+ if (BluePrintTypes.validPrimitiveTypes().contains(dataType)) {
+ // Do Nothing
+ } else if (BluePrintTypes.validCollectionTypes().contains(dataType)) {
+ val entrySchemaType: String = propertyDefinition.entrySchema?.type
+ ?: throw BluePrintException(format("Entry schema for data type ({}) for the property ({}) not found", dataType, propertyName))
+ checkPrimitiveOrComplex(entrySchemaType, propertyName)
+ } else {
+ checkPropertyDataType(dataType, propertyName)
+ }
+ message.appendln("property " + paths.joinToString(seperator) + " of type " + dataType)
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validatePropertyAssignments(nodeTypeProperties: MutableMap<String, PropertyDefinition>,
+ properties: MutableMap<String, JsonNode>) {
+ properties.forEach { propertyName, propertyAssignment ->
+ val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName]
+ ?: throw BluePrintException(format("failed to get definition for the property ({})", propertyName))
+ // Check and Validate if Expression Node
+ val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment)
+ if (!expressionData.isExpression) {
+ checkPropertyValue(propertyDefinition, propertyAssignment)
+ }
+ }
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateArtifactDefinitions(artifacts: MutableMap<String, ArtifactDefinition>) {
+ paths.add("artifacts")
+ artifacts.forEach { artifactName, artifactDefinition ->
+ paths.add(artifactName)
+ message.appendln("Validating artifact " + paths.joinToString(seperator))
+ val type: String = artifactDefinition.type
+ ?: throw BluePrintException("type is missing for artifact definition :" + artifactName)
+ // Check Artifact Type
+ checkValidArtifactType(type)
+
+ val file: String = artifactDefinition.file
+ ?: throw BluePrintException(format("file is missing for artifact definition : {}", artifactName))
+
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateCapabilityAssignments(capabilities: MutableMap<String, CapabilityAssignment>) {
+
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateRequirementAssignments(requirements: MutableMap<String, RequirementAssignment>) {
+
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateInterfaceAssignments(interfaces: MutableMap<String, InterfaceAssignment>) {
+
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) {
+ paths.add("interfaces")
+ interfaces.forEach { interfaceName, interfaceDefinition ->
+ paths.add(interfaceName)
+ message.appendln("Validating : " + paths.joinToString(seperator))
+ interfaceDefinition.operations?.let { validateOperationDefinitions(interfaceDefinition.operations!!) }
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateOperationDefinitions(operations: MutableMap<String, OperationDefinition>) {
+ paths.add("operations")
+ operations.forEach { opertaionName, operationDefinition ->
+ paths.add(opertaionName)
+ message.appendln("Validating : " + paths.joinToString(seperator))
+ operationDefinition.implementation?.let { validateImplementation(operationDefinition.implementation!!) }
+ operationDefinition.inputs?.let { validatePropertyDefinitions(operationDefinition.inputs!!) }
+ operationDefinition.outputs?.let { validatePropertyDefinitions(operationDefinition.outputs!!) }
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateImplementation(implementation: Implementation) {
+ checkNotEmptyNThrow(implementation.primary)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun checkValidNodeType(nodeType : String) {
+
+ }
+
+ @Throws(BluePrintException::class)
+ open fun checkValidArtifactType(artifactType: String) {
+
+ serviceTemplate.artifactTypes?.containsKey(artifactType)
+ ?: throw BluePrintException(format("Failed to node type definition for artifact definition : {}", artifactType))
+ }
+
+ @Throws(BluePrintException::class)
+ open fun checkValidNodeTypesDerivedFrom(derivedFrom: String) {
+
+ }
+
+ private fun checkPropertyValue(propertyDefinition: PropertyDefinition, jsonNode: JsonNode) {
+ //logger.info("validating path ({}), Property {}, value ({})", paths, propertyDefinition, jsonNode)
+ }
+
+ private fun checkPropertyDataType(dataType: String, propertyName: String): Boolean {
+ if (checkDataType(dataType)) {
+ return true
+ } else {
+ throw BluePrintException(format("Data type ({}) for the property ({}) not found", dataType, propertyName))
+ }
+ }
+
+ private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean {
+ if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
+ return true
+ } else {
+ throw BluePrintException(format("Data type ({}) for the property ({}) is not valid", dataType))
+ }
+ }
+
+ private fun checkDataType(key: String): Boolean {
+ return serviceTemplate.dataTypes?.containsKey(key) ?: false
+ }
+
+ private fun checkNodeType(key: String): Boolean {
+ return serviceTemplate.nodeTypes?.containsKey(key) ?: false
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt
new file mode 100644
index 000000000..9389a6f30
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt
@@ -0,0 +1,198 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.NullNode
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.ResourceResolverUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class PropertyAssignmentService(var context: MutableMap<String, Any>,
+ var bluePrintRuntimeService: BluePrintRuntimeService) {
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ private var bluePrintContext: BluePrintContext = bluePrintRuntimeService.bluePrintContext
+
+/*
+
+If Property Assignment is Expression.
+ Get the Expression
+ Recurssely resolve the expression
+ */
+
+ fun resolveAssignmentExpression(nodeTemplateName: String, assignmentName: String,
+ assignment: Any): JsonNode {
+ var valueNode: JsonNode = NullNode.getInstance()
+ logger.trace("Assignment ({})", assignment)
+ val expressionData = BluePrintExpressionService.getExpressionData(assignment)
+
+ if (expressionData.isExpression) {
+ valueNode = resolveExpression(nodeTemplateName, assignmentName, expressionData)
+ } else {
+ valueNode = expressionData.valueNode
+ }
+ return valueNode
+ }
+
+ fun resolveExpression(nodeTemplateName: String, propName: String, expressionData: ExpressionData): JsonNode {
+
+ var valueNode: JsonNode = NullNode.getInstance()
+
+ if(expressionData.isExpression) {
+ val command = expressionData.command!!
+
+ when(command){
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_INPUT ->{
+ valueNode = bluePrintRuntimeService.getInputValue(expressionData.inputExpression?.propertyName!!)
+ }
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ATTRIBUTE ->{
+ valueNode = resolveAttributeExpression(nodeTemplateName, expressionData.attributeExpression!!)
+ }
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_PROPERTY ->{
+ valueNode = resolvePropertyExpression(nodeTemplateName, expressionData.propertyExpression!!)
+ }
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT ->{
+ valueNode = resolveOperationOutputExpression(nodeTemplateName, expressionData.operationOutputExpression!!)
+ }
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ARTIFACT ->{
+ valueNode = resolveArtifactExpression(nodeTemplateName, expressionData.artifactExpression!!)
+ }
+ org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE ->{
+
+ }
+ else ->{
+ throw BluePrintException(String.format("for property ({}), command ({}) is not supported ", propName, command))
+ }
+ }
+ }
+ return valueNode
+ }
+
+ /*
+ get_property: [ <modelable_entity_name>, <optional_req_or_cap_name>, <property_name>,
+ <nested_property_name_or_index_1>, ..., <nested_property_name_or_index_n> ]
+ */
+ fun resolveAttributeExpression(nodeTemplateName: String, attributeExpression: AttributeExpression): JsonNode {
+ var valueNode: JsonNode = NullNode.getInstance()
+
+ val attributeName = attributeExpression.attributeName
+ val subAttributeName: String? = attributeExpression.subAttributeName
+
+ var attributeNodeTemplateName = nodeTemplateName
+ if (!attributeExpression.modelableEntityName.equals("SELF", true)) {
+ attributeNodeTemplateName = attributeExpression.modelableEntityName
+ }
+
+ val attributeExpression = bluePrintContext.nodeTemplateByName(attributeNodeTemplateName).attributes?.get(attributeName)
+ ?: throw BluePrintException(String.format("failed to get property definitions for node template ({})'s property name ({}) ", nodeTemplateName, attributeName))
+
+ var propertyDefinition: AttributeDefinition = bluePrintContext.nodeTemplateNodeType(attributeNodeTemplateName).attributes?.get(attributeName)!!
+
+ logger.info("template name ({}), property Name ({}) resolved value ({})", attributeNodeTemplateName, attributeName, attributeExpression)
+
+ // Check it it is a nested expression
+ valueNode = resolveAssignmentExpression(attributeNodeTemplateName, attributeName, attributeExpression)
+
+// subPropertyName?.let {
+// valueNode = valueNode.at(JsonPointer.valueOf(subPropertyName))
+// }
+ return valueNode
+ }
+
+ /*
+ get_property: [ <modelable_entity_name>, <optional_req_or_cap_name>, <property_name>,
+ <nested_property_name_or_index_1>, ..., <nested_property_name_or_index_n> ]
+ */
+ fun resolvePropertyExpression(nodeTemplateName: String, propertyExpression: PropertyExpression): JsonNode {
+ var valueNode: JsonNode = NullNode.getInstance()
+
+ val propertyName = propertyExpression.propertyName
+ val subPropertyName: String? = propertyExpression.subPropertyName
+
+ var propertyNodeTemplateName = nodeTemplateName
+ if (!propertyExpression.modelableEntityName.equals("SELF", true)) {
+ propertyNodeTemplateName = propertyExpression.modelableEntityName
+ }
+
+ val propertyExpression = bluePrintContext.nodeTemplateByName(propertyNodeTemplateName).properties?.get(propertyName)
+ ?: throw BluePrintException(String.format("failed to get property definitions for node template ({})'s property name ({}) ", nodeTemplateName, propertyName))
+
+ var propertyDefinition: PropertyDefinition = bluePrintContext.nodeTemplateNodeType(propertyNodeTemplateName).properties?.get(propertyName)!!
+
+ logger.info("template name ({}), property Name ({}) resolved value ({})", propertyNodeTemplateName, propertyName, propertyExpression)
+
+ // Check it it is a nested expression
+ valueNode = resolveAssignmentExpression(propertyNodeTemplateName, propertyName, propertyExpression)
+
+// subPropertyName?.let {
+// valueNode = valueNode.at(JsonPointer.valueOf(subPropertyName))
+// }
+ return valueNode
+ }
+
+ /*
+ get_operation_output: <modelable_entity_name>, <interface_name>, <operation_name>, <output_variable_name>
+ */
+ fun resolveOperationOutputExpression(nodeTemplateName: String, operationOutputExpression: OperationOutputExpression): JsonNode {
+ var outputNodeTemplateName = nodeTemplateName
+ if (!operationOutputExpression.modelableEntityName.equals("SELF", true)) {
+ outputNodeTemplateName = operationOutputExpression.modelableEntityName
+ }
+ return bluePrintRuntimeService.getNodeTemplateOperationOutputValue(outputNodeTemplateName,
+ operationOutputExpression.interfaceName, operationOutputExpression.operationName,
+ operationOutputExpression.propertyName)
+ }
+
+ /*
+ get_artifact: [ <modelable_entity_name>, <artifact_name>, <location>, <remove> ]
+ */
+ fun resolveArtifactExpression(nodeTemplateName: String, artifactExpression: ArtifactExpression): JsonNode {
+
+ var artifactNodeTemplateName = nodeTemplateName
+ if (!artifactExpression.modelableEntityName.equals("SELF", true)) {
+ artifactNodeTemplateName = artifactExpression.modelableEntityName
+ }
+ val artifactDefinition: ArtifactDefinition = bluePrintContext.nodeTemplateByName(artifactNodeTemplateName)
+ .artifacts?.get(artifactExpression.artifactName)
+ ?: throw BluePrintException(String.format("failed to get artifact definitions for node template ({})'s " +
+ "artifact name ({}) ", nodeTemplateName, artifactExpression.artifactName))
+
+ return JacksonUtils.jsonNodeFromObject(artifactContent(artifactDefinition))
+ }
+
+ fun artifactContent(artifactDefinition: ArtifactDefinition): String {
+ val bluePrintBasePath: String = context[org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] as? String
+ ?: throw BluePrintException(String.format("failed to get property (%s) from context", org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH))
+
+ if (artifactDefinition.repository != null) {
+ TODO()
+ } else if (artifactDefinition.file != null) {
+ return ResourceResolverUtils.getFileContent(artifactDefinition.file!!, bluePrintBasePath)
+ }
+ return ""
+ }
+}
+
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
new file mode 100644
index 000000000..a9236f693
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
@@ -0,0 +1,95 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.utils
+
+
+import org.apache.commons.io.FileUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ToscaMetaData
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.io.File
+import java.nio.charset.Charset
+
+object BluePrintMetadataUtils {
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ @JvmStatic
+ fun toscaMetaData(basePath: String): ToscaMetaData {
+ val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER).plus("TOSCA-Metadata/TOSCA.meta")
+ return toscaMetaDataFromMetaFile(toscaMetaPath)
+ }
+
+ @JvmStatic
+ fun toscaMetaDataFromMetaFile(metaFilePath: String): ToscaMetaData {
+ val toscaMetaData = ToscaMetaData()
+ val lines: MutableList<String> = FileUtils.readLines(File(metaFilePath), Charset.defaultCharset())
+ lines.forEach { line ->
+ if (line.contains(":")) {
+ val keyValue = line.split(":")
+ if (keyValue.size == 2) {
+ val value: String = keyValue[1].trim()
+ when (keyValue[0]) {
+ "TOSCA-Meta-File-Version" -> toscaMetaData.toscaMetaFileVersion = value
+ "CSAR-Version" -> toscaMetaData.csarVersion = value
+ "Created-By" -> toscaMetaData.createdBy = value
+ "Entry-Definitions" -> toscaMetaData.entityDefinitions = value
+ "Template-Tags" -> toscaMetaData.templateTags = value
+ }
+ }
+ }
+
+ }
+ return toscaMetaData
+ }
+
+ /*
+ fun getBluePrintContext(blueprintBasePath: String): BluePrintContext {
+
+ val metaDataFile = StringBuilder().append(blueprintBasePath).append(File.separator)
+ .append(BluePrintConstants.DEFAULT_TOSCA_METADATA_ENTRY_DEFINITION_FILE).toString()
+
+ val toscaMetaData: ToscaMetaData = BluePrintMetadataUtils.toscaMetaData(metaDataFile)
+
+ logger.info("Processing blueprint base path ({}) and entry definition file ({})", blueprintBasePath, toscaMetaData.entityDefinitions)
+
+ return BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
+ .readBlueprintFile(toscaMetaData.entityDefinitions!!, blueprintBasePath)
+ }
+
+ fun getBluePrintRuntime(requestId: String, blueprintBasePath: String): BluePrintRuntimeService {
+
+ val metaDataFile = StringBuilder().append(blueprintBasePath).append(File.separator)
+ .append(BluePrintConstants.DEFAULT_TOSCA_METADATA_ENTRY_DEFINITION_FILE).toString()
+
+ val toscaMetaData: ToscaMetaData = BluePrintMetadataUtils.toscaMetaData(metaDataFile)
+
+ logger.info("Processing blueprint base path ({}) and entry definition file ({})", blueprintBasePath, toscaMetaData.entityDefinitions)
+
+ val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
+ .readBlueprintFile(toscaMetaData.entityDefinitions!!, blueprintBasePath)
+
+ val context: MutableMap<String, Any> = hashMapOf()
+ context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = blueprintBasePath
+ context[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = requestId
+
+ val bluePrintRuntimeService: BluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context)
+
+ return bluePrintRuntimeService
+ }
+ */
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
new file mode 100644
index 000000000..bad9201b7
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.utils
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.NullNode
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+object BluePrintRuntimeUtils {
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ fun assignInputsFromFile(bluePrintContext: BluePrintContext, fileName: String, context: MutableMap<String, Any>) {
+ val jsonNode: JsonNode = JacksonUtils.jsonNodeFromFile(fileName)
+ return assignInputs(bluePrintContext, jsonNode, context)
+ }
+
+ fun assignInputsFromContent(bluePrintContext: BluePrintContext, content: String, context: MutableMap<String, Any>) {
+ val jsonNode: JsonNode = JacksonUtils.jsonNode(content)
+ return assignInputs(bluePrintContext, jsonNode, context)
+ }
+
+ fun assignInputs(bluePrintContext: BluePrintContext, jsonNode: JsonNode, context: MutableMap<String, Any>) {
+ logger.info("assignInputs from input JSON ({})", jsonNode.toString())
+ bluePrintContext.inputs?.forEach { propertyName, property ->
+ val valueNode: JsonNode = jsonNode.at("/".plus(propertyName)) ?: NullNode.getInstance()
+
+ val path = BluePrintConstants.PATH_INPUTS.plus(BluePrintConstants.PATH_DIVIDER).plus(propertyName)
+ logger.trace("setting input path ({}), values ({})", path, valueNode)
+ context[path] = valueNode
+ }
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
new file mode 100644
index 000000000..95b2af7b7
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
@@ -0,0 +1,179 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.utils
+
+import com.fasterxml.jackson.annotation.JsonInclude
+import com.fasterxml.jackson.core.type.TypeReference
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializationFeature
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import org.apache.commons.io.FileUtils
+import org.apache.commons.io.IOUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.apps.controllerblueprints.core.format
+import org.slf4j.LoggerFactory
+import java.io.File
+import java.nio.charset.Charset
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+object JacksonUtils {
+ private val log = LoggerFactory.getLogger(JacksonUtils::class.java)
+
+ inline fun <reified T : Any> readValue(content: String): T =
+ jacksonObjectMapper().readValue(content, T::class.java)
+
+ @JvmStatic
+ fun <T> readValue(content: String, valueType: Class<T>): T? {
+ return jacksonObjectMapper().readValue(content, valueType)
+ }
+
+ @JvmStatic
+ fun jsonNodeFromObject(from: kotlin.Any): JsonNode = jacksonObjectMapper().convertValue(from, JsonNode::class.java)
+
+ @JvmStatic
+ fun jsonNodeFromClassPathFile(fileName: String): JsonNode {
+ val content: String = IOUtils.toString(JacksonUtils::class.java.classLoader.getResourceAsStream(fileName), Charset.defaultCharset())
+ ?: throw BluePrintException(String.format("Failed to read json file : %s", fileName))
+ return jsonNode(content)
+ }
+
+ @JvmStatic
+ fun jsonNodeFromFile(fileName: String): JsonNode {
+ val content: String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset())
+ ?: throw BluePrintException(format("Failed to read json file : {}", fileName))
+ return jsonNode(content)
+ }
+
+ @JvmStatic
+ fun jsonNode(content: String): JsonNode {
+ return jacksonObjectMapper().readTree(content)
+ }
+
+ @JvmStatic
+ fun getJson(any: kotlin.Any): String {
+ return getJson(any, false)
+ }
+
+ @JvmStatic
+ fun getJson(any: kotlin.Any, pretty: Boolean = false): String {
+ val objectMapper = jacksonObjectMapper()
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
+ if (pretty) {
+ objectMapper.enable(SerializationFeature.INDENT_OUTPUT)
+ }
+ return objectMapper.writeValueAsString(any)
+ }
+
+ @JvmStatic
+ fun <T> getListFromJson(content: String, valueType: Class<T>): List<T>? {
+ val objectMapper = jacksonObjectMapper()
+ val javaType = objectMapper.typeFactory.constructCollectionType(List::class.java, valueType)
+ return objectMapper.readValue<List<T>>(content, javaType)
+ }
+
+ @JvmStatic
+ fun <T> getMapFromJson(content: String, valueType: Class<T>): MutableMap<String, T>? {
+ val objectMapper = jacksonObjectMapper()
+ val typeRef = object : TypeReference<MutableMap<String, T>>() {}
+ return objectMapper.readValue(content, typeRef)
+ }
+
+ @JvmStatic
+ fun populatePrimitiveValues(key: String, value: Any, primitiveType: String, objectNode: ObjectNode) {
+ if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {
+ objectNode.put(key, value as Boolean)
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {
+ objectNode.put(key, value as Int)
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {
+ objectNode.put(key, value as Float)
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_TIMESTAMP == primitiveType) {
+ objectNode.put(key, value as String)
+ } else {
+ objectNode.put(key, value as String)
+ }
+ }
+
+ @JvmStatic
+ fun populatePrimitiveValues(value: Any, primitiveType: String, objectNode: ArrayNode) {
+ if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {
+ objectNode.add(value as Boolean)
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {
+ objectNode.add(value as Int)
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {
+ objectNode.add(value as Float)
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_TIMESTAMP == primitiveType) {
+ objectNode.add(value as String)
+ } else {
+ objectNode.add(value as String)
+ }
+ }
+
+ @JvmStatic
+ fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) {
+ if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {
+ objectNode.put(key, false)
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {
+ objectNode.put(key, 0)
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {
+ objectNode.put(key, 0.0)
+ } else {
+ objectNode.put(key, "")
+ }
+ }
+
+ @JvmStatic
+ fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) {
+ if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {
+ arrayNode.add(false)
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {
+ arrayNode.add(0)
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {
+ arrayNode.add(0.0)
+ } else {
+ arrayNode.add("")
+ }
+ }
+
+ @JvmStatic
+ fun populateJsonNodeValues(key: String, nodeValue: JsonNode?, type: String, objectNode: ObjectNode) {
+ if (nodeValue == null || nodeValue is NullNode) {
+ objectNode.set(key, nodeValue)
+ } else if (BluePrintTypes.validPrimitiveTypes().contains(type)) {
+ if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_BOOLEAN == type) {
+ objectNode.put(key, nodeValue.asBoolean())
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_INTEGER == type) {
+ objectNode.put(key, nodeValue.asInt())
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_FLOAT == type) {
+ objectNode.put(key, nodeValue.floatValue())
+ } else if (org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.DATA_TYPE_TIMESTAMP == type) {
+ objectNode.put(key, nodeValue.asText())
+ } else {
+ objectNode.put(key, nodeValue.asText())
+ }
+ } else {
+ objectNode.set(key, nodeValue)
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ResourceResolverUtils.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ResourceResolverUtils.kt
new file mode 100644
index 000000000..a26745564
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ResourceResolverUtils.kt
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.utils
+
+import org.apache.commons.io.FileUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmpty
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.io.File
+import java.net.URL
+import java.nio.charset.Charset
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+object ResourceResolverUtils {
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ @JvmStatic
+ fun getFileContent(filename : String, basePath : String?): String {
+ logger.trace("file ({}), basePath ({}) ", filename, basePath)
+ try{
+ var resolvedFileName : String = filename
+ if(filename.startsWith("http", true)
+ || filename.startsWith("https", true)){
+ val givenUrl : String = URL(filename).toString()
+ val systemUrl : String = File(".").toURI().toURL().toString()
+ logger.trace("givenUrl ({}), systemUrl ({}) ", givenUrl, systemUrl)
+ if(givenUrl.startsWith(systemUrl)){
+
+ }
+ }else{
+ if(!filename.startsWith("/")){
+ if (checkNotEmpty(basePath)) {
+ resolvedFileName = basePath.plus(File.separator).plus(filename)
+ }else{
+ resolvedFileName = javaClass.classLoader.getResource(".").path.plus(filename)
+ }
+ }
+ }
+ return FileUtils.readFileToString(File(resolvedFileName), Charset.defaultCharset())
+ }catch (e : Exception){
+ throw BluePrintException(e, "failed to file (%s), basePath (%s) ", filename, basePath)
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt
new file mode 100644
index 000000000..2fcb9b2ae
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.utils
+
+import org.apache.commons.io.FileUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
+import java.io.File
+import java.nio.charset.Charset
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+object ServiceTemplateUtils {
+
+ @JvmStatic
+ fun getServiceTemplate(fileName: String): ServiceTemplate {
+ val content: String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset())
+ return getServiceTemplateFromContent(content)
+ }
+
+
+ @JvmStatic
+ fun getServiceTemplateFromContent(content: String): ServiceTemplate {
+ return JacksonUtils.readValue<ServiceTemplate>(content)
+ }
+
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtils.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtils.kt
new file mode 100644
index 000000000..dcafa974c
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtils.kt
@@ -0,0 +1,131 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.utils
+
+import java.util.*
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class TopologicalSortingUtils<V> {
+
+ private val neighbors: MutableMap<V, MutableList<V>> = hashMapOf()
+
+ val isDag: Boolean
+ get() = topSort() != null
+
+ override fun toString(): String {
+ val s = StringBuffer()
+ for (v in neighbors.keys)
+ s.append("\n " + v + " -> " + neighbors[v])
+ return s.toString()
+ }
+
+ fun getNeighbors(): Map<V, List<V>> {
+ return neighbors
+ }
+
+ fun add(vertex: V) {
+ if (neighbors.containsKey(vertex))
+ return
+ neighbors[vertex] = arrayListOf()
+ }
+
+ operator fun contains(vertex: V): Boolean {
+ return neighbors.containsKey(vertex)
+ }
+
+ fun add(from: V, to: V) {
+ this.add(from)
+ this.add(to)
+ neighbors[from]?.add(to)
+ }
+
+ fun remove(from: V, to: V) {
+ if (!(this.contains(from) && this.contains(to)))
+ throw IllegalArgumentException("Nonexistent vertex")
+ neighbors[from]?.remove(to)
+ }
+
+ fun outDegree(): Map<V, Int> {
+ var result: MutableMap<V, Int> = hashMapOf()
+ for (v in neighbors.keys)
+ result[v] = neighbors[v]!!.size
+ return result
+ }
+
+
+ fun inDegree(): MutableMap<V, Int> {
+ val result = HashMap<V, Int>()
+ for (v in neighbors.keys)
+ result[v] = 0 // All in-degrees are 0
+ for (from in neighbors.keys) {
+ for (to in neighbors[from]!!) {
+ result[to] = result[to]!! + 1 // Increment in-degree
+ }
+ }
+ return result
+ }
+
+ fun topSort(): List<V>? {
+ val degree = inDegree()
+ // Determine all vertices with zero in-degree
+ val zeroVerts = Stack<V>() // Stack as good as any here
+ for (v in degree.keys) {
+ if (degree[v] == 0) zeroVerts.push(v)
+ }
+ // Determine the topological order
+ val result = ArrayList<V>()
+ while (!zeroVerts.isEmpty()) {
+ val v = zeroVerts.pop() // Choose a vertex with zero in-degree
+ result.add(v) // Vertex v is next in topol order
+ // "Remove" vertex v by updating its neighbors
+ for (neighbor in neighbors[v]!!) {
+ degree[neighbor] = degree[neighbor]!! - 1
+ // Remember any vertices that now have zero in-degree
+ if (degree[neighbor] == 0) zeroVerts.push(neighbor)
+ }
+ }
+ // Check that we have used the entire graph (if not, there was a cycle)
+ return if (result.size != neighbors.size) null else result
+ }
+
+
+ fun bfsDistance(start: V): Map<*, *> {
+ var distance: MutableMap<V, Int> = hashMapOf()
+ // Initially, all distance are infinity, except start node
+ for (v in neighbors.keys)
+ distance[v] = -1
+ distance[start] = 0
+ // Process nodes in queue order
+ val queue = LinkedList<V>()
+ queue.offer(start) // Place start node in queue
+ while (!queue.isEmpty()) {
+ val v = queue.remove()
+ val vDist = distance[v]!!
+ // Update neighbors
+ for (neighbor in neighbors[v]!!) {
+ if (distance[neighbor] != null) continue // Ignore if already done
+ distance[neighbor] = vDist + 1
+ queue.offer(neighbor)
+ }
+ }
+ return distance
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt
new file mode 100644
index 000000000..128b7f576
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core
+
+import org.junit.Test
+import kotlin.test.assertEquals
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class CustomFunctionsTest {
+ @Test
+ fun testFormat(): Unit {
+ val returnValue : String = format("This is {} for times {}", "test", 2)
+ assertEquals("This is test for times 2", returnValue, "Failed to format String")
+
+ val returnValue1 : String = format("This is test for times 2")
+ assertEquals("This is test for times 2", returnValue1, "Failed to format empty args")
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt
new file mode 100644
index 000000000..0b2b39c3d
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+
+import org.apache.commons.io.FileUtils
+import org.junit.Before
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.io.File
+import java.nio.charset.Charset
+import kotlin.test.assertNotNull
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class BluePrintContextTest {
+
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ lateinit var bluePrintContext: BluePrintContext
+
+ @Before
+ fun setUp() {
+
+ val basepath = "load/blueprints"
+
+ bluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
+ .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath)
+ assertNotNull(bluePrintContext, "Failed to populate Blueprint context")
+ }
+
+ @Test
+ fun testBluePrintContextFromContent() {
+ val fileName = "load/blueprints/baseconfiguration/Definitions/activation-blueprint.json"
+ val content : String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset())
+ val bpContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
+ .readBlueprint(content)
+ assertNotNull(bpContext, "Failed to get blueprint content")
+ assertNotNull(bpContext.serviceTemplate, "Failed to get blueprint content's service template")
+ }
+
+ @Test
+ fun testChainedProperty() {
+ val nodeType = bluePrintContext.nodeTypeChained("component-resource-assignment")
+ assertNotNull(nodeType, "Failed to get chained node type")
+ logger.trace("Properties {}", JacksonUtils.getJson(nodeType, true))
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoFileServiceTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoFileServiceTest.kt
new file mode 100644
index 000000000..ef4384ff2
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoFileServiceTest.kt
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import org.junit.Test
+import kotlin.test.assertNotNull
+
+/**
+ * BluePrintEnhancerRepoFileServiceTest
+ * @author Brinda Santh
+ *
+ */
+class BluePrintEnhancerRepoFileServiceTest {
+
+ val basePath = "load/model_type"
+
+ @Test
+ fun testGetDataType() {
+ val bluePrintEnhancerRepoFileService = BluePrintEnhancerRepoFileService(basePath)
+ val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate")
+ assertNotNull(dataType, "Failed to get DataType from repo")
+ }
+
+ @Test
+ fun testGetNodeType() {
+ val bluePrintEnhancerRepoFileService = BluePrintEnhancerRepoFileService(basePath)
+ val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment")
+ assertNotNull(nodeType, "Failed to get NodeType from repo")
+ }
+
+ @Test
+ fun testGetArtifactType() {
+ val bluePrintEnhancerRepoFileService = BluePrintEnhancerRepoFileService(basePath)
+ val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity")
+ assertNotNull(nodeType, "Failed to get ArtifactType from repo")
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt
new file mode 100644
index 000000000..6fc18532e
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.ServiceTemplateUtils
+
+/**
+ * BluePrintEnhancerServiceTest
+ * @author Brinda Santh
+ *
+ */
+
+class BluePrintEnhancerServiceTest {
+ val basePath = "load/model_type"
+
+ @Test
+ fun testEnrichBlueprint() {
+ val bluePrintEnhancerRepoFileService = BluePrintEnhancerRepoFileService(basePath)
+ val bluePrintEnhancerService: BluePrintEnhancerService = BluePrintEnhancerDefaultService(bluePrintEnhancerRepoFileService)
+
+ val serviceTemplate = ServiceTemplateUtils.getServiceTemplate("load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json")
+ bluePrintEnhancerService.enhance(serviceTemplate)
+
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
new file mode 100644
index 000000000..911a891a8
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
@@ -0,0 +1,109 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ExpressionData
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class BluePrintExpressionServiceTest {
+ @Test
+ fun testInputExpression() {
+ val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_input\" : \"input-name\" }")
+ val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node)
+ assertNotNull(expressionData, " Failed to populate expression data")
+ assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
+ assertNotNull(expressionData.inputExpression, " Failed to populate input expression data")
+ assertEquals("input-name", expressionData.inputExpression?.propertyName, "Failed to get propertyName from expression data")
+ }
+
+ @Test
+ fun testPropertyExpression() {
+ val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_property\" : [\"SELF\", \"property-name\"] }")
+ val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node)
+ assertNotNull(expressionData, " Failed to populate expression data")
+ assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
+ assertNotNull(expressionData.propertyExpression, " Failed to populate property expression data")
+ assertEquals("SELF", expressionData.propertyExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
+ assertEquals("property-name", expressionData.propertyExpression?.propertyName, " Failed to get expected propertyName")
+
+ val node1 : JsonNode = jacksonObjectMapper().readTree("{ \"get_property\" : [\"SELF\", \"\",\"property-name\", \"resource\", \"name\"] }")
+ val expressionData1 : ExpressionData = BluePrintExpressionService.getExpressionData(node1)
+ assertNotNull(expressionData1, " Failed to populate expression data")
+ assertEquals(expressionData1.isExpression, true, "Failed to identify as nested property expression")
+ assertNotNull(expressionData1.propertyExpression, " Failed to populate nested property expression data")
+ assertEquals("SELF", expressionData1.propertyExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
+ assertEquals("property-name", expressionData1.propertyExpression?.propertyName, " Failed to get expected propertyName")
+ assertEquals("resource/name",expressionData1.propertyExpression?.subPropertyName, " Failed to populate nested subPropertyName expression data")
+ }
+
+ @Test
+ fun testAttributeExpression() {
+ val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }")
+ val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node)
+ assertNotNull(expressionData, " Failed to populate expression data")
+ assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
+ assertNotNull(expressionData.attributeExpression, " Failed to populate attribute expression data")
+ assertEquals("SELF", expressionData.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
+ assertEquals("attribute-name", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName")
+ assertEquals("resource/name",expressionData.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")
+ }
+
+
+ @Test
+ fun testOutputOperationExpression() {
+ val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_operation_output\": [\"SELF\", \"interface-name\", \"operation-name\", \"output-property-name\"] }")
+ val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node)
+ assertNotNull(expressionData, " Failed to populate expression data")
+ assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
+ assertNotNull(expressionData.operationOutputExpression, " Failed to populate output expression data")
+ assertEquals("SELF", expressionData.operationOutputExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
+ assertEquals("interface-name", expressionData.operationOutputExpression?.interfaceName, " Failed to get expected interfaceName")
+ assertEquals("operation-name", expressionData.operationOutputExpression?.operationName, " Failed to get expected operationName")
+ assertEquals("output-property-name", expressionData.operationOutputExpression?.propertyName, " Failed to get expected propertyName")
+ }
+
+
+ @Test
+ fun testArtifactExpression() {
+ val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_artifact\" : [\"SELF\", \"artifact-template\"] }")
+ val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node)
+ assertNotNull(expressionData, " Failed to populate expression data")
+ assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
+ assertNotNull(expressionData.artifactExpression, " Failed to populate Artifact expression data")
+ assertEquals("SELF", expressionData.artifactExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
+ assertEquals("artifact-template", expressionData.artifactExpression?.artifactName, " Failed to get expected artifactName")
+
+
+ val node1 : JsonNode = jacksonObjectMapper().readTree("{ \"get_artifact\" : [\"SELF\", \"artifact-template\", \"location\", true] }")
+ val expressionData1 : ExpressionData = BluePrintExpressionService.getExpressionData(node1)
+ assertNotNull(expressionData1, " Failed to populate expression data")
+ assertEquals(expressionData1.isExpression, true, "Failed to identify as expression")
+ assertNotNull(expressionData1.artifactExpression, " Failed to populate Artifact expression data")
+ assertEquals("SELF", expressionData1.artifactExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
+ assertEquals("artifact-template", expressionData1.artifactExpression?.artifactName, " Failed to get expected artifactName")
+ assertEquals("location", expressionData1.artifactExpression?.location, " Failed to get expected location")
+ assertEquals(true, expressionData1.artifactExpression?.remove, " Failed to get expected remove")
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt
new file mode 100644
index 000000000..0f211ab54
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintParserFactoryTest.kt
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import kotlin.test.assertNotNull
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class BluePrintParserFactoryTest {
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ @Test
+ fun testBluePrintJson() {
+ val basepath = "load/blueprints"
+
+ val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.TYPE_DEFAULT)!!
+ .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath)
+ assertNotNull(bluePrintContext, "Failed to populate Blueprint context")
+ logger.trace("Blue Print {}",bluePrintContext.blueprintJson(true))
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
new file mode 100644
index 000000000..8ed161a15
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
@@ -0,0 +1,131 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.NullNode
+import org.junit.Before
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintRuntimeUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils.jsonNodeFromFile
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils.jsonNodeFromObject
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class BluePrintRuntimeServiceTest {
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+ val basepath = "load/blueprints"
+
+
+ @Before
+ fun setUp(): Unit {
+
+ }
+
+ @Test
+ fun testResolveNodeTemplateProperties() {
+ logger.info("************************ testResolveNodeTemplateProperties **********************")
+ val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
+ .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath)
+
+ val context: MutableMap<String, Any> = hashMapOf()
+ context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
+ val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context)
+
+ val inputDataPath = "src/test/resources/data/default-context.json"
+
+ val inputNode: JsonNode = jsonNodeFromFile(inputDataPath)
+ bluePrintRuntimeService.assignInputs(inputNode)
+
+ val propContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process")
+ logger.info("Context {}" ,bluePrintRuntimeService.context)
+
+ assertNotNull(propContext, "Failed to populate interface property values")
+ assertEquals(propContext.get("process-name"), jsonNodeFromObject("sample-action"), "Failed to populate parameter process-name")
+ assertEquals(propContext.get("version"), jsonNodeFromObject("sample-action"), "Failed to populate parameter version")
+ }
+
+ @Test
+ fun testResolveNodeTemplateInterfaceOperationInputs() {
+ logger.info("************************ testResolveNodeTemplateInterfaceOperationInputs **********************")
+ val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
+ .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath)
+ assertNotNull(bluePrintContext, "Failed to populate Blueprint context")
+
+ val context: MutableMap<String, Any> = hashMapOf()
+ context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
+
+ val inputDataPath = "src/test/resources/data/default-context.json"
+ BluePrintRuntimeUtils.assignInputsFromFile(bluePrintContext, inputDataPath, context)
+
+
+ val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context)
+
+ logger.info("Prepared Context {}" ,context)
+
+ val inContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment",
+ "DefaultComponentNode", "process")
+
+ logger.trace("In Context {}" ,inContext)
+
+ assertNotNull(inContext, "Failed to populate interface input property values")
+ assertEquals(inContext.get("action-name"), jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
+ assertEquals(inContext.get("request-id"), jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
+ assertEquals(inContext.get("template-content"), jsonNodeFromObject("This is Sample Velocity Template"), "Failed to populate parameter action-name")
+
+ }
+
+ @Test
+ fun testResolveNodeTemplateInterfaceOperationOutputs() {
+ logger.info("************************ testResolveNodeTemplateInterfaceOperationOutputs **********************")
+ val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
+ .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath)
+ assertNotNull(bluePrintContext, "Failed to populate Blueprint context")
+
+ val context: MutableMap<String, Any> = hashMapOf()
+ context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
+
+ val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context)
+
+ val componentContext: MutableMap<String, Any?> = hashMapOf()
+ val successValue : JsonNode= jsonNodeFromObject("Success")
+ componentContext["resource-assignment.DefaultComponentNode.process.status"] = successValue
+ componentContext["resource-assignment.DefaultComponentNode.process.resource-assignment-params"] = null
+
+ bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment",
+ "DefaultComponentNode", "process", componentContext)
+
+ assertEquals(NullNode.instance,
+ context.get("node_templates/resource-assignment/interfaces/DefaultComponentNode/operations/process/properties/resource-assignment-params"),
+ "Failed to get operation property resource-assignment-params")
+
+ assertEquals(successValue,
+ context.get("node_templates/resource-assignment/interfaces/DefaultComponentNode/operations/process/properties/status"),
+ "Failed to get operation property status")
+
+
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt
new file mode 100644
index 000000000..bccd946c4
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.service
+
+import org.junit.Before
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+class BluePrintValidatorDefaultServiceTest {
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+ val basepath = "load/blueprints"
+
+ @Before
+ fun setUp(): Unit {
+
+ }
+
+ @Test
+ fun testValidateBluePrint() {
+ val bluePrintContext: BluePrintContext = BluePrintParserFactory.instance(BluePrintConstants.TYPE_DEFAULT)!!
+ .readBlueprintFile("baseconfiguration/Definitions/activation-blueprint.json", basepath)
+ val properties : MutableMap<String, Any> = hashMapOf()
+ val validatorService = BluePrintValidatorDefaultService()
+ validatorService.validateBlueprint(bluePrintContext.serviceTemplate,properties)
+ logger.info("Validation Message {}", properties)
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
new file mode 100644
index 000000000..ddb39a2d6
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.utils
+
+
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ToscaMetaData
+import kotlin.test.assertNotNull
+
+class BluePrintMetadataUtilsTest {
+
+ @Test
+ fun testToscaMetaData(){
+
+ val basePath : String = "load/blueprints/baseconfiguration"
+
+ val toscaMetaData : ToscaMetaData = BluePrintMetadataUtils.toscaMetaData(basePath)
+ assertNotNull(toscaMetaData, "Missing Tosca Definition Object")
+ assertNotNull(toscaMetaData.toscaMetaFileVersion, "Missing Tosca Metadata Version")
+ assertNotNull(toscaMetaData.csarVersion, "Missing CSAR version")
+ assertNotNull(toscaMetaData.createdBy, "Missing Created by")
+ assertNotNull(toscaMetaData.entityDefinitions, "Missing Tosca Entity Definition")
+ assertNotNull(toscaMetaData.templateTags, "Missing Template Tags")
+
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt
new file mode 100644
index 000000000..28f3b3974
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt
@@ -0,0 +1,71 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.utils
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+
+/**
+ * JacksonUtilsTest
+ * @author Brinda Santh
+ * ${DATA}
+ */
+class JacksonUtilsTest {
+
+ private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
+
+ val basePath = "load/blueprints"
+
+ @Test
+ fun testReadValues() {
+ val content = ResourceResolverUtils.getFileContent("baseconfiguration/Definitions/activation-blueprint.json", basePath)
+ val serviceTemplate = JacksonUtils.readValue(content, ServiceTemplate::class.java)
+ assertNotNull(serviceTemplate, "Failed to simple transform Service Template")
+ assertEquals(true, serviceTemplate is ServiceTemplate, "failed to get Service Template instance")
+
+ val jsonContent = JacksonUtils.getJson(serviceTemplate!!, true)
+ assertNotNull(jsonContent, "Failed to get json content")
+ }
+
+ @Test
+ fun testJsonNodeFromClassPathFile() {
+ val filePath = "data/default-context.json"
+ val jsonNode = JacksonUtils.jsonNodeFromClassPathFile(filePath)
+ assertNotNull(jsonNode, "Failed to get json node from file")
+ assertEquals(true, jsonNode is JsonNode, "failed to get JSON node instance")
+ }
+
+ @Test
+ fun testJsonNodeFromFile() {
+ val filePath = basePath + "/baseconfiguration/Definitions/activation-blueprint.json"
+ val jsonNode = JacksonUtils.jsonNodeFromFile(filePath)
+ assertNotNull(jsonNode, "Failed to get json node from file")
+ assertEquals(true, jsonNode is JsonNode, "failed to get JSON node instance")
+ }
+
+ @Test
+ fun testGetListFromJson() {
+ val content = "[\"good\",\"boy\" ]"
+ val nodeType = JacksonUtils.getListFromJson(content, String::class.java)
+ assertNotNull(nodeType, "Failed to get String array from content")
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
new file mode 100644
index 000000000..907eb2e0c
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.core.utils
+
+import org.junit.Test
+
+class TopologicalSortingUtilsTest {
+
+ @Test
+ fun testSorting(): Unit {
+ val graph: TopologicalSortingUtils<String> = TopologicalSortingUtils<String>()
+ graph.add("bundle-id", "bundle-mac")
+ graph.add("bundle-id", "bundle-ip")
+ graph.add("bundle-mac", "bundle-ip")
+ graph.add("bundle-ip", "bundle-mac")
+
+ println("The current graph: " + graph)
+ println("In-degrees: " + graph.inDegree())
+ println("Out-degrees: " + graph.outDegree())
+ println("A topological sort of the vertices: " + graph.topSort())
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/resources/componentnode/default.json b/ms/controllerblueprints/modules/core/src/test/resources/componentnode/default.json
new file mode 100644
index 000000000..b7265fcd1
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/resources/componentnode/default.json
@@ -0,0 +1,100 @@
+{
+ "metadata": {
+ "template_author": "bs2796",
+ "vendor": "Juniper",
+ "os": "XXX",
+ "service-type": "AVPN",
+ "vnf-type": "VRR",
+ "action": "Base Configuration",
+ "sub-action": "Generate Configuration",
+ "template_name": "VRR-baseconfiguration",
+ "template_version": "1.0.0"
+ },
+ "topology_template": {
+ "inputs": {
+ "service-instance-id": {
+ "required": true,
+ "type": "string"
+ },
+ "vnf-id": {
+ "required": true,
+ "type": "string"
+ },
+ "service": {
+ "required": true,
+ "type": "string"
+ },
+ "region": {
+ "required": true,
+ "type": "string"
+ },
+ "bundle-id": {
+ "required": true,
+ "type": "string"
+ },
+ "bundle-mac": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "node_templates": {
+ "generate-configuration": {
+ "type": "mock-component-generateConfig",
+ "interfaces": {
+ "org-openecomp-sdnc-config-params-service-MockComponentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "entity-type": "vnf-type",
+ "template-content": "sample-template",
+ "entity-id": "{ \"get_input\" : \"vnf-id\" }"
+ },
+ "outputs": {
+ "mergedData": "merged Data",
+ "status": "status"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "node_types": {
+ "mock-component-generateConfig": {
+ "interfaces": {
+ "org-openecomp-sdnc-config-params-service-MockComponentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "entity-type": {
+ "required": false,
+ "type": "string"
+ },
+ "template-content": {
+ "required": false,
+ "type": "string"
+ },
+ "entity-id": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "generated-config": {
+ "required": true,
+ "type": "string"
+ },
+ "status": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ }
+ }
+}
diff --git a/ms/controllerblueprints/modules/core/src/test/resources/data/default-context.json b/ms/controllerblueprints/modules/core/src/test/resources/data/default-context.json
new file mode 100644
index 000000000..fcd4cbe26
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/resources/data/default-context.json
@@ -0,0 +1,5 @@
+{
+ "request-id" : "12345",
+ "hostname" : "localhost",
+ "action-name" : "sample-action"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/src/test/resources/dictionary/dictionary_schema.json b/ms/controllerblueprints/modules/core/src/test/resources/dictionary/dictionary_schema.json
new file mode 100644
index 000000000..d03170050
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/resources/dictionary/dictionary_schema.json
@@ -0,0 +1,261 @@
+{
+ "type": "object",
+ "properties": {
+ "resource-path": {
+ "type": "string",
+ "required": true
+ },
+ "description": {
+ "type": "string"
+ },
+ "updated-by": {
+ "type": "string"
+ },
+ "data-type": {
+ "type": "string",
+ "required": true
+ },
+ "source": {
+ "type": "object",
+ "required": true,
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {
+ "key": {
+ "type": "string"
+ }
+ }
+ },
+ "component": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "required": true
+ },
+ "input-key-mapping": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "output-key-mapping": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "default": {
+ "type": "any"
+ },
+ "aai": {
+ "type": "any"
+ },
+ "mdsal": {
+ "type": "object",
+ "properties": {
+ "path": {
+ "type": "string",
+ "required": true
+ },
+ "url-path": {
+ "type": "string",
+ "required": true
+ },
+ "input-key-mapping": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "type": {
+ "type": "string",
+ "required": true
+ },
+ "output-key-mapping": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "base": {
+ "type": "string",
+ "required": true
+ }
+ }
+ },
+ "network-resource-discovery": {
+ "type": "object",
+ "properties": {
+ "input-key-mapping": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "output-key-mapping": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "db": {
+ "type": "object",
+ "properties": {
+ "query": {
+ "type": "string",
+ "required": true
+ },
+ "input-key-mapping": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "type": {
+ "type": "string",
+ "required": true
+ },
+ "output-key-mapping": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "base": {
+ "type": "string",
+ "required": true
+ }
+ }
+ },
+ "policy": {
+ "type": "object",
+ "properties": {
+ "input-key-mapping": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "output-key-mapping": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "candidate-dependency": {
+ "type": "object",
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {
+ "names": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "component": {
+ "type": "object",
+ "properties": {
+ "names": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "aai": {
+ "type": "object",
+ "properties": {
+ "names": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "mdsal": {
+ "type": "object",
+ "properties": {
+ "names": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "network-resource-discovery": {
+ "type": "object",
+ "properties": {
+ "names": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "db": {
+ "type": "object",
+ "properties": {
+ "names": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "policy": {
+ "type": "object",
+ "properties": {
+ "names": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "tags": {
+ "type": "string"
+ },
+ "default": {
+ "type": "any"
+ },
+ "name": {
+ "type": "string",
+ "required": true
+ },
+ "valid-values": {
+ "type": "string"
+ },
+ "resource-type": {
+ "type": "string",
+ "required": true
+ },
+ "sample-value": {
+ "type": "string"
+ },
+ "entry-schema": {
+ "type": "string"
+ }
+ }
+}
diff --git a/ms/controllerblueprints/modules/core/src/test/resources/properties/convert.json b/ms/controllerblueprints/modules/core/src/test/resources/properties/convert.json
new file mode 100644
index 000000000..cb7d08e44
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/resources/properties/convert.json
@@ -0,0 +1,33 @@
+{
+ "type": "sdnc-component-getResourceAssignment",
+ "interfaces": {
+ "ResourceAssignmentService": {
+ "operations": {
+ "getResourceAssignment": {
+ "inputs": {
+ "assignment-mappings": [
+ {
+ "name": "service-name",
+ "mapping-field": "service",
+ "mapping-category": "SDN",
+ "required": true
+ },
+ {
+ "name": "region-name",
+ "mapping-field": "region",
+ "mapping-category": "SDN",
+ "required": true
+ }
+ ],
+ "pre-data": "{ \"get_attribute\" : \"get-resource-assignment.config-params\" }",
+ "prifix": "get-resource-assignment"
+ },
+ "outputs": {
+ "resource-assignment-status": "success",
+ "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params\" }"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/ms/controllerblueprints/modules/core/src/test/resources/properties/default.json b/ms/controllerblueprints/modules/core/src/test/resources/properties/default.json
new file mode 100644
index 000000000..0ac97f907
--- /dev/null
+++ b/ms/controllerblueprints/modules/core/src/test/resources/properties/default.json
@@ -0,0 +1,16 @@
+{
+ "default": "{ \"get_input\" : \"loopback-default\" }",
+ "domain": "ethernet",
+ "criteria": [
+ {
+ "value": "attga301me1",
+ "type": "complex",
+ "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"
+ },
+ {
+ "value": "{ \"get_input\" : \"host-ip-address\" }",
+ "type": "simple",
+ "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"
+ }
+ ]
+}
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
new file mode 100644
index 000000000..9e7215ba8
--- /dev/null
+++ b/ms/controllerblueprints/modules/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps</groupId>
+ <artifactId>controllerblueprints-parent</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <artifactId>controllerblueprints-modules</artifactId>
+ <name>Controller Blueprints Modules</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>core</module>
+ <module>resource-dict</module>
+ <module>service</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <!-- <skip>${skip.compile}</skip>-->
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+
diff --git a/ms/controllerblueprints/modules/resource-dict/pom.xml b/ms/controllerblueprints/modules/resource-dict/pom.xml
new file mode 100644
index 000000000..a0d1be611
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps</groupId>
+ <artifactId>controllerblueprints-modules</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>controllerblueprints-resource-dict</artifactId>
+ <name>Controller Blueprints Resource Dictionary</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps</groupId>
+ <artifactId>controllerblueprints-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+
+ </dependencies>
+
+
+</project>
+
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java
new file mode 100644
index 000000000..15576b906
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java
@@ -0,0 +1,167 @@
+/*
+ * 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;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * ResourceAssignment.java Purpose: Provide ResourceAssignment Custom TOSCO Model POJO bean.
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+public class ResourceAssignment {
+
+ private String name;
+
+ @JsonProperty("property")
+ private PropertyDefinition property;
+
+ @JsonProperty("input-param")
+ private Boolean inputParameter;
+
+ @JsonProperty("dictionary-name")
+ private String dictionaryName;
+
+ @JsonProperty("dictionary-source")
+ private String dictionarySource;
+
+ @JsonProperty("dependencies")
+ private List<String> dependencies;
+
+ @JsonProperty("version")
+ private int version;
+
+ @JsonProperty("status")
+ private String status;
+
+ @JsonProperty("message")
+ private String message;
+
+ @JsonProperty("updated-date")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy hh:mm:ss")
+ private Date updatedDate;
+
+ @JsonProperty("updated-by")
+ private String updatedBy;
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("[");
+ builder.append("name = " + name);
+ builder.append(", source = " + dictionarySource);
+ if (dependencies != null) {
+ builder.append(", dependencies = " + dependencies);
+ }
+ builder.append("]");
+ return builder.toString();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public PropertyDefinition getProperty() {
+ return property;
+ }
+
+ public void setProperty(PropertyDefinition property) {
+ this.property = property;
+ }
+
+ public Boolean getInputParameter() {
+ return inputParameter;
+ }
+
+ public void setInputParameter(Boolean inputParameter) {
+ this.inputParameter = inputParameter;
+ }
+
+ public String getDictionaryName() {
+ return dictionaryName;
+ }
+
+ public void setDictionaryName(String dictionaryName) {
+ this.dictionaryName = dictionaryName;
+ }
+
+ public String getDictionarySource() {
+ return dictionarySource;
+ }
+
+ public void setDictionarySource(String dictionarySource) {
+ this.dictionarySource = dictionarySource;
+ }
+
+ public List<String> getDependencies() {
+ return dependencies;
+ }
+
+ public void setDependencies(List<String> dependencies) {
+ this.dependencies = dependencies;
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ public void setVersion(int version) {
+ this.version = version;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public Date getUpdatedDate() {
+ return updatedDate;
+ }
+
+ public void setUpdatedDate(Date updatedDate) {
+ this.updatedDate = updatedDate;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DecryptionRule.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DecryptionRule.java
new file mode 100644
index 000000000..be435242d
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DecryptionRule.java
@@ -0,0 +1,67 @@
+/*
+ * 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.data;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+/**
+ *
+ * DecryptionRule.java Purpose:
+ * @author Brinda Santh
+ */
+public class DecryptionRule {
+
+ private List<String> sources = null;
+ private String path;
+ private String rule;
+ @JsonProperty("decrypt-type")
+ private String decryptType;
+
+ public List<String> getSources() {
+ return sources;
+ }
+
+ public void setSources(List<String> sources) {
+ this.sources = sources;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public String getRule() {
+ return rule;
+ }
+
+ public void setRule(String rule) {
+ this.rule = rule;
+ }
+
+ public String getDecryptType() {
+ return decryptType;
+ }
+
+ public void setDecryptType(String decryptType) {
+ this.decryptType = decryptType;
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java
new file mode 100644
index 000000000..4dc9c89a1
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java
@@ -0,0 +1,181 @@
+/*
+ * 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.data;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.JsonNode;
+
+import java.util.List;
+import java.util.Map;
+/**
+ *
+ * DictionaryDefinition.java Purpose:
+ * @author Brinda Santh
+ */
+public class DictionaryDefinition {
+ @JsonProperty(value = "name", required = true)
+ private String name;
+ @JsonProperty(value = "description")
+ private String description;
+
+ @JsonProperty(value = "valid-values")
+ private String validValues;
+
+ @JsonProperty(value = "sample-value")
+ private String sampleValue;
+
+ private String tags;
+ @JsonProperty(value = "updated-by")
+ private String updatedBy;
+
+ @JsonProperty(value = "resource-type", required = true)
+ private String resourceType;
+
+ @JsonProperty(value = "resource-path", required = true)
+ private String resourcePath;
+
+ @JsonProperty(value = "data-type", required = true)
+ private String dataType;
+
+ @JsonProperty("entry-schema")
+ private String entrySchema;
+
+ @JsonProperty(value = "default")
+ private Object defaultValue;
+
+ @JsonProperty(value = "source", required = true)
+ private Map<String, JsonNode> source;
+
+ @JsonProperty("candidate-dependency")
+ private Map<String, DictionaryDependency> dependency;
+
+ @JsonProperty("decryption-rules")
+ private List<DecryptionRule> decryptionRules;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getValidValues() {
+ return validValues;
+ }
+
+ public void setValidValues(String validValues) {
+ this.validValues = validValues;
+ }
+
+ public String getSampleValue() {
+ return sampleValue;
+ }
+
+ public void setSampleValue(String sampleValue) {
+ this.sampleValue = sampleValue;
+ }
+
+ public String getTags() {
+ return tags;
+ }
+
+ public void setTags(String tags) {
+ this.tags = tags;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public String getResourcePath() {
+ return resourcePath;
+ }
+
+ public void setResourcePath(String resourcePath) {
+ this.resourcePath = resourcePath;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getEntrySchema() {
+ return entrySchema;
+ }
+
+ public void setEntrySchema(String entrySchema) {
+ this.entrySchema = entrySchema;
+ }
+
+ public Object getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(Object defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public Map<String, JsonNode> getSource() {
+ return source;
+ }
+
+ public void setSource(Map<String, JsonNode> source) {
+ this.source = source;
+ }
+
+ public Map<String, DictionaryDependency> getDependency() {
+ return dependency;
+ }
+
+ public void setDependency(Map<String, DictionaryDependency> dependency) {
+ this.dependency = dependency;
+ }
+
+ public List<DecryptionRule> getDecryptionRules() {
+ return decryptionRules;
+ }
+
+ public void setDecryptionRules(List<DecryptionRule> decryptionRules) {
+ this.decryptionRules = decryptionRules;
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java
new file mode 100644
index 000000000..acb710584
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;
+
+import java.util.List;
+/**
+ *
+ * DictionaryDependency
+ * @author Brinda Santh
+ */
+public class DictionaryDependency {
+ private List<String> names;
+
+ public List<String> getNames() {
+ return names;
+ }
+
+ public void setNames(List<String> names) {
+ this.names = names;
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java
new file mode 100644
index 000000000..23d404605
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java
@@ -0,0 +1,83 @@
+/*
+ * 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.data;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.Map;
+/**
+ *
+ * SourceDb
+ * @author Brinda Santh
+ */
+public class SourceDb {
+ @JsonProperty(value = "base", required = true)
+ private String base;
+ @JsonProperty(value = "type", required = true)
+ private String type; // SQL | PLSQL
+ @JsonProperty(value = "query", required = true)
+ private String query;
+
+ @JsonProperty("input-key-mapping")
+ private Map<String, String> inputKeyMapping;
+
+ @JsonProperty("output-key-mapping")
+ private Map<String, String> outputKeyMapping;
+
+ public String getBase() {
+ return base;
+ }
+
+ public void setBase(String base) {
+ this.base = base;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getQuery() {
+ return query;
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+
+ public Map<String, String> getInputKeyMapping() {
+ return inputKeyMapping;
+ }
+
+ public void setInputKeyMapping(Map<String, String> inputKeyMapping) {
+ this.inputKeyMapping = inputKeyMapping;
+ }
+
+ public Map<String, String> getOutputKeyMapping() {
+ return outputKeyMapping;
+ }
+
+ public void setOutputKeyMapping(Map<String, String> outputKeyMapping) {
+ this.outputKeyMapping = outputKeyMapping;
+ }
+
+
+
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java
new file mode 100644
index 000000000..0a4351cca
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;
+/**
+ *
+ * SourceDefault
+ * @author Brinda Santh
+ */
+public class SourceDefault {
+
+ private String key;
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java
new file mode 100644
index 000000000..82cb769da
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java
@@ -0,0 +1,37 @@
+/*
+ * 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.data;
+/**
+ *
+ * SourceInput
+ * @author Brinda Santh
+ */
+public class SourceInput {
+
+ private String key;
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+
+
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java
new file mode 100644
index 000000000..9eb233e76
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java
@@ -0,0 +1,97 @@
+/*
+ * 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.data;
+/**
+ *
+ * SourceMdsal
+ * @author Brinda Santh
+ */
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.Map;
+
+public class SourceMdsal {
+
+ @JsonProperty(value = "base", required = true)
+ private String base;
+
+ @JsonProperty(value = "type", required = true)
+ private String type; // XML | JSON
+
+ @JsonProperty(value = "url-path", required = true)
+ private String urlPath;
+
+ @JsonProperty(value = "path", required = true)
+ private String path;
+
+ @JsonProperty("input-key-mapping")
+ private Map<String, String> inputKeyMapping;
+
+ @JsonProperty("output-key-mapping")
+ private Map<String, String> outputKeyMapping;
+
+ public String getBase() {
+ return base;
+ }
+
+ public void setBase(String base) {
+ this.base = base;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getUrlPath() {
+ return urlPath;
+ }
+
+ public void setUrlPath(String urlPath) {
+ this.urlPath = urlPath;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public Map<String, String> getInputKeyMapping() {
+ return inputKeyMapping;
+ }
+
+ public void setInputKeyMapping(Map<String, String> inputKeyMapping) {
+ this.inputKeyMapping = inputKeyMapping;
+ }
+
+ public Map<String, String> getOutputKeyMapping() {
+ return outputKeyMapping;
+ }
+
+ public void setOutputKeyMapping(Map<String, String> outputKeyMapping) {
+ this.outputKeyMapping = outputKeyMapping;
+ }
+
+
+
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.java
new file mode 100644
index 000000000..9d51d8213
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.java
@@ -0,0 +1,129 @@
+/*
+ * 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 com.fasterxml.jackson.databind.JsonNode;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.EntrySchema;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DictionaryDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DictionaryDependency;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Supplier;
+
+/**
+ * ResourceDictionaryUtils.java Purpose to provide ResourceDictionaryUtils
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+public class ResourceDictionaryUtils {
+
+ private ResourceDictionaryUtils() {
+ // Do nothing
+ }
+
+ private static final Logger log = LoggerFactory.getLogger(ResourceDictionaryUtils.class);
+
+ /**
+ * This Method is to assign the source name to the Dictionary Definition Check to see if the source
+ * definition is not present then assign, if more than one source then assign only one first source.
+ *
+ * @param resourceAssignment
+ * @param dictionaryDefinition
+ */
+ @SuppressWarnings("squid:S3776")
+ public static void populateSourceMapping(ResourceAssignment resourceAssignment,
+ DictionaryDefinition dictionaryDefinition) {
+
+ if (resourceAssignment != null && dictionaryDefinition != null
+ && StringUtils.isBlank(resourceAssignment.getDictionarySource())) {
+
+ // Overwrite the Property Definitions from Dictionary
+ setProperty(resourceAssignment, dictionaryDefinition);
+
+ Map<String, JsonNode> dictionarySource = dictionaryDefinition.getSource();
+ Map<String, DictionaryDependency> dictionaryDependencyMap = dictionaryDefinition.getDependency();
+
+ if (MapUtils.isNotEmpty(dictionarySource)) {
+ String source = findFirstSource(dictionarySource);
+
+ // Populate and Assign First Source
+ if (StringUtils.isNotBlank(source)) {
+ // Set Dictionary Source
+ resourceAssignment.setDictionarySource(source);
+
+ if (MapUtils.isNotEmpty(dictionaryDependencyMap)) {
+ // Set Dependencies
+ DictionaryDependency dictionaryDependency = dictionaryDependencyMap.get(source);
+ if (dictionaryDependency != null) {
+ resourceAssignment.setDependencies(dictionaryDependency.getNames());
+ }
+ }
+ } else {
+ resourceAssignment.setDictionarySource(ConfigModelConstant.SOURCE_INPUT);
+ }
+ log.info("auto map resourceAssignment : {}", resourceAssignment);
+ }
+ }
+ }
+
+ public static <T> Optional<T> resolve(Supplier<T> resolver) {
+ try {
+ T result = resolver.get();
+ return Optional.ofNullable(result);
+ } catch (NullPointerException e) {
+ return Optional.empty();
+ }
+ }
+
+ private static String findFirstSource(Map<String, JsonNode> dictionarySource) {
+ String source = null;
+ if (MapUtils.isNotEmpty(dictionarySource)) {
+ source = dictionarySource.keySet().stream().findFirst().get();
+ }
+ return source;
+ }
+
+ /**
+ * Overriding ResourceAssignment Properties with properties defined in Dictionary
+ */
+ private static void setProperty(ResourceAssignment resourceAssignment, DictionaryDefinition dictionaryDefinition) {
+ if (StringUtils.isNotBlank(dictionaryDefinition.getDataType())) {
+ PropertyDefinition property = resourceAssignment.getProperty();
+ if (property == null) {
+ property = new PropertyDefinition();
+ }
+ property.setDefaultValue(dictionaryDefinition.getDefaultValue());
+ property.setType(dictionaryDefinition.getDataType());
+ if (StringUtils.isNotBlank(dictionaryDefinition.getEntrySchema())) {
+ EntrySchema entrySchema = new EntrySchema();
+ entrySchema.setType(dictionaryDefinition.getEntrySchema());
+ property.setEntrySchema(entrySchema);
+ }
+ resourceAssignment.setProperty(property);
+ }
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/validator/ResourceAssignmentValidator.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/validator/ResourceAssignmentValidator.java
new file mode 100644
index 000000000..c980a0c08
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/validator/ResourceAssignmentValidator.java
@@ -0,0 +1,164 @@
+/*
+ * 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.validator;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.text.StrBuilder;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.CapabilityAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.TopologicalSortingUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+/**
+ *
+ * ResourceAssignmentValidator.java Purpose:
+ * @author Brinda Santh
+ */
+public class ResourceAssignmentValidator {
+ private static final Logger log = LoggerFactory.getLogger(ResourceAssignmentValidator.class);
+ private List<ResourceAssignment> assignments;
+ private Map<String, ResourceAssignment> resourceAssignmentMap = new HashMap();
+ private StrBuilder validationMessage = new StrBuilder();
+
+ public ResourceAssignmentValidator(List<ResourceAssignment> assignments) {
+ this.assignments = assignments;
+ }
+
+ public ResourceAssignmentValidator(NodeTemplate nodeTemplate) throws BluePrintException {
+
+ if (nodeTemplate != null && nodeTemplate.getCapabilities() != null) {
+ CapabilityAssignment capabilityAssignment =
+ nodeTemplate.getCapabilities().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
+ if (capabilityAssignment != null && capabilityAssignment.getProperties() != null) {
+ Object mappingObject =
+ capabilityAssignment.getProperties().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
+ if (mappingObject != null) {
+ String mappingContent = JacksonUtils.getJson(mappingObject);
+ if (StringUtils.isNotBlank(mappingContent)) {
+ this.assignments =
+ JacksonUtils.getListFromJson(mappingContent, ResourceAssignment.class);
+ } else {
+ validationMessage
+ .appendln(String.format("Failed to transform Mapping Content (%s) ", mappingContent));
+ throw new BluePrintException(
+ String.format("Failed to transform Mapping Content (%s) ", mappingContent));
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This is a validateResourceAssignment to validate the Topology Template
+ *
+ * @return boolean
+ * @throws BluePrintException
+ */
+ public boolean validateResourceAssignment() throws BluePrintException {
+ if (assignments != null && !assignments.isEmpty()) {
+ validateDuplicateDictionaryKeys();
+ validateCyclicDependency();
+ if (validationMessage.length() > 0) {
+ throw new BluePrintException("Resource Assignment Validation :" + validationMessage.toString());
+ }
+ }
+ return true;
+ }
+
+ @SuppressWarnings("squid:S3776")
+ private void validateDuplicateDictionaryKeys() {
+ this.assignments.forEach(resourceMapping -> {
+ if (resourceMapping != null) {
+ if (!resourceAssignmentMap.containsKey(resourceMapping.getName())) {
+ resourceAssignmentMap.put(resourceMapping.getName(), resourceMapping);
+ } else {
+ validationMessage.appendln(String.format("Duplicate Assignment Template Key (%s) is Present",
+ resourceMapping.getName()));
+ }
+ }
+ });
+
+ if (!assignments.isEmpty()) {
+ Set<String> uniqueSet = new HashSet<>();
+ for (ResourceAssignment resourceAssignment : assignments) {
+ if (resourceAssignment != null) {
+ boolean added = uniqueSet.add(resourceAssignment.getDictionaryName());
+ if (!added) {
+ validationMessage.appendln(
+ String.format("Duplicate Assignment Dictionary Key (%s) present with Template Key (%s)",
+ resourceAssignment.getDictionaryName(), resourceAssignment.getName()));
+ }
+ }
+ }
+ }
+ }
+
+ private void validateCyclicDependency() {
+ TopologicalSortingUtils<ResourceAssignment> topologySorting = new TopologicalSortingUtils<>();
+ this.resourceAssignmentMap.forEach((mappingKey, mapping) -> {
+ if (mapping != null) {
+ if (mapping.getDependencies() != null && !mapping.getDependencies().isEmpty()) {
+ for (String dependency : mapping.getDependencies()) {
+ topologySorting.add(resourceAssignmentMap.get(dependency), mapping);
+ }
+ } else {
+ topologySorting.add(null, mapping);
+ }
+ }
+ });
+
+ if (!topologySorting.isDag()) {
+ String graph = getTopologicalGraph(topologySorting);
+ validationMessage.appendln("Cyclic Dependency :" + graph);
+ }
+ }
+
+
+ public String getTopologicalGraph(TopologicalSortingUtils<ResourceAssignment> topologySorting) {
+ StringBuilder s = new StringBuilder();
+ if (topologySorting != null) {
+ Map<ResourceAssignment, List<ResourceAssignment>> neighbors = topologySorting.getNeighbors();
+
+ neighbors.forEach((v, vs) -> {
+ if (v == null) {
+ s.append("\n * -> [");
+ List<ResourceAssignment> links = vs;
+ for (ResourceAssignment resourceAssignment : links) {
+ s.append("(" + resourceAssignment.getDictionaryName() + ":" + resourceAssignment.getName()
+ + "),");
+ }
+ s.append("]");
+ } else {
+ s.append("\n (" + v.getDictionaryName() + ":" + v.getName() + ") -> [");
+ List<ResourceAssignment> links = vs;
+ for (ResourceAssignment resourceAssignment : links) {
+ s.append("(" + resourceAssignment.getDictionaryName() + ":" + resourceAssignment.getName()
+ + "),");
+ }
+ s.append("]");
+ }
+ });
+ }
+ return s.toString();
+ }
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java
new file mode 100644
index 000000000..22b01c4a8
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java
@@ -0,0 +1,165 @@
+/*
+ * 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.util;
+
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ResourceDictionaryUtilsTest {
+ private static final Logger log = LoggerFactory.getLogger(ResourceDictionaryUtilsTest.class);
+
+ @Test
+ public void validateSingleInputSource() {
+ try {
+ log.info(" **************** Validating validateSingleSource *****************");
+ ResourceAssignment resourceAssignment = new ResourceAssignment();
+ resourceAssignment.setName("test-input-key");
+ DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
+ dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
+
+ Map<String, JsonNode> source = new HashMap<>();
+ SourceInput sourceInput = new SourceInput();
+ source.put(ConfigModelConstant.SOURCE_INPUT, JacksonUtils.jsonNodeFromObject(sourceInput));
+ dictionaryDefinition.setSource(source);
+
+ ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);
+ Assert.assertNotNull("Resource assignment input source is missing ",
+ resourceAssignment.getDictionarySource());
+ Assert.assertNotNull("Resource assignment input source property is missing ",
+ resourceAssignment.getProperty());
+ Assert.assertNotNull("Resource assignment input source property type is missing ",
+ resourceAssignment.getProperty().getType());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void validateSingleDbSource() {
+ try {
+ log.info(" **************** Validating validateSingleSource *****************");
+ ResourceAssignment resourceAssignment = new ResourceAssignment();
+ resourceAssignment.setName("test-db-key");
+ DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
+ dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
+
+ Map<String, JsonNode> source = new HashMap<>();
+ SourceDb sourceDb = new SourceDb();
+ source.put(ConfigModelConstant.SOURCE_DB, JacksonUtils.jsonNodeFromObject(sourceDb));
+ dictionaryDefinition.setSource(source);
+
+ Map<String, DictionaryDependency> dependency = new HashMap<>();
+ DictionaryDependency dependencyDb = new DictionaryDependency();
+ dependencyDb.setNames(Arrays.asList("vnf-id", "vnf-name"));
+ dependency.put(ConfigModelConstant.SOURCE_DB, dependencyDb);
+ dictionaryDefinition.setDependency(dependency);
+
+ DecryptionRule decryptionRule = new DecryptionRule();
+ decryptionRule.setDecryptType("sample Type");
+ decryptionRule.setPath("$.");
+ decryptionRule.setRule("Sample Rule");
+ decryptionRule.setSources(Arrays.asList("vnf-id"));
+ dictionaryDefinition.setDecryptionRules(Arrays.asList(decryptionRule));
+
+ ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);
+ Assert.assertNotNull("Resource assignment db source source is missing ",
+ resourceAssignment.getDictionarySource());
+ Assert.assertNotNull("Resource assignment db source source property is missing ",
+ resourceAssignment.getProperty());
+ Assert.assertNotNull("Resource assignment db source source property type is missing ",
+ resourceAssignment.getProperty().getType());
+
+ Assert.assertNotNull("Resource assignment db dependecy is missing ", resourceAssignment.getDependencies());
+ Assert.assertEquals("Resource assignment db dependecy count mismatch ", 2,
+ resourceAssignment.getDependencies().size());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testSourceDefault() {
+ ResourceAssignment resourceAssignment = new ResourceAssignment();
+ resourceAssignment.setName("test-input-key");
+
+ DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
+ dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
+
+ Map<String, JsonNode> source = new HashMap<>();
+ SourceDefault sourceDefault = new SourceDefault();
+ source.put(ConfigModelConstant.SOURCE_DEFAULT, JacksonUtils.jsonNodeFromObject(sourceDefault));
+ dictionaryDefinition.setSource(source);
+
+ Map<String, DictionaryDependency> dependency = new HashMap<>();
+ DictionaryDependency dependencyDefault = new DictionaryDependency();
+ dependencyDefault.setNames(Arrays.asList(new String[]{"vnf-id", "vnf-name"}));
+ dependency.put(ConfigModelConstant.SOURCE_DEFAULT, dependencyDefault);
+ dictionaryDefinition.setDependency(dependency);
+
+ ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);
+
+ Assert.assertNotNull("Resource assignment default source is missing ",
+ resourceAssignment.getDictionarySource());
+ Assert.assertNotNull("Resource assignment default source property is missing ",
+ resourceAssignment.getProperty());
+ Assert.assertNotNull("Resource assignment default source property type is missing ",
+ resourceAssignment.getProperty().getType());
+ }
+
+ @Test
+ public void testSourceMdsal() {
+ ResourceAssignment resourceAssignment = new ResourceAssignment();
+ resourceAssignment.setName("test-input-key");
+ DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
+ dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
+
+ Map<String, JsonNode> source = new HashMap<>();
+ SourceMdsal sourceMdsal = new SourceMdsal();
+ source.put(ConfigModelConstant.SOURCE_MDSAL, JacksonUtils.jsonNodeFromObject(sourceMdsal));
+ dictionaryDefinition.setSource(source);
+
+ Map<String, DictionaryDependency> dependency = new HashMap<>();
+ DictionaryDependency dependencyMdsal = new DictionaryDependency();
+ dependencyMdsal.setNames(Arrays.asList(new String[]{"vnf-id", "vnf-name"}));
+ dependency.put(ConfigModelConstant.SOURCE_MDSAL, dependencyMdsal);
+ dictionaryDefinition.setDependency(dependency);
+
+ ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);
+
+ Assert.assertNotNull("Resource assignment mdsal source is missing ", resourceAssignment.getDictionarySource());
+ Assert.assertNotNull("Resource assignment mdsal source property is missing ", resourceAssignment.getProperty());
+ Assert.assertNotNull("Resource assignment mdsal source property type is missing ",
+ resourceAssignment.getProperty().getType());
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
new file mode 100644
index 000000000..635e177a1
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
@@ -0,0 +1,411 @@
+{
+ "metadata": {
+ "template_author": "Brinda Santh Muthuramalingam",
+ "author-email": "brindasanth@gmail.com",
+ "user-groups" : "ADMIN, OPERATION",
+ "template_name": "baseconfiguration",
+ "template_version": "1.0.0",
+ "template_tags": "brinda, tosca"
+ },
+ "topology_template": {
+ "inputs": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "node_templates": {
+ "activate-process": {
+ "type": "bpmn-activate",
+ "properties": {
+ "process-name": { "get_input" : "action-name" },
+ "version" : { "get_property" : ["SELF", "process-name"] },
+ "content": { "get_artifact" : ["SELF", "activate-process"] }
+ },
+ "artifacts": {
+ "activate-process": {
+ "type": "artifact-bpmn-camunda",
+ "file": "Plans/ActivateProcess.bpmn"
+ }
+ }
+ },
+ "resource-assignment": {
+ "type": "component-resource-assignment",
+ "properties":{
+ "request-id": ["1234", "1234"]
+ },
+ "interfaces": {
+ "DefaultComponentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": { "get_input" : "action-name" },
+ "resource-type": "vnf-type",
+ "request-id": { "get_input" : "request-id" },
+ "resource-id": { "get_input" : "hostname" },
+ "template-content": { "get_artifact" : ["SELF", "baseconfig-template"] },
+ "mapping-content": { "get_artifact" : ["SELF", "baseconfig-mapping"] }
+ },
+ "outputs": {
+ "resource-assignment-params": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "artifacts": {
+ "baseconfig-template": {
+ "type": "artifact-template-velocity",
+ "file": "Templates/baseconfig-template.vtl"
+ },
+ "baseconfig-mapping": {
+ "type": "artifact-mapping-resource",
+ "file": "Mappings/baseconfig-mapping.json"
+ }
+ }
+ },
+ "resource-assignment-py": {
+ "type": "component-resource-assignment",
+ "properties":{
+ "request-id": ["1234", "1234"]
+ },
+ "interfaces": {
+ "DefaultComponentNode": {
+ "operations": {
+ "process": {
+ "implementation" :{
+ "primary" : "component-script"
+ },
+ "inputs": {
+ "action-name": { "get_input" : "action-name" }
+ },
+ "outputs": {
+ "resource-assignment-params": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "artifacts": {
+ "component-script": {
+ "type": "artifact-script-python",
+ "file": "Scripts/baseconfig-template.vtl"
+ }
+ }
+ }
+ },
+ "workflows":{
+ "activate-process":{
+ "steps" : {
+ "call-resource-assignment" : {
+ "description" : "Invoke Resource Assignment Component",
+ "target" : "resource-assignment",
+ "activities" : [
+ {
+ "call_operation": "ResourceAssignmentNode.process"
+ }
+ ],
+ "on_success" : [
+ "download-baseconfig"
+ ]
+ },
+ "download-baseconfig" : {
+ "description" : "Call Download Base Config Component",
+ "target" : "activate-netconf",
+ "activities" : [
+ {
+ "call_operation": "NetconfTransactionNode.process"
+ }
+ ],
+ "on_success" : [
+ "download-licence"
+ ]
+ },
+ "download-licence" : {
+ "description" : "Call Download Licence Component",
+ "target" : "activate-netconf",
+ "activities" : [
+ {
+ "call_operation": "NetconfTransactionNode.process"
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "artifact_types": {
+ "artifact-template-velocity": {
+ "description": " Velocity Template used for Configuration",
+ "version": "1.0.0",
+ "file_ext": [
+ "vtl"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ },
+ "artifact-mapping-resource": {
+ "description": " Velocity Template Resource Mapping File used along with Configuration template",
+ "version": "1.0.0",
+ "file_ext": [
+ "json"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ },
+ "artifact-script-kotlin": {
+ "description": " Kotlin Script Template used for Configuration",
+ "version": "1.0.0",
+ "file_ext": [
+ "kt"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ },
+ "artifact-script-python": {
+ "description": " Kotlin Script Template used for Configuration",
+ "version": "1.0.0",
+ "file_ext": [
+ "py"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ },
+ "artifact-bpmn-camunda": {
+ "description": " Camunda BPM File",
+ "version": "1.0.0",
+ "file_ext": [
+ "bpmn"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ },
+ "artifact-component-jar": {
+ "description": "Component Jar",
+ "version": "1.0.0",
+ "file_ext": [
+ "jar"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+ }
+ },
+ "node_types": {
+ "bpmn-activate": {
+ "description": "This is BPMN Activate node type",
+ "version": "1.0.0",
+ "properties": {
+ "content": {
+ "required": false,
+ "type": "string"
+ },
+ "process-name": {
+ "required": false,
+ "type": "string"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default" : "LATEST"
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ },
+ "tosca.nodes.Component": {
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "properties": {
+ "type": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": false,
+ "type": "string"
+ }
+ },
+ "interfaces": {
+ "DefaultOperation": {
+ "operations": {
+ "validate": {
+ "inputs": {
+ "action-name": {
+ "description": "validate for action",
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "artifacts" :{
+ "component-jar": {
+ "description": "Component Jar",
+ "type": "artifact-component-jar",
+ "file": "Component/basecomponent.jar"
+ }
+ },
+ "derived_from": "tosca.nodes.Root"
+ },
+ "tosca.nodes.component.Python": {
+ "description": "This is Resource Assignment Python Component API",
+ "version": "1.0.0",
+ "properties": {
+ "type": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": false,
+ "type": "string"
+ }
+ },
+ "interfaces": {
+ "DefaultOperation": {
+ "operations": {
+ "validate": {
+ "inputs": {
+ "action-name": {
+ "description": "validate for action",
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "artifacts" :{
+ "component-jar": {
+ "description": "Component Jar",
+ "type": "artifact-component-jar",
+ "file": "Component/basecomponent.jar"
+ }
+ },
+ "derived_from": "tosca.nodes.Root"
+ },
+ "component-resource-assignment": {
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "properties": {
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "interfaces": {
+ "DefaultComponentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": {
+ "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "resource-type": {
+ "required": false,
+ "type": "string"
+ },
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "required": true,
+ "type": "string"
+ },
+ "template-content": {
+ "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "required": true,
+ "type": "string"
+ },
+ "mapping-content": {
+ "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "resource-assignment-params": {
+ "required": true,
+ "type": "string"
+ },
+ "status": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ },
+ "component-resource-assignment-python": {
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "properties": {
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "interfaces": {
+ "DefaultComponentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": {
+ "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "resource-assignment-params": {
+ "required": true,
+ "type": "string"
+ },
+ "status": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.component.Python"
+ }
+ },
+ "data_types": {
+ "sample-property" : {
+ "description": "This is sample data type",
+ "version": "1.0.0",
+ "properties": {
+ "content": {
+ "required": false,
+ "type": "string"
+ },
+ "process-name": {
+ "required": false,
+ "type": "string"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default" : "LATEST"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json
new file mode 100644
index 000000000..6abfb51bd
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json
@@ -0,0 +1,3 @@
+{
+ "assignments": "Sample Assignments"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn
new file mode 100644
index 000000000..5e94c0f8e
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
+ xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+ xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
+ xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1"
+ targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.2">
+ <bpmn:process id="ActivateProcess" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_0l0dq58</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1pr0kil">
+ <bpmn:incoming>SequenceFlow_1ay0k6p</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0l0dq58" sourceRef="StartEvent_1" targetRef="activate_device_task"/>
+ <bpmn:sequenceFlow id="SequenceFlow_1ay0k6p" sourceRef="activate_device_task" targetRef="EndEvent_1pr0kil"/>
+ <bpmn:serviceTask id="activate_device_task" name="Activate Device"
+ camunda:delegateExpression="${componentDelegateService}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="selector"><![CDATA[resource-assignment
+]]></camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0l0dq58</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ay0k6p</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateProcess">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="175" y="143" width="36" height="36"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="148" y="179" width="90" height="20"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1pr0kil_di" bpmnElement="EndEvent_1pr0kil">
+ <dc:Bounds x="575" y="114" width="36" height="36"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="593" y="154" width="0" height="12"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0l0dq58_di" bpmnElement="SequenceFlow_0l0dq58">
+ <di:waypoint xsi:type="dc:Point" x="211" y="161"/>
+ <di:waypoint xsi:type="dc:Point" x="273" y="161"/>
+ <di:waypoint xsi:type="dc:Point" x="273" y="149"/>
+ <di:waypoint xsi:type="dc:Point" x="334" y="149"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="288" y="149" width="0" height="12"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ay0k6p_di" bpmnElement="SequenceFlow_1ay0k6p">
+ <di:waypoint xsi:type="dc:Point" x="434" y="149"/>
+ <di:waypoint xsi:type="dc:Point" x="505" y="149"/>
+ <di:waypoint xsi:type="dc:Point" x="505" y="132"/>
+ <di:waypoint xsi:type="dc:Point" x="575" y="132"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="520" y="134.5" width="0" height="12"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0e8ek4f_di" bpmnElement="activate_device_task">
+ <dc:Bounds x="334" y="109" width="100" height="80"/>
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py
new file mode 100644
index 000000000..eb198c79a
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py
@@ -0,0 +1,8 @@
+from com.brvith.orchestrator.core.interfaces import ComponentNode
+
+class SamplePythonComponentNode(ComponentNode):
+ def prepare(self, context, componentContext):
+ return None
+
+ def prepare(self, context, componentContext):
+ return None \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta
new file mode 100644
index 000000000..05c2c67f5
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta
@@ -0,0 +1,8 @@
+TOSCA-Meta-File-Version: 1.0.0
+CSAR-Version: 1.0
+Created-By: Brinda Santh M
+Entry-Definitions: Definitions/activation-blueprint.json
+Template-Tags: vrr-test, Brinda Santh
+
+Name: Plans/ActivateProcess.bpmn
+Content-Type: application/vnd.oasis.bpmn
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl
new file mode 100644
index 000000000..026c59176
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl
@@ -0,0 +1 @@
+This is Sample Velocity Template \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json
new file mode 100644
index 000000000..626329ac8
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json
@@ -0,0 +1,742 @@
+{
+ "metadata": {
+ "template_author": "Brinda Santh ( bs2796@onap.com )",
+ "template_name": "vrr-test",
+ "template_version": "1.0.0",
+ "release": "201802",
+ "service-type": "AVPN",
+ "vnf-type": "VRR"
+ },
+ "topology_template": {
+ "inputs": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ },
+ "resource-assignment-request": {
+ "description": "This is Dynamic Data type for the receipe resource-assignment-action.",
+ "required": false,
+ "type": "dt-resource-assignment-request"
+ }
+ },
+ "node_templates": {
+ "base-config-template": {
+ "type": "artifact-config-template",
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://base-config-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "vnf-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "vnf-id",
+ "dictionary-source": "input"
+ },
+ {
+ "name": "group-name",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "group-name",
+ "dictionary-source": "input"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "activate-action": {
+ "type": "dg-activate-netconf",
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {}
+ }
+ }
+ },
+ "capabilities": {
+ "dg-node": {}
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "transaction-netconf-baseconfig",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ }
+ },
+ "resource-assignment-action": {
+ "type": "dg-resource-assignment",
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {}
+ }
+ }
+ },
+ "capabilities": {
+ "dg-node": {}
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "resource-assignment",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ }
+ },
+ "licence-template": {
+ "type": "artifact-config-template",
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://licence-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "licence-key",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "licence-key",
+ "dictionary-source": "input"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "runningconfig-template": {
+ "type": "artifact-config-template",
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://runningconfig-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": []
+ }
+ }
+ }
+ },
+ "resource-assignment": {
+ "type": "component-resource-assignment",
+ "interfaces": {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "service-template-name": "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
+ "action-name": "{ \"get_input\" : \"action-name\" }",
+ "resource-type": "vnf-type",
+ "template-names": [
+ "base-config-template",
+ "licence-template"
+ ],
+ "request-id": "{ \"get_input\" : \"request-id\" }",
+ "resource-id": "{ \"get_input\" : \"vnf-id\" }"
+ },
+ "outputs": {
+ "resource-assignment-params": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "capabilities": {
+ "component-node": {}
+ }
+ },
+ "vrr-netconf-device": {
+ "type": "vnf-netconf-device",
+ "capabilities": {
+ "netconf": {
+ "properties": {
+ "profile-name": "sample",
+ "oam-ipv4-address": "{ \"get_attribute\" : \"hostname\" }",
+ "port-number": "{ \"get_attribute\" : \"host-port\" }",
+ "connection-time-out": 30
+ }
+ }
+ }
+ },
+ "transaction-netconf-baseconfig": {
+ "type": "component-netconf-executor",
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {
+ "operations": {
+ "process": {
+ "implementation" : {
+ "primary" : "file://netconf-adaptor/DefaultGetConfig.py"
+ },
+ "inputs": {
+ "action-name": "{ \"get_input\" : \"action-name\" }",
+ "resource-type": "vnf-type",
+ "request-id": "{ \"get_attribute\" : \"request-id\" }",
+ "resource-id": "{ \"get_input\" : \"vnf-id\" }",
+ "execution-script": "execution-script"
+ },
+ "outputs": {
+ "response-data": "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",
+ "status": "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"
+ }
+ }
+ }
+ }
+ },
+ "capabilities": {
+ "component-node": {
+ }
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vrr-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ }
+ }
+ }
+ },
+ "node_types": {
+ "dg-resource-assignment": {
+ "description": "This is Resource Assignment Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-resource-assignment",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+ },
+ "component-resource-assignment": {
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": {
+ "description": "Action Name of the process",
+ "required": true,
+ "type": "string"
+ },
+ "service-template-name": {
+ "description": "Service Template Name.",
+ "required": true,
+ "type": "string"
+ },
+ "service-template-version": {
+ "description": "Service Template Version.",
+ "required": true,
+ "type": "string"
+ },
+ "resource-type": {
+ "description": "Request type.",
+ "required": true,
+ "type": "string"
+ },
+ "template-names": {
+ "description": "Name of the artifact Node Templates, to get the template Content.",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "request-id": {
+ "description": "Request Id, Unique Id for the request.",
+ "required": true,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Resource Id.",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "resource-assignment-params": {
+ "required": true,
+ "type": "string"
+ },
+ "status": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ },
+ "artifact-config-template": {
+ "description": "This is Configuration Velocity Template",
+ "version": "1.0.0",
+ "properties": {
+ "action-names": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "capabilities": {
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ },
+ "mapping": {
+ "type": "tosca.capability.Mapping",
+ "properties": {
+ "mapping": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-resource-assignment"
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Artifact"
+ },
+ "vnf-netconf-device": {
+ "description": "This is VNF Device with Netconf and SSH Capability",
+ "version": "1.0.0",
+ "capabilities": {
+ "netconf": {
+ "type": "tosca.capability.Netconf",
+ "properties": {
+ "profile-name": {
+ "required": true,
+ "type": "string"
+ },
+ "oam-ipv4-address": {
+ "required": true,
+ "type": "string"
+ },
+ "port-number": {
+ "required": true,
+ "type": "integer",
+ "default": 830
+ },
+ "connection-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ }
+ },
+ "ssh": {
+ "type": "tosca.capability.Ssh",
+ "properties": {
+ "profile-name": {
+ "required": true,
+ "type": "string"
+ },
+ "oam-ipv4-address": {
+ "required": true,
+ "type": "string"
+ },
+ "port-number": {
+ "required": true,
+ "type": "integer",
+ "default": 22
+ },
+ "message-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 3000
+ },
+ "connection-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 3000
+ }
+ }
+ },
+ "sftp": {
+ "type": "tosca.capability.Sftp",
+ "properties": {
+ "profile-name": {
+ "required": true,
+ "type": "string"
+ },
+ "oam-ipv4-address": {
+ "required": true,
+ "type": "string"
+ },
+ "port-number": {
+ "required": true,
+ "type": "integer",
+ "default": 22
+ },
+ "message-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 3000
+ },
+ "connection-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 3000
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Vnf"
+ },
+ "dg-activate-netconf": {
+ "description": "This is Download Netconf Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-netconf-executor",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+ },
+ "component-netconf-executor": {
+ "description": "This is Netconf Transaction Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vnf-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "service-template-name": {
+ "description": "Service Template Name",
+ "required": true,
+ "type": "string"
+ },
+ "service-template-version": {
+ "description": "Service Template Version",
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "resource-type": {
+ "description": "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "execution-script": {
+ "description": "Python Script to Execute for this Component action, It should refer any one of Prython Artifact Definition for this Node Template.",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "response-data": {
+ "description": "Execution Response Data in JSON format.",
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ }
+ },
+ "data_types": {
+ "datatype-resource-assignment": {
+ "version": "1.0.0",
+ "description": "This is Resource Assignment Data Type",
+ "properties": {
+ "property": {
+ "required": true,
+ "type": "datatype-property"
+ },
+ "input-param": {
+ "required": true,
+ "type": "boolean"
+ },
+ "dictionary-name": {
+ "required": false,
+ "type": "string"
+ },
+ "dictionary-source": {
+ "required": false,
+ "type": "string"
+ },
+ "dependencies": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "status": {
+ "required": false,
+ "type": "string"
+ },
+ "message": {
+ "required": false,
+ "type": "string"
+ },
+ "updated-date": {
+ "required": false,
+ "type": "string"
+ },
+ "updated-by": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+ },
+ "datatype-property": {
+ "version": "1.0.0",
+ "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
+ "properties": {
+ "type": {
+ "required": true,
+ "type": "string"
+ },
+ "description": {
+ "required": false,
+ "type": "string"
+ },
+ "required": {
+ "required": false,
+ "type": "boolean"
+ },
+ "default": {
+ "required": false,
+ "type": "string"
+ },
+ "entry_schema": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+ },
+ "dt-resource-assignment-request": {
+ "version": "1.0.0",
+ "description": "This is Dynamic Data type definition generated from resource mapping for the config template name base-config-template.",
+ "properties": {
+ "vnf-id": {
+ "required": true,
+ "type": "string"
+ },
+ "group-name": {
+ "required": true,
+ "type": "string"
+ },
+ "licence-key": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Dynamic"
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/TOSCA-Metadata/TOSCA.meta b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/TOSCA-Metadata/TOSCA.meta
new file mode 100644
index 000000000..a4e1df3df
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/TOSCA-Metadata/TOSCA.meta
@@ -0,0 +1,5 @@
+TOSCA-Meta-File-Version: 1.0.0
+CSAR-Version: 1.0
+Created-By: Brinda Santh M
+Entry-Definitions: Definitions/vrr-test.json
+Template-Tags: vrr-test, Brinda Santh
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Templates/base-config-template.vtl b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Templates/base-config-template.vtl
new file mode 100644
index 000000000..92dba1024
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Templates/base-config-template.vtl
@@ -0,0 +1,40 @@
+ <config>
+ <configuration>
+ <groups>
+ <name>${group-name}</name>
+ <routing-instances>
+ <instance>
+ <name>&lt;*&gt;</name>
+ <protocols>
+ <pim>
+ <dense-groups>
+ <dynamic-reject />
+ <pim-dense-group-type>
+ <name>224.0.1.40/32</name>
+ </pim-dense-group-type>
+ <pim-dense-group-type>
+ <name>224.0.1.39/32</name>
+ </pim-dense-group-type>
+ <pim-dense-group-type>
+ <name>224.0.0.0/4</name>
+ <reject />
+ </pim-dense-group-type>
+ </dense-groups>
+ <rp>
+ <auto-rp>
+ <discovery />
+ </auto-rp>
+ </rp>
+ <interface>
+ <name>&lt;*&gt;</name>
+ <disable />
+ <priority>1000</priority>
+ </interface>
+ <reset-tracking-bit />
+ </pim>
+ </protocols>
+ </instance>
+ </routing-instances>
+ </groups>
+ </configuration>
+ </config> \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Templates/licence-template.vtl b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Templates/licence-template.vtl
new file mode 100644
index 000000000..626974f27
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Templates/licence-template.vtl
@@ -0,0 +1,4 @@
+ <config>
+ <configuration>
+ </configuration>
+ </config>
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/__init__.py b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/__init__.py
diff --git a/ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-mapping-resource.json b/ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-mapping-resource.json
new file mode 100644
index 000000000..0a3261b09
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-mapping-resource.json
@@ -0,0 +1,8 @@
+{
+ "description": " Velocity Template Resource Mapping File used along with Configuration template",
+ "version": "1.0.0",
+ "file_ext": [
+ "json"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-script-python.json b/ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-script-python.json
new file mode 100644
index 000000000..b48d2b628
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-script-python.json
@@ -0,0 +1,8 @@
+{
+ "description": " Kotlin Script Template used for Configuration",
+ "version": "1.0.0",
+ "file_ext": [
+ "py"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-template-velocity.json b/ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-template-velocity.json
new file mode 100644
index 000000000..9395d3970
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/artifact_type/artifact-template-velocity.json
@@ -0,0 +1,8 @@
+{
+ "description": " Velocity Template used for Configuration",
+ "version": "1.0.0",
+ "file_ext": [
+ "vtl"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/data_type/datatype-property.json b/ms/controllerblueprints/modules/service/load/model_type/data_type/datatype-property.json
new file mode 100644
index 000000000..5584b10ea
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/data_type/datatype-property.json
@@ -0,0 +1,27 @@
+{
+ "version": "1.0.0",
+ "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
+ "properties": {
+ "type": {
+ "required": true,
+ "type": "string"
+ },
+ "description": {
+ "required": false,
+ "type": "string"
+ },
+ "required": {
+ "required": false,
+ "type": "boolean"
+ },
+ "default": {
+ "required": false,
+ "type": "string"
+ },
+ "entry_schema": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/data_type/datatype-resource-assignment.json b/ms/controllerblueprints/modules/service/load/model_type/data_type/datatype-resource-assignment.json
new file mode 100644
index 000000000..cc9816ebb
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/data_type/datatype-resource-assignment.json
@@ -0,0 +1,46 @@
+{
+ "version": "1.0.0",
+ "description": "This is Resource Assignment Data Type",
+ "properties": {
+ "property": {
+ "required": true,
+ "type": "datatype-property"
+ },
+ "input-param": {
+ "required": true,
+ "type": "boolean"
+ },
+ "dictionary-name": {
+ "required": false,
+ "type": "string"
+ },
+ "dictionary-source": {
+ "required": false,
+ "type": "string"
+ },
+ "dependencies": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "status": {
+ "required": false,
+ "type": "string"
+ },
+ "message": {
+ "required": false,
+ "type": "string"
+ },
+ "updated-date": {
+ "required": false,
+ "type": "string"
+ },
+ "updated-by": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/data_type/dt-license-key.json b/ms/controllerblueprints/modules/service/load/model_type/data_type/dt-license-key.json
new file mode 100644
index 000000000..e9c312b79
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/data_type/dt-license-key.json
@@ -0,0 +1,11 @@
+{
+ "version": "1.0.0",
+ "description": "This is dt-plicense-key Data Type",
+ "properties": {
+ "license-key": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/data_type/dt-v4-aggregate.json b/ms/controllerblueprints/modules/service/load/model_type/data_type/dt-v4-aggregate.json
new file mode 100644
index 000000000..842a7f805
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/data_type/dt-v4-aggregate.json
@@ -0,0 +1,15 @@
+{
+ "version": "1.0.0",
+ "description": "This is dt-v4-aggregate Data Type",
+ "properties": {
+ "ipv4-address": {
+ "required": true,
+ "type": "string"
+ },
+ "ipv4-plen": {
+ "required": false,
+ "type": "integer"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/artifact-config-template.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/artifact-config-template.json
new file mode 100644
index 000000000..be9bbfc0e
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/artifact-config-template.json
@@ -0,0 +1,37 @@
+{
+ "description": "This is Configuration Velocity Template",
+ "version": "1.0.0",
+ "properties": {
+ "action-names": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "capabilities": {
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ },
+ "mapping": {
+ "type": "tosca.capability.Mapping",
+ "properties": {
+ "mapping": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-resource-assignment"
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Artifact"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/component-config-generator.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-config-generator.json
new file mode 100644
index 000000000..764f9e890
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-config-generator.json
@@ -0,0 +1,72 @@
+{
+ "description": "This is Generate Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-config-generator-service-ConfigGeneratorNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "template-data": {
+ "description": "Conditional : JSON string which is used to mash with template. Either template-data or ( resource-id and resource-type ) should be present",
+ "required": false,
+ "type": "string"
+ },
+ "template-content": {
+ "description": "Conditional : Dynamic Template used to generate Configuration.",
+ "required": false,
+ "type": "string"
+ },
+ "resource-type": {
+ "description": "Conditional : resource-type used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
+ "required": false,
+ "type": "string"
+ },
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Conditional : Id used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
+ "required": false,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Conditional : Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "template-name": {
+ "description": "Conditional : Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "generated-config": {
+ "description": "Generated Configuration for the Template adn Resource Data",
+ "required": true,
+ "type": "string"
+ },
+ "mask-info": {
+ "description": "If template contains mask encription keys, then this mask-info field will be generated, This JSON Content alligns to the bean org.onap.ccsdk.apps.controllerblueprints.core.data.custom.MaskInfo ",
+ "required": false,
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-edit.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-edit.json
new file mode 100644
index 000000000..144e1dded
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-edit.json
@@ -0,0 +1,95 @@
+{
+ "description": "This is Netconf Edit Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-SimpleNetconfEditConfigNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "template-name": {
+ "description": "Template name used by the Components during processing",
+ "required": false,
+ "type": "string"
+ },
+ "rpc-message": {
+ "description": "If the message is Neconf RPC message,It should be true or false.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "wait": {
+ "description": "Delay time in sec before performing edit-config action.",
+ "required": false,
+ "type": "integer",
+ "default": 0
+ },
+ "unlock": {
+ "description": "If unLock command has to send before Edit Configuration.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "config-target": {
+ "required": false,
+ "type": "string"
+ },
+ "commit": {
+ "description": "Issue commit command to the device after performing edit-config action.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "edit-default-operation": {
+ "required": false,
+ "type": "string"
+ },
+ "content": {
+ "description": "Static messgae content, If this is not set, need to have Requirement relationship to Artifact contents.",
+ "required": false,
+ "type": "string"
+ },
+ "lock": {
+ "description": "Issue lock command to the device before performing edit-config action.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "post-restart-wait": {
+ "description": "If Restart command should be issued before the Edit Operation, Provide the time to wait after restart. 0 meanno restart required or wait time in sec ex : 3000 for 5 ",
+ "required": false,
+ "type": "integer",
+ "default": 0
+ },
+ "pre-restart-wait": {
+ "description": "If Restart command should be issued after the Edit Operation, Provide the time to wait after restart. 0 meanno restart required or wait time in sec ex : 3000 for 5 ",
+ "required": false,
+ "type": "integer",
+ "default": 0
+ },
+ "message-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ },
+ "outputs": {
+ "rpc-response-message": {
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-executor.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-executor.json
new file mode 100644
index 000000000..aed667aaf
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-executor.json
@@ -0,0 +1,79 @@
+{
+ "description": "This is Netconf Transaction Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vnf-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "service-template-name": {
+ "description": "Service Template Name",
+ "required": true,
+ "type": "string"
+ },
+ "service-template-version": {
+ "description": "Service Template Version",
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "resource-type": {
+ "description": "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "reservation-id": {
+ "description": "Reservation Id used to send to NPM",
+ "required": false,
+ "type": "string"
+ },
+ "execution-script": {
+ "description": "Python Script to Execute for this Component action, It should refer any one of Prython Artifact Definition for this Node Template.",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "response-data": {
+ "description": "Execution Response Data in JSON format.",
+ "required": false,
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-get.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-get.json
new file mode 100644
index 000000000..1659bf419
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-get.json
@@ -0,0 +1,61 @@
+{
+ "description": "This is Netconf Get Running Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-SimpleNetconfGetConfigNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "template-name": {
+ "description": "Template name used by the Components during processing",
+ "required": false,
+ "type": "string"
+ },
+ "rpc-message": {
+ "description": "It should be true, If the message is Neconf RPC message, It should be false If it is plain Config message.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "wait": {
+ "required": false,
+ "type": "integer",
+ "default": 0
+ },
+ "lock": {
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "content": {
+ "description": "Static messgae content, If this is not set, need to have Requirement relationship to Artifact contents.",
+ "required": false,
+ "type": "string"
+ },
+ "message-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ },
+ "outputs": {
+ "config-message": {
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/component-resource-assignment.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-resource-assignment.json
new file mode 100644
index 000000000..34c028482
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-resource-assignment.json
@@ -0,0 +1,68 @@
+{
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "service-template-name": {
+ "description": "Service Template Name.",
+ "required": true,
+ "type": "string"
+ },
+ "service-template-version": {
+ "description": "Service Template Version.",
+ "required": true,
+ "type": "string"
+ },
+ "resource-type": {
+ "description": "Request type.",
+ "required": true,
+ "type": "string"
+ },
+ "template-names": {
+ "description": "Name of the artifact Node Templates, to get the template Content.",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "request-id": {
+ "description": "Request Id, Unique Id for the request.",
+ "required": true,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Resource Id.",
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Action Name of the process",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "resource-assignment-params": {
+ "required": true,
+ "type": "string"
+ },
+ "status": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/component-transaction-netconf.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-transaction-netconf.json
new file mode 100644
index 000000000..7c3745848
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-transaction-netconf.json
@@ -0,0 +1,93 @@
+{
+ "description": "This is Netconf Transaction Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vnf-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfTransactionNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "rollback": {
+ "required": false,
+ "type": "boolean"
+ },
+ "assignment-action-name": {
+ "description": "Assignment Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": true,
+ "type": "string"
+ },
+ "transaction-components": {
+ "description": "Components used to used for the atomic transaction, Default Handlers are org.openecomp.sdnc.netconf.adaptor.service.SimpleNetconfEditConfigNode and org.openecomp.sdnc.netconf.adaptor.service.SimpleNetconfGetConfigNode",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "resource-type": {
+ "description": "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "initialise-sftp": {
+ "required": false,
+ "type": "boolean"
+ },
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "initialise-ssh": {
+ "required": false,
+ "type": "boolean"
+ },
+ "lock": {
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "unlock": {
+ "description": "If unLock command has to send before Edit Configuration.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "resource-id": {
+ "description": "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "rpc-response-message": {
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-activate-netconf.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-activate-netconf.json
new file mode 100644
index 000000000..c638df00c
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-activate-netconf.json
@@ -0,0 +1,66 @@
+{
+ "description": "This is Download Netconf Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-netconf-executor",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+
+ "derived_from": "tosca.nodes.DG"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-config-generator.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-config-generator.json
new file mode 100644
index 000000000..28bace0f0
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-config-generator.json
@@ -0,0 +1,65 @@
+{
+ "description": "This is Activate DG for Config Generator Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-config-generator",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "GenerateConfiguration": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assign-activate.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assign-activate.json
new file mode 100644
index 000000000..e98fa5a67
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assign-activate.json
@@ -0,0 +1,70 @@
+{
+ "description": "This is Resource Assign and Activate Netconf Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "ra-component": {
+ "capability": "component-node",
+ "node": "component-resource-assignment",
+ "relationship": "tosca.relationships.DependsOn"
+ },
+ "netconf-component": {
+ "capability": "component-node",
+ "node": "component-netconf-executor",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignAndActivate": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assignment.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assignment.json
new file mode 100644
index 000000000..36fbb6861
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assignment.json
@@ -0,0 +1,65 @@
+{
+ "description": "This is Resource Assignment Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-resource-assignment",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/vnf-netconf-device.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/vnf-netconf-device.json
new file mode 100644
index 000000000..54573bade
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/vnf-netconf-device.json
@@ -0,0 +1,42 @@
+{
+ "description": "This is VNF Device with Netconf Capability",
+ "version": "1.0.0",
+ "capabilities": {
+ "netconf": {
+ "type": "tosca.capability.Netconf",
+ "properties": {
+ "login-key": {
+ "required": true,
+ "type": "string",
+ "default": "sdnc"
+ },
+ "login-account": {
+ "required": true,
+ "type": "string",
+ "default": "sdnc-tacacs"
+ },
+ "source": {
+ "required": true,
+ "type": "string",
+ "default": "npm"
+ },
+ "target-ip-address": {
+ "required": true,
+ "type": "string"
+ },
+ "port-number": {
+ "required": true,
+ "type": "integer",
+ "default": 830
+ },
+ "connection-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Vnf"
+
+}
diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/action-name.json b/ms/controllerblueprints/modules/service/load/resource_dictionary/action-name.json
new file mode 100644
index 000000000..92b64e629
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/resource_dictionary/action-name.json
@@ -0,0 +1,17 @@
+{
+ "name": "action-name",
+ "resource-path": "action-name",
+ "resource-type": "ONAP",
+ "description": "To be provided",
+ "valid-values": null,
+ "sample-value": null,
+ "updated-by": "ym9479@onap.com",
+ "tags": null,
+ "default": null,
+ "data-type": "string",
+ "source": {
+ "input": {
+ "key": "action-name"
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/bundle-id.json b/ms/controllerblueprints/modules/service/load/resource_dictionary/bundle-id.json
new file mode 100644
index 000000000..f9678f5ff
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/resource_dictionary/bundle-id.json
@@ -0,0 +1,32 @@
+{
+ "name": "bundle-id",
+ "description": "name of the ",
+ "resource-type": "ONAP",
+ "resource-path": "vnf/bundle-id",
+ "updated-by": "ym9479@onap.com",
+ "data-type": "String",
+ "tags": "bundle-id, ym9479@onap.com",
+ "source": {
+ "db": {
+ "path": "$key-value",
+ "input-key-mapping": {
+ "key-value": "$resource-group-key"
+ },
+ "output-key-mapping": {
+ "bundle-id": "bundle-id"
+ }
+ },
+ "input": {
+ }
+ },
+ "decryption-rules": [
+ {
+ "sources": [
+ "input"
+ ],
+ "path": "/.",
+ "rule": "LOCAL-Decrypt",
+ "decrypt-type": "AES128"
+ }
+ ]
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json b/ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json
new file mode 100644
index 000000000..03254b78a
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json
@@ -0,0 +1,14 @@
+{
+ "tags": "v4-ip-type, tosca.datatypes.Root, data_type, ym9479@onap.com",
+ "name": "v4-ip-type",
+ "description": "To be provided",
+ "updated-by": "ym9479@onap.com",
+ "resource-type": "ONAP",
+ "resource-path": "vnf/v4-ip-type",
+ "data-type": "string",
+ "source": {
+ "input": {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml
new file mode 100644
index 000000000..17738bf4b
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/pom.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps</groupId>
+ <artifactId>controllerblueprints-modules</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>controllerblueprints-service</artifactId>
+ <name>Controller Blueprints Service</name>
+
+ <properties>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps</groupId>
+ <artifactId>controllerblueprints-resource-dict</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jersey2-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jersey</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.mariadb.jdbc</groupId>-->
+ <!--<artifactId>mariadb-java-client</artifactId>-->
+ <!--</dependency>-->
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
+
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java
new file mode 100644
index 000000000..6b09c81ff
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java
@@ -0,0 +1,211 @@
+/*
+ * 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.service;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DictionaryDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * AutoResourceMappingService.java Purpose: Provide Automapping of Resource Assignments AutoResourceMappingService
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Service
+public class AutoResourceMappingService {
+
+ private static Logger log = LoggerFactory.getLogger(AutoResourceMappingService.class);
+
+ private ResourceDictionaryRepository dataDictionaryRepository;
+
+ /**
+ * This is a AutoResourceMappingService constructor
+ *
+ * @param dataDictionaryRepository
+ *
+ */
+ public AutoResourceMappingService(ResourceDictionaryRepository dataDictionaryRepository) {
+ this.dataDictionaryRepository = dataDictionaryRepository;
+ }
+
+ /**
+ * This is a autoMap service to map the template keys automatically to Dictionary fields.
+ *
+ * @param resourceAssignments
+ * @return AutoMapResponse
+ */
+ public AutoMapResponse autoMap(List<ResourceAssignment> resourceAssignments) throws BluePrintException {
+ AutoMapResponse autoMapResponse = new AutoMapResponse();
+ try {
+ if (CollectionUtils.isNotEmpty(resourceAssignments)) {
+
+ // Create the Dictionary definitions for the ResourceAssignment Names
+ Map<String, ResourceDictionary> dictionaryMap = getDictionaryDefinitions(resourceAssignments);
+
+ for (ResourceAssignment resourceAssignment : resourceAssignments) {
+ if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getName())
+ && StringUtils.isBlank(resourceAssignment.getDictionaryName())) {
+
+ populateDictionaryMapping(dictionaryMap, resourceAssignment);
+
+ log.info("Mapped Resource : {}", resourceAssignment);
+
+ } else {
+ // Do nothins
+ }
+ }
+ }
+ List<ResourceDictionary> dictionaries = getDictionaryDefinitionsList(resourceAssignments);
+ List<ResourceAssignment> resourceAssignmentsFinal = getAllAutomapResourceAssignments(resourceAssignments);
+ autoMapResponse.setDataDictionaries(dictionaries);
+ autoMapResponse.setResourceAssignments(resourceAssignmentsFinal);
+ } catch (Exception e) {
+ log.error(String.format("Failed in auto process %s", e.getMessage()));
+ throw new BluePrintException(e.getMessage(), e);
+ }
+ return autoMapResponse;
+ }
+
+ private void populateDictionaryMapping(Map<String, ResourceDictionary> dictionaryMap, ResourceAssignment resourceAssignment) {
+ ResourceDictionary dbDataDictionary = dictionaryMap.get(resourceAssignment.getName());
+ if (dbDataDictionary != null && StringUtils.isNotBlank(dbDataDictionary.getDefinition())) {
+
+ DictionaryDefinition dictionaryDefinition = JacksonUtils.readValue(dbDataDictionary.getDefinition(), DictionaryDefinition.class);
+
+ if (dictionaryDefinition != null && StringUtils.isNotBlank(dictionaryDefinition.getName())
+ && StringUtils.isBlank(resourceAssignment.getDictionaryName())) {
+
+ resourceAssignment.setDictionaryName(dbDataDictionary.getName());
+ ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);
+ }
+ }
+ }
+
+ private Map<String, ResourceDictionary> getDictionaryDefinitions(List<ResourceAssignment> resourceAssignments) {
+ Map<String, ResourceDictionary> dictionaryMap = new HashMap<>();
+ List<String> names = new ArrayList<>();
+ for (ResourceAssignment resourceAssignment : resourceAssignments) {
+ if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getName())) {
+ names.add(resourceAssignment.getName());
+ }
+ }
+ if (CollectionUtils.isNotEmpty(names)) {
+
+ List<ResourceDictionary> dictionaries = dataDictionaryRepository.findByNameIn(names);
+ if (CollectionUtils.isNotEmpty( dictionaries)) {
+ for (ResourceDictionary dataDictionary : dictionaries) {
+ if (dataDictionary != null && StringUtils.isNotBlank(dataDictionary.getName())) {
+ dictionaryMap.put(dataDictionary.getName(), dataDictionary);
+ }
+ }
+ }
+ }
+ return dictionaryMap;
+
+ }
+
+ private List<ResourceDictionary> getDictionaryDefinitionsList(List<ResourceAssignment> resourceAssignments) {
+ List<ResourceDictionary> dictionaries = null;
+ List<String> names = new ArrayList<>();
+ for (ResourceAssignment resourceAssignment : resourceAssignments) {
+ if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getDictionaryName())) {
+
+ if (!names.contains(resourceAssignment.getDictionaryName())) {
+ names.add(resourceAssignment.getDictionaryName());
+ }
+
+ if (resourceAssignment.getDependencies() != null && !resourceAssignment.getDependencies().isEmpty()) {
+ List<String> dependencyNames = resourceAssignment.getDependencies();
+ for (String dependencyName : dependencyNames) {
+ if (StringUtils.isNotBlank(dependencyName) && !names.contains(dependencyName)) {
+ names.add(dependencyName);
+ }
+ }
+ }
+ }
+ }
+ if (CollectionUtils.isNotEmpty(names)) {
+ dictionaries = dataDictionaryRepository.findByNameIn(names);
+ }
+ return dictionaries;
+
+ }
+
+ private List<ResourceAssignment> getAllAutomapResourceAssignments(List<ResourceAssignment> resourceAssignments) {
+ List<ResourceDictionary> dictionaries = null;
+ List<String> names = new ArrayList<>();
+ List<ResourceAssignment> resourceAssignmentsWithDepencies = resourceAssignments;
+ for (ResourceAssignment resourceAssignment : resourceAssignments) {
+ if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getDictionaryName())) {
+ if (resourceAssignment.getDependencies() != null && !resourceAssignment.getDependencies().isEmpty()) {
+ List<String> dependencieNames = resourceAssignment.getDependencies();
+ for (String dependencieName : dependencieNames) {
+ if (StringUtils.isNotBlank(dependencieName) && !names.contains(dependencieName)
+ && !checkAssignmentsExists(resourceAssignmentsWithDepencies, dependencieName)) {
+ names.add(dependencieName);
+ }
+ }
+ }
+ }
+ }
+
+ if (!names.isEmpty()) {
+ dictionaries = dataDictionaryRepository.findByNameIn(names);
+ }
+ if (dictionaries != null) {
+ for (ResourceDictionary resourcedictionary : dictionaries) {
+ DictionaryDefinition dictionaryDefinition = JacksonUtils.readValue(resourcedictionary.getDefinition(), DictionaryDefinition.class);
+ PropertyDefinition property = new PropertyDefinition();
+ property.setRequired(true);
+ ResourceAssignment resourceAssignment = new ResourceAssignment();
+ resourceAssignment.setName(resourcedictionary.getName());
+ resourceAssignment.setDictionaryName(resourcedictionary
+ .getName());
+ resourceAssignment.setVersion(0);
+ resourceAssignment.setProperty(property);
+ ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);
+ resourceAssignmentsWithDepencies.add(resourceAssignment);
+ }
+ }
+ return resourceAssignmentsWithDepencies;
+
+ }
+
+
+ public boolean checkAssignmentsExists(List<ResourceAssignment> resourceAssignmentsWithDepencies, String resourceName) {
+ return resourceAssignmentsWithDepencies.stream().anyMatch(names -> names.getName().equalsIgnoreCase(resourceName));
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerRepoDBService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerRepoDBService.java
new file mode 100644
index 000000000..a2e5b104c
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerRepoDBService.java
@@ -0,0 +1,100 @@
+/*
+ * 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.service;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*;
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerRepoService;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ModelTypeRepository;
+import org.springframework.stereotype.Service;
+
+import java.util.Optional;
+
+/**
+ * BluePrintEnhancerRepoDBService
+ *
+ * @author Brinda Santh
+ */
+@Service
+public class BluePrintEnhancerRepoDBService implements BluePrintEnhancerRepoService {
+
+ private ModelTypeRepository modelTypeRepository;
+
+ public BluePrintEnhancerRepoDBService(ModelTypeRepository modelTypeRepository) {
+ this.modelTypeRepository = modelTypeRepository;
+ }
+
+
+ @Override
+ public NodeType getNodeType(String nodeTypeName) throws BluePrintException {
+ Preconditions.checkArgument(StringUtils.isNotBlank(nodeTypeName), "NodeType name is missing");
+ String content = getModelDefinitions(nodeTypeName);
+ Preconditions.checkArgument(StringUtils.isNotBlank(content), "NodeType content is missing");
+ return JacksonUtils.readValue(content, NodeType.class);
+ }
+
+
+ @Override
+ public DataType getDataType(String dataTypeName) throws BluePrintException {
+ Preconditions.checkArgument(StringUtils.isNotBlank(dataTypeName), "DataType name is missing");
+ String content = getModelDefinitions(dataTypeName);
+ Preconditions.checkArgument(StringUtils.isNotBlank(content), "DataType content is missing");
+ return JacksonUtils.readValue(content, DataType.class);
+ }
+
+
+ @Override
+ public ArtifactType getArtifactType(String artifactTypeName) throws BluePrintException {
+ Preconditions.checkArgument(StringUtils.isNotBlank(artifactTypeName), "ArtifactType name is missing");
+ String content = getModelDefinitions(artifactTypeName);
+ Preconditions.checkArgument(StringUtils.isNotBlank(content), "ArtifactType content is missing");
+ return JacksonUtils.readValue(content, ArtifactType.class);
+ }
+
+
+ @Override
+ public RelationshipType getRelationshipType(String relationshipTypeName) throws BluePrintException {
+ Preconditions.checkArgument(StringUtils.isNotBlank(relationshipTypeName), "RelationshipType name is missing");
+ String content = getModelDefinitions(relationshipTypeName);
+ Preconditions.checkArgument(StringUtils.isNotBlank(content), "RelationshipType content is missing");
+ return JacksonUtils.readValue(content, RelationshipType.class);
+ }
+
+
+ @Override
+ public CapabilityDefinition getCapabilityDefinition(String capabilityDefinitionName) throws BluePrintException {
+ Preconditions.checkArgument(StringUtils.isNotBlank(capabilityDefinitionName), "CapabilityDefinition name is missing");
+ String content = getModelDefinitions(capabilityDefinitionName);
+ Preconditions.checkArgument(StringUtils.isNotBlank(content), "CapabilityDefinition content is missing");
+ return JacksonUtils.readValue(content, CapabilityDefinition.class);
+ }
+
+ private String getModelDefinitions(String modelName) throws BluePrintException {
+ String modelDefinition = null;
+ Optional<ModelType> modelTypedb = modelTypeRepository.findByModelName(modelName);
+ if (modelTypedb.isPresent()) {
+ modelDefinition = modelTypedb.get().getDefinition();
+ } else {
+ throw new BluePrintException(String.format("failed to get model definition (%s) from repo", modelName));
+ }
+ return modelDefinition;
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
new file mode 100644
index 000000000..afd12f219
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
@@ -0,0 +1,207 @@
+/*
+ * 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.service;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang3.StringUtils;
+import org.jetbrains.annotations.NotNull;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*;
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerDefaultService;
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerRepoService;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * BluePrintEnhancerService
+ *
+ * @author Brinda Santh DATE : 8/8/2018
+ */
+
+@Service
+public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
+
+ private static Logger log = LoggerFactory.getLogger(BluePrintEnhancerService.class);
+
+ private HashMap<String, DataType> recipeDataTypes = new HashMap<>();
+
+ public BluePrintEnhancerService(BluePrintEnhancerRepoService bluePrintEnhancerRepoDBService) {
+ super(bluePrintEnhancerRepoDBService);
+ }
+
+ @Override
+ public void enrichTopologyTemplate(@NotNull ServiceTemplate serviceTemplate) {
+ super.enrichTopologyTemplate(serviceTemplate);
+
+ // Update the Recipe Inputs and DataTypes
+ populateRecipeInputs(serviceTemplate);
+ }
+
+
+ @Override
+ public void enrichNodeTemplate(@NotNull String nodeTemplateName, @NotNull NodeTemplate nodeTemplate) throws BluePrintException {
+ super.enrichNodeTemplate(nodeTemplateName, nodeTemplate);
+
+ String nodeTypeName = nodeTemplate.getType();
+ log.info("*** Enriching NodeType: {}", nodeTypeName);
+ // Get NodeType from Repo and Update Service Template
+ NodeType nodeType = super.populateNodeType(nodeTypeName);
+
+ // Enrich NodeType
+ super.enrichNodeType(nodeTypeName, nodeType);
+
+ // Custom for Artifact Population
+ if (StringUtils.isNotBlank(nodeType.getDerivedFrom())
+ && ConfigModelConstant.MODEL_TYPE_NODE_ARTIFACT.equalsIgnoreCase(nodeType.getDerivedFrom())) {
+ populateArtifactTemplateMappingDataType(nodeTemplateName, nodeTemplate);
+ }
+
+ //Enrich Node Template Artifacts
+ super.enrichNodeTemplateArtifactDefinition(nodeTemplateName, nodeTemplate);
+
+ }
+
+
+ private void populateArtifactTemplateMappingDataType(@NotNull String nodeTemplateName, @NotNull NodeTemplate nodeTemplate)
+ throws BluePrintException {
+ log.info("****** Processing Artifact Node Template : {}", nodeTemplateName);
+
+ if (nodeTemplate.getProperties() != null) {
+
+ if (!nodeTemplate.getProperties().containsKey(ConfigModelConstant.PROPERTY_RECIPE_NAMES)) {
+ throw new BluePrintException("Node Template (" + nodeTemplateName + ") doesn't have "
+ + ConfigModelConstant.PROPERTY_RECIPE_NAMES + " property.");
+ }
+
+ // Modified for ONAP converted Object to JsonNode
+ JsonNode recipeNames = nodeTemplate.getProperties().get(ConfigModelConstant.PROPERTY_RECIPE_NAMES);
+
+ log.info("Processing Receipe Names : {} ", recipeNames);
+
+ if (recipeNames != null && recipeNames.isArray() && recipeNames.size() > 0) {
+
+ Map<String, PropertyDefinition> mappingProperties =
+ getCapabilityMappingProperties(nodeTemplateName, nodeTemplate);
+
+ for (JsonNode recipeNameNode : recipeNames) {
+ String recipeName = recipeNameNode.textValue();
+ processRecipe(nodeTemplateName, mappingProperties, recipeName);
+ }
+ }
+ }
+ }
+
+ private void processRecipe(@NotNull String nodeTemplateName, Map<String, PropertyDefinition> mappingProperties, String recipeName) {
+ if (StringUtils.isNotBlank(recipeName)) {
+ DataType recipeDataType = this.recipeDataTypes.get(recipeName);
+ if (recipeDataType == null) {
+ log.info("DataType not present for the recipe({})" , recipeName);
+ recipeDataType = new DataType();
+ recipeDataType.setVersion("1.0.0");
+ recipeDataType.setDescription(
+ "This is Dynamic Data type definition generated from resource mapping for the config template name "
+ + nodeTemplateName + ".");
+ recipeDataType.setDerivedFrom(ConfigModelConstant.MODEL_TYPE_DATA_TYPE_DYNAMIC);
+ Map<String, PropertyDefinition> dataTypeProperties = new HashMap<>();
+ recipeDataType.setProperties(dataTypeProperties);
+ } else {
+ log.info("DataType Already present for the recipe({})" , recipeName);
+ }
+
+ // Merge all the Recipe Properties
+ mergeDataTypeProperties(recipeDataType, mappingProperties);
+
+ // Overwrite Recipe DataType
+ this.recipeDataTypes.put(recipeName, recipeDataType);
+
+ }
+ }
+
+ private Map<String, PropertyDefinition> getCapabilityMappingProperties(String nodeTemplateName,
+ NodeTemplate nodeTemplate) {
+
+ Map<String, PropertyDefinition> dataTypeProperties = null;
+ if (nodeTemplate != null) {
+ CapabilityAssignment capability =
+ nodeTemplate.getCapabilities().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
+
+ if (capability != null && capability.getProperties() != null) {
+
+ String resourceAssignmentContent = JacksonUtils
+ .getJson(capability.getProperties().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING));
+
+ List<ResourceAssignment> resourceAssignments =
+ JacksonUtils.getListFromJson(resourceAssignmentContent, ResourceAssignment.class);
+
+ Preconditions.checkNotNull(resourceAssignments, "Failed to Processing Resource Mapping " + resourceAssignmentContent);
+ dataTypeProperties = new HashMap<>();
+
+ for (ResourceAssignment resourceAssignment : resourceAssignments) {
+ if (resourceAssignment != null
+ // && Boolean.valueOf(resourceAssignment.getInputParameter())
+ && resourceAssignment.getProperty() != null
+ && StringUtils.isNotBlank(resourceAssignment.getName())) {
+
+ // Enrich the Property Definition
+ super.enrichPropertyDefinition(resourceAssignment.getName(), resourceAssignment.getProperty());
+
+ dataTypeProperties.put(resourceAssignment.getName(), resourceAssignment.getProperty());
+
+ }
+ }
+
+ }
+ }
+ return dataTypeProperties;
+ }
+
+ private void mergeDataTypeProperties(DataType dataType, Map<String, PropertyDefinition> mergeProperties) {
+ if (dataType != null && dataType.getProperties() != null && mergeProperties != null) {
+ // Add the Other Template Properties
+ mergeProperties.forEach((mappingKey, propertyDefinition) -> {
+ dataType.getProperties().put(mappingKey, propertyDefinition);
+ });
+ }
+ }
+
+ private void populateRecipeInputs(ServiceTemplate serviceTemplate) {
+ if (this.recipeDataTypes != null && !this.recipeDataTypes.isEmpty()) {
+ this.recipeDataTypes.forEach((recipeName, recipeDataType) -> {
+ String dataTypePrifix = recipeName.replace("-action", "") + "-request";
+ String dataTypeName = "dt-" + dataTypePrifix;
+
+ serviceTemplate.getDataTypes().put(dataTypeName, recipeDataType);
+
+ PropertyDefinition customInputProperty = new PropertyDefinition();
+ customInputProperty.setDescription("This is Dynamic Data type for the receipe " + recipeName + ".");
+ customInputProperty.setRequired(Boolean.FALSE);
+ customInputProperty.setType(dataTypeName);
+ serviceTemplate.getTopologyTemplate().getInputs().put(dataTypePrifix, customInputProperty);
+
+ });
+ }
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java
new file mode 100644
index 000000000..7e96f2f89
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java
@@ -0,0 +1,339 @@
+/*
+ * 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.service;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.service.common.ApplicationConstants;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ConfigModelRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * ServiceTemplateCreateService.java Purpose: Provide Service Template Create Service processing
+ * ServiceTemplateCreateService
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Service
+public class ConfigModelCreateService {
+
+ private static Logger log = LoggerFactory.getLogger(ConfigModelCreateService.class);
+
+ private ConfigModelRepository configModelRepository;
+ private ConfigModelValidatorService configModelValidatorService;
+
+ /**
+ * This is a ConfigModelCreateService
+ *
+ * @param configModelRepository ConfigModelRepository
+ * @param configModelValidatorService ConfigModelValidatorService
+ */
+ public ConfigModelCreateService(ConfigModelRepository configModelRepository,
+ ConfigModelValidatorService configModelValidatorService) {
+ this.configModelRepository = configModelRepository;
+ this.configModelValidatorService = configModelValidatorService;
+ }
+
+ /**
+ * This is a createInitialServiceTemplateContent method
+ *
+ * @param templateName templateName
+ * @return String
+ * @throws BluePrintException BluePrintException
+ */
+ public String createInitialServiceTemplateContent(String templateName) throws BluePrintException {
+ String serviceTemplateContent = null;
+ if (StringUtils.isNotBlank(templateName)) {
+ try {
+ serviceTemplateContent = IOUtils.toString(ConfigModelCreateService.class.getClassLoader()
+ .getResourceAsStream("service_template/" + templateName + ".json"), Charset.defaultCharset());
+ } catch (IOException e) {
+ throw new BluePrintException(e.getMessage(), e);
+ }
+
+ }
+ return serviceTemplateContent;
+ }
+
+ /**
+ * This is a createInitialServiceTemplate method
+ *
+ * @param templateName templateName
+ * @return ServiceTemplate
+ * @throws BluePrintException BluePrintException
+ */
+ public ServiceTemplate createInitialServiceTemplate(String templateName) throws BluePrintException {
+ ServiceTemplate serviceTemplate = null;
+ if (StringUtils.isNotBlank(templateName)) {
+ try {
+ String serviceTemplateContent = IOUtils.toString(ConfigModelCreateService.class.getClassLoader()
+ .getResourceAsStream("service_template/" + templateName + ".json"), Charset.defaultCharset());
+ if (StringUtils.isNotBlank(serviceTemplateContent)) {
+ serviceTemplate = JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
+ }
+ } catch (IOException e) {
+ throw new BluePrintException(e.getMessage(), e);
+ }
+
+ }
+ return serviceTemplate;
+ }
+
+ /**
+ * This is a saveConfigModel method
+ *
+ * @param configModel configModel
+ * @return ConfigModel
+ * @throws BluePrintException BluePrintException
+ */
+ public ConfigModel saveConfigModel(ConfigModel configModel) throws BluePrintException {
+
+ if (configModel != null) {
+ String artifactName = configModel.getArtifactName();
+ String artifactVersion = configModel.getArtifactVersion();
+ String author = configModel.getUpdatedBy();
+ // configModel.setTags(artifactName);
+
+ if (StringUtils.isBlank(author)) {
+ throw new BluePrintException("Artifact Author is missing in the Service Template");
+ }
+
+ if (StringUtils.isBlank(artifactName)) {
+ throw new BluePrintException("Artifact Name is missing in the Service Template");
+ }
+
+ if (StringUtils.isBlank(artifactVersion)) {
+ throw new BluePrintException("Artifact Version is missing in the Service Template");
+ }
+ ConfigModel updateConfigModel = null;
+
+ Optional<ConfigModel> dbConfigModelOptional = Optional.empty();
+
+ if (configModel.getId() != null) {
+ log.info("Searching for config model id : {}", configModel.getId());
+ dbConfigModelOptional = configModelRepository.findById(configModel.getId());
+ }
+
+ if (!dbConfigModelOptional.isPresent()) {
+ log.info("Searching for config model name :"
+ + configModel.getArtifactName() + ", version " + configModel.getArtifactVersion());
+ dbConfigModelOptional = configModelRepository.findByArtifactNameAndArtifactVersion(
+ configModel.getArtifactName(), configModel.getArtifactVersion());
+ }
+
+ if (dbConfigModelOptional.isPresent()) {
+ updateConfigModel = dbConfigModelOptional.get();
+ log.info("Processing for config model id : {} with config model content count : {}"
+ , updateConfigModel.getId(), updateConfigModel.getConfigModelContents().size());
+ } else {
+ ConfigModel tempConfigModel = new ConfigModel();
+ tempConfigModel.setArtifactType(ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL);
+ tempConfigModel.setArtifactName(artifactName);
+ tempConfigModel.setArtifactVersion(artifactVersion);
+ tempConfigModel.setUpdatedBy(author);
+ tempConfigModel.setPublished(ApplicationConstants.ACTIVE_N);
+ tempConfigModel.setTags(artifactName);
+ configModelRepository.saveAndFlush(tempConfigModel);
+ updateConfigModel = tempConfigModel;
+ }
+
+ Long dbConfigModelId = updateConfigModel.getId();
+
+ if (dbConfigModelId == null) {
+ throw new BluePrintException("failed to get the initial saved config model id.");
+ }
+
+ log.info("Processing for config model id : {}", dbConfigModelId);
+
+ deleteConfigModelContent(dbConfigModelId);
+
+ addConfigModelContent(dbConfigModelId, configModel);
+
+ // Populate Content model types
+ updateConfigModel = updateConfigModel(dbConfigModelId, artifactName, artifactVersion, author);
+
+
+ return updateConfigModel;
+ } else {
+ throw new BluePrintException("Config model information is missing");
+ }
+
+ }
+
+ private void deleteConfigModelContent(Long dbConfigModelId) {
+ if (dbConfigModelId != null) {
+ ConfigModel dbConfigModel = configModelRepository.getOne(dbConfigModelId);
+ if (dbConfigModel != null && CollectionUtils.isNotEmpty(dbConfigModel.getConfigModelContents())) {
+ dbConfigModel.getConfigModelContents().clear();
+ log.debug("Configuration Model content deleting : {}", dbConfigModel.getConfigModelContents());
+ configModelRepository.saveAndFlush(dbConfigModel);
+ }
+
+ }
+ }
+
+ private void addConfigModelContent(Long dbConfigModelId, ConfigModel configModel) {
+ if (dbConfigModelId != null && configModel != null
+ && CollectionUtils.isNotEmpty(configModel.getConfigModelContents())) {
+ ConfigModel dbConfigModel = configModelRepository.getOne(dbConfigModelId);
+ if (dbConfigModel != null) {
+ for (ConfigModelContent configModelContent : configModel.getConfigModelContents()) {
+ if (configModelContent != null) {
+ configModelContent.setId(null);
+ configModelContent.setConfigModel(dbConfigModel);
+ dbConfigModel.getConfigModelContents().add(configModelContent);
+ log.debug("Configuration Model content adding : {}", configModelContent);
+ }
+ }
+ configModelRepository.saveAndFlush(dbConfigModel);
+ }
+
+ }
+ }
+
+ private ConfigModel updateConfigModel(Long dbConfigModelId, String artifactName, String artifactVersion,
+ String author) throws BluePrintException {
+
+ ConfigModel dbConfigModel = configModelRepository.getOne(dbConfigModelId);
+ if (dbConfigModel != null) {
+ // Populate tags from metadata
+ String tags = getConfigModelTags(dbConfigModel);
+ if (StringUtils.isBlank(tags)) {
+ throw new BluePrintException("Failed to populate tags for the config model name " + artifactName);
+ }
+ dbConfigModel.setArtifactType(ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL);
+ dbConfigModel.setArtifactName(artifactName);
+ dbConfigModel.setArtifactVersion(artifactVersion);
+ dbConfigModel.setUpdatedBy(author);
+ dbConfigModel.setPublished(ApplicationConstants.ACTIVE_N);
+ dbConfigModel.setTags(tags);
+ configModelRepository.saveAndFlush(dbConfigModel);
+
+ log.info("Config model ({}) saved successfully.", dbConfigModel.getId());
+ }
+ return dbConfigModel;
+ }
+
+ private List<String> getValidContentTypes() {
+ List<String> valids = new ArrayList<>();
+ valids.add(ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON);
+ valids.add(ConfigModelConstant.MODEL_CONTENT_TYPE_TEMPLATE);
+ return valids;
+
+ }
+
+ private String getConfigModelTags(ConfigModel configModel) throws BluePrintException {
+ String tags = null;
+ if (CollectionUtils.isNotEmpty(configModel.getConfigModelContents())) {
+
+ for (ConfigModelContent configModelContent : configModel.getConfigModelContents()) {
+ if (configModelContent != null && StringUtils.isNotBlank(configModelContent.getContentType())) {
+
+ if (!getValidContentTypes().contains(configModelContent.getContentType())) {
+ throw new BluePrintException(configModelContent.getContentType()
+ + " is not a valid content type, It should be any one of this "
+ + getValidContentTypes());
+ }
+
+ if (configModelContent.getContentType().equals(ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON)) {
+ ServiceTemplate serviceTemplate =
+ JacksonUtils.readValue(configModelContent.getContent(), ServiceTemplate.class);
+ Preconditions.checkNotNull(serviceTemplate, "failed to transform service template content");
+ if (serviceTemplate.getMetadata() != null) {
+ serviceTemplate.getMetadata().put(BluePrintConstants.METADATA_TEMPLATE_AUTHOR,
+ configModel.getUpdatedBy());
+ serviceTemplate.getMetadata().put(BluePrintConstants.METADATA_TEMPLATE_VERSION,
+ configModel.getArtifactVersion());
+ serviceTemplate.getMetadata().put(BluePrintConstants.METADATA_TEMPLATE_NAME,
+ configModel.getArtifactName());
+ }
+ tags = String.valueOf(serviceTemplate.getMetadata());
+ } else {
+ // Do Nothing
+ }
+ }
+ }
+ }
+ return tags;
+ }
+
+ /**
+ * This is a publishConfigModel method
+ *
+ * @param id id
+ * @return ConfigModel
+ * @throws BluePrintException BluePrintException
+ */
+ public ConfigModel publishConfigModel(Long id) throws BluePrintException {
+ ConfigModel dbConfigModel = null;
+ if (id != null) {
+ Optional<ConfigModel> dbConfigModelOptional = configModelRepository.findById(id);
+ if (dbConfigModelOptional.isPresent()) {
+ dbConfigModel = dbConfigModelOptional.get();
+ List<ConfigModelContent> configModelContents = dbConfigModel.getConfigModelContents();
+ if (configModelContents != null && !configModelContents.isEmpty()) {
+ for (ConfigModelContent configModelContent : configModelContents) {
+ if (configModelContent.getContentType()
+ .equals(ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON)) {
+ ServiceTemplate serviceTemplate = JacksonUtils
+ .readValue(configModelContent.getContent(), ServiceTemplate.class);
+ if (serviceTemplate != null) {
+ validateServiceTemplate(serviceTemplate);
+ }
+ }
+ }
+ }
+ dbConfigModel.setPublished(ApplicationConstants.ACTIVE_Y);
+ configModelRepository.save(dbConfigModel);
+ log.info("Config model ({}) published successfully.", id);
+
+ }
+
+ }
+ return dbConfigModel;
+ }
+
+ /**
+ * This is a validateServiceTemplate method
+ *
+ * @param serviceTemplate Service Template
+ * @return ServiceTemplate
+ * @throws BluePrintException BluePrintException
+ */
+ public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
+ return this.configModelValidatorService.validateServiceTemplate(serviceTemplate);
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelService.java
new file mode 100644
index 000000000..feee3a3ea
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelService.java
@@ -0,0 +1,247 @@
+/*
+ * 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.service;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.service.common.ApplicationConstants;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ConfigModelContentRepository;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ConfigModelRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * ConfigModelService.java Purpose: Provide Service Template Service processing ConfigModelService
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Service
+public class ConfigModelService {
+
+ private static Logger log = LoggerFactory.getLogger(ConfigModelService.class);
+
+ private ConfigModelRepository configModelRepository;
+ private ConfigModelContentRepository configModelContentRepository;
+ private ConfigModelCreateService configModelCreateService;
+
+ /**
+ * This is a ConfigModelService constructor.
+ *
+ * @param configModelRepository
+ * @param configModelContentRepository
+ * @param configModelCreateService
+ */
+ public ConfigModelService(ConfigModelRepository configModelRepository,
+ ConfigModelContentRepository configModelContentRepository,
+ ConfigModelCreateService configModelCreateService) {
+ this.configModelRepository = configModelRepository;
+ this.configModelContentRepository = configModelContentRepository;
+ this.configModelCreateService = configModelCreateService;
+ }
+
+ /**
+ * This is a getInitialConfigModel method
+ *
+ * @param templateName
+ * @return ConfigModel
+ * @throws BluePrintException
+ */
+ public ConfigModel getInitialConfigModel(String templateName) throws BluePrintException {
+ ConfigModel configModel = null;
+ if (StringUtils.isNotBlank(templateName)) {
+ configModel = new ConfigModel();
+ configModel.setArtifactName(templateName);
+ configModel.setArtifactType(ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL);
+ configModel.setUpdatedBy("xxxxx@xxx.com");
+ ConfigModelContent configModelContent = new ConfigModelContent();
+ configModelContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON);
+ configModelContent.setName(templateName);
+ String content = this.configModelCreateService.createInitialServiceTemplateContent(templateName);
+ configModelContent.setContent(content);
+
+ List<ConfigModelContent> configModelContents = new ArrayList<>();
+ configModelContents.add(configModelContent);
+
+ configModel.setConfigModelContents(configModelContents);
+ }
+ return configModel;
+ }
+
+ /**
+ * This is a saveConfigModel method
+ *
+ * @param configModel
+ * @return ConfigModel
+ * @throws BluePrintException
+ */
+ public ConfigModel saveConfigModel(ConfigModel configModel) throws BluePrintException {
+ return this.configModelCreateService.saveConfigModel(configModel);
+ }
+
+ /**
+ * This is a publishConfigModel method
+ *
+ * @param id
+ * @return ConfigModel
+ * @throws BluePrintException
+ */
+ public ConfigModel publishConfigModel(Long id) throws BluePrintException {
+ return this.configModelCreateService.publishConfigModel(id);
+ }
+
+ /**
+ * This is a searchConfigModels method
+ *
+ * @param tags
+ * @return ConfigModel
+ */
+ public List<ConfigModel> searchConfigModels(String tags) {
+ List<ConfigModel> models = configModelRepository.findByTagsContainingIgnoreCase(tags);
+ if (models != null) {
+ for (ConfigModel configModel : models) {
+ configModel.setConfigModelContents(null);
+ }
+ }
+ return models;
+ }
+
+ /**
+ * This is a getConfigModelByNameAndVersion method
+ *
+ * @param name
+ * @param version
+ * @return ConfigModel
+ */
+ public ConfigModel getConfigModelByNameAndVersion(String name, String version) {
+ ConfigModel configModel = null;
+ Optional<ConfigModel> dbConfigModel = null;
+ if (StringUtils.isNotBlank(version)) {
+ dbConfigModel = configModelRepository.findByArtifactNameAndArtifactVersion(name, version);
+ } else {
+ dbConfigModel = configModelRepository.findTopByArtifactNameOrderByArtifactVersionDesc(name);
+ }
+ if (dbConfigModel.isPresent()) {
+ configModel = dbConfigModel.get();
+ }
+ return configModel;
+ }
+
+ /**
+ * This is a getConfigModel method
+ *
+ * @param id
+ * @return ConfigModel
+ */
+ public ConfigModel getConfigModel(Long id) {
+ ConfigModel configModel = null;
+ if (id != null) {
+ Optional<ConfigModel> dbConfigModel = configModelRepository.findById(id);
+ if (dbConfigModel.isPresent()) {
+ configModel = dbConfigModel.get();
+ }
+ }
+ return configModel;
+ }
+
+ /**
+ * This method returns clone of the given model id, by masking the other unrelated fields
+ *
+ * @param id
+ * @return
+ */
+
+ public ConfigModel getCloneConfigModel(Long id) {
+
+ ConfigModel configModel = null;
+ ConfigModel cloneConfigModel = null;
+ if (id != null) {
+ Optional<ConfigModel> dbConfigModel = configModelRepository.findById(id);
+ if (dbConfigModel.isPresent()) {
+ configModel = dbConfigModel.get();
+ cloneConfigModel = configModel;
+ cloneConfigModel.setUpdatedBy("xxxxx@xxx.com");
+ cloneConfigModel.setArtifactName("XXXX");
+ cloneConfigModel.setPublished("XXXX");
+ cloneConfigModel.setPublished("XXXX");
+ cloneConfigModel.setUpdatedBy("XXXX");
+ cloneConfigModel.setId(null);
+ cloneConfigModel.setTags(null);
+ cloneConfigModel.setCreatedDate(new Date());
+ List<ConfigModelContent> configModelContents = cloneConfigModel.getConfigModelContents();
+
+ if (CollectionUtils.isNotEmpty(configModelContents)) {
+ for (ConfigModelContent configModelContent : configModelContents) {
+ if (configModelContent != null && StringUtils.isNotBlank(configModelContent.getContentType())) {
+ configModelContent.setId(null);
+ configModelContent.setCreationDate(new Date());
+
+ if (ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON
+ .equalsIgnoreCase(configModelContent.getContentType())) {
+ ServiceTemplate serviceTemplate = JacksonUtils
+ .readValue(configModelContent.getContent(), ServiceTemplate.class);
+ if (serviceTemplate != null && serviceTemplate.getMetadata() != null) {
+ serviceTemplate.getMetadata()
+ .put(BluePrintConstants.METADATA_TEMPLATE_AUTHOR, "XXXX");
+ serviceTemplate.getMetadata()
+ .put(BluePrintConstants.METADATA_TEMPLATE_VERSION, "1.0.0");
+ serviceTemplate.getMetadata()
+ .put(BluePrintConstants.METADATA_TEMPLATE_NAME, "XXXXXX");
+
+ configModelContent.setContent(JacksonUtils.getJson(serviceTemplate));
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
+ return cloneConfigModel;
+ }
+
+ /**
+ * This is a deleteConfigModel method
+ *
+ * @param id
+ */
+
+ @Transactional
+ public void deleteConfigModel(Long id) {
+ Optional<ConfigModel> dbConfigModel = configModelRepository.findById(id);
+ if (dbConfigModel.isPresent()) {
+ configModelContentRepository.deleteByConfigModel(dbConfigModel.get());
+ configModelRepository.delete(dbConfigModel.get());
+ }
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelValidatorService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelValidatorService.java
new file mode 100644
index 000000000..21b00f8c2
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelValidatorService.java
@@ -0,0 +1,67 @@
+/*
+ * 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.service;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.service.validator.ServiceTemplateValidator;
+import org.springframework.stereotype.Service;
+
+/**
+ * ServiceTemplateValidatorService.java Purpose: Provide Service to Validate Service Model Template
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Service
+public class ConfigModelValidatorService {
+
+ /**
+ * This is a validateServiceTemplate
+ *
+ * @param serviceTemplateContent
+ * @return ServiceTemplate
+ * @throws BluePrintException
+ */
+ public ServiceTemplate validateServiceTemplate(String serviceTemplateContent) throws BluePrintException {
+ Preconditions.checkArgument(StringUtils.isNotBlank(serviceTemplateContent), "Service Template Content is (" + serviceTemplateContent + ") not Defined.");
+ ServiceTemplate serviceTemplate =
+ JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
+ return validateServiceTemplate(serviceTemplate);
+ }
+
+ /**
+ * This is a enhanceServiceTemplate
+ *
+ * @param serviceTemplate
+ * @return ServiceTemplate
+ * @throws BluePrintException
+ */
+ @SuppressWarnings("squid:S00112")
+ public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
+ Preconditions.checkNotNull(serviceTemplate, "Service Template is not defined.");
+ ServiceTemplateValidator validator = new ServiceTemplateValidator();
+ validator.validateServiceTemplate(serviceTemplate);
+ return serviceTemplate;
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
new file mode 100644
index 000000000..9ab319cb7
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
@@ -0,0 +1,325 @@
+/*
+ * 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.service;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.text.StrBuilder;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DictionaryDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.List;
+
+/**
+ * DataBaseInitService.java Purpose: Provide DataBaseInitService Service
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Component
+@ConditionalOnProperty(name = "blueprints.load.initial-data", havingValue = "true", matchIfMissing = false)
+public class DataBaseInitService {
+
+ private static Logger log = LoggerFactory.getLogger(DataBaseInitService.class);
+ @Value("${blueprints.load.path}")
+ private String modelLoadPath;
+ private ModelTypeService modelTypeService;
+ private ResourceDictionaryService resourceDictionaryService;
+ private ConfigModelService configModelService;
+
+ private String dataTypePath;
+ private String nodeTypePath;
+ private String artifactTypePath;
+ private String resourceDictionaryPath;
+ private String bluePrintsPath;
+
+ @Autowired
+ private ResourcePatternResolver resourceLoader;
+
+ /**
+ * This is a DataBaseInitService, used to load the initial data
+ *
+ * @param modelTypeService
+ * @param resourceDictionaryService
+ * @param configModelService
+ */
+ public DataBaseInitService(ModelTypeService modelTypeService, ResourceDictionaryService resourceDictionaryService,
+ ConfigModelService configModelService) {
+ this.modelTypeService = modelTypeService;
+ this.resourceDictionaryService = resourceDictionaryService;
+ this.configModelService = configModelService;
+ log.info("DataBaseInitService started...");
+
+ }
+
+ @PostConstruct
+ private void initDatabase() {
+ log.info("loading Blueprints from DIR : {}", modelLoadPath);
+ dataTypePath = modelLoadPath + "/model_type/data_type";
+ nodeTypePath = modelLoadPath + "/model_type/node_type";
+ artifactTypePath = modelLoadPath + "/model_type/artifact_type";
+ resourceDictionaryPath = modelLoadPath + "/resource_dictionary";
+ bluePrintsPath = modelLoadPath + "/blueprints";
+
+ log.info("loading dataTypePath from DIR : {}", dataTypePath);
+ log.info("loading nodeTypePath from DIR : {}", nodeTypePath);
+ log.info("loading artifactTypePath from DIR : {}", artifactTypePath);
+ log.info("loading resourceDictionaryPath from DIR : {}", resourceDictionaryPath);
+ log.info("loading bluePrintsPath from DIR : {}", bluePrintsPath);
+
+ loadModelType();
+ loadResourceDictionary();
+ loadBlueprints();
+ }
+
+ private void loadModelType() {
+ log.info(" *************************** loadModelType **********************");
+ try {
+ Resource[] dataTypefiles = getPathResources(dataTypePath, ".json");
+ StrBuilder errorBuilder = new StrBuilder();
+ if (dataTypefiles != null) {
+ for (Resource file : dataTypefiles) {
+ if (file != null) {
+ loadDataType(file, errorBuilder);
+ }
+ }
+ }
+
+ Resource[] nodeTypefiles = getPathResources(nodeTypePath, ".json");
+ if (nodeTypefiles != null) {
+ for (Resource file : nodeTypefiles) {
+ if (file != null) {
+ loadNodeType(file, errorBuilder);
+ }
+ }
+ }
+
+ Resource[] artifactTypefiles = getPathResources(artifactTypePath, ".json");
+ if (artifactTypefiles != null) {
+ for (Resource file : artifactTypefiles) {
+ if (file != null) {
+ loadArtifactType(file, errorBuilder);
+ }
+ }
+ }
+
+ if (!errorBuilder.isEmpty()) {
+ log.error(errorBuilder.toString());
+ }
+ } catch (Exception e) {
+ log.error("Failed in Data type loading", e);
+ }
+ }
+
+ private void loadResourceDictionary() {
+ log.info(
+ " *************************** loadResourceDictionary **********************");
+ try {
+ Resource[] dataTypefiles = getPathResources(resourceDictionaryPath, ".json");
+ if (dataTypefiles != null) {
+ StrBuilder errorBuilder = new StrBuilder();
+ String fileName = null;
+ for (Resource file : dataTypefiles) {
+ try {
+ fileName = file.getFilename();
+ log.trace("Loading : {}", fileName);
+ String definitionContent = getResourceContent(file);
+ DictionaryDefinition dictionaryDefinition =
+ JacksonUtils.readValue(definitionContent, DictionaryDefinition.class);
+ if (dictionaryDefinition != null) {
+ ResourceDictionary resourceDictionary = new ResourceDictionary();
+ resourceDictionary.setResourcePath(dictionaryDefinition.getResourcePath());
+ resourceDictionary.setName(dictionaryDefinition.getName());
+ resourceDictionary.setDefinition(definitionContent);
+
+ if (dictionaryDefinition.getValidValues() != null)
+ resourceDictionary
+ .setValidValues(String.valueOf(dictionaryDefinition.getValidValues()));
+
+ if (dictionaryDefinition.getSampleValue() != null)
+ resourceDictionary
+ .setValidValues(String.valueOf(dictionaryDefinition.getSampleValue()));
+
+ resourceDictionary.setResourceType(dictionaryDefinition.getResourceType());
+ resourceDictionary.setDataType(dictionaryDefinition.getDataType());
+ resourceDictionary.setEntrySchema(dictionaryDefinition.getEntrySchema());
+ resourceDictionary.setDescription(dictionaryDefinition.getDescription());
+ resourceDictionary.setUpdatedBy(dictionaryDefinition.getUpdatedBy());
+ if (StringUtils.isBlank(dictionaryDefinition.getTags())) {
+ resourceDictionary.setTags(
+ dictionaryDefinition.getName() + ", " + dictionaryDefinition.getUpdatedBy()
+ + ", " + dictionaryDefinition.getResourceType() + ", "
+ + dictionaryDefinition.getUpdatedBy());
+
+ } else {
+ resourceDictionary.setTags(dictionaryDefinition.getTags());
+ }
+ resourceDictionaryService.saveResourceDictionary(resourceDictionary);
+
+ log.trace(" Loaded successfully : {}", file.getFilename());
+ } else {
+ throw new BluePrintException("couldn't get dictionary from content information");
+ }
+ } catch (Exception e) {
+ errorBuilder.appendln("Dictionary loading Errors : " + file.getFilename() + ":" + e.getMessage());
+ }
+ }
+ if (!errorBuilder.isEmpty()) {
+ log.error(errorBuilder.toString());
+ }
+
+ }
+ } catch (Exception e) {
+ log.error(
+ "Failed in Resource dictionary loading", e);
+ }
+ }
+
+ private void loadBlueprints() {
+ log.info("*************************** loadServiceTemplate **********************");
+ try {
+ List<String> serviceTemplateDirs = ConfigModelUtils.getBlueprintNames(bluePrintsPath);
+ if (CollectionUtils.isNotEmpty(serviceTemplateDirs)) {
+ StrBuilder errorBuilder = new StrBuilder();
+ for (String fileName : serviceTemplateDirs) {
+ try {
+ String bluePrintPath = this.bluePrintsPath.concat("/").concat(fileName);
+ log.debug("***** Loading service template : {}", bluePrintPath);
+ ConfigModel configModel = ConfigModelUtils.getConfigModel(bluePrintPath);
+
+ configModel = this.configModelService.saveConfigModel(configModel);
+
+ log.info("Publishing : {}", configModel.getId());
+
+ this.configModelService.publishConfigModel(configModel.getId());
+
+ log.info("Loaded service template successfully: {}", fileName);
+
+ } catch (Exception e) {
+ errorBuilder.appendln("load config model " + fileName + " error : " + e.getMessage());
+ }
+ }
+
+ if (!errorBuilder.isEmpty()) {
+ log.error(errorBuilder.toString());
+ }
+ }
+ } catch (Exception e) {
+ log.error("Failed in Service Template loading", e);
+ }
+ }
+
+ private void loadNodeType(Resource file, StrBuilder errorBuilder) {
+ try {
+ log.trace("Loading Node Type : {}", file.getFilename());
+ String nodeKey = file.getFilename().replace(".json", "");
+ String definitionContent = getResourceContent(file);
+ NodeType nodeType = JacksonUtils.readValue(definitionContent, NodeType.class);
+ ModelType modelType = new ModelType();
+ modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE);
+ modelType.setDerivedFrom(nodeType.getDerivedFrom());
+ modelType.setDescription(nodeType.getDescription());
+ modelType.setDefinition(definitionContent);
+ modelType.setModelName(nodeKey);
+ modelType.setVersion(nodeType.getVersion());
+ modelType.setUpdatedBy("System");
+ modelType.setTags(nodeKey + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE + ","
+ + nodeType.getDerivedFrom());
+ modelTypeService.saveModel(modelType);
+ log.trace("Loaded Node Type successfully : {}", file.getFilename());
+ } catch (Exception e) {
+ errorBuilder.appendln("Node type loading error : " + file.getFilename() + ":" + e.getMessage());
+ }
+ }
+
+ private void loadDataType(Resource file, StrBuilder errorBuilder) {
+ try {
+ log.trace("Loading Data Type: {}", file.getFilename());
+ String dataKey = file.getFilename().replace(".json", "");
+ String definitionContent = getResourceContent(file);
+ DataType dataType = JacksonUtils.readValue(definitionContent, DataType.class);
+ ModelType modelType = new ModelType();
+ modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+ modelType.setDerivedFrom(dataType.getDerivedFrom());
+ modelType.setDescription(dataType.getDescription());
+ modelType.setDefinition(definitionContent);
+ modelType.setModelName(dataKey);
+ modelType.setVersion(dataType.getVersion());
+ modelType.setUpdatedBy("System");
+ modelType.setTags(dataKey + "," + dataType.getDerivedFrom() + ","
+ + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+ modelTypeService.saveModel(modelType);
+ log.trace(" Loaded Data Type successfully : {}", file.getFilename());
+ } catch (Exception e) {
+ errorBuilder.appendln("Data type loading error : " + file.getFilename() + ":" + e.getMessage());
+ }
+ }
+
+ private void loadArtifactType(Resource file, StrBuilder errorBuilder) {
+ try {
+ log.trace("Loading Artifact Type: {}", file.getFilename());
+ String dataKey = file.getFilename().replace(".json", "");
+ String definitionContent = getResourceContent(file);
+ ArtifactType artifactType = JacksonUtils.readValue(definitionContent, ArtifactType.class);
+ ModelType modelType = new ModelType();
+ modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
+ modelType.setDerivedFrom(artifactType.getDerivedFrom());
+ modelType.setDescription(artifactType.getDescription());
+ modelType.setDefinition(definitionContent);
+ modelType.setModelName(dataKey);
+ modelType.setVersion(artifactType.getVersion());
+ modelType.setUpdatedBy("System");
+ modelType.setTags(dataKey + "," + artifactType.getDerivedFrom() + ","
+ + BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
+ modelTypeService.saveModel(modelType);
+ log.trace("Loaded Artifact Type successfully : {}", file.getFilename());
+ } catch (Exception e) {
+ errorBuilder.appendln("Artifact type loading error : " + file.getFilename() + ":" + e.getMessage());
+ }
+ }
+
+ private Resource[] getPathResources(String path, String extension) throws IOException {
+ return resourceLoader.getResources("file:" + path + "/*" + extension);
+ }
+
+ private String getResourceContent(Resource resource) throws IOException {
+ return IOUtils.toString(resource.getInputStream(), Charset.defaultCharset());
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeService.java
new file mode 100644
index 000000000..2bc2963b6
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeService.java
@@ -0,0 +1,178 @@
+/*
+ * 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.service;
+
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ModelTypeRepository;
+import org.onap.ccsdk.apps.controllerblueprints.service.validator.ModelTypeValidator;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * ModelTypeService.java Purpose: Provide ModelTypeService Service ModelTypeService
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Service
+@Transactional
+public class ModelTypeService {
+
+ private ModelTypeRepository modelTypeRepository;
+
+ /**
+ * This is a ModelTypeService, used to save and get the model types stored in database
+ *
+ * @param modelTypeRepository
+ */
+ public ModelTypeService(ModelTypeRepository modelTypeRepository) {
+ this.modelTypeRepository = modelTypeRepository;
+ }
+
+
+ /**
+ * This is a getModelTypeByName service
+ *
+ * @param modelTypeName
+ * @return ModelType
+ * @throws BluePrintException
+ */
+ public ModelType getModelTypeByName(String modelTypeName) throws BluePrintException {
+ ModelType modelType = null;
+ if (StringUtils.isNotBlank(modelTypeName)) {
+ Optional<ModelType> modelTypeOption = modelTypeRepository.findByModelName(modelTypeName);
+ if (modelTypeOption.isPresent()) {
+ modelType = modelTypeOption.get();
+ }
+ } else {
+ throw new BluePrintException("Model Name Information is missing.");
+ }
+ return modelType;
+ }
+
+
+ /**
+ * This is a searchModelTypes service
+ *
+ * @param tags
+ * @return List<ModelType>
+ * @throws BluePrintException
+ */
+ public List<ModelType> searchModelTypes(String tags) throws BluePrintException {
+ if (tags != null) {
+ return modelTypeRepository.findByTagsContainingIgnoreCase(tags);
+ } else {
+ throw new BluePrintException("No Search Information provide");
+ }
+ }
+
+ /**
+ * This is a saveModel service
+ *
+ * @param modelType
+ * @return ModelType
+ * @throws BluePrintException
+ */
+ public ModelType saveModel(ModelType modelType) throws BluePrintException {
+
+ ModelTypeValidator.validateModelType(modelType);
+
+ Optional<ModelType> dbModelType = modelTypeRepository.findByModelName(modelType.getModelName());
+ if (dbModelType.isPresent()) {
+ ModelType dbModel = dbModelType.get();
+ dbModel.setDescription(modelType.getDescription());
+ dbModel.setDefinition(modelType.getDefinition());
+ dbModel.setDefinitionType(modelType.getDefinitionType());
+ dbModel.setDerivedFrom(modelType.getDerivedFrom());
+ dbModel.setTags(modelType.getTags());
+ dbModel.setVersion(modelType.getVersion());
+ dbModel.setUpdatedBy(modelType.getUpdatedBy());
+ modelType = modelTypeRepository.save(dbModel);
+ } else {
+ modelType = modelTypeRepository.save(modelType);
+ }
+ return modelType;
+ }
+
+
+ /**
+ * This is a deleteByModelName service
+ *
+ * @param modelName
+ * @throws BluePrintException
+ */
+ public void deleteByModelName(String modelName) throws BluePrintException {
+ if (modelName != null) {
+ modelTypeRepository.deleteByModelName(modelName);
+ } else {
+ throw new BluePrintException("Model Name Information is missing.");
+ }
+ }
+
+ /**
+ * This is a getModelTypeByTags service
+ *
+ * @param tags
+ * @return List<ModelType>
+ * @throws BluePrintException
+ */
+ public List<ModelType> getModelTypeByTags(String tags) throws BluePrintException {
+ if (StringUtils.isNotBlank(tags)) {
+ return modelTypeRepository.findByTagsContainingIgnoreCase(tags);
+ } else {
+ throw new BluePrintException("Model Tag Information is missing.");
+ }
+ }
+
+ /**
+ * This is a getModelTypeByDefinitionType service
+ *
+ * @param definitionType
+ * @return List<ModelType>
+ * @throws BluePrintException
+ */
+ public List<ModelType> getModelTypeByDefinitionType(String definitionType) throws BluePrintException {
+ if (StringUtils.isNotBlank(definitionType)) {
+ return modelTypeRepository.findByDefinitionType(definitionType);
+ } else {
+ throw new BluePrintException("Model definitionType Information is missing.");
+ }
+ }
+
+ /**
+ * This is a getModelTypeByDerivedFrom service
+ *
+ * @param derivedFrom
+ * @return List<ModelType>
+ * @throws BluePrintException
+ */
+ public List<ModelType> getModelTypeByDerivedFrom(String derivedFrom) throws BluePrintException {
+ if (StringUtils.isNotBlank(derivedFrom)) {
+ return modelTypeRepository.findByDerivedFrom(derivedFrom);
+ } else {
+ throw new BluePrintException("Model derivedFrom Information is missing.");
+ }
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
new file mode 100644
index 000000000..b9567db13
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
@@ -0,0 +1,169 @@
+/*
+ * 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.service;
+
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DictionaryDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository;
+import org.onap.ccsdk.apps.controllerblueprints.service.validator.ResourceDictionaryValidator;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * ResourceDictionaryService.java Purpose: Provide DataDictionaryService Service
+ * DataDictionaryService
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Service
+public class ResourceDictionaryService {
+
+ private ResourceDictionaryRepository resourceDictionaryRepository;
+
+ /**
+ * This is a DataDictionaryService, used to save and get the Resource Mapping stored in database
+ *
+ * @param dataDictionaryRepository
+ *
+ */
+ public ResourceDictionaryService(ResourceDictionaryRepository dataDictionaryRepository) {
+ this.resourceDictionaryRepository = dataDictionaryRepository;
+ }
+
+ /**
+ * This is a getDataDictionaryByName service
+ *
+ * @param name
+ * @return DataDictionary
+ * @throws BluePrintException
+ */
+ public ResourceDictionary getResourceDictionaryByName(String name) throws BluePrintException {
+ if (StringUtils.isNotBlank(name)) {
+ return resourceDictionaryRepository.findByName(name).get();
+ } else {
+ throw new BluePrintException("Resource Mapping Name Information is missing.");
+ }
+ }
+
+ /**
+ * This is a searchResourceDictionaryByNames service
+ *
+ * @param names
+ * @return List<ResourceDictionary>
+ * @throws BluePrintException
+ */
+ public List<ResourceDictionary> searchResourceDictionaryByNames(List<String> names)
+ throws BluePrintException {
+ if (names != null && !names.isEmpty()) {
+ return resourceDictionaryRepository.findByNameIn(names);
+ } else {
+ throw new BluePrintException("No Search Information provide");
+ }
+ }
+
+ /**
+ * This is a searchResourceDictionaryByTags service
+ *
+ * @param tags
+ * @return List<ResourceDictionary>
+ * @throws BluePrintException
+ */
+ public List<ResourceDictionary> searchResourceDictionaryByTags(String tags) throws BluePrintException {
+ if (StringUtils.isNotBlank(tags)) {
+ return resourceDictionaryRepository.findByTagsContainingIgnoreCase(tags);
+ } else {
+ throw new BluePrintException("No Search Information provide");
+ }
+ }
+
+ /**
+ * This is a saveDataDictionary service
+ *
+ * @param resourceDictionary
+ * @return DataDictionary
+ * @throws BluePrintException
+ */
+ public ResourceDictionary saveResourceDictionary(ResourceDictionary resourceDictionary)
+ throws BluePrintException {
+ if (resourceDictionary != null) {
+ ResourceDictionaryValidator.validateResourceDictionary(resourceDictionary);
+
+ DictionaryDefinition dictionaryDefinition =
+ JacksonUtils.readValue(resourceDictionary.getDefinition(), DictionaryDefinition.class);
+
+ if (dictionaryDefinition == null) {
+ throw new BluePrintException(
+ "Resource dictionary definition is not valid content " + resourceDictionary.getDefinition());
+ }
+
+ dictionaryDefinition.setName(resourceDictionary.getName());
+ dictionaryDefinition.setResourcePath(resourceDictionary.getResourcePath());
+ dictionaryDefinition.setResourceType(resourceDictionary.getResourceType());
+ dictionaryDefinition.setDataType(resourceDictionary.getDataType());
+ dictionaryDefinition.setEntrySchema(resourceDictionary.getEntrySchema());
+ dictionaryDefinition.setTags(resourceDictionary.getTags());
+ dictionaryDefinition.setDescription(resourceDictionary.getDescription());
+ dictionaryDefinition.setUpdatedBy(resourceDictionary.getUpdatedBy());
+
+ String definitionContent = JacksonUtils.getJson(dictionaryDefinition, true);
+ resourceDictionary.setDefinition(definitionContent);
+
+ Optional<ResourceDictionary> dbResourceDictionaryData =
+ resourceDictionaryRepository.findByName(resourceDictionary.getName());
+ if (dbResourceDictionaryData.isPresent()) {
+ ResourceDictionary dbResourceDictionary = dbResourceDictionaryData.get();
+
+ dbResourceDictionary.setName(resourceDictionary.getName());
+ dbResourceDictionary.setDefinition(resourceDictionary.getDefinition());
+ dbResourceDictionary.setDescription(resourceDictionary.getDescription());
+ dbResourceDictionary.setResourceType(resourceDictionary.getResourceType());
+ dbResourceDictionary.setResourcePath(resourceDictionary.getResourcePath());
+ dbResourceDictionary.setDataType(resourceDictionary.getDataType());
+ dbResourceDictionary.setEntrySchema(resourceDictionary.getEntrySchema());
+ dbResourceDictionary.setTags(resourceDictionary.getTags());
+ dbResourceDictionary.setValidValues(resourceDictionary.getValidValues());
+ resourceDictionary = resourceDictionaryRepository.save(dbResourceDictionary);
+ } else {
+ resourceDictionary = resourceDictionaryRepository.save(resourceDictionary);
+ }
+ } else {
+ throw new BluePrintException("Resource Dictionary information is missing");
+ }
+ return resourceDictionary;
+ }
+
+ /**
+ * This is a deleteResourceDictionary service
+ *
+ * @param name
+ * @throws BluePrintException
+ */
+ public void deleteResourceDictionary(String name) throws BluePrintException {
+ if (name != null) {
+ resourceDictionaryRepository.deleteByName(name);
+ } else {
+ throw new BluePrintException("Resource Mapping Id Information is missing.");
+ }
+
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/SchemaGeneratorService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/SchemaGeneratorService.java
new file mode 100644
index 000000000..a75651f19
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/SchemaGeneratorService.java
@@ -0,0 +1,116 @@
+/*
+ * 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.service;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.service.common.SwaggerGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * SchemaGeneratorService.java Purpose: Provide Service to generate service template input schema definition and Sample
+ * Json generation.
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+public class SchemaGeneratorService {
+ private static Logger log = LoggerFactory.getLogger(SchemaGeneratorService.class);
+
+ private Map<String, DataType> dataTypes;
+
+ /**
+ * This is a SchemaGeneratorService constructor
+ */
+ public SchemaGeneratorService() {
+ dataTypes = new HashMap<>();
+ }
+
+ /**
+ * This is a generateSchema
+ *
+ * @param serviceTemplateContent service template content
+ * @return String
+ * @throws BluePrintException Blueprint Exception
+ */
+ public String generateSchema(String serviceTemplateContent) throws BluePrintException {
+ if (StringUtils.isNotBlank(serviceTemplateContent)) {
+ ServiceTemplate serviceTemplate = JacksonUtils.readValue(serviceTemplateContent,
+ ServiceTemplate.class);
+ return generateSchema(serviceTemplate);
+ } else {
+ throw new BluePrintException(
+ "Service Template Content is (" + serviceTemplateContent + ") not Defined.");
+ }
+ }
+
+ /**
+ * This is a generateSchema
+ *
+ * @param serviceTemplate service template content
+ * @return String
+ * @throws BluePrintException Blueprint Exception
+ */
+ public String generateSchema(ServiceTemplate serviceTemplate) throws BluePrintException {
+ String schemaContent = null;
+ Preconditions.checkNotNull(serviceTemplate, "Service Template is not defined.");
+ try {
+ if (serviceTemplate.getTopologyTemplate() != null
+ && serviceTemplate.getTopologyTemplate().getInputs() != null) {
+ SwaggerGenerator swaggerGenerator = new SwaggerGenerator(serviceTemplate);
+ schemaContent = swaggerGenerator.generateSwagger();
+ }
+ } catch (Exception e) {
+ throw new BluePrintException(e.getMessage(), e);
+ }
+
+ return schemaContent;
+ }
+
+ private void manageServiceTemplateActions(ServiceTemplate serviceTemplate, String actionName) {
+ if (serviceTemplate != null && serviceTemplate.getTopologyTemplate() != null
+ && StringUtils.isNotBlank(actionName)) {
+
+ if (MapUtils.isNotEmpty(serviceTemplate.getTopologyTemplate().getInputs())) {
+
+ serviceTemplate.getTopologyTemplate().getInputs().entrySet().removeIf(entity -> {
+ String keyName = entity.getKey();
+ String replacedAction = actionName.replace("-action", "-request");
+ log.debug("Key name : " + keyName + ", actionName "
+ + actionName + ", replacedAction :" + replacedAction);
+ if (keyName.endsWith("-request") && !keyName.equals(replacedAction)) {
+ log.info("deleting input property {} ", keyName);
+ return true;
+ }
+ return false;
+ });
+ }
+
+ }
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
new file mode 100644
index 000000000..70b7917a4
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
@@ -0,0 +1,140 @@
+/*
+ * 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.service;
+
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.validator.ResourceAssignmentValidator;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
+import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * ServiceTemplateService.java Purpose: Provide Service Template Create Service processing ServiceTemplateService
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Service
+public class ServiceTemplateService {
+
+ private ResourceDictionaryRepository dataDictionaryRepository;
+
+ private ConfigModelCreateService configModelCreateService;
+ private BluePrintEnhancerService bluePrintEnhancerService;
+
+ /**
+ * This is a SchemaGeneratorService constructor
+ *
+ * @param dataDictionaryRepository
+ * @param configModelCreateService
+ * @param bluePrintEnhancerService
+ */
+ public ServiceTemplateService(ResourceDictionaryRepository dataDictionaryRepository,
+ ConfigModelCreateService configModelCreateService,
+ BluePrintEnhancerService bluePrintEnhancerService) {
+ this.dataDictionaryRepository = dataDictionaryRepository;
+ this.configModelCreateService = configModelCreateService;
+ this.bluePrintEnhancerService = bluePrintEnhancerService;
+
+ }
+
+ /**
+ * This is a validateServiceTemplate method
+ *
+ * @param serviceTemplate
+ * @return ServiceTemplate
+ * @throws BluePrintException
+ */
+ public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
+ return this.configModelCreateService.validateServiceTemplate(serviceTemplate);
+ }
+
+ /**
+ * This is a enrichServiceTemplate method
+ *
+ * @param serviceTemplate
+ * @return ServiceTemplate
+ * @throws BluePrintException
+ */
+ public ServiceTemplate enrichServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
+ this.bluePrintEnhancerService.enhance(serviceTemplate);
+ return serviceTemplate;
+ }
+
+ /**
+ * This is a autoMap method to map the template keys
+ *
+ * @param resourceAssignments
+ * @return AutoMapResponse
+ * @throws BluePrintException
+ */
+ public AutoMapResponse autoMap(List<ResourceAssignment> resourceAssignments) throws BluePrintException {
+ AutoResourceMappingService autoMappingService = new AutoResourceMappingService(dataDictionaryRepository);
+ AutoMapResponse autoMapResponse = autoMappingService.autoMap(resourceAssignments);
+ return autoMapResponse;
+ }
+
+ /**
+ * This is a validateResourceAssignments method
+ *
+ * @param resourceAssignments
+ * @return List<ResourceAssignment>
+ * @throws BluePrintException
+ */
+ public List<ResourceAssignment> validateResourceAssignments(List<ResourceAssignment> resourceAssignments)
+ throws BluePrintException {
+ try {
+ ResourceAssignmentValidator resourceAssignmentValidator =
+ new ResourceAssignmentValidator(resourceAssignments);
+ resourceAssignmentValidator.validateResourceAssignment();
+ } catch (BluePrintException e) {
+ throw new BluePrintException(e.getMessage(), e);
+ }
+ return resourceAssignments;
+ }
+
+ /**
+ * This is a generateResourceAssignments method
+ *
+ * @param templateContent
+ * @return List<ResourceAssignment>
+ */
+ public List<ResourceAssignment> generateResourceAssignments(ConfigModelContent templateContent) {
+ List<ResourceAssignment> resourceAssignments = new ArrayList<>();
+ if (templateContent != null && StringUtils.isNotBlank(templateContent.getContent())) {
+ Pattern p = Pattern.compile("(?<=\\$\\{)([^\\}]+)(?=\\})");
+ Matcher m = p.matcher(templateContent.getContent());
+ while (m.find()) {
+ ResourceAssignment resourceAssignment = new ResourceAssignment();
+ resourceAssignment.setName(m.group());
+ resourceAssignments.add(resourceAssignment);
+ }
+ }
+ return resourceAssignments;
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ApplicationConstants.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ApplicationConstants.java
new file mode 100644
index 000000000..8dd748404
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ApplicationConstants.java
@@ -0,0 +1,33 @@
+/*
+ * 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.service.common;
+
+/**
+ * ApplicationConstants.java Purpose: Provide ControllerBluprintsApplication Constant Information
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+public final class ApplicationConstants {
+ private ApplicationConstants() {
+
+ }
+ public static final String ACTIVE_Y = "Y";
+ public static final String ACTIVE_N = "N";
+ public static final String ASDC_ARTIFACT_TYPE_SDNC_MODEL = "SDNC_MODEL";
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java
new file mode 100644
index 000000000..f7a802e46
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java
@@ -0,0 +1,63 @@
+/*
+ * 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.service.common;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+import java.io.Serializable;
+
+@JsonInclude(Include.NON_NULL)
+public class ErrorMessage implements Serializable {
+ private Integer httpStatus;
+ private String message;
+ private Integer code;
+ private String developerMessage;
+
+ public Integer getHttpStatus() {
+ return httpStatus;
+ }
+
+ public void setHttpStatus(Integer httpStatus) {
+ this.httpStatus = httpStatus;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public void setCode(Integer code) {
+ this.code = code;
+ }
+
+ public String getDeveloperMessage() {
+ return developerMessage;
+ }
+
+ public void setDeveloperMessage(String developerMessage) {
+ this.developerMessage = developerMessage;
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java
new file mode 100644
index 000000000..f223dccb2
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.common;
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+@Provider
+public class ServiceExceptionMapper implements ExceptionMapper<BluePrintException> {
+
+ @Override
+ public Response toResponse(BluePrintException ex) {
+ ErrorMessage errorMessage = new ErrorMessage();
+ errorMessage.setCode(ex.getCode());
+ errorMessage.setMessage(ex.getMessage());
+ StringWriter errorStackTrace = new StringWriter();
+ ex.printStackTrace(new PrintWriter(errorStackTrace));
+ errorMessage.setDeveloperMessage(ex.toString());
+ return Response.status(500).entity(errorMessage).type(MediaType.APPLICATION_JSON).build();
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java
new file mode 100644
index 000000000..e90807633
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java
@@ -0,0 +1,187 @@
+/*
+ * 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.service.common;
+
+import io.swagger.models.*;
+import io.swagger.models.parameters.BodyParameter;
+import io.swagger.models.parameters.Parameter;
+import io.swagger.models.properties.*;
+import io.swagger.util.Json;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.BooleanUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+
+import java.util.*;
+
+/**
+ * SwaggerGenerator.java Purpose: Provide Service to generate service template input schema definition and Sample Json
+ * generation.
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Deprecated
+public class SwaggerGenerator {
+
+ private ServiceTemplate serviceTemplate;
+
+ /**
+ * This is a SwaggerGenerator constructor
+ */
+ public SwaggerGenerator(ServiceTemplate serviceTemplate) {
+ this.serviceTemplate = serviceTemplate;
+ }
+
+ /**
+ * This is a generateSwagger
+ *
+ * @return String
+ */
+ public String generateSwagger() {
+ String swaggerContent = null;
+
+ Swagger swagger = new Swagger().info(getInfo());
+
+ swagger.setPaths(getPaths());
+ swagger.setDefinitions(getDefinition());
+
+
+ swaggerContent = Json.pretty(swagger);
+ return swaggerContent;
+ }
+
+ private Info getInfo() {
+ Info info = new Info();
+ Contact contact = new Contact();
+ contact.setName(serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_AUTHOR));
+ info.setContact(contact);
+ info.setTitle(serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_NAME));
+ info.setDescription(serviceTemplate.getDescription());
+ info.setVersion(serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_VERSION));
+ return info;
+ }
+
+ private Map<String, Path> getPaths() {
+ Map<String, Path> paths = new HashMap<>();
+ Path path = new Path();
+ Operation post = new Operation();
+ post.setOperationId("configure");
+ post.setConsumes(Arrays.asList("application/json", "application/xml"));
+ post.setProduces(Arrays.asList("application/json", "application/xml"));
+ List<Parameter> parameters = new ArrayList<>();
+ Parameter in = new BodyParameter().schema(new RefModel("#/definitions/inputs"));
+ in.setRequired(true);
+ in.setName("inputs");
+ parameters.add(in);
+ post.setParameters(parameters);
+
+ Map<String, Response> responses = new HashMap<>();
+ Response response = new Response().description("Success");
+ responses.put("200", response);
+
+ Response failureResponse = new Response().description("Failure");
+ responses.put("400", failureResponse);
+ post.setResponses(responses);
+
+ path.setPost(post);
+ paths.put("/operations/config-selfservice-api:configure", path);
+ return paths;
+ }
+
+ private Map<String, Model> getDefinition() {
+ Map<String, Model> models = new HashMap<>();
+
+ ModelImpl inputmodel = new ModelImpl();
+ inputmodel.setTitle("inputs");
+ serviceTemplate.getTopologyTemplate().getInputs().forEach((propertyName, property) -> {
+ Property defProperty = getPropery(propertyName, property);
+ inputmodel.property(propertyName, defProperty);
+ });
+ models.put("inputs", inputmodel);
+
+ if (MapUtils.isNotEmpty(serviceTemplate.getDataTypes())) {
+ serviceTemplate.getDataTypes().forEach((name, dataType) -> {
+ ModelImpl model = new ModelImpl();
+ model.setDescription(dataType.getDescription());
+ // model.setType("object");
+ if (dataType != null && MapUtils.isNotEmpty(dataType.getProperties())) {
+
+ dataType.getProperties().forEach((propertyName, property) -> {
+ Property defProperty = getPropery(propertyName, property);
+ model.addProperty(propertyName, defProperty);
+ });
+ }
+ models.put(name, model);
+ });
+ }
+ return models;
+
+ }
+
+ private Property getPropery(String name, PropertyDefinition propertyDefinition) {
+ Property defProperty = null;
+
+ if (BluePrintTypes.validPrimitiveTypes().contains(propertyDefinition.getType())) {
+ if (BluePrintConstants.DATA_TYPE_BOOLEAN.equals(propertyDefinition.getType())) {
+ defProperty = new BooleanProperty();
+ } else if (BluePrintConstants.DATA_TYPE_INTEGER.equals(propertyDefinition.getType())) {
+ StringProperty stringProperty = new StringProperty();
+ stringProperty.setType("integer");
+ defProperty = stringProperty;
+ } else if (BluePrintConstants.DATA_TYPE_FLOAT.equals(propertyDefinition.getType())) {
+ StringProperty stringProperty = new StringProperty();
+ stringProperty.setFormat("float");
+ defProperty = stringProperty;
+ } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP.equals(propertyDefinition.getType())) {
+ DateTimeProperty dateTimeProperty = new DateTimeProperty();
+ dateTimeProperty.setFormat("date-time");
+ defProperty = dateTimeProperty;
+ } else {
+ defProperty = new StringProperty();
+ }
+ } else if (BluePrintTypes.validCollectionTypes().contains(propertyDefinition.getType())) {
+ ArrayProperty arrayProperty = new ArrayProperty();
+ if (propertyDefinition.getEntrySchema() != null) {
+ String entrySchema = propertyDefinition.getEntrySchema().getType();
+ if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema)) {
+ Property innerType = new RefProperty("#/definitions/" + entrySchema);
+ arrayProperty.setItems(innerType);
+ } else {
+ Property innerType = new StringProperty();
+ arrayProperty.setItems(innerType);
+ }
+ defProperty = arrayProperty;
+ }
+
+ } else {
+ defProperty = new RefProperty("#/definitions/" + propertyDefinition.getType());
+ }
+ defProperty.setName(name);
+ if (propertyDefinition.getDefaultValue() != null) {
+ defProperty.setDefault(String.valueOf(propertyDefinition.getDefaultValue()));
+ }
+
+ defProperty.setRequired(BooleanUtils.isTrue(propertyDefinition.getRequired()));
+ defProperty.setDescription(propertyDefinition.getDescription());
+ return defProperty;
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java
new file mode 100644
index 000000000..224960fa5
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java
@@ -0,0 +1,291 @@
+/*
+ * 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.service.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonManagedReference;
+import org.hibernate.annotations.Proxy;
+import org.springframework.data.annotation.LastModifiedDate;
+import org.springframework.data.jpa.domain.support.AuditingEntityListener;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * ConfigModel.java Purpose: Provide Configuration Generator ConfigModel Entity
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@EntityListeners({AuditingEntityListener.class})
+@Entity
+@Table(name = "CONFIG_MODEL")
+@Proxy(lazy=false)
+public class ConfigModel implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "config_model_id")
+ private Long id;
+
+ @Column(name = "service_uuid")
+ private String serviceUUID;
+
+ @Column(name = "distribution_id")
+ private String distributionId;
+
+ @Column(name = "service_name")
+ private String serviceName;
+
+ @Column(name = "service_description")
+ private String serviceDescription;
+
+ @Column(name = "resource_uuid")
+ private String resourceUUID;
+
+ @Column(name = "resource_instance_name")
+ private String resourceInstanceName;
+
+ @Column(name = "resource_name")
+ private String resourceName;
+
+ @Column(name = "resource_version")
+ private String resourceVersion;
+
+ @Column(name = "resource_type")
+ private String resourceType;
+
+ @Column(name = "artifact_uuid")
+ private String artifactUUId;
+
+ @Column(name = "artifact_type")
+ private String artifactType;
+
+ @NotNull
+ @Column(name = "artifact_version")
+ private String artifactVersion;
+
+ @Lob
+ @Column(name = "artifact_description")
+ private String artifactDescription;
+
+ @Column(name = "internal_version")
+ private Integer internalVersion;
+
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")
+ @LastModifiedDate
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "creation_date")
+ private Date createdDate = new Date();
+
+ @NotNull
+ @Column(name = "artifact_name")
+ private String artifactName;
+
+ @NotNull
+ @Column(name = "published")
+ private String published;
+
+ @NotNull
+ @Column(name = "updated_by")
+ private String updatedBy;
+
+ @NotNull
+ @Lob
+ @Column(name = "tags")
+ private String tags;
+
+
+ @OneToMany(mappedBy = "configModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = CascadeType.ALL)
+ @Column(nullable = true)
+ @JsonManagedReference
+ private List<ConfigModelContent> configModelContents = new ArrayList<>();
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getServiceUUID() {
+ return serviceUUID;
+ }
+
+ public void setServiceUUID(String serviceUUID) {
+ this.serviceUUID = serviceUUID;
+ }
+
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setDistributionId(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getServiceDescription() {
+ return serviceDescription;
+ }
+
+ public void setServiceDescription(String serviceDescription) {
+ this.serviceDescription = serviceDescription;
+ }
+
+ public String getResourceUUID() {
+ return resourceUUID;
+ }
+
+ public void setResourceUUID(String resourceUUID) {
+ this.resourceUUID = resourceUUID;
+ }
+
+ public String getResourceInstanceName() {
+ return resourceInstanceName;
+ }
+
+ public void setResourceInstanceName(String resourceInstanceName) {
+ this.resourceInstanceName = resourceInstanceName;
+ }
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public String getArtifactUUId() {
+ return artifactUUId;
+ }
+
+ public void setArtifactUUId(String artifactUUId) {
+ this.artifactUUId = artifactUUId;
+ }
+
+ public String getArtifactType() {
+ return artifactType;
+ }
+
+ public void setArtifactType(String artifactType) {
+ this.artifactType = artifactType;
+ }
+
+ public String getArtifactVersion() {
+ return artifactVersion;
+ }
+
+ public void setArtifactVersion(String artifactVersion) {
+ this.artifactVersion = artifactVersion;
+ }
+
+ public String getArtifactDescription() {
+ return artifactDescription;
+ }
+
+ public void setArtifactDescription(String artifactDescription) {
+ this.artifactDescription = artifactDescription;
+ }
+
+ public Integer getInternalVersion() {
+ return internalVersion;
+ }
+
+ public void setInternalVersion(Integer internalVersion) {
+ this.internalVersion = internalVersion;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getArtifactName() {
+ return artifactName;
+ }
+
+ public void setArtifactName(String artifactName) {
+ this.artifactName = artifactName;
+ }
+
+ public String getPublished() {
+ return published;
+ }
+
+ public void setPublished(String published) {
+ this.published = published;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+ public String getTags() {
+ return tags;
+ }
+
+ public void setTags(String tags) {
+ this.tags = tags;
+ }
+
+ public List<ConfigModelContent> getConfigModelContents() {
+ return configModelContents;
+ }
+
+ public void setConfigModelContents(List<ConfigModelContent> configModelContents) {
+ this.configModelContents = configModelContents;
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java
new file mode 100644
index 000000000..f7bd554df
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java
@@ -0,0 +1,175 @@
+/*
+ * 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.service.domain;
+
+import com.fasterxml.jackson.annotation.JsonBackReference;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.data.annotation.LastModifiedDate;
+import org.springframework.data.jpa.domain.support.AuditingEntityListener;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * DataDictionary.java Purpose: Provide Configuration Generator DataDictionary Entity
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@EntityListeners({AuditingEntityListener.class})
+@Entity
+@Table(name = "CONFIG_MODEL_CONTENT")
+public class ConfigModelContent {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "config_model_content_id")
+ private Long id;
+
+ @NotNull
+ @Column(name = "name")
+ private String name;
+
+ @NotNull
+ @Column(name = "content_type")
+ private String contentType;
+
+
+ @ManyToOne
+ @JoinColumn(name = "config_model_id")
+ @JsonBackReference
+ private ConfigModel configModel;
+
+ @Lob
+ @Column(name = "description")
+ private String description;
+
+ @NotNull
+ @Lob
+ @Column(name = "content")
+ private String content;
+
+
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")
+ @LastModifiedDate
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "updated_date")
+ private Date creationDate;
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("[");
+ builder.append("id = " + id);
+ builder.append(", name = " + name);
+ builder.append(", contentType = " + contentType);
+ builder.append("]");
+ return builder.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof ConfigModelContent)) {
+ return false;
+ }
+ ConfigModelContent configModelContent = (ConfigModelContent) o;
+ return Objects.equals(id, configModelContent.id) && Objects.equals(name, configModelContent.name)
+ && Objects.equals(contentType, configModelContent.contentType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, name, contentType);
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ public String getContentType() {
+ return contentType;
+ }
+
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+
+ public ConfigModel getConfigModel() {
+ return configModel;
+ }
+
+
+ public void setConfigModel(ConfigModel configModel) {
+ this.configModel = configModel;
+ }
+
+
+ public String getDescription() {
+ return description;
+ }
+
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+
+ public String getContent() {
+ return content;
+ }
+
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+
+ public void setCreationDate(Date creationDate) {
+ this.creationDate = creationDate;
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java
new file mode 100644
index 000000000..2e9018837
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java
@@ -0,0 +1,171 @@
+/*
+ * 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.service.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.data.annotation.LastModifiedDate;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+
+@Entity
+@Table(name = "CONFIG_MODEL")
+public class ConfigModelSearch implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "config_model_id")
+ private Long id;
+
+ @Column(name = "artifact_uuid")
+ private String artifactUUId;
+
+ @Column(name = "artifact_type")
+ private String artifactType;
+
+ @NotNull
+ @Column(name = "artifact_version")
+ private String artifactVersion;
+
+ @Lob
+ @Column(name = "artifact_description")
+ private String artifactDescription;
+
+ @Column(name = "internal_version")
+ private Integer internalVersion;
+
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")
+ @LastModifiedDate
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "creation_date")
+ private Date createdDate = new Date();
+
+ @NotNull
+ @Column(name = "artifact_name")
+ private String artifactName;
+
+ @NotNull
+ @Column(name = "published")
+ private String published;
+
+ @NotNull
+ @Column(name = "updated_by")
+ private String updatedBy;
+
+ @NotNull
+ @Lob
+ @Column(name = "tags")
+ private String tags;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getArtifactUUId() {
+ return artifactUUId;
+ }
+
+ public void setArtifactUUId(String artifactUUId) {
+ this.artifactUUId = artifactUUId;
+ }
+
+ public String getArtifactType() {
+ return artifactType;
+ }
+
+ public void setArtifactType(String artifactType) {
+ this.artifactType = artifactType;
+ }
+
+ public String getArtifactVersion() {
+ return artifactVersion;
+ }
+
+ public void setArtifactVersion(String artifactVersion) {
+ this.artifactVersion = artifactVersion;
+ }
+
+ public String getArtifactDescription() {
+ return artifactDescription;
+ }
+
+ public void setArtifactDescription(String artifactDescription) {
+ this.artifactDescription = artifactDescription;
+ }
+
+ public Integer getInternalVersion() {
+ return internalVersion;
+ }
+
+ public void setInternalVersion(Integer internalVersion) {
+ this.internalVersion = internalVersion;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getArtifactName() {
+ return artifactName;
+ }
+
+ public void setArtifactName(String artifactName) {
+ this.artifactName = artifactName;
+ }
+
+ public String getPublished() {
+ return published;
+ }
+
+ public void setPublished(String published) {
+ this.published = published;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+ public String getTags() {
+ return tags;
+ }
+
+ public void setTags(String tags) {
+ this.tags = tags;
+ }
+
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
new file mode 100644
index 000000000..ed6340a65
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
@@ -0,0 +1,170 @@
+/*
+ * 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.service.domain;
+
+import org.springframework.data.annotation.LastModifiedDate;
+import org.springframework.data.jpa.domain.support.AuditingEntityListener;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * AsdcReference.java Purpose: Provide Configuration Generator AsdcReference Entity
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@EntityListeners({AuditingEntityListener.class})
+@Entity
+@Table(name = "MODEL_TYPE")
+public class ModelType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @NotNull
+ @Column(name = "model_name", nullable = false)
+ private String modelName;
+
+ @NotNull
+ @Column(name = "derived_from")
+ private String derivedFrom;
+
+ @NotNull
+ @Column(name = "definition_type")
+ private String definitionType;
+
+ @NotNull
+ @Lob
+ @Column(name = "definition")
+ private String definition;
+
+ @NotNull
+ @Lob
+ @Column(name = "description")
+ private String description;
+
+ @NotNull
+ @Column(name = "version")
+ private String version;
+
+ @NotNull
+ @Lob
+ @Column(name = "tags")
+ private String tags;
+
+ // @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")
+ @LastModifiedDate
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "creation_date")
+ private Date creationDate;
+
+ @NotNull
+ @Column(name = "updated_by")
+ private String updatedBy;
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder("[");
+ buffer.append(", modelName = " + modelName);
+ buffer.append(", derivedFrom = " + derivedFrom);
+ buffer.append(", definitionType = " + definitionType);
+ buffer.append(", description = " + description);
+ buffer.append(", creationDate = " + creationDate);
+ buffer.append(", version = " + version);
+ buffer.append(", updatedBy = " + updatedBy);
+ buffer.append(", tags = " + tags);
+ buffer.append("]");
+ return buffer.toString();
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getDerivedFrom() {
+ return derivedFrom;
+ }
+
+ public void setDerivedFrom(String derivedFrom) {
+ this.derivedFrom = derivedFrom;
+ }
+
+ public String getDefinitionType() {
+ return definitionType;
+ }
+
+ public void setDefinitionType(String definitionType) {
+ this.definitionType = definitionType;
+ }
+
+ public String getDefinition() {
+ return definition;
+ }
+
+ public void setDefinition(String definition) {
+ this.definition = definition;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getTags() {
+ return tags;
+ }
+
+ public void setTags(String tags) {
+ this.tags = tags;
+ }
+
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+ public void setCreationDate(Date creationDate) {
+ this.creationDate = creationDate;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
new file mode 100644
index 000000000..adb018841
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
@@ -0,0 +1,207 @@
+/*
+ * 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.service.domain;
+
+import org.springframework.data.annotation.LastModifiedDate;
+import org.springframework.data.jpa.domain.support.AuditingEntityListener;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * DataDictionary.java Purpose: Provide Configuration Generator DataDictionary Entity
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@EntityListeners({AuditingEntityListener.class})
+@Entity
+@Table(name = "RESOURCE_DICTIONARY")
+public class ResourceDictionary implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @NotNull
+ @Column(name = "name")
+ private String name;
+
+ @NotNull
+ @Column(name = "resource_path")
+ private String resourcePath;
+
+ @NotNull
+ @Column(name = "resource_type")
+ private String resourceType;
+
+ @NotNull
+ @Column(name = "data_type")
+ private String dataType;
+
+ @Column(name = "entry_schema")
+ private String entrySchema;
+
+ @Lob
+ @Column(name = "valid_values")
+ private String validValues;
+
+ @Lob
+ @Column(name = "sample_value")
+ private String sampleValue;
+
+ @NotNull
+ @Lob
+ @Column(name = "definition")
+ private String definition;
+
+ @NotNull
+ @Lob
+ @Column(name = "description")
+ private String description;
+
+ @NotNull
+ @Lob
+ @Column(name = "tags")
+ private String tags;
+
+ @LastModifiedDate
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "creation_date")
+ private Date creationDate;
+
+ @NotNull
+ @Column(name = "updated_by")
+ private String updatedBy;
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder("[");
+ buffer.append(", name = " + name);
+ buffer.append(", resourcePath = " + resourcePath);
+ buffer.append(", resourceType = " + resourceType);
+ buffer.append(", dataType = " + dataType);
+ buffer.append(", entrySchema = " + entrySchema);
+ buffer.append(", validValues = " + validValues);
+ buffer.append(", definition =" + definition);
+ buffer.append(", description = " + description);
+ buffer.append(", updatedBy = " + updatedBy);
+ buffer.append(", tags = " + tags);
+ buffer.append(", creationDate = " + creationDate);
+ buffer.append("]");
+ return buffer.toString();
+ }
+
+ public String getResourcePath() {
+ return resourcePath;
+ }
+
+ public void setResourcePath(String resourcePath) {
+ this.resourcePath = resourcePath;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getEntrySchema() {
+ return entrySchema;
+ }
+
+ public void setEntrySchema(String entrySchema) {
+ this.entrySchema = entrySchema;
+ }
+
+ public String getValidValues() {
+ return validValues;
+ }
+
+ public void setValidValues(String validValues) {
+ this.validValues = validValues;
+ }
+
+ public String getSampleValue() {
+ return sampleValue;
+ }
+
+ public void setSampleValue(String sampleValue) {
+ this.sampleValue = sampleValue;
+ }
+
+ public String getDefinition() {
+ return definition;
+ }
+
+ public void setDefinition(String definition) {
+ this.definition = definition;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getTags() {
+ return tags;
+ }
+
+ public void setTags(String tags) {
+ this.tags = tags;
+ }
+
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+ public void setCreationDate(Date creationDate) {
+ this.creationDate = creationDate;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/model/AutoMapResponse.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/model/AutoMapResponse.java
new file mode 100644
index 000000000..2250828ac
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/model/AutoMapResponse.java
@@ -0,0 +1,53 @@
+/*
+ * 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.service.model;
+
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+
+import java.util.List;
+
+/**
+ * ArtifactRequest.java Purpose: Provide Configuration Generator ArtifactRequest Model
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+public class AutoMapResponse {
+
+ private List<ResourceAssignment> resourceAssignments;
+ private List<ResourceDictionary> dataDictionaries;
+
+ public List<ResourceAssignment> getResourceAssignments() {
+ return resourceAssignments;
+ }
+
+ public void setResourceAssignments(List<ResourceAssignment> resourceAssignments) {
+ this.resourceAssignments = resourceAssignments;
+ }
+
+ public List<ResourceDictionary> getDataDictionaries() {
+ return dataDictionaries;
+ }
+
+ public void setDataDictionaries(List<ResourceDictionary> dataDictionaries) {
+ this.dataDictionaries = dataDictionaries;
+ }
+
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelContentRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelContentRepository.java
new file mode 100644
index 000000000..ad2584a8e
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelContentRepository.java
@@ -0,0 +1,95 @@
+/*
+ * 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.service.repository;
+
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * ConfigModelContentRepository.java Purpose: Provide ConfigModelContentRepository of Repository
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Repository
+public interface ConfigModelContentRepository extends JpaRepository<ConfigModelContent, Long> {
+
+ /**
+ * This is a findById method
+ *
+ * @param id
+ * @return Optional<AsdcArtifacts>
+ */
+ Optional<ConfigModelContent> findById(Long id);
+
+ /**
+ * This is a findTopByConfigModelAndContentType method
+ *
+ * @param configModel
+ * @param contentType
+ * @return Optional<ConfigModelContent>
+ */
+ Optional<ConfigModelContent> findTopByConfigModelAndContentType(ConfigModel configModel, String contentType);
+
+ /**
+ * This is a findByConfigModelAndContentType method
+ *
+ * @param configModel
+ * @param contentType
+ * @return Optional<ConfigModelContent>
+ */
+ List<ConfigModelContent> findByConfigModelAndContentType(ConfigModel configModel, String contentType);
+
+ /**
+ * This is a findByConfigModel method
+ *
+ * @param configModel
+ * @return Optional<ConfigModelContent>
+ */
+ List<ConfigModelContent> findByConfigModel(ConfigModel configModel);
+
+ /**
+ * This is a findByConfigModelAndContentTypeAndName method
+ *
+ * @param configModel
+ * @param contentType
+ * @param name
+ * @return Optional<ConfigModelContent>
+ */
+ Optional<ConfigModelContent> findByConfigModelAndContentTypeAndName(ConfigModel configModel,
+ String contentType, String name);
+
+ /**
+ * This is a deleteByMdeleteByConfigModelodelName method
+ *
+ * @param configModel
+ */
+ void deleteByConfigModel(ConfigModel configModel);
+
+ /**
+ * This is a deleteById method
+ *
+ * @param id
+ */
+ void deleteById(Long id);
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelRepository.java
new file mode 100644
index 000000000..4822ee971
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelRepository.java
@@ -0,0 +1,90 @@
+/*
+ * 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.service.repository;
+
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * AsdcArtifactsRepository.java Purpose: Provide Configuration Generator AsdcArtifactsRepository
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Repository
+public interface ConfigModelRepository extends JpaRepository<ConfigModel, Long> {
+ /**
+ * This is a findById method
+ *
+ * @param id
+ * @return Optional<AsdcArtifacts>
+ */
+ Optional<ConfigModel> findById(Long id);
+
+ /**
+ * This is a findByArtifactNameAndArtifactVersion method
+ *
+ * @param artifactName
+ * @param artifactVersion
+ * @return Optional<AsdcArtifacts>
+ */
+ Optional<ConfigModel> findByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);
+
+ /**
+ * This is a findTopByArtifactNameOrderByArtifactIdDesc method
+ *
+ * @param artifactName
+ * @return Optional<AsdcArtifacts>
+ */
+ Optional<ConfigModel> findTopByArtifactNameOrderByArtifactVersionDesc(String artifactName);
+
+ /**
+ * This is a findTopByArtifactName method
+ *
+ * @param artifactName
+ * @return Optional<AsdcArtifacts>
+ */
+ List<ConfigModel> findTopByArtifactName(String artifactName);
+
+ /**
+ * This is a findByTagsContainingIgnoreCase method
+ *
+ * @param tags
+ * @return Optional<ModelType>
+ */
+ List<ConfigModel> findByTagsContainingIgnoreCase(String tags);
+
+ /**
+ * This is a deleteByArtifactNameAndArtifactVersion method
+ *
+ * @param artifactName
+ * @param artifactVersion
+ */
+ void deleteByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);
+
+ /**
+ * This is a deleteById method
+ *
+ * @param id
+ */
+ void deleteById(Long id);
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelSearchRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelSearchRepository.java
new file mode 100644
index 000000000..bafc3aa89
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelSearchRepository.java
@@ -0,0 +1,43 @@
+/*
+ * 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.service.repository;
+
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelSearch;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * ConfigModelSearchRepository.java Purpose: Provide Configuration Generator AsdcArtifactsRepository
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Repository
+public interface ConfigModelSearchRepository extends JpaRepository<ConfigModelSearch, Long> {
+
+
+ /**
+ * This is a findByTagsContainingIgnoreCase method
+ *
+ * @param tags
+ * @return Optional<ModelType>
+ */
+ List<ConfigModel> findByTagsContainingIgnoreCase(String tags);
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.java
new file mode 100644
index 000000000..51ae752f9
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.java
@@ -0,0 +1,98 @@
+/*
+ * 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.service.repository;
+
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Optional;
+
+
+/**
+ * ModelTypeRepository.java Purpose: Provide Configuration Generator ModelTypeRepository
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Repository
+public interface ModelTypeRepository extends JpaRepository<ModelType, String> {
+
+
+ /**
+ * This is a findByModelName method
+ *
+ * @param modelName
+ * @return Optional<ModelType>
+ */
+ Optional<ModelType> findByModelName(String modelName);
+
+ /**
+ * This is a findByDerivedFrom method
+ *
+ * @param derivedFrom
+ * @return List<ModelType>
+ */
+ List<ModelType> findByDerivedFrom(String derivedFrom);
+
+
+ /**
+ * This is a findByDerivedFromIn method
+ *
+ * @param derivedFroms
+ * @return List<ModelType>
+ */
+ List<ModelType> findByDerivedFromIn(List<String> derivedFroms);
+
+ /**
+ * This is a findByDefinitionType method
+ *
+ * @param definitionType
+ * @return List<ModelType>
+ */
+ List<ModelType> findByDefinitionType(String definitionType);
+
+ /**
+ * This is a findByDefinitionTypeIn method
+ *
+ * @param definitionTypes
+ * @return List<ModelType>
+ */
+ List<ModelType> findByDefinitionTypeIn(List<String> definitionTypes);
+
+
+ /**
+ * This is a findByTagsContainingIgnoreCase method
+ *
+ * @param tags
+ * @return Optional<ModelType>
+ */
+ List<ModelType> findByTagsContainingIgnoreCase(String tags);
+
+
+ /**
+ * This is a deleteByModelName method
+ *
+ * @param modelName
+ * @return Optional<ModelType>
+ */
+ void deleteByModelName(String modelName);
+
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryRepository.java
new file mode 100644
index 000000000..279dcd1c9
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryRepository.java
@@ -0,0 +1,68 @@
+/*
+ * 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.service.repository;
+
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * ResourceMappingRepository.java Purpose: Provide Configuration Generator ResourceMappingRepository
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Repository
+public interface ResourceDictionaryRepository extends JpaRepository<ResourceDictionary, String> {
+
+
+ /**
+ * This is a findByName method
+ *
+ * @param name
+ * @return Optional<ResourceMapping>
+ */
+ Optional<ResourceDictionary> findByName(String name);
+
+ /**
+ * This is a findByNameIn method
+ *
+ * @param names
+ * @return Optional<ResourceMapping>
+ */
+ List<ResourceDictionary> findByNameIn(List<String> names);
+
+ /**
+ * This is a findByTagsContainingIgnoreCase method
+ *
+ * @param tags
+ * @return Optional<ModelType>
+ */
+ List<ResourceDictionary> findByTagsContainingIgnoreCase(String tags);
+
+ /**
+ * This is a deleteByName method
+ *
+ * @param name
+ */
+ void deleteByName(String name);
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java
new file mode 100644
index 000000000..86c89bf90
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.service.rs;
+
+import io.swagger.annotations.*;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+
+/**
+ * ConfigModelRest.java Purpose: Rest service controller for ConfigModelRest Management
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Api
+@Path("/service")
+@Produces({MediaType.APPLICATION_JSON})
+public interface ConfigModelRest {
+
+ /**
+ * This is a getConfigModel rest service
+ *
+ * @param id
+ * @return ConfigModel
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/configmodel/{id}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ @RequestMapping(value = "/configmodel/{id}", method = RequestMethod.GET)
+ @ResponseBody ConfigModel getConfigModel(@ApiParam(required = true) @PathParam("id") Long id)
+ throws BluePrintException;
+
+
+ /**
+ * This is a saveConfigModel rest service
+ *
+ * @param configModel
+ * @return ConfigModel
+ * @throws BluePrintException
+ */
+ @POST
+ @Path("/configmodel")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to get Model Type by Tags", response = ServiceTemplate.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ConfigModel saveConfigModel(@ApiParam(required = true) ConfigModel configModel)
+ throws BluePrintException;
+
+ /**
+ * This is a deleteConfigModel rest service
+ *
+ * @param id
+ * @throws BluePrintException
+ */
+ @DELETE
+ @Path("/configmodel/{id}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to delete ConfigModel.")
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ void deleteConfigModel(@ApiParam(required = true) @PathParam("id") Long id) throws BluePrintException;
+
+ /**
+ * This is a getInitialConfigModel rest service
+ *
+ * @param name
+ * @return ConfigModel
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/configmodelinitial/{name}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to create default Service Template", response = ConfigModel.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ConfigModel getInitialConfigModel(@ApiParam(required = true) @PathParam("name") String name)
+ throws BluePrintException;
+
+ /**
+ * This is a getCloneConfigModel rest service
+ *
+ * @param id
+ * @return ConfigModel
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/configmodelclone/{id}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to create default Service Template", response = ConfigModel.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ConfigModel getCloneConfigModel(@ApiParam(required = true) @PathParam("id") Long id)
+ throws BluePrintException;
+
+ /**
+ * This is a publishConfigModel rest service
+ *
+ * @param id
+ * @return ServiceTemplate
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/configmodelpublish/{id}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to get Model Type by Tags", response = ConfigModel.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ConfigModel publishConfigModel(@ApiParam(required = true) @PathParam("id") Long id)
+ throws BluePrintException;
+
+ /**
+ * This is a getConfigModelByNameAndVersion rest service
+ *
+ * @param name
+ * @param version
+ * @return ConfigModel
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/configmodelbyname/{name}/version/{version}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ConfigModel getConfigModelByNameAndVersion(@ApiParam(required = true) @PathParam("name") String name,
+ @ApiParam(required = true) @PathParam("version") String version) throws BluePrintException;
+
+ /**
+ * This is a searchServiceModels rest service
+ *
+ * @param tags
+ * @return List<ConfigModel>
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/configmodelsearch/{tags}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ List<ConfigModel> searchConfigModels(@ApiParam(required = true) @PathParam("tags") String tags)
+ throws BluePrintException;
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java
new file mode 100644
index 000000000..a9abcd5ff
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java
@@ -0,0 +1,116 @@
+/*
+ * 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.service.rs;
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.ConfigModelService;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * {@inheritDoc}
+ */
+@Service
+public class ConfigModelRestImpl implements ConfigModelRest {
+
+ private ConfigModelService configModelService;
+
+ /**
+ * This is a ConfigModelRestImpl constructor.
+ *
+ * @param configModelService Config Model Service
+ */
+ public ConfigModelRestImpl(ConfigModelService configModelService) {
+ this.configModelService = configModelService;
+
+ }
+
+ @Override
+ public ConfigModel getInitialConfigModel(String name) throws BluePrintException {
+ try {
+ return this.configModelService.getInitialConfigModel(name);
+ } catch (Exception e) {
+ throw new BluePrintException(2000, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public ConfigModel saveConfigModel(ConfigModel configModel) throws BluePrintException {
+ try {
+ return this.configModelService.saveConfigModel(configModel);
+ } catch (Exception e) {
+ throw new BluePrintException(2200, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void deleteConfigModel(Long id) throws BluePrintException {
+ try {
+ this.configModelService.deleteConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(4000, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public ConfigModel publishConfigModel(Long id) throws BluePrintException {
+ try {
+ return this.configModelService.publishConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(2500, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public ConfigModel getConfigModel(Long id) throws BluePrintException {
+ try {
+ return this.configModelService.getConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(2001, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public ConfigModel getConfigModelByNameAndVersion(String name, String version) throws BluePrintException {
+ try {
+ return this.configModelService.getConfigModelByNameAndVersion(name, version);
+ } catch (Exception e) {
+ throw new BluePrintException(2002, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public List<ConfigModel> searchConfigModels(String tags) throws BluePrintException {
+ try {
+ return this.configModelService.searchConfigModels(tags);
+ } catch (Exception e) {
+ throw new BluePrintException(2003, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public ConfigModel getCloneConfigModel(Long id) throws BluePrintException {
+ try {
+ return this.configModelService.getCloneConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(2004, e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java
new file mode 100644
index 000000000..59b730309
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.service.rs;
+
+import io.swagger.annotations.*;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+
+/**
+ * ModelTypeRest.java Purpose: Rest service controller for Artifact Handling
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Api
+@Path("/service")
+@Produces({MediaType.APPLICATION_JSON})
+public interface ModelTypeRest {
+
+ /**
+ * This is a getModelTypeByName rest service
+ *
+ * @param name
+ * @return ModelType
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/modeltype/{name}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to get Model Type by id", response = ModelType.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ModelType getModelTypeByName(@ApiParam(required = true) @PathParam("name") String name)
+ throws BluePrintException;
+
+ /**
+ * This is a saveModelType rest service
+ *
+ * @param modelType
+ * @return ModelType
+ * @throws BluePrintException
+ */
+
+ @POST
+ @Path("/modeltype")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to Save Model Type", response = ModelType.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ModelType saveModelType(@ApiParam(required = true) ModelType modelType) throws BluePrintException;
+
+ /**
+ * This is a deleteModelType rest service
+ *
+ * @param name
+ * @throws BluePrintException
+ */
+ @DELETE
+ @Path("/modeltype/{name}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to delete Model Type")
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ void deleteModelTypeByName(@ApiParam(required = true) @PathParam("name") String name)
+ throws BluePrintException;
+
+ /**
+ * This is a searchModelType rest service
+ *
+ * @param tags
+ * @return List<ModelType>
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/modeltypesearch/{tags}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to get Model Type by tags", response = ModelType.class,
+ responseContainer = "List")
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ List<ModelType> searchModelTypes(@ApiParam(required = true) @PathParam("tags") String tags)
+ throws BluePrintException;
+
+ /**
+ * This is a getModelTypeByDefinitionType rest service
+ *
+ * @param definitionType
+ * @return List<ModelType>
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/modeltypebydefinition/{definitionType}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to get Model Type by tags", response = ModelType.class,
+ responseContainer = "List")
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ List<ModelType> getModelTypeByDefinitionType(
+ @ApiParam(required = true) @PathParam("definitionType") String definitionType)
+ throws BluePrintException;
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java
new file mode 100644
index 000000000..6fbc69699
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java
@@ -0,0 +1,87 @@
+/*
+ * 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.service.rs;
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * {@inheritDoc}
+ */
+@Service
+public class ModelTypeRestImpl implements ModelTypeRest {
+
+ private ModelTypeService modelTypeService;
+
+ /**
+ * This is a ModelTypeResourceImpl, used to save and get the model types stored in database
+ *
+ * @param modelTypeService Model Type Service
+ */
+ public ModelTypeRestImpl(ModelTypeService modelTypeService) {
+ this.modelTypeService = modelTypeService;
+ }
+
+ @Override
+ public ModelType getModelTypeByName(String modelName) throws BluePrintException {
+ try {
+ return modelTypeService.getModelTypeByName(modelName);
+ } catch (Exception e) {
+ throw new BluePrintException(1000, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public List<ModelType> searchModelTypes(String tags) throws BluePrintException {
+ try {
+ return modelTypeService.searchModelTypes(tags);
+ } catch (Exception e) {
+ throw new BluePrintException(1001, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public List<ModelType> getModelTypeByDefinitionType(String definitionType) throws BluePrintException {
+ try {
+ return modelTypeService.getModelTypeByDefinitionType(definitionType);
+ } catch (Exception e) {
+ throw new BluePrintException(1002, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public ModelType saveModelType(ModelType modelType) throws BluePrintException {
+ try {
+ return modelTypeService.saveModel(modelType);
+ } catch (Exception e) {
+ throw new BluePrintException(1100, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void deleteModelTypeByName(String name) throws BluePrintException {
+ try {
+ modelTypeService.deleteByModelName(name);
+ } catch (Exception e) {
+ throw new BluePrintException(1400, e.getMessage(), e);
+ }
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java
new file mode 100644
index 000000000..5bc983363
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.service.rs;
+
+import io.swagger.annotations.*;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+
+/**
+ * ResourceDictionaryRest.java Purpose: Rest service controller for Artifact Handling
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Api
+@Path("/service")
+@Produces({MediaType.APPLICATION_JSON})
+
+public interface ResourceDictionaryRest {
+
+ /**
+ * This is a getDataDictionaryByPath rest service
+ *
+ * @param name
+ * @return ResourceDictionary
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/dictionary/{name}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to get Resource dictionary", response = ResourceDictionary.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ResourceDictionary getResourceDictionaryByName(@ApiParam(required = true) @PathParam("name") String name)
+ throws BluePrintException;
+
+ /**
+ * This is a saveDataDictionary rest service
+ *
+ * @param resourceMapping
+ * @return ResourceDictionary
+ * @throws BluePrintException
+ */
+
+ @POST
+ @Path("/dictionary")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to Save Resource dictionary Type", response = ResourceDictionary.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ResourceDictionary saveResourceDictionary(@ApiParam(required = true) ResourceDictionary resourceMapping)
+ throws BluePrintException;
+
+ /**
+ * This is a deleteDataDictionaryByName rest service
+ *
+ * @param name
+ * @throws BluePrintException
+ */
+ @DELETE
+ @Path("/dictionary/{name}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to delete ResourceDictionary Type")
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ void deleteResourceDictionaryByName(@ApiParam(required = true) @PathParam("name") String name)
+ throws BluePrintException;
+
+ /**
+ * This is a searchResourceDictionaryByTags rest service
+ *
+ * @param tags
+ * @return ResourceDictionary
+ * @throws BluePrintException
+ */
+ @GET
+ @Path("/dictionarysearch/{tags}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to search Resource dictionary by tags",
+ response = ResourceDictionary.class, responseContainer = "List")
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ List<ResourceDictionary> searchResourceDictionaryByTags(
+ @ApiParam(required = true) @PathParam("tags") String tags) throws BluePrintException;
+
+ /**
+ * This is a searchResourceDictionaryByNames rest service
+ *
+ * @param names
+ * @return List<ResourceDictionary>
+ * @throws BluePrintException
+ */
+ @POST
+ @Path("/dictionarybynames")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to get ResourceDictionary Type by names",
+ response = ResourceDictionary.class, responseContainer = "List")
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ List<ResourceDictionary> searchResourceDictionaryByNames(@ApiParam(required = true) List<String> names)
+ throws BluePrintException;
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java
new file mode 100644
index 000000000..e3448424d
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java
@@ -0,0 +1,91 @@
+/*
+ * 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.service.rs;
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * {@inheritDoc}
+ */
+@Service
+public class ResourceDictionaryRestImpl implements ResourceDictionaryRest {
+
+
+ private ResourceDictionaryService resourceDictionaryService;
+
+ /**
+ * This is a DataDictionaryRestImpl, used to save and get the Resource Mapping stored in database
+ *
+ * @param dataDictionaryService Data Dictionary Service
+ */
+ public ResourceDictionaryRestImpl(ResourceDictionaryService dataDictionaryService) {
+ this.resourceDictionaryService = dataDictionaryService;
+ }
+
+ @Override
+ public ResourceDictionary saveResourceDictionary(ResourceDictionary dataDictionary)
+ throws BluePrintException {
+ try {
+ return resourceDictionaryService.saveResourceDictionary(dataDictionary);
+ } catch (Exception e) {
+ throw new BluePrintException(4100, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void deleteResourceDictionaryByName(String name) throws BluePrintException {
+ try {
+ resourceDictionaryService.deleteResourceDictionary(name);
+ } catch (Exception e) {
+ throw new BluePrintException(4400, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public ResourceDictionary getResourceDictionaryByName(String resourcePath) throws BluePrintException {
+ try {
+ return resourceDictionaryService.getResourceDictionaryByName(resourcePath);
+ } catch (Exception e) {
+ throw new BluePrintException(4001, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public List<ResourceDictionary> searchResourceDictionaryByNames(List<String> names)
+ throws BluePrintException {
+ try {
+ return resourceDictionaryService.searchResourceDictionaryByNames(names);
+ } catch (Exception e) {
+ throw new BluePrintException(4002, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public List<ResourceDictionary> searchResourceDictionaryByTags(String tags) throws BluePrintException {
+ try {
+ return resourceDictionaryService.searchResourceDictionaryByTags(tags);
+ } catch (Exception e) {
+ throw new BluePrintException(4003, e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java
new file mode 100644
index 000000000..fcb8f3119
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java
@@ -0,0 +1,134 @@
+/*
+ * 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.service.rs;
+
+import io.swagger.annotations.*;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
+import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+
+
+/**
+ * ServiceTemplateRest.java Purpose: ServiceTemplateRest interface
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Api
+@Path("/service")
+@Produces({MediaType.APPLICATION_JSON})
+public interface ServiceTemplateRest {
+
+ /**
+ * This is a enrichServiceTemplate rest service
+ *
+ * @param serviceTemplate
+ * @return ServiceTemplate
+ * @throws BluePrintException
+ */
+ @POST
+ @Path("/servicetemplate/enrich")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to enrich service template", response = ServiceTemplate.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ServiceTemplate enrichServiceTemplate(@ApiParam(required = true) ServiceTemplate serviceTemplate)
+ throws BluePrintException;
+
+ /**
+ * This is a validateServiceTemplate rest service
+ *
+ * @param serviceTemplate
+ * @return ServiceTemplate
+ * @throws BluePrintException
+ */
+ @POST
+ @Path("/servicetemplate/validate")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to validate service template", response = ServiceTemplate.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ ServiceTemplate validateServiceTemplate(@ApiParam(required = true) ServiceTemplate serviceTemplate)
+ throws BluePrintException;
+
+ /**
+ * This is a generateResourceAssignments rest service
+ *
+ * @param templateContent
+ * @return List<ResourceAssignment>
+ * @throws BluePrintException
+ */
+ @POST
+ @Path("/resourceassignment/generate")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to auto map for the Resource Mapping",
+ response = ResourceAssignment.class, responseContainer = "List")
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ List<ResourceAssignment> generateResourceAssignments(
+ @ApiParam(required = true) ConfigModelContent templateContent) throws BluePrintException;
+
+ /**
+ * This is a autoMap rest service
+ *
+ * @param resourceAssignments
+ * @return AutoMapResponse
+ * @throws BluePrintException
+ */
+ @POST
+ @Path("/resourceassignment/automap")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to auto map for the Resource assignments",
+ response = AutoMapResponse.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ AutoMapResponse autoMap(@ApiParam(required = true) List<ResourceAssignment> resourceAssignments)
+ throws BluePrintException;
+
+ /**
+ * This is a validateResourceAssignments rest service
+ *
+ * @param resourceAssignments
+ * @return List<ResourceAssignment>
+ * @throws BluePrintException
+ */
+ @POST
+ @Path("/resourceassignment/validate")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Provides Rest service to validate Resource assignments", response = ResourceAssignment.class,
+ responseContainer = "List")
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ List<ResourceAssignment> validateResourceAssignments(
+ @ApiParam(required = true) List<ResourceAssignment> resourceAssignments) throws BluePrintException;
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java
new file mode 100644
index 000000000..6c49d5c65
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.rs;
+
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.service.ServiceTemplateService;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
+import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * {@inheritDoc}
+ */
+@Service
+public class ServiceTemplateRestImpl implements ServiceTemplateRest {
+
+ private ServiceTemplateService serviceTemplateService;
+
+ /**
+ * This is a ServiceTemplateRestImpl constructor
+ *
+ * @param serviceTemplateService Service Template Service
+ */
+ public ServiceTemplateRestImpl(ServiceTemplateService serviceTemplateService) {
+ this.serviceTemplateService = serviceTemplateService;
+ }
+
+ @Override
+ public ServiceTemplate enrichServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
+ try {
+ return serviceTemplateService.enrichServiceTemplate(serviceTemplate);
+ } catch (Exception e) {
+ throw new BluePrintException(3500, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
+ try {
+ return serviceTemplateService.validateServiceTemplate(serviceTemplate);
+ } catch (Exception e) {
+ throw new BluePrintException(3501, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public AutoMapResponse autoMap(List<ResourceAssignment> resourceAssignments) throws BluePrintException {
+ try {
+ return serviceTemplateService.autoMap(resourceAssignments);
+ } catch (Exception e) {
+ throw new BluePrintException(3502, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public List<ResourceAssignment> validateResourceAssignments(List<ResourceAssignment> resourceAssignments)
+ throws BluePrintException {
+ try {
+ return serviceTemplateService.validateResourceAssignments(resourceAssignments);
+ } catch (Exception e) {
+ throw new BluePrintException(3503, e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public List<ResourceAssignment> generateResourceAssignments(ConfigModelContent templateContent)
+ throws BluePrintException {
+ try {
+ return serviceTemplateService.generateResourceAssignments(templateContent);
+ } catch (Exception e) {
+ throw new BluePrintException(3504, e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtils.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtils.java
new file mode 100644
index 000000000..e31b04d16
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtils.java
@@ -0,0 +1,124 @@
+/*
+ * 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.service.utils;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.filefilter.DirectoryFileFilter;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ToscaMetaData;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class ConfigModelUtils {
+
+ private ConfigModelUtils(){
+
+ }
+ private static Logger log = LoggerFactory.getLogger(ConfigModelUtils.class);
+
+ public static ConfigModel getConfigModel(String blueprintPath) throws Exception {
+ Preconditions.checkArgument(StringUtils.isNotBlank(blueprintPath), "Blueprint Path is missing");
+ ToscaMetaData toscaMetaData = BluePrintMetadataUtils.toscaMetaData(blueprintPath);
+
+ Preconditions.checkNotNull(toscaMetaData, "failed to get Blueprint Metadata information");
+ Preconditions.checkArgument(StringUtils.isNotBlank(toscaMetaData.getEntityDefinitions()), "failed to get Blueprint Definition file");
+ Preconditions.checkArgument(StringUtils.isNotBlank(toscaMetaData.getCreatedBy()), "failed to get Blueprint created by");
+ Preconditions.checkArgument(StringUtils.isNotBlank(toscaMetaData.getToscaMetaFileVersion()), "failed to get Blueprint package version");
+
+ String bluePrintName = FilenameUtils.getBaseName(toscaMetaData.getEntityDefinitions());
+ Preconditions.checkArgument(StringUtils.isNotBlank(bluePrintName), "failed to get Blueprint Definition Name");
+
+ // TODO - Update Rest of the Model
+ ConfigModel configModel = new ConfigModel();
+ configModel.setUpdatedBy(toscaMetaData.getCreatedBy());
+ configModel.setArtifactName(bluePrintName);
+ configModel.setArtifactVersion(toscaMetaData.getToscaMetaFileVersion());
+ configModel.setTags(toscaMetaData.getTemplateTags());
+ configModel.setArtifactType("SDNC_MODEL");
+
+ String blueprintContent =
+ getPathContent(blueprintPath + "/" + toscaMetaData.getEntityDefinitions());
+
+ Preconditions.checkArgument(StringUtils.isNotBlank(blueprintPath), "failed to get Blueprint content");
+
+ List<ConfigModelContent> configModelContents = new ArrayList<>();
+ ConfigModelContent stConfigModelContent = new ConfigModelContent();
+ stConfigModelContent.setName(configModel.getArtifactName());
+ stConfigModelContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON);
+ stConfigModelContent.setContent(blueprintContent);
+ configModelContents.add(stConfigModelContent);
+
+ String velocityDir = blueprintPath + "/Templates";
+ List<File> velocityTemplateFiles = getFileOfExtension(velocityDir, new String[]{"vtl"});
+
+ if (CollectionUtils.isNotEmpty(velocityTemplateFiles)) {
+ for (File velocityTemplateFile : velocityTemplateFiles) {
+ if (velocityTemplateFile != null) {
+ String contentName = velocityTemplateFile.getName().replace(".vtl", "");
+ ConfigModelContent velocityConfigModelContent = new ConfigModelContent();
+ String velocityConfigContent = getPathContent(velocityTemplateFile);
+ velocityConfigModelContent.setName(contentName);
+ velocityConfigModelContent
+ .setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TEMPLATE);
+ velocityConfigModelContent.setContent(velocityConfigContent);
+ configModelContents.add(velocityConfigModelContent);
+ log.info("Loaded blueprint template successfully: {}", velocityTemplateFile.getName());
+ }
+ }
+ }
+ configModel.setConfigModelContents(configModelContents);
+
+ return configModel;
+
+ }
+
+ public static String getPathContent(String path) throws IOException {
+ Preconditions.checkArgument(StringUtils.isNotBlank(path), "Path is missing");
+ return FileUtils.readFileToString(new File(path), Charset.defaultCharset());
+ }
+
+ public static String getPathContent(File file) throws IOException {
+ Preconditions.checkNotNull(file, "File is missing");
+ return FileUtils.readFileToString(file, Charset.defaultCharset());
+ }
+
+ public static List<File> getFileOfExtension(String basePath, String[] extensions) {
+ Preconditions.checkArgument(StringUtils.isNotBlank(basePath), "Path is missing");
+ Preconditions.checkNotNull(extensions, "Extensions is missing");
+ return (List<File>) FileUtils.listFiles(new File(basePath), extensions, true);
+ }
+
+ public static List<String> getBlueprintNames(String pathName) {
+ File blueprintDir = new File(pathName);
+ Preconditions.checkNotNull(blueprintDir, "failed to find the blueprint pathName file");
+ return Arrays.asList(blueprintDir.list(DirectoryFileFilter.INSTANCE));
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
new file mode 100644
index 000000000..85f256ea7
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
@@ -0,0 +1,200 @@
+/*
+ * 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.service.validator;
+
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.CapabilityDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * ModelTypeValidation.java Purpose: Provide Validation Service for Model Type ModelTypeValidation
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+public class ModelTypeValidator {
+
+ private ModelTypeValidator() {
+
+ }
+
+ private static List<String> getValidModelDefinitionType() {
+ List<String> validTypes = new ArrayList<>();
+ validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+ validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE);
+ validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
+ validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE);
+ validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE);
+ return validTypes;
+ }
+
+ @Deprecated
+ private static List<String> getValidModelDerivedFrom(String definitionType) {
+ List<String> validTypes = new ArrayList<>();
+ if (StringUtils.isNotBlank(definitionType)) {
+ if (BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE.equalsIgnoreCase(definitionType)) {
+ validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_DG);
+ validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_COMPONENT);
+ validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_VNF);
+ validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_ARTIFACT);
+ } else if (BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE.equalsIgnoreCase(definitionType)) {
+ validTypes.add(ConfigModelConstant.MODEL_TYPE_CAPABILITY_NETCONF);
+ validTypes.add(ConfigModelConstant.MODEL_TYPE_CAPABILITY_SSH);
+ validTypes.add(ConfigModelConstant.MODEL_TYPE_CAPABILITY_SFTP);
+ validTypes.add(ConfigModelConstant.MODEL_TYPE_CAPABILITY_CHEF);
+ validTypes.add(ConfigModelConstant.MODEL_TYPE_CAPABILITY_ANSIBLEF);
+ } else if (BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE.equalsIgnoreCase(definitionType)) {
+ validTypes.add(BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON);
+ validTypes.add(BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON);
+ validTypes.add(BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO);
+ validTypes.add(BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ATTACH_TO);
+ validTypes.add(BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROUTES_TO);
+ }
+
+ }
+ return validTypes;
+ }
+
+ /**
+ * This is a validateNodeType
+ *
+ * @param definitionType
+ * @param derivedFrom
+ * @return boolean
+ * @throws BluePrintException
+ */
+ public static boolean validateNodeType(String definitionType, String derivedFrom) throws BluePrintException {
+ boolean valid = true;
+ if (!BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE.equalsIgnoreCase(definitionType)
+ && !BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE.equalsIgnoreCase(definitionType)) {
+ List<String> validTypes = getValidModelDerivedFrom(definitionType);
+ if (!validTypes.contains(derivedFrom)) {
+ throw new BluePrintException(
+ "Not Valid Model Type (" + derivedFrom + "), It sould be " + validTypes);
+ }
+ }
+ return valid;
+ }
+
+ /**
+ * This is a validateModelTypeDefinition
+ *
+ * @param definitionType
+ * @param definitionContent
+ * @return boolean
+ * @throws BluePrintException
+ */
+ public static boolean validateModelTypeDefinition(String definitionType, String definitionContent)
+ throws BluePrintException {
+ boolean valid = true;
+ if (StringUtils.isNotBlank(definitionContent)) {
+ if (BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE.equalsIgnoreCase(definitionType)) {
+ DataType dataType = JacksonUtils.readValue(definitionContent, DataType.class);
+ if (dataType == null) {
+ throw new BluePrintException(
+ "Model type definition is not DataType valid content " + definitionContent);
+ }
+ } else if (BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE.equalsIgnoreCase(definitionType)) {
+ NodeType nodeType = JacksonUtils.readValue(definitionContent, NodeType.class);
+ if (nodeType == null) {
+ throw new BluePrintException(
+ "Model type definition is not NodeType valid content " + definitionContent);
+ }
+ } else if (BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE.equalsIgnoreCase(definitionType)) {
+ ArtifactType artifactType = JacksonUtils.readValue(definitionContent, ArtifactType.class);
+ if (artifactType == null) {
+ throw new BluePrintException(
+ "Model type definition is not ArtifactType valid content " + definitionContent);
+ }
+ }else if (BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE.equalsIgnoreCase(definitionType)) {
+ CapabilityDefinition capabilityDefinition =
+ JacksonUtils.readValue(definitionContent, CapabilityDefinition.class);
+ if (capabilityDefinition == null) {
+ throw new BluePrintException(
+ "Model type definition is not CapabilityDefinition valid content " + definitionContent);
+ }
+ }
+
+ }
+ return valid;
+ }
+
+ /**
+ * This is a validateModelType method
+ *
+ * @param modelType
+ * @return boolean
+ */
+ public static boolean validateModelType(ModelType modelType) throws BluePrintException {
+ if (modelType != null) {
+
+ if (StringUtils.isBlank(modelType.getModelName())) {
+ throw new BluePrintException("Model Name Information is missing.");
+ }
+
+ if (StringUtils.isBlank(modelType.getDefinitionType())) {
+ throw new BluePrintException("Model Root Type Information is missing.");
+ }
+ if (StringUtils.isBlank(modelType.getDerivedFrom())) {
+ throw new BluePrintException("Model Type Information is missing.");
+ }
+
+ if (StringUtils.isBlank(modelType.getDefinition())) {
+ throw new BluePrintException("Model Definition Information is missing.");
+ }
+ if (StringUtils.isBlank(modelType.getDescription())) {
+ throw new BluePrintException("Model Description Information is missing.");
+ }
+
+ if (StringUtils.isBlank(modelType.getVersion())) {
+ throw new BluePrintException("Model Version Information is missing.");
+ }
+
+ if (StringUtils.isBlank(modelType.getUpdatedBy())) {
+ throw new BluePrintException("Model Updated By Information is missing.");
+ }
+
+ List<String> validRootTypes = getValidModelDefinitionType();
+ if (!validRootTypes.contains(modelType.getDefinitionType())) {
+ throw new BluePrintException("Not Valid Model Root Type(" + modelType.getDefinitionType()
+ + "), It sould be " + validRootTypes);
+ }
+
+ validateModelTypeDefinition(modelType.getDefinitionType(), modelType.getDefinition());
+
+ validateNodeType(modelType.getDefinitionType(), modelType.getDerivedFrom());
+
+ } else {
+ throw new BluePrintException("Model Type Information is missing.");
+ }
+
+ return true;
+
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java
new file mode 100644
index 000000000..eb2448e70
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java
@@ -0,0 +1,88 @@
+/*
+ * 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.service.validator;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DictionaryDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+
+/**
+ * ResourceDictionaryValidator.java Purpose: Provide Validation Service for Model Type Resource
+ * Dictionary Validator
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+public class ResourceDictionaryValidator {
+
+ private ResourceDictionaryValidator() {}
+
+ /**
+ * This is a validateResourceDictionaryDefinition
+ *
+ * @param definitionContent
+ * @return boolean
+ * @throws BluePrintException
+ */
+ public static boolean validateResourceDictionaryDefinition(String definitionContent)
+ throws BluePrintException {
+ boolean valid = true;
+ if (StringUtils.isNotBlank(definitionContent)) {
+ DictionaryDefinition dictionaryDefinition =
+ JacksonUtils.readValue(definitionContent, DictionaryDefinition.class);
+ if (dictionaryDefinition == null) {
+ throw new BluePrintException(
+ "Resource dictionary definition is not valid content " + definitionContent);
+ }
+
+ }
+ return valid;
+ }
+
+ /**
+ * This is a validateResourceDictionary method
+ *
+ * @param resourceDictionary
+ * @return boolean
+ *
+ */
+ public static boolean validateResourceDictionary(ResourceDictionary resourceDictionary) {
+
+ Preconditions.checkNotNull(resourceDictionary,"ResourceDictionary Information is missing." );
+
+ Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getName()),
+ "DataDictionary Alias Name Information is missing.");
+ Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getResourcePath()),
+ "DataDictionary Resource Name Information is missing.");
+ Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getResourceType()),
+ "DataDictionary Resource Type Information is missing.");
+ Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getDefinition()),
+ "DataDictionary Definition Information is missing.");
+ Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getDescription()),
+ "DataDictionary Description Information is missing.");
+ Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getTags()),
+ "DataDictionary Tags Information is missing.");
+ Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getUpdatedBy()),
+ "DataDictionary Updated By Information is missing.");
+ return true;
+
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java
new file mode 100644
index 000000000..ea46f3ad3
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java
@@ -0,0 +1,123 @@
+/*
+ * 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.service.validator;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang3.StringUtils;
+import org.jetbrains.annotations.NotNull;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintValidatorDefaultService;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.validator.ResourceAssignmentValidator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * ServiceTemplateValidator.java Purpose: Provide Configuration Generator ServiceTemplateValidator
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+public class ServiceTemplateValidator extends BluePrintValidatorDefaultService {
+
+ StringBuilder message = new StringBuilder();
+ private Map<String, String> metaData = new HashMap();
+
+ /**
+ * This is a validateServiceTemplate
+ *
+ * @param serviceTemplateContent
+ * @return boolean
+ * @throws BluePrintException
+ */
+ public boolean validateServiceTemplate(String serviceTemplateContent) throws BluePrintException {
+ if (StringUtils.isNotBlank(serviceTemplateContent)) {
+ ServiceTemplate serviceTemplate =
+ JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
+ return validateServiceTemplate(serviceTemplate);
+ } else {
+ throw new BluePrintException(
+ "Service Template Content is (" + serviceTemplateContent + ") not Defined.");
+ }
+ }
+
+ /**
+ * This is a validateServiceTemplate
+ *
+ * @param serviceTemplate
+ * @return boolean
+ * @throws BluePrintException
+ */
+ @SuppressWarnings("squid:S00112")
+ public boolean validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
+ Map<String, Object> properties = new HashMap<>();
+ super.validateBlueprint(serviceTemplate, properties);
+ return true;
+ }
+
+ /**
+ * This is a getMetaData to get the key information during the
+ *
+ * @return Map<String ,
+ * String>
+ */
+ public Map<String, String> getMetaData() {
+ return metaData;
+ }
+
+ @Override
+ public void validateMetadata(@NotNull Map<String, String> metaDataMap) throws BluePrintException {
+
+ Preconditions.checkNotNull(serviceTemplate.getMetadata(), "Service Template Metadata Information is missing.");
+
+ this.metaData.putAll(serviceTemplate.getMetadata());
+
+ String author = serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_AUTHOR);
+ String serviceTemplateName =
+ serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_NAME);
+ String serviceTemplateVersion =
+ serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_VERSION);
+
+ Preconditions.checkArgument(StringUtils.isNotBlank(author), "Template Metadata (author) Information is missing.");
+ Preconditions.checkArgument(StringUtils.isNotBlank(serviceTemplateName), "Template Metadata (service-template-name) Information is missing.");
+ Preconditions.checkArgument(StringUtils.isNotBlank(serviceTemplateVersion), "Template Metadata (service-template-version) Information is missing.");
+ }
+
+
+ @Override
+ public void validateNodeTemplate(@NotNull String nodeTemplateName, @NotNull NodeTemplate nodeTemplate)
+ throws BluePrintException {
+ super.validateNodeTemplate(nodeTemplateName, nodeTemplate);
+ validateNodeTemplateCustom(nodeTemplateName, nodeTemplate);
+
+ }
+
+ @Deprecated()
+ private void validateNodeTemplateCustom(@NotNull String nodeTemplateName, @NotNull NodeTemplate nodeTemplate)
+ throws BluePrintException {
+ String derivedFrom = getBluePrintContext().nodeTemplateNodeType(nodeTemplateName).getDerivedFrom();
+ if ("tosca.nodes.Artifact".equals(derivedFrom)) {
+ ResourceAssignmentValidator resourceAssignmentValidator = new ResourceAssignmentValidator(nodeTemplate);
+ resourceAssignmentValidator.validateResourceAssignment();
+ }
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json b/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json
new file mode 100644
index 000000000..95c829c4f
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json
@@ -0,0 +1,890 @@
+{
+ "version": "1.0.0",
+ "metadata": {
+ "template_author": "xxxx@onap.com",
+ "template_name": "default_netconf",
+ "template_version": "1.0.0",
+ "service-type": "XXXXXXXXXXX",
+ "vnf-type": "XXXXXXXXX"
+ },
+ "topology_template": {
+ "inputs": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "service-template-name": {
+ "required": true,
+ "type": "string"
+ },
+ "service-template-version": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string"
+ },
+ "resource-type": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "node_templates": {
+ "base-config-template": {
+ "type": "artifact-config-template",
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": ""
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": []
+ }
+ }
+ }
+ },
+ "licence-template": {
+ "type": "artifact-config-template",
+ "properties": {
+ "action-names": [
+ "activate-netconf-action"
+ ]
+ },
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": ""
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": []
+ }
+ }
+ }
+ },
+ "runningconfig-template": {
+ "type": "artifact-config-template",
+ "properties": {
+ "action-names": [
+ "activate-netconf-action"
+ ]
+ },
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "<get-config><source><running/></source></get-config>"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": []
+ }
+ }
+ }
+ },
+ "resource-assignment-action": {
+ "type": "dg-resource-assignment",
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {
+
+ }
+ }
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "get-resource-assignment",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ }
+ },
+ "activate-netconf-action": {
+ "type": "dg-activate-netconf",
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {
+
+ }
+ }
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "transaction-netconf-baseconfig",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ }
+ },
+ "resource-assignment": {
+ "type": "component-resource-assignment",
+ "interfaces": {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "resource-type": "vnf-type",
+ "template-names": [
+ "base-config-template",
+ "licence-template"
+ ],
+ "request-id": "{ \"get_attribute\" : \"request-id\" }",
+ "resource-id": "{ \"get_input\" : \"vnf-id\" }"
+ },
+ "outputs": {
+ "resource-assignment-params": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "capabilities": {
+ "component-node": {
+
+ }
+ }
+ },
+ "edit-netconf-config": {
+ "type": "component-netconf-edit",
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-SimpleNetconfEditConfigNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "rpc-message": false,
+ "wait": 0,
+ "unlock": false,
+ "config-target": "RUNNING",
+ "commit": true,
+ "edit-default-operation": "repalce",
+ "lock": false,
+ "post-restart-wait": false,
+ "pre-restart-wait": false
+ },
+ "outputs": {
+ "rpc-response-message": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "capabilities": {
+ "component-node": {
+
+ }
+ }
+ },
+ "transaction-netconf-baseconfig": {
+ "type": "component-transaction-netconf",
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfTransactionNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "rollback": false,
+ "transaction-templates": [
+ "runningconfig-template"
+ ],
+ "assignment-action-name": "resource-assignment-action",
+ "transaction-components": [
+ "get-netconf-config"
+ ],
+ "resource-type": "vnf-type",
+ "initialise-sftp": false,
+ "request-id": "{ \"get_input\" : \"request-id\" }",
+ "initialise-ssh": false,
+ "resource-id": "{ \"get_input\" : \"vnf-id\" }",
+ "action-name": "{ \"get_input\" : \"action-name\" }"
+ },
+ "outputs": {
+ "rpc-response-message": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "capabilities": {
+ "component-node": {
+
+ }
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vdbe-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ }
+ },
+ "get-netconf-config": {
+ "type": "component-netconf-get",
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-SimpleNetconfGetConfigNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "rpc-message": true,
+ "wait": 1,
+ "message-time-out": 10
+ },
+ "outputs": {
+ "rpc-response-message": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "capabilities": {
+ "component-node": {
+
+ }
+ }
+ }
+ }
+ },
+ "node_types": {
+ "vnf-netconf-device": {
+ "description": "This is VNF Device with Netconf and SSH Capability",
+ "version": "1.0.0",
+ "capabilities": {
+ "netconf": {
+ "type": "tosca.capability.Netconf",
+ "properties": {
+ "password": {
+ "required": false,
+ "type": "string"
+ },
+ "user-id": {
+ "required": true,
+ "type": "string"
+ },
+ "host-ip-address": {
+ "required": true,
+ "type": "string"
+ },
+ "port-number": {
+ "required": true,
+ "type": "integer",
+ "default": 830
+ },
+ "message-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 3000
+ },
+ "connection-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ }
+ },
+ "ssh": {
+ "type": "tosca.capability.Ssh",
+ "properties": {
+ "password": {
+ "required": false,
+ "type": "string"
+ },
+ "user-id": {
+ "required": true,
+ "type": "string"
+ },
+ "host-ip-address": {
+ "required": true,
+ "type": "string"
+ },
+ "port-number": {
+ "required": true,
+ "type": "integer",
+ "default": 22
+ },
+ "message-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 180
+ },
+ "connection-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ }
+ },
+ "sftp": {
+ "type": "tosca.capability.Sftp",
+ "properties": {
+ "password": {
+ "required": false,
+ "type": "string"
+ },
+ "user-id": {
+ "required": true,
+ "type": "string"
+ },
+ "host-ip-address": {
+ "required": true,
+ "type": "string"
+ },
+ "port-number": {
+ "required": true,
+ "type": "integer",
+ "default": 22
+ },
+ "message-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 180
+ },
+ "connection-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Vnf"
+ },
+ "dg-resource-assignment": {
+ "description": "This is Resource Assignment Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-resource-assignment",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+ },
+ "dg-activate-netconf": {
+ "description": "This is Download Netconf Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-transaction-netconf",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+ },
+ "artifact-config-template": {
+ "description": "This is Configuration Velocity Template",
+ "version": "1.0.0",
+ "properties": {
+ "action-names": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "capabilities": {
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ },
+ "mapping": {
+ "type": "tosca.capability.Mapping",
+ "properties": {
+ "mapping": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-resource-assignment"
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Artifact"
+ },
+ "component-resource-assignment": {
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "handler-name": {
+ "description": "Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
+ "required": true,
+ "type": "string"
+ },
+ "resource-type": {
+ "required": false,
+ "type": "string"
+ },
+ "template-names": {
+ "description": "Name of the Artifact Node Templates, to get the template Content.",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "resource-assignment-params": {
+ "required": true,
+ "type": "string"
+ },
+ "status": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ },
+ "component-netconf-get": {
+ "description": "This is Netconf Get Running Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-SimpleNetconfGetConfigNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "rpc-message": {
+ "description": "It should be true, If the message is Neconf RPC message, It should be false If it is plain Config message.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "wait": {
+ "required": false,
+ "type": "integer",
+ "default": 0
+ },
+ "message-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ },
+ "outputs": {
+ "config-message": {
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ },
+ "component-netconf-edit": {
+ "description": "This is Netconf Edit Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-SimpleNetconfEditConfigNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "rpc-message": {
+ "description": "If the message is Neconf RPC message,It should be true or false.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "wait": {
+ "description": "Delay time in sec before performing edit-config action.",
+ "required": false,
+ "type": "integer",
+ "default": 0
+ },
+ "unlock": {
+ "description": "If unLock command has to send before Edit Configuration.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "config-target": {
+ "required": false,
+ "type": "string"
+ },
+ "commit": {
+ "description": "Issue commit command to the device after performing edit-config action.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "edit-default-operation": {
+ "required": false,
+ "type": "string"
+ },
+ "lock": {
+ "description": "Issue lock command to the device before performing edit-config action.",
+ "required": false,
+ "type": "boolean",
+ "default": false
+ },
+ "post-restart-wait": {
+ "description": "If Restart command should be issued before the Edit Operation, Provide the time to wait after restart. 0 meanno restart required or wait time in sec ex : 3000 for 5 ",
+ "required": false,
+ "type": "integer",
+ "default": 0
+ },
+ "pre-restart-wait": {
+ "description": "If Restart command should be issued after the Edit Operation, Provide the time to wait after restart. 0 meanno restart required or wait time in sec ex : 3000 for 5 ",
+ "required": false,
+ "type": "integer",
+ "default": 0
+ },
+ "message-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ },
+ "outputs": {
+ "rpc-response-message": {
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ },
+ "component-transaction-netconf": {
+ "description": "This is Netconf Transaction Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vnf-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfTransactionNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "rollback": {
+ "required": false,
+ "type": "boolean"
+ },
+ "transaction-templates": {
+ "description": "Templates used by the Transaction Components during processing",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "assignment-action-name": {
+ "description": "Assignment Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": true,
+ "type": "string"
+ },
+ "transaction-components": {
+ "description": "Components used to used for the atomic transaction, Default Handlers are org.openecomp.sdnc.netconf.adaptor.service.SimpleNetconfEditConfigNode and org.openecomp.sdnc.netconf.adaptor.service.SimpleNetconfGetConfigNode",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "resource-type": {
+ "description": "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "initialise-sftp": {
+ "required": false,
+ "type": "boolean"
+ },
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "initialise-ssh": {
+ "required": false,
+ "type": "boolean"
+ },
+ "resource-id": {
+ "description": "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "rpc-response-message": {
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ }
+ },
+ "data_types": {
+ "datatype-resource-assignment": {
+ "version": "1.0.0",
+ "description": "This is Resource Assignment Data Type",
+ "properties": {
+ "property": {
+ "required": true,
+ "type": "datatype-property"
+ },
+ "input-param": {
+ "required": true,
+ "type": "boolean"
+ },
+ "dictionary-name": {
+ "required": false,
+ "type": "string"
+ },
+ "dictionary-source": {
+ "required": false,
+ "type": "string"
+ },
+ "dependencies": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+ },
+ "datatype-property": {
+ "version": "1.0.0",
+ "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
+ "properties": {
+ "type": {
+ "required": true,
+ "type": "string"
+ },
+ "description": {
+ "required": false,
+ "type": "string"
+ },
+ "required": {
+ "required": false,
+ "type": "boolean"
+ },
+ "default": {
+ "required": false,
+ "type": "string"
+ },
+ "entry_schema": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/data.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/data.sql
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/resources/sql/data.sql
diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql
new file mode 100644
index 000000000..1ba9c365a
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql
@@ -0,0 +1,87 @@
+-- drop table sdnctl.MODEL_TYPE;
+-- drop table sdnctl.RESOURCE_DICTIONARY;
+-- drop table sdnctl.CONFIG_MODEL_CONTENT;
+-- drop table sdnctl.CONFIG_MODEL;
+
+-- -----------------------------------------------------
+-- table CONFIG_MODEL
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_MODEL (
+ config_model_id INT(11) NOT NULL AUTO_INCREMENT,
+ service_uuid VARCHAR(50) NULL DEFAULT NULL,
+ distribution_id VARCHAR(50) NULL DEFAULT NULL,
+ service_name VARCHAR(255) NULL DEFAULT NULL,
+ service_description VARCHAR(255) NULL DEFAULT NULL,
+ resource_uuid VARCHAR(255) NULL DEFAULT NULL,
+ resource_instance_name VARCHAR(255) NULL DEFAULT NULL,
+ resource_name varchar(255) null default null,
+ resource_version varchar(50) null default null,
+ resource_type varchar(50) null default null,
+ artifact_uuid varchar(50) null default null,
+ artifact_type varchar(50) not null,
+ artifact_version varchar(25) not null,
+ artifact_description longtext null default null,
+ internal_version int(11) null default null,
+ creation_date datetime not null default current_timestamp,
+ artifact_name varchar(100) not null,
+ published varchar(1) not null,
+ updated_by varchar(100) not null,
+ tags longtext null default null,
+ primary key PK_CONFIG_MODEL (config_model_id),
+ UNIQUE KEY UK_CONFIG_MODEL (artifact_name , artifact_version)
+) ENGINE=InnoDB;
+
+
+-- -----------------------------------------------------
+-- table CONFIG_MODEL_CONTENT
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_MODEL_CONTENT (
+ config_model_content_id INT(11) NOT NULL AUTO_INCREMENT,
+ config_model_id INT NOT NULL,
+ name VARCHAR(100) NOT NULL,
+ content_type VARCHAR(50) NOT NULL,
+ description LONGTEXT NULL DEFAULT NULL,
+ updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ content LONGTEXT NULL DEFAULT NULL,
+ PRIMARY KEY PK_CONFIG_MODEL_CONTENT (config_model_content_id),
+ UNIQUE KEY UK_CONFIG_MODEL_CONTENT (config_model_id, name, content_type),
+ FOREIGN KEY FK_CONFIG_MODEL_CONTENT (config_model_id) REFERENCES sdnctl.CONFIG_MODEL(config_model_id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+-- -----------------------------------------------------
+-- table MODEL_TYPE
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS sdnctl.MODEL_TYPE (
+ model_name VARCHAR(100) NOT NULL,
+ derived_from VARCHAR(100) NOT NULL,
+ definition_type VARCHAR(100) NOT NULL,
+ definition LONGTEXT NOT NULL,
+ version VARCHAR(10) NOT NULL,
+ description LONGTEXT NOT NULL,
+ tags LONGTEXT NULL DEFAULT NULL,
+ creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ updated_by VARCHAR(100) NOT NULL,
+ PRIMARY KEY PK_MODEL_TYPE (model_name),
+ INDEX IX_MODEL_TYPE (model_name)
+) ENGINE=InnoDB;
+
+
+-- -----------------------------------------------------
+-- table RESOURCE_DICTIONARY
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS sdnctl.RESOURCE_DICTIONARY (
+ name VARCHAR(100) NOT NULL,
+ resource_path VARCHAR(500) NOT NULL,
+ resource_type VARCHAR(100) NOT NULL,
+ data_type VARCHAR(100) NOT NULL,
+ entry_schema VARCHAR(100) NULL DEFAULT NULL,
+ valid_values LONGTEXT NULL DEFAULT NULL,
+ sample_value LONGTEXT NULL DEFAULT NULL,
+ definition LONGTEXT NOT NULL,
+ description LONGTEXT NOT NULL,
+ tags LONGTEXT NOT NULL,
+ creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ updated_by VARCHAR(100) NOT NULL,
+ primary key PK_RESOURCE_DICTIONARY (name),
+ INDEX IX_RESOURCE_DICTIONARY (name)
+) ENGINE=InnoDB; \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql
new file mode 100644
index 000000000..b884cf345
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql
@@ -0,0 +1,82 @@
+-- -----------------------------------------------------
+-- table CONFIG_MODEL
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL (
+ config_model_id INT(11) NOT NULL AUTO_INCREMENT,
+ service_uuid VARCHAR(50) NULL DEFAULT NULL,
+ distribution_id VARCHAR(50) NULL DEFAULT NULL,
+ service_name VARCHAR(255) NULL DEFAULT NULL,
+ service_description VARCHAR(255) NULL DEFAULT NULL,
+ resource_uuid VARCHAR(255) NULL DEFAULT NULL,
+ resource_instance_name VARCHAR(255) NULL DEFAULT NULL,
+ resource_name varchar(255) null default null,
+ resource_version varchar(50) null default null,
+ resource_type varchar(50) null default null,
+ artifact_uuid varchar(50) null default null,
+ artifact_type varchar(50) not null,
+ artifact_version varchar(25) not null,
+ artifact_description longtext null default null,
+ internal_version int(11) null default null,
+ creation_date datetime not null default current_timestamp,
+ artifact_name varchar(100) not null,
+ published varchar(1) not null,
+ updated_by varchar(100) not null,
+ tags longtext null default null,
+ primary key PK_CONFIG_MODEL (config_model_id),
+ UNIQUE KEY UK_CONFIG_MODEL (artifact_name , artifact_version)
+) ENGINE=InnoDB;
+
+
+-- -----------------------------------------------------
+-- table CONFIG_MODEL_CONTENT
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL_CONTENT (
+ config_model_content_id INT(11) NOT NULL AUTO_INCREMENT,
+ config_model_id INT NOT NULL,
+ name VARCHAR(100) NOT NULL,
+ content_type VARCHAR(50) NOT NULL,
+ description LONGTEXT NULL DEFAULT NULL,
+ updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ content LONGTEXT NULL DEFAULT NULL,
+ PRIMARY KEY PK_CONFIG_MODEL_CONTENT (config_model_content_id),
+ UNIQUE KEY UK_CONFIG_MODEL_CONTENT (config_model_id, name, content_type),
+ FOREIGN KEY FK_CONFIG_MODEL_CONTENT (config_model_id) REFERENCES configurator.CONFIG_MODEL(config_model_id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+-- -----------------------------------------------------
+-- table MODEL_TYPE
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS configurator.MODEL_TYPE (
+ model_name VARCHAR(100) NOT NULL,
+ derived_from VARCHAR(100) NOT NULL,
+ definition_type VARCHAR(100) NOT NULL,
+ definition LONGTEXT NOT NULL,
+ version VARCHAR(10) NOT NULL,
+ description LONGTEXT NOT NULL,
+ tags LONGTEXT NULL DEFAULT NULL,
+ creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ updated_by VARCHAR(100) NOT NULL,
+ PRIMARY KEY PK_MODEL_TYPE (model_name),
+ INDEX IX_MODEL_TYPE (model_name)
+) ENGINE=InnoDB;
+
+
+-- -----------------------------------------------------
+-- table RESOURCE_DICTIONARY
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS configurator.RESOURCE_DICTIONARY (
+ name VARCHAR(100) NOT NULL,
+ resource_path VARCHAR(500) NOT NULL,
+ resource_type VARCHAR(100) NOT NULL,
+ data_type VARCHAR(100) NOT NULL,
+ entry_schema VARCHAR(100) NULL DEFAULT NULL,
+ valid_values LONGTEXT NULL DEFAULT NULL,
+ sample_value LONGTEXT NULL DEFAULT NULL,
+ definition LONGTEXT NOT NULL,
+ description LONGTEXT NOT NULL,
+ tags LONGTEXT NOT NULL,
+ creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ updated_by VARCHAR(100) NOT NULL,
+ primary key PK_RESOURCE_DICTIONARY (name),
+ INDEX IX_RESOURCE_DICTIONARY (name)
+) ENGINE=InnoDB;
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java
new file mode 100644
index 000000000..db35fe661
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import javax.sql.DataSource;
+
+/**
+ * DatabaseConfig.java Purpose: Provide Configuration Generator DatabaseConfig Information
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Configuration
+@EntityScan("org.onap.ccsdk.apps.controllerblueprints.service.domain")
+@EnableTransactionManagement
+@EnableJpaRepositories("org.onap.ccsdk.apps.controllerblueprints.service.repository")
+@EnableJpaAuditing
+public class DatabaseConfig {
+ /**
+ * This is a entityManagerFactory method
+ *
+ * @param dataSource
+ * @return LocalContainerEntityManagerFactoryBean
+ */
+
+ @Bean
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
+ HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
+ vendorAdapter.setGenerateDdl(true);
+ vendorAdapter.setShowSql(false);
+ LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
+ factory.setJpaVendorAdapter(vendorAdapter);
+ factory.setPackagesToScan("org.onap.ccsdk.apps.controllerblueprints.service.domain");
+ factory.setDataSource(dataSource);
+ return factory;
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java
new file mode 100644
index 000000000..f5535eb12
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java
@@ -0,0 +1,69 @@
+/*
+ * 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;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.glassfish.jersey.logging.LoggingFeature;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletProperties;
+import org.onap.ccsdk.apps.controllerblueprints.service.common.ServiceExceptionMapper;
+import org.onap.ccsdk.apps.controllerblueprints.service.rs.ConfigModelRestImpl;
+import org.onap.ccsdk.apps.controllerblueprints.service.rs.ModelTypeRestImpl;
+import org.onap.ccsdk.apps.controllerblueprints.service.rs.ResourceDictionaryRestImpl;
+import org.onap.ccsdk.apps.controllerblueprints.service.rs.ServiceTemplateRestImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Primary;
+import org.springframework.stereotype.Component;
+
+import java.util.logging.Logger;
+
+
+@Component
+public class JerseyConfiguration extends ResourceConfig {
+ private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName());
+
+ @Bean
+ @Primary
+ public ObjectMapper objectMapper() {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+ objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
+ objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
+ objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
+ return objectMapper;
+ }
+
+ @Autowired
+ public JerseyConfiguration() {
+ register(ConfigModelRestImpl.class);
+ register(ModelTypeRestImpl.class);
+ register(ResourceDictionaryRestImpl.class);
+ register(ServiceTemplateRestImpl.class);
+ // Exception Mapping
+ register(ServiceExceptionMapper.class);
+ property(ServletProperties.FILTER_FORWARD_ON_404, true);
+ register(new LoggingFeature(log));
+ }
+
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestApplication.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestApplication.java
new file mode 100644
index 000000000..537429f0b
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestApplication.java
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+
+
+@SpringBootApplication
+@ComponentScan(basePackages = {"org.onap.ccsdk.apps.controllerblueprints"})
+@EnableAutoConfiguration
+public class TestApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(TestApplication.class, args);
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java
new file mode 100644
index 000000000..ea259c9c9
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints;
+
+import org.springframework.context.annotation.Bean;
+
+import java.util.ArrayList;
+
+//@Configuration
+public class TestConfiguration {
+
+ @Bean("jaxrsProviders")
+ public ArrayList<Object> provider() {
+ return new ArrayList<Object>();
+ }
+
+ @Bean("jaxrsServices")
+ public ArrayList<Object> service() {
+ return new ArrayList<Object>();
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java
new file mode 100644
index 000000000..50e94df9e
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.service.common;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+import org.onap.ccsdk.apps.controllerblueprints.service.SchemaGeneratorService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.nio.charset.Charset;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class SchemaGeneratorServiceTest {
+
+ private static Logger log = LoggerFactory.getLogger(ServiceTemplateValidationTest.class);
+
+ @Test
+ public void test01GenerateSwaggerData() throws Exception {
+ log.info("******************* test01GenerateSwaggerData ******************************");
+
+ String file = "src/test/resources/enhance/enhanced-template.json";
+ String serviceTemplateContent = FileUtils.readFileToString(new File(file), Charset.defaultCharset());
+ SchemaGeneratorService schemaGeneratorService = new SchemaGeneratorService();
+ String schema = schemaGeneratorService.generateSchema(serviceTemplateContent);
+ log.trace("Generated Schema " + schema);
+ Assert.assertNotNull("failed to generate Sample Data", schema);
+
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceTemplateValidationTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceTemplateValidationTest.java
new file mode 100644
index 000000000..af309e217
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceTemplateValidationTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.service.common;
+
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;
+import org.onap.ccsdk.apps.controllerblueprints.service.validator.ServiceTemplateValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.nio.charset.Charset;
+import java.util.List;
+
+public class ServiceTemplateValidationTest {
+ private static Logger log = LoggerFactory.getLogger(ServiceTemplateValidationTest.class);
+
+ @Test
+ public void testBluePrintDirs(){
+ List<String> dirs = ConfigModelUtils.getBlueprintNames("load/blueprints");
+ Assert.assertNotNull("Failed to get blueprint directories", dirs );
+ Assert.assertEquals("Failed to get actual directories",2, dirs.size() );
+ }
+
+ // @Test
+ public void validateServiceTemplate() {
+ try {
+ String file = "load/service_template/vrr-201806-test/service-template.json";
+ String serviceTemplateContent =
+ IOUtils.toString(ServiceTemplateValidationTest.class.getClassLoader().getResourceAsStream(file),
+ Charset.defaultCharset());
+ ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator();
+ serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent);
+ log.info("Validated Service Template " + serviceTemplateValidator.getMetaData());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java
new file mode 100644
index 000000000..5b10a7e86
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java
@@ -0,0 +1,172 @@
+/*
+ * 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.service.rs;
+
+import org.junit.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
+import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.List;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ConfigModelRestTest {
+
+ private static Logger log = LoggerFactory.getLogger(ConfigModelRestTest.class);
+
+ @Autowired
+ ConfigModelRest configModelRest;
+
+ ConfigModel configModel;
+
+ String name = "vrr-test";
+ String version = "1.0.0";
+
+ @Before
+ public void setUp() {
+
+ }
+
+
+ @After
+ public void tearDown() {
+ }
+
+
+ @Test
+ public void test01getInitialConfigModel() throws Exception {
+ log.info("** test01getInitialConfigModel *****************");
+
+ String name = "default_netconf";
+ ConfigModel configModel = configModelRest.getInitialConfigModel(name);
+ Assert.assertNotNull("Failed to get Initial Config Model , Return object is Null", configModel);
+ Assert.assertNotNull("Failed to get Service Template Content ", configModel.getConfigModelContents());
+
+ }
+
+
+ @Test
+ public void test02SaveServiceTemplate() throws Exception {
+ log.info("************************ test02SaveServiceTemplate ******************");
+
+
+ configModel = ConfigModelUtils.getConfigModel("load/blueprints/vrr-test");
+
+ configModel = configModelRest.saveConfigModel(configModel);
+ Assert.assertNotNull("Failed to ConfigModel, Return object is Null", configModel);
+ Assert.assertNotNull("Failed to ConfigModel Id , Return ID object is Null", configModel.getId());
+ Assert.assertNotNull("Failed to ConfigModel Content, Return object is Null",
+ configModel.getConfigModelContents());
+ Assert.assertEquals("Failed in validation of ConfigModel Content count,", 3,
+ configModel.getConfigModelContents().size());
+
+ ConfigModel dbconfigModel = configModelRest.getConfigModel(configModel.getId());
+
+ log.info("************************ test02SaveServiceTemplate-2 ******************");
+
+ dbconfigModel.getConfigModelContents().remove(2);
+ dbconfigModel = configModelRest.saveConfigModel(dbconfigModel);
+ log.info("Saved Config Model " + configModel.getId());
+ Assert.assertNotNull("Failed to ConfigModel, Return object is Null", dbconfigModel);
+ Assert.assertNotNull("Failed to ConfigModel Id ", dbconfigModel.getId());
+ Assert.assertNotNull("Failed to ConfigModel Content",
+ dbconfigModel.getConfigModelContents());
+ Assert.assertEquals("Failed to Remove the ConfigModel Content,", 2,
+ dbconfigModel.getConfigModelContents().size());
+
+
+ }
+
+
+ @Test
+ public void test03PublishServiceTemplate() throws Exception {
+ log.info("** test03PublishServiceTemplate *****************");
+
+ ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
+ log.info("Publishing Config Model " + configModel.getId());
+ configModel = configModelRest.publishConfigModel(configModel.getId());
+ Assert.assertNotNull("Failed to ConfigModel, Return object is Null", configModel);
+ Assert.assertNotNull("Failed to ConfigModel Id ", configModel.getId());
+ Assert.assertNotNull("Failed to ConfigModel Content", configModel.getConfigModelContents());
+ Assert.assertEquals("Failed to update the publish indicator", "Y", configModel.getPublished());
+ }
+
+
+ @Test
+ public void test04GetConfigModel() throws Exception {
+ log.info("** test04GetConfigModel *****************");
+
+ ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
+ Assert.assertNotNull("Failed to get ConfigModel for the Name (" + configModel.getArtifactName() + ") and ("
+ + configModel.getArtifactVersion() + ")", configModel);
+ Assert.assertNotNull("Failed to get ConfigModel Id", configModel.getId());
+
+ configModel = configModelRest.getConfigModel(configModel.getId());
+ Assert.assertNotNull("Failed to get ConfigModel for the Id (" + configModel.getId() + ") ", configModel);
+
+ }
+
+ @Test
+ public void test05GetCloneConfigModel() throws Exception {
+ log.info("** test05GetCloneConfigModel *****************");
+
+ ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
+
+ Assert.assertNotNull("Failed to get ConfigModel for the Name (" + configModel.getArtifactName() + ") and ("
+ + configModel.getArtifactVersion() + ")", configModel);
+ Assert.assertNotNull("Failed to get ConfigModel Id", configModel.getId());
+
+ configModel = configModelRest.getCloneConfigModel(configModel.getId());
+ Assert.assertNotNull("Failed to get ConfigModel for the Id (" + configModel.getId() + ") ", configModel);
+ }
+
+
+ @Test
+ public void test07SearchConfigModels() throws Exception {
+ log.info("** test07SearchConfigModels *****************");
+
+ List<ConfigModel> configModels = configModelRest.searchConfigModels("vrr-test");
+ Assert.assertNotNull("Failed to search ConfigModel", configModels);
+ Assert.assertTrue("Failed to search ConfigModel with count", configModels.size() > 0);
+ // update the ServiceModelContent
+ }
+
+
+ @Test
+ public void test08DeleteConfigModels() throws Exception {
+ log.info("** test08DeleteConfigModels *****************");
+
+ ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
+ configModelRest.deleteConfigModel(configModel.getId());
+
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
new file mode 100644
index 000000000..d33349c53
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
@@ -0,0 +1,130 @@
+/*
+ * 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.service.rs;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
+import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.List;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ModelTypeRestTest {
+ private static Logger log = LoggerFactory.getLogger(ModelTypeRestTest.class);
+ @Autowired
+ ModelTypeRest modelTypeRest;
+
+ String modelName = "test-datatype";
+
+ @Before
+ public void setUp() {
+
+ }
+
+
+ @After
+ public void tearDown() {}
+
+ @Test
+ public void test01SaveModelType() throws Exception {
+ log.info( "**************** test01SaveModelType ********************");
+
+ String content = FileUtils.readFileToString(new File("load/model_type/data_type/datatype-property.json"), Charset.defaultCharset());
+ ModelType modelType = new ModelType();
+ modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+ modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);
+ modelType.setDescription("Definition for Sample Datatype ");
+ modelType.setDefinition(content);
+ modelType.setModelName(modelName);
+ modelType.setVersion("1.0.0");
+ modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
+ + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+ modelType.setUpdatedBy("xxxxxx@xxx.com");
+ modelType = modelTypeRest.saveModelType(modelType);
+ log.info( "Saved Mode {}", modelType.toString());
+ Assert.assertNotNull("Failed to get Saved ModelType", modelType);
+ Assert.assertNotNull("Failed to get Saved ModelType, Id", modelType.getModelName());
+
+ ModelType dbModelType = modelTypeRest.getModelTypeByName(modelType.getModelName());
+ Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType.getModelName() + ")",
+ dbModelType);
+
+ // Model Update
+ modelType.setUpdatedBy("bs2796@xxx.com");
+ modelType = modelTypeRest.saveModelType(modelType);
+ Assert.assertNotNull("Failed to get Saved ModelType", modelType);
+ Assert.assertEquals("Failed to get Saved getUpdatedBy ", "bs2796@xxx.com", modelType.getUpdatedBy());
+
+ }
+
+ @Test
+ public void test02SearchModelTypes() throws Exception {
+ log.info( "*********************** test02SearchModelTypes ***************************");
+
+ String tags = "test-datatype";
+
+ List<ModelType> dbModelTypes = modelTypeRest.searchModelTypes(tags);
+ Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes);
+ Assert.assertEquals("Failed to search ResourceMapping by tags count", true, dbModelTypes.size() > 0);
+
+ }
+
+ @Test
+ public void test03GetModelType() throws Exception {
+ log.info( "************************* test03GetModelType *********************************");
+ ModelType dbModelType = modelTypeRest.getModelTypeByName(modelName);
+ Assert.assertNotNull("Failed to get response for api call getModelByName ", dbModelType);
+ Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbModelType.getModelName());
+
+ List<ModelType> dbDatatypeModelTypes =
+ modelTypeRest.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+ Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes);
+ Assert.assertEquals("Failed to find getModelTypeByDefinitionType by count", true,
+ dbDatatypeModelTypes.size() > 0);
+ }
+
+ @Test
+ public void test04DeleteModelType() throws Exception {
+ log.info(
+ "************************ test03DeleteModelType ***********************");
+ ModelType dbResourceMapping = modelTypeRest.getModelTypeByName(modelName);
+ Assert.assertNotNull("Failed to get response for api call getModelByName ", dbResourceMapping);
+ Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbResourceMapping.getModelName());
+
+ modelTypeRest.deleteModelTypeByName(dbResourceMapping.getModelName());
+ }
+
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
new file mode 100644
index 000000000..71dff338b
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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.service.rs;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
+import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ResourceDictionaryRestTest {
+
+ private static Logger log = LoggerFactory.getLogger(ResourceDictionaryRestTest.class);
+
+ @Autowired
+ protected ResourceDictionaryRest resourceDictionaryRest;
+
+ @Before
+ public void setUp() {
+
+ }
+
+ @Test
+ public void test01SaveDataDictionary() throws Exception {
+ String definition = IOUtils.toString(
+ getClass().getClassLoader().getResourceAsStream("resourcedictionary/default_definition.json"),
+ Charset.defaultCharset());
+
+ ResourceDictionary dataDictionary = new ResourceDictionary();
+ dataDictionary.setResourcePath("test/vnf/ipaddress");
+ dataDictionary.setName("test-name");
+ dataDictionary.setDefinition(definition);
+ dataDictionary.setValidValues("127.0.0.1");
+ dataDictionary.setResourceType("ONAP");
+ dataDictionary.setDataType("string");
+ dataDictionary.setDescription("Sample Resource Mapping");
+ dataDictionary.setTags("test, ipaddress");
+ dataDictionary.setUpdatedBy("xxxxxx@xxx.com");
+
+ dataDictionary = resourceDictionaryRest.saveResourceDictionary(dataDictionary);
+
+ Assert.assertNotNull("Failed to get Saved Resource Dictionary", dataDictionary);
+ Assert.assertNotNull("Failed to get Saved Resource Dictionary, Id", dataDictionary.getName());
+
+ ResourceDictionary dbDataDictionary =
+ resourceDictionaryRest.getResourceDictionaryByName(dataDictionary.getName());
+ Assert.assertNotNull("Failed to query Resource Dictionary for ID (" + dataDictionary.getName() + ")",
+ dbDataDictionary);
+ Assert.assertNotNull("Failed to query Resource Dictionary definition for ID (" + dataDictionary.getName() + ")",
+ dbDataDictionary.getDefinition());
+
+ log.trace("Saved Dictionary " + dbDataDictionary.getDefinition());
+
+ }
+
+ @Test
+ public void test02GetDataDictionary() throws Exception {
+
+ ResourceDictionary dbResourceDictionary = resourceDictionaryRest.getResourceDictionaryByName("test-name");
+ Assert.assertNotNull("Failed to query Resource Dictionary by Name", dbResourceDictionary);
+
+ String tags = "ipaddress";
+
+ List<ResourceDictionary> dbResourceDictionaries = resourceDictionaryRest.searchResourceDictionaryByTags(tags);
+ Assert.assertNotNull("Failed to search ResourceDictionary by tags", dbResourceDictionaries);
+ Assert.assertTrue("Failed to search searchResourceDictionaryByTags by tags by count",
+ dbResourceDictionaries.size() > 0);
+
+ List<String> names = new ArrayList<>();
+ names.add("test-name");
+ dbResourceDictionaries = resourceDictionaryRest.searchResourceDictionaryByNames(names);
+ Assert.assertNotNull("Failed to search ResourceDictionary by Names", dbResourceDictionaries);
+ Assert.assertTrue("Failed to search searchResourceDictionaryByNames by tags by count",
+ dbResourceDictionaries.size() > 0);
+
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java
new file mode 100644
index 000000000..f81dd4165
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java
@@ -0,0 +1,155 @@
+/*
+ * 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.service.rs;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
+import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
+import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
+import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.List;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ServiceTemplateRestTest {
+
+ private static Logger log = LoggerFactory.getLogger(ServiceTemplateRestTest.class);
+ @Autowired
+ ModelTypeRest modelTypeRest;
+
+ @Autowired
+ private ServiceTemplateRest serviceTemplateRest;
+
+ @Test
+ public void test02EnrichServiceTemplate() throws Exception {
+ log.info("*********** test02EnrichServiceTemplate ***********************");
+ String file = "src/test/resources/enhance/enhance-template.json";
+
+ String serviceTemplateContent = FileUtils.readFileToString(new File(file), Charset.defaultCharset());
+
+ ServiceTemplate serviceTemplate = JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
+
+ serviceTemplate = serviceTemplateRest.enrichServiceTemplate(serviceTemplate);
+
+ String enhancedFile = "src/test/resources/enhance/enhanced-template.json";
+
+ FileUtils.write(new File(enhancedFile),
+ JacksonUtils.getJson(serviceTemplate, true), Charset.defaultCharset());
+
+ Assert.assertNotNull("Failed to get Enriched Blueprints, Return object is Null", serviceTemplate);
+ Assert.assertNotNull("Failed to get Enriched Blueprints Data Type, Return object is Null",
+ serviceTemplate.getDataTypes());
+ Assert.assertNotNull("Failed to get Enriched Blueprints Node Type, Return object is Null",
+ serviceTemplate.getNodeTypes());
+ log.trace("Enriched Service Template :\n" + JacksonUtils.getJson(serviceTemplate, true));
+ }
+
+ @Test
+ public void test03ValidateServiceTemplate() throws Exception {
+ log.info("*********** test03ValidateServiceTemplate *******************************************");
+ String enhancedFile = "src/test/resources/enhance/enhanced-template.json";
+ String serviceTemplateContent = FileUtils.readFileToString(new File(enhancedFile), Charset.defaultCharset());
+
+ ServiceTemplate serviceTemplate =
+ JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
+
+ serviceTemplate = serviceTemplateRest.validateServiceTemplate(serviceTemplate);
+
+ Assert.assertNotNull("Failed to validate Service Template, Return object is Null", serviceTemplate);
+ Assert.assertNotNull("Failed to get Service Template Data Type, Return object is Null",
+ serviceTemplate.getDataTypes());
+ Assert.assertNotNull("Failed to get Service Template Node Type, Return object is Null",
+ serviceTemplate.getNodeTypes());
+
+ log.trace("Validated Service Template :\n" + JacksonUtils.getJson(serviceTemplate, true));
+
+ }
+
+
+ @Test
+ public void test04GenerateResourceAssignments() throws Exception {
+ log.info("*********** test04GenerateResourceAssignments *******************************************");
+ ConfigModelContent baseConfigConfigModelContent = new ConfigModelContent();
+ String baseConfigContent = FileUtils.readFileToString(new File("load/blueprints/vrr-test/Templates/base-config-template.vtl")
+ , Charset.defaultCharset());
+ baseConfigConfigModelContent.setName("base-config-template");
+ baseConfigConfigModelContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TEMPLATE);
+ baseConfigConfigModelContent.setContent(baseConfigContent);
+
+ List<ResourceAssignment> resourceAssignments =
+ serviceTemplateRest.generateResourceAssignments(baseConfigConfigModelContent);
+
+ Assert.assertNotNull("Failed to get ResourceAssignments, Return object is Null", resourceAssignments);
+ Assert.assertTrue("Failed to get ResourceAssignments count", resourceAssignments.size() > 0);
+
+ log.trace("Validated Service Template :\n" + JacksonUtils.getJson(resourceAssignments, true));
+
+
+ }
+
+ @Test
+ public void test05AutoMap() throws Exception {
+ log.info("*********** test05AutoMap *******************************************");
+
+ String resourceassignmentContent = FileUtils.readFileToString(
+ new File("src/test/resources/resourcedictionary/automap.json"), Charset.defaultCharset());
+ List<ResourceAssignment> batchResourceAssignment =
+ JacksonUtils.getListFromJson(resourceassignmentContent, ResourceAssignment.class);
+ AutoMapResponse autoMapResponse = serviceTemplateRest.autoMap(batchResourceAssignment);
+
+ Assert.assertNotNull("Failed to get ResourceAssignments, Return object is Null",
+ autoMapResponse.getResourceAssignments());
+ Assert.assertNotNull("Failed to get Data Dictionary from ResourceAssignments",
+ autoMapResponse.getDataDictionaries());
+ Assert.assertTrue("Failed to get ResourceAssignments count",
+ CollectionUtils.isNotEmpty(autoMapResponse.getDataDictionaries()));
+
+ List<ResourceAssignment> autoMappedResourceAssignment = autoMapResponse.getResourceAssignments();
+ autoMappedResourceAssignment.forEach(resourceAssignment -> {
+ if ("bundle-id".equals(resourceAssignment.getName())) {
+ Assert.assertEquals("Failed to assign default first source", "db",
+ resourceAssignment.getDictionarySource());
+ }
+ });
+
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtilsTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtilsTest.java
new file mode 100644
index 000000000..b38dd6de1
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtilsTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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.service.utils;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+
+public class ConfigModelUtilsTest {
+
+ @Test
+ public void testConfigModel() throws Exception {
+
+ ConfigModel configModel = ConfigModelUtils.getConfigModel("load/blueprints/vrr-test");
+ Assert.assertNotNull("Failed to prepare config model", configModel);
+ Assert.assertTrue("Failed to prepare config model contents", CollectionUtils.isNotEmpty(configModel.getConfigModelContents()));
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties
new file mode 100644
index 000000000..a13e16841
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties
@@ -0,0 +1,67 @@
+#
+# 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.
+#
+
+info.build.artifact=@project.artifactId@
+info.build.name=@project.name@
+info.build.description=@project.description@
+info.build.version=@project.version@
+info.build.groupId=@project.groupId@
+logging.level.root=info
+
+server.contextPath=/
+server.servlet-path=/
+spring.jersey.application-path=/api/controller-blueprints/v1
+server.routingPath=/api
+
+
+mots.application.acronym=MOTS_ID
+platform.identifier=AJSC7_JERSEY
+#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+
+#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex
+
+
+#The max number of active threads in this pool
+server.tomcat.max-threads=200
+#The minimum number of threads always kept alive
+server.tomcat.min-Spare-Threads=25
+#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads
+server.tomcat.max-idle-time=60000
+
+#for changing the tomcat port...
+#server.port=8081
+
+
+
+#Servlet context parameters
+server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
+
+# make this true for AAF authentication and place cadi.properties into etc folder
+aaf.enabled=true
+
+# set to true to enable version proxy
+#ivp.enabled=false
+
+spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS = false
+
+
+logging.level.org.springframework.web=INFO
+logging.level.org.hibernate.SQL=warn
+logging.level.org.hibernate.type.descriptor.sql=debug
+
+
+blueprints.load.initial-data=true
+blueprints.load.path=load \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
new file mode 100644
index 000000000..8b4fd9d3a
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
@@ -0,0 +1,345 @@
+{
+ "metadata": {
+ "template_author": "Brinda Santh",
+ "template_name": "enhance-template",
+ "template_version": "1.0.0",
+ "service-type": "Sample Service",
+ "release": "1806",
+ "vnf-type": "VPE"
+ },
+ "topology_template": {
+ "inputs": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "node_templates": {
+ "vpe-netconf-device": {
+ "capabilities": {
+ "netconf": {
+ "properties": {
+ "login-key": "sdnc",
+ "login-account": "sndc-local",
+ "source": "local",
+ "target-ip-address": "{\"get_attribute\":\"lo0-local-ipv4-address\"}",
+ "port-number": 22,
+ "connection-time-out": 30
+ }
+ }
+ },
+ "type": "vnf-netconf-device"
+ },
+ "activate-netconf-component": {
+ "capabilities": {
+ "component-node": {}
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vpe-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": "{ \"get_input\" : \"action-name\" }",
+ "template_name": "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
+ "resource-type": "vnf-type",
+ "request-id": "{ \"get_input\" : \"request-id\" }",
+ "resource-id": "{ \"get_input\" : \"hostname\" }",
+ "execution-script": "execution-script"
+ },
+ "outputs": {
+ "response-data": "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",
+ "status": "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"
+ },
+ "implementation" : {
+ "primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
+ }
+ }
+ }
+ }
+ },
+ "type": "component-netconf-executor"
+ },
+ "resource-assignment-ra-component": {
+ "capabilities": {
+ "component-node": {}
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "template-names": [
+ "base-config-template",
+ "licence-template"
+ ],
+ "action-name": "{ \"get_input\" : \"action-name\" }",
+ "service-template-name": "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
+ "resource-type": "vnf-type",
+ "request-id": "{ \"get_input\" : \"request-id\" }",
+ "resource-id": "{ \"get_input\" : \"hostname\" }"
+ },
+ "outputs": {
+ "resource-assignment-params": "success",
+ "status": "status"
+ }
+ }
+ }
+ }
+ },
+ "type": "component-resource-assignment"
+ },
+ "resource-assignment-action": {
+ "properties": {
+ "mode": "sync",
+ "version": "LATEST",
+ "is-start-flow": "false"
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "resource-assignment-ra-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {},
+ "content": {
+ "properties": {
+ "type": "json"
+ }
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {
+ "inputs": {
+ "params": []
+ }
+ }
+ }
+ }
+ },
+ "type": "dg-resource-assignment"
+ },
+ "activate-action": {
+ "properties": {
+ "mode": "sync",
+ "version": "LATEST",
+ "is-start-flow": "false"
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "activate-netconf-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {},
+ "content": {
+ "properties": {
+ "type": "json"
+ }
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {
+ "inputs": {
+ "params": []
+ }
+ }
+ }
+ }
+ },
+ "type": "dg-activate-netconf"
+ },
+ "base-config-template": {
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://base-config-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "bundle-mac",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "string",
+ "status": "",
+ "constraints": [
+ {}
+ ],
+ "entry_schema": {
+ "type": ""
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "bundle-mac",
+ "dictionary-source": "db",
+ "dependencies": [
+ "hostname"
+ ],
+ "version": 0
+ },
+ {
+ "name": "wan-aggregate-ipv4-addresses",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "list",
+ "status": "",
+ "constraints": [
+ {}
+ ],
+ "entry_schema": {
+ "type": "dt-v4-aggregate"
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "wan-aggregate-ipv4-addresses",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "service-instance-id",
+ "oam-network-role",
+ "oam-v4-ip-type ",
+ "oam-vm-type"
+ ],
+ "version": 0
+ },
+ {
+ "name": "hostname",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "hostname",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ },
+ {
+ "name": "service",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ },
+ {
+ "name": "service-instance-id",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ }
+ ]
+ }
+ }
+ },
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "type": "artifact-config-template"
+ },
+ "licence-template": {
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://licence-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "licenses",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "list",
+ "status": "",
+ "constraints": [
+ {}
+ ],
+ "entry_schema": {
+ "type": "dt-license-key"
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "licenses",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "service-instance-id"
+ ],
+ "version": 0
+ },
+ {
+ "name": "service-instance-id",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ }
+ ]
+ }
+ }
+ },
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "type": "artifact-config-template"
+ }
+ }
+ },
+ "node_types": {
+ },
+ "data_types": {
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
new file mode 100644
index 000000000..18f499250
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
@@ -0,0 +1,824 @@
+{
+ "metadata" : {
+ "template_author" : "Brinda Santh",
+ "template_name" : "enhance-template",
+ "template_version" : "1.0.0",
+ "service-type" : "Sample Service",
+ "release" : "1806",
+ "vnf-type" : "VPE"
+ },
+ "tosca_definitions_version" : "controller_blueprint_1_0_0",
+ "artifact_types" : { },
+ "data_types" : {
+ "dt-v4-aggregate" : {
+ "description" : "This is dt-v4-aggregate Data Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "ipv4-address" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "ipv4-plen" : {
+ "required" : false,
+ "type" : "integer"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ },
+ "dt-license-key" : {
+ "description" : "This is dt-plicense-key Data Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "license-key" : {
+ "required" : true,
+ "type" : "string"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ },
+ "datatype-resource-assignment" : {
+ "description" : "This is Resource Assignment Data Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "property" : {
+ "required" : true,
+ "type" : "datatype-property"
+ },
+ "input-param" : {
+ "required" : true,
+ "type" : "boolean"
+ },
+ "dictionary-name" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "dictionary-source" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "dependencies" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "status" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "message" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "updated-date" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "updated-by" : {
+ "required" : false,
+ "type" : "string"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ },
+ "datatype-property" : {
+ "description" : "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
+ "version" : "1.0.0",
+ "properties" : {
+ "type" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "description" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "required" : {
+ "required" : false,
+ "type" : "boolean"
+ },
+ "default" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "entry_schema" : {
+ "required" : false,
+ "type" : "string"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ },
+ "dt-resource-assignment-request" : {
+ "description" : "This is Dynamic Data type definition generated from resource mapping for the config template name base-config-template.",
+ "version" : "1.0.0",
+ "properties" : {
+ "bundle-mac" : {
+ "description" : "",
+ "required" : true,
+ "type" : "string",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : ""
+ }
+ },
+ "hostname" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "licenses" : {
+ "description" : "",
+ "required" : true,
+ "type" : "list",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : "dt-license-key"
+ }
+ },
+ "wan-aggregate-ipv4-addresses" : {
+ "description" : "",
+ "required" : true,
+ "type" : "list",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : "dt-v4-aggregate"
+ }
+ },
+ "service" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "service-instance-id" : {
+ "required" : true,
+ "type" : "string"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Dynamic"
+ }
+ },
+ "node_types" : {
+ "dg-resource-assignment" : {
+ "description" : "This is Resource Assignment Directed Graph",
+ "version" : "1.0.0",
+ "properties" : {
+ "mode" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "sync"
+ },
+ "version" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "LATEST"
+ },
+ "is-start-flow" : {
+ "required" : false,
+ "type" : "boolean",
+ "default" : "false"
+ }
+ },
+ "capabilities" : {
+ "dg-node" : {
+ "type" : "tosca.capabilities.Node"
+ },
+ "content" : {
+ "type" : "tosca.capability.Content",
+ "properties" : {
+ "type" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "json"
+ },
+ "content" : {
+ "required" : false,
+ "type" : "string"
+ }
+ }
+ }
+ },
+ "requirements" : {
+ "component-dependency" : {
+ "capability" : "component-node",
+ "node" : "component-resource-assignment",
+ "relationship" : "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces" : {
+ "CONFIG" : {
+ "operations" : {
+ "ResourceAssignment" : {
+ "inputs" : {
+ "params" : {
+ "required" : false,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.DG"
+ },
+ "component-resource-assignment" : {
+ "description" : "This is Resource Assignment Component API",
+ "version" : "1.0.0",
+ "capabilities" : {
+ "component-node" : {
+ "type" : "tosca.capabilities.Node"
+ }
+ },
+ "interfaces" : {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "service-template-name" : {
+ "description" : "Service Template Name.",
+ "required" : true,
+ "type" : "string"
+ },
+ "service-template-version" : {
+ "description" : "Service Template Version.",
+ "required" : true,
+ "type" : "string"
+ },
+ "resource-type" : {
+ "description" : "Request type.",
+ "required" : true,
+ "type" : "string"
+ },
+ "template-names" : {
+ "description" : "Name of the artifact Node Templates, to get the template Content.",
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "request-id" : {
+ "description" : "Request Id, Unique Id for the request.",
+ "required" : true,
+ "type" : "string"
+ },
+ "resource-id" : {
+ "description" : "Resource Id.",
+ "required" : true,
+ "type" : "string"
+ },
+ "action-name" : {
+ "description" : "Action Name of the process",
+ "required" : true,
+ "type" : "string"
+ }
+ },
+ "outputs" : {
+ "resource-assignment-params" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "status" : {
+ "required" : true,
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.Component"
+ },
+ "artifact-config-template" : {
+ "description" : "This is Configuration Velocity Template",
+ "version" : "1.0.0",
+ "properties" : {
+ "action-names" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ }
+ },
+ "capabilities" : {
+ "content" : {
+ "type" : "tosca.capability.Content",
+ "properties" : {
+ "content" : {
+ "required" : true,
+ "type" : "string"
+ }
+ }
+ },
+ "mapping" : {
+ "type" : "tosca.capability.Mapping",
+ "properties" : {
+ "mapping" : {
+ "required" : false,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "datatype-resource-assignment"
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.Artifact"
+ },
+ "vnf-netconf-device" : {
+ "description" : "This is VNF Device with Netconf Capability",
+ "version" : "1.0.0",
+ "capabilities" : {
+ "netconf" : {
+ "type" : "tosca.capability.Netconf",
+ "properties" : {
+ "login-key" : {
+ "required" : true,
+ "type" : "string",
+ "default" : "sdnc"
+ },
+ "login-account" : {
+ "required" : true,
+ "type" : "string",
+ "default" : "sdnc-tacacs"
+ },
+ "source" : {
+ "required" : true,
+ "type" : "string",
+ "default" : "npm"
+ },
+ "target-ip-address" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "port-number" : {
+ "required" : true,
+ "type" : "integer",
+ "default" : 830
+ },
+ "connection-time-out" : {
+ "required" : false,
+ "type" : "integer",
+ "default" : 30
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.Vnf"
+ },
+ "component-netconf-executor" : {
+ "description" : "This is Netconf Transaction Configuration Component API",
+ "version" : "1.0.0",
+ "capabilities" : {
+ "component-node" : {
+ "type" : "tosca.capabilities.Node"
+ }
+ },
+ "requirements" : {
+ "netconf-connection" : {
+ "capability" : "netconf",
+ "node" : "vnf-netconf-device",
+ "relationship" : "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces" : {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "request-id" : {
+ "description" : "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required" : true,
+ "type" : "string"
+ },
+ "service-template-name" : {
+ "description" : "Service Template Name",
+ "required" : true,
+ "type" : "string"
+ },
+ "service-template-version" : {
+ "description" : "Service Template Version",
+ "required" : true,
+ "type" : "string"
+ },
+ "action-name" : {
+ "description" : "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required" : false,
+ "type" : "string"
+ },
+ "resource-type" : {
+ "description" : "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required" : false,
+ "type" : "string"
+ },
+ "resource-id" : {
+ "description" : "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required" : false,
+ "type" : "string"
+ },
+ "reservation-id" : {
+ "description" : "Reservation Id used to send to NPM",
+ "required" : false,
+ "type" : "string"
+ },
+ "execution-script" : {
+ "description" : "Python Script to Execute for this Component action, It should refer any one of Prython Artifact Definition for this Node Template.",
+ "required" : true,
+ "type" : "string"
+ }
+ },
+ "outputs" : {
+ "response-data" : {
+ "description" : "Execution Response Data in JSON format.",
+ "required" : false,
+ "type" : "string"
+ },
+ "status" : {
+ "description" : "Status of the Component Execution ( success or failure )",
+ "required" : true,
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.Component"
+ },
+ "dg-activate-netconf" : {
+ "description" : "This is Download Netconf Directed Graph",
+ "version" : "1.0.0",
+ "properties" : {
+ "mode" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "sync"
+ },
+ "version" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "LATEST"
+ },
+ "is-start-flow" : {
+ "required" : false,
+ "type" : "boolean",
+ "default" : "false"
+ }
+ },
+ "capabilities" : {
+ "dg-node" : {
+ "type" : "tosca.capabilities.Node"
+ },
+ "content" : {
+ "type" : "tosca.capability.Content",
+ "properties" : {
+ "type" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "json"
+ },
+ "content" : {
+ "required" : true,
+ "type" : "string"
+ }
+ }
+ }
+ },
+ "requirements" : {
+ "component-dependency" : {
+ "capability" : "component-node",
+ "node" : "component-netconf-executor",
+ "relationship" : "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces" : {
+ "CONFIG" : {
+ "operations" : {
+ "ActivateNetconf" : {
+ "inputs" : {
+ "params" : {
+ "required" : false,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.DG"
+ }
+ },
+ "topology_template" : {
+ "inputs" : {
+ "request-id" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "service-instance-id" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "scope-type" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "action-name" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "hostname" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "resource-assignment-request" : {
+ "description" : "This is Dynamic Data type for the receipe resource-assignment-action.",
+ "required" : false,
+ "type" : "dt-resource-assignment-request"
+ }
+ },
+ "node_templates" : {
+ "vpe-netconf-device" : {
+ "type" : "vnf-netconf-device",
+ "capabilities" : {
+ "netconf" : {
+ "properties" : {
+ "login-key" : "sdnc",
+ "login-account" : "sndc-local",
+ "source" : "local",
+ "target-ip-address" : "{\"get_attribute\":\"lo0-local-ipv4-address\"}",
+ "port-number" : 22,
+ "connection-time-out" : 30
+ }
+ }
+ }
+ },
+ "activate-netconf-component" : {
+ "type" : "component-netconf-executor",
+ "capabilities" : {
+ "component-node" : { }
+ },
+ "requirements" : {
+ "netconf-connection" : {
+ "capability" : "netconf",
+ "node" : "vpe-netconf-device",
+ "relationship" : "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces" : {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode" : {
+ "operations" : {
+ "process" : {
+ "implementation" : {
+ "primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
+ },
+ "inputs" : {
+ "action-name" : "{ \"get_input\" : \"action-name\" }",
+ "template_name" : "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version" : "{ \"get_attribute\" : \"service-template-version\" }",
+ "resource-type" : "vnf-type",
+ "request-id" : "{ \"get_input\" : \"request-id\" }",
+ "resource-id" : "{ \"get_input\" : \"hostname\" }",
+ "execution-script" : "execution-script"
+ },
+ "outputs" : {
+ "response-data" : "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",
+ "status" : "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"
+ }
+ }
+ }
+ }
+ }
+ },
+ "resource-assignment-ra-component" : {
+ "type" : "component-resource-assignment",
+ "capabilities" : {
+ "component-node" : { }
+ },
+ "interfaces" : {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "template-names" : [ "base-config-template", "licence-template" ],
+ "action-name" : "{ \"get_input\" : \"action-name\" }",
+ "service-template-name" : "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version" : "{ \"get_attribute\" : \"service-template-version\" }",
+ "resource-type" : "vnf-type",
+ "request-id" : "{ \"get_input\" : \"request-id\" }",
+ "resource-id" : "{ \"get_input\" : \"hostname\" }"
+ },
+ "outputs" : {
+ "resource-assignment-params" : "success",
+ "status" : "status"
+ }
+ }
+ }
+ }
+ }
+ },
+ "resource-assignment-action" : {
+ "type" : "dg-resource-assignment",
+ "properties" : {
+ "mode" : "sync",
+ "version" : "LATEST",
+ "is-start-flow" : "false"
+ },
+ "capabilities" : {
+ "dg-node" : { },
+ "content" : {
+ "properties" : {
+ "type" : "json"
+ }
+ }
+ },
+ "requirements" : {
+ "component-dependency" : {
+ "capability" : "component-node",
+ "node" : "resource-assignment-ra-component",
+ "relationship" : "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces" : {
+ "CONFIG" : {
+ "operations" : {
+ "ResourceAssignment" : {
+ "inputs" : {
+ "params" : [ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "activate-action" : {
+ "type" : "dg-activate-netconf",
+ "properties" : {
+ "mode" : "sync",
+ "version" : "LATEST",
+ "is-start-flow" : "false"
+ },
+ "capabilities" : {
+ "dg-node" : { },
+ "content" : {
+ "properties" : {
+ "type" : "json"
+ }
+ }
+ },
+ "requirements" : {
+ "component-dependency" : {
+ "capability" : "component-node",
+ "node" : "activate-netconf-component",
+ "relationship" : "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces" : {
+ "CONFIG" : {
+ "operations" : {
+ "ActivateNetconf" : {
+ "inputs" : {
+ "params" : [ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "base-config-template" : {
+ "type" : "artifact-config-template",
+ "properties" : {
+ "action-names" : [ "resource-assignment-action" ]
+ },
+ "capabilities" : {
+ "content" : {
+ "properties" : {
+ "content" : "db://base-config-template"
+ }
+ },
+ "mapping" : {
+ "properties" : {
+ "mapping" : [ {
+ "name" : "bundle-mac",
+ "property" : {
+ "description" : "",
+ "required" : true,
+ "type" : "string",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : ""
+ }
+ },
+ "input-param" : false,
+ "dictionary-name" : "bundle-mac",
+ "dictionary-source" : "db",
+ "dependencies" : [ "hostname" ],
+ "version" : 0
+ }, {
+ "name" : "wan-aggregate-ipv4-addresses",
+ "property" : {
+ "description" : "",
+ "required" : true,
+ "type" : "list",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : "dt-v4-aggregate"
+ }
+ },
+ "input-param" : false,
+ "dictionary-name" : "wan-aggregate-ipv4-addresses",
+ "dictionary-source" : "mdsal",
+ "dependencies" : [ "service-instance-id", "oam-network-role", "oam-v4-ip-type ", "oam-vm-type" ],
+ "version" : 0
+ }, {
+ "name" : "hostname",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "hostname",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ }, {
+ "name" : "service",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "service",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ }, {
+ "name" : "service-instance-id",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "service-instance-id",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ } ]
+ }
+ }
+ }
+ },
+ "licence-template" : {
+ "type" : "artifact-config-template",
+ "properties" : {
+ "action-names" : [ "resource-assignment-action" ]
+ },
+ "capabilities" : {
+ "content" : {
+ "properties" : {
+ "content" : "db://licence-template"
+ }
+ },
+ "mapping" : {
+ "properties" : {
+ "mapping" : [ {
+ "name" : "licenses",
+ "property" : {
+ "description" : "",
+ "required" : true,
+ "type" : "list",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : "dt-license-key"
+ }
+ },
+ "input-param" : false,
+ "dictionary-name" : "licenses",
+ "dictionary-source" : "mdsal",
+ "dependencies" : [ "service-instance-id" ],
+ "version" : 0
+ }, {
+ "name" : "service-instance-id",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "service-instance-id",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ } ]
+ }
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json
new file mode 100644
index 000000000..a85e71550
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json
@@ -0,0 +1,11 @@
+[
+ {
+ "name": "action-name"
+ },
+ {
+ "name": "v4-ip-type"
+ },
+ {
+ "name": "bundle-id"
+ }
+] \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json
new file mode 100644
index 000000000..2b392054d
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json
@@ -0,0 +1,19 @@
+{
+ "name": "v4-aggregat-list",
+ "description": "This collection v4-aggregate list",
+ "valid-values": null,
+ "sample-value": null,
+ "updated-by": "Brinda Santh (bs2796)",
+ "resource-type": "ONAP",
+ "resource-path": "/v4-aggregat-list",
+ "data-type": "list",
+ "entry-schema": "dt-v4-aggregate",
+ "tags": null,
+ "default": null,
+ "source": {
+ "input": {
+
+ }
+ },
+ "candidate-dependency": null
+} \ No newline at end of file