aboutsummaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
authorAlexis de Talhouët <adetalhouet89@gmail.com>2019-03-26 09:49:13 -0400
committerAlexis de Talhouët <adetalhouet89@gmail.com>2019-03-26 09:49:13 -0400
commit72d22a4339db09824d46746dacbba1e141763dc0 (patch)
tree7fbfea4b81afca0bc0c95e5d4b810f236f4dea29 /ms
parentef6983b670796becfa66c69075c1829e8f9aef4b (diff)
Migrate ccdsk/apps to ccsdk/cds
Change-Id: I020a2ccec4e691717f888e8bd2afec91a7c4e987 Issue-ID: CCSDK-1178 Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/.gitignore32
-rwxr-xr-xms/blueprintsprocessor/README.md0
-rwxr-xr-xms/blueprintsprocessor/application/opt/app/onap/config/application.properties0
-rwxr-xr-xms/blueprintsprocessor/application/pom.xml181
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintGRPCServer.java67
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintHttpServer.java55
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplication.java39
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java63
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/WebConfig.java78
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/AuthenticationManager.java40
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/BasicAuthServerInterceptor.java97
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/SecurityConfiguration.java59
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/SecurityContextRepository.java75
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application-dev.properties48
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application.properties51
-rw-r--r--ms/blueprintsprocessor/application/src/main/resources/logback.xml36
-rw-r--r--ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java57
-rw-r--r--ms/blueprintsprocessor/application/src/test/resources/application.properties40
-rw-r--r--ms/blueprintsprocessor/application/src/test/resources/logback-test.xml35
-rwxr-xr-xms/blueprintsprocessor/distribution/pom.xml183
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml30
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/docker/Dockerfile18
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/docker/distribution.xml50
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/docker/run.source12
-rw-r--r--ms/blueprintsprocessor/distribution/src/main/docker/startService.sh8
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/pom.xml37
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/CliExecutorConfiguration.kt22
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/api/CliExecutorService.kt22
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImpl.kt25
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImplTest.kt38
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/test/resources/logback-test.xml35
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/pom.xml54
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt75
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/JsonParserService.kt24
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt70
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt31
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt43
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfException.kt24
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfMessage.kt74
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfRpcService.kt142
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfSession.kt86
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt21
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt243
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImpl.kt220
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt287
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt90
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt404
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt79
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfSessionImplTest.kt111
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt124
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/mocks/NetconfDeviceSimulator.kt62
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/mocks/NetconfSubsystemFactory.kt125
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt306
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/application-test.properties32
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml35
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/payload/requests/sample-activate-request.json31
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/running-config-input.json15
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/sample-activate-request.json28
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/sample-resourceresolution-request.json28
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/response/get-config-123456.xml10
-rwxr-xr-xms/blueprintsprocessor/functions/pom.xml75
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/pom.xml38
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt105
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt68
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt32
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/resources/logback-test.xml35
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json31
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/pom.xml58
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentProcessorScriptConfiguration.kt42
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt88
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt62
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConfiguration.kt26
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt31
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt228
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt79
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionRepository.kt25
-rwxr-xr-xms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResult.kt69
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt64
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt104
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt190
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt65
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt68
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt115
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt204
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt159
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt79
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt91
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt126
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties43
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml35
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/capability/jython-resource-definitions.json19
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json15
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json35
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json27
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json26
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json22
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/inputs/input.json18
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/requests/sample-resourceresolution-request.json32
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/pom.xml42
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt73
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt58
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt29
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/scripts/InternalSimpleRestconf.cba.kts82
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt102
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/application-test.properties32
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/logback-test.xml35
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/pom.xml71
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt56
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibData.kt52
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt44
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt114
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt105
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt59
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt55
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt27
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt82
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt84
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt101
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt22
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt21
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt52
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt49
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties27
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/logback-test.xml35
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zipbin9302 -> 0 bytes
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml77
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt63
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt102
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt46
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt187
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/DmaapClientProperties.kt46
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt62
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/resources/event.properties26
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/apps/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt215
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/resources/logback-test.xml40
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/resources/preferredRoute.txt22
-rwxr-xr-xms/blueprintsprocessor/modules/commons/pom.xml77
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/pom.xml37
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt49
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt29
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt123
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt68
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/utils/PayloadUtils.kt47
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/resources/application.properties16
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintPropertiesTest.kt20
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml46
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt39
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibData.kt55
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt58
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt129
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BlueprintWebClientService.kt115
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/DME2ProxyRestClientService.kt29
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/SSLBasicAuthRestClientService.kt72
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt47
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/utils/WebClientUtils.kt35
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/resources/application.properties16
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt58
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/RestClientServiceTest.kt83
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/resources/logback-test.xml35
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/pom.xml81
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml30
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java48
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionControllerTest.java22
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml64
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt115
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt64
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt67
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt142
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt130
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/Utils.kt59
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt27
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt116
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt124
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt89
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/Mock.kt62
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt132
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt44
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties32
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json23
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/sample-payload.json10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml35
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zipbin9302 -> 0 bytes
-rw-r--r--ms/blueprintsprocessor/modules/outbounds/pom.xml30
-rw-r--r--ms/blueprintsprocessor/modules/pom.xml69
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/pom.xml70
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt148
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt50
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt87
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt131
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintPythonHost.kt46
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintPythonInterpreterProxy.kt40
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/PythonExecutorConfiguration.kt68
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt57
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json18
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json20
-rwxr-xr-xms/blueprintsprocessor/modules/services/pom.xml71
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/pom.xml46
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt72
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt52
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt143
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt49
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt70
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt72
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt31
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt69
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt35
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt54
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt99
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt57
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt82
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json23
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json23
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml35
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml564
-rwxr-xr-xms/blueprintsprocessor/pom.xml50
-rw-r--r--ms/cds-sdc-listener/application/pom.xml73
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerApplication.java21
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClient.java81
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfiguration.java137
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerDto.java23
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerNotificationCallback.java69
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/exceptions/CdsSdcListenerException.java27
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerService.java18
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerServiceImpl.java27
-rw-r--r--ms/cds-sdc-listener/application/src/main/resources/application.yml17
-rw-r--r--ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClientTest.java71
-rw-r--r--ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfigurationTest.java41
-rw-r--r--ms/cds-sdc-listener/distribution/pom.xml106
-rw-r--r--ms/cds-sdc-listener/pom.xml29
-rw-r--r--ms/controllerblueprints/.gitignore25
-rwxr-xr-xms/controllerblueprints/README.md13
-rw-r--r--ms/controllerblueprints/README_FIRST.txt0
-rw-r--r--ms/controllerblueprints/application/pom.xml254
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java28
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplication.java42
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java61
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java155
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebConfig.java50
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/filters/ApplicationLoggingFilter.java98
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java62
-rwxr-xr-xms/controllerblueprints/application/src/main/resources/application-dev.properties70
-rwxr-xr-xms/controllerblueprints/application/src/main/resources/application.properties75
-rw-r--r--ms/controllerblueprints/application/src/main/resources/logback.xml44
-rw-r--r--ms/controllerblueprints/application/src/main/resources/sql/data.sql0
-rw-r--r--ms/controllerblueprints/application/src/main/resources/sql/schema-local.sql83
-rw-r--r--ms/controllerblueprints/application/src/main/resources/sql/schema.sql78
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java62
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java49
-rwxr-xr-xms/controllerblueprints/application/src/test/resources/application.properties58
-rw-r--r--ms/controllerblueprints/application/src/test/resources/logback.xml35
-rwxr-xr-xms/controllerblueprints/distribution/pom.xml184
-rwxr-xr-xms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml30
-rwxr-xr-xms/controllerblueprints/distribution/src/main/docker/Dockerfile18
-rwxr-xr-xms/controllerblueprints/distribution/src/main/docker/distribution.xml51
-rwxr-xr-xms/controllerblueprints/distribution/src/main/docker/run.source13
-rwxr-xr-xms/controllerblueprints/distribution/src/main/docker/startService.sh8
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-bpmn-camunda.json8
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-directed-graph.json9
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-mapping-resource.json8
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-script-python.json8
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-template-velocity.json8
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/tosca.artifacts.Implementation.json5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-property.json27
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-resource-assignment.json46
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-license-key.json11
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-v4-aggregate.json15
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/tosca.datatypes.Credential.json31
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/artifact-config-template.json37
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-config-generator.json72
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-netconf-executor.json79
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-resource-assignment.json68
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-activate-netconf.json52
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-config-generator.json51
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assign-activate.json56
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assignment.json51
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Artifact.json5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Component.json5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.DG.json5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Vnf.json5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.component.Python.json5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/vnf-netconf-device.json42
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/pom.xml71
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt184
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintError.kt29
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintException.kt49
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintProcessorException.kt50
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt164
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt30
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt161
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/FileExtensionFunctions.kt83
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/common/ApplicationConstants.kt23
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/config/BluePrintLoadConfiguration.kt34
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintExpressionData.kt77
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt623
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BlueprintErrorCode.kt97
-rwxr-xr-xms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintCatalogService.kt59
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt142
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt47
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintScriptsService.kt28
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt26
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt39
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt165
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintChainedService.kt117
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt261
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt195
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt97
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt71
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt585
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateService.kt92
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt608
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt227
-rwxr-xr-xms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt122
-rwxr-xr-xms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt253
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt169
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt61
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtils.kt92
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt311
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtils.kt60
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ResourceResolverUtils.kt62
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt108
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtils.kt131
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory17
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt35
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt54
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt131
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt57
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt180
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt35
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt60
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt57
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt43
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt78
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtilsTest.kt33
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt36
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/componentnode/default.json100
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/alltype-data.json10
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json7
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json261
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment1.properties2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment2.properties2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/convert.json36
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/default.json16
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts44
-rwxr-xr-xms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data.json36
-rwxr-xr-xms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-template.vtl61
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/pom.xml60
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt56
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt154
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptingHost.kt94
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptsConfiguration.kt58
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptsServiceImpl.kt71
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript0
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt84
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts55
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts55
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/pom.xml62
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt97
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt35
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt88
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt35
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt82
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt295
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt168
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt92
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt112
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt78
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt104
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintValidationConfiguration.kt24
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt82
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt48
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt44
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt105
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt75
-rw-r--r--ms/controllerblueprints/modules/db-resources/pom.xml42
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt86
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelContentRepository.kt91
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelRepository.kt90
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt21
-rw-r--r--ms/controllerblueprints/modules/pom.xml88
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json31
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json18
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json18
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-primary-db.json44
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json61
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json5
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/address.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic-cloud-region.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic_clli.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/availability_zone_0.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json16
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json34
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/name_0.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json21
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_id.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/primary-db-source.json24
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json21
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json21
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json21
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/public_net_id.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/service-instance-id.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json21
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json21
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-id.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf_module_name.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json35
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json35
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_2.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-id.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json28
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json28
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json35
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_1.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json35
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_1.json17
-rw-r--r--ms/controllerblueprints/modules/resource-dict/pom.xml42
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt100
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt40
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt47
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt141
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt109
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt100
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java60
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java42
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt66
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java37
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java99
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt30
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json10
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json111
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json110
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json110
-rw-r--r--ms/controllerblueprints/modules/service/pom.xml72
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java56
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java210
-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/common/ErrorMessage.java75
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java185
-rwxr-xr-xms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/BlueprintModel.java284
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/BlueprintModelContent.java170
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/BlueprintModelSearch.java166
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaJsonNodeConverter.java40
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java39
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java171
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java158
-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/ControllerBlueprintModelSearchRepository.java69
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryRepository.java69
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt105
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt60
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelController.kt110
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt50
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeController.kt56
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryController.kt68
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt93
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt55
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt80
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTemplateEnhancerImpl.kt70
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTypeEnhancerImpl.kt154
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPolicyTypeEnhancerImpl.kt43
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt62
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintServiceTemplateEnhancerImpl.kt69
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt61
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTypeEnhancerServiceImpl.kt65
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt214
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt111
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt145
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt330
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ModelTypeHandler.kt116
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ResourceDictionaryHandler.kt148
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintCatalogLoadService.kt68
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt83
-rwxr-xr-xms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt112
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt150
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ResourceDictionaryLoadService.kt106
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/BluePrintsReactRepository.kt76
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt22
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt21
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.kt85
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepository.kt56
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt163
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.kt83
-rw-r--r--ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json862
-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.sql83
-rw-r--r--ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql78
-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/TestApplication.java34
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java127
-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/repository/ModelTypeReactRepositoryTest.java110
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java103
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelControllerTest.kt193
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeControllerTest.kt120
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryControllerTest.kt43
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/mock/MockFilePart.kt53
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt111
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt66
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.kt40
-rwxr-xr-xms/controllerblueprints/modules/service/src/test/resources/application.properties41
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json62
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json351
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json327
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/logback.xml40
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/model_type/data_type/datatype-property.json27
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json14
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json17
-rw-r--r--ms/controllerblueprints/parent/pom.xml451
-rw-r--r--ms/controllerblueprints/pom.xml45
-rw-r--r--ms/controllerblueprints/repoproject.txt1
-rw-r--r--ms/controllerblueprints/time.txt1
-rw-r--r--ms/pom.xml3
524 files changed, 0 insertions, 38884 deletions
diff --git a/ms/blueprintsprocessor/.gitignore b/ms/blueprintsprocessor/.gitignore
deleted file mode 100644
index 04f991d1..00000000
--- a/ms/blueprintsprocessor/.gitignore
+++ /dev/null
@@ -1,32 +0,0 @@
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-.classpath
-.settings/
-
-# Target dirs in all projects
-**/target-ide/*
-**/target/*
-**/logs/*
-**/tokens/*
-**/lib/cachedir/**
-
-# Added for Intellij IDEA IDE
-**/debug-logs/*
-**/.idea/*
-**/*.iml
-**/*.project
-**/.springBeans
-**/.directory
-
-**/transaction.log
-**/*versionsBackup
-**/blackDuckHub*
-**/*.jsonld
-/target-ide/
diff --git a/ms/blueprintsprocessor/README.md b/ms/blueprintsprocessor/README.md
deleted file mode 100755
index e69de29b..00000000
--- a/ms/blueprintsprocessor/README.md
+++ /dev/null
diff --git a/ms/blueprintsprocessor/application/opt/app/onap/config/application.properties b/ms/blueprintsprocessor/application/opt/app/onap/config/application.properties
deleted file mode 100755
index e69de29b..00000000
--- a/ms/blueprintsprocessor/application/opt/app/onap/config/application.properties
+++ /dev/null
diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml
deleted file mode 100755
index 8757a036..00000000
--- a/ms/blueprintsprocessor/application/pom.xml
+++ /dev/null
@@ -1,181 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~ Modifications Copyright © 2019 Bell Canada.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
- </parent>
- <artifactId>application</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Application</name>
- <description>Blueprints Processor Application</description>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-devtools</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-security</artifactId>
- </dependency>
-
- <!-- North Bound -->
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>resource-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>python-executor</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>netconf-executor</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>restconf-executor</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>selfservice-api</artifactId>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <!--config and resource files -->
- <directory>${basedir}/etc</directory>
- <targetPath>${basedir}/target/etc</targetPath>
- <filtering>true</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
- <!--config and resource files -->
- <directory>${basedir}/src/main/resources</directory>
- <targetPath>${basedir}/target/src/main/resources</targetPath>
- <filtering>true</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <id>copy-dockerfile</id>
- <goals>
- <goal>copy-resources</goal>
- </goals><!-- here the phase you need -->
- <phase>validate</phase>
- <configuration>
- <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/docker</directory>
- <includes>
- <include>*</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>ant-test</id>
- <phase>package</phase>
- <configuration>
- <tasks>
- <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <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/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintGRPCServer.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintGRPCServer.java
deleted file mode 100644
index 3ac1a6e6..00000000
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintGRPCServer.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor;
-
-import io.grpc.Server;
-import io.grpc.ServerBuilder;
-import org.onap.ccsdk.apps.blueprintsprocessor.security.BasicAuthServerInterceptor;
-import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.BluePrintManagementGRPCHandler;
-import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.BluePrintProcessingGRPCHandler;
-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.context.ApplicationListener;
-import org.springframework.context.event.ContextRefreshedEvent;
-import org.springframework.stereotype.Component;
-
-@ConditionalOnProperty(name = "blueprintsprocessor.grpcEnable", havingValue = "true")
-@Component
-public class BlueprintGRPCServer implements ApplicationListener<ContextRefreshedEvent> {
-
- private static Logger log = LoggerFactory.getLogger(BlueprintGRPCServer.class);
-
- @Autowired
- private BluePrintProcessingGRPCHandler bluePrintProcessingGRPCHandler;
- @Autowired
- private BluePrintManagementGRPCHandler bluePrintManagementGRPCHandler;
- @Autowired
- private BasicAuthServerInterceptor authInterceptor;
-
- @Value("${blueprintsprocessor.grpcPort}")
- private Integer grpcPort;
-
- @Override
- public void onApplicationEvent(ContextRefreshedEvent event) {
- try {
- log.info("Starting Blueprint Processor GRPC Starting..");
- Server server = ServerBuilder
- .forPort(grpcPort)
- .intercept(authInterceptor)
- .addService(bluePrintProcessingGRPCHandler)
- .addService(bluePrintManagementGRPCHandler)
- .build();
-
- server.start();
- log.info("Blueprint Processor GRPC server started and ready to serve on port({})...", server.getPort());
- server.awaitTermination();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintHttpServer.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintHttpServer.java
deleted file mode 100644
index 9561b78d..00000000
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintHttpServer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-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.web.embedded.netty.NettyReactiveWebServerFactory;
-import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory;
-import org.springframework.boot.web.server.WebServer;
-import org.springframework.http.server.reactive.HttpHandler;
-import org.springframework.stereotype.Component;
-
-@Component
-public class BlueprintHttpServer {
-
- private static Logger log = LoggerFactory.getLogger(BlueprintHttpServer.class);
-
- @Value("${blueprintsprocessor.httpPort}")
- private Integer httpPort;
-
- @Autowired
- HttpHandler httpHandler;
-
- WebServer http;
-
- @PostConstruct
- public void start() {
- ReactiveWebServerFactory factory = new NettyReactiveWebServerFactory(httpPort);
- this.http = factory.getWebServer(this.httpHandler);
- this.http.start();
- }
-
- @PreDestroy
- public void stop() {
- this.http.stop();
- }
-}
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplication.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplication.java
deleted file mode 100644
index 3f8dc375..00000000
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplication.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.context.annotation.ComponentScan;
-
-/**
- * BlueprintProcessorApplication
- *
- * @author Brinda Santh 8/14/2018
- */
-@SpringBootApplication
-@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
-@ComponentScan(basePackages = {"org.onap.ccsdk.apps.controllerblueprints",
- "org.onap.ccsdk.apps.blueprintsprocessor"})
-public class BlueprintProcessorApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(BlueprintProcessorApplication.class, args);
- }
-}
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java
deleted file mode 100644
index 810480e9..00000000
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor;
-
-
-import org.springframework.context.annotation.Bean;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Contact;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-
-import java.util.Collections;
-
-/**
- * SwaggerConfig
- *
- * @author Brinda Santh 8/13/2018
- */
-//@Configuration
-//@EnableSwagger2
-@SuppressWarnings("unused")
-@Deprecated
-public class SwaggerConfig {
-
- @Bean
- public Docket api() {
- return new Docket(DocumentationType.SWAGGER_2)
- .select()
- .apis(RequestHandlerSelectors.any())
- .paths(PathSelectors.any())
- .build()
- .apiInfo(apiInfo());
- }
-
- private ApiInfo apiInfo() {
- return new ApiInfo(
- "Blueprints Processor API",
- "Controller blueprints processor API for VNF Selfservice.",
- "1.0.0",
- "Terms of service",
- new Contact("Brinda Santh", "www.onap.com", "bs2796@onap.com"),
- "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", Collections.emptyList());
- }
-
-
-}
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/WebConfig.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/WebConfig.java
deleted file mode 100644
index 47c7b722..00000000
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/WebConfig.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor;
-
-import org.onap.ccsdk.apps.blueprintsprocessor.security.AuthenticationManager;
-import org.onap.ccsdk.apps.blueprintsprocessor.security.SecurityContextRepository;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpMethod;
-import org.springframework.security.config.web.server.ServerHttpSecurity;
-import org.springframework.security.web.server.SecurityWebFilterChain;
-import org.springframework.web.reactive.config.CorsRegistry;
-import org.springframework.web.reactive.config.ResourceHandlerRegistry;
-import org.springframework.web.reactive.config.WebFluxConfigurationSupport;
-
-/**
- * WebConfig
- *
- * @author Brinda Santh 8/13/2018
- */
-@Configuration
-public class WebConfig extends WebFluxConfigurationSupport {
-
- @Autowired
- private AuthenticationManager authenticationManager;
-
- @Autowired
- private SecurityContextRepository securityContextRepository;
-
- @Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler("swagger-ui.html")
- .addResourceLocations("classpath:/META-INF/resources/");
-
- registry.addResourceHandler("/webjars/**")
- .addResourceLocations("classpath:/META-INF/resources/webjars/");
- }
-
- @Override
- public void addCorsMappings(CorsRegistry corsRegistry) {
- corsRegistry.addMapping("/**")
- .allowedOrigins("*")
- .allowedMethods("*")
- .allowedHeaders("*")
- .maxAge(3600);
- }
-
-
- @Bean
- public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) {
- return http.csrf().disable()
- .formLogin().disable()
- .httpBasic().disable()
- .authenticationManager(authenticationManager)
- .securityContextRepository(securityContextRepository)
- .authorizeExchange()
- .pathMatchers(HttpMethod.OPTIONS).permitAll()
- .anyExchange().authenticated()
- .and().build();
-
- }
-}
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/AuthenticationManager.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/AuthenticationManager.java
deleted file mode 100644
index 726be2ce..00000000
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/AuthenticationManager.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
-* limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.security;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.authentication.AuthenticationProvider;
-import org.springframework.security.authentication.ReactiveAuthenticationManager;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
-import reactor.core.publisher.Mono;
-
-@Configuration
-public class AuthenticationManager implements ReactiveAuthenticationManager {
-
- @Autowired
- private AuthenticationProvider authenticationProvider;
-
- @Override
- public Mono<Authentication> authenticate(Authentication authentication) {
- try {
- return Mono.just(authenticationProvider.authenticate(authentication));
- } catch (AuthenticationException e) {
- return Mono.error(e);
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/BasicAuthServerInterceptor.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/BasicAuthServerInterceptor.java
deleted file mode 100644
index db0bfce4..00000000
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/BasicAuthServerInterceptor.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.security;
-
-import com.google.common.base.Strings;
-import io.grpc.Metadata;
-import io.grpc.ServerCall;
-import io.grpc.ServerCallHandler;
-import io.grpc.ServerInterceptor;
-import io.grpc.Status;
-import java.nio.charset.StandardCharsets;
-import java.util.Base64;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Component;
-
-@Component
-public class BasicAuthServerInterceptor implements ServerInterceptor {
-
- private static Logger log = LoggerFactory.getLogger(BasicAuthServerInterceptor.class);
-
- @Autowired
- private AuthenticationManager authenticationManager;
-
-
- @Override
- public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
- ServerCall<ReqT, RespT> call,
- Metadata headers,
- ServerCallHandler<ReqT, RespT> next) {
- String authHeader = headers.get(Metadata.Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER));
-
- if (Strings.isNullOrEmpty(authHeader)) {
- throw Status.UNAUTHENTICATED.withDescription("Missing required authentication").asRuntimeException();
-
- }
-
- try {
- String[] tokens = decodeBasicAuth(authHeader);
- String username = tokens[0];
-
- log.info("Basic Authentication Authorization header found for user: {}", username);
-
- Authentication authRequest = new UsernamePasswordAuthenticationToken(username, tokens[1]);
- Authentication authResult = authenticationManager.authenticate(authRequest).block();
-
- log.info("Authentication success: {}", authResult);
-
- SecurityContextHolder.getContext().setAuthentication(authResult);
-
- } catch (AuthenticationException e) {
- SecurityContextHolder.clearContext();
-
- log.info("Authentication request failed: {}", e.getMessage());
-
- throw Status.UNAUTHENTICATED.withDescription(e.getMessage()).withCause(e).asRuntimeException();
- }
-
- return next.startCall(call, headers);
- }
-
- private String[] decodeBasicAuth(String authHeader) {
- String basicAuth;
- try {
- basicAuth = new String(Base64.getDecoder().decode(authHeader.substring(6).getBytes(StandardCharsets.UTF_8)),
- StandardCharsets.UTF_8);
- } catch (IllegalArgumentException | IndexOutOfBoundsException e) {
- throw new BadCredentialsException("Failed to decode basic authentication token");
- }
-
- int delim = basicAuth.indexOf(':');
- if (delim == -1) {
- throw new BadCredentialsException("Failed to decode basic authentication token");
- }
-
- return new String[]{basicAuth.substring(0, delim), basicAuth.substring(delim + 1)};
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/SecurityConfiguration.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/SecurityConfiguration.java
deleted file mode 100644
index 7ddc42cc..00000000
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/SecurityConfiguration.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.security;
-
-import java.util.Collections;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.authentication.AuthenticationProvider;
-import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.userdetails.User;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.security.provisioning.InMemoryUserDetailsManager;
-
-@Configuration
-public class SecurityConfiguration {
-
- @Value("${security.user.name}")
- private String username;
-
- @Value("${security.user.password}")
- private String password;
-
- @Bean
- public UserDetailsService inMemoryUserService() {
- UserDetails user = new User(username, password,
- Collections.singletonList(new SimpleGrantedAuthority("USER")));
- return new InMemoryUserDetailsManager(user);
- }
-
- @Bean
- public PasswordEncoder passwordEncoder() {
- return new BCryptPasswordEncoder();
- }
-
- @Bean
- public AuthenticationProvider inMemoryAuthenticationProvider() {
- DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
- provider.setUserDetailsService(inMemoryUserService());
- return provider;
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/SecurityContextRepository.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/SecurityContextRepository.java
deleted file mode 100644
index f9e184a1..00000000
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/security/SecurityContextRepository.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.security;
-
-import java.nio.charset.StandardCharsets;
-import java.util.Base64;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.server.reactive.ServerHttpRequest;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContext;
-import org.springframework.security.core.context.SecurityContextImpl;
-import org.springframework.security.web.server.context.ServerSecurityContextRepository;
-import org.springframework.stereotype.Component;
-import org.springframework.web.server.ServerWebExchange;
-import reactor.core.publisher.Mono;
-
-@Component
-public class SecurityContextRepository implements ServerSecurityContextRepository {
-
- @Autowired
- private AuthenticationManager authenticationManager;
-
- @Override
- public Mono<Void> save(ServerWebExchange swe, SecurityContext sc) {
- throw new UnsupportedOperationException("Not supported.");
- }
-
- @Override
- public Mono<SecurityContext> load(ServerWebExchange swe) {
- ServerHttpRequest request = swe.getRequest();
- String authHeader = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);
- if (authHeader != null && authHeader.startsWith("Basic")) {
- String[] tokens = decodeBasicAuth(authHeader);
- String username = tokens[0];
- String password = tokens[1];
- Authentication auth = new UsernamePasswordAuthenticationToken(username, password);
- return this.authenticationManager.authenticate(auth).map(SecurityContextImpl::new);
- } else {
- return Mono.empty();
- }
- }
-
- private String[] decodeBasicAuth(String authHeader) {
- String basicAuth;
- try {
- basicAuth = new String(Base64.getDecoder().decode(authHeader.substring(6).getBytes(StandardCharsets.UTF_8)),
- StandardCharsets.UTF_8);
- } catch (IllegalArgumentException | IndexOutOfBoundsException e) {
- throw new BadCredentialsException("Failed to decode basic authentication token");
- }
-
- int delim = basicAuth.indexOf(':');
- if (delim == -1) {
- throw new BadCredentialsException("Failed to decode basic authentication token");
- }
-
- return new String[]{basicAuth.substring(0, delim), basicAuth.substring(delim + 1)};
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
deleted file mode 100755
index e64dee2a..00000000
--- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Copyright � 2017-2018 AT&T Intellectual Property.
-#
-# Modifications Copyright © 2019 IBM, Bell Canada.
-#
-# 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.
-#
-#logging.level.web=DEBUG
-
-# Web server config
-server.port=8080
-
-blueprintsprocessor.grpcEnable=false
-blueprintsprocessor.httpPort=8080
-blueprintsprocessor.grpcPort=9111
-# Blueprint Processor File Execution and Handling Properties
-blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
-# Primary Database Configuration
-blueprintsprocessor.db.primary.url=jdbc:mysql://localhost:3306/sdnctl
-blueprintsprocessor.db.primary.username=sdnctl
-blueprintsprocessor.db.primary.password=sdnctl
-blueprintsprocessor.db.primary.driverClassName=org.mariadb.jdbc.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=update
-blueprintsprocessor.db.primary.hibernateDDLAuto=none
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.MySQL5InnoDBDialect
-
-# Python executor
-blueprints.processor.functions.python.executor.executionPath=./../../../components/scripts/python/ccsdk_blueprints
-blueprints.processor.functions.python.executor.modulePaths=./../../../components/scripts/python/ccsdk_blueprints
-
-# SDN-C's ODL Restconf Connection Details
-blueprintsprocessor.restconfEnabled=true
-blueprintsprocessor.restclient.sdncodl.type=basic-auth
-blueprintsprocessor.restclient.sdncodl.url=http://localhost:8282/
-blueprintsprocessor.restclient.sdncodl.username=admin
-blueprintsprocessor.restclient.sdncodl.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U \ No newline at end of file
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties
deleted file mode 100755
index 3b97e672..00000000
--- a/ms/blueprintsprocessor/application/src/main/resources/application.properties
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# Copyright (c) 2017-2019 AT&T, IBM, Bell Canada, Nordix Foundation.
-#
-# 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.
-#
-#logging.level.web=DEBUG
-
-# Web server config
-server.port=8080
-
-blueprintsprocessor.grpcEnable=false
-blueprintsprocessor.httpPort=8080
-blueprintsprocessor.grpcPort=9111
-
-# Blueprint Processor File Execution and Handling Properties
-blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
-
-# Primary Database Configuration
-blueprintsprocessor.db.primary.url=jdbc:mysql://db:3306/sdnctl
-blueprintsprocessor.db.primary.username=sdnctl
-blueprintsprocessor.db.primary.password=sdnctl
-blueprintsprocessor.db.primary.driverClassName=org.mariadb.jdbc.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=update
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.MySQL5InnoDBDialect
-
-# Python executor
-blueprints.processor.functions.python.executor.executionPath=/opt/app/onap/scripts/jython/ccsdk_blueprints
-blueprints.processor.functions.python.executor.modulePaths=/opt/app/onap/scripts/jython/ccsdk_blueprints,/opt/app/onap/scripts/jython/ccsdk_netconf
-
-security.user.password: {bcrypt}$2a$10$duaUzVUVW0YPQCSIbGEkQOXwafZGwQ/b32/Ys4R1iwSSawFgz7QNu
-security.user.name: ccsdkapps
-
-# SDN-C's ODL Restconf Connection Details
-blueprintsprocessor.restconfEnabled=true
-blueprintsprocessor.restclient.sdncodl.type=basic-auth
-blueprintsprocessor.restclient.sdncodl.url=http://sdnc:8282/
-blueprintsprocessor.restclient.sdncodl.username=admin
-blueprintsprocessor.restclient.sdncodl.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
diff --git a/ms/blueprintsprocessor/application/src/main/resources/logback.xml b/ms/blueprintsprocessor/application/src/main/resources/logback.xml
deleted file mode 100644
index a97bb8c3..00000000
--- a/ms/blueprintsprocessor/application/src/main/resources/logback.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="info"/>
- <logger name="org.springframework.web" level="info"/>
- <logger name="org.hibernate" level="error"/>
- <logger name="org.onap.ccsdk.apps" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java b/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java
deleted file mode 100644
index 5777a28f..00000000
--- a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor;
-
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.ApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-/**
- * BlueprintProcessorApplicationTest
- *
- * @author Brinda Santh
- * DATE : 8/14/2018
- */
-
-@RunWith(SpringRunner.class)
-@ContextConfiguration(classes = {BlueprintProcessorApplication.class, BluePrintLoadConfiguration.class})
-@SpringBootTest(classes = BlueprintProcessorApplication.class,
- webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-public class BlueprintProcessorApplicationTest {
-
- @Autowired
- private ApplicationContext context;
-
- @Before
- public void setUp() {
-
- }
-
- @Test
- public void testSample() {
- Assert.assertNotNull("Failed to create Application Context ", context);
- }
-
-}
diff --git a/ms/blueprintsprocessor/application/src/test/resources/application.properties b/ms/blueprintsprocessor/application/src/test/resources/application.properties
deleted file mode 100644
index fc6f7290..00000000
--- a/ms/blueprintsprocessor/application/src/test/resources/application.properties
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-#
-# Modifications Copyright © 2019 IBM, Bell Canada.
-#
-# 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.
-#
-# Web server config
-server.port=8080
-blueprintsprocessor.grpcEnable=false
-blueprintsprocessor.httpPort=8080
-blueprintsprocessor.grpcPort=9111
-# Blueprint Processor File Execution and Handling Properties
-blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
-# Primary Database Configuration
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
-# Python executor
-blueprints.processor.functions.python.executor.executionPath=/opt/app/onap/scripts/jython/ccsdk_blueprints
-blueprints.processor.functions.python.executor.modulePaths=/opt/app/onap/scripts/jython/ccsdk_blueprints
-
-security.user.password: {bcrypt}$2a$10$duaUzVUVW0YPQCSIbGEkQOXwafZGwQ/b32/Ys4R1iwSSawFgz7QNu
-security.user.name: ccsdkapps
diff --git a/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml
deleted file mode 100644
index a816a06c..00000000
--- a/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/distribution/pom.xml b/ms/blueprintsprocessor/distribution/pom.xml
deleted file mode 100755
index 2bd16e5c..00000000
--- a/ms/blueprintsprocessor/distribution/pom.xml
+++ /dev/null
@@ -1,183 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2019 IBM, Bell Canada.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
- </parent>
- <artifactId>distribution</artifactId>
- <packaging>pom</packaging>
- <name>Blueprints Processor Distribution</name>
- <properties>
- <assembly.id>maven</assembly.id>
- <name.space>org.onap.ccsdk.apps</name.space>
- <serviceArtifactName>blueprintsprocessor</serviceArtifactName>
- <image.name>onap/ccsdk-blueprintsprocessor</image.name>
- <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
- <docker.push.phase>deploy</docker.push.phase>
- <docker.verbose>true</docker.verbose>
- <ccsdk.project.version>${project.version}</ccsdk.project.version>
- <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>application</artifactId>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <id>copy-dockerfile</id>
- <goals>
- <goal>copy-resources</goal>
- </goals><!-- here the phase you need -->
- <phase>validate</phase>
- <configuration>
- <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/docker</directory>
- <includes>
- <include>*</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>ant-test</id>
- <phase>package</phase>
- <configuration>
- <tasks>
- <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!--build the final artifact for docker deployment -->
- <artifactId>maven-assembly-plugin</artifactId>
- <version>3.1.0</version>
- <configuration>
- <!-- <skipAssembly>${skip.assembly}</skipAssembly> -->
- <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
- <descriptors>
- <descriptor>src/main/docker/distribution.xml</descriptor>
- </descriptors>
- <tarLongFileMode>posix</tarLongFileMode>
- </configuration>
- <executions>
- <execution>
- <id>${assembly.id}</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.groovy.maven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <source>${basedir}/../../../TagVersion.groovy</source>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.26.1</version>
- <inherited>false</inherited>
- <configuration>
- <images>
- <image>
- <name>${image.name}</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
- <tags>
- <tag>${project.docker.latestminortag.version}</tag>
- <tag>${project.docker.latestfulltag.version}</tag>
- <tag>${project.docker.latesttagtimestamp.version}</tag>
- </tags>
- </build>
- </image>
- </images>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <id>generate-images</id>
- <phase>package</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- <execution>
- <id>push-images</id>
- <phase>${docker.push.phase}</phase>
- <goals>
- <goal>build</goal>
- <goal>push</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- </profiles>
-</project>
diff --git a/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml b/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml
deleted file mode 100755
index 1e197442..00000000
--- a/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-version: '3.3'
-
-services:
- db:
- image: mariadb:latest
- container_name: ccsdk-mariadb
- ports:
- - "3306:3306"
- volumes:
- - ~/vm_mysql:/var/lib/mysql
- restart: always
- environment:
- MYSQL_ROOT_PASSWORD: sdnctl
- MYSQL_DATABASE: sdnctl
- MYSQL_USER: sdnctl
- MYSQL_PASSWORD: sdnctl
- blueprints-processor:
- depends_on:
- - db
- image: onap/ccsdk-blueprintsprocessor:latest
- container_name: bp-rest
- ports:
- - "8000:8080"
- restart: always
- environment:
- APPLICATIONNAME: BlueprintsProcessor
- BUNDLEVERSION: 1.0.0
- APP_CONFIG_HOME: /opt/app/onap/config
- STICKYSELECTORKEY:
- ENVCONTEXT: dev \ No newline at end of file
diff --git a/ms/blueprintsprocessor/distribution/src/main/docker/Dockerfile b/ms/blueprintsprocessor/distribution/src/main/docker/Dockerfile
deleted file mode 100755
index dab0a4c0..00000000
--- a/ms/blueprintsprocessor/distribution/src/main/docker/Dockerfile
+++ /dev/null
@@ -1,18 +0,0 @@
-FROM omahoco1/alpine-java-python
-
-ENV HTTP_PROXY ${HTTP_PROXY}
-ENV HTTPS_PROXY ${HTTPS_PROXY}
-
-# add entrypoint
-COPY run.source /etc/run.source
-COPY startService.sh /startService.sh
-RUN chmod 777 /startService.sh && dos2unix /startService.sh
-
-# add application
-COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz
-RUN tar -xzf /source.tar.gz -C /tmp \
- && cp -rf /tmp/@project.build.finalName@/opt / \
- && rm -rf /source.tar.gz \
- && rm -rf /tmp/@project.build.finalName@
-
-ENTRYPOINT /startService.sh \ No newline at end of file
diff --git a/ms/blueprintsprocessor/distribution/src/main/docker/distribution.xml b/ms/blueprintsprocessor/distribution/src/main/docker/distribution.xml
deleted file mode 100755
index 3137eb49..00000000
--- a/ms/blueprintsprocessor/distribution/src/main/docker/distribution.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2018-2019 Bell Canada.
- ~
- ~ 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.
- -->
-
-<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
- <!-- create a tar.gz file containing the projects dependencies -->
- <id>${assembly.id}</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/opt/app/onap/lib</outputDirectory>
- <outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
- <excludes>
- </excludes>
- </dependencySet>
- </dependencySets>
- <fileSets>
- <fileSet>
- <directory>${project.basedir}/../application/src/main/resources</directory>
- <includes>
- <include>application.properties</include>
- <include>logback.xml</include>
- </includes>
- <outputDirectory>/opt/app/onap/config</outputDirectory>
- <useDefaultExcludes>true</useDefaultExcludes>
- </fileSet>
- <fileSet>
- <directory>${project.basedir}/../../../components/scripts/python</directory>
- <outputDirectory>/opt/app/onap/scripts/jython</outputDirectory>
- <useDefaultExcludes>true</useDefaultExcludes>
- </fileSet>
- </fileSets>
-</assembly> \ No newline at end of file
diff --git a/ms/blueprintsprocessor/distribution/src/main/docker/run.source b/ms/blueprintsprocessor/distribution/src/main/docker/run.source
deleted file mode 100755
index 7557ab12..00000000
--- a/ms/blueprintsprocessor/distribution/src/main/docker/run.source
+++ /dev/null
@@ -1,12 +0,0 @@
-java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sources:${APP_CONFIG_HOME}:${APP_HOME}" \
--DappName=${APPLICATIONNAME} -DappVersion=${BUNDLEVERSION} \
--DrouteOffer=${ROUTEOFFER} \
--DVERSION_ROUTEOFFER_ENVCONTEXT=${BUNDLEVERSION}/${STICKYSELECTORKEY}/${ENVCONTEXT} \
--DSecurityFilePath=/etc \
--DREST_NAME_NORMALIZER_PATTERN_FILE=/etc/PatternInputs.txt \
--Dms_name=org.onap.ccsdk.apps.blueprintsprocessor \
--Dlogging.config=${APP_CONFIG_HOME}/logback.xml \
--Djava.security.egd=file:/dev/./urandom \
--DAPPNAME=${APP_NAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \
--Dspring.config.location=${APP_CONFIG_HOME}/ \
-org.onap.ccsdk.apps.blueprintsprocessor.BlueprintProcessorApplication
diff --git a/ms/blueprintsprocessor/distribution/src/main/docker/startService.sh b/ms/blueprintsprocessor/distribution/src/main/docker/startService.sh
deleted file mode 100644
index 88497156..00000000
--- a/ms/blueprintsprocessor/distribution/src/main/docker/startService.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-nodeName=BlueprintsProcessor_1.0.0_$(cat /proc/self/cgroup | grep docker | sed s/\\//\\n/g | tail -1)
-
-echo "APP Config HOME : ${APP_CONFIG_HOME}"
-export APP_HOME=/opt/app/onap
-
-source /etc/run.source
diff --git a/ms/blueprintsprocessor/functions/cli-executor/pom.xml b/ms/blueprintsprocessor/functions/cli-executor/pom.xml
deleted file mode 100644
index 9077c13c..00000000
--- a/ms/blueprintsprocessor/functions/cli-executor/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2019 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>functions</artifactId>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>cli-executor</artifactId>
- <name>Blueprints Processor Function - CLI Executor</name>
- <description>Blueprints Processor Function - CLI Executor</description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.sshd</groupId>
- <artifactId>sshd-core</artifactId>
- </dependency>
-
- </dependencies>
-
-
-</project>
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/CliExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/CliExecutorConfiguration.kt
deleted file mode 100644
index c2652495..00000000
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/CliExecutorConfiguration.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.cli.executor
-
-import org.springframework.context.annotation.Configuration
-
-@Configuration
-open class CliExecutorConfiguration \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/api/CliExecutorService.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/api/CliExecutorService.kt
deleted file mode 100644
index 3c5c9588..00000000
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/api/CliExecutorService.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.cli.executor.api
-
-interface CliExecutorService {
-
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImpl.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImpl.kt
deleted file mode 100644
index 02a74fa0..00000000
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImpl.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.cli.executor.service
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.cli.executor.api.CliExecutorService
-import org.springframework.stereotype.Service
-
-@Service
-open class CliExecutorServiceImpl : CliExecutorService {
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImplTest.kt b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImplTest.kt
deleted file mode 100644
index 347aba79..00000000
--- a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImplTest.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.cli.executor.service
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.cli.executor.api.CliExecutorService
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [CliExecutorServiceImpl::class])
-class CliExecutorServiceImplTest {
-
- @Autowired
- lateinit var cliExecutorService: CliExecutorService
-
- @Test
- fun testCliExecutorService() {
- assertNotNull(cliExecutorService, "failed to intilise cliExecutorService")
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/cli-executor/src/test/resources/logback-test.xml
deleted file mode 100644
index 071c7943..00000000
--- a/ms/blueprintsprocessor/functions/cli-executor/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2019 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <logger name="org.springframework.test" level="warn"/>
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/pom.xml b/ms/blueprintsprocessor/functions/netconf-executor/pom.xml
deleted file mode 100644
index 2e6d77ed..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/pom.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>functions</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>netconf-executor</artifactId>
- <name>Blueprints Processor Function - Netconf Executor</name>
- <description>Blueprints Processor Function - Netconf Executor</description>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>resource-resolution</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jettison</groupId>
- <artifactId>jettison</artifactId>
- <version>${jettison.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sshd</groupId>
- <artifactId>sshd-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
deleted file mode 100644
index c2ccdafd..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Modifications Copyright © 2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor
-
-import com.fasterxml.jackson.databind.node.ArrayNode
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
-import org.onap.ccsdk.apps.controllerblueprints.core.getAsString
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Component
-
-@Component("component-netconf-executor")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ComponentNetconfExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService)
- : AbstractComponentFunction() {
-
- private val log = LoggerFactory.getLogger(ComponentNetconfExecutor::class.java)
-
- companion object {
- const val SCRIPT_TYPE = "script-type"
- const val SCRIPT_CLASS_REFERENCE = "script-class-reference"
- const val INSTANCE_DEPENDENCIES = "instance-dependencies"
- }
-
-
- lateinit var scriptComponent: NetconfComponentFunction
-
- override fun process(executionRequest: ExecutionServiceInput) {
-
- val scriptType = operationInputs.getAsString(SCRIPT_TYPE)
- val scriptClassReference = operationInputs.getAsString(SCRIPT_CLASS_REFERENCE)
- val instanceDependenciesNode = operationInputs.get(INSTANCE_DEPENDENCIES) as? ArrayNode
-
- val scriptDependencies: MutableList<String> = arrayListOf()
- scriptDependencies.add(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
-
- instanceDependenciesNode?.forEach { instanceName ->
- scriptDependencies.add(instanceName.textValue())
- }
-
- scriptComponent = componentFunctionScriptingService.scriptInstance<NetconfComponentFunction>(this, scriptType,
- scriptClassReference, scriptDependencies)
-
-
- checkNotNull(scriptComponent) { "failed to get netconf script component" }
-
- scriptComponent.process(executionServiceInput)
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- scriptComponent.recover(runtimeException, executionRequest)
- }
-
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/JsonParserService.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/JsonParserService.kt
deleted file mode 100644
index 11173663..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/JsonParserService.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor
-
-import org.springframework.stereotype.Service
-
-@Service("json-parser-service")
-class JsonParserService {
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt
deleted file mode 100644
index fe8ba54d..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright © 2018-2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-
-abstract class NetconfComponentFunction : AbstractScriptComponentFunction() {
-
- open fun resourceResolutionService(): ResourceResolutionService =
- functionDependencyInstanceAsType(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
-
- // Called from python script
- fun initializeNetconfConnection(requirementName: String): NetconfDevice {
- val deviceInfo = deviceProperties(requirementName)
- return NetconfDevice(deviceInfo)
- }
-
- fun generateMessage(artifactName: String): String {
- return bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
- }
-
- fun resolveFromDatabase(resolutionKey: String, artifactName: String): String {
- return resourceResolutionService().resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey)
- }
-
- fun resolveAndGenerateMessage(artifactMapping: String, artifactTemplate: String): String {
- return resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName,
- artifactMapping, artifactTemplate)
- }
-
- fun resolveAndGenerateMessage(artifactPrefix: String): String {
- return resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName,
- artifactPrefix, mapOf())
- }
-
- private fun deviceProperties(requirementName: String): DeviceInfo {
-
- val blueprintContext = bluePrintRuntimeService.bluePrintContext()
-
- val requirement = blueprintContext.nodeTemplateRequirement(nodeTemplateName, requirementName)
-
- val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(requirement
- .node!!, requirement.capability!!)
-
- return deviceProperties(capabilityProperties)
- }
-
- private fun deviceProperties(capabilityProperty: MutableMap<String, JsonNode>): DeviceInfo {
- return JacksonUtils.getInstanceFromMap(capabilityProperty, DeviceInfo::class.java)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
deleted file mode 100644
index 1c07c5e6..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfSession
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core.NetconfRpcServiceImpl
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core.NetconfSessionImpl
-
-data class NetconfDevice(val deviceInfo: DeviceInfo) {
- val netconfRpcService = NetconfRpcServiceImpl(deviceInfo)
- val netconfSession: NetconfSession
-
- init {
- netconfSession = NetconfSessionImpl(deviceInfo, netconfRpcService)
- netconfRpcService.setNetconfSession(netconfSession)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
deleted file mode 100644
index 466e6b5e..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api
-
-import com.fasterxml.jackson.annotation.JsonIgnore
-import com.fasterxml.jackson.annotation.JsonProperty
-
-class DeviceInfo {
- @get:JsonProperty("login-account")
- var username: String? = null
- @get:JsonProperty("login-key")
- var password: String? = null
- @get:JsonProperty("target-ip-address")
- var ipAddress: String? = null
- @get:JsonProperty("port-number")
- var port: Int = 0
- @get:JsonProperty("connection-time-out")
- var connectTimeout: Long = 5
- @get:JsonIgnore
- var source: String? = null
- @get:JsonIgnore
- var replyTimeout: Int = 5
- @get:JsonIgnore
- var idleTimeout: Int = 99999
-
- override fun toString(): String {
- return "$ipAddress:$port"
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfException.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfException.kt
deleted file mode 100644
index d7642e75..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfException.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api
-
-class NetconfException : Exception {
-
- constructor(cause: Throwable) : super(cause)
- constructor(message: String) : super(message)
- constructor(message: String, cause: Throwable) : super(message, cause)
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfMessage.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfMessage.kt
deleted file mode 100644
index da746614..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfMessage.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.RpcStatus
-
-class DeviceResponse {
- var status: String? = null
- var errorMessage: String? = null
- var responseMessage: String? = null
- var requestMessage: String? = null
- private var subDeviceResponse: MutableMap<Any, Any>? = null
-
- fun addSubDeviceResponse(key: String, subDeviceResponse: DeviceResponse) {
- if (this.subDeviceResponse == null) {
- this.subDeviceResponse = hashMapOf()
- }
- this.subDeviceResponse!![key] = subDeviceResponse
- }
-
- fun isSuccess(): Boolean {
- if (this.status != RpcStatus.SUCCESS && !this.errorMessage.isNullOrEmpty()) {
- return false
- }
- return true
- }
-}
-
-
-/**
- * Creates an event of a given type and for the specified subject and the current time.
- *
- * @param type event type
- * @param payload message from the device
- * @param messageId id of the message related to the event
- * @param deviceInfo device of event
- */
-class NetconfReceivedEvent
- (private var type: Type, private var payload: String = "", private var messageId: String = "",
- private var deviceInfo: DeviceInfo) {
-
- enum class Type {
- DEVICE_REPLY,
- DEVICE_UNREGISTERED,
- DEVICE_ERROR,
- SESSION_CLOSED
- }
-
- fun getType(): Type {
- return type
- }
-
- fun getMessagePayload(): String {
- return payload
- }
-
- fun getMessageID(): String {
- return messageId
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfRpcService.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfRpcService.kt
deleted file mode 100644
index 02c0a342..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfRpcService.kt
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.ModifyAction
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.NetconfDatastore
-
-interface NetconfRpcService {
-
- /**
- * Lock
- *
- * @param configTarget running or candidate, default candidate
- * @return Device response
- */
- fun lock(configTarget: String = NetconfDatastore.CANDIDATE.datastore): DeviceResponse
-
- /**
- * Get-config
- *
- * @param filter filter content, default empty
- * @param configTarget running or candidate, default running
- * @return Device response
- */
- fun getConfig(filter: String = "", configTarget: String = NetconfDatastore.RUNNING.datastore): DeviceResponse
-
- /**
- * Delete config
- *
- * @param configTarget running or candidate, default candidate
- * @return Device response
- */
- fun deleteConfig(configTarget: String = NetconfDatastore.CANDIDATE.datastore): DeviceResponse
-
- /**
- * Edit-config
- *
- * @param messageContent edit config content.
- * @param configTarget running or candidate, default candidate
- * @param editDefaultOperation, default set to none. Valid values: merge, replace, create, delete, none
- * @return Device response
- */
- fun editConfig(messageContent: String, configTarget: String = NetconfDatastore.CANDIDATE.datastore,
- editDefaultOperation: String = ModifyAction.NONE.action): DeviceResponse
-
- /**
- * Invoke custom RPC as provided as input.
- *
- * Some use cases might required one to directly invoke a device
- * specific RPC. The RPC must be correctly formatted.
- *
- * Ex: in order to rollback last submitted configuration
- * for JUNOS devices, such RPC can be use:
- * <code>
- * &lt;rpc>
- * &lt;load-configuration rollback="1"/>
- * &lt;/rpc>
- * </code>
- *
- * @param rpc the rpc content.
- */
- fun invokeRpc(rpc: String): DeviceResponse
-
- /**
- * Validate
- *
- * @param configTarget running or candidate, default candidate
- * @return Device response
- */
- fun validate(configTarget: String = NetconfDatastore.CANDIDATE.datastore): DeviceResponse
-
- /**
- * Commit
- *
- * @param confirmed Perform a confirmed <commit> operation. If flag set to true,
- * then it is expected to have a follow-up <commit> operation to confirm the request
- * @param confirmTimeout Timeout period for confirmed commit, in seconds.
- * @param persist Make the confirmed commit survive a session termination, and
- * set a token on the ongoing confirmed commit.
- * @param persistId Used to issue a follow-up confirmed commit or a confirming
- * commit from any session, with the token from the previous <commit> operation.
- * If unspecified, the confirm timeout defaults to 600 seconds.
- * @return Device response
- */
- fun commit(confirmed: Boolean = false, confirmTimeout: Int = 60, persist: String = "",
- persistId: String = ""): DeviceResponse
-
- /**
- * Cancels an ongoing confirmed commit. If the <persist-id> parameter is not given,
- * the <cancel-commit> operation MUST be issued on the same session that issued
- * the confirmed commit.
- *
- * @param persistId Cancels a persistent confirmed commit. The value MUST be equal
- * to the value given in the <persist> parameter to the <commit> operation.
- * If the value does not match, the operation fails with an "invalid-value" error.
- */
- fun cancelCommit(persistId: String = ""): DeviceResponse
-
- /**
- * Unlock
- *
- * @param configTarget running or candidate, default candidate
- * @return Device response
- */
- fun unLock(configTarget: String = NetconfDatastore.CANDIDATE.datastore): DeviceResponse
-
- /**
- * Discard config
- *
- * @return Device response
- */
- fun discardConfig(): DeviceResponse
-
- /**
- * Close session
- *
- * @param force force closeSession
- * @return Device response
- */
- fun closeSession(force: Boolean): DeviceResponse
-
- /**
- * Executes an RPC request to the netconf server.
- *
- * @param request the XML containing the RPC request for the server.
- * @return Device response
- */
- fun asyncRpc(request: String, messageId: String): DeviceResponse
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfSession.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfSession.kt
deleted file mode 100644
index 6a655d91..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfSession.kt
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api
-
-import java.util.concurrent.CompletableFuture
-
-interface NetconfSession {
-
- /**
- * Establish netconf session
- */
- fun connect()
-
-
- /**
- * Disconnect netconf session
- */
- fun disconnect()
-
- /**
- * Reconnect netconf session
- */
- fun reconnect()
-
- /**
- * Executes an synchronous RPC request.
- *
- * @param request the XML request
- * @param messageId message id of the request.
- * @return Response
- */
- @Throws(NetconfException::class)
- fun syncRpc(request: String, messageId: String): String
-
- /**
- * Executes an asynchronous RPC request.
- *
- * @param request the XML request
- * @param messageId message id of the request.
- * @return Response
- */
- @Throws(NetconfException::class)
- fun asyncRpc(request: String, messageId: String): CompletableFuture<String>
-
- /**
- * Checks the state of the underlying SSH session and connection and if necessary it reestablishes
- * it.
- */
- @Throws(NetconfException::class)
- fun checkAndReestablish()
-
- /**
- * Get the device information for initialised session.
- *
- * @return DeviceInfo as device information
- */
- fun getDeviceInfo(): DeviceInfo
-
- /**
- * Gets the session ID of the Netconf session.
- *
- * @return Session ID as a string.
- */
- fun getSessionId(): String
-
- /**
- * Gets the capabilities of the remote Netconf device associated to this session.
- *
- * @return Network capabilities as strings in a Set.
- */
- fun getDeviceCapabilitiesSet(): Set<String>
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt
deleted file mode 100644
index 8854894f..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api
-
-interface NetconfSessionListener {
-
- fun notify(event: NetconfReceivedEvent)
-}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
deleted file mode 100644
index 69475619..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfReceivedEvent
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfSessionListener
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.NetconfMessageUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.RpcMessageUtils
-import org.slf4j.LoggerFactory
-import java.io.BufferedReader
-import java.io.IOException
-import java.io.InputStream
-import java.io.InputStreamReader
-import java.io.OutputStream
-import java.io.OutputStreamWriter
-import java.nio.charset.StandardCharsets
-import java.util.concurrent.CompletableFuture
-
-class NetconfDeviceCommunicator(private var inputStream: InputStream,
- private var out: OutputStream,
- private val deviceInfo: DeviceInfo,
- private val sessionListener: NetconfSessionListener,
- private var replies: MutableMap<String, CompletableFuture<String>>) : Thread() {
-
- private val log = LoggerFactory.getLogger(NetconfDeviceCommunicator::class.java)
- private var state = NetconfMessageState.NO_MATCHING_PATTERN
-
- init {
- start()
- }
-
- override fun run() {
- var bufferReader: BufferedReader? = null
- while (bufferReader == null) {
- bufferReader = BufferedReader(InputStreamReader(inputStream, StandardCharsets.UTF_8))
- }
-
- try {
- var socketClosed = false
- val deviceReplyBuilder = StringBuilder()
- while (!socketClosed) {
- val cInt = bufferReader.read()
- if (cInt == -1) {
- log.error("$deviceInfo: Received cInt = -1")
-// bufferReader.close()
- socketClosed = true
-// sessionListener.notify(NetconfReceivedEvent(
-// NetconfReceivedEvent.Type.SESSION_CLOSED,
-// deviceInfo = deviceInfo))
- }
- val c = cInt.toChar()
- state = state.evaluateChar(c)
- deviceReplyBuilder.append(c)
- if (state === NetconfMessageState.END_PATTERN) {
- var deviceReply = deviceReplyBuilder.toString()
- if (deviceReply == RpcMessageUtils.END_PATTERN) {
- socketClosed = true
- bufferReader.close()
- sessionListener.notify(NetconfReceivedEvent(
- NetconfReceivedEvent.Type.DEVICE_UNREGISTERED,
- deviceInfo = deviceInfo))
- } else {
- deviceReply = deviceReply.replace(RpcMessageUtils.END_PATTERN, "")
- receivedMessage(deviceReply)
- deviceReplyBuilder.setLength(0)
- }
- } else if (state === NetconfMessageState.END_CHUNKED_PATTERN) {
- var deviceReply = deviceReplyBuilder.toString()
- if (!NetconfMessageUtils.validateChunkedFraming(deviceReply)) {
- log.debug("$deviceInfo: Received badly framed message $deviceReply")
- socketClosed = true
- sessionListener.notify(NetconfReceivedEvent(
- NetconfReceivedEvent.Type.DEVICE_ERROR,
- deviceInfo = deviceInfo))
- } else {
- deviceReply = deviceReply.replace(RpcMessageUtils.MSGLEN_REGEX_PATTERN.toRegex(), "")
- deviceReply = deviceReply.replace(NetconfMessageUtils.CHUNKED_END_REGEX_PATTERN.toRegex(), "")
- receivedMessage(deviceReply)
- deviceReplyBuilder.setLength(0)
- }
- }
- }
-
- } catch (e: IOException) {
- log.warn("$deviceInfo: Fail while reading from channel", e)
- sessionListener.notify(NetconfReceivedEvent(
- NetconfReceivedEvent.Type.DEVICE_ERROR,
- deviceInfo = deviceInfo))
- }
-
- }
-
- private enum class NetconfMessageState {
- NO_MATCHING_PATTERN {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return if (c == ']') {
- FIRST_BRACKET
- } else if (c == '\n') {
- FIRST_LF
- } else {
- this
- }
- }
- },
- FIRST_BRACKET {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return if (c == ']') {
- SECOND_BRACKET
- } else {
- NO_MATCHING_PATTERN
- }
- }
- },
- SECOND_BRACKET {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return if (c == '>') {
- FIRST_BIGGER
- } else {
- NO_MATCHING_PATTERN
- }
- }
- },
- FIRST_BIGGER {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return if (c == ']') {
- THIRD_BRACKET
- } else {
- NO_MATCHING_PATTERN
- }
- }
- },
- THIRD_BRACKET {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return if (c == ']') {
- ENDING_BIGGER
- } else {
- NO_MATCHING_PATTERN
- }
- }
- },
- ENDING_BIGGER {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return if (c == '>') {
- END_PATTERN
- } else {
- NO_MATCHING_PATTERN
- }
- }
- },
- FIRST_LF {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return if (c == '#') {
- FIRST_HASH
- } else if (c == ']') {
- FIRST_BRACKET
- } else if (c == '\n') {
- this
- } else {
- NO_MATCHING_PATTERN
- }
- }
- },
- FIRST_HASH {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return if (c == '#') {
- SECOND_HASH
- } else {
- NO_MATCHING_PATTERN
- }
- }
- },
- SECOND_HASH {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return if (c == '\n') {
- END_CHUNKED_PATTERN
- } else {
- NO_MATCHING_PATTERN
- }
- }
- },
- END_CHUNKED_PATTERN {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return NO_MATCHING_PATTERN
- }
- },
- END_PATTERN {
- override fun evaluateChar(c: Char): NetconfMessageState {
- return NO_MATCHING_PATTERN
- }
- };
-
- internal abstract fun evaluateChar(c: Char): NetconfMessageState
- }
-
- fun sendMessage(request: String, messageId: String): CompletableFuture<String> {
- log.info("$deviceInfo: Sending message: \n $request")
- val future = CompletableFuture<String>()
- replies.put(messageId, future)
- val outputStream = OutputStreamWriter(out, StandardCharsets.UTF_8)
- synchronized(this) {
- try {
- outputStream.write(request)
- outputStream.flush()
- } catch (e: IOException) {
- log.error("$deviceInfo: Failed to send message : \n $request", e)
- future.completeExceptionally(e)
- }
-
- }
- return future
- }
-
- private fun receivedMessage(deviceReply: String) {
- if (deviceReply.contains(RpcMessageUtils.RPC_REPLY) || deviceReply.contains(RpcMessageUtils.RPC_ERROR)
- || deviceReply.contains(RpcMessageUtils.HELLO)) {
- log.info("$deviceInfo: Received message with messageId: {} \n $deviceReply",
- NetconfMessageUtils.getMsgId(deviceReply))
-
- } else {
- log.error("$deviceInfo: Invalid message received: \n $deviceReply")
- }
- sessionListener.notify(NetconfReceivedEvent(
- NetconfReceivedEvent.Type.DEVICE_REPLY,
- deviceReply,
- NetconfMessageUtils.getMsgId(deviceReply),
- deviceInfo))
- }
-}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImpl.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImpl.kt
deleted file mode 100644
index 15fb3122..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImpl.kt
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.DeviceResponse
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfException
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfRpcService
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfSession
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.NetconfMessageUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.RpcStatus
-import org.slf4j.LoggerFactory
-import java.util.concurrent.TimeUnit
-import java.util.concurrent.atomic.AtomicInteger
-
-class NetconfRpcServiceImpl(private var deviceInfo: DeviceInfo) : NetconfRpcService {
-
- private val log = LoggerFactory.getLogger(NetconfRpcService::class.java)
-
- private var responseTimeout: Int = deviceInfo.replyTimeout
-
- private lateinit var netconfSession: NetconfSession
-
- private val messageIdInteger = AtomicInteger(1)
-
- fun setNetconfSession(netconfSession: NetconfSession) {
- this.netconfSession = netconfSession
- }
-
- override fun invokeRpc(rpc: String): DeviceResponse {
- var output = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- log.info("$deviceInfo: invokeRpc: messageId($messageId)")
- try {
- output = asyncRpc(rpc, messageId)
- } catch (e: Exception) {
- output.status = RpcStatus.FAILURE
- output.errorMessage = "$deviceInfo: failed in invokeRpc command $e.message"
- }
- return output
- }
-
- override fun getConfig(filter: String, configTarget: String): DeviceResponse {
- var output = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- log.info("$deviceInfo: getConfig: messageId($messageId)")
- try {
- val message = NetconfMessageUtils.getConfig(messageId, configTarget, filter)
- output = asyncRpc(message, messageId)
- } catch (e: Exception) {
- output.status = RpcStatus.FAILURE
- output.errorMessage = "$deviceInfo: failed in get-config command $e.message"
- }
- return output
- }
-
- override fun deleteConfig(configTarget: String): DeviceResponse {
- var output = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- log.info("$deviceInfo: deleteConfig: messageId($messageId)")
- try {
- val deleteConfigMessage = NetconfMessageUtils.deleteConfig(messageId, configTarget)
- output.requestMessage = deleteConfigMessage
- output = asyncRpc(deleteConfigMessage, messageId)
- } catch (e: Exception) {
- output.status = RpcStatus.FAILURE
- output.errorMessage = "$deviceInfo: failed in delete config command $e.message"
- }
- return output
- }
-
- override fun lock(configTarget: String): DeviceResponse {
- var output = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- log.info("$deviceInfo: lock: messageId($messageId)")
- try {
- val lockMessage = NetconfMessageUtils.lock(messageId, configTarget)
- output.requestMessage = lockMessage
- output = asyncRpc(lockMessage, messageId)
- } catch (e: Exception) {
- output.status = RpcStatus.FAILURE
- output.errorMessage = "$deviceInfo: failed in lock command $e.message"
- }
-
- return output
- }
-
- override fun unLock(configTarget: String): DeviceResponse {
- var output = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- log.info("$deviceInfo: unLock: messageId($messageId)")
- try {
- val unlockMessage = NetconfMessageUtils.unlock(messageId, configTarget)
- output.requestMessage = unlockMessage
- output = asyncRpc(unlockMessage, messageId)
- } catch (e: Exception) {
- output.status = RpcStatus.FAILURE
- output.errorMessage = "$deviceInfo: failed in lock command $e.message"
- }
- return output
- }
-
- override fun commit(confirmed: Boolean, confirmTimeout: Int, persist: String, persistId: String): DeviceResponse {
- var output = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- log.info("$deviceInfo: commit: messageId($messageId)")
- try {
- val messageContent = NetconfMessageUtils.commit(messageId, confirmed, confirmTimeout, persist, persistId)
- output = asyncRpc(messageContent, messageId)
- } catch (e: Exception) {
- output.status = RpcStatus.FAILURE
- output.errorMessage = "$deviceInfo: failed in commit command $e.message"
- }
- return output
- }
-
- override fun cancelCommit(persistId: String): DeviceResponse {
- var output = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- log.info("$deviceInfo: cancelCommit: messageId($messageId)")
- try {
- val messageContent = NetconfMessageUtils.cancelCommit(messageId, persistId)
- output = asyncRpc(messageContent, messageId)
- } catch (e: Exception) {
- output.status = RpcStatus.FAILURE
- output.errorMessage = "$deviceInfo: failed in cancelCommit command $e.message"
- }
- return output
- }
-
- override fun discardConfig(): DeviceResponse {
- var output = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- log.info("$deviceInfo: discard: messageId($messageId)")
- try {
- val discardChangesMessage = NetconfMessageUtils.discardChanges(messageId)
- output.requestMessage = discardChangesMessage
- output = asyncRpc(discardChangesMessage, messageId)
- } catch (e: Exception) {
- output.status = RpcStatus.FAILURE
- output.errorMessage = "$deviceInfo: failed in discard changes command " + e.message
- }
- return output
- }
-
- override fun editConfig(messageContent: String, configTarget: String,
- editDefaultOperation: String): DeviceResponse {
- var response = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- log.info("$deviceInfo: editConfig: messageId($messageId)")
- try {
- val editMessage =
- NetconfMessageUtils.editConfig(messageId, configTarget, editDefaultOperation, messageContent)
- response.requestMessage = editMessage
- response = asyncRpc(editMessage, messageId)
- } catch (e: Exception) {
- response.status = RpcStatus.FAILURE
- response.errorMessage = e.message
- }
- return response
- }
-
- override fun validate(configTarget: String): DeviceResponse {
- var output = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- try {
- val validateMessage = NetconfMessageUtils.validate(messageId, configTarget)
- output.requestMessage = validateMessage
- output = asyncRpc(validateMessage, messageId)
- } catch (e: Exception) {
- output.status = RpcStatus.FAILURE
- output.errorMessage = "$deviceInfo: failed in validate command " + e.message
- }
- return output
- }
-
- override fun closeSession(force: Boolean): DeviceResponse {
- var output = DeviceResponse()
- val messageId = messageIdInteger.getAndIncrement().toString()
- log.info("$deviceInfo: closeSession: messageId($messageId)")
- try {
- val messageContent = NetconfMessageUtils.closeSession(messageId, force)
- output = asyncRpc(messageContent, messageId)
- } catch (e: Exception) {
- output.status = RpcStatus.FAILURE
- output.errorMessage = "$deviceInfo: failed in closeSession command " + e.message
- }
- return output
- }
-
- @Throws(NetconfException::class)
- override fun asyncRpc(request: String, messageId: String): DeviceResponse {
- val response = DeviceResponse()
- log.info("$deviceInfo: send asyncRpc with messageId($messageId)")
- response.requestMessage = request
-
- val rpcResponse = netconfSession.asyncRpc(request, messageId).get(responseTimeout.toLong(), TimeUnit.SECONDS)
- if (!NetconfMessageUtils.checkReply(rpcResponse)) {
- throw NetconfException(rpcResponse)
- }
- response.responseMessage = rpcResponse
- response.status = RpcStatus.SUCCESS
- response.errorMessage = null
- return response
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
deleted file mode 100644
index 2dd73ef1..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core
-
-import com.google.common.collect.ImmutableList
-import com.google.common.collect.ImmutableSet
-import org.apache.sshd.client.SshClient
-import org.apache.sshd.client.channel.ChannelSubsystem
-import org.apache.sshd.client.channel.ClientChannel
-import org.apache.sshd.client.session.ClientSession
-import org.apache.sshd.client.session.ClientSessionImpl
-import org.apache.sshd.common.FactoryManager
-import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfException
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfReceivedEvent
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfRpcService
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfSession
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfSessionListener
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.NetconfMessageUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.RpcMessageUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.RpcStatus
-import org.slf4j.LoggerFactory
-import java.io.IOException
-import java.util.*
-import java.util.concurrent.CompletableFuture
-import java.util.concurrent.ConcurrentHashMap
-import java.util.concurrent.ExecutionException
-import java.util.concurrent.TimeUnit
-import java.util.concurrent.TimeoutException
-import java.util.concurrent.atomic.AtomicReference
-
-class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcService: NetconfRpcService) :
- NetconfSession {
-
- private val log = LoggerFactory.getLogger(NetconfSessionImpl::class.java)
-
- private val errorReplies: MutableList<String> = Collections.synchronizedList(listOf())
- private val replies: MutableMap<String, CompletableFuture<String>> = ConcurrentHashMap()
- private val deviceCapabilities = setOf<String>()
-
- private var connectionTimeout: Long = 0
- private var replyTimeout: Int = 0
- private var idleTimeout: Int = 0
- private var sessionId: String? = null
-
- private lateinit var session: ClientSession
- private lateinit var client: SshClient
- private lateinit var channel: ClientChannel
- private lateinit var streamHandler: NetconfDeviceCommunicator
-
- private var capabilities =
- ImmutableList.of(RpcMessageUtils.NETCONF_10_CAPABILITY, RpcMessageUtils.NETCONF_11_CAPABILITY)
-
- override fun connect() {
- try {
- log.info("$deviceInfo: Connecting to Netconf Device with timeouts C:${deviceInfo.connectTimeout}, " +
- "R:${deviceInfo.replyTimeout}, I:${deviceInfo.idleTimeout}")
- startConnection()
- log.info("$deviceInfo: Connected to Netconf Device")
- } catch (e: NetconfException) {
- log.error("$deviceInfo: Netconf Device Connection Failed. ${e.message}")
- throw NetconfException(e)
- }
- }
-
- override fun disconnect() {
- if (rpcService.closeSession(false).status.equals(
- RpcStatus.FAILURE, true)) {
- rpcService.closeSession(true)
- }
-
- session.close()
- // Closes the socket which should interrupt the streamHandler
- channel.close()
- client.close()
- }
-
- override fun reconnect() {
- disconnect()
- connect()
- }
-
- override fun syncRpc(request: String, messageId: String): String {
- val formattedRequest = NetconfMessageUtils.formatRPCRequest(request, messageId, deviceCapabilities)
-
- checkAndReestablish()
-
- try {
- return streamHandler.sendMessage(formattedRequest, messageId).get(replyTimeout.toLong(), TimeUnit.SECONDS)
-// replies.remove(messageId)
- } catch (e: InterruptedException) {
- Thread.currentThread().interrupt()
- throw NetconfException("$deviceInfo: Interrupted while waiting for reply for request: $formattedRequest", e)
- } catch (e: TimeoutException) {
- throw NetconfException("$deviceInfo: Timed out while waiting for reply for request $formattedRequest after $replyTimeout sec.",
- e)
- } catch (e: ExecutionException) {
- log.warn("$deviceInfo: Closing session($sessionId) due to unexpected Error", e)
- try {
- session.close()
- // Closes the socket which should interrupt the streamHandler
- channel.close()
- client.close()
- } catch (ioe: IOException) {
- log.warn("$deviceInfo: Error closing session($sessionId) for host($deviceInfo)", ioe)
- }
-
-// NetconfReceivedEvent(NetconfReceivedEvent.Type.SESSION_CLOSED, "",
-// "Closed due to unexpected error " + e.cause, "-1", deviceInfo)
- errorReplies.clear() // move to cleanUp()?
- replies.clear()
-
- throw NetconfException("$deviceInfo: Closing session $sessionId for request $formattedRequest", e)
- }
- }
-
- override fun asyncRpc(request: String, messageId: String): CompletableFuture<String> {
- val formattedRequest = NetconfMessageUtils.formatRPCRequest(request, messageId, deviceCapabilities)
-
- checkAndReestablish()
-
- return streamHandler.sendMessage(formattedRequest, messageId).handleAsync { reply, t ->
- if (t != null) {
- throw NetconfException(messageId, t)
- }
- reply
- }
- }
-
- override fun checkAndReestablish() {
- try {
- if (client.isClosed) {
- log.info("Trying to restart the whole SSH connection with {}", deviceInfo)
- replies.clear()
- startConnection()
- } else if (session.isClosed) {
- log.info("Trying to restart the session with {}", deviceInfo)
- replies.clear()
- startSession()
- } else if (channel.isClosed) {
- log.info("Trying to reopen the channel with {}", deviceInfo)
- replies.clear()
- openChannel()
- } else {
- return
- }
- } catch (e: IOException) {
- log.error("Can't reopen connection for device {}", e.message)
- throw NetconfException(String.format("Cannot re-open the connection with device (%s)", deviceInfo), e)
- } catch (e: IllegalStateException) {
- log.error("Can't reopen connection for device {}", e.message)
- throw NetconfException(String.format("Cannot re-open the connection with device (%s)", deviceInfo), e)
- }
-
- }
-
- override fun getDeviceInfo(): DeviceInfo {
- return deviceInfo
- }
-
- override fun getSessionId(): String {
- return this.sessionId!!
- }
-
- override fun getDeviceCapabilitiesSet(): Set<String> {
- return Collections.unmodifiableSet(deviceCapabilities)
- }
-
- private fun startConnection() {
- connectionTimeout = deviceInfo.connectTimeout
- replyTimeout = deviceInfo.replyTimeout
- idleTimeout = deviceInfo.idleTimeout
- try {
- startClient()
- } catch (e: Exception) {
- throw NetconfException("$deviceInfo: Failed to establish SSH session", e)
- }
-
- }
-
- private fun startClient() {
- client = SshClient.setUpDefaultClient()
- client.properties.putIfAbsent(FactoryManager.IDLE_TIMEOUT, TimeUnit.SECONDS.toMillis(idleTimeout.toLong()))
- client.properties.putIfAbsent(FactoryManager.NIO2_READ_TIMEOUT, TimeUnit.SECONDS.toMillis(idleTimeout + 15L))
- client.keyPairProvider = SimpleGeneratorHostKeyProvider()
- client.start()
-
- startSession()
- }
-
- private fun startSession() {
- log.info("$deviceInfo: Starting SSH session")
- val connectFuture = client.connect(deviceInfo.username, deviceInfo.ipAddress, deviceInfo.port)
- .verify(connectionTimeout, TimeUnit.SECONDS)
- session = connectFuture.session
- log.info("$deviceInfo: SSH session created")
-
- authSession()
- }
-
- private fun authSession() {
- session.addPasswordIdentity(deviceInfo.password)
- session.auth().verify(connectionTimeout, TimeUnit.SECONDS)
- val event = session.waitFor(ImmutableSet.of(ClientSession.ClientSessionEvent.WAIT_AUTH,
- ClientSession.ClientSessionEvent.CLOSED, ClientSession.ClientSessionEvent.AUTHED), 0)
- if (!event.contains(ClientSession.ClientSessionEvent.AUTHED)) {
- throw NetconfException("$deviceInfo: Failed to authenticate session.")
- }
- log.info("$deviceInfo: SSH session authenticated")
-
- openChannel()
- }
-
- private fun openChannel() {
- channel = session.createSubsystemChannel("netconf")
- val channelFuture = channel.open()
- if (channelFuture.await(connectionTimeout, TimeUnit.SECONDS) && channelFuture.isOpened) {
- log.info("$deviceInfo: SSH NETCONF subsystem channel opened")
- setupHandler()
- } else {
- throw NetconfException("$deviceInfo: Failed to open SSH subsystem channel")
- }
- }
-
- private fun setupHandler() {
- val sessionListener: NetconfSessionListener = NetconfSessionListenerImpl()
- streamHandler = NetconfDeviceCommunicator(channel.invertedOut, channel.invertedIn, deviceInfo,
- sessionListener, replies)
-
- exchangeHelloMessage()
- }
-
- private fun exchangeHelloMessage() {
- sessionId = "-1"
- val messageId = "-1"
-
- val serverHelloResponse = syncRpc(NetconfMessageUtils.createHelloString(capabilities), messageId)
- val sessionIDMatcher = NetconfMessageUtils.SESSION_ID_REGEX_PATTERN.matcher(serverHelloResponse)
-
- if (sessionIDMatcher.find()) {
- sessionId = sessionIDMatcher.group(1)
- } else {
- throw NetconfException("$deviceInfo: Missing sessionId in server hello message: $serverHelloResponse")
- }
-
- val capabilityMatcher = NetconfMessageUtils.CAPABILITY_REGEX_PATTERN.matcher(serverHelloResponse)
- while (capabilityMatcher.find()) {
- deviceCapabilities.plus(capabilityMatcher.group(1))
- }
- }
-
- inner class NetconfSessionListenerImpl : NetconfSessionListener {
- override fun notify(event: NetconfReceivedEvent) {
- val messageId = event.getMessageID()
-
- when (event.getType()) {
- NetconfReceivedEvent.Type.DEVICE_UNREGISTERED -> disconnect()
- NetconfReceivedEvent.Type.DEVICE_ERROR -> errorReplies.add(event.getMessagePayload())
- NetconfReceivedEvent.Type.DEVICE_REPLY -> replies[messageId]?.complete(event.getMessagePayload())
- NetconfReceivedEvent.Type.SESSION_CLOSED -> disconnect()
- }
- }
- }
-
- fun sessionstatus(state:String): Boolean{
- return when (state){
- "Close" -> channel.isClosed
- "Open" -> channel.isOpen
- else -> false
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt
deleted file mode 100644
index 3b3b0c02..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils
-
-enum class NetconfDatastore(val datastore: String) {
- RUNNING("running"),
- CANDIDATE("candidate");
-}
-
-enum class ModifyAction(val action: String) {
- MERGE("merge"),
- REPLACE("replace"),
- NONE("none")
-}
-
-object RpcStatus {
- const val SUCCESS = "success"
- const val FAILURE = "failure"
-}
-
-object RpcMessageUtils {
- const val OPEN = "<"
- const val CLOSE = ">"
- const val EQUAL = "="
-
- const val HASH = "#"
- const val HASH_CHAR = '#'
-
- const val LF_CHAR = '\n'
- const val NEW_LINE = "\n"
-
- const val QUOTE = "\""
- const val QUOTE_SPACE = "\" "
-
- const val TAG_CLOSE = "/>"
- const val END_OF_RPC_OPEN_TAG = "\">"
- const val END_PATTERN = "]]>]]>"
-
- const val HELLO = "hello"
- const val RPC_REPLY = "rpc-reply"
- const val RPC_ERROR = "rpc-error"
-
- const val RPC_OPEN = "<rpc "
- const val RPC_CLOSE = "</rpc>"
- const val WITH_DEFAULT_OPEN = "<with-defaults "
- const val WITH_DEFAULT_CLOSE = "</with-defaults>"
- const val DEFAULT_OPERATION_OPEN = "<default-operation>"
- const val DEFAULT_OPERATION_CLOSE = "</default-operation>"
- const val SUBTREE_FILTER_OPEN = "<filter type=\"subtree\">"
- const val SUBTREE_FILTER_CLOSE = "</filter>"
- const val TARGET_OPEN = "<target>"
- const val TARGET_CLOSE = "</target>"
- const val SOURCE_OPEN = "<source>"
- const val SOURCE_CLOSE = "</source>"
- const val CONFIG_OPEN = "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- const val CONFIG_CLOSE = "</config>"
- const val MSGLEN_REGEX_PATTERN = "\n#\\d+\n"
-
- const val NUMBER_BETWEEN_QUOTES_MATCHER = "\"+([0-9]+)+\""
-
- const val XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- const val NETCONF_BASE_NAMESPACE = "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\""
- const val NETCONF_WITH_DEFAULTS_NAMESPACE = "xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\""
- const val SUBSCRIPTION_SUBTREE_FILTER_OPEN =
- "<filter xmlns:base10=\"urn:ietf:params:xml:ns:netconf:base:1.0\" base10:type=\"subtree\">"
-
- const val INTERLEAVE_CAPABILITY_STRING = "urn:ietf:params:netconf:capability:interleave:1.0"
-
- const val CAPABILITY_REGEX = "capability>\\s*(.*?)\\s*capability>"
-
- const val SESSION_ID_REGEX = "session-id>\\s*(.*?)\\s*session-id>"
-
- const val MESSAGE_ID_STRING = "message-id"
-
- const val NETCONF_10_CAPABILITY = "urn:ietf:params:netconf:base:1.0"
- const val NETCONF_11_CAPABILITY = "urn:ietf:params:netconf:base:1.1"
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
deleted file mode 100644
index 4de3860c..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils
-
-import org.apache.commons.lang3.StringUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfException
-import org.slf4j.LoggerFactory
-import org.xml.sax.InputSource
-import java.io.StringReader
-import java.nio.charset.StandardCharsets
-import java.util.regex.MatchResult
-import java.util.regex.Pattern
-import javax.xml.XMLConstants
-import javax.xml.parsers.DocumentBuilderFactory
-import kotlin.text.Charsets.UTF_8
-
-
-class NetconfMessageUtils {
-
- companion object {
- val log = LoggerFactory.getLogger(NetconfMessageUtils::class.java)
-
- const val NEW_LINE = "\n"
- const val CHUNKED_END_REGEX_PATTERN = "\n##\n"
-
- val CAPABILITY_REGEX_PATTERN: Pattern = Pattern.compile(RpcMessageUtils.CAPABILITY_REGEX)
- val SESSION_ID_REGEX_PATTERN: Pattern = Pattern.compile(RpcMessageUtils.SESSION_ID_REGEX)
-
- private val CHUNKED_FRAMING_PATTERN: Pattern =
- Pattern.compile("(\\n#([1-9][0-9]*)\\n(.+))+\\n##\\n", Pattern.DOTALL)
- private val CHUNKED_SIZE_PATTERN: Pattern = Pattern.compile("\\n#([1-9][0-9]*)\\n")
- private val MSG_ID_STRING_PATTERN = Pattern.compile("${RpcMessageUtils.MESSAGE_ID_STRING}=\"(.*?)\"")
-
- fun getConfig(messageId: String, configType: String, filterContent: String?): String {
- val request = StringBuilder()
-
- request.append("<get-config>").append(NEW_LINE)
- request.append(RpcMessageUtils.SOURCE_OPEN).append(NEW_LINE)
- request.append(RpcMessageUtils.OPEN).append(configType).append(RpcMessageUtils.TAG_CLOSE)
- .append(NEW_LINE)
- request.append(RpcMessageUtils.SOURCE_CLOSE).append(NEW_LINE)
-
- if (!filterContent.isNullOrEmpty()) {
- request.append(RpcMessageUtils.SUBTREE_FILTER_OPEN).append(NEW_LINE)
- request.append(filterContent).append(NEW_LINE)
- request.append(RpcMessageUtils.SUBTREE_FILTER_CLOSE).append(NEW_LINE)
- }
- request.append("</get-config>").append(NEW_LINE)
-
- return doWrappedRpc(messageId, request.toString())
- }
-
- fun doWrappedRpc(messageId: String, request: String): String {
- val rpc = StringBuilder(RpcMessageUtils.XML_HEADER).append(NEW_LINE)
- rpc.append(RpcMessageUtils.RPC_OPEN)
- rpc.append(RpcMessageUtils.MESSAGE_ID_STRING).append(RpcMessageUtils.EQUAL)
- rpc.append(RpcMessageUtils.QUOTE).append(messageId).append(RpcMessageUtils.QUOTE_SPACE)
- rpc.append(RpcMessageUtils.NETCONF_BASE_NAMESPACE).append(RpcMessageUtils.CLOSE)
- .append(NEW_LINE)
- rpc.append(request)
- rpc.append(RpcMessageUtils.RPC_CLOSE)
- // rpc.append(NEW_LINE).append(END_PATTERN);
-
- return rpc.toString()
- }
-
- fun editConfig(messageId: String, configType: String, defaultOperation: String?,
- newConfiguration: String): String {
-
- val request = StringBuilder()
-
- request.append("<edit-config>").append(NEW_LINE)
- request.append(RpcMessageUtils.TARGET_OPEN).append(NEW_LINE)
- request.append(RpcMessageUtils.OPEN).append(configType).append(RpcMessageUtils.TAG_CLOSE)
- .append(NEW_LINE)
- request.append(RpcMessageUtils.TARGET_CLOSE).append(NEW_LINE)
-
- if (defaultOperation != null) {
- request.append(RpcMessageUtils.DEFAULT_OPERATION_OPEN).append(defaultOperation)
- .append(RpcMessageUtils.DEFAULT_OPERATION_CLOSE)
- request.append(NEW_LINE)
- }
-
- request.append(RpcMessageUtils.CONFIG_OPEN).append(NEW_LINE)
- request.append(newConfiguration.trim { it <= ' ' }).append(NEW_LINE)
- request.append(RpcMessageUtils.CONFIG_CLOSE).append(NEW_LINE)
- request.append("</edit-config>").append(NEW_LINE)
-
- return doWrappedRpc(messageId, request.toString())
- }
-
- fun validate(messageId: String, configType: String): String {
- val request = StringBuilder()
-
- request.append("<validate>").append(NEW_LINE)
- request.append(RpcMessageUtils.SOURCE_OPEN).append(NEW_LINE)
- request.append(RpcMessageUtils.OPEN).append(configType).append(RpcMessageUtils.TAG_CLOSE)
- .append(NEW_LINE)
- request.append(RpcMessageUtils.SOURCE_CLOSE).append(NEW_LINE)
- request.append("</validate>").append(NEW_LINE)
-
- return doWrappedRpc(messageId, request.toString())
- }
-
- fun commit(messageId: String, confirmed: Boolean, confirmTimeout: Int, persist: String,
- persistId: String): String {
-
- if (!persist.isEmpty() && !persistId.isEmpty()) {
- throw NetconfException("Can't proceed <commit> with both persist($persist) and " +
- "persistId($persistId) specified. Only one should be specified.")
- }
- if (confirmed && !persistId.isEmpty()) {
- throw NetconfException("Can't proceed <commit> with both confirmed flag and " +
- "persistId($persistId) specified. Only one should be specified.")
- }
-
- val request = StringBuilder()
- request.append("<commit>").append(NEW_LINE)
- if (confirmed) {
- request.append("<confirmed/>")
- request.append("<confirm-timeout>$confirmTimeout</confirm-timeout>")
- if (!persist.isEmpty()) {
- request.append("<persist>$persist</persist>")
- }
- }
- if (!persistId.isEmpty()) {
- request.append("<persist-id>$persistId</persist-id>")
- }
- request.append("</commit>").append(NEW_LINE)
-
- return doWrappedRpc(messageId, request.toString())
- }
-
- fun cancelCommit(messageId: String, persistId: String): String {
- val request = StringBuilder()
- request.append("<cancel-commit>").append(NEW_LINE)
- if (!persistId.isEmpty()) {
- request.append("<persist-id>$persistId</persist-id>")
- }
- request.append("</cancel-commit>").append(NEW_LINE)
-
- return doWrappedRpc(messageId, request.toString())
- }
-
- fun unlock(messageId: String, configType: String): String {
- val request = StringBuilder()
-
- request.append("<unlock>").append(NEW_LINE)
- request.append(RpcMessageUtils.TARGET_OPEN).append(NEW_LINE)
- request.append(RpcMessageUtils.OPEN).append(configType).append(RpcMessageUtils.TAG_CLOSE)
- .append(NEW_LINE)
- request.append(RpcMessageUtils.TARGET_CLOSE).append(NEW_LINE)
- request.append("</unlock>").append(NEW_LINE)
-
- return doWrappedRpc(messageId, request.toString())
- }
-
- @Throws(NetconfException::class)
- fun deleteConfig(messageId: String, configType: String): String {
- if (configType == NetconfDatastore.RUNNING.datastore) {
- log.warn("Target configuration for delete operation can't be \"running\" {}", configType)
- throw NetconfException("Target configuration for delete operation can't be running")
- }
-
- val request = StringBuilder()
-
- request.append("<delete-config>").append(NEW_LINE)
- request.append(RpcMessageUtils.TARGET_OPEN).append(NEW_LINE)
- request.append(RpcMessageUtils.OPEN).append(configType)
- .append(RpcMessageUtils.TAG_CLOSE)
- .append(NEW_LINE)
- request.append(RpcMessageUtils.TARGET_CLOSE).append(NEW_LINE)
- request.append("</delete-config>").append(NEW_LINE)
-
- return doWrappedRpc(messageId, request.toString())
- }
-
- fun discardChanges(messageId: String): String {
- val request = StringBuilder()
- request.append("<discard-changes/>").append(NEW_LINE)
- return doWrappedRpc(messageId, request.toString())
- }
-
- fun lock(messageId: String, configType: String): String {
- val request = StringBuilder()
-
- request.append("<lock>").append(NEW_LINE)
- request.append(RpcMessageUtils.TARGET_OPEN).append(NEW_LINE)
- request.append(RpcMessageUtils.OPEN).append(configType).append(RpcMessageUtils.TAG_CLOSE)
- .append(NEW_LINE)
- request.append(RpcMessageUtils.TARGET_CLOSE).append(NEW_LINE)
- request.append("</lock>").append(NEW_LINE)
-
- return doWrappedRpc(messageId, request.toString())
- }
-
- fun closeSession(messageId: String, force: Boolean): String {
- val request = StringBuilder()
-
- if (force) {
- request.append("<kill-session/>").append(NEW_LINE)
- } else {
- request.append("<close-session/>").append(NEW_LINE)
- }
-
- return doWrappedRpc(messageId, request.toString())
- }
-
- fun validateRPCXML(rpcRequest: String): Boolean {
- try {
- if (StringUtils.isBlank(rpcRequest)) {
- return false
- }
- val dbf = DocumentBuilderFactory.newInstance()
- dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true)
- dbf.setFeature("http://xml.org/sax/features/external-general-entities", false)
- dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false)
- dbf.newDocumentBuilder()
- .parse(InputSource(StringReader(rpcRequest.replace(RpcMessageUtils.END_PATTERN, ""))))
- return true
- } catch (e: Exception) {
- return false
- }
-
- }
-
- fun getMsgId(message: String): String {
- val matcher = MSG_ID_STRING_PATTERN.matcher(message)
- if (matcher.find()) {
- return matcher.group(1)
- }
- return if (message.contains(RpcMessageUtils.HELLO)) {
- (-1).toString()
- } else ""
- }
-
- fun validateChunkedFraming(reply: String): Boolean {
- val matcher = CHUNKED_FRAMING_PATTERN.matcher(reply)
- if (!matcher.matches()) {
- log.debug("Error Reply: {}", reply)
- return false
- }
- val chunkM = CHUNKED_SIZE_PATTERN.matcher(reply)
- val chunks = ArrayList<MatchResult>()
- var chunkdataStr = ""
- while (chunkM.find()) {
- chunks.add(chunkM.toMatchResult())
- // extract chunk-data (and later) in bytes
- val bytes = Integer.parseInt(chunkM.group(1))
- val chunkdata = reply.substring(chunkM.end()).toByteArray(StandardCharsets.UTF_8)
- if (bytes > chunkdata.size) {
- log.debug("Error Reply - wrong chunk size {}", reply)
- return false
- }
- // convert (only) chunk-data part into String
- chunkdataStr = String(chunkdata, 0, bytes, StandardCharsets.UTF_8)
- // skip chunk-data part from next match
- chunkM.region(chunkM.end() + chunkdataStr.length, reply.length)
- }
- if (!CHUNKED_END_REGEX_PATTERN.equals(reply.substring(chunks[chunks.size - 1].end() + chunkdataStr.length))) {
- log.debug("Error Reply: {}", reply)
- return false
- }
- return true
- }
-
- fun createHelloString(capabilities: List<String>): String {
- val helloMessage = StringBuilder()
- helloMessage.append(RpcMessageUtils.XML_HEADER).append(NEW_LINE)
- helloMessage.append("<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">").append(NEW_LINE)
- helloMessage.append(" <capabilities>").append(NEW_LINE)
- if (capabilities.isNotEmpty()) {
- capabilities.forEach { cap ->
- helloMessage.append(" <capability>").append(cap).append("</capability>").append(NEW_LINE)
- }
- }
- helloMessage.append(" </capabilities>").append(NEW_LINE)
- helloMessage.append("</hello>").append(NEW_LINE)
- helloMessage.append(RpcMessageUtils.END_PATTERN)
- return helloMessage.toString()
- }
-
- fun formatRPCRequest(request: String, messageId: String, deviceCapabilities: Set<String>): String {
- var request = request
- request = NetconfMessageUtils.formatNetconfMessage(deviceCapabilities, request)
- request = NetconfMessageUtils.formatXmlHeader(request)
- request = NetconfMessageUtils.formatRequestMessageId(request, messageId)
-
- return request
- }
-
- /**
- * Validate and format netconf message. - NC1.0 if no EOM sequence present on `message`,
- * append. - NC1.1 chunk-encode given message unless it already is chunk encoded
- *
- * @param deviceCapabilities Set containing Device Capabilities
- * @param message to format
- * @return formated message
- */
- fun formatNetconfMessage(deviceCapabilities: Set<String>, message: String): String {
- var message = message
- if (deviceCapabilities.contains(RpcMessageUtils.NETCONF_11_CAPABILITY)) {
- message = formatChunkedMessage(message)
- } else if (!message.endsWith(RpcMessageUtils.END_PATTERN)) {
- message = message + NEW_LINE + RpcMessageUtils.END_PATTERN
- }
- return message
- }
-
- /**
- * Validate and format message according to chunked framing mechanism.
- *
- * @param message to format
- * @return formated message
- */
- fun formatChunkedMessage(message: String): String {
- var message = message
- if (message.endsWith(RpcMessageUtils.END_PATTERN)) {
- // message given had Netconf 1.0 EOM pattern -> remove
- message = message.substring(0, message.length - RpcMessageUtils.END_PATTERN.length)
- }
- if (!message.startsWith(RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH)) {
- // chunk encode message
- message =
- (RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + message.toByteArray(UTF_8).size + RpcMessageUtils.NEW_LINE + message + RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH
- + RpcMessageUtils.NEW_LINE)
- }
- return message
- }
-
- /**
- * Ensures xml start directive/declaration appears in the `request`.
- *
- * @param request RPC request message
- * @return XML RPC message
- */
- fun formatXmlHeader(request: String): String {
- var request = request
- if (!request.contains(RpcMessageUtils.XML_HEADER)) {
- if (request.startsWith(RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH)) {
- request =
- request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0] + RpcMessageUtils.XML_HEADER + request.substring(
- request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].length)
- } else {
- request = RpcMessageUtils.XML_HEADER + "\n" + request
- }
- }
- return request
- }
-
- fun formatRequestMessageId(request: String, messageId: String): String {
- var request = request
- if (request.contains(RpcMessageUtils.MESSAGE_ID_STRING)) {
- request =
- request.replaceFirst((RpcMessageUtils.MESSAGE_ID_STRING + RpcMessageUtils.EQUAL + RpcMessageUtils.NUMBER_BETWEEN_QUOTES_MATCHER).toRegex(),
- RpcMessageUtils.MESSAGE_ID_STRING + RpcMessageUtils.EQUAL + RpcMessageUtils.QUOTE + messageId + RpcMessageUtils.QUOTE)
- } else if (!request.contains(RpcMessageUtils.MESSAGE_ID_STRING) && !request.contains(
- RpcMessageUtils.HELLO)) {
- request = request.replaceFirst(RpcMessageUtils.END_OF_RPC_OPEN_TAG.toRegex(),
- RpcMessageUtils.QUOTE_SPACE + RpcMessageUtils.MESSAGE_ID_STRING + RpcMessageUtils.EQUAL + RpcMessageUtils.QUOTE + messageId + RpcMessageUtils.QUOTE + ">")
- }
- return updateRequestLength(request)
- }
-
- fun updateRequestLength(request: String): String {
- if (request.contains(NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH + NEW_LINE)) {
- val oldLen =
- Integer.parseInt(request.split(RpcMessageUtils.HASH.toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()[1].split(
- NEW_LINE.toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()[0])
- val rpcWithEnding = request.substring(request.indexOf('<'))
- val firstBlock =
- request.split(RpcMessageUtils.MSGLEN_REGEX_PATTERN.toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()[1].split(
- (NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH + NEW_LINE).toRegex()).dropLastWhile(
- { it.isEmpty() }).toTypedArray()[0]
- var newLen = 0
- newLen = firstBlock.toByteArray(UTF_8).size
- if (oldLen != newLen) {
- return NEW_LINE + RpcMessageUtils.HASH + newLen + NEW_LINE + rpcWithEnding
- }
- }
- return request
- }
-
- fun checkReply(reply: String?): Boolean {
- return if (reply != null) {
- !reply.contains("rpc-error>") || reply.contains("warning") || reply.contains("ok/>")
- } else false
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt
deleted file mode 100644
index e2b90199..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Modifications Copyright © 2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.annotation.DirtiesContext
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-
-@RunWith(SpringRunner::class)
-@EnableAutoConfiguration
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@DirtiesContext
-@TestPropertySource(properties =
-["blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_netconf,./../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_netconf"],
- locations = ["classpath:application-test.properties"])
-class ComponentNetconfExecutorTest {
-
- @Autowired
- lateinit var componentNetconfExecutor: ComponentNetconfExecutor
-
-
- @Test
- fun testComponentNetconfExecutor() {
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("requests/sample-activate-request.json",
- ExecutionServiceInput::class.java)!!
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- val executionContext = bluePrintRuntimeService.getExecutionContext()
-
-
- componentNetconfExecutor.bluePrintRuntimeService = bluePrintRuntimeService
-
- //TODO("Set Attribute properties")
- val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
- stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-netconf")
- stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ComponentNetconfExecutor")
- stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
- // Set Step Inputs in Blueprint Runtime Service
- bluePrintRuntimeService.put("activate-netconf-step-inputs", stepMetaData.asJsonNode())
-
- componentNetconfExecutor.bluePrintRuntimeService = bluePrintRuntimeService
- componentNetconfExecutor.stepName = "activate-netconf"
- componentNetconfExecutor.apply(executionServiceInput)
-
- }
-}
-
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfSessionImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfSessionImplTest.kt
deleted file mode 100644
index e7a51434..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/NetconfSessionImplTest.kt
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor
-
-import org.apache.sshd.client.channel.ChannelSubsystem
-import org.apache.sshd.client.session.ClientSessionImpl
-import org.junit.After
-import org.junit.Assert
-import org.junit.Before
-import org.junit.Test
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core.NetconfRpcServiceImpl
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core.NetconfSessionImpl
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.mocks.NetconfDeviceSimulator
-import java.util.concurrent.atomic.AtomicReference
-import kotlin.script.experimental.api.asSuccess
-
-class NetconfSessionImplTest {
-
- private var device: NetconfDeviceSimulator? = null
- private var deviceInfo: DeviceInfo? = null
-
- @Before
- fun before() {
- deviceInfo = DeviceInfo().apply {
- username = "username"
- password = "password"
- ipAddress = "localhost"
- port = 2224
- connectTimeout = 10
- }
-
- device = NetconfDeviceSimulator(deviceInfo!!.port)
- device!!.start()
- }
-
- @After
- fun after() {
- device!!.stop()
- }
-
- @Throws(Exception::class)
- fun testNetconfSession() {
- val netconfSession = NetconfSessionImpl(deviceInfo!!, NetconfRpcServiceImpl(DeviceInfo()))
-
- Assert.assertNotNull(netconfSession.getSessionId())
- Assert.assertEquals("localhost:2224", netconfSession.getDeviceInfo().toString())
-
- netconfSession.checkAndReestablish()
-
- Assert.assertNotNull(netconfSession.getSessionId())
- Assert.assertEquals("localhost:2224", netconfSession.getDeviceInfo().toString())
-
- Assert.assertTrue(!netconfSession.getDeviceCapabilitiesSet().isEmpty())
- }
-
- @Test
- fun testNetconfSessionconnect() {
- val netconfSession = NetconfSessionImpl(deviceInfo!!, NetconfRpcServiceImpl(deviceInfo!!))
- netconfSession.connect()
- Assert.assertTrue(netconfSession.sessionstatus("Open"))
- }
-
- @Test
- fun testNetconfSessionreconnect() {
- val netconfSession = NetconfSessionImpl(deviceInfo!!, NetconfRpcServiceImpl(deviceInfo!!))
- netconfSession.connect()
- netconfSession.reconnect()
- Assert.assertTrue(netconfSession.sessionstatus("Open"))
-
- }
- @Test
- fun testNetconfSessiondisconnect() {
- val netconfSession = NetconfSessionImpl(deviceInfo!!, NetconfRpcServiceImpl(deviceInfo!!))
- netconfSession.connect()
- netconfSession.disconnect()
- Assert.assertTrue(netconfSession.sessionstatus("Close"))
-
- }
- @Test
- fun testNetconfSessioncheckAndReestablish() {
- val netconfSession = NetconfSessionImpl(deviceInfo!!, NetconfRpcServiceImpl(deviceInfo!!))
- netconfSession.connect()
- netconfSession.checkAndReestablish()
- Assert.assertTrue(netconfSession.sessionstatus("Open"))
-
-
- }
- @Test
- fun testNetconfSessionconnecgetDeviceInfo() {
- val netconfSession = NetconfSessionImpl(deviceInfo!!, NetconfRpcServiceImpl(deviceInfo!!))
- netconfSession.connect()
- Assert.assertNotNull(netconfSession.getDeviceInfo())
- Assert.assertFalse(!netconfSession.getDeviceCapabilitiesSet().isEmpty())
- }
-
-
-}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
deleted file mode 100644
index 8f1f7150..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
+++ /dev/null
@@ -1,124 +0,0 @@
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core
-
-import org.junit.After
-import org.junit.Assert
-import org.junit.Before
-import org.junit.Test
-
-import org.junit.Assert.*
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.mocks.NetconfDeviceSimulator
-
-class NetconfRpcServiceImplTest {
-
- private var device: NetconfDeviceSimulator? = null
- private var deviceInfo: DeviceInfo? = null
-
- @Before
- fun before() {
- deviceInfo = DeviceInfo().apply {
- username = "username"
- password = "password"
- ipAddress = "localhost"
- port = 2224
- connectTimeout = 10
- }
-
- device = NetconfDeviceSimulator(deviceInfo!!.port)
- device!!.start()
- }
-
- @After
- fun after() {
- device!!.stop()
- }
-
- @Test
- fun setNetconfSession() {
-
- }
-
- @Test
- fun getConfig() {
-
- val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
- val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
- netconfRpcServiceImpl.setNetconfSession(netconfSession)
- netconfSession.connect()
- Assert.assertTrue(netconfRpcServiceImpl.getConfig("filter","target").status.equals("failure"))
- }
-
-
- @Test
- fun deleteConfig() {
-
- val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
- val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
- netconfRpcServiceImpl.setNetconfSession(netconfSession)
- netconfSession.connect()
- Assert.assertTrue(netconfRpcServiceImpl.deleteConfig("target").status.equals("failure"))
- }
-
- @Test
- fun lock() {
- val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
- val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
- netconfRpcServiceImpl.setNetconfSession(netconfSession)
- netconfSession.connect()
- Assert.assertTrue(netconfRpcServiceImpl.lock("target").status.equals("failure"))
- }
-
- @Test
- fun unLock() {
- val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
- val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
- netconfRpcServiceImpl.setNetconfSession(netconfSession)
- netconfSession.connect()
- Assert.assertTrue(netconfRpcServiceImpl.unLock("target").status.equals("failure"))
- }
-
- @Test
- fun commit() {
- val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
- val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
- netconfRpcServiceImpl.setNetconfSession(netconfSession)
- netconfSession.connect()
- Assert.assertTrue(netconfRpcServiceImpl.commit(true,60,"persist","1").status.equals("failure"))
-
- }
-
- @Test
- fun cancelCommit() {
- val netconfSession = NetconfSessionImpl(deviceInfo!!, NetconfRpcServiceImpl(DeviceInfo()))
- val netconfRpcServiceImpl = NetconfRpcServiceImpl(DeviceInfo())
- netconfRpcServiceImpl.setNetconfSession(netconfSession)
- netconfSession.connect()
-
- Assert.assertNotNull(netconfRpcServiceImpl.cancelCommit("1"))
- }
-
- @Test
- fun discardConfig() {
- val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
- val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
- netconfRpcServiceImpl.setNetconfSession(netconfSession)
- netconfSession.connect()
- Assert.assertTrue(netconfRpcServiceImpl.discardConfig().status.equals("failure"))
-
- }
-
- @Test
- fun editConfig() {
- }
-
- @Test
- fun validate() {
- val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
- val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
- netconfRpcServiceImpl.setNetconfSession(netconfSession)
- netconfSession.connect()
- Assert.assertTrue(netconfRpcServiceImpl.validate("target").status.equals("failure"))
-
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/mocks/NetconfDeviceSimulator.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/mocks/NetconfDeviceSimulator.kt
deleted file mode 100644
index a2a3946d..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/mocks/NetconfDeviceSimulator.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.mocks
-
-
-import org.apache.sshd.common.NamedFactory
-import org.apache.sshd.server.Command
-import org.apache.sshd.server.SshServer
-import org.apache.sshd.server.auth.UserAuth
-import org.apache.sshd.server.auth.UserAuthNoneFactory
-import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.NetconfSubsystemFactory
-import java.util.*
-
-
-class NetconfDeviceSimulator(private val port: Int) {
-
- private var sshd: SshServer? = null
-
- fun start() {
- sshd = SshServer.setUpDefaultServer()
- sshd!!.port = port
- sshd!!.keyPairProvider = SimpleGeneratorHostKeyProvider()
-
- val userAuthFactories = ArrayList<NamedFactory<UserAuth>>()
- userAuthFactories.add(UserAuthNoneFactory())
- sshd!!.userAuthFactories = userAuthFactories
-
- val namedFactoryList = ArrayList<NamedFactory<Command>>()
- namedFactoryList.add(NetconfSubsystemFactory())
- sshd!!.subsystemFactories = namedFactoryList
-
- try {
- sshd!!.start()
- } catch (e: Exception) {
- e.printStackTrace()
- }
-
- }
-
- fun stop() {
- try {
- sshd!!.stop(true)
- } catch (e: Exception) {
- e.printStackTrace()
- }
-
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/mocks/NetconfSubsystemFactory.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/mocks/NetconfSubsystemFactory.kt
deleted file mode 100644
index 7eaef030..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/mocks/NetconfSubsystemFactory.kt
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils
-
-
-import java.io.IOException
-import java.io.InputStream
-import java.io.OutputStream
-import org.apache.sshd.common.NamedFactory;
-import org.apache.sshd.server.Command;
-import org.apache.sshd.server.Environment;
-import org.apache.sshd.server.ExitCallback;
-
-
-class NetconfSubsystemFactory : NamedFactory<Command> {
-
- private val END_CHAR_SEQUENCE = "]]>]]>"
-
- override fun create(): Command {
- return NetconfSubsystem()
- }
-
- override fun getName(): String {
- return "netconf"
- }
-
- /**
- * Simple implementation of netconf reading 1 request, sending a 'hello' response and quitting
- */
- inner class NetconfSubsystem : Command {
- private var input: InputStream? = null
- private var out: OutputStream? = null
- private var clientThread: Thread? = null
- private var r: Int = 0
-
- @Throws(IOException::class)
- override fun start(env: Environment) {
- clientThread = Thread(object : Runnable {
-
- override fun run() {
- try {
- val message = StringBuilder()
- while (true) {
- process(createHelloString())
- r = input!!.read()
- if (r == -1) {
- break
- } else {
- val c = r.toChar()
- message.append(c)
- val messageString = message.toString()
- if (messageString.endsWith(END_CHAR_SEQUENCE)) {
- println("Detected end message:\n$messageString")
- process(createHelloString())
- message.setLength(0)
- break
- }
- }
- }
- } catch (e: IOException) {
- e.printStackTrace()
- }
-
- }
-
- @Throws(IOException::class)
- private fun process(xmlMessage: String) {
- println("Sending message:\n$xmlMessage")
- out!!.write(xmlMessage.toByteArray(charset("UTF-8")))
- out!!.write((END_CHAR_SEQUENCE + "\n").toByteArray(charset("UTF-8")))
- out!!.flush()
- }
-
- private fun createHelloString(): String {
- val sessionId = "" + (Math.random() * Integer.MAX_VALUE).toInt()
- return ("<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
- + "<capabilities>\n<capability>urn:ietf:params:netconf:base:1.0</capability>\n"
- + "<capability>urn:ietf:params:netconf:base:1.1</capability>\n</capabilities>\n"
- + "<session-id>" + sessionId + "</session-id>\n</hello>")
- }
- })
-
- clientThread!!.start()
- }
-
- @Throws(Exception::class)
- override fun destroy() {
- try {
- clientThread!!.join(2000)
- } catch (e: InterruptedException) {
- // log.warn("Error joining Client thread" + e.getMessage());
- }
-
- clientThread!!.interrupt()
- }
-
- override fun setInputStream(input: InputStream) {
- this.input = input
- }
-
- override fun setOutputStream(out: OutputStream) {
- this.out = out
- }
-
- override fun setErrorStream(err: OutputStream) {}
-
- override fun setExitCallback(callback: ExitCallback) {}
-
-
-
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
deleted file mode 100644
index 8a60d809..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils
-
-import org.junit.Assert
-import org.junit.Assert.assertTrue
-import org.junit.Test
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.NetconfException
-import kotlin.test.fail
-
-class RpcMessageUtilsTest {
-
- @Test
- fun getConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<get-config><source><candidate/></source><filter type=\"subtree\">Test-Filter-Content</filter>"
- + "</get-config></rpc>")
-
- val messageId = "Test-Message-ID"
- val configType = NetconfDatastore.CANDIDATE.datastore
- val filterContent = "Test-Filter-Content"
-
- val result =
- NetconfMessageUtils.getConfig(messageId, configType, filterContent).replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(result))
- Assert.assertEquals(checkString, result)
- }
-
-
- @Test
- fun editConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<edit-config><target><candidate/></target><default-operation>Test-Default-Operation</default-operation>"
- + "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">Test-Filter-Content</config></edit-config></rpc>")
-
- val messageId = "Test-Message-ID"
- val configType = NetconfDatastore.CANDIDATE.datastore
- val filterContent = "Test-Filter-Content"
- val defaultOperation = "Test-Default-Operation"
-
- val result =
- NetconfMessageUtils.editConfig(messageId, configType, defaultOperation, filterContent).replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(result))
- Assert.assertEquals(checkString, result)
- }
-
- @Test
- fun validate() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<validate><source><candidate/></source></validate></rpc>")
-
- val messageId = "Test-Message-ID"
- val configType = NetconfDatastore.CANDIDATE.datastore
-
- val result = NetconfMessageUtils.validate(messageId, configType).replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(result))
- Assert.assertEquals(checkString, result)
- }
-
- @Test
- fun cancelCommit() {
- val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<cancel-commit>" +
- "<persist-id>1234</persist-id>" +
- "</cancel-commit></rpc>")
-
- val messageId = "Test-Message-ID"
-
- val cancelCommitPersistId =
- NetconfMessageUtils.cancelCommit(messageId, "1234").replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(cancelCommitPersistId))
- Assert.assertEquals(checkString, cancelCommitPersistId)
- }
-
- @Test
- fun cancelCommitNoPersistId() {
- val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<cancel-commit>" +
- "</cancel-commit></rpc>")
-
- val messageId = "Test-Message-ID"
-
- val cancelCommitNoPersistId = NetconfMessageUtils.cancelCommit(messageId, "").replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(cancelCommitNoPersistId))
- Assert.assertEquals(checkString, cancelCommitNoPersistId)
- }
-
- @Test
- fun commit() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<commit></commit></rpc>")
-
- val messageId = "Test-Message-ID"
-
- val commit = NetconfMessageUtils.commit(messageId, false, 0, "", "").replace("[\n\r\t]".toRegex(), "")
-
- val commitWithPersistButNotConfirmed =
- NetconfMessageUtils.commit(messageId, false, 0, "1234", "").replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(commit))
- Assert.assertEquals(checkString, commit)
- Assert.assertEquals(checkString, commitWithPersistButNotConfirmed)
-
- }
-
- @Test
- fun commitPersistId() {
- val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<commit>" +
- "<persist-id>1234</persist-id>" +
- "</commit></rpc>")
-
- val messageId = "Test-Message-ID"
-
- val result = NetconfMessageUtils.commit(messageId, false, 30, "", "1234").replace("[\n\r\t]".toRegex(), "")
- assertTrue(NetconfMessageUtils.validateRPCXML(result))
- Assert.assertEquals(checkString, result)
-
- try {
- NetconfMessageUtils.commit(messageId, true, 30, "", "1234").replace("[\n\r\t]".toRegex(), "")
- } catch (e: NetconfException) {
- Assert.assertEquals("Can't proceed <commit> with both confirmed flag and persistId(1234) specified. Only one should be specified.",
- e.message)
- return
- }
-
- fail()
- }
-
- @Test
- fun commitPersist() {
- val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<commit>" +
- "<confirmed/>" +
- "<confirm-timeout>30</confirm-timeout>" +
- "<persist>1234</persist>" +
- "</commit></rpc>")
-
- val messageId = "Test-Message-ID"
-
- val result = NetconfMessageUtils.commit(messageId, true, 30, "1234", "").replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(result))
- Assert.assertEquals(checkString, result)
-
- try {
- NetconfMessageUtils.commit(messageId, false, 30, "1234", "1234").replace("[\n\r\t]".toRegex(), "")
- } catch (e: NetconfException) {
- Assert.assertEquals("Can't proceed <commit> with both persist(1234) and persistId(1234) specified. Only one should be specified.",
- e.message)
- return
- }
- fail()
- }
-
- @Test
- fun unlock() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<unlock><target><candidate/></target></unlock></rpc>")
-
- val messageId = "Test-Message-ID"
- val configType = NetconfDatastore.CANDIDATE.datastore
-
- val result = NetconfMessageUtils.unlock(messageId, configType).replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(result))
- Assert.assertEquals(checkString, result)
- }
-
- @Test
- fun deleteConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<delete-config><target><candidate/></target></delete-config></rpc>")
-
- val messageId = "Test-Message-ID"
- val netconfTargetConfig = NetconfDatastore.CANDIDATE.datastore
-
- val result = NetconfMessageUtils.deleteConfig(messageId, netconfTargetConfig).replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(result))
- Assert.assertEquals(checkString, result)
- }
-
- @Test
- fun discardChanges() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<discard-changes/></rpc>")
-
- val messageId = "Test-Message-ID"
-
- val result = NetconfMessageUtils.discardChanges(messageId).replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(result))
- Assert.assertEquals(checkString, result)
- }
-
- @Test
- fun lock() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<lock><target><candidate/></target></lock></rpc>")
-
- val messageId = "Test-Message-ID"
- val configType = NetconfDatastore.CANDIDATE.datastore
- val result = NetconfMessageUtils.lock(messageId, configType).replace("[\n\r\t]".toRegex(), "")
-
- assertTrue(NetconfMessageUtils.validateRPCXML(result))
- Assert.assertEquals(checkString, result)
- }
-
- @Test
- fun getMsgId() {
- val checkString = ("testmessage")
-
- var messageId = "message-id=\"testmessage\""
- var result = NetconfMessageUtils.getMsgId(messageId).replace("[\n\r\t]".toRegex(), "")
- Assert.assertEquals(checkString, result)
-
- messageId = "message-id=\"hello\""
- result = NetconfMessageUtils.getMsgId(messageId).replace("[\n\r\t]".toRegex(), "")
- Assert.assertEquals("hello", result)
-
- messageId = "message-id"
- result = NetconfMessageUtils.getMsgId(messageId).replace("[\n\r\t]".toRegex(), "")
- Assert.assertEquals("", result)
- }
-
- @Test
- fun createHelloString() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> "
- +"<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>")
-
- val capability = listOf<String>("hi", "hello")
-
- val result = NetconfMessageUtils.createHelloString(capability).replace("[\n\r\t]".toRegex(), "")
- Assert.assertEquals(checkString, result)
- }
-
- @Test
- fun validateChunkedFraming() {
- val reply = ("hello")
- val result = NetconfMessageUtils.validateChunkedFraming(reply)
- Assert.assertFalse(result)
- }
-
- @Test
- fun checkReply(){
- assertTrue(NetconfMessageUtils.checkReply("ok"))
- }
-
- @Test
- fun formatRPCRequest(){
- val checkString = ("#199" +
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> <capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>" +
- "##")
-
- val request = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> "
- +"<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>")
-
- val messageId = "Test-Message-ID"
-
- val capabilities = setOf<String>("hi", "hello","urn:ietf:params:netconf:base:1.1")
-
- val result = NetconfMessageUtils.formatRPCRequest(request,messageId,capabilities).replace("[\n\r\t]".toRegex(), "")
- Assert.assertEquals(checkString, result)
-
-
- }
-
-
-
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/application-test.properties
deleted file mode 100644
index 6d8b62ff..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/application-test.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-#
-# Modifications Copyright © 2019 IBM, Bell Canada.
-#
-# 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.
-#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
-# Controller Blueprints Core Configuration
-blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
-
-# Python executor
-blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints
-blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml
deleted file mode 100644
index f9ec9fe5..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <logger name="org.springframework.test" level="warn"/>
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/payload/requests/sample-activate-request.json b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/payload/requests/sample-activate-request.json
deleted file mode 100644
index 694589de..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/payload/requests/sample-activate-request.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "actionIdentifiers": {
- "actionName": "activate",
- "blueprintName": "baseconfiguration",
- "blueprintVersion": "1.0.0",
- "mode": "sync"
- },
- "commonHeader": {
- "flags": {
- "force": true,
- "ttl": 3600
- },
- "originatorId": "sdnc",
- "requestId": "123456-1000",
- "subRequestId": "sub-123456-1000",
- "timestamp": "2012-04-23T18:25:43.511Z"
- },
- "payload": {
- "resource-assignment-request": {
- "resource-assignment-properties": {
- "request-id": "1234",
- "service-instance-id": "siid_1234",
- "vnf-id": "vnf_1234",
- "action-name": "assign-activate",
- "scope-type": "vnf-type",
- "hostname": "localhost",
- "vnf_name": "temp_vnf"
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/running-config-input.json b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/running-config-input.json
deleted file mode 100644
index 381cc16c..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/running-config-input.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "api-ver": "2.00",
- "originator-id": "MSO",
- "request-id": "123456",
- "service-instance-id": "ibcx0001vm001",
- "service-type": "AVPN",
- "vnf-type": "vUSP - vDBE-IPX HUB",
- "vnf-id": "123456",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "action-name": "running-config-action",
- "hostname": "localhost",
- "host-port": "22",
- "reservation-id": "hostname"
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/sample-activate-request.json b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/sample-activate-request.json
deleted file mode 100644
index d0b4a0c1..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/sample-activate-request.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "actionIdentifiers": {
- "actionName": "activate",
- "blueprintName": "baseconfiguration",
- "blueprintVersion": "1.0.0",
- "mode": "sync"
- },
- "commonHeader": {
- "flags": {
- "force": true,
- "ttl": 3600
- },
- "originatorId": "sdnc",
- "requestId": "123456-1000",
- "subRequestId": "sub-123456-1000",
- "timestamp": "2012-04-23T18:25:43.511Z"
- },
- "payload": {
- "resource-assignment-request": {
- "resource-assignment-properties": {
- "request-id": "1234",
- "action-name": "assign-activate",
- "scope-type": "vnf-type",
- "hostname": "localhost"
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/sample-resourceresolution-request.json b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/sample-resourceresolution-request.json
deleted file mode 100644
index c37e8891..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/requests/sample-resourceresolution-request.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "actionIdentifiers": {
- "actionName": "sample-action",
- "blueprintName": "sample-blurprint",
- "blueprintVersion": "1.0.0",
- "mode": "sync"
- },
- "commonHeader": {
- "flags": {
- "force": true,
- "ttl": 3600
- },
- "originatorId": "sdnc",
- "requestId": "123456-1000",
- "subRequestId": "sub-123456-1000",
- "timestamp": "2012-04-23T18:25:43.511Z"
- },
- "payload": {
- "resource-assignment-request": {
- "resource-assignment-properties": {
- "request-id": "1234",
- "action-name": "assign-activate",
- "scope-type": "vnf-type",
- "hostname": "localhost"
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/response/get-config-123456.xml b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/response/get-config-123456.xml
deleted file mode 100644
index 85cbeeac..00000000
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/response/get-config-123456.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<rpc-reply message-id="runningconfig-template-123456"
- xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
- xmlns:junos="http://xml.juniper.net/junos/17.4R1/junos">
- <interface-information
- xmlns="http://xml.juniper.net/junos/17.4R1/junos-interface">
- <physical-interface>
- <name>ge-2/3/0</name>
- </physical-interface>
- </interface-information>
-</rpc-reply>
diff --git a/ms/blueprintsprocessor/functions/pom.xml b/ms/blueprintsprocessor/functions/pom.xml
deleted file mode 100755
index 5bc26d5f..00000000
--- a/ms/blueprintsprocessor/functions/pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <packaging>pom</packaging>
- <artifactId>functions</artifactId>
- <name>Blueprints Processor Functions</name>
- <description>Blueprints Processor Functions</description>
- <modules>
- <module>resource-resolution</module>
- <module>python-executor</module>
- <module>netconf-executor</module>
- <module>restconf-executor</module>
- <module>cli-executor</module>
- </modules>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>execution-service</artifactId>
- </dependency>
- <!-- Test Dependencies -->
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/ms/blueprintsprocessor/functions/python-executor/pom.xml b/ms/blueprintsprocessor/functions/python-executor/pom.xml
deleted file mode 100644
index e0c61749..00000000
--- a/ms/blueprintsprocessor/functions/python-executor/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>functions</artifactId>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>python-executor</artifactId>
- <name>Blueprints Processor Function - Python Executor</name>
- <description>Blueprints Processor Function - Python Executor</description>
-
- <dependencies>
- <dependency>
- <groupId>org.python</groupId>
- <artifactId>jython-standalone</artifactId>
- </dependency>
- </dependencies>
-
-
-</project>
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
deleted file mode 100644
index b7f77719..00000000
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Modifications Copyright © 2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.python.executor
-
-import com.fasterxml.jackson.databind.node.ArrayNode
-import org.apache.commons.io.FilenameUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts.BlueprintJythonService
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts.PythonExecutorConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyOrThrow
-import org.onap.ccsdk.apps.controllerblueprints.core.data.OperationAssignment
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.ApplicationContext
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Component
-
-@Component("component-jython-executor")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ComponentJythonExecutor(private var applicationContext: ApplicationContext,
- private val blueprintJythonService: BlueprintJythonService) : AbstractComponentFunction() {
-
- private val log = LoggerFactory.getLogger(ComponentJythonExecutor::class.java)
-
- private var componentFunction: AbstractComponentFunction? = null
-
- override fun prepareRequest(executionRequest: ExecutionServiceInput): ExecutionServiceInput {
- val request = super.prepareRequest(executionRequest)
- // Populate Component Instance
- populateJythonComponentInstance()
- return request
- }
-
- override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing : $operationInputs")
- // Invoke Jython Component Script
- componentFunction!!.process(executionServiceInput)
-
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- componentFunction!!.recover(runtimeException, executionRequest)
- }
-
- private fun populateJythonComponentInstance() {
- val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- val operationAssignment: OperationAssignment = bluePrintContext
- .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName)
-
- val artifactName: String = operationAssignment.implementation?.primary
- ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
-
- val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
-
- val pythonFileName = artifactDefinition.file
- ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
-
- val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
-
- val content: String? = bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
-
- checkNotEmptyOrThrow(content, "artifact ($artifactName) content is empty")
-
- val instanceDependenciesNode: ArrayNode = operationInputs[PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES] as? ArrayNode
- ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})")
-
- val jythonInstance: MutableMap<String, Any> = hashMapOf()
- jythonInstance["log"] = LoggerFactory.getLogger(pythonClassName)
- jythonInstance["bluePrintRuntimeService"] = bluePrintRuntimeService
-
- instanceDependenciesNode.forEach { instanceName ->
- jythonInstance[instanceName.textValue()] = applicationContext.getBean(instanceName.textValue())
- }
-
- // Setup componentFunction
- componentFunction = blueprintJythonService.jythonInstance(bluePrintContext, pythonClassName,
- content!!, jythonInstance)
- componentFunction?.bluePrintRuntimeService = bluePrintRuntimeService
- componentFunction?.executionServiceInput = executionServiceInput
- componentFunction?.stepName = stepName
- componentFunction?.interfaceName = interfaceName
- componentFunction?.operationName = operationName
- componentFunction?.processId = processId
- componentFunction?.workflowName = workflowName
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
deleted file mode 100644
index dd8eb503..00000000
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.python.executor
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.python.executor.mock.MockInstanceConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts.PythonExecutorConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts.PythonExecutorProperty
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [PythonExecutorConfiguration::class, PythonExecutorProperty::class,
- ComponentJythonExecutor::class, MockInstanceConfiguration::class])
-@TestPropertySource(properties =
-["blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"])
-class ComponentJythonExecutorTest {
-
- @Autowired
- lateinit var componentJythonExecutor: ComponentJythonExecutor
-
- @Test
- fun testPythonComponentInjection() {
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-activate-request.json",
- ExecutionServiceInput::class.java)!!
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
- stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-jython")
- stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ComponentJythonExecutor")
- stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
- bluePrintRuntimeService.put("activate-jython-step-inputs", stepMetaData.asJsonNode())
-
- componentJythonExecutor.bluePrintRuntimeService = bluePrintRuntimeService
- componentJythonExecutor.stepName = "activate-jython"
-
-
- componentJythonExecutor.apply(executionServiceInput)
-
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt
deleted file mode 100644
index 41250e0c..00000000
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.python.executor.mock
-
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-
-@Configuration
-open class MockInstanceConfiguration {
- @Bean(name = ["json-parser-service", "netconf-rpc-service"])
- open fun createComponentFunction(): MockJythonService {
- return MockJythonService()
- }
-}
-
-class MockJythonService {
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/logback-test.xml
deleted file mode 100644
index a816a06c..00000000
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json
deleted file mode 100644
index 7142f045..00000000
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "actionIdentifiers": {
- "actionName": "activate",
- "blueprintName": "baseconfiguration",
- "blueprintVersion": "1.0.0",
- "mode": "sync"
- },
- "commonHeader": {
- "flags": {
- "force": true,
- "ttl": 3600
- },
- "originatorId": "sdnc",
- "requestId": "123456-1000",
- "subRequestId": "sub-123456-1000",
- "timestamp": "2012-04-23T18:25:43.511Z"
- },
- "payload": {
- "resource-assignment-request": {
- "resource-assignment-properties": {
- "request-id": "1234",
- "service-instance-id": "siid_1234",
- "vnf-id": "vnf_1234",
- "action-name": "assign-activate",
- "scope-type": "vnf-type",
- "hostname": "localhost",
- "vnf_name": "temp_vnf"
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/pom.xml b/ms/blueprintsprocessor/functions/resource-resolution/pom.xml
deleted file mode 100644
index eafdb9a0..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/pom.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>functions</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>resource-resolution</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Function - Resource Resolution</name>
- <description>Blueprints Processor Function - Resource Resolution</description>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>db-lib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>python-executor</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-testing</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentProcessorScriptConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentProcessorScriptConfiguration.kt
deleted file mode 100644
index ffe09e4d..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentProcessorScriptConfiguration.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
-
-import org.jetbrains.kotlin.script.util.DependsOn
-import org.jetbrains.kotlin.script.util.Repository
-import kotlin.script.experimental.annotations.KotlinScript
-import kotlin.script.experimental.api.ScriptCompilationConfiguration
-import kotlin.script.experimental.api.defaultImports
-import kotlin.script.experimental.jvm.dependenciesFromCurrentContext
-import kotlin.script.experimental.jvm.jvm
-
-@KotlinScript(fileExtension = "resourceassignmentprocessor.kts",
- compilationConfiguration = ResourceAssignmentProcessorScriptConfiguration::class)
-abstract class ResourceAssignmentProcessorScript {
-
-}
-
-object ResourceAssignmentProcessorScriptConfiguration : ScriptCompilationConfiguration(
- {
- defaultImports(DependsOn::class, Repository::class)
- jvm {
- dependenciesFromCurrentContext(
- wholeClasspath = true
- )
- }
- }
-) \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt
deleted file mode 100644
index c4ae1397..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.DefaultBluePrintRuntimeService
-
-class ResourceAssignmentRuntimeService(private var id: String, private var bluePrintContext: BluePrintContext)
- : DefaultBluePrintRuntimeService(id, bluePrintContext) {
-
- private lateinit var resolutionId: String
- private var resourceStore: MutableMap<String, JsonNode> = hashMapOf()
-
- fun createUniqueId(key: String) {
- resolutionId = "$id-$key"
- }
-
- fun cleanResourceStore() {
- resourceStore.clear()
- }
-
- fun putResolutionStore(key: String, value: JsonNode) {
- resourceStore[key] = value
- }
-
- fun getResolutionStore(key: String): JsonNode {
- return resourceStore[key]
- ?: throw BluePrintProcessorException("failed to get execution property ($key)")
- }
-
- fun checkResolutionStore(key: String): Boolean {
- return resourceStore.containsKey(key)
- }
-
- fun getJsonNodeFromResolutionStore(key: String): JsonNode {
- return getResolutionStore(key)
- }
-
- fun getStringFromResolutionStore(key: String): String? {
- return getResolutionStore(key).asText()
- }
-
- fun getBooleanFromResolutionStore(key: String): Boolean? {
- return getResolutionStore(key).asBoolean()
- }
-
- fun getIntFromResolutionStore(key: String): Int? {
- return getResolutionStore(key).asInt()
- }
-
- fun getDoubleFromResolutionStore(key: String): Double? {
- return getResolutionStore(key).asDouble()
- }
-
- fun putDictionaryStore(key: String, value: JsonNode) {
- resourceStore["dictionary-$key"] = value
- }
-
- fun getDictionaryStore(key: String): JsonNode {
- return resourceStore["dictionary-$key"]
- ?: throw BluePrintProcessorException("failed to get execution property (dictionary-$key)")
- }
-
- fun checkDictionaryStore(key: String): Boolean {
- return resourceStore.containsKey("dictionary-$key")
- }
-
- fun getJsonNodeFromDictionaryStore(key: String): JsonNode {
- return getResolutionStore("dictionary-$key")
- }
-
- fun getStringFromDictionaryStore(key: String): String? {
- return getResolutionStore("dictionary-$key").asText()
- }
-
- fun getBooleanFromDictionaryStore(key: String): Boolean? {
- return getResolutionStore("dictionary-$key").asBoolean()
- }
-
- fun getIntFromDictionaryStore(key: String): Int? {
- return getResolutionStore("dictionary-$key").asInt()
- }
-
- fun getDoubleFromDictionaryStore(key: String): Double? {
- return getResolutionStore("dictionary-$key").asDouble()
- }
-
-}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
deleted file mode 100644
index 98d8c65d..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Component
-
-@Component("component-resource-resolution")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ResourceResolutionComponent(private val resourceResolutionService: ResourceResolutionService) :
- AbstractComponentFunction() {
-
- override fun process(executionRequest: ExecutionServiceInput) {
-
- val properties: MutableMap<String, Any> = mutableMapOf()
-
- try {
- val key = getOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_KEY)
- val storeResult = getOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT)
- properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_KEY] = key.asText()
- properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] = storeResult.asBoolean()
- } catch (e: BluePrintProcessorException) {
- // NoOp - these property aren't mandatory, so don't fail the process if not provided.
- }
-
- val artifactPrefixNamesNode = getOperationInput(ResourceResolutionConstants.INPUT_ARTIFACT_PREFIX_NAMES)
- val artifactPrefixNames = JacksonUtils.getListFromJsonNode(artifactPrefixNamesNode, String::class.java)
-
- val resolvedParamContents = resourceResolutionService.resolveResources(bluePrintRuntimeService,
- nodeTemplateName,
- artifactPrefixNames,
- properties)
-
- // Set Output Attributes
- bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
- ResourceResolutionConstants.OUTPUT_ASSIGNMENT_PARAMS, resolvedParamContents.asJsonNode())
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBluePrintError().addError(runtimeException.message!!)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConfiguration.kt
deleted file mode 100644
index 4c24ac69..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConfiguration.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
-
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Configuration
-
-@Configuration
-@ComponentScan
-open class ResourceResolutionConfiguration
-
-
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt
deleted file mode 100644
index b57b88b7..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
-
-object ResourceResolutionConstants {
-
- const val SERVICE_RESOURCE_RESOLUTION = "resource-resolution-service"
- const val PREFIX_RESOURCE_RESOLUTION_PROCESSOR = "rr-processor-"
- const val INPUT_ARTIFACT_PREFIX_NAMES = "artifact-prefix-names"
- const val OUTPUT_ASSIGNMENT_PARAMS = "assignment-params"
- const val FILE_NAME_RESOURCE_DEFINITION_TYPES = "resources_definition_types.json"
- const val RESOURCE_RESOLUTION_INPUT_KEY = "resolution-key";
- const val RESOURCE_RESOLUTION_INPUT_STORE_RESULT = "store-result";
-
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
deleted file mode 100644
index 620696f8..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.db.ResourceResolutionResultService
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyOrThrow
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintTemplateService
-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.ResourceDefinition
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.BulkResourceSequencingUtils
-import org.slf4j.LoggerFactory
-import org.springframework.context.ApplicationContext
-import org.springframework.stereotype.Service
-import java.io.File
-
-interface ResourceResolutionService {
-
- fun registeredResourceSources(): List<String>
-
- fun resolveFromDatabase(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactTemplate: String,
- resolutionKey: String): String
-
- fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactNames: List<String>, properties: Map<String, Any>): MutableMap<String, String>
-
- fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactPrefix: String, properties: Map<String, Any>): String
-
- fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactMapping: String, artifactTemplate: String?): String
-
- fun resolveResourceAssignments(blueprintRuntimeService: BluePrintRuntimeService<*>,
- resourceDictionaries: MutableMap<String, ResourceDefinition>,
- resourceAssignments: MutableList<ResourceAssignment>,
- identifierName: String)
-}
-
-@Service(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
-open class ResourceResolutionServiceImpl(private var applicationContext: ApplicationContext,
- private var resolutionResultService: ResourceResolutionResultService) :
- ResourceResolutionService {
-
- private val log = LoggerFactory.getLogger(ResourceResolutionService::class.java)
-
- override fun registeredResourceSources(): List<String> {
- return applicationContext.getBeanNamesForType(ResourceAssignmentProcessor::class.java)
- .filter { it.startsWith(ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR) }
- .map { it.substringAfter(ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR) }
- }
-
- override fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactNames: List<String>,
- properties: Map<String, Any>): MutableMap<String, String> {
-
- val resolvedParams: MutableMap<String, String> = hashMapOf()
- artifactNames.forEach { artifactName ->
- val resolvedContent = resolveResources(bluePrintRuntimeService, nodeTemplateName, artifactName, properties)
- resolvedParams[artifactName] = resolvedContent
- }
- return resolvedParams
- }
-
- override fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactPrefix: String, properties: Map<String, Any>): String {
-
- // Velocity Artifact Definition Name
- val artifactTemplate = "$artifactPrefix-template"
- // Resource Assignment Artifact Definition Name
- val artifactMapping = "$artifactPrefix-mapping"
-
- val result = resolveResources(bluePrintRuntimeService, nodeTemplateName, artifactMapping, artifactTemplate)
-
- if (properties.containsKey(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT)
- && properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] as Boolean) {
- resolutionResultService.write(properties, result, bluePrintRuntimeService, artifactPrefix)
- }
-
- return result
- }
-
- override fun resolveFromDatabase(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactTemplate: String,
- resolutionKey: String): String {
- return resolutionResultService.read(bluePrintRuntimeService, artifactTemplate, resolutionKey)
- }
-
- override fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactMapping: String, artifactTemplate: String?): String {
-
- var resolvedContent = ""
- log.info("Resolving resource for template artifact($artifactTemplate) with resource assignment artifact($artifactMapping)")
-
- val identifierName = artifactTemplate ?: "no-template"
-
- val resourceAssignmentContent =
- bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactMapping)
-
- val resourceAssignments: MutableList<ResourceAssignment> =
- JacksonUtils.getListFromJson(resourceAssignmentContent, ResourceAssignment::class.java)
- as? MutableList<ResourceAssignment>
- ?: throw BluePrintProcessorException("couldn't get Dictionary Definitions")
-
- // Get the Resource Dictionary Name
- val dictionaryFile = bluePrintRuntimeService.bluePrintContext().rootPath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator)
- .plus(ResourceResolutionConstants.FILE_NAME_RESOURCE_DEFINITION_TYPES)
-
- val resourceDictionaries: MutableMap<String, ResourceDefinition> =
- JacksonUtils.getMapFromFile(dictionaryFile, ResourceDefinition::class.java)
- ?: throw BluePrintProcessorException("couldn't get Dictionary Definitions")
-
- // Resolve resources
- resolveResourceAssignments(bluePrintRuntimeService, resourceDictionaries, resourceAssignments, identifierName)
-
- val resolvedParamJsonContent =
- ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments.toList())
-
- // Check Template is there
- if (artifactTemplate != null) {
- val templateContent =
- bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactTemplate)
- resolvedContent = BluePrintTemplateService.generateContent(templateContent, resolvedParamJsonContent)
- } else {
- resolvedContent = resolvedParamJsonContent
- }
-
- return resolvedContent
- }
-
- /**
- * Iterate the Batch, get the Resource Assignment, dictionary Name, Look for the Resource definition for the
- * name, then get the type of the Resource Definition, Get the instance for the Resource Type and process the
- * request.
- */
- override fun resolveResourceAssignments(blueprintRuntimeService: BluePrintRuntimeService<*>,
- resourceDictionaries: MutableMap<String, ResourceDefinition>,
- resourceAssignments: MutableList<ResourceAssignment>,
- identifierName: String) {
-
- val bulkSequenced = BulkResourceSequencingUtils.process(resourceAssignments)
- val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(blueprintRuntimeService, identifierName)
-
- bulkSequenced.map { batchResourceAssignments ->
- batchResourceAssignments.filter { it.name != "*" && it.name != "start" }
- .forEach { resourceAssignment ->
- val dictionaryName = resourceAssignment.dictionaryName
- val dictionarySource = resourceAssignment.dictionarySource
- /**
- * Get the Processor name
- */
- val processorName = processorName(dictionaryName!!, dictionarySource!!, resourceDictionaries)
-
- val resourceAssignmentProcessor =
- applicationContext.getBean(processorName) as? ResourceAssignmentProcessor
- ?: throw BluePrintProcessorException("failed to get resource processor for name($processorName) " +
- "for resource assignment(${resourceAssignment.name})")
- try {
- // Set BluePrint Runtime Service
- resourceAssignmentProcessor.raRuntimeService = resourceAssignmentRuntimeService
- // Set Resource Dictionaries
- resourceAssignmentProcessor.resourceDictionaries = resourceDictionaries
- // Invoke Apply Method
- resourceAssignmentProcessor.apply(resourceAssignment)
-
- // Set errors from RA
- blueprintRuntimeService.setBluePrintError(resourceAssignmentRuntimeService.getBluePrintError())
- } catch (e: RuntimeException) {
- throw BluePrintProcessorException(e)
- }
- }
- }
- }
-
-
- /**
- * If the Source instance is "input", then it is not mandatory to have source Resource Definition, So it can
- * derive the default input processor.
- */
- private fun processorName(dictionaryName: String, dictionarySource: String,
- resourceDictionaries: MutableMap<String, ResourceDefinition>): String {
- var processorName: String? = null
- when (dictionarySource) {
- "input" -> {
- processorName = "${ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-input"
- }
- "default" -> {
- processorName = "${ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-default"
- }
- else -> {
- val resourceDefinition = resourceDictionaries[dictionaryName]
- ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dictionaryName")
-
- val resourceSource = resourceDefinition.sources[dictionarySource]
- ?: throw BluePrintProcessorException("couldn't get resource definition $dictionaryName source($dictionarySource)")
-
- processorName = ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
- .plus(resourceSource.type)
- }
- }
- checkNotEmptyOrThrow(processorName,
- "couldn't get processor name for resource dictionary definition($dictionaryName) source" +
- "($dictionarySource)")
-
- return processorName
-
- }
-}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
deleted file mode 100644
index 25fc8c01..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@file:Suppress("unused")
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
-
-import com.fasterxml.jackson.annotation.JsonProperty
-
-open class ResourceSourceProperties
-
-open class InputResourceSource : ResourceSourceProperties() {
- lateinit var key: String
- @get:JsonProperty("key-dependencies")
- lateinit var keyDependencies: MutableList<String>
-}
-
-open class DefaultResourceSource : ResourceSourceProperties() {
- lateinit var key: String
- @get:JsonProperty("key-dependencies")
- lateinit var keyDependencies: MutableList<String>
-}
-
-open class DatabaseResourceSource : ResourceSourceProperties() {
- lateinit var type: String
- @get:JsonProperty("endpoint-selector")
- var endpointSelector: String? = null
- lateinit var query: String
- @get:JsonProperty("input-key-mapping")
- var inputKeyMapping: MutableMap<String, String>? = null
- @get:JsonProperty("output-key-mapping")
- var outputKeyMapping: MutableMap<String, String>? = null
- @get:JsonProperty("key-dependencies")
- lateinit var keyDependencies: MutableList<String>
-}
-
-open class RestResourceSource : ResourceSourceProperties() {
- lateinit var verb: String
- @get:JsonProperty("payload")
- var payload: String? = null
- lateinit var type: String
- @get:JsonProperty("endpoint-selector")
- var endpointSelector: String? = null
- @get:JsonProperty("url-path")
- lateinit var urlPath: String
- lateinit var path: String
- @get:JsonProperty("expression-type")
- lateinit var expressionType: String
- @get:JsonProperty("input-key-mapping")
- var inputKeyMapping: MutableMap<String, String>? = null
- @get:JsonProperty("output-key-mapping")
- var outputKeyMapping: MutableMap<String, String>? = null
- @get:JsonProperty("key-dependencies")
- lateinit var keyDependencies: MutableList<String>
-}
-
-open class CapabilityResourceSource : ResourceSourceProperties() {
- @get:JsonProperty("script-type")
- lateinit var scriptType: String
- @get:JsonProperty("script-class-reference")
- lateinit var scriptClassReference: String
- @get:JsonProperty("instance-dependencies")
- var instanceDependencies: List<String>? = null
- @get:JsonProperty("key-dependencies")
- lateinit var keyDependencies: MutableList<String>
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionRepository.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionRepository.kt
deleted file mode 100644
index e50c578d..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionRepository.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.db
-
-import org.springframework.data.jpa.repository.JpaRepository
-
-interface ResourceResolutionRepository : JpaRepository<ResourceResolutionResult, String> {
-
- fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(key: String, blueprintName: String?,
- blueprintVersion: String?,
- artifactName: String): ResourceResolutionResult
-}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResult.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResult.kt
deleted file mode 100755
index 814fba5e..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResult.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.db
-
-import com.fasterxml.jackson.annotation.JsonFormat
-import org.hibernate.annotations.Proxy
-import org.springframework.data.annotation.LastModifiedDate
-import org.springframework.data.jpa.domain.support.AuditingEntityListener
-import java.io.Serializable
-import java.util.*
-import javax.persistence.Column
-import javax.persistence.Entity
-import javax.persistence.EntityListeners
-import javax.persistence.Id
-import javax.persistence.Lob
-import javax.persistence.Table
-import javax.persistence.Temporal
-import javax.persistence.TemporalType
-
-@EntityListeners(AuditingEntityListener::class)
-@Entity
-@Table(name = "RESOURCE_RESOLUTION_RESULT")
-@Proxy(lazy = false)
-class ResourceResolutionResult : Serializable {
-
- @Id
- @Column(name = "resource_resolution_result_id")
- var id: String? = null
-
- @Column(name = "resolution_key", nullable = false)
- var resolutionKey: String? = null
-
- @Column(name = "blueprint_name", nullable = false)
- var blueprintName: String? = null
-
- @Column(name = "blueprint_version", nullable = false)
- var blueprintVersion: String? = null
-
- @Column(name = "artifact_name", nullable = false)
- var artifactName: String? = null
-
- @Lob
- @Column(name = "result", nullable = false)
- var result: String? = null
-
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- @LastModifiedDate
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "creation_date")
- var createdDate = Date()
-
- companion object {
- private const val serialVersionUID = 1L
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt
deleted file mode 100644
index 448782a8..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.db
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.dao.DataIntegrityViolationException
-import org.springframework.stereotype.Service
-import java.util.*
-
-@Service
-class ResourceResolutionResultService(private val resourceResolutionRepository: ResourceResolutionRepository) {
-
- fun write(properties: Map<String, Any>, result: String, bluePrintRuntimeService: BluePrintRuntimeService<*>,
- artifactPrefix: String) {
-
- val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
-
- val resourceResolutionResult = ResourceResolutionResult()
- resourceResolutionResult.id = UUID.randomUUID().toString()
- resourceResolutionResult.artifactName = artifactPrefix
- resourceResolutionResult.blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]
- resourceResolutionResult.blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]
- resourceResolutionResult.resolutionKey =
- properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_KEY].toString()
- resourceResolutionResult.result = result
-
- try {
- resourceResolutionRepository.saveAndFlush(resourceResolutionResult)
- } catch (ex: DataIntegrityViolationException) {
- throw BluePrintException("Failed to store resource resolution result.", ex)
- }
- }
-
- fun read(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactPrefix: String,
- resolutionKey: String): String {
-
- val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
-
- val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]
- val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]
-
- return resourceResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
- resolutionKey,
- blueprintName,
- blueprintVersion,
- artifactPrefix).result!!
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
deleted file mode 100644
index 6469e78d..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Modifications Copyright © 2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.CapabilityResourceSource
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.ApplicationContext
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service("${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-capability")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class CapabilityResourceResolutionProcessor(private val applicationContext: ApplicationContext,
- private var componentFunctionScriptingService: ComponentFunctionScriptingService)
- : ResourceAssignmentProcessor() {
-
- private val log = LoggerFactory.getLogger(CapabilityResourceResolutionProcessor::class.java)
-
- var componentResourceAssignmentProcessor: ResourceAssignmentProcessor? = null
-
- override fun getName(): String {
- return "${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-capability"
- }
-
- override fun process(resourceAssignment: ResourceAssignment) {
-
- val resourceDefinition = resourceDictionaries[resourceAssignment.dictionaryName]
- ?: throw BluePrintProcessorException("couldn't get resource definition for ${resourceAssignment.dictionaryName}")
-
- val resourceSource = resourceDefinition.sources[resourceAssignment.dictionarySource]
- ?: throw BluePrintProcessorException("couldn't get resource definition " +
- "${resourceAssignment.dictionaryName} source(${resourceAssignment.dictionarySource})")
-
- val resourceSourceProps = checkNotNull(resourceSource.properties) { "failed to get $resourceSource properties" }
- /**
- * Get the Capability Resource Source Info from Property Definitions.
- */
- val capabilityResourceSourceProperty = JacksonUtils
- .getInstanceFromMap(resourceSourceProps, CapabilityResourceSource::class.java)
-
- val scriptType = capabilityResourceSourceProperty.scriptType
- val scriptClassReference = capabilityResourceSourceProperty.scriptClassReference
- val instanceDependencies = capabilityResourceSourceProperty.instanceDependencies ?: listOf()
-
- componentResourceAssignmentProcessor = scriptInstance(scriptType, scriptClassReference, instanceDependencies)
-
- checkNotNull(componentResourceAssignmentProcessor) {
- "failed to get capability resource assignment processor($scriptClassReference)"
- }
-
- // Assign Current Blueprint runtime and ResourceDictionaries
- componentResourceAssignmentProcessor!!.raRuntimeService = raRuntimeService
- componentResourceAssignmentProcessor!!.resourceDictionaries = resourceDictionaries
-
- // Invoke componentResourceAssignmentProcessor
- componentResourceAssignmentProcessor!!.apply(resourceAssignment)
- }
-
- override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- log.info("Recovering for : ${resourceAssignment.name} : ${runtimeException.toString()}")
- if (componentResourceAssignmentProcessor != null) {
- componentResourceAssignmentProcessor!!.recover(runtimeException, resourceAssignment)
- }
- }
-
- fun scriptInstance(scriptType: String, scriptClassReference: String, instanceDependencies: List<String>)
- : ResourceAssignmentProcessor {
-
- log.info("creating resource resolution of script type($scriptType), reference name($scriptClassReference) and" +
- "instanceDependencies($instanceDependencies)")
-
- val scriptComponent = componentFunctionScriptingService
- .scriptInstance<ResourceAssignmentProcessor>(raRuntimeService.bluePrintContext(), scriptType,
- scriptClassReference)
-
- instanceDependencies.forEach { instanceDependency ->
- scriptPropertyInstances[instanceDependency] = applicationContext
- .getBean(instanceDependency)
- }
- return scriptComponent
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
deleted file mode 100644
index a192989e..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- * Modifications Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
-
-import com.fasterxml.jackson.databind.node.JsonNodeFactory
-import com.fasterxml.jackson.databind.node.MissingNode
-import com.fasterxml.jackson.databind.node.NullNode
-import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibGenericService
-import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.BluePrintDBLibPropertySevice
-import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.PrimaryDBLibGenericService
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.DatabaseResourceSource
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.*
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-import java.util.*
-
-/**
- * DatabaseResourceAssignmentProcessor
- *
- * @author Kapil Singal
- */
-@Service("${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-processor-db")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class DatabaseResourceAssignmentProcessor(private val bluePrintDBLibPropertySevice: BluePrintDBLibPropertySevice, private val primaryDBLibGenericService: PrimaryDBLibGenericService)
- : ResourceAssignmentProcessor() {
-
- private val logger = LoggerFactory.getLogger(DatabaseResourceAssignmentProcessor::class.java)
-
- override fun getName(): String {
- return "${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-processor-db"
- }
-
- override fun process(resourceAssignment: ResourceAssignment) {
- try {
- validate(resourceAssignment)
-
- // Check if It has Input
- try {
- val value = raRuntimeService.getInputValue(resourceAssignment.name)
- if (value !is NullNode && value !is MissingNode) {
- logger.info("processor-db source template key (${resourceAssignment.name}) found from input and value is ($value)")
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
- } else {
- setValueFromDB(resourceAssignment)
- }
- } catch (e: BluePrintProcessorException) {
- setValueFromDB(resourceAssignment)
- }
-
- // Check the value has populated for mandatory case
- ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
- } catch (e: Exception) {
- ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
- throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
- }
- }
-
- private fun setValueFromDB(resourceAssignment: ResourceAssignment) {
- val dName = resourceAssignment.dictionaryName
- val dSource = resourceAssignment.dictionarySource
- val resourceDefinition = resourceDictionaries[dName]
- ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dName")
- val resourceSource = resourceDefinition.sources[dSource]
- ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)")
- val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " }
- val sourceProperties = JacksonUtils.getInstanceFromMap(resourceSourceProperties, DatabaseResourceSource::class.java)
-
- val sql = checkNotNull(sourceProperties.query) { "failed to get request query for $dName under $dSource properties" }
- val inputKeyMapping = checkNotNull(sourceProperties.inputKeyMapping) { "failed to get input-key-mappings for $dName under $dSource properties" }
-
- logger.info("$dSource dictionary information : ($sql), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
- val jdbcTemplate = blueprintDBLibService(sourceProperties)
-
- val rows = jdbcTemplate.query(sql, populateNamedParameter(inputKeyMapping))
- if (rows.isNullOrEmpty()) {
- logger.warn("Failed to get $dSource result for dictionary name ($dName) the query ($sql)")
- } else {
- populateResource(resourceAssignment, sourceProperties, rows)
- }
- }
-
- private fun blueprintDBLibService(sourceProperties: DatabaseResourceSource): BluePrintDBLibGenericService {
- return if (checkNotEmpty(sourceProperties.endpointSelector)) {
- val dbPropertiesJson = raRuntimeService.resolveDSLExpression(sourceProperties.endpointSelector!!)
- bluePrintDBLibPropertySevice.JdbcTemplate(dbPropertiesJson)
- } else {
- primaryDBLibGenericService
- }
-
- }
-
- @Throws(BluePrintProcessorException::class)
- private fun validate(resourceAssignment: ResourceAssignment) {
- checkNotEmptyOrThrow(resourceAssignment.name, "resource assignment template key is not defined")
- checkNotEmptyOrThrow(resourceAssignment.dictionaryName, "resource assignment dictionary name is not defined for template key (${resourceAssignment.name})")
- checkEqualsOrThrow(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, resourceAssignment.dictionarySource) {
- "resource assignment source is not ${ResourceDictionaryConstants.SOURCE_PROCESSOR_DB} but it is ${resourceAssignment.dictionarySource}"
- }
- }
-
- private fun populateNamedParameter(inputKeyMapping: Map<String, String>): Map<String, Any> {
- val namedParameters = HashMap<String, Any>()
- inputKeyMapping.forEach {
- val expressionValue = raRuntimeService.getDictionaryStore(it.value).textValue()
- logger.trace("Reference dictionary key (${it.key}) resulted in value ($expressionValue)")
- namedParameters[it.key] = expressionValue
- }
- logger.info("Parameter information : ({})", namedParameters)
- return namedParameters
- }
-
- @Throws(BluePrintProcessorException::class)
- private fun populateResource(resourceAssignment: ResourceAssignment, sourceProperties: DatabaseResourceSource, rows: List<Map<String, Any>>) {
- val dName = resourceAssignment.dictionaryName
- val dSource = resourceAssignment.dictionarySource
- val type = nullToEmpty(resourceAssignment.property?.type)
-
- val outputKeyMapping = checkNotNull(sourceProperties.outputKeyMapping) { "failed to get output-key-mappings for $dName under $dSource properties" }
- logger.info("Response processing type($type)")
-
- // Primitive Types
- when (type) {
- in BluePrintTypes.validPrimitiveTypes() -> {
- val dbColumnValue = rows[0][outputKeyMapping[dName]]
- logger.info("For template key (${resourceAssignment.name}) setting value as ($dbColumnValue)")
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, dbColumnValue)
- }
- in BluePrintTypes.validCollectionTypes() -> {
- val entrySchemaType = returnNotEmptyOrThrow(resourceAssignment.property?.entrySchema?.type) { "Entry schema is not defined for dictionary ($dName) info" }
- val arrayNode = JsonNodeFactory.instance.arrayNode()
- rows.forEach {
- if (entrySchemaType in BluePrintTypes.validPrimitiveTypes()) {
- val dbColumnValue = it[outputKeyMapping[dName]]
- // Add Array JSON
- JacksonUtils.populatePrimitiveValues(dbColumnValue!!, entrySchemaType, arrayNode)
- } else {
- val arrayChildNode = JsonNodeFactory.instance.objectNode()
- for (mapping in outputKeyMapping.entries) {
- val dbColumnValue = checkNotNull(it[mapping.key])
- val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, entrySchemaType, mapping.key)
- JacksonUtils.populatePrimitiveValues(mapping.key, dbColumnValue, propertyTypeForDataType, arrayChildNode)
- }
- arrayNode.add(arrayChildNode)
- }
- }
- logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)")
- // Set the List of Complex Values
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, arrayNode)
- }
- else -> {
- // Complex Types
- val row = rows[0]
- val objectNode = JsonNodeFactory.instance.objectNode()
- for (mapping in outputKeyMapping.entries) {
- val dbColumnValue = checkNotNull(row[mapping.key])
- val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, type, mapping.key)
- JacksonUtils.populatePrimitiveValues(mapping.key, dbColumnValue, propertyTypeForDataType, objectNode)
- }
- logger.info("For template key (${resourceAssignment.name}) setting value as ($objectNode)")
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, objectNode)
- }
- }
- }
-
- override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- raRuntimeService.getBluePrintError().addError(runtimeException.message!!)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
deleted file mode 100644
index 0f51e4bf..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
-
-import com.fasterxml.jackson.databind.node.MissingNode
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-/**
- * DefaultResourceResolutionProcessor
- *
- * @author Kapil Singal
- */
-@Service("${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-default")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class DefaultResourceResolutionProcessor : ResourceAssignmentProcessor() {
-
- private val logger = LoggerFactory.getLogger(DefaultResourceResolutionProcessor::class.java)
-
- override fun getName(): String {
- return "${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-default"
- }
-
- override fun process(resourceAssignment: ResourceAssignment) {
- try {
- var value = getFromInput(resourceAssignment)
- if (value == null || value is MissingNode) {
- value = resourceAssignment.property?.defaultValue
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
- }
- // Check the value has populated for mandatory case
- ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
- } catch (e: Exception) {
- ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
- throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}",
- e)
- }
-
- }
-
- override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- raRuntimeService.getBluePrintError().addError(runtimeException.message!!)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
deleted file mode 100644
index 579989a6..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
-
-import com.fasterxml.jackson.databind.node.MissingNode
-import com.fasterxml.jackson.databind.node.NullNode
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmpty
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-/**
- * InputResourceResolutionProcessor
- *
- * @author Kapil Singal
- */
-@Service("${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-input")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() {
-
- private val logger = LoggerFactory.getLogger(InputResourceResolutionProcessor::class.java)
-
- override fun getName(): String {
- return "${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-input"
- }
-
- override fun process(resourceAssignment: ResourceAssignment) {
- try {
- if (checkNotEmpty(resourceAssignment.name)) {
- val value = raRuntimeService.getInputValue(resourceAssignment.name)
- // if value is null don't call setResourceDataValue to populate the value
- if (value !is MissingNode && value !is NullNode) {
- logger.info("input source template key (${resourceAssignment.name}) found from input and value is ($value)")
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
- }
- }
- // Check the value has populated for mandatory case
- ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
- } catch (e: Exception) {
- ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
- throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with : (${e.message})", e)
- }
- }
-
- override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- raRuntimeService.getBluePrintError().addError(runtimeException.message!!)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
deleted file mode 100644
index 3f0c1b4f..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- * Modifications Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.apache.commons.collections.MapUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintTemplateService
-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.ResourceDefinition
-import org.slf4j.LoggerFactory
-import java.util.*
-
-abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssignment, Boolean> {
-
- private val log = LoggerFactory.getLogger(ResourceAssignmentProcessor::class.java)
-
- lateinit var raRuntimeService: ResourceAssignmentRuntimeService
- lateinit var resourceDictionaries: MutableMap<String, ResourceDefinition>
-
- var scriptPropertyInstances: MutableMap<String, Any> = hashMapOf()
-
- /**
- * This will be called from the scripts to serve instance from runtime to scripts.
- */
- open fun <T> scriptPropertyInstanceType(name: String): T {
- return scriptPropertyInstances as? T
- ?: throw BluePrintProcessorException("couldn't get script property instance ($name)")
- }
-
- open fun getFromInput(resourceAssignment: ResourceAssignment): JsonNode? {
- var value: JsonNode? = null
- try {
- value = raRuntimeService.getInputValue(resourceAssignment.name)
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
- } catch (e: BluePrintProcessorException) {
- // NoOp - couldn't find value from input
- }
- return value
- }
-
- open fun resourceDefinition(name: String): ResourceDefinition {
- return resourceDictionaries[name]
- ?: throw BluePrintProcessorException("couldn't get resource definition for ($name)")
- }
-
- open fun resolveInputKeyMappingVariables(inputKeyMapping: Map<String, String>): Map<String, Any> {
- val resolvedInputKeyMapping = HashMap<String, Any>()
- if (MapUtils.isNotEmpty(inputKeyMapping)) {
- for ((key, value) in inputKeyMapping) {
- val resultValue = raRuntimeService.getResolutionStore(value)
- val expressionValue = JacksonUtils.getValue(resultValue)
- log.trace("Reference dictionary key ({}), value ({})", key, expressionValue)
- resolvedInputKeyMapping[key] = expressionValue
- }
- }
- return resolvedInputKeyMapping
- }
-
- open fun resolveFromInputKeyMapping(valueToResolve: String, keyMapping: Map<String, Any>): String {
- if (valueToResolve.isEmpty() || !valueToResolve.contains("$")) {
- return valueToResolve
- }
- return BluePrintTemplateService.generateContent(valueToResolve, additionalContext = keyMapping)
- }
-
- override fun prepareRequest(resourceAssignment: ResourceAssignment): ResourceAssignment {
- log.info("prepareRequest for ${resourceAssignment.name}, dictionary(${resourceAssignment.dictionaryName})," +
- "source(${resourceAssignment.dictionarySource})")
- return resourceAssignment
- }
-
- override fun prepareResponse(): Boolean {
- log.info("Preparing Response...")
- return true
- }
-
- override fun apply(resourceAssignment: ResourceAssignment): Boolean {
- try {
- prepareRequest(resourceAssignment)
- process(resourceAssignment)
- } catch (runtimeException: RuntimeException) {
- recover(runtimeException, resourceAssignment)
- }
- return prepareResponse()
- }
-
- fun addError(type: String, name: String, error: String) {
- raRuntimeService.getBluePrintError().addError(type, name, error)
- }
-
- fun addError(error: String) {
- raRuntimeService.getBluePrintError().addError(error)
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
deleted file mode 100644
index 091220b5..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- * Modifications Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
-
-import com.fasterxml.jackson.databind.node.ArrayNode
-import com.fasterxml.jackson.databind.node.JsonNodeFactory
-import com.fasterxml.jackson.databind.node.MissingNode
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.RestResourceSource
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BlueprintWebClientService
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.checkEqualsOrThrow
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmpty
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyOrThrow
-import org.onap.ccsdk.apps.controllerblueprints.core.nullToEmpty
-import org.onap.ccsdk.apps.controllerblueprints.core.returnNotEmptyOrThrow
-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.ResourceDictionaryConstants
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-/**
- * RestResourceResolutionProcessor
- *
- * @author Kapil Singal
- */
-@Service("${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-rest")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyService: BluePrintRestLibPropertyService)
- : ResourceAssignmentProcessor() {
-
- private val logger = LoggerFactory.getLogger(RestResourceResolutionProcessor::class.java)
-
- override fun getName(): String {
- return "${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-rest"
- }
-
- override fun process(resourceAssignment: ResourceAssignment) {
- try {
- validate(resourceAssignment)
-
- // Check if It has Input
- val value = getFromInput(resourceAssignment)
- if (value == null || value is MissingNode) {
- val dName = resourceAssignment.dictionaryName
- val dSource = resourceAssignment.dictionarySource
- val resourceDefinition = resourceDictionaries[dName]
- ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dName")
- val resourceSource = resourceDefinition.sources[dSource]
- ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)")
- val resourceSourceProperties =
- checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " }
- val sourceProperties =
- JacksonUtils.getInstanceFromMap(resourceSourceProperties, RestResourceSource::class.java)
- val path = nullToEmpty(sourceProperties.path)
- val inputKeyMapping =
- checkNotNull(sourceProperties.inputKeyMapping) { "failed to get input-key-mappings for $dName under $dSource properties" }
- val resolvedInputKeyMapping = resolveInputKeyMappingVariables(inputKeyMapping)
-
- // Resolving content Variables
- val payload = resolveFromInputKeyMapping(nullToEmpty(sourceProperties.payload), resolvedInputKeyMapping)
- val urlPath =
- resolveFromInputKeyMapping(checkNotNull(sourceProperties.urlPath), resolvedInputKeyMapping)
- val verb = resolveFromInputKeyMapping(nullToEmpty(sourceProperties.verb), resolvedInputKeyMapping)
-
- logger.info("$dSource dictionary information : ($urlPath), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
- // Get the Rest Client Service
- val restClientService = blueprintWebClientService(resourceAssignment, sourceProperties)
-
- val response = restClientService.exchangeResource(verb, urlPath, payload)
- if (response.isBlank()) {
- logger.warn("Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath)")
- } else {
- populateResource(resourceAssignment, sourceProperties, response, path)
- }
- }
- // Check the value has populated for mandatory case
- ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
- } catch (e: Exception) {
- ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
- throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}",
- e)
- }
- }
-
- private fun blueprintWebClientService(resourceAssignment: ResourceAssignment,
- restResourceSource: RestResourceSource): BlueprintWebClientService {
- return if (checkNotEmpty(restResourceSource.endpointSelector)) {
- val restPropertiesJson = raRuntimeService.resolveDSLExpression(restResourceSource.endpointSelector!!)
- blueprintRestLibPropertyService.blueprintWebClientService(restPropertiesJson)
- } else {
- blueprintRestLibPropertyService.blueprintWebClientService(resourceAssignment.dictionarySource!!)
- }
- }
-
- @Throws(BluePrintProcessorException::class)
- private fun populateResource(resourceAssignment: ResourceAssignment, sourceProperties: RestResourceSource,
- restResponse: String, path: String) {
- val dName = resourceAssignment.dictionaryName
- val dSource = resourceAssignment.dictionarySource
- val type = nullToEmpty(resourceAssignment.property?.type)
- lateinit var entrySchemaType: String
-
- val outputKeyMapping =
- checkNotNull(sourceProperties.outputKeyMapping) { "failed to get output-key-mappings for $dName under $dSource properties" }
- logger.info("Response processing type($type)")
-
- val responseNode =
- checkNotNull(JacksonUtils.jsonNode(restResponse).at(path)) { "Failed to find path ($path) in response ($restResponse)" }
- logger.info("populating value for output mapping ($outputKeyMapping), from json ($responseNode)")
-
-
- when (type) {
- in BluePrintTypes.validPrimitiveTypes() -> {
- logger.info("For template key (${resourceAssignment.name}) setting value as ($responseNode)")
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, responseNode)
- }
- in BluePrintTypes.validCollectionTypes() -> {
- // Array Types
- entrySchemaType =
- returnNotEmptyOrThrow(resourceAssignment.property?.entrySchema?.type) { "Entry schema is not defined for dictionary ($dName) info" }
- val arrayNode = responseNode as ArrayNode
-
- if (entrySchemaType !in BluePrintTypes.validPrimitiveTypes()) {
- val responseArrayNode = responseNode.toList()
- for (responseSingleJsonNode in responseArrayNode) {
- val arrayChildNode = JsonNodeFactory.instance.objectNode()
- outputKeyMapping.map {
- val responseKeyValue = responseSingleJsonNode.get(it.key)
- val propertyTypeForDataType =
- ResourceAssignmentUtils.getPropertyType(raRuntimeService, entrySchemaType, it.key)
- logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), type ({$propertyTypeForDataType})")
- JacksonUtils.populateJsonNodeValues(it.value,
- responseKeyValue,
- propertyTypeForDataType,
- arrayChildNode)
- }
- arrayNode.add(arrayChildNode)
- }
- }
- logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)")
- // Set the List of Complex Values
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, arrayNode)
- }
- else -> {
- // Complex Types
- entrySchemaType =
- returnNotEmptyOrThrow(resourceAssignment.property?.type) { "Entry schema is not defined for dictionary ($dName) info" }
- val objectNode = JsonNodeFactory.instance.objectNode()
- outputKeyMapping.map {
- val responseKeyValue = responseNode.get(it.key)
- val propertyTypeForDataType =
- ResourceAssignmentUtils.getPropertyType(raRuntimeService, entrySchemaType, it.key)
- logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), type ({$propertyTypeForDataType})")
- JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, propertyTypeForDataType, objectNode)
- }
-
- logger.info("For template key (${resourceAssignment.name}) setting value as ($objectNode)")
- // Set the List of Complex Values
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, objectNode)
- }
- }
- }
-
- @Throws(BluePrintProcessorException::class)
- private fun validate(resourceAssignment: ResourceAssignment) {
- checkNotEmptyOrThrow(resourceAssignment.name, "resource assignment template key is not defined")
- checkNotEmptyOrThrow(resourceAssignment.dictionaryName,
- "resource assignment dictionary name is not defined for template key (${resourceAssignment.name})")
- checkEqualsOrThrow(ResourceDictionaryConstants.SOURCE_PRIMARY_CONFIG_DATA,
- resourceAssignment.dictionarySource) {
- "resource assignment source is not ${ResourceDictionaryConstants.SOURCE_PRIMARY_CONFIG_DATA} but it is ${resourceAssignment.dictionarySource}"
- }
- checkNotEmptyOrThrow(resourceAssignment.dictionaryName,
- "resource assignment dictionary name is not defined for template key (${resourceAssignment.name})")
- }
-
- override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- raRuntimeService.getBluePrintError().addError(runtimeException.message!!)
- }
-
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
deleted file mode 100644
index d55ccacb..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.ObjectMapper
-import com.fasterxml.jackson.databind.node.NullNode
-import com.fasterxml.jackson.databind.node.ObjectNode
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmpty
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyOrThrow
-import org.onap.ccsdk.apps.controllerblueprints.core.nullToEmpty
-import org.onap.ccsdk.apps.controllerblueprints.core.returnNotEmptyOrThrow
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import java.util.*
-
-class ResourceAssignmentUtils {
- companion object {
-
- private val logger: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentUtils::class.toString())
-
- // TODO("Modify Value type from Any to JsonNode")
- @Throws(BluePrintProcessorException::class)
- fun setResourceDataValue(resourceAssignment: ResourceAssignment,
- raRuntimeService: ResourceAssignmentRuntimeService, value: Any?) {
-
- val resourceProp = checkNotNull(resourceAssignment.property) { "Failed in setting resource value for resource mapping $resourceAssignment" }
- checkNotEmptyOrThrow(resourceAssignment.name, "Failed in setting resource value for resource mapping $resourceAssignment")
-
- if (resourceAssignment.dictionaryName.isNullOrEmpty()) {
- resourceAssignment.dictionaryName = resourceAssignment.name
- logger.warn("Missing dictionary key, setting with template key (${resourceAssignment.name}) as dictionary key (${resourceAssignment.dictionaryName})")
- }
-
- try {
- if (resourceProp.type.isNotEmpty()) {
- val convertedValue = convertResourceValue(resourceProp.type, value)
- logger.info("Setting Resource Value ($convertedValue) for Resource Name (${resourceAssignment.dictionaryName}) of type (${resourceProp.type})")
- setResourceValue(resourceAssignment, raRuntimeService, convertedValue)
- resourceAssignment.updatedDate = Date()
- resourceAssignment.updatedBy = BluePrintConstants.USER_SYSTEM
- resourceAssignment.status = BluePrintConstants.STATUS_SUCCESS
- }
- } catch (e: Exception) {
- throw BluePrintProcessorException("Failed in setting value for template key (${resourceAssignment.name}) and " +
- "dictionary key (${resourceAssignment.dictionaryName}) of type (${resourceProp.type}) with error message (${e.message})", e)
- }
- }
-
- private fun setResourceValue(resourceAssignment: ResourceAssignment, raRuntimeService: ResourceAssignmentRuntimeService, value: JsonNode) {
- raRuntimeService.putResolutionStore(resourceAssignment.name, value)
- raRuntimeService.putDictionaryStore(resourceAssignment.dictionaryName!!, value)
- resourceAssignment.property!!.value = value
- }
-
- private fun convertResourceValue(type: String, value: Any?): JsonNode {
-
- return if (value == null || value is NullNode) {
- logger.info("Returning {} value from convertResourceValue", value)
- NullNode.instance
- } else if (BluePrintTypes.validPrimitiveTypes().contains(type) && value is String) {
- JacksonUtils.convertPrimitiveResourceValue(type, value)
- } else if (value is String) {
- JacksonUtils.jsonNode(value)
- } else {
- JacksonUtils.getJsonNode(value)
- }
-
- }
-
- fun setFailedResourceDataValue(resourceAssignment: ResourceAssignment, message: String?) {
- if (checkNotEmpty(resourceAssignment.name)) {
- resourceAssignment.updatedDate = Date()
- resourceAssignment.updatedBy = BluePrintConstants.USER_SYSTEM
- resourceAssignment.status = BluePrintConstants.STATUS_FAILURE
- resourceAssignment.message = message
- }
- }
-
- @Throws(BluePrintProcessorException::class)
- fun assertTemplateKeyValueNotNull(resourceAssignment: ResourceAssignment) {
- val resourceProp = checkNotNull(resourceAssignment.property) { "Failed to populate mandatory resource resource mapping $resourceAssignment" }
- if (resourceProp.required != null && resourceProp.required!! && (resourceProp.value == null || resourceProp.value !is NullNode)) {
- logger.error("failed to populate mandatory resource mapping ($resourceAssignment)")
- throw BluePrintProcessorException("failed to populate mandatory resource mapping ($resourceAssignment)")
- }
- }
-
- @Throws(BluePrintProcessorException::class)
- fun generateResourceDataForAssignments(assignments: List<ResourceAssignment>): String {
- val result: String
- try {
- val mapper = ObjectMapper()
- val root: ObjectNode = mapper.createObjectNode()
-
- assignments.forEach {
- if (checkNotEmpty(it.name) && it.property != null) {
- val rName = it.name
- val type = nullToEmpty(it.property?.type).toLowerCase()
- val value = it.property?.value
- logger.info("Generating Resource name ($rName), type ($type), value ($value)")
- root.set(rName, value)
- }
- }
- result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(root)
- logger.info("Generated Resource Param Data ($result)")
- } catch (e: Exception) {
- throw BluePrintProcessorException("Resource Assignment is failed with $e.message", e)
- }
-
- return result
- }
-
- fun transformToRARuntimeService(blueprintRuntimeService: BluePrintRuntimeService<*>, templateArtifactName: String): ResourceAssignmentRuntimeService {
- val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService(blueprintRuntimeService.id(), blueprintRuntimeService.bluePrintContext())
- resourceAssignmentRuntimeService.createUniqueId(templateArtifactName)
- resourceAssignmentRuntimeService.setExecutionContext(blueprintRuntimeService.getExecutionContext() as MutableMap<String, JsonNode>)
-
- return resourceAssignmentRuntimeService
- }
-
- @Throws(BluePrintProcessorException::class)
- fun getPropertyType(raRuntimeService: ResourceAssignmentRuntimeService, dataTypeName: String, propertyName: String): String {
- lateinit var type: String
- try {
- val dataTypeProps = checkNotNull(raRuntimeService.bluePrintContext().dataTypeByName(dataTypeName)?.properties)
- val propertyDefinition = checkNotNull(dataTypeProps[propertyName])
- type = returnNotEmptyOrThrow(propertyDefinition.type) { "Couldn't get data type ($dataTypeName)" }
- logger.trace("Data type({})'s property ({}) is ({})", dataTypeName, propertyName, type)
- } catch (e: Exception) {
- logger.error("couldn't get data type($dataTypeName)'s property ($propertyName), error message $e")
- throw BluePrintProcessorException("${e.message}", e)
- }
- return type
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
deleted file mode 100644
index 91997e34..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BlueprintPropertyConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.utils.PayloadUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.*
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [ResourceResolutionServiceImpl::class,
- InputResourceResolutionProcessor::class, DefaultResourceResolutionProcessor::class,
- DatabaseResourceAssignmentProcessor::class, RestResourceResolutionProcessor::class,
- CapabilityResourceResolutionProcessor::class,
- BlueprintPropertyConfiguration::class, BluePrintProperties::class,
- BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@EnableAutoConfiguration
-class ResourceResolutionComponentTest {
-
- @Autowired
- lateinit var resourceResolutionComponent: ResourceResolutionComponent
-
- @Test
- fun testProcess() {
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java)!!
-
- // Prepare Inputs
- PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService, executionServiceInput.payload, "resource-assignment")
-
- val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
- stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "resource-assignment")
- stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ResourceResolutionComponent")
- stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
- bluePrintRuntimeService.put("resource-assignment-step-inputs", stepMetaData.asJsonNode())
-
- resourceResolutionComponent.bluePrintRuntimeService = bluePrintRuntimeService
- resourceResolutionComponent.stepName = "resource-assignment"
- resourceResolutionComponent.apply(executionServiceInput)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
deleted file mode 100644
index d560e8c3..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
-
-import org.junit.Assert
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BlueprintPropertyConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.utils.PayloadUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.*
-import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-
-/**
- * ResourceResolutionServiceTest
- *
- * @author Brinda Santh DATE : 8/15/2018
- */
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [ResourceResolutionServiceImpl::class,
- InputResourceResolutionProcessor::class, DefaultResourceResolutionProcessor::class,
- DatabaseResourceAssignmentProcessor::class, RestResourceResolutionProcessor::class,
- CapabilityResourceResolutionProcessor::class,
- BlueprintPropertyConfiguration::class, BluePrintProperties::class,
- BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@EnableAutoConfiguration
-class ResourceResolutionServiceTest {
-
- private val log = LoggerFactory.getLogger(ResourceResolutionServiceTest::class.java)
-
- @Autowired
- lateinit var resourceResolutionService: ResourceResolutionService
-
- @Test
- fun testRegisteredSource() {
- val sources = resourceResolutionService.registeredResourceSources()
- assertNotNull(sources, "failed to get registered sources")
- assertTrue(sources.containsAll(arrayListOf("source-input", "source-default", "source-processor-db",
- "source-rest")), "failed to get registered sources : $sources")
- }
-
- @Test
- @Throws(Exception::class)
- fun testResolveResource() {
-
- Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java)!!
-
- // Prepare Inputs
- PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService, executionServiceInput.payload, "resource-assignment")
-
- resourceResolutionService.resolveResources(bluePrintRuntimeService, "resource-assignment", "baseconfig", mapOf())
-
- }
-
-}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
deleted file mode 100644
index 5a14a296..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Modifications Copyright © 2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
-
-import org.junit.Ignore
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts.BlueprintJythonService
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts.PythonExecutorProperty
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-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.ResourceDefinition
-import org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintScriptsServiceImpl
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [CapabilityResourceResolutionProcessor::class, ComponentFunctionScriptingService::class,
- BluePrintScriptsServiceImpl::class,
- BlueprintJythonService::class, PythonExecutorProperty::class, MockCapabilityService::class])
-@TestPropertySource(properties =
-["blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"])
-class CapabilityResourceResolutionProcessorTest {
-
- @Autowired
- lateinit var capabilityResourceResolutionProcessor: CapabilityResourceResolutionProcessor
-
- @Ignore
- @Test
- fun `test kotlin capability`() {
-
- val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
-
- capabilityResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService
- capabilityResourceResolutionProcessor.resourceDictionaries = hashMapOf()
-
-
- val scriptPropertyInstances: MutableMap<String, Any> = mutableMapOf()
- scriptPropertyInstances["mock-service1"] = MockCapabilityService()
- scriptPropertyInstances["mock-service2"] = MockCapabilityService()
-
- val instanceDependencies: List<String> = listOf()
-
- val resourceAssignmentProcessor = capabilityResourceResolutionProcessor
- .scriptInstance("kotlin",
- "ResourceAssignmentProcessor_cba\$ScriptResourceAssignmentProcessor", instanceDependencies)
-
- assertNotNull(resourceAssignmentProcessor, "couldn't get kotlin script resource assignment processor")
-
- val resourceAssignment = ResourceAssignment().apply {
- name = "ra-name"
- dictionaryName = "ra-dict-name"
- dictionarySource = "capability"
- property = PropertyDefinition().apply {
- type = "string"
- }
- }
-
- val processorName = resourceAssignmentProcessor.apply(resourceAssignment)
- assertNotNull(processorName, "couldn't get kotlin script resource assignment processor name")
- println(processorName)
- }
-
- @Test
- fun `test jython capability`() {
-
- val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/capability_python")
-
- val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
-
- capabilityResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService
-
- val resourceDefinition = JacksonUtils
- .readValueFromClassPathFile("mapping/capability/jython-resource-definitions.json",
- ResourceDefinition::class.java)!!
- val resourceDefinitions: MutableMap<String, ResourceDefinition> = mutableMapOf()
- resourceDefinitions[resourceDefinition.name] = resourceDefinition
- capabilityResourceResolutionProcessor.resourceDictionaries = resourceDefinitions
-
- val resourceAssignment = ResourceAssignment().apply {
- name = "service-instance-id"
- dictionaryName = "service-instance-id"
- dictionarySource = "capability"
- property = PropertyDefinition().apply {
- type = "string"
- }
- }
-
- val processorName = capabilityResourceResolutionProcessor.apply(resourceAssignment)
- assertNotNull(processorName, "couldn't get Jython script resource assignment processor name")
-
- }
-
-}
-
-open class MockCapabilityService {
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties
deleted file mode 100644
index 3f37d1b9..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# suppress inspection "UnusedProperty" for whole file
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-#
-# Modifications Copyright © 2019 IBM, Bell Canada.
-#
-# 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.
-#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
-# Controller Blueprints Core Configuration
-blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
-
-blueprintsprocessor.restclient.primary-config-data.type=basic-auth
-blueprintsprocessor.restclient.primary-config-data.url=http://127.0.0.1:9111
-blueprintsprocessor.restclient.primary-config-data.userId=sampleuser
-blueprintsprocessor.restclient.primary-config-data.token=sampletoken
-
-# Python executor
-blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints
-blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
-
-
-# CBA examples for tests cases
-controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint
-controllerblueprints.loadBluePrintPaths=./../../../../components/model-catalog/blueprint-model/test-blueprint \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml
deleted file mode 100644
index a816a06c..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/capability/jython-resource-definitions.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/capability/jython-resource-definitions.json
deleted file mode 100644
index b565eec8..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/capability/jython-resource-definitions.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "tags": "service-instance-id, tosca.datatypes.Root, data_type",
- "name": "service-instance-id",
- "property": {
- "description": "To be provided",
- "type": "string"
- },
- "updated-by": "Singal, Kapil <ks220y@att.com>",
- "sources": {
- "capability": {
- "type": "source-capability",
- "properties": {
- "script-type": "jython",
- "script-class-reference": "Scripts/python/SampleRAProcessor.py",
- "instance-dependencies": []
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json
deleted file mode 100644
index 52e0a796..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "version": "1.0.0",
- "description": "test Data Type",
- "properties": {
- "country": {
- "required": true,
- "type": "string"
- },
- "state": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
-}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json
deleted file mode 100644
index 7082a434..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "locations": {
- "name": "locations",
- "data-type": "list",
- "entry-schema": "dt-location",
- "source": {
- "primary-db": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- }
- }
- },
- "candidate-dependency": {
- "primary-db": {
- "names": [
- "profile_name"
- ]
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json
deleted file mode 100644
index 53e2a11c..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "location": {
- "name": "location",
- "data-type": "dt-location",
- "source": {
- "primary-db": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json
deleted file mode 100644
index fad08887..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "country": {
- "name": "country",
- "data-type": "string",
- "source": {
- "primary-db": {
- "query": "SELECT country FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "country": "country"
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json
deleted file mode 100644
index bb392d7b..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json
+++ /dev/null
@@ -1,22 +0,0 @@
-[
- {
- "name": "country",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "country",
- "dictionary-source": "primary-db",
- "dependencies": ["state"]
- },
- {
- "name": "state",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "state",
- "dictionary-source": "input",
- "dependencies": []
- }
-]
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/inputs/input.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/inputs/input.json
deleted file mode 100644
index cd6fac12..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/inputs/input.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "api-ver": "2.00",
- "originator-id": "MSO",
- "request-id": "123456",
- "service-instance-id": "ibcx0001vm001",
- "service-type": "AVPN",
- "vnf-type": "vUSP - vDBE-IPX HUB",
- "vnf-id": 123456,
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "action-name": "resource-assignment-action",
- "group-name": "sample group name",
- "bundle-id": "sample bundle id",
- "bundle-mac": [
- "Sample bundle mac",
- "Sample bundle mac"
- ]
-}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/requests/sample-resourceresolution-request.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/requests/sample-resourceresolution-request.json
deleted file mode 100644
index 6a7b4c2a..00000000
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/requests/sample-resourceresolution-request.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "actionIdentifiers": {
- "actionName": "sample-action",
- "blueprintName": "sample-blurprint",
- "blueprintVersion": "1.0.0",
- "mode": "sync"
- },
- "commonHeader": {
- "flags": {
- "force": true,
- "ttl": 3600
- },
- "originatorId": "sdnc",
- "requestId": "123456-1000",
- "subRequestId": "sub-123456-1000",
- "timestamp": "2012-04-23T18:25:43.511Z"
- },
- "payload": {
- "resource-assignment-request": {
- "resource-assignment-properties": {
- "request-id": "1234",
- "profile_name": "1.0.0",
- "service-instance-id": "siid_1234",
- "vnf-id": "vnf_1234",
- "action-name": "assign-activate",
- "scope-type": "vnf-type",
- "hostname": "localhost",
- "vnf_name": "temp_vnf"
- }
- }
- }
-}
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/pom.xml b/ms/blueprintsprocessor/functions/restconf-executor/pom.xml
deleted file mode 100644
index 1ee23d3d..00000000
--- a/ms/blueprintsprocessor/functions/restconf-executor/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>functions</artifactId>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>restconf-executor</artifactId>
- <name>Blueprints Processor Function - Restconf Executor</name>
- <description>Blueprints Processor Function - Restconf Executor</description>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>resource-resolution</artifactId>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
-</project>
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt
deleted file mode 100644
index 7166ec27..00000000
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor
-
-import com.fasterxml.jackson.databind.node.ArrayNode
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.RestLibConstants
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
-import org.onap.ccsdk.apps.controllerblueprints.core.getAsString
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Component
-
-@Component("component-restconf-executor")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ComponentRestconfExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService) :
- AbstractComponentFunction() {
-
- private val log = LoggerFactory.getLogger(ComponentRestconfExecutor::class.java)
-
- lateinit var scriptComponent: RestconfComponentFunction
-
- companion object {
- const val SCRIPT_TYPE = "script-type"
- const val SCRIPT_CLASS_REFERENCE = "script-class-reference"
- const val INSTANCE_DEPENDENCIES = "instance-dependencies"
- }
-
- override fun process(executionRequest: ExecutionServiceInput) {
-
- val scriptType = operationInputs.getAsString(SCRIPT_TYPE)
- val scriptClassReference = operationInputs.getAsString(SCRIPT_CLASS_REFERENCE)
- val instanceDependenciesNode = operationInputs.get(INSTANCE_DEPENDENCIES) as? ArrayNode
-
- val scriptDependencies: MutableList<String> = arrayListOf()
- scriptDependencies.add(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
- scriptDependencies.add(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
-
- instanceDependenciesNode?.forEach { instanceName ->
- scriptDependencies.add(instanceName.textValue())
- }
- /**
- * Populate the Script Instance based on the Type
- */
- scriptComponent = componentFunctionScriptingService.scriptInstance<RestconfComponentFunction>(this, scriptType,
- scriptClassReference, scriptDependencies)
-
- checkNotNull(scriptComponent) { "failed to get restconf script component" }
-
- scriptComponent.process(executionServiceInput)
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- scriptComponent.recover(runtimeException, executionRequest)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt
deleted file mode 100644
index 1914616e..00000000
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@file:Suppress("unused")
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.RestLibConstants
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BlueprintWebClientService
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
-
-
-abstract class RestconfComponentFunction : AbstractScriptComponentFunction() {
-
- open fun bluePrintRestLibPropertyService(): BluePrintRestLibPropertyService =
- functionDependencyInstanceAsType(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
-
- open fun resourceResolutionService(): ResourceResolutionService =
- functionDependencyInstanceAsType(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
-
-
- fun restClientService(selector: String): BlueprintWebClientService {
- return bluePrintRestLibPropertyService().blueprintWebClientService(selector)
- }
-
- fun resolveFromDatabase(resolutionKey: String, artifactName: String): String {
- return resourceResolutionService().resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey)
- }
-
- fun generateMessage(artifactName: String): String {
- return bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
- }
-
- fun resolveAndGenerateMessage(artifactMapping: String, artifactTemplate: String): String {
- return resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName,
- artifactMapping, artifactTemplate)
- }
-
- fun resolveAndGenerateMessage(artifactPrefix: String): String {
- return resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName,
- artifactPrefix, mapOf())
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt
deleted file mode 100644
index 300f5be1..00000000
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
-import org.springframework.boot.context.properties.EnableConfigurationProperties
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Configuration
-
-
-@Configuration
-@ComponentScan
-@EnableConfigurationProperties
-@ConditionalOnProperty(name = ["blueprintsprocessor.restconfEnabled"], havingValue = "true")
-open class RestconfExecutorConfiguration \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/scripts/InternalSimpleRestconf.cba.kts b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/scripts/InternalSimpleRestconf.cba.kts
deleted file mode 100644
index 588f7f10..00000000
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/scripts/InternalSimpleRestconf.cba.kts
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@file:Suppress("unused") //TODO remove this line!
-
-
-import com.fasterxml.jackson.databind.node.ObjectNode
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor.RestconfComponentFunction
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.slf4j.LoggerFactory
-
-open class EditConfigure : RestconfComponentFunction() {
-
- val log = LoggerFactory.getLogger(EditConfigure::class.java)!!
-
- override fun getName(): String {
- return "EditConfigure"
- }
-
- override fun process(executionRequest: ExecutionServiceInput) {
- //val webClientService = restClientService("odlparent")
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-}
-
-open class MountNEditConfigure : RestconfComponentFunction() {
-
- val log = LoggerFactory.getLogger(MountNEditConfigure::class.java)!!
-
- override fun getName(): String {
- return "MountNEditConfigure"
- }
-
- override fun process(executionRequest: ExecutionServiceInput) {
- val webClientService = restClientService("odlparent")
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
-}
-
-/**
- * This is for used for Testing only
- */
-open class TestRestconfConfigure : RestconfComponentFunction() {
-
- val log = LoggerFactory.getLogger(TestRestconfConfigure::class.java)!!
-
- override fun getName(): String {
- return "TestRestconfConfigure"
- }
-
- override fun process(executionRequest: ExecutionServiceInput) {
- log.info("processing request..")
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- log.info("recovering..")
- }
-}
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt
deleted file mode 100644
index 5d903bc7..00000000
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor
-
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.ArrayNode
-import com.fasterxml.jackson.databind.node.ObjectNode
-import io.mockk.every
-import io.mockk.mockk
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.DefaultBluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.annotation.DirtiesContext
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
-
-@RunWith(SpringRunner::class)
-@EnableAutoConfiguration
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@DirtiesContext
-@TestPropertySource(properties =
-["server.port=9111",
- "blueprintsprocessor.restconfEnabled=true",
- "blueprintsprocessor.restclient.odlPrimary.type=basic-auth",
- "blueprintsprocessor.restclient.odlPrimary.url=http://127.0.0.1:9111",
- "blueprintsprocessor.restclient.odlPrimary.userId=sampleuser",
- "blueprintsprocessor.restclient.odlPrimary.token=sampletoken"],
- locations = ["classpath:application-test.properties"])
-class ComponentRestconfExecutorTest {
-
- @Autowired
- lateinit var componentRestconfExecutor: ComponentRestconfExecutor
-
- @Test
- fun `test Restconf Component Instance`() {
- assertNotNull(componentRestconfExecutor, "failed to get ComponentRestconfExecutor instance")
- val executionServiceInput = ExecutionServiceInput().apply {
- commonHeader = CommonHeader().apply {
- requestId = "1234"
- }
- actionIdentifiers = ActionIdentifiers().apply {
- actionName = "activate"
- }
- payload = JacksonUtils.jsonNode("{}") as ObjectNode
- }
- val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234")
- componentRestconfExecutor.bluePrintRuntimeService = bluePrintRuntime
- componentRestconfExecutor.stepName = "sample-step"
-
- val operationInputs = hashMapOf<String, JsonNode>()
- operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = "activate-restconf".asJsonPrimitive()
- operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = "interfaceName".asJsonPrimitive()
- operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = "operationName".asJsonPrimitive()
- operationInputs[ComponentRestconfExecutor.SCRIPT_TYPE] = BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive()
- operationInputs[ComponentRestconfExecutor.SCRIPT_CLASS_REFERENCE] =
- "InternalSimpleRestconf_cba\$TestRestconfConfigure".asJsonPrimitive()
- operationInputs[ComponentRestconfExecutor.INSTANCE_DEPENDENCIES] = JacksonUtils.jsonNode("[]") as ArrayNode
-
- val blueprintContext = mockk<BluePrintContext>()
- every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
- every { bluePrintRuntime.get("sample-step-step-inputs") } returns operationInputs.asJsonNode()
- every {
- bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs("activate-restconf",
- "interfaceName", "operationName")
- } returns operationInputs
-
- val operationOutputs = hashMapOf<String, JsonNode>()
- every {
- bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs("activate-restconf",
- "interfaceName", "operationName")
- } returns operationOutputs
- every { bluePrintRuntime.put("sample-step-step-outputs", any()) } returns Unit
-
- componentRestconfExecutor.apply(executionServiceInput)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/application-test.properties
deleted file mode 100644
index 6d8b62ff..00000000
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/application-test.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-#
-# Modifications Copyright © 2019 IBM, Bell Canada.
-#
-# 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.
-#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
-# Controller Blueprints Core Configuration
-blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
-
-# Python executor
-blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints
-blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/logback-test.xml
deleted file mode 100644
index 56ea7bb5..00000000
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <logger name="org.springframework.test" level="warn"/>
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
deleted file mode 100644
index 045c871f..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>db-lib</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor DB Lib</name>
- <description>Blueprints Processor DB Lib</description>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>db-resources</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>processor-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-testing</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
deleted file mode 100644
index 3e9ec0ce..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
-import org.springframework.boot.context.properties.EnableConfigurationProperties
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Configuration
-
-@Configuration
-@ComponentScan
-@EnableConfigurationProperties
-open class BluePrintDBLibConfiguration(private var bluePrintProperties: BluePrintProperties) {
-
- @Bean("primary-database-properties")
- open fun getPrimaryProperties(): PrimaryDataSourceProperties {
- return bluePrintProperties.propertyBeanType(DBLibConstants.PREFIX_DB_PRIMARY,
- PrimaryDataSourceProperties::class.java)
- }
-}
-
-class DBLibConstants {
- companion object {
- const val PREFIX_DB_PRIMARY: String = "blueprintsprocessor.db.primary"
-
- //list of database
- const val MARIA_DB: String = "maria-db"
- const val PRIMARY_DB: String = "primary-db"
- const val MYSQL_DB: String = "mysql-db"
- const val ORACLE_DB: String = "oracle-db"
- const val POSTGRES_DB: String = "postgres-db"
-
- //List of database drivers
- const val DRIVER_MARIA_DB = "org.mariadb.jdbc.Driver"
- const val DRIVER_MYSQL_DB = "com.mysql.jdbc.Driver"
- const val DRIVER_ORACLE_DB = "oracle.jdbc.driver.OracleDriver"
- const val DRIVER_POSTGRES_DB = "org.postgresql.Driver"
-
-
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibData.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibData.kt
deleted file mode 100644
index ab2c19a4..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibData.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db
-
-
-open class DBDataSourceProperties {
- lateinit var url: String
- lateinit var username: String
- lateinit var password: String
- open lateinit var driverClassName: String
-
-}
-
-open class PrimaryDataSourceProperties: DBDataSourceProperties() {
- lateinit var hibernateHbm2ddlAuto: String
- lateinit var hibernateDDLAuto: String
- lateinit var hibernateNamingStrategy: String
- lateinit var hibernateDialect: String
-}
-
-open class MariaDataSourceProperties: DBDataSourceProperties() {
- lateinit var hibernateHbm2ddlAuto: String
- lateinit var hibernateDDLAuto: String
- lateinit var hibernateNamingStrategy: String
- lateinit var type: String
- lateinit var hibernateDialect: String
- override var driverClassName = DBLibConstants.DRIVER_MARIA_DB
-}
-
-open class MySqlDataSourceProperties: DBDataSourceProperties() {
- lateinit var hibernateHbm2ddlAuto: String
- lateinit var hibernateDDLAuto: String
- lateinit var hibernateNamingStrategy: String
- lateinit var type: String
- lateinit var hibernateDialect: String
- override var driverClassName = DBLibConstants.DRIVER_MYSQL_DB
-}
-
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt
deleted file mode 100644
index aee74d3f..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db
-
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
-
-interface BluePrintDBLibGenericService {
-
- fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate
-
- fun query(sql: String, params: Map<String, Any>): List<Map<String, Any>>
-
- fun update(sql: String, params: Map<String, Any>): Int
-}
-
-abstract class AbstractDBLibGenericService(private val namedParameterJdbcTemplate: NamedParameterJdbcTemplate)
- : BluePrintDBLibGenericService {
-
- override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate {
- return namedParameterJdbcTemplate
- }
-
- override fun query(sql: String, params: Map<String, Any>): List<Map<String, Any>> {
- return namedParameterJdbcTemplate.queryForList(sql, params)
- }
-
- override fun update(sql: String, params: Map<String, Any>): Int {
- return namedParameterJdbcTemplate.update(sql, params)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
deleted file mode 100755
index e94bcff5..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel
-import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent
-import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.repository.BlueprintProcessorModelRepository
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.common.ApplicationConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ErrorCode
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintArchiveUtils
-import org.onap.ccsdk.apps.controllerblueprints.db.resources.BlueprintCatalogServiceImpl
-import org.slf4j.LoggerFactory
-import org.springframework.dao.DataIntegrityViolationException
-import org.springframework.stereotype.Service
-import java.io.File
-import java.nio.file.Files
-import java.nio.file.Path
-import java.nio.file.Paths
-
-/**
- * Similar/Duplicate implementation in [org.onap.ccsdk.apps.controllerblueprints.service.load.ControllerBlueprintCatalogServiceImpl]
- */
-@Service
-class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: BluePrintValidatorService,
- private val blueprintConfig: BluePrintCoreConfiguration,
- private val blueprintModelRepository: BlueprintProcessorModelRepository)
- : BlueprintCatalogServiceImpl(bluePrintRuntimeValidatorService) {
-
- private val log = LoggerFactory.getLogger(BlueprintProcessorCatalogServiceImpl::class.toString())
-
- init {
-
- log.info("BlueprintProcessorCatalogServiceImpl initialized")
- }
-
- override fun delete(name: String, version: String) = blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(name, version)
-
-
- override fun get(name: String, version: String, extract: Boolean): Path? {
- var path = "${blueprintConfig.archivePath}/$name/$version.zip"
-
- blueprintModelRepository.findByArtifactNameAndArtifactVersion(name, version)?.also {
- it.blueprintModelContent.run {
- val file = File(path)
- file.parentFile.mkdirs()
- file.createNewFile()
- file.writeBytes(this!!.content!!).let {
- if (extract) {
- path = "${blueprintConfig.archivePath}/$name/$version"
- BluePrintArchiveUtils.deCompress(file, path)
- }
- return Paths.get(path)
- }
- }
- }
- return null
- }
-
- override fun save(metadata: MutableMap<String, String>, archiveFile: File) {
- val artifactName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]
- val artifactVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]
-
- blueprintModelRepository.findByArtifactNameAndArtifactVersion(artifactName!!, artifactVersion!!)?.let {
- log.info("Overwriting blueprint model :$artifactName::$artifactVersion")
- blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(artifactName, artifactVersion)
- }
-
- val blueprintModel = BlueprintProcessorModel()
- blueprintModel.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID]
- blueprintModel.artifactType = ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL
- blueprintModel.artifactName = artifactName
- blueprintModel.artifactVersion = artifactVersion
- blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]
- blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS]
- blueprintModel.artifactDescription = "Controller Blueprint for $artifactName:$artifactVersion"
-
- val blueprintModelContent = BlueprintProcessorModelContent()
- blueprintModelContent.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID]
- blueprintModelContent.contentType = "CBA_ZIP"
- blueprintModelContent.name = "$artifactName:$artifactVersion"
- blueprintModelContent.description = "$artifactName:$artifactVersion CBA Zip Content"
- blueprintModelContent.content = Files.readAllBytes(archiveFile.toPath())
- blueprintModelContent.blueprintModel = blueprintModel
-
- blueprintModel.blueprintModelContent = blueprintModelContent
-
- try {
- blueprintModelRepository.saveAndFlush(blueprintModel)
- } catch (ex: DataIntegrityViolationException) {
- throw BluePrintException(ErrorCode.CONFLICT_ADDING_RESOURCE.value, "The blueprint entry " +
- "is already exist in database: ${ex.message}", ex)
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
deleted file mode 100644
index f93c241d..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db.primary
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.db.*
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.stereotype.Service
-
-@Service
-class BluePrintDBLibPropertySevice(private var bluePrintProperties: BluePrintProperties) {
-
- fun JdbcTemplate(jsonNode: JsonNode): BluePrintDBLibGenericService {
- val dBConnetionProperties = dBDataSourceProperties(jsonNode)
- return blueprintDBDataSourceService(dBConnetionProperties)
- }
-
- fun JdbcTemplate(selector: String): BluePrintDBLibGenericService {
- val prefix = "blueprintsprocessor.database.$selector"
- val dBConnetionProperties = dBDataSourceProperties(prefix)
- return blueprintDBDataSourceService(dBConnetionProperties)
- }
-
- private fun dBDataSourceProperties(jsonNode: JsonNode): DBDataSourceProperties {
- val type = jsonNode.get("type").textValue()
- return when (type) {
- DBLibConstants.MYSQL_DB -> {
- JacksonUtils.readValue(jsonNode, MySqlDataSourceProperties::class.java)!!
- }
- DBLibConstants.MARIA_DB -> {
- JacksonUtils.readValue(jsonNode, MariaDataSourceProperties::class.java)!!
- }
- else -> {
- throw BluePrintProcessorException("Rest adaptor($type) is not supported")
- }
- }
- }
-
- private fun dBDataSourceProperties(prefix: String): DBDataSourceProperties {
- val type = bluePrintProperties.propertyBeanType("$prefix.type", String::class.java)
- return when (type) {
- DBLibConstants.MARIA_DB -> {
- mariaDBConnectionProperties(prefix)
- }
- DBLibConstants.MYSQL_DB -> {
- mySqlDBConnectionProperties(prefix)
- }
- DBLibConstants.ORACLE_DB -> {
- TODO("not implemented")
- }
- DBLibConstants.POSTGRES_DB -> {
- TODO("not implemented")
- }
- DBLibConstants.PRIMARY_DB -> {
- primaryDBConnectionProperties(prefix)
- }
- else -> {
- throw BluePrintProcessorException("Rest adaptor($type) is not supported")
- }
- }
- }
-
- private fun blueprintDBDataSourceService(dBConnetionProperties: DBDataSourceProperties): BluePrintDBLibGenericService {
- when (dBConnetionProperties) {
- is MariaDataSourceProperties -> {
- return MariaDatabaseConfiguration(dBConnetionProperties)
- }
- is MySqlDataSourceProperties -> {
- return MySqlDatabaseConfiguration(dBConnetionProperties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't get rest service for")
- }
- }
- }
-
- private fun mySqlDBConnectionProperties(prefix: String): MySqlDataSourceProperties {
- return bluePrintProperties.propertyBeanType(prefix, MySqlDataSourceProperties::class.java)
- }
-
- private fun mariaDBConnectionProperties(prefix: String): MariaDataSourceProperties {
- return bluePrintProperties.propertyBeanType(prefix, MariaDataSourceProperties::class.java)
- }
-
- private fun primaryDBConnectionProperties(prefix: String): PrimaryDataSourceProperties {
- return bluePrintProperties.propertyBeanType(prefix, PrimaryDataSourceProperties::class.java)
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt
deleted file mode 100644
index c67fb339..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db.primary
-
-import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibGenericService
-import org.onap.ccsdk.apps.blueprintsprocessor.db.MariaDataSourceProperties
-import org.slf4j.LoggerFactory
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
-import org.springframework.jdbc.datasource.DriverManagerDataSource
-import org.springframework.orm.jpa.JpaTransactionManager
-import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
-import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter
-import org.springframework.transaction.PlatformTransactionManager
-import java.util.*
-import javax.sql.DataSource
-
-class MariaDatabaseConfiguration(private val mariaDataSourceProperties: MariaDataSourceProperties) : BluePrintDBLibGenericService {
-
- override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate {
- return mariaNamedParameterJdbcTemplate(mariaDataSource())
- }
-
- override fun query(sql: String, params: Map<String, Any>): List<Map<String, Any>> {
- return mariaNamedParameterJdbcTemplate(mariaDataSource()).queryForList(sql, params)
- }
-
- override fun update(sql: String, params: Map<String, Any>): Int {
- return mariaNamedParameterJdbcTemplate(mariaDataSource()).update(sql, params)
- }
-
- val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!!
-
- fun mariaDataSource(): DataSource {
- val dataSource = DriverManagerDataSource()
- dataSource.setDriverClassName(mariaDataSourceProperties.driverClassName)
- dataSource.url = mariaDataSourceProperties.url
- dataSource.username = mariaDataSourceProperties.username
- dataSource.password = mariaDataSourceProperties.password
- return dataSource
- }
-
- fun mariaNamedParameterJdbcTemplate(mariaDataSource: DataSource): NamedParameterJdbcTemplate {
- return NamedParameterJdbcTemplate(mariaDataSource)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
deleted file mode 100644
index 2a0dec73..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db.primary
-
-import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibGenericService
-import org.onap.ccsdk.apps.blueprintsprocessor.db.MySqlDataSourceProperties
-import org.slf4j.LoggerFactory
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
-import org.springframework.jdbc.datasource.DriverManagerDataSource
-import javax.sql.DataSource
-
-class MySqlDatabaseConfiguration(private val mySqlDataSourceProperties: MySqlDataSourceProperties) : BluePrintDBLibGenericService {
- override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate {
- return mySqlNamedParameterJdbcTemplate(mySqlDataSource())
- }
-
- override fun query(sql: String, params: Map<String, Any>): List<Map<String, Any>> {
- return mySqlNamedParameterJdbcTemplate(mySqlDataSource()).queryForList(sql, params)
- }
-
- override fun update(sql: String, params: Map<String, Any>): Int {
- return mySqlNamedParameterJdbcTemplate(mySqlDataSource()).update(sql, params)
- }
-
- val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!!
-
- fun mySqlDataSource(): DataSource {
- val dataSource = DriverManagerDataSource()
- dataSource.setDriverClassName(mySqlDataSourceProperties.driverClassName)
- dataSource.url = mySqlDataSourceProperties.url
- dataSource.username = mySqlDataSourceProperties.username
- dataSource.password = mySqlDataSourceProperties.password
- return dataSource
- }
-
- fun mySqlNamedParameterJdbcTemplate(mySqlDataSource: DataSource): NamedParameterJdbcTemplate {
- return NamedParameterJdbcTemplate(mySqlDataSource)
- }
-
-
-}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt
deleted file mode 100644
index 5a926534..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db.primary
-
-import org.onap.ccsdk.apps.blueprintsprocessor.db.AbstractDBLibGenericService
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
-import org.springframework.stereotype.Service
-
-@Service
-open class PrimaryDBLibGenericService(primaryNamedParameterJdbcTemplate: NamedParameterJdbcTemplate)
- : AbstractDBLibGenericService(primaryNamedParameterJdbcTemplate) {
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
deleted file mode 100644
index 4039b053..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db.primary
-
-import org.onap.ccsdk.apps.blueprintsprocessor.db.PrimaryDataSourceProperties
-import org.slf4j.LoggerFactory
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.context.annotation.Primary
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
-import org.springframework.jdbc.datasource.DriverManagerDataSource
-import org.springframework.orm.jpa.JpaTransactionManager
-import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
-import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter
-import org.springframework.transaction.PlatformTransactionManager
-import java.util.*
-import javax.sql.DataSource
-
-@Configuration
-@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor.*"],
- entityManagerFactoryRef = "primaryEntityManager",
- transactionManagerRef = "primaryTransactionManager"
-)
-open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties: PrimaryDataSourceProperties) {
- val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!!
-
- @Primary
- @Bean("primaryEntityManager")
- open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
- val em = LocalContainerEntityManagerFactoryBean()
- em.dataSource = primaryDataSource()
- em.setPackagesToScan("org.onap.ccsdk.apps.blueprintsprocessor.*")
- em.jpaVendorAdapter = HibernateJpaVendorAdapter()
- val properties = HashMap<String, Any>()
- properties["hibernate.hbm2ddl.auto"] = primaryDataSourceProperties.hibernateHbm2ddlAuto
- properties["hibernate.dialect"] = primaryDataSourceProperties.hibernateDialect
- em.jpaPropertyMap = properties
- return em
- }
-
- @Primary
- @Bean("primaryDataSource")
- open fun primaryDataSource(): DataSource {
- val dataSource = DriverManagerDataSource()
- dataSource.setDriverClassName(primaryDataSourceProperties.driverClassName)
- dataSource.url = primaryDataSourceProperties.url
- dataSource.username = primaryDataSourceProperties.username
- dataSource.password = primaryDataSourceProperties.password
- return dataSource
- }
-
- @Primary
- @Bean("primaryTransactionManager")
- open fun primaryTransactionManager(): PlatformTransactionManager {
- val transactionManager = JpaTransactionManager()
- transactionManager.entityManagerFactory = primaryEntityManager().getObject()
- log.info("Initialised Primary Transaction Manager for url ${primaryDataSourceProperties.url}")
- return transactionManager
- }
-
- @Bean("primaryNamedParameterJdbcTemplate")
- open fun primaryNamedParameterJdbcTemplate(primaryDataSource: DataSource): NamedParameterJdbcTemplate {
- return NamedParameterJdbcTemplate(primaryDataSource)
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt
deleted file mode 100755
index 0935d038..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain
-
-import com.fasterxml.jackson.annotation.JsonFormat
-import io.swagger.annotations.ApiModelProperty
-import javax.persistence.Entity
-import javax.persistence.EntityListeners
-import javax.persistence.Table
-import org.hibernate.annotations.Proxy
-import org.springframework.data.annotation.LastModifiedDate
-import org.springframework.data.jpa.domain.support.AuditingEntityListener
-import java.io.Serializable
-import java.util.*
-import javax.persistence.CascadeType
-import javax.persistence.Column
-import javax.persistence.FetchType
-import javax.persistence.Id
-import javax.persistence.Lob
-import javax.persistence.OneToOne
-import javax.persistence.Temporal
-import javax.persistence.TemporalType
-
-@EntityListeners(AuditingEntityListener::class)
-@Entity
-@Table(name = "BLUEPRINT_RUNTIME")
-@Proxy(lazy = false)
-class BlueprintProcessorModel : Serializable {
-
- @Id
- @Column(name = "blueprint_runtime_id")
- var id: String? = null
-
- @Column(name = "artifact_type")
- var artifactType: String? = null
-
- @Column(name = "artifact_version", nullable = false)
- @ApiModelProperty(required = true)
- var artifactVersion: String? = null
-
- @Lob
- @Column(name = "artifact_description")
- var artifactDescription: String? = null
-
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- @LastModifiedDate
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "creation_date")
- var createdDate = Date()
-
- @Column(name = "artifact_name", nullable = false)
- @ApiModelProperty(required = true)
- var artifactName: String? = null
-
- @Column(name = "updated_by", nullable = false)
- @ApiModelProperty(required = true)
- var updatedBy: String? = null
-
- @Lob
- @Column(name = "tags", nullable = false)
- @ApiModelProperty(required = true)
- var tags: String? = null
-
- @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = [CascadeType.ALL])
- var blueprintModelContent: BlueprintProcessorModelContent? = null
-
- companion object {
- private const val serialVersionUID = 1L
- }
-}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt
deleted file mode 100644
index 58bf8a33..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain
-
-import com.fasterxml.jackson.annotation.JsonFormat
-import io.swagger.annotations.ApiModelProperty
-import java.io.Serializable
-import java.util.Date
-import java.util.Objects
-import javax.persistence.Column
-import javax.persistence.Entity
-import javax.persistence.EntityListeners
-import javax.persistence.Id
-import javax.persistence.JoinColumn
-import javax.persistence.Lob
-import javax.persistence.OneToOne
-import javax.persistence.Table
-import javax.persistence.Temporal
-import javax.persistence.TemporalType
-import org.springframework.data.annotation.LastModifiedDate
-import org.springframework.data.jpa.domain.support.AuditingEntityListener
-
-@EntityListeners(AuditingEntityListener::class)
-@Entity
-@Table(name = "BLUEPRINT_CONTENT_RUNTIME")
-class BlueprintProcessorModelContent : Serializable {
-
- @Id
- @Column(name = "blueprint_content_runtime_id")
- var id: String? = null
-
- @Column(name = "name", nullable = false)
- @ApiModelProperty(required = true)
- var name: String? = null
-
- @Column(name = "content_type", nullable = false)
- @ApiModelProperty(required = true)
- var contentType: String? = null
-
- @OneToOne
- @JoinColumn(name = "blueprint_runtime_id")
- var blueprintModel: BlueprintProcessorModel? = null
-
- @Lob
- @Column(name = "description")
- var description: String? = null
-
- @Lob
- @Column(name = "content", nullable = false)
- @ApiModelProperty(required = true)
- var content: ByteArray? = null
-
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- @LastModifiedDate
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "updated_date")
- var creationDate = Date()
-
- override fun toString(): String {
- return "[" + "id = " + id +
- ", name = " + name +
- ", contentType = " + contentType +
- "]"
- }
-
- override fun equals(o: Any?): Boolean {
-
- if (o === this) {
- return true
- }
- if (o !is BlueprintProcessorModelContent) {
- return false
- }
- val blueprintModelContent = o as BlueprintProcessorModelContent?
- return (id == blueprintModelContent!!.id && name == blueprintModelContent.name
- && contentType == blueprintModelContent.contentType)
- }
-
- override fun hashCode(): Int {
- return Objects.hash(id, name, contentType)
- }
-
- companion object {
- private const val serialVersionUID = 1L
- }
-
-}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt
deleted file mode 100644
index e614544e..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.db.primary.repository
-
-import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel
-import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent
-import org.onap.ccsdk.apps.controllerblueprints.db.resources.repository.ModelContentRepository
-
-interface BlueprintProcessorModelContentRepository : ModelContentRepository<BlueprintProcessorModel, BlueprintProcessorModelContent> \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt
deleted file mode 100644
index 25f3dac9..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.db.primary.repository
-
-import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel
-import org.onap.ccsdk.apps.controllerblueprints.db.resources.repository.ModelRepository
-
-interface BlueprintProcessorModelRepository : ModelRepository<BlueprintProcessorModel>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
deleted file mode 100644
index 4c953163..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.db
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import java.io.File
-import java.nio.file.Paths
-import kotlin.test.assertTrue
-
-@RunWith(SpringRunner::class)
-@EnableAutoConfiguration
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-class BlueprintProcessorCatalogServiceImplTest {
-
- @Autowired
- lateinit var blueprintCatalog: BluePrintCatalogService
-
- @Test
- fun `test catalog service`() {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
-
- blueprintCatalog.saveToDatabase(file)
-
- blueprintCatalog.getFromDatabase("baseconfiguration", "1.0.0")
-
- blueprintCatalog.deleteFromDatabase("baseconfiguration", "1.0.0")
-
- File("./src/test/resources/baseconfiguration").deleteRecursively()
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt
deleted file mode 100644
index 3f737e31..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.db.primary
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BlueprintPropertyConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibConfiguration
-import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import javax.sql.DataSource
-import kotlin.test.assertNotNull
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BlueprintPropertyConfiguration::class, BluePrintProperties::class,
- BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@EnableAutoConfiguration
-class PrimaryDatabaseConfigurationTest {
-
- @Autowired
- lateinit var primaryDataSource: DataSource
-
- @Test
- fun testPrimaryDatabaseConfiguration() {
- assertNotNull(primaryDataSource, " failed to create primary data source")
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
deleted file mode 100644
index 3ac7ec38..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-# suppress inspection "UnusedProperty" for whole file
-#
-# 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.
-#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
-# Controller Blueprints Core Configuration
-blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/logback-test.xml
deleted file mode 100644
index f9ec9fe5..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <logger name="org.springframework.test" level="warn"/>
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip
deleted file mode 100644
index 90748240..00000000
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip
+++ /dev/null
Binary files differ
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
deleted file mode 100644
index 30f83d38..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ ============LICENSE_START=======================================================
- ~ ONAP - CDS
- ~ ================================================================================
- ~ Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- ~ ================================================================================
- ~ 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.
- ~ ============LICENSE_END=========================================================
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>dmaap-lib</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Dmaap Lib</name>
- <description>Blueprints Processor Dmaap Lib</description>
-
-
- <dependencies>
- <dependency>
- <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
- <artifactId>dmaapClient</artifactId>
- <version>${dmaap.client.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-webflux</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.inject</groupId>
- <artifactId>jersey-hk2</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.1-m07</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>processor-core</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
deleted file mode 100644
index dd884092..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - CDS
- * ================================================================================
- * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.dmaap
-
-import com.att.nsa.mr.client.MRBatchingPublisher
-import com.att.nsa.mr.client.MRClientFactory
-import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher
-
-/**
- * Representation of DMAAP client service for AAF auth type.
- */
-class AafAuthDmaapClientService(private val clientProps:
- AafAuthDmaapClientProperties)
- : BluePrintDmaapClientService {
-
- /**
- * The constructed DMAAP client.
- */
- var clients: MutableList<MRBatchingPublisher> = mutableListOf()
-
-
- /**
- * Returns the DMAAP client after constructing it properly with the data
- * that is required for AAF auth connection.
- */
- override fun getDmaapClient(): MutableList<MRBatchingPublisher> {
- if (!clients.isEmpty()) {
- return clients
- }
- val topics = mutableListOf<String>()
- topics.addAll(clientProps.topic.split(","))
-
- for (t in topics) {
- val client = MRClientFactory.createBatchingPublisher(
- clientProps.host, t, clientProps.username,
- clientProps.password, 1, 1, false,
- clientProps.type, "")
- val batchPublisher = client as MRSimplerBatchPublisher
- batchPublisher.props = clientProps.props
- clients.add(client)
- }
- return clients
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
deleted file mode 100644
index 21d7128e..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
+++ /dev/null
@@ -1,102 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - CDS
- * ================================================================================
- * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.dmaap
-
-import com.att.nsa.mr.client.MRBatchingPublisher
-import com.att.nsa.mr.client.MRPublisher
-import org.slf4j.LoggerFactory
-import java.io.IOException
-import java.util.concurrent.TimeUnit
-
-
-/**
- * Abstraction of DMAAP client services that could form DMAAP client from the
- * properties provided. This abstraction also provides a mechanism to send
- * messages with the given partition in a session and closing the same.
- */
-interface BluePrintDmaapClientService {
-
- /**
- * Static variable for logging.
- */
- companion object {
- var log = LoggerFactory.getLogger(
- BluePrintDmaapClientService::class.java)!!
- }
-
- /**
- * Returns the properly constructed DMAAP client with the type.
- */
- fun getDmaapClient(): MutableList<MRBatchingPublisher>
-
- /**
- * Sends messages to the sessions created by the information provided from
- * application.properties and event.properties file
- */
- fun sendMessage(msgs: Collection<String>): Boolean {
- var success = true
- val clients = getDmaapClient()
- val dmaapMsgs = mutableListOf<MRPublisher.message>()
- for (m in msgs) {
- dmaapMsgs.add(MRPublisher.message("1", m))
- }
- log.info("Sending messages to the DMAAP Server")
- for (client in clients) {
- try {
- client.send(dmaapMsgs)
- } catch (e: IOException) {
- success = false
- log.error(e.message, e)
- }
- }
- return success
- }
-
- /**
- * Sends message to the sessions created by the information provided from
- * application.properties and event.properties file
- */
- fun sendMessage(msg: String): Boolean {
- val msgs = mutableListOf<String>()
- msgs.add(msg)
- return sendMessage(msgs)
- }
-
- /**
- * Closes the opened session that was used for sending messages.
- */
- fun close(timeout: Long): MutableList<MutableList<MRPublisher.message>>? {
- log.debug("Closing the DMAAP producer clients")
- var msgs: MutableList<MutableList<MRPublisher.message>> =
- mutableListOf()
- val clients = getDmaapClient()
- for (client in clients) {
- try {
- var ms = client.close(timeout, TimeUnit.SECONDS)
- msgs.add(ms)
- } catch (e: IOException) {
- log.warn("Unable to cleanly close the connection from the " +
- "client $client", e)
- }
- }
- return msgs
- }
-}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
deleted file mode 100644
index ca1a07ba..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - CDS
- * ================================================================================
- * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.dmaap
-
-import org.springframework.boot.context.properties.EnableConfigurationProperties
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Configuration
-
-/**
- * Representation of DMAAP lib configuration to load the required property
- * files into the application context.
- */
-@Configuration
-@ComponentScan
-@EnableConfigurationProperties
-open class BluePrintDmaapLibConfiguration
-
-/**
- * Util constants required for DMAAP library to use.
- */
-class DmaapLibConstants {
- companion object {
- const val SERVICE_BLUEPRINT_DMAAP_LIB_PROPERTY = "blueprint" +
- "-dmaap-lib-property-service"
- const val TYPE_HTTP_NO_AUTH = "HTTPNOAUTH"
- const val TYPE_HTTP_AAF_AUTH = "HTTPAAF"
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
deleted file mode 100644
index 7abbefbc..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
+++ /dev/null
@@ -1,187 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - CDS
- * ================================================================================
- * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.dmaap
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.dmaap.DmaapLibConstants.Companion.SERVICE_BLUEPRINT_DMAAP_LIB_PROPERTY
-import org.onap.ccsdk.apps.blueprintsprocessor.dmaap.DmaapLibConstants.Companion.TYPE_HTTP_AAF_AUTH
-import org.onap.ccsdk.apps.blueprintsprocessor.dmaap.DmaapLibConstants.Companion.TYPE_HTTP_NO_AUTH
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.context.annotation.Configuration
-import org.springframework.context.annotation.PropertySource
-import org.springframework.context.annotation.PropertySources
-import org.springframework.core.env.ConfigurableEnvironment
-import org.springframework.core.env.Environment
-import org.springframework.core.io.support.ResourcePropertySource
-import org.springframework.stereotype.Service
-import java.util.Properties
-
-/**
- * Representation of DMAAP lib property service to load the properties
- * according to the connection type to the DMAAP server and returning back
- * the appropriate DMAAP client to send messages DMAAP client.
- */
-@Service(SERVICE_BLUEPRINT_DMAAP_LIB_PROPERTY)
-@Configuration
-@PropertySources(PropertySource("classpath:event.properties"))
-open class BluePrintDmaapLibPropertyService(private var bluePrintProperties:
- BluePrintProperties) {
-
- /**
- * Static variable for logging.
- */
- companion object {
- var log = LoggerFactory.getLogger(
- BluePrintDmaapLibPropertyService::class.java)!!
- }
-
- /**
- * Environment entity to derive it from the system to load a specific
- * property file.
- */
- @Autowired
- lateinit var env: Environment
-
- /**
- * Returns the DMAAP client by providing the input properties as a JSON
- * node.
- */
- fun blueprintDmaapClientService(jsonNode: JsonNode):
- BluePrintDmaapClientService {
- val dmaapProps = dmaapClientProperties(jsonNode)
- return blueprintDmaapClientService(dmaapProps)
- }
-
- /**
- * Returns the DMAAP client by providing the input properties as a
- * selector string.
- */
- fun blueprintDmaapClientService(selector: String):
- BluePrintDmaapClientService {
- val prefix = "blueprintsprocessor.dmaapclient.$selector"
- val dmaapProps = dmaapClientProperties(prefix)
- return blueprintDmaapClientService(dmaapProps)
- }
-
- /**
- * Returns the DMAAP client properties from the type of connection it
- * requires.
- */
- fun dmaapClientProperties(prefix: String): DmaapClientProperties {
- val type = bluePrintProperties.propertyBeanType(
- "$prefix.type", String::class.java)
- val clientProps : DmaapClientProperties
-
- when (type) {
- TYPE_HTTP_NO_AUTH -> {
- clientProps = bluePrintProperties.propertyBeanType(
- prefix, HttpNoAuthDmaapClientProperties::class.java)
- clientProps.props = parseEventProps()
- }
-
- TYPE_HTTP_AAF_AUTH -> {
- clientProps = bluePrintProperties.propertyBeanType(
- prefix, AafAuthDmaapClientProperties::class.java)
- clientProps.props = parseEventProps()
- }
-
- else -> {
- throw BluePrintProcessorException("DMAAP adaptor($type) is " +
- "not supported")
- }
- }
- return clientProps
- }
-
- /**
- * Returns the DMAAP client properties from the type of connection it
- * requires.
- */
- fun dmaapClientProperties(jsonNode: JsonNode): DmaapClientProperties {
- val type = jsonNode.get("type").textValue()
- val clientProps : DmaapClientProperties
-
- when (type) {
- TYPE_HTTP_NO_AUTH -> {
- clientProps = JacksonUtils.readValue(jsonNode,
- HttpNoAuthDmaapClientProperties::class.java)!!
- clientProps.props = parseEventProps()
- }
-
- TYPE_HTTP_AAF_AUTH -> {
- clientProps = JacksonUtils.readValue(jsonNode,
- AafAuthDmaapClientProperties::class.java)!!
- clientProps.props = parseEventProps()
- }
-
- else -> {
- throw BluePrintProcessorException("DMAAP adaptor($type) is " +
- "not supported")
- }
- }
- return clientProps
- }
-
- /**
- * Returns DMAAP client service according to the type of client properties.
- */
- private fun blueprintDmaapClientService(clientProps: DmaapClientProperties):
- BluePrintDmaapClientService {
- when (clientProps) {
- is HttpNoAuthDmaapClientProperties -> {
- return HttpNoAuthDmaapClientService(clientProps)
- }
-
- is AafAuthDmaapClientProperties -> {
- return AafAuthDmaapClientService(clientProps)
- }
-
- else -> {
- throw BluePrintProcessorException("Unable to get the DMAAP " +
- "client")
- }
- }
- }
-
- /**
- * Parses the event.properties file which contains the default values for
- * the connection required.
- */
- private fun parseEventProps(): Properties {
- val prodProps = Properties()
- val proProps = (env as ConfigurableEnvironment).propertySources.get(
- "class path resource [event.properties]")
-
- if (proProps != null) {
- val entries = (proProps as ResourcePropertySource).source.entries
- for (e in entries) {
- prodProps.put(e.key, e.value)
- }
- } else {
- log.error("Unable to load the event.properties file")
- }
- return prodProps
- }
-}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/DmaapClientProperties.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/DmaapClientProperties.kt
deleted file mode 100644
index 97df2723..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/DmaapClientProperties.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - CDS
- * ================================================================================
- * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.dmaap
-
-import java.util.Properties
-
-/**
- * Representation of data required for all DMAAP client.
- */
-open class DmaapClientProperties {
- lateinit var props: Properties
- lateinit var type: String
- lateinit var host: String
- lateinit var topic: String
-}
-
-/**
- * Representation of data required for HTTP no auth DMAAP client.
- */
-open class HttpNoAuthDmaapClientProperties : DmaapClientProperties()
-
-/**
- * Representation of data required for AAF auth DMAAP client.
- */
-open class AafAuthDmaapClientProperties : DmaapClientProperties() {
- lateinit var username: String
- lateinit var password: String
-}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
deleted file mode 100644
index ad023b96..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - CDS
- * ================================================================================
- * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.dmaap
-
-import com.att.nsa.mr.client.MRBatchingPublisher
-import com.att.nsa.mr.client.MRClientFactory.createSimplePublisher
-import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher
-
-/**
- * Representation of DMAAP client service for HTTP no auth type.
- */
-class HttpNoAuthDmaapClientService(private val clientProps:
- HttpNoAuthDmaapClientProperties)
- : BluePrintDmaapClientService {
-
- /**
- * The constructed DMAAP client.
- */
- var clients: MutableList<MRBatchingPublisher> = mutableListOf()
-
-
- /**
- * Returns the DMAAP client after constructing it properly with the data
- * that is required for HTTP no auth connection.
- */
- override fun getDmaapClient(): MutableList<MRBatchingPublisher> {
- if (!clients.isEmpty()) {
- return clients
- }
- val topics = mutableListOf<String>()
- topics.addAll(clientProps.topic.split(","))
-
- for (t in topics) {
- val client = createSimplePublisher(clientProps.host, t)
- val batchPublisher = client as MRSimplerBatchPublisher
- batchPublisher.setProtocolFlag(clientProps.type)
- batchPublisher.props = clientProps.props
- clients.add(client)
- }
-
- return clients
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/resources/event.properties b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/resources/event.properties
deleted file mode 100644
index 320b08e8..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/resources/event.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# ============LICENSE_START=======================================================
-# ONAP - CDS
-# ================================================================================
-# Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
-# ================================================================================
-# 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.
-# ============LICENSE_END=========================================================
-#
-
-#TransportType-Specify which way user want to use. I.e. <HTTPAAF,DME2,HTTPAUTH >
-Protocol =http
-partition=1
-contenttype = application/json
-
-
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/apps/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/apps/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
deleted file mode 100644
index 9b3aae5e..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/apps/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP - CDS
- * ================================================================================
- * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.ccsdk.apps.blueprintprocessor.dmaap
-
-import com.fasterxml.jackson.databind.ObjectMapper
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BlueprintPropertyConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.dmaap.BluePrintDmaapLibConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.dmaap.BluePrintDmaapLibPropertyService
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
-import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.http.HttpStatus
-import org.springframework.http.ResponseEntity
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import org.springframework.web.bind.annotation.PathVariable
-import org.springframework.web.bind.annotation.PostMapping
-import org.springframework.web.bind.annotation.RequestMapping
-import org.springframework.web.bind.annotation.RestController
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
-
-/**
- * Unit test cases for DMaap publisher code.
- */
-@RunWith(SpringRunner::class)
-@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
-@ContextConfiguration(classes = [BluePrintDmaapLibConfiguration::class, TestController::class,
- BlueprintPropertyConfiguration::class, BluePrintProperties::class])
-@TestPropertySource(properties = ["server.port=9111",
- "blueprintsprocessor.dmaapclient.aai.topic=cds_aai",
- "blueprintsprocessor.dmaapclient.aai.type=HTTPNOAUTH",
- "blueprintsprocessor.dmaapclient.aai.host=127.0.0.1:9111",
- "blueprintsprocessor.dmaapclient.multi.topic=cds_multi1,cds_multi2",
- "blueprintsprocessor.dmaapclient.multi.type=HTTPNOAUTH",
- "blueprintsprocessor.dmaapclient.multi.host=127.0.0.1:9111"])
-class TestDmaapEventPublisher {
-
- @Autowired
- lateinit var dmaapService : BluePrintDmaapLibPropertyService
-
- /**
- * Tests the event properties being set properly and sent as request.
- */
- @Test
- fun testEventProperties() {
- val strList = mutableListOf<String>()
- val dmaapClient = dmaapService.blueprintDmaapClientService("aai")
-
- strList.add("{\n" +
- " \"a\" : \"hello\"\n" +
- "}")
- dmaapClient.sendMessage(strList)
- val msgs = dmaapClient.close(2)
- assertEquals(msgs!!.size, 1)
- val topic1 = msgs.get(0)
- assertEquals(topic1!!.size, 0)
- }
-
- /**
- * Tests the event properties being set properly and sent as request with
- * single message.
- */
- @Test
- fun testEventPropertiesWithSingleMsg() {
- val dmaapClient = dmaapService.blueprintDmaapClientService("aai")
- val str : String = "{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
- dmaapClient.sendMessage(str)
- val msgs = dmaapClient.close(2)
- assertEquals(msgs!!.size, 1)
- val topic1 = msgs.get(0)
- assertEquals(topic1!!.size, 0)
- }
-
- /**
- * Tests the event properties with multiple topics.
- */
- @Test
- fun testMultiTopicProperties() {
- val strList = mutableListOf<String>()
- val dmaapClient = dmaapService.blueprintDmaapClientService("multi")
-
- strList.add("{\n" +
- " \"a\" : \"hello\"\n" +
- "}")
- dmaapClient.sendMessage(strList)
- val msgs = dmaapClient.close(2)
- assertEquals(msgs!!.size, 2)
- val topic1 = msgs.get(0)
- assertEquals(topic1!!.size, 0)
- val topic2 = msgs.get(1)
- assertEquals(topic2!!.size, 0)
- }
-
-
- /**
- * Tests the event properties with multiple topics with JSON node as input.
- */
- @Test
- fun testMultiTopicPropertiesWithJsonInput() {
- val jsonString = "{\n" +
- " \"topic\" : \"cds_json1,cds_json2\",\n" +
- " \"type\" : \"HTTPNOAUTH\",\n" +
- " \"host\" : \"127.0.0.1:9111\"\n" +
- "}"
- val mapper = ObjectMapper()
- val node = mapper.readTree(jsonString)
- val strList = mutableListOf<String>()
- val dmaapClient = dmaapService.blueprintDmaapClientService(node)
-
- strList.add("{\n" +
- " \"a\" : \"hello\"\n" +
- "}")
- dmaapClient.sendMessage(strList)
- val msgs = dmaapClient.close(2)
- assertEquals(msgs!!.size, 2)
- val topic1 = msgs.get(0)
- assertEquals(topic1!!.size, 0)
- val topic2 = msgs.get(1)
- assertEquals(topic2!!.size, 0)
- }
-
-
- /**
- * Tests the event properties with multiple messages.
- */
- @Test
- fun testMultiMsgsProperties() {
- val strList = mutableListOf<String>()
- val dmaapClient = dmaapService.blueprintDmaapClientService("aai")
-
- strList.add("{\n" +
- " \"a\" : \"hello\"\n" +
- "}")
- strList.add("{\n" +
- " \"a\" : \"second\"\n" +
- "}")
- dmaapClient.sendMessage(strList)
- val msgs = dmaapClient.close(2)
- assertEquals(msgs!!.size, 1)
- val topic1 = msgs.get(0)
- assertEquals(topic1!!.size, 0)
- }
-
- /**
- * Tests the DMAAP client properties generated with the complete prefix.
- */
- @Test
- fun testDmaapClientProperties() {
- val properties = dmaapService.dmaapClientProperties(
- "blueprintsprocessor.dmaapclient.aai")
- assertNotNull(properties, "failed to create property bean")
- assertNotNull(properties.host, "failed to get url property" +
- " in property bean")
- }
-
- /**
- * Tests the blueprint DMAAP client service with only selector prefix.
- */
- @Test
- fun testBlueprintDmaapClientService() {
- val blueprintDmaapClientService =
- dmaapService.blueprintDmaapClientService("aai")
- assertNotNull(blueprintDmaapClientService,
- "failed to create blueprintDmaapClientService")
- }
-
-}
-
-/**
- * Rest controller for testing the client request that is sent.
- */
-@RestController
-@RequestMapping(path = ["/events"])
-open class TestController {
-
- /**
- * Accepts request for a topic and sends a message as response.
- */
- @PostMapping(path = ["/{topic}"])
- fun postTopic(@PathVariable(value = "topic") topic : String):
- ResponseEntity<Any> {
- var a = "{\n" +
- " \"message\" : \"The message is published into $topic " +
- "topic\"\n" +
- "}"
- return ResponseEntity(a, HttpStatus.OK)
- }
-}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/resources/logback-test.xml
deleted file mode 100644
index 0f76057a..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
- ~ ============LICENSE_START=======================================================
- ~ ONAP - CDS
- ~ ================================================================================
- ~ Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- ~ ================================================================================
- ~ 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.
- ~ ============LICENSE_END=========================================================
- -->
-
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <logger name="org.springframework.test" level="warn"/>
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/resources/preferredRoute.txt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/resources/preferredRoute.txt
deleted file mode 100644
index 7e6ed8bd..00000000
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/resources/preferredRoute.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# ============LICENSE_START==========================================
-# ONAP : APPC
-# ===================================================================
-# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the License);
-# you may not use this software 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.
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# ============LICENSE_END============================================
-preferredRouteKey=MR1
diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml
deleted file mode 100755
index 205fd94c..00000000
--- a/ms/blueprintsprocessor/modules/commons/pom.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2019 Bell Canada.
- ~ Modifications Copyright © 2019 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>commons</artifactId>
- <packaging>pom</packaging>
- <name>Blueprints Processor Commons POM</name>
- <description>Blueprints Processor Commons</description>
-
- <modules>
- <module>processor-core</module>
- <module>db-lib</module>
- <module>rest-lib</module>
- <module>dmaap-lib</module>
- </modules>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
- </dependency>
- <!-- Test Dependencies -->
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
deleted file mode 100644
index 32e4b3d4..00000000
--- a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>processor-core</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Core</name>
- <description>Blueprints Processor Core</description>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-webflux</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
deleted file mode 100644
index 07e494a1..00000000
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.core
-
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.beans.factory.annotation.Value
-import org.springframework.boot.context.properties.bind.Binder
-import org.springframework.boot.context.properties.source.ConfigurationPropertySources
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.core.env.Environment
-
-
-@Configuration
-open class BluePrintCoreConfiguration {
-
- @Value("\${blueprintsprocessor.blueprintDeployPath}")
- lateinit var deployPath: String
-
- @Value("\${blueprintsprocessor.blueprintArchivePath}")
- lateinit var archivePath: String
-
-}
-
-@Configuration
-open class BlueprintPropertyConfiguration {
- @Autowired
- lateinit var environment: Environment
-
- @Bean
- open fun bluePrintPropertyBinder(): Binder {
- val configurationPropertySource = ConfigurationPropertySources.get(environment)
- return Binder(configurationPropertySource)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt
deleted file mode 100644
index 10b8ceb5..00000000
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.core
-
-import org.springframework.boot.context.properties.bind.Bindable
-import org.springframework.boot.context.properties.bind.Binder
-import org.springframework.stereotype.Service
-
-@Service
-open class BluePrintProperties(var bluePrintPropertyBinder: Binder) {
-
- fun <T> propertyBeanType(prefix: String, type: Class<T>): T {
- return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get()
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
deleted file mode 100644
index 41bbd1df..00000000
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.core.api.data
-
-import com.fasterxml.jackson.annotation.JsonFormat
-import com.fasterxml.jackson.databind.node.ObjectNode
-import io.swagger.annotations.ApiModelProperty
-import java.util.*
-
-/**
- * BlueprintProcessorData
- * @author Brinda Santh
- * DATE : 8/15/2018
- */
-
-open class ExecutionServiceInput {
- @get:ApiModelProperty(required = true)
- lateinit var commonHeader: CommonHeader
- @get:ApiModelProperty(required = true)
- lateinit var actionIdentifiers: ActionIdentifiers
- @get:ApiModelProperty(required = true)
- lateinit var payload: ObjectNode
-}
-
-open class ExecutionServiceOutput {
- @get:ApiModelProperty(required = true)
- lateinit var commonHeader: CommonHeader
- @get:ApiModelProperty(required = true)
- lateinit var actionIdentifiers: ActionIdentifiers
- @get:ApiModelProperty(required = true)
- var status: Status = Status()
- @get:ApiModelProperty(required = true)
- lateinit var payload: ObjectNode
-}
-
-const val ACTION_MODE_ASYNC = "async"
-const val ACTION_MODE_SYNC = "sync"
-
-open class ActionIdentifiers {
- @get:ApiModelProperty(required = false)
- lateinit var blueprintName: String
- @get:ApiModelProperty(required = false)
- lateinit var blueprintVersion: String
- @get:ApiModelProperty(required = true)
- lateinit var actionName: String
- @get:ApiModelProperty(required = true, allowableValues = "sync, async")
- lateinit var mode: String
-}
-
-open class CommonHeader {
- @get:ApiModelProperty(required = true, example = "2012-04-23T18:25:43.511Z")
- @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- var timestamp: Date = Date()
- @get:ApiModelProperty(required = true)
- lateinit var originatorId: String
- @get:ApiModelProperty(required = true)
- lateinit var requestId: String
- @get:ApiModelProperty(required = true)
- lateinit var subRequestId: String
- @get:ApiModelProperty(required = false)
- var flags: Flags? = null
-}
-
-open class Flags {
- var isForce: Boolean = false
- @get:ApiModelProperty(value = "3600")
- var ttl: Int = 3600
-}
-
-open class Status {
- @get:ApiModelProperty(required = true)
- var code: Int = 200
- @get:ApiModelProperty(required = true)
- var eventType: String = "EVENT-ACTION-RESPONSE"
- @get:ApiModelProperty(required = true, example = "2012-04-23T18:25:43.511Z")
- @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- var timestamp: Date = Date()
- @get:ApiModelProperty(required = false)
- var errorMessage: String? = null
- @get:ApiModelProperty(required = true)
- var message: String = "success"
-}
-
-open class BluePrintManagementInput {
- @get:ApiModelProperty(required = true)
- lateinit var commonHeader: CommonHeader
- @get:ApiModelProperty(required = false)
- lateinit var blueprintName: String
- @get:ApiModelProperty(required = false)
- lateinit var blueprintVersion: String
- @get:ApiModelProperty(required = true)
- lateinit var fileChunk: FileChunk
-}
-
-open class FileChunk {
- @get:ApiModelProperty(required = true)
- lateinit var chunk: ByteArray
-}
-
-open class BluePrintManagementOutput {
- @get:ApiModelProperty(required = true)
- lateinit var commonHeader: CommonHeader
- @get:ApiModelProperty(required = true)
- var status: Status = Status()
-}
-
-
-
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
deleted file mode 100644
index 9c6e5075..00000000
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.core.factory
-
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.springframework.context.ApplicationContext
-import org.springframework.context.ApplicationContextAware
-
-/**
- * ComponentNode
- *
- * @author Brinda Santh
- */
-interface ComponentNode {
-
- @Throws(BluePrintProcessorException::class)
- fun validate(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)
-
- @Throws(BluePrintProcessorException::class)
- fun process(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)
-
- @Throws(BluePrintProcessorException::class)
- fun errorHandle(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)
-
- @Throws(BluePrintProcessorException::class)
- fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)
-}
-
-/**
- * ComponentNodeFactory
- *
- * @author Brinda Santh
- */
-open class ComponentNodeFactory : ApplicationContextAware {
- private val log = EELFManager.getInstance().getLogger(ComponentNodeFactory::class.java)
-
- var componentNodes: MutableMap<String, ComponentNode> = hashMapOf()
-
- fun getInstance(instanceName: String): ComponentNode? {
- log.trace("looking for Component Nodes : {}", instanceName)
- return componentNodes.get(instanceName)
- }
-
- fun injectInstance(instanceName: String, componentNode: ComponentNode) {
- this.componentNodes[instanceName] = componentNode
- }
-
- override fun setApplicationContext(context: ApplicationContext) {
- componentNodes = context.getBeansOfType(ComponentNode::class.java)
- log.info("Injected Component Nodes : {}", componentNodes)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/utils/PayloadUtils.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/utils/PayloadUtils.kt
deleted file mode 100644
index 31dca33b..00000000
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/utils/PayloadUtils.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.core.utils
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-
-
-class PayloadUtils {
-
- companion object {
-
- fun prepareInputsFromWorkflowPayload(bluePrintRuntimeService: BluePrintRuntimeService<*>, payload: JsonNode, workflowName: String) {
- val input = payload.get("$workflowName-request")
- bluePrintRuntimeService.assignWorkflowInputs(workflowName, input)
- }
-
- fun prepareDynamicInputsFromWorkflowPayload(bluePrintRuntimeService: BluePrintRuntimeService<*>, payload: JsonNode, workflowName: String) {
- val input = payload.get("$workflowName-request")
- val propertyFields = input.get("$workflowName-properties")
- prepareDynamicInputsFromComponentPayload(bluePrintRuntimeService, propertyFields)
- }
-
- fun prepareDynamicInputsFromComponentPayload(bluePrintRuntimeService: BluePrintRuntimeService<*>, payload: JsonNode) {
- payload.fields().forEach { property ->
- val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(property.key).toString()
- bluePrintRuntimeService.put(path, property.value)
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/resources/application.properties b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/resources/application.properties
deleted file mode 100644
index c10e96ee..00000000
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/resources/application.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright 2017-2018 AT&T Intellectual Property.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintPropertiesTest.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintPropertiesTest.kt
deleted file mode 100644
index 66de11fd..00000000
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintPropertiesTest.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.core
-
-// TODO
-open class BluePrintPropertiesTest \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
deleted file mode 100644
index 1ed157dc..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>rest-lib</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Rest Lib</name>
- <description>Blueprints Processor Rest Lib</description>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>processor-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>${apache.httpcomponents.client.version}</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
deleted file mode 100644
index 7af91c6f..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest
-
-import org.springframework.boot.context.properties.EnableConfigurationProperties
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Configuration
-
-@Configuration
-@ComponentScan
-@EnableConfigurationProperties
-open class BluePrintRestLibConfiguration
-
-
-class RestLibConstants {
- companion object {
- const val SERVICE_BLUEPRINT_REST_LIB_PROPERTY = "blueprint-rest-lib-property-service"
- const val TYPE_TOKEN_AUTH = "token-auth"
- const val TYPE_BASIC_AUTH = "basic-auth"
- const val TYPE_SSL_BASIC_AUTH = "ssl-basic-auth"
- const val TYPE_DME2_PROXY = "dme2-proxy"
- const val TYPE_POLICY_MANAGER = "policy-manager"
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibData.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibData.kt
deleted file mode 100644
index dd4d9f7d..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibData.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest
-
-open class RestClientProperties {
- lateinit var type: String
- lateinit var url: String
-}
-
-open class BasicAuthRestClientProperties : RestClientProperties() {
- lateinit var password: String
- lateinit var username: String
-}
-
-open class TokenAuthRestClientProperties : RestClientProperties() {
- var token: String? = null
-}
-
-open class SSLBasicAuthRestClientProperties : RestClientProperties() {
- lateinit var keyStoreInstance: String // JKS, PKCS12
- lateinit var sslTrust: String
- lateinit var sslTrustPassword: String
- lateinit var sslKey: String
- lateinit var sslKeyPassword: String
-}
-
-open class DME2RestClientProperties : RestClientProperties() {
- lateinit var service: String
- lateinit var subContext: String
- lateinit var version: String
- lateinit var envContext: String
- lateinit var routeOffer: String
- var partner: String? = null
- lateinit var appId: String
-}
-
-open class PolicyManagerRestClientProperties : RestClientProperties() {
- lateinit var env: String
- lateinit var clientAuth: String
- lateinit var authorisation: String
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
deleted file mode 100644
index 98a4fd58..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada, Nordix Foundation
- *
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest.service
-
-import org.apache.http.message.BasicHeader
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.BasicAuthRestClientProperties
-import org.springframework.http.HttpHeaders
-import org.springframework.http.MediaType
-import java.nio.charset.Charset
-import java.util.*
-
-class BasicAuthRestClientService(private val restClientProperties: BasicAuthRestClientProperties) :
- BlueprintWebClientService {
-
- override fun defaultHeaders(): Map<String, String> {
- val encodedCredentials = setBasicAuth(restClientProperties.username, restClientProperties.password)
- return mapOf(
- HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.AUTHORIZATION to "Basic $encodedCredentials")
- }
-
- override fun host(uri: String): String {
- return restClientProperties.url + uri
- }
-
- override fun convertToBasicHeaders(headers: Map<String, String>): Array<BasicHeader> {
- val customHeaders: MutableMap<String, String> = headers.toMutableMap()
- if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
- val encodedCredentials = setBasicAuth(restClientProperties.username, restClientProperties.password)
- customHeaders[HttpHeaders.AUTHORIZATION] = "Basic $encodedCredentials"
- }
- return super.convertToBasicHeaders(customHeaders)
- }
-
- private fun setBasicAuth(username: String, password: String): String {
- val credentialsString = "$username:$password"
- return Base64.getEncoder().encodeToString(credentialsString.toByteArray(Charset.defaultCharset()))
- }
-
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
deleted file mode 100644
index 3888bb72..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest.service
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.BasicAuthRestClientProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.DME2RestClientProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.PolicyManagerRestClientProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.RestClientProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.RestLibConstants
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.SSLBasicAuthRestClientProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.TokenAuthRestClientProperties
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.stereotype.Service
-
-@Service(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
-open class BluePrintRestLibPropertyService(private var bluePrintProperties: BluePrintProperties) {
-
- fun blueprintWebClientService(jsonNode: JsonNode): BlueprintWebClientService {
- val restClientProperties = restClientProperties(jsonNode)
- return blueprintWebClientService(restClientProperties)
- }
-
- fun blueprintWebClientService(selector: String): BlueprintWebClientService {
- val prefix = "blueprintsprocessor.restclient.$selector"
- val restClientProperties = restClientProperties(prefix)
- return blueprintWebClientService(restClientProperties)
- }
-
- fun restClientProperties(prefix: String): RestClientProperties {
- val type = bluePrintProperties.propertyBeanType("$prefix.type", String::class.java)
- return when (type) {
- RestLibConstants.TYPE_BASIC_AUTH -> {
- basicAuthRestClientProperties(prefix)
- }
- RestLibConstants.TYPE_SSL_BASIC_AUTH -> {
- sslBasicAuthRestClientProperties(prefix)
- }
- RestLibConstants.TYPE_DME2_PROXY -> {
- dme2ProxyClientProperties(prefix)
- }
- RestLibConstants.TYPE_POLICY_MANAGER -> {
- policyManagerRestClientProperties(prefix)
- }
- else -> {
- throw BluePrintProcessorException("Rest adaptor($type) is not supported")
- }
- }
- }
-
- private fun restClientProperties(jsonNode: JsonNode): RestClientProperties {
- val type = jsonNode.get("type").textValue()
- return when (type) {
- RestLibConstants.TYPE_TOKEN_AUTH -> {
- JacksonUtils.readValue(jsonNode, TokenAuthRestClientProperties::class.java)!!
- }
- RestLibConstants.TYPE_BASIC_AUTH -> {
- JacksonUtils.readValue(jsonNode, BasicAuthRestClientProperties::class.java)!!
- }
- RestLibConstants.TYPE_SSL_BASIC_AUTH -> {
- JacksonUtils.readValue(jsonNode, SSLBasicAuthRestClientProperties::class.java)!!
- }
- RestLibConstants.TYPE_DME2_PROXY -> {
- JacksonUtils.readValue(jsonNode, DME2RestClientProperties::class.java)!!
- }
- RestLibConstants.TYPE_POLICY_MANAGER -> {
- JacksonUtils.readValue(jsonNode, PolicyManagerRestClientProperties::class.java)!!
- }
- else -> {
- throw BluePrintProcessorException("Rest adaptor($type) is not supported")
- }
- }
- }
-
- private fun blueprintWebClientService(restClientProperties: RestClientProperties): BlueprintWebClientService {
- when (restClientProperties) {
- is TokenAuthRestClientProperties -> {
- return TokenAuthRestClientService(restClientProperties)
- }
- is BasicAuthRestClientProperties -> {
- return BasicAuthRestClientService(restClientProperties)
- }
- is SSLBasicAuthRestClientProperties -> {
- return SSLBasicAuthRestClientService(restClientProperties)
- }
- is DME2RestClientProperties -> {
- return DME2ProxyRestClientService(restClientProperties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't get rest service for")
- }
- }
- }
-
- private fun basicAuthRestClientProperties(prefix: String): BasicAuthRestClientProperties {
- return bluePrintProperties.propertyBeanType(prefix, BasicAuthRestClientProperties::class.java)
- }
-
- private fun sslBasicAuthRestClientProperties(prefix: String): SSLBasicAuthRestClientProperties {
- return bluePrintProperties.propertyBeanType(prefix, SSLBasicAuthRestClientProperties::class.java)
- }
-
- private fun dme2ProxyClientProperties(prefix: String): DME2RestClientProperties {
- return bluePrintProperties.propertyBeanType(prefix, DME2RestClientProperties::class.java)
- }
-
- private fun policyManagerRestClientProperties(prefix: String): PolicyManagerRestClientProperties {
- return bluePrintProperties.propertyBeanType(prefix, PolicyManagerRestClientProperties::class.java)
- }
-}
-
-
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BlueprintWebClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
deleted file mode 100644
index 0629909e..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada, Nordix Foundation
- *
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest.service
-
-import org.apache.commons.io.IOUtils
-import org.apache.http.client.methods.*
-import org.apache.http.entity.StringEntity
-import org.apache.http.impl.client.CloseableHttpClient
-import org.apache.http.impl.client.HttpClients
-import org.apache.http.message.BasicHeader
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.utils.WebClientUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.springframework.http.HttpMethod
-import java.nio.charset.Charset
-
-interface BlueprintWebClientService {
-
- fun defaultHeaders(): Map<String, String>
-
- fun host(uri: String): String
-
- fun httpClient(): CloseableHttpClient {
- return HttpClients.custom()
- .addInterceptorFirst(WebClientUtils.logRequest())
- .addInterceptorLast(WebClientUtils.logResponse())
- .build()
- }
-
- fun exchangeResource(methodType: String, path: String, request: String): String {
- return this.exchangeResource(methodType, path, request, defaultHeaders())
- }
-
- fun exchangeResource(methodType: String, path: String, request: String, headers: Map<String, String>): String {
- val convertedHeaders: Array<BasicHeader> = convertToBasicHeaders(headers)
- return when (HttpMethod.resolve(methodType)) {
- HttpMethod.DELETE -> delete(path, convertedHeaders)
- HttpMethod.GET -> get(path, convertedHeaders)
- HttpMethod.POST -> post(path, request, convertedHeaders)
- HttpMethod.PUT -> put(path, request, convertedHeaders)
- HttpMethod.PATCH -> patch(path, request, convertedHeaders)
- else -> throw BluePrintProcessorException("Unsupported methodType($methodType)")
- }
- }
-
- fun convertToBasicHeaders(headers: Map<String, String>): Array<BasicHeader> {
- val convertedHeaders = Array<BasicHeader>(headers.size){ BasicHeader("","") }
- var currentElement = 0
- for ((name, value) in headers) {
- convertedHeaders[currentElement++] = BasicHeader(name, value)
- }
- return convertedHeaders
- }
-
- fun delete(path: String, headers: Array<BasicHeader>): String {
- val httpDelete = HttpDelete(host(path))
- httpDelete.setHeaders(headers)
- httpClient().execute(httpDelete).entity.content.use {
- return IOUtils.toString(it, Charset.defaultCharset())
- }
- }
-
- fun get(path: String, headers: Array<BasicHeader>): String {
- val httpGet = HttpGet(host(path))
- httpGet.setHeaders(headers)
- httpClient().execute(httpGet).entity.content.use {
- return IOUtils.toString(it, Charset.defaultCharset())
- }
- }
-
- fun post(path: String, request: String, headers: Array<BasicHeader>): String {
- val httpPost = HttpPost(host(path))
- val entity = StringEntity(request)
- httpPost.entity = entity
- httpPost.setHeaders(headers)
- httpClient().execute(httpPost).entity.content.use {
- return IOUtils.toString(it, Charset.defaultCharset())
- }
- }
-
- fun put(path: String, request: String, headers: Array<BasicHeader>): String {
- val httpPut = HttpPut(host(path))
- val entity = StringEntity(request)
- httpPut.entity = entity
- httpPut.setHeaders(headers)
- httpClient().execute(httpPut).entity.content.use {
- return IOUtils.toString(it, Charset.defaultCharset())
- }
- }
-
- fun patch(path: String, request: String, headers: Array<BasicHeader>): String {
- val httpPatch = HttpPatch(host(path))
- val entity = StringEntity(request)
- httpPatch.entity = entity
- httpPatch.setHeaders(headers)
- httpClient().execute(httpPatch).entity.content.use {
- return IOUtils.toString(it, Charset.defaultCharset())
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/DME2ProxyRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/DME2ProxyRestClientService.kt
deleted file mode 100644
index 94e146d8..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/DME2ProxyRestClientService.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest.service
-
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.RestClientProperties
-
-class DME2ProxyRestClientService(restClientProperties: RestClientProperties) : BlueprintWebClientService {
- override fun defaultHeaders(): Map<String, String> {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun host(uri: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/SSLBasicAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/SSLBasicAuthRestClientService.kt
deleted file mode 100644
index 2bfacf41..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/SSLBasicAuthRestClientService.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright © 2017-2019 AT&T, Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest.service
-
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory
-import org.apache.http.impl.client.CloseableHttpClient
-import org.apache.http.impl.client.HttpClients
-import org.apache.http.ssl.SSLContextBuilder
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.SSLBasicAuthRestClientProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.utils.WebClientUtils
-import org.springframework.http.HttpHeaders
-import org.springframework.http.MediaType
-import java.io.File
-import java.io.FileInputStream
-import java.security.KeyStore
-import java.security.cert.X509Certificate
-
-class SSLBasicAuthRestClientService(private val restClientProperties: SSLBasicAuthRestClientProperties) :
- BlueprintWebClientService {
-
- override fun defaultHeaders(): Map<String, String> {
- return mapOf(
- HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE)
- }
-
- override fun host(uri: String): String {
- return restClientProperties.url + uri
- }
-
- override fun httpClient(): CloseableHttpClient {
-
- val keystoreInstance = restClientProperties.keyStoreInstance
- val sslKey = restClientProperties.sslKey
- val sslKeyPwd = restClientProperties.sslKeyPassword
- val sslTrust = restClientProperties.sslTrust
- val sslTrustPwd = restClientProperties.sslTrustPassword
-
- val acceptingTrustStrategy = { chain: Array<X509Certificate>, authType: String -> true }
-
- FileInputStream(sslKey).use { keyInput ->
- val keyStore = KeyStore.getInstance(keystoreInstance)
- keyStore.load(keyInput, sslKeyPwd.toCharArray())
-
- val sslContext =
- SSLContextBuilder.create()
- .loadKeyMaterial(keyStore, sslKeyPwd.toCharArray())
- .loadTrustMaterial(File(sslTrust), sslTrustPwd.toCharArray(), acceptingTrustStrategy).build()
-
- val csf = SSLConnectionSocketFactory(sslContext!!)
-
- return HttpClients.custom()
- .addInterceptorFirst(WebClientUtils.logRequest())
- .addInterceptorLast(WebClientUtils.logResponse())
- .setSSLSocketFactory(csf).build()
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
deleted file mode 100644
index d5dec3ae..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada, Nordix Foundation
- *
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest.service
-
-import org.apache.http.message.BasicHeader
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.TokenAuthRestClientProperties
-import org.springframework.http.HttpHeaders
-import org.springframework.http.MediaType
-
-class TokenAuthRestClientService(private val restClientProperties: TokenAuthRestClientProperties) :
- BlueprintWebClientService {
-
- override fun defaultHeaders(): Map<String, String> {
- return mapOf(
- HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.AUTHORIZATION to restClientProperties.token!!)
- }
-
- override fun convertToBasicHeaders(headers: Map<String, String>): Array<BasicHeader> {
- val customHeaders: MutableMap<String, String> = headers.toMutableMap()
- if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
- customHeaders[HttpHeaders.AUTHORIZATION] = restClientProperties.token!!
- }
- return super.convertToBasicHeaders(customHeaders)
- }
-
- override fun host(uri: String): String {
- return restClientProperties.url + uri
- }
-}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/utils/WebClientUtils.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/utils/WebClientUtils.kt
deleted file mode 100644
index b9a014e3..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/utils/WebClientUtils.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest.utils
-
-import org.apache.http.HttpRequestInterceptor
-import org.apache.http.HttpResponseInterceptor
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
-
-class WebClientUtils {
- companion object {
-
- val log: Logger = LoggerFactory.getLogger(WebClientUtils::class.java)
-
- fun logRequest(): HttpRequestInterceptor =
- HttpRequestInterceptor { request, _ -> log.info("Rest request method(${request?.requestLine?.method}), url(${request?.requestLine?.uri})") }
-
- fun logResponse(): HttpResponseInterceptor =
- HttpResponseInterceptor { response, _ -> log.info("Response status(${response.statusLine.statusCode} - ${response.statusLine.reasonPhrase})") }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/resources/application.properties b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/resources/application.properties
deleted file mode 100644
index 2ce87147..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/resources/application.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright 2017-2018 AT&T Intellectual Property.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
deleted file mode 100644
index d6e5549a..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest.service
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BlueprintPropertyConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.BluePrintRestLibConfiguration
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
-
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintRestLibConfiguration::class, BlueprintPropertyConfiguration::class, BluePrintProperties::class])
-@TestPropertySource(properties =
-["blueprintsprocessor.restclient.sample.type=basic-auth",
- "blueprintsprocessor.restclient.sample.url=http://localhost:8080",
- "blueprintsprocessor.restclient.sample.userId=sampleuser"])
-
-class BluePrintRestLibPropertyServiceTest {
-
- @Autowired
- lateinit var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService
-
- @Test
- fun testRestClientProperties() {
- val properties = bluePrintRestLibPropertyService.restClientProperties("blueprintsprocessor.restclient.sample")
- assertNotNull(properties, "failed to create property bean")
- assertNotNull(properties.url, "failed to get url property in property bean")
- }
-
- @Test
- fun testBlueprintWebClientService() {
- val blueprintWebClientService = bluePrintRestLibPropertyService.blueprintWebClientService("sample")
- assertNotNull(blueprintWebClientService, "failed to create blueprintWebClientService")
- }
-
-}
-
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/RestClientServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/RestClientServiceTest.kt
deleted file mode 100644
index 0390550c..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/RestClientServiceTest.kt
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Copyright (C) 2019 Nordix Foundation
- *
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.rest.service
-
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BlueprintPropertyConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.rest.BluePrintRestLibConfiguration
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
-import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.http.HttpMethod
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import org.springframework.web.bind.annotation.GetMapping
-import org.springframework.web.bind.annotation.PatchMapping
-import org.springframework.web.bind.annotation.RequestMapping
-import org.springframework.web.bind.annotation.RestController
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
-
-@RunWith(SpringRunner::class)
-@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
-@ContextConfiguration(classes = [BluePrintRestLibConfiguration::class, BlueprintPropertyConfiguration::class,
- SampleController::class, BluePrintProperties::class, BluePrintProperties::class])
-@TestPropertySource(properties =
-["blueprintsprocessor.restclient.sample.type=basic-auth",
- "blueprintsprocessor.restclient.sample.url=http://127.0.0.1:8080",
- "blueprintsprocessor.restclient.sample.username=sampleuser",
- "blueprintsprocessor.restclient.sample.password=sampletoken"])
-class RestClientServiceTest {
-
- @Autowired
- lateinit var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService
-
- @Test
- fun testBaseAuth() {
- val restClientService = bluePrintRestLibPropertyService.blueprintWebClientService("sample")
- val headers = mutableMapOf<String, String>()
- headers["X-Transaction-Id"] = "1234"
- val response = restClientService.exchangeResource(HttpMethod.GET.name, "/sample/name", "")
- assertNotNull(response, "failed to get response")
- }
-
- @Test
- fun testPatch() {
- val restClientService = bluePrintRestLibPropertyService.blueprintWebClientService("sample")
- val response = restClientService.exchangeResource(HttpMethod.PATCH.name, "/sample/name", "")
- assertEquals("Patch request successful", response, "failed to get patch response")
- }
-
-}
-
-@RestController
-@RequestMapping("/sample")
-open class SampleController {
- @GetMapping("/name")
- fun getName(): String = "Sample Controller"
- @PatchMapping("/name")
- fun patchName(): String = "Patch request successful"
-}
-
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/resources/logback-test.xml
deleted file mode 100644
index f9ec9fe5..00000000
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <logger name="org.springframework.test" level="warn"/>
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml
deleted file mode 100644
index 060c7e42..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2019 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>inbounds</artifactId>
- <packaging>pom</packaging>
- <name>Blueprints Processor Inbounds POM</name>
- <description>Blueprints Processor Inbounds</description>
-
- <modules>
- <module>resource-api</module>
- <module>selfservice-api</module>
- </modules>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>workflow-service</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>resource-resolution</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
deleted file mode 100644
index 26ce4a8c..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>inbounds</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>resource-api</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Resource API</name>
- <description>Blueprints Processor Resource API</description>
-
-</project>
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java
deleted file mode 100644
index fb833a57..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.resource.api;
-
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-import reactor.core.publisher.Mono;
-
-/**
- * ResourceResolutionController
- *
- * @author Brinda Santh Date : 8/13/2018
- */
-
-@RestController
-@RequestMapping("/api/v1/resource")
-public class ResourceResolutionController {
-
- private ResourceResolutionService resourceResolutionService;
-
- public ResourceResolutionController(ResourceResolutionService resourceResolutionService) {
- this.resourceResolutionService = resourceResolutionService;
- }
-
- @RequestMapping(path = "/ping", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- Mono<String> ping() {
- return Mono.just("Success");
- }
-}
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionControllerTest.java b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionControllerTest.java
deleted file mode 100644
index 53718654..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionControllerTest.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.resource.api;
-
-// TODO
-public class ResourceResolutionControllerTest {
-
-}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
deleted file mode 100755
index 0c6b8e77..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2019 Bell Canada.
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>inbounds</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>selfservice-api</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Selfservice API</name>
- <description>Blueprints Processor Selfservice API</description>
-
- <dependencies>
-
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.onap.ccsdk.apps.components</groupId>
- <artifactId>proto-definition</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-testing</artifactId>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
deleted file mode 100644
index d689187e..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
-
-import io.grpc.StatusException
-import io.grpc.stub.StreamObserver
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils.currentTimestamp
-import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
-import org.onap.ccsdk.apps.controllerblueprints.common.api.Status
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementInput
-import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementOutput
-import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementServiceGrpc
-import org.slf4j.LoggerFactory
-import org.springframework.security.access.prepost.PreAuthorize
-import org.springframework.stereotype.Service
-import java.io.File
-
-@Service
-open class BluePrintManagementGRPCHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration,
- private val bluePrintCatalogService: BluePrintCatalogService)
- : BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase() {
-
- private val log = LoggerFactory.getLogger(BluePrintManagementGRPCHandler::class.java)
-
- @PreAuthorize("hasRole('USER')")
- override fun uploadBlueprint(request: BluePrintManagementInput, responseObserver: StreamObserver<BluePrintManagementOutput>) {
- val blueprintName = request.blueprintName
- val blueprintVersion = request.blueprintVersion
- val blueprint = "blueprint $blueprintName:$blueprintVersion"
-
- log.info("request(${request.commonHeader.requestId}): Received upload $blueprint")
-
- val blueprintArchivedFilePath = "${bluePrintCoreConfiguration.archivePath}/$blueprintName/$blueprintVersion/$blueprintName.zip"
- try {
- val blueprintArchivedFile = File(blueprintArchivedFilePath)
-
- saveToDisk(request, blueprintArchivedFile)
- val blueprintId = bluePrintCatalogService.saveToDatabase(blueprintArchivedFile)
-
- File("${bluePrintCoreConfiguration.archivePath}/$blueprintName").deleteRecursively()
-
- responseObserver.onNext(successStatus("Successfully uploaded $blueprint with id($blueprintId)", request.commonHeader))
- responseObserver.onCompleted()
- } catch (e: Exception) {
- failStatus("request(${request.commonHeader.requestId}): Failed to upload $blueprint at path $blueprintArchivedFilePath", e)
- }
- }
-
- @PreAuthorize("hasRole('USER')")
- override fun removeBlueprint(request: BluePrintManagementInput, responseObserver: StreamObserver<BluePrintManagementOutput>) {
- val blueprintName = request.blueprintName
- val blueprintVersion = request.blueprintVersion
- val blueprint = "blueprint $blueprintName:$blueprintVersion"
-
- log.info("request(${request.commonHeader.requestId}): Received delete $blueprint")
-
- try {
- bluePrintCatalogService.deleteFromDatabase(blueprintName, blueprintVersion)
- responseObserver.onNext(successStatus("Successfully deleted $blueprint", request.commonHeader))
- responseObserver.onCompleted()
- } catch (e: Exception) {
- failStatus("request(${request.commonHeader.requestId}): Failed to delete $blueprint", e)
- }
- }
-
- private fun saveToDisk(request: BluePrintManagementInput, blueprintDir: File) {
- log.info("request(${request.commonHeader.requestId}): Writing CBA File under :${blueprintDir.absolutePath}")
- if (blueprintDir.exists()) {
- log.info("request(${request.commonHeader.requestId}): Re-creating blueprint directory(${blueprintDir.absolutePath})")
- //FileUtils.deleteDirectory(blueprintDir.parentFile)
- blueprintDir.parentFile.deleteRecursively()
- }
- blueprintDir.parentFile.mkdirs()
- //FileUtils.forceMkdir(blueprintDir.parentFile)
- blueprintDir.writeBytes(request.fileChunk.chunk.toByteArray()).apply {
- log.info("request(${request.commonHeader.requestId}): CBA file(${blueprintDir.absolutePath} written successfully")
- }
-
- }
-
- private fun successStatus(message: String, header: CommonHeader): BluePrintManagementOutput =
- BluePrintManagementOutput.newBuilder()
- .setCommonHeader(header)
- .setStatus(Status.newBuilder()
- .setTimestamp(currentTimestamp())
- .setMessage(message)
- .setCode(200)
- .build())
- .build()
-
- private fun failStatus(message: String, e: Exception): StatusException {
- log.error(message, e)
- return io.grpc.Status.INTERNAL
- .withDescription(message)
- .withCause(e)
- .asException()
- }
-}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
deleted file mode 100644
index ebeda69b..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
-
-import io.grpc.stub.StreamObserver
-import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils.toJava
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput
-import org.slf4j.LoggerFactory
-import org.springframework.security.access.prepost.PreAuthorize
-import org.springframework.stereotype.Service
-
-@Service
-open class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration,
- private val executionServiceHandler: ExecutionServiceHandler)
- : BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
- private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandler::class.java)
-
- @PreAuthorize("hasRole('USER')")
- override fun process(
- responseObserver: StreamObserver<ExecutionServiceOutput>): StreamObserver<ExecutionServiceInput> {
-
- return object : StreamObserver<ExecutionServiceInput> {
- override fun onNext(executionServiceInput: ExecutionServiceInput) {
- try {
- runBlocking {
- executionServiceHandler.process(executionServiceInput.toJava(), responseObserver)
- }
- } catch (e: Exception) {
- onError(e)
- }
- }
-
- override fun onError(error: Throwable) {
- log.debug("Fail to process message", error)
- responseObserver.onError(io.grpc.Status.INTERNAL
- .withDescription(error.message)
- .asException())
- }
-
- override fun onCompleted() {
- log.info("Completed")
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
deleted file mode 100644
index 6e729479..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
-
-import io.swagger.annotations.ApiOperation
-import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ACTION_MODE_ASYNC
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.http.MediaType
-import org.springframework.http.codec.multipart.FilePart
-import org.springframework.security.access.prepost.PreAuthorize
-import org.springframework.web.bind.annotation.*
-import reactor.core.publisher.Mono
-
-@RestController
-@RequestMapping("/api/v1/execution-service")
-open class ExecutionServiceController {
-
- @Autowired
- lateinit var executionServiceHandler: ExecutionServiceHandler
-
- @RequestMapping(path = ["/ping"], method = [RequestMethod.GET], produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- fun ping(): String = runBlocking {
- "Success"
- }
-
- @PostMapping(path = ["/upload"], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
- @ApiOperation(value = "Upload CBA", notes = "Takes a File and load it in the runtime database")
- @ResponseBody
- @PreAuthorize("hasRole('USER')")
- fun upload(@RequestPart("file") parts: Mono<FilePart>): Mono<String> {
- return parts
- .filter { it is FilePart }
- .ofType(FilePart::class.java)
- .flatMap(executionServiceHandler::upload)
- }
-
- @RequestMapping(path = ["/process"], method = [RequestMethod.POST], produces = [MediaType.APPLICATION_JSON_VALUE])
- @ApiOperation(value = "Resolve Resource Mappings",
- notes = "Takes the blueprint information and process as per the payload")
- @ResponseBody
- @PreAuthorize("hasRole('USER')")
- fun process(@RequestBody executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput = runBlocking {
- if (executionServiceInput.actionIdentifiers.mode == ACTION_MODE_ASYNC) {
- throw IllegalStateException("Can't process async request through the REST endpoint. Use gRPC for async processing.")
- }
- executionServiceHandler.doProcess(executionServiceInput)
- }
-}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
deleted file mode 100644
index 05a569cb..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
-
-import com.fasterxml.jackson.databind.node.JsonNodeFactory
-import io.grpc.stub.StreamObserver
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ACTION_MODE_ASYNC
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ACTION_MODE_SYNC
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status
-import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils.saveCBAFile
-import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils.toProto
-import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.slf4j.LoggerFactory
-import org.springframework.http.codec.multipart.FilePart
-import org.springframework.stereotype.Service
-import reactor.core.publisher.Mono
-import java.util.stream.Collectors
-
-@Service
-class ExecutionServiceHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration,
- private val bluePrintCatalogService: BluePrintCatalogService,
- private val bluePrintWorkflowExecutionService
- : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>) {
-
- private val log = LoggerFactory.getLogger(ExecutionServiceHandler::class.toString())
-
- fun upload(filePart: FilePart): Mono<String> {
- try {
- val archivedPath = BluePrintFileUtils.getCbaStorageDirectory(bluePrintCoreConfiguration.archivePath)
- val cbaPath = saveCBAFile(filePart, archivedPath)
- bluePrintCatalogService.saveToDatabase(cbaPath.toFile()).let {
- return Mono.just("{\"status\": \"Successfully uploaded blueprint with id($it)\"}")
- }
- } catch (e: Exception) {
- return Mono.error<String>(BluePrintException("Error uploading the CBA file.", e))
- }
- }
-
- suspend fun process(executionServiceInput: ExecutionServiceInput,
- responseObserver: StreamObserver<org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput>) {
- when {
- executionServiceInput.actionIdentifiers.mode == ACTION_MODE_ASYNC -> {
- GlobalScope.launch(Dispatchers.Default) {
- val executionServiceOutput = doProcess(executionServiceInput)
- responseObserver.onNext(executionServiceOutput.toProto())
- responseObserver.onCompleted()
- }
- responseObserver.onNext(response(executionServiceInput).toProto())
- }
- executionServiceInput.actionIdentifiers.mode == ACTION_MODE_SYNC -> {
- val executionServiceOutput = doProcess(executionServiceInput)
- responseObserver.onNext(executionServiceOutput.toProto())
- responseObserver.onCompleted()
- }
- else -> responseObserver.onNext(response(executionServiceInput,
- "Failed to process request, 'actionIdentifiers.mode' not specified. Valid value are: 'sync' or 'async'.",
- true).toProto());
- }
- }
-
- suspend fun doProcess(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
- val requestId = executionServiceInput.commonHeader.requestId
- log.info("processing request id $requestId")
-
- val actionIdentifiers = executionServiceInput.actionIdentifiers
-
- val blueprintName = actionIdentifiers.blueprintName
- val blueprintVersion = actionIdentifiers.blueprintVersion
-
- val basePath = bluePrintCatalogService.getFromDatabase(blueprintName, blueprintVersion)
- log.info("blueprint base path $basePath")
-
- val blueprintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(requestId, basePath.toString())
-
- val output = bluePrintWorkflowExecutionService.executeBluePrintWorkflow(blueprintRuntimeService,
- executionServiceInput, hashMapOf())
-
- val errors = blueprintRuntimeService.getBluePrintError().errors
- if (errors.isNotEmpty()) {
- val errorMessage = errors.stream().map { it.toString() }.collect(Collectors.joining(", "))
- setErrorStatus(errorMessage, output.status)
- }
-
- return output
- }
-
- private fun setErrorStatus(errorMessage: String, status: Status) {
- status.errorMessage = errorMessage
- status.eventType = EventType.EVENT_COMPONENT_FAILURE.name
- status.code = 500
- status.message = BluePrintConstants.STATUS_FAILURE
- }
-
- private fun response(executionServiceInput: ExecutionServiceInput, errorMessage: String = "",
- failure: Boolean = false): ExecutionServiceOutput {
- val executionServiceOutput = ExecutionServiceOutput()
- executionServiceOutput.commonHeader = executionServiceInput.commonHeader
- executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
- executionServiceOutput.payload = JsonNodeFactory.instance.objectNode()
-
- val status = Status()
- if (failure) {
- setErrorStatus(errorMessage, status)
- } else {
- status.eventType = EventType.EVENT_COMPONENT_PROCESSING.name
- status.code = 200
- status.message = BluePrintConstants.STATUS_PROCESSING
- }
-
- executionServiceOutput.status = status
-
- return executionServiceOutput
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt
deleted file mode 100644
index c344ca00..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils
-
-import com.fasterxml.jackson.databind.node.ObjectNode
-import com.google.common.base.Strings
-import com.google.protobuf.Struct
-import com.google.protobuf.util.JsonFormat
-import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers
-import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
-import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.apps.controllerblueprints.common.api.Flag
-import org.onap.ccsdk.apps.controllerblueprints.common.api.Status
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput
-import java.text.SimpleDateFormat
-import java.util.*
-
-private val formatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
-
-// ACTION IDENTIFIER
-
-fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers.toProto(): ActionIdentifiers {
- val actionIdentifier = ActionIdentifiers.newBuilder()
- actionIdentifier.actionName = this.actionName
- actionIdentifier.blueprintName = this.blueprintName
- actionIdentifier.blueprintVersion = this.blueprintVersion
- actionIdentifier.mode = this.mode
- return actionIdentifier.build()
-}
-
-fun ActionIdentifiers.toJava(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers {
- val actionIdentifier = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers()
- actionIdentifier.actionName = this.actionName
- actionIdentifier.blueprintName = this.blueprintName
- actionIdentifier.blueprintVersion = this.blueprintVersion
- actionIdentifier.mode = this.mode
- return actionIdentifier
-}
-
-// COMMON HEADER
-
-fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader.toProto(): CommonHeader {
- val commonHeader = CommonHeader.newBuilder()
- commonHeader.originatorId = this.originatorId
- commonHeader.requestId = this.requestId
- commonHeader.subRequestId = this.subRequestId
- commonHeader.timestamp = this.timestamp.toString()
- commonHeader.flag = this.flags?.toProto()
- return commonHeader.build()
-}
-
-fun CommonHeader.toJava(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader {
- val commonHeader = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader()
- commonHeader.originatorId = this.originatorId
- commonHeader.requestId = this.requestId
- commonHeader.subRequestId = this.subRequestId
- commonHeader.timestamp = if (!Strings.isNullOrEmpty(this.timestamp)) {
- formatter.parse(this.timestamp)
- } else {
- Date()
- }
- commonHeader.flags = this.flag?.toJava()
- return commonHeader
-}
-
-// FLAG
-
-fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Flags.toProto(): Flag {
- val flag = Flag.newBuilder()
- flag.isForce = this.isForce
- flag.ttl = this.ttl
- return flag.build()
-}
-
-fun Flag.toJava(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Flags {
- val flag = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Flags()
- flag.isForce = this.isForce
- flag.ttl = this.ttl
- return flag
-}
-
-// STATUS
-
-fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status.toProto(): Status {
- val status = Status.newBuilder()
- status.code = this.code
- status.errorMessage = this.errorMessage ?: ""
- status.message = this.message
- status.timestamp = this.timestamp.toString()
- status.eventType = EventType.valueOf(this.eventType)
- return status.build()
-}
-
-// EXECUTION INPUT
-
-fun ExecutionServiceInput.toJava(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput {
- val executionServiceInput = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput()
- executionServiceInput.actionIdentifiers = this.actionIdentifiers.toJava()
- executionServiceInput.commonHeader = this.commonHeader.toJava()
- executionServiceInput.payload = JacksonUtils.jsonNode(JsonFormat.printer().print(this.payload)) as ObjectNode
- return executionServiceInput
-}
-
-// EXECUTION OUPUT
-
-fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput.toProto(): ExecutionServiceOutput {
- val executionServiceOuput = ExecutionServiceOutput.newBuilder()
- executionServiceOuput.actionIdentifiers = this.actionIdentifiers.toProto()
- executionServiceOuput.commonHeader = this.commonHeader.toProto()
- executionServiceOuput.status = this.status.toProto()
- val struct = Struct.newBuilder()
- JsonFormat.parser().merge(JacksonUtils.getJson(this.payload), struct)
- executionServiceOuput.payload = struct.build()
- return executionServiceOuput.build()
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/Utils.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/Utils.kt
deleted file mode 100644
index 6d22fdab..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/Utils.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.springframework.http.codec.multipart.FilePart
-import org.springframework.util.StringUtils
-import java.io.File
-import java.io.IOException
-import java.nio.file.Path
-import java.time.LocalDateTime
-import java.time.ZoneId
-import java.time.format.DateTimeFormatter
-import java.util.*
-
-
-fun currentTimestamp(): String {
- val now = LocalDateTime.now(ZoneId.systemDefault())
- val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- return formatter.format(now)
-}
-
-
-@Throws(BluePrintException::class, IOException::class)
-fun saveCBAFile(filePart: FilePart, targetDirectory: Path): Path {
-
- val fileName = StringUtils.cleanPath(filePart.filename())
-
- if (StringUtils.getFilenameExtension(fileName) != "zip") {
- throw BluePrintException("Invalid file extension required ZIP")
- }
-
- val changedFileName = UUID.randomUUID().toString() + ".zip"
-
- val targetLocation = targetDirectory.resolve(changedFileName)
-
- val file = File(targetLocation.toString())
- if (file.exists()) {
- file.delete()
- }
- file.createNewFile()
-
- filePart.transferTo(file)
-
- return targetLocation
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt
deleted file mode 100644
index 100bd320..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.validation
-
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.validation.BluePrintDesignTimeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.validation.extension.ResourceDefinitionValidator
-import org.springframework.stereotype.Service
-
-@Service
-open class BluePrintRuntimeValidatorService(bluePrintTypeValidatorService: BluePrintTypeValidatorService,
- resourceDefinitionValidator: ResourceDefinitionValidator)
- : BluePrintDesignTimeValidatorService(bluePrintTypeValidatorService, resourceDefinitionValidator)
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
deleted file mode 100644
index 264e2aea..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
-
-import com.google.protobuf.ByteString
-import io.grpc.testing.GrpcServerRule
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
-import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementInput
-import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementServiceGrpc
-import org.onap.ccsdk.apps.controllerblueprints.management.api.FileChunk
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.annotation.DirtiesContext
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import java.io.File
-import kotlin.test.AfterTest
-import kotlin.test.BeforeTest
-import kotlin.test.assertEquals
-import kotlin.test.assertTrue
-
-@RunWith(SpringRunner::class)
-@EnableAutoConfiguration
-@DirtiesContext
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-class BluePrintManagementGRPCHandlerTest {
-
- @get:Rule
- val grpcServerRule = GrpcServerRule().directExecutor()
-
- @Autowired
- lateinit var bluePrintManagementGRPCHandler: BluePrintManagementGRPCHandler
-
- @BeforeTest
- fun init() {
- // Create a server, add service, start, and register for automatic graceful shutdown.
- grpcServerRule.serviceRegistry.addService(bluePrintManagementGRPCHandler)
- }
-
- @AfterTest
- fun cleanDir() {
- //TODO It's giving fluctuating results, need to look for another way to cleanup
- // works sometimes otherwise results IO Exception
- // Most probably bufferReader stream is not getting closed when cleanDir is getting invoked
- File("./target/blueprints").deleteRecursively()
- }
-
- @Test
- fun `test upload blueprint`() {
- val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
- val id = "123_upload"
- val req = createInputRequest(id)
- val output = blockingStub.uploadBlueprint(req)
-
- assertEquals(200, output.status.code)
- assertTrue(output.status.message.contains("Successfully uploaded blueprint sample:1.0.0 with id("))
- assertEquals(id, output.commonHeader.requestId)
- }
-
- @Test
- fun `test delete blueprint`() {
- val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
- val id = "123_delete"
- val req = createInputRequest(id)
-
- var output = blockingStub.uploadBlueprint(req)
- assertEquals(200, output.status.code)
- assertTrue(output.status.message.contains("Successfully uploaded blueprint sample:1.0.0 with id("))
- assertEquals(id, output.commonHeader.requestId)
-
- output = blockingStub.removeBlueprint(req)
- assertEquals(200, output.status.code)
- }
-
- private fun createInputRequest(id: String): BluePrintManagementInput {
- val file = File("./src/test/resources/test-cba.zip")
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
-
- val commonHeader = CommonHeader
- .newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId(id)
- .setSubRequestId("1234-56").build()
-
- val fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(file.inputStream().readBytes()))
- .build()
-
- return BluePrintManagementInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setBlueprintName("sample")
- .setBlueprintVersion("1.0.0")
- .setFileChunk(fileChunk)
- .build()
- }
-}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
deleted file mode 100644
index 01984b21..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
-
-
-import com.google.protobuf.util.JsonFormat
-import io.grpc.stub.StreamObserver
-import io.grpc.testing.GrpcServerRule
-import org.junit.Assert
-import org.junit.Ignore
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers
-import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.annotation.DirtiesContext
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.BeforeTest
-
-@Ignore
-@RunWith(SpringRunner::class)
-@DirtiesContext
-@EnableAutoConfiguration
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-class BluePrintProcessingGRPCHandlerTest {
- private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandlerTest::class.java)
-
- @get:Rule
- val grpcServerRule = GrpcServerRule().directExecutor()
-
- @Autowired
- lateinit var bluePrintProcessingGRPCHandler: BluePrintProcessingGRPCHandler
-
- lateinit var requestObs: StreamObserver<ExecutionServiceInput>
-
- @BeforeTest
- fun init() {
- grpcServerRule.serviceRegistry.addService(bluePrintProcessingGRPCHandler)
-
- val blockingStub = BluePrintProcessingServiceGrpc.newStub(grpcServerRule.channel)
-
- requestObs = blockingStub.process(object : StreamObserver<ExecutionServiceOutput> {
- override fun onNext(executionServiceOuput: ExecutionServiceOutput) {
- log.debug("onNext {}", executionServiceOuput)
- if ("1234".equals(executionServiceOuput.commonHeader.requestId)) {
- Assert.assertEquals("Failed to process request, \'actionIdentifiers.mode\' not specified. Valid value are: \'sync\' or \'async\'.", executionServiceOuput.status.errorMessage)
- }
- }
-
- override fun onError(error: Throwable) {
- log.debug("Fail to process message", error)
- Assert.assertEquals("INTERNAL: Could not find blueprint : from database", error.message)
- }
-
- override fun onCompleted() {
- log.info("Done")
- }
- })
- }
-
- @Test
- fun testSelfServiceGRPCHandler() {
- val commonHeader = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId("1234")
- .setSubRequestId("1234-56").build()
-
- val jsonContent = JacksonUtils.getClassPathFileContent("execution-input/sample-payload.json")
- val payloadBuilder = ExecutionServiceInput.newBuilder().payloadBuilder
- JsonFormat.parser().merge(jsonContent, payloadBuilder)
-
- val input = ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setPayload(payloadBuilder.build())
- .build()
-
- requestObs.onNext(input)
-
- val commonHeader2 = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId("2345")
- .setSubRequestId("1234-56").build()
-
- val actionIdentifier = ActionIdentifiers.newBuilder().setMode("sync").build()
-
- val input2 = ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader2)
- .setActionIdentifiers(actionIdentifier)
- .setPayload(payloadBuilder.build())
- .build()
-
- requestObs.onNext(input2)
-
- requestObs.onCompleted()
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
deleted file mode 100644
index b730472e..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.security.SecurityProperties
-import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.core.io.ByteArrayResource
-import org.springframework.http.client.MultipartBodyBuilder
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import org.springframework.test.web.reactive.server.WebTestClient
-import org.springframework.web.reactive.function.BodyInserters
-import java.nio.file.Files
-import java.nio.file.Paths
-import kotlin.test.assertTrue
-
-@RunWith(SpringRunner::class)
-@WebFluxTest
-@ContextConfiguration(classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class, BluePrintCatalogService::class, SecurityProperties::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-class ExecutionServiceHandlerTest {
-
- @Autowired
- lateinit var blueprintCatalog: BluePrintCatalogService
- @Autowired
- lateinit var webTestClient: WebTestClient
-
-
- @Test
- fun `test rest upload blueprint`() {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
-
- val body = MultipartBodyBuilder().apply {
- part("file", object : ByteArrayResource(Files.readAllBytes(Paths.get("./src/test/resources/test-cba.zip"))) {
- override fun getFilename(): String {
- return "test-cba.zip"
- }
- })
- }.build()
-
- webTestClient
- .post()
- .uri("/api/v1/execution-service/upload")
- .body(BodyInserters.fromMultipartData(body))
- .exchange()
- .expectStatus().isOk
- }
-
- @Test
- fun `test rest process`() {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
- blueprintCatalog.saveToDatabase(file)
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!!
- webTestClient
- .post()
- .uri("/api/v1/execution-service/process")
- .body(BodyInserters.fromObject(executionServiceInput))
- .exchange()
- .expectStatus().isOk
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/Mock.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/Mock.kt
deleted file mode 100644
index 19c624bc..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/Mock.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.mock
-
-import io.mockk.mockk
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.slf4j.LoggerFactory
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-
-@Configuration
-open class MockComponentConfiguration {
-
- @Bean(name = ["component-resource-assignment", "component-netconf-executor", "component-jython-executor"])
- open fun createComponentFunction(): AbstractComponentFunction {
- return MockComponentFunction()
- }
-}
-
-class MockComponentFunction : AbstractComponentFunction() {
-
- private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
-
- override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing component : $operationInputs")
-
- bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
- "assignment-params", "params".asJsonPrimitive())
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- log.info("Recovering component..")
- }
-}
-
-open class MockResourceSource {
- @Bean(name = [
- "rr-processor-source-input",
- "rr-processor-source-default",
- "rr-processor-source-primary-db",
- "rr-processor-source-rest"])
- open fun sourceInstance(): ResourceAssignmentProcessor {
- return mockk<ResourceAssignmentProcessor>()
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt
deleted file mode 100644
index 770e4a9b..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils
-
-import org.junit.Assert
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Flags
-import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers
-import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
-import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.apps.controllerblueprints.common.api.Flag
-import org.springframework.test.context.junit4.SpringRunner
-import java.text.SimpleDateFormat
-
-@RunWith(SpringRunner::class)
-class BluePrintMappingsTest {
-
- val formatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- val dateString = "2019-01-16T18:25:43.511Z"
- val dateForTest = formatter.parse(dateString)
-
- val flag = Flag.newBuilder().setIsForce(false).setTtl(1).build()
-
- fun createFlag(): Flags {
- val flag = Flags()
- flag.isForce = false
- flag.ttl = 1
- return flag
- }
-
- @Test
- fun flagToJavaTest() {
- val flag2 = flag.toJava()
-
- Assert.assertEquals(flag.isForce, flag2.isForce)
- Assert.assertEquals(flag.ttl, flag2.ttl)
- }
-
- @Test
- fun flagToProtoTest() {
- val flag = createFlag()
- val flag2 = flag.toProto()
-
- Assert.assertEquals(flag.isForce, flag2.isForce)
- Assert.assertEquals(flag.ttl, flag2.ttl)
- }
-
- fun createStatus(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status {
- val status = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status()
- status.code = 400
- status.errorMessage = "Concurrent modification exception"
- status.eventType = EventType.EVENT_COMPONENT_PROCESSING.name
- status.message = "Error uploading data"
- status.timestamp = dateForTest
- return status
- }
-
- @Test
- fun statusToProtoTest() {
- val status = createStatus()
- val status2 = status.toProto()
-
- Assert.assertEquals(status.code, status2.code)
- Assert.assertEquals(status.errorMessage, status2.errorMessage)
- Assert.assertEquals(status.eventType, status2.eventType.name)
- Assert.assertEquals(status.message, status2.message)
- Assert.assertEquals(status.timestamp.toString(), status2.timestamp)
- }
-
- @Test
- fun commonHeaderToJavaTest() {
- val flag = Flag.newBuilder().setIsForce(true).setTtl(2).build()
-
- val commonHeader = CommonHeader.newBuilder().setOriginatorId("Origin").setRequestId("requestID").setSubRequestId("subRequestID").setTimestamp(dateString).setFlag(flag).build()
- val commonHeader2 = commonHeader.toJava()
-
- Assert.assertEquals(commonHeader.originatorId, commonHeader2.originatorId)
- Assert.assertEquals(commonHeader.requestId, commonHeader2.requestId)
- Assert.assertEquals(commonHeader.subRequestId, commonHeader2.subRequestId)
- Assert.assertEquals(commonHeader.timestamp, formatter.format(commonHeader2.timestamp))
- }
-
- fun createCommonHeader(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader {
- val commonHeader = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader()
- commonHeader.flags = createFlag()
- commonHeader.originatorId = "1234"
- commonHeader.requestId = "2345"
- commonHeader.subRequestId = "0123"
- commonHeader.timestamp = dateForTest
- return commonHeader
- }
-
- @Test
- fun commonHeaderToProtoTest() {
- val commonHeader = createCommonHeader()
- val commonHeader2 = commonHeader.toProto()
- Assert.assertEquals(commonHeader.originatorId, commonHeader2.originatorId)
- Assert.assertEquals(commonHeader.requestId, commonHeader2.requestId)
- Assert.assertEquals(commonHeader.subRequestId, commonHeader2.subRequestId)
- Assert.assertEquals(commonHeader.timestamp.toString(), commonHeader2.timestamp)
- }
-
- @Test
- fun actionIdentifierToJavaTest() {
- val actionIdentifiers = ActionIdentifiers.newBuilder().setActionName("Process Action").setBlueprintName("BlueprintName").setBlueprintVersion("3.0").setMode("Execution").build()
- val actionIdentifiers2 = actionIdentifiers.toJava()
-
- Assert.assertEquals(actionIdentifiers.actionName, actionIdentifiers2.actionName)
- Assert.assertEquals(actionIdentifiers.blueprintName, actionIdentifiers2.blueprintName)
- Assert.assertEquals(actionIdentifiers.blueprintVersion, actionIdentifiers2.blueprintVersion)
- Assert.assertEquals(actionIdentifiers.mode, actionIdentifiers2.mode)
- }
-
- fun createActionIdentifier(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers {
- val ac = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers()
- ac.mode = "mode"
- ac.blueprintVersion = "version"
- ac.blueprintName = "name"
- ac.actionName = "action"
- return ac
- }
-
- @Test
- fun actionIdentifierToProtoTest() {
- val actionIdentifiers = createActionIdentifier()
- val actionIdentifiers2 = actionIdentifiers.toProto()
-
- Assert.assertEquals(actionIdentifiers.actionName, actionIdentifiers2.actionName)
- Assert.assertEquals(actionIdentifiers.blueprintName, actionIdentifiers2.blueprintName)
- Assert.assertEquals(actionIdentifiers.blueprintVersion, actionIdentifiers2.blueprintVersion)
- Assert.assertEquals(actionIdentifiers.mode, actionIdentifiers2.mode)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
deleted file mode 100644
index 1cafead7..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.validation
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.mock.MockResourceSource
-import org.onap.ccsdk.apps.controllerblueprints.validation.BluePrintValidationConfiguration
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintRuntimeValidatorService::class,
- BluePrintValidationConfiguration::class, MockResourceSource::class])
-class BluePrintRuntimeValidatorServiceTest {
-
- @Autowired
- lateinit var bluePrintRuntimeValidatorService: BluePrintRuntimeValidatorService
-
- @Test
- fun testBlueprintRuntimeValidation() {
- val blueprintBasePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
- assertNotNull(bluePrintRuntimeValidatorService, " failed to initilize bluePrintRuntimeValidatorService")
-
- bluePrintRuntimeValidatorService.validateBluePrints(blueprintBasePath)
-
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
deleted file mode 100644
index 6d8b62ff..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-#
-# Modifications Copyright © 2019 IBM, Bell Canada.
-#
-# 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.
-#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
-# Controller Blueprints Core Configuration
-blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
-
-# Python executor
-blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints
-blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json
deleted file mode 100644
index 47ace853..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "commonHeader": {
- "originatorId": "System",
- "requestId": "1234",
- "subRequestId": "1234-12234"
- },
- "actionIdentifiers": {
- "blueprintName": "baseconfiguration",
- "blueprintVersion": "1.0.0",
- "actionName": "activate",
- "mode": "sync"
- },
- "payload": {
- "activate-request": {
- "activate-properties": {
- "request-id": "1234",
- "action-name": "activate",
- "scope-type": "vnf-type",
- "hostname": "localhost"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/sample-payload.json b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/sample-payload.json
deleted file mode 100644
index 07046aa3..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/sample-payload.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "activate-request": {
- "activate-properties": {
- "request-id": "1234",
- "action-name": "activate",
- "scope-type": "vnf-type",
- "hostname": "localhost"
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml
deleted file mode 100644
index a816a06c..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zip b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zip
deleted file mode 100644
index 90748240..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zip
+++ /dev/null
Binary files differ
diff --git a/ms/blueprintsprocessor/modules/outbounds/pom.xml b/ms/blueprintsprocessor/modules/outbounds/pom.xml
deleted file mode 100644
index 3fb7e382..00000000
--- a/ms/blueprintsprocessor/modules/outbounds/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>outbounds</artifactId>
- <packaging>pom</packaging>
- <name>Blueprints Processor Outbounds POM</name>
- <description>Blueprints Processor Outbounds</description>
-
-</project>
diff --git a/ms/blueprintsprocessor/modules/pom.xml b/ms/blueprintsprocessor/modules/pom.xml
deleted file mode 100644
index 26500f50..00000000
--- a/ms/blueprintsprocessor/modules/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
- </parent>
-
- <artifactId>modules</artifactId>
- <packaging>pom</packaging>
- <name>Blueprints Processor Modules</name>
- <description>Blueprints Processor Modules</description>
-
- <modules>
- <module>commons</module>
- <module>outbounds</module>
- <module>services</module>
- <module>inbounds</module>
- </modules>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-maven-plugin</artifactId>
- <version>${kotlin.maven.version}</version>
- <executions>
- <execution>
- <id>compile</id>
- <phase>compile</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- <execution>
- <id>test-compile</id>
- <phase>test-compile</phase>
- <goals>
- <goal>test-compile</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <jvmTarget>1.8</jvmTarget>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-
-</project>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
deleted file mode 100644
index 913ce467..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>services</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>execution-service</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Execution Service</name>
- <description>Blueprints Processor Execution Service</description>
-
- <dependencies>
- <dependency>
- <groupId>org.python</groupId>
- <artifactId>jython-standalone</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-scripts</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>processor-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>db-lib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>rest-lib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.components</groupId>
- <artifactId>proto-definition</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-provider</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
deleted file mode 100644
index 4c381706..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution
-
-
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.JsonNodeFactory
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status
-import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.asObjectNode
-import org.onap.ccsdk.apps.controllerblueprints.core.getAsString
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.slf4j.LoggerFactory
-
-/**
- * AbstractComponentFunction
- * @author Brinda Santh
- */
-abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServiceInput, ExecutionServiceOutput> {
- @Transient
- private val log = LoggerFactory.getLogger(AbstractComponentFunction::class.java)
-
- lateinit var executionServiceInput: ExecutionServiceInput
- var executionServiceOutput = ExecutionServiceOutput()
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var processId: String
- lateinit var workflowName: String
- lateinit var stepName: String
- lateinit var interfaceName: String
- lateinit var operationName: String
- lateinit var nodeTemplateName: String
- var operationInputs: MutableMap<String, JsonNode> = hashMapOf()
-
- override fun getName(): String {
- return stepName
- }
-
- override fun prepareRequest(executionRequest: ExecutionServiceInput): ExecutionServiceInput {
- checkNotNull(bluePrintRuntimeService) { "failed to prepare blueprint runtime" }
-
- check(stepName.isNotEmpty()) { "failed to assign step name" }
-
- this.executionServiceInput = executionRequest
-
- processId = executionRequest.commonHeader.requestId
- check(processId.isNotEmpty()) { "couldn't get process id for step($stepName)" }
-
- workflowName = executionRequest.actionIdentifiers.actionName
- check(workflowName.isNotEmpty()) { "couldn't get action name for step($stepName)" }
-
- log.info("preparing request id($processId) for workflow($workflowName) step($stepName)")
-
- val operationInputs = bluePrintRuntimeService.get("$stepName-step-inputs")
- ?: JsonNodeFactory.instance.objectNode()
-
- operationInputs.fields().forEach {
- this.operationInputs[it.key] = it.value
- }
-
- nodeTemplateName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE)
- check(nodeTemplateName.isNotEmpty()) { "couldn't get NodeTemplate name for step($stepName)" }
-
- interfaceName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_INTERFACE)
- check(interfaceName.isNotEmpty()) { "couldn't get Interface name for step($stepName)" }
-
- operationName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_OPERATION)
- check(operationName.isNotEmpty()) { "couldn't get Operation name for step($stepName)" }
-
- val operationResolvedProperties = bluePrintRuntimeService
- .resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
-
- this.operationInputs.putAll(operationResolvedProperties)
-
- return executionRequest
- }
-
- override fun prepareResponse(): ExecutionServiceOutput {
- log.info("Preparing Response...")
- executionServiceOutput.commonHeader = executionServiceInput.commonHeader
- executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
-
- // Resolve the Output Expression
- val stepOutputs = bluePrintRuntimeService
- .resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
-
- // FIXME("Not the right place to populate the response payload")
- executionServiceOutput.payload = stepOutputs.asObjectNode()
-
- bluePrintRuntimeService.put("$stepName-step-outputs", executionServiceOutput.payload)
-
- // FIXME("Not the right place to populate the status")
- // Populate Status
- val status = Status()
- status.eventType = EventType.EVENT_COMPONENT_EXECUTED.name
- status.code = 200
- status.message = BluePrintConstants.STATUS_SUCCESS
- executionServiceOutput.status = status
- return this.executionServiceOutput
- }
-
- override fun apply(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
- try {
- prepareRequest(executionServiceInput)
- process(executionServiceInput)
- } catch (runtimeException: RuntimeException) {
- recover(runtimeException, executionServiceInput)
- }
- return prepareResponse()
- }
-
- fun getOperationInput(key: String): JsonNode {
- return operationInputs[key]
- ?: throw BluePrintProcessorException("couldn't get the operation input($key) value.")
- }
-
- fun setAttribute(key: String, value: JsonNode) {
- bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName, key, value)
- }
-
- fun addError(type: String, name: String, error: String) {
- bluePrintRuntimeService.getBluePrintError().addError(type, name, error)
- }
-
- fun addError(error: String) {
- bluePrintRuntimeService.getBluePrintError().addError(error)
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
deleted file mode 100644
index 811ee4a2..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-
-abstract class AbstractScriptComponentFunction : AbstractComponentFunction() {
-
- companion object {
- const val DYNAMIC_PROPERTIES = "dynamic-properties"
- }
-
- /**
- * Store Dynamic Script Dependency Instances, Objects present inside won't be persisted or state maintained.
- */
- var functionDependencyInstances: MutableMap<String, Any> = hashMapOf()
-
- /**
- * This will be called from the scripts to serve instance from runtime to scripts.
- */
- open fun <T> functionDependencyInstanceAsType(name: String): T {
- return functionDependencyInstances[name] as? T
- ?: throw BluePrintProcessorException("couldn't get script property instance ($name)")
- }
-
- fun checkDynamicProperties(key: String): Boolean {
- return operationInputs[DYNAMIC_PROPERTIES]?.has(key) ?: false
- }
-
- fun getDynamicProperties(key: String): JsonNode {
- return operationInputs[DYNAMIC_PROPERTIES]!!.get(key)
- }
-
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
deleted file mode 100644
index 2cf22325..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution
-
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts.BlueprintJythonService
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintScriptsService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.slf4j.LoggerFactory
-import org.springframework.context.ApplicationContext
-import org.springframework.stereotype.Service
-
-@Service
-class ComponentFunctionScriptingService(private val applicationContext: ApplicationContext,
- private val bluePrintScriptsService: BluePrintScriptsService,
- private val blueprintJythonService: BlueprintJythonService) {
-
- private val log = LoggerFactory.getLogger(ComponentFunctionScriptingService::class.java)
-
- fun <T : AbstractScriptComponentFunction> scriptInstance(componentFunction: AbstractComponentFunction, scriptType: String,
- scriptClassReference: String,
- instanceDependencies: List<String>): T {
-
- log.info("creating component function of script type($scriptType), reference name($scriptClassReference) and " +
- "instanceDependencies($instanceDependencies)")
-
- val scriptComponent: T = scriptInstance(componentFunction.bluePrintRuntimeService.bluePrintContext(),
- scriptType, scriptClassReference)
-
- checkNotNull(scriptComponent) { "failed to initialize script component" }
-
- scriptComponent.bluePrintRuntimeService = componentFunction.bluePrintRuntimeService
- scriptComponent.processId = componentFunction.processId
- scriptComponent.workflowName = componentFunction.workflowName
- scriptComponent.stepName = componentFunction.stepName
- scriptComponent.interfaceName = componentFunction.interfaceName
- scriptComponent.operationName = componentFunction.operationName
- scriptComponent.nodeTemplateName = componentFunction.nodeTemplateName
- scriptComponent.operationInputs = componentFunction.operationInputs
-
- // Populate Instance Properties
- instanceDependencies.forEach { instanceDependency ->
- scriptComponent.functionDependencyInstances[instanceDependency] = applicationContext
- .getBean(instanceDependency)
- }
- return scriptComponent
- }
-
-
- fun <T : BlueprintFunctionNode<*, *>> scriptInstance(bluePrintContext: BluePrintContext, scriptType: String,
- scriptClassReference: String): T {
- var scriptComponent: T? = null
-
- when (scriptType) {
- BluePrintConstants.SCRIPT_INTERNAL -> {
- scriptComponent = bluePrintScriptsService.scriptInstance<T>(scriptClassReference)
- }
- BluePrintConstants.SCRIPT_KOTLIN -> {
- scriptComponent = bluePrintScriptsService.scriptInstance<T>(bluePrintContext, scriptClassReference, false)
- }
- BluePrintConstants.SCRIPT_JYTHON -> {
- scriptComponent = blueprintJythonService.jythonComponentInstance(bluePrintContext, scriptClassReference) as T
- }
- else -> {
- throw BluePrintProcessorException("script type($scriptType) is not supported")
- }
- }
- return scriptComponent
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
deleted file mode 100644
index 3937f27c..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright © 2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts
-
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.ArrayNode
-import org.apache.commons.io.FilenameUtils
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyOrThrow
-import org.onap.ccsdk.apps.controllerblueprints.core.data.OperationAssignment
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
-import org.springframework.context.ApplicationContext
-import org.springframework.stereotype.Service
-import java.io.File
-
-@Service
-class BlueprintJythonService(val pythonExecutorProperty: PythonExecutorProperty,
- private val applicationContext: ApplicationContext) {
-
- val log: Logger = LoggerFactory.getLogger(BlueprintJythonService::class.java)
-
- inline fun <reified T> jythonInstance(blueprintContext: BluePrintContext, pythonClassName: String, content: String,
- dependencyInstanceNames: MutableMap<String, Any>?): T {
-
- val blueprintBasePath: String = blueprintContext.rootPath
- val pythonPath: MutableList<String> = arrayListOf()
- pythonPath.add(blueprintBasePath)
- pythonPath.addAll(pythonExecutorProperty.modulePaths)
-
- val blueprintPythonConfigurations = BluePrintPython(pythonExecutorProperty.executionPath, pythonPath, arrayListOf())
-
- val blueprintPythonHost = BlueprintPythonHost(blueprintPythonConfigurations)
- val pyObject = blueprintPythonHost.getPythonComponent(content, pythonClassName, dependencyInstanceNames)
-
- log.info("Component Object {}", pyObject)
-
- return pyObject.__tojava__(T::class.java) as T
- }
-
- fun jythonComponentInstance(bluePrintContext: BluePrintContext, scriptClassReference: String):
- BlueprintFunctionNode<*, *> {
- val blueprintBasePath: String = bluePrintContext.rootPath
-
- val pythonFileName = bluePrintContext.rootPath
- .plus(File.separator)
- .plus(scriptClassReference)
-
- val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
- log.info("Getting Jython Script Class($pythonClassName)")
-
- val content: String = JacksonUtils.getContent(pythonFileName)
-
- val pythonPath: MutableList<String> = arrayListOf()
- pythonPath.add(blueprintBasePath)
- pythonPath.addAll(pythonExecutorProperty.modulePaths)
-
- val jythonInstances: MutableMap<String, Any> = hashMapOf()
- jythonInstances["log"] = LoggerFactory.getLogger(pythonClassName)
-
- return jythonInstance<BlueprintFunctionNode<*, *>>(bluePrintContext, pythonClassName,
- content, jythonInstances)
- }
-
- fun jythonComponentInstance(abstractComponentFunction: AbstractComponentFunction): AbstractComponentFunction {
-
- val bluePrintRuntimeService = abstractComponentFunction.bluePrintRuntimeService
- val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
- val nodeTemplateName: String = abstractComponentFunction.nodeTemplateName
- val operationInputs: MutableMap<String, JsonNode> = abstractComponentFunction.operationInputs
-
- val operationAssignment: OperationAssignment = bluePrintContext
- .nodeTemplateInterfaceOperation(abstractComponentFunction.nodeTemplateName,
- abstractComponentFunction.interfaceName, abstractComponentFunction.operationName)
-
- val blueprintBasePath: String = bluePrintContext.rootPath
-
- val artifactName: String = operationAssignment.implementation?.primary
- ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
-
- val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
-
- val pythonFileName = artifactDefinition.file
- ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
-
- val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
- log.info("Getting Jython Script Class($pythonClassName)")
-
- val content: String? = bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
-
- checkNotEmptyOrThrow(content, "artifact ($artifactName) content is empty")
-
- val pythonPath: MutableList<String> = operationAssignment.implementation?.dependencies ?: arrayListOf()
- pythonPath.add(blueprintBasePath)
- pythonPath.addAll(pythonExecutorProperty.modulePaths)
-
- val jythonInstances: MutableMap<String, Any> = hashMapOf()
- jythonInstances["log"] = LoggerFactory.getLogger(nodeTemplateName)
-
- val instanceDependenciesNode: ArrayNode = operationInputs[PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES] as? ArrayNode
- ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})")
-
- instanceDependenciesNode.forEach { instanceName ->
- jythonInstances[instanceName.textValue()] = applicationContext.getBean(instanceName.textValue())
- }
-
- val scriptComponentFunction = jythonInstance<AbstractComponentFunction>(bluePrintContext, pythonClassName,
- content!!, jythonInstances)
-
- return scriptComponentFunction
-
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintPythonHost.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintPythonHost.kt
deleted file mode 100644
index e5b248b6..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintPythonHost.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright © 2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts
-
-import org.python.core.PyObject
-import org.python.util.PythonInterpreter
-
-open class BlueprintPythonHost(private val bluePrintPython: BluePrintPython){
- private val blueprintPythonInterpreterProxy: BlueprintPythonInterpreterProxy
-
- init {
- PythonInterpreter.initialize(System.getProperties(), bluePrintPython.props, bluePrintPython.argv.toTypedArray())
- blueprintPythonInterpreterProxy = BlueprintPythonInterpreterProxy(bluePrintPython)
- }
-
- /**
- * getPythonComponent Purpose: execute the python script and return the python interpreter object
- *
- * @param content String
- * @param interfaceName String
- * @param properties MutableMap<String, Any>
- * @return pyObject PyObject
- */
- fun getPythonComponent(content: String?, interfaceName: String, properties: MutableMap<String, Any>?): PyObject {
- bluePrintPython.content = content!!
- bluePrintPython.pythonClassName = interfaceName
- bluePrintPython.moduleName = "Blueprint Python Script [Class Name = $interfaceName]"
-
- return blueprintPythonInterpreterProxy.getPythonInstance(properties)
- }
-
- //TODO Check potential errors in python scripts
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintPythonInterpreterProxy.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintPythonInterpreterProxy.kt
deleted file mode 100644
index 735b8d77..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintPythonInterpreterProxy.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts
-
-import org.python.core.PyObject
-import org.python.util.PythonInterpreter
-
-open class BlueprintPythonInterpreterProxy(private val bluePrintPython: BluePrintPython): PythonInterpreter(){
-
- fun getPythonInstance(properties: MutableMap<String, Any>?): PyObject{
- properties?.forEach { (name, value) ->
- this.set(name, value)
- }
-
- this.exec("import sys")
-
- bluePrintPython.content.let {
- this.exec(bluePrintPython.content)
- }
-
- val initCommand = bluePrintPython.pythonClassName.plus(" = ").plus(
- bluePrintPython.pythonClassName).plus("()")
- this.exec(initCommand)
-
- return this.get(bluePrintPython.pythonClassName)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/PythonExecutorConfiguration.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/PythonExecutorConfiguration.kt
deleted file mode 100644
index fa3e3a13..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/PythonExecutorConfiguration.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Modifications Copyright © 2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts
-
-import org.springframework.beans.factory.annotation.Value
-import org.springframework.boot.context.properties.EnableConfigurationProperties
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Configuration
-import java.io.File
-import java.util.*
-
-@Configuration
-@ComponentScan
-@EnableConfigurationProperties
-open class PythonExecutorConfiguration
-
-@Configuration
-open class PythonExecutorProperty {
- @Value("\${blueprints.processor.functions.python.executor.executionPath}")
- lateinit var executionPath: String
- @Value("#{'\${blueprints.processor.functions.python.executor.modulePaths}'.split(',')}")
- lateinit var modulePaths: List<String>
-}
-
-class PythonExecutorConstants {
- companion object {
- const val INPUT_INSTANCE_DEPENDENCIES = "instance-dependencies"
- }
-}
-
-open class BluePrintPython(executablePath: String, blueprintPythonPlatform: MutableList<String>,
- val argv: MutableList<String>){
- lateinit var moduleName: String
- lateinit var pythonClassName: String
- lateinit var content: String
- var props: Properties = Properties()
-
- init {
- // Build up the python.path
- val sb = StringBuilder()
- sb.append(System.getProperty("java.class.path"))
-
- for (p in blueprintPythonPlatform) {
- sb.append(File.pathSeparator).append(p)
- }
-
- props["python.import.site"] = "true"
- props.setProperty("python.path", sb.toString())
- props.setProperty("python.verbose", "error")
- props.setProperty("python.executable", executablePath)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
deleted file mode 100644
index b48a10e9..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright © 2019 IBM, Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BlueprintJythonService::class, PythonExecutorProperty::class])
-@TestPropertySource(properties =
-["blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"])
-class BlueprintJythonServiceTest {
-
- @Autowired
- private lateinit var blueprintJythonService: BlueprintJythonService
-
- @Test
- fun testGetAbstractPythonPlugin() {
- val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- val dependencies: MutableMap<String, Any> = hashMapOf()
-
- val content = JacksonUtils.getContent("./../../../../." +
- "./components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py")
-
- val abstractComponentFunction = blueprintJythonService.jythonInstance<AbstractComponentFunction>(bluePrintContext, "SamplePythonComponentNode", content, dependencies)
-
- assertNotNull(abstractComponentFunction, "failed to get python component")
-
- abstractComponentFunction.process(ExecutionServiceInput())
-
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json b/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json
deleted file mode 100644
index cd6fac12..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "api-ver": "2.00",
- "originator-id": "MSO",
- "request-id": "123456",
- "service-instance-id": "ibcx0001vm001",
- "service-type": "AVPN",
- "vnf-type": "vUSP - vDBE-IPX HUB",
- "vnf-id": 123456,
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "action-name": "resource-assignment-action",
- "group-name": "sample group name",
- "bundle-id": "sample bundle id",
- "bundle-mac": [
- "Sample bundle mac",
- "Sample bundle mac"
- ]
-}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json b/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json
deleted file mode 100644
index b28ac5a2..00000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "actionIdentifiers": {
- "actionName": "sample-action",
- "blueprintName": "sample-blurprint",
- "blueprintVersion": "1.0.0",
- "mode": "sync"
- },
- "commonHeader": {
- "flags": {
- "force": true,
- "ttl": 3600
- },
- "originatorId": "sdnc",
- "requestId": "123456-1000",
- "subRequestId": "sub-123456-1000",
- "timestamp": "2012-04-23T18:25:43.511Z"
- },
- "payload": {
- }
-}
diff --git a/ms/blueprintsprocessor/modules/services/pom.xml b/ms/blueprintsprocessor/modules/services/pom.xml
deleted file mode 100755
index ee5b73cc..00000000
--- a/ms/blueprintsprocessor/modules/services/pom.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2019 Bell Canada.
- ~ Modifications Copyright © 2019 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>services</artifactId>
- <name>Blueprints Processor Service POM</name>
- <description>Blueprints Processor Service</description>
- <packaging>pom</packaging>
-
- <modules>
- <module>execution-service</module>
- <module>workflow-service</module>
- </modules>
-
- <dependencies>
- <!-- Test Dependencies -->
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
deleted file mode 100644
index 4331eec7..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>services</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>workflow-service</artifactId>
- <name>Blueprints Processor Workflow Service</name>
- <description>Blueprints Processor Workflow Service</description>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>execution-service</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-provider</artifactId>
- </dependency>
- </dependencies>
-
-
-</project>
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
deleted file mode 100644
index 73f6f497..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.slf4j.LoggerFactory
-import org.springframework.stereotype.Service
-
-@Service("bluePrintWorkflowExecutionService")
-open class BluePrintWorkflowExecutionServiceImpl(
- private val componentWorkflowExecutionService: ComponentWorkflowExecutionService,
- private val dgWorkflowExecutionService: DGWorkflowExecutionService
-) : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
-
- private val log = LoggerFactory.getLogger(BluePrintWorkflowExecutionServiceImpl::class.java)!!
-
- override suspend fun executeBluePrintWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- executionServiceInput: ExecutionServiceInput,
- properties: MutableMap<String, Any>): ExecutionServiceOutput {
-
- val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- val workflowName = executionServiceInput.actionIdentifiers.actionName
-
- // Get the DG Node Template
- val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName)
-
- val derivedFrom = bluePrintContext.nodeTemplateNodeType(nodeTemplateName).derivedFrom
-
- log.info("Executing workflow($workflowName) NodeTemplate($nodeTemplateName), derived from($derivedFrom)")
-
- val executionServiceOutput: ExecutionServiceOutput = when {
- derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_COMPONENT, true) -> {
- componentWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
- }
- derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_DG, true) -> {
- dgWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't execute workflow($workflowName) step mapped " +
- "to node template($nodeTemplateName) derived from($derivedFrom)")
- }
- }
-
- executionServiceOutput.commonHeader = executionServiceInput.commonHeader
- executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
- // TODO("Populate Response Payload and status")
- return executionServiceOutput
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt
deleted file mode 100644
index d2648c07..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
-
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext
-
-class BlueprintSvcLogicContext : SvcLogicContext() {
-
- private var bluePrintRuntimeService: BluePrintRuntimeService<*>? = null
- private var request: Any? = null
- private var response: Any? = null
-
- fun getBluePrintService(): BluePrintRuntimeService<*> {
- return this.bluePrintRuntimeService!!
- }
-
- fun setBluePrintRuntimeService(bluePrintRuntimeService: BluePrintRuntimeService<*>) {
- this.bluePrintRuntimeService = bluePrintRuntimeService
- }
-
- fun setRequest(request: Any) {
- this.request = request
- }
-
- fun getRequest(): Any {
- return this.request!!
- }
-
- fun setResponse(response: Any) {
- this.response = response
- }
-
- fun getResponse(): Any {
- return this.response!!
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
deleted file mode 100644
index fd7ec45b..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
-
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.sli.core.sli.*
-import org.onap.ccsdk.sli.core.sli.provider.base.*
-import org.slf4j.LoggerFactory
-import org.slf4j.MDC
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.context.ApplicationContext
-import org.springframework.stereotype.Service
-import java.util.*
-import javax.annotation.PostConstruct
-
-interface BlueprintSvcLogicService : SvcLogicServiceBase {
-
- fun registerDefaultExecutors()
-
- fun registerExecutors(name: String, svcLogicNodeExecutor: AbstractSvcLogicNodeExecutor)
-
- fun unRegisterExecutors(name: String)
-
- suspend fun execute(graph: SvcLogicGraph, bluePrintRuntimeService: BluePrintRuntimeService<*>, input: Any): Any
-
- @Deprecated("Populate Graph Dynamically from Blueprints, No need to get from Database Store ")
- override fun getStore(): SvcLogicStore {
- TODO("not implemented")
- }
-
- @Deprecated("Not used in Micro service Implementation")
- override fun hasGraph(module: String, rpc: String, version: String?, mode: String): Boolean {
- TODO("not implemented")
- }
-
- @Deprecated("Not used in Micro service Implementation")
- override fun execute(p0: String?, p1: String?, p2: String?, p3: String?, p4: Properties?): Properties {
- TODO("not implemented")
- }
-}
-
-
-@Service
-class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
-
- private val log = LoggerFactory.getLogger(DefaultBlueprintSvcLogicService::class.java)
-
- private val nodeExecutors: MutableMap<String, AbstractSvcLogicNodeExecutor> = hashMapOf()
-
- @Autowired
- private lateinit var context: ApplicationContext
-
- @PostConstruct
- override fun registerDefaultExecutors() {
-
- val executeNodeExecutor = context.getBean(ExecuteNodeExecutor::class.java)
- registerExecutors("execute", executeNodeExecutor)
- registerExecutors("block", BlockNodeExecutor())
- registerExecutors("return", ReturnNodeExecutor())
- registerExecutors("break", BreakNodeExecutor())
- registerExecutors("exit", ExitNodeExecutor())
- }
-
- override fun registerExecutors(name: String, svcLogicNodeExecutor: AbstractSvcLogicNodeExecutor) {
- log.info("Registering executors($name) with type(${svcLogicNodeExecutor.javaClass}")
- nodeExecutors[name] = svcLogicNodeExecutor
- }
-
- override fun unRegisterExecutors(name: String) {
- if (nodeExecutors.containsKey(name)) {
- log.info("UnRegistering executors($name)")
- nodeExecutors.remove(name)
- }
- }
-
- override suspend fun execute(graph: SvcLogicGraph, bluePrintRuntimeService: BluePrintRuntimeService<*>,
- input: Any): Any {
- //Initialise BlueprintSvcLogic Context with Blueprint Runtime Service and Input Request
- val blueprintSvcLogicContext = BlueprintSvcLogicContext()
- blueprintSvcLogicContext.setBluePrintRuntimeService(bluePrintRuntimeService)
- blueprintSvcLogicContext.setRequest(input)
- // Execute the Graph
- execute(graph, blueprintSvcLogicContext)
- // Get the Response
- return blueprintSvcLogicContext.getResponse()
- }
-
- override fun executeNode(node: SvcLogicNode?, ctx: SvcLogicContext): SvcLogicNode? {
- if (node == null) {
- return null
- } else {
- if (log.isDebugEnabled) {
- log.debug("Executing node {}", node.nodeId)
- }
-
- val executor = this.nodeExecutors[node.nodeType]
-
- if (executor != null) {
- log.debug("Executing node executor for node type {} - {}", node.nodeType, executor.javaClass.name)
- return executor.execute(this, node, ctx)
- } else {
- throw SvcLogicException("Attempted to execute a node of type " + node.nodeType + ", but no executor was registered for this type")
- }
- }
- }
-
- override fun execute(graph: SvcLogicGraph, svcLogicContext: SvcLogicContext): SvcLogicContext {
- MDC.put("currentGraph", graph.toString())
-
- var curNode: SvcLogicNode? = graph.rootNode
- log.info("About to execute graph {}", graph.toString())
-
- try {
- while (curNode != null) {
- MDC.put("nodeId", curNode.nodeId.toString() + " (" + curNode.nodeType + ")")
- log.info("About to execute node # {} ({})", curNode.nodeId, curNode.nodeType)
- val nextNode = this.executeNode(curNode, svcLogicContext)
- curNode = nextNode
- }
- } catch (var5: ExitNodeException) {
- log.debug("SvcLogicServiceImpl caught ExitNodeException")
- }
-
- MDC.remove("nodeId")
- MDC.remove("currentGraph")
- return svcLogicContext
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
deleted file mode 100644
index 76d0c46b..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
-
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.stereotype.Service
-
-@Service("componentWorkflowExecutionService")
-open class ComponentWorkflowExecutionService(private val nodeTemplateExecutionService: NodeTemplateExecutionService)
- : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
-
- override suspend fun executeBluePrintWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- executionServiceInput: ExecutionServiceInput,
- properties: MutableMap<String, Any>): ExecutionServiceOutput {
-
- val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- val workflowName = executionServiceInput.actionIdentifiers.actionName
-
- // Get the DG Node Template
- val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName)
-
- // Assign Workflow inputs
- val input = executionServiceInput.payload.get("$workflowName-request")
- bluePrintRuntimeService.assignWorkflowInputs(workflowName, input)
-
- return nodeTemplateExecutionService.executeNodeTemplate(bluePrintRuntimeService,
- nodeTemplateName, executionServiceInput)
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
deleted file mode 100644
index 262b1be1..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.utils.SvcGraphUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.slf4j.LoggerFactory
-import org.springframework.stereotype.Service
-import java.io.File
-
-
-@Service("dgWorkflowExecutionService")
-open class DGWorkflowExecutionService(private val blueprintSvcLogicService: BlueprintSvcLogicService)
- : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
-
- private val log = LoggerFactory.getLogger(DGWorkflowExecutionService::class.java)
-
- override suspend fun executeBluePrintWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- executionServiceInput: ExecutionServiceInput,
- properties: MutableMap<String, Any>): ExecutionServiceOutput {
-
- val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- val workflowName = executionServiceInput.actionIdentifiers.actionName
-
- // Get the DG Node Template
- val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName)
-
- log.info("Executing workflow($workflowName) directed graph NodeTemplate($nodeTemplateName)")
-
- // Get the DG file info
- val artifactDefinition = bluePrintContext.nodeTemplateArtifactForArtifactType(nodeTemplateName,
- WorkflowServiceConstants.ARTIFACT_TYPE_DIRECTED_GRAPH)
-
- // Populate the DG Path
- val dgFilePath = bluePrintContext.rootPath.plus(File.separator).plus(artifactDefinition.file)
-
- log.info("Executing directed graph ($dgFilePath)")
-
- // Create DG instance
- val graph = SvcGraphUtils.getSvcGraphFromFile(dgFilePath)
-
- // Assign Workflow inputs
- val input = executionServiceInput.payload.get("$workflowName-request")
- bluePrintRuntimeService.assignWorkflowInputs(workflowName, input)
-
- // Execute the DG
- return blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput) as ExecutionServiceOutput
-
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
deleted file mode 100644
index 6ce4753b..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
-
-import com.fasterxml.jackson.databind.JsonNode
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.withContext
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.slf4j.LoggerFactory
-import org.springframework.context.ApplicationContext
-import org.springframework.stereotype.Service
-
-@Service
-open class NodeTemplateExecutionService(private val applicationContext: ApplicationContext) {
-
- private val log = LoggerFactory.getLogger(NodeTemplateExecutionService::class.java)!!
-
- suspend fun executeNodeTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
- // Get the Blueprint Context
- val blueprintContext = bluePrintRuntimeService.bluePrintContext()
- // Get the Component Name, NodeTemplate type is mapped to Component Name
- val componentName = blueprintContext.nodeTemplateByName(nodeTemplateName).type
-
- val interfaceName = blueprintContext.nodeTemplateFirstInterfaceName(nodeTemplateName)
-
- val operationName = blueprintContext.nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName)
-
- log.info("executing node template($nodeTemplateName) component($componentName) " +
- "interface($interfaceName) operation($operationName)")
-
- // Get the Component Instance
- val plugin = applicationContext.getBean(componentName, AbstractComponentFunction::class.java)
- // Set the Blueprint Service
- plugin.bluePrintRuntimeService = bluePrintRuntimeService
- plugin.stepName = nodeTemplateName
-
- // Populate Step Meta Data
- val stepInputs: MutableMap<String, JsonNode> = hashMapOf()
- stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, nodeTemplateName)
- stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, interfaceName)
- stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, operationName)
-
- plugin.bluePrintRuntimeService.put("$nodeTemplateName-step-inputs", stepInputs.asJsonNode())
-
- // Get the Request from the Context and Set to the Function Input and Invoke the function
- return withContext(Dispatchers.Default) {
- plugin.apply(executionServiceInput)
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
deleted file mode 100644
index b3186e84..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
-
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Configuration
-
-@Configuration
-@ComponentScan
-open class WorkflowServiceConfiguration
-
-
-class WorkflowServiceConstants {
- companion object {
- const val ARTIFACT_TYPE_DIRECTED_GRAPH = "artifact-directed-graph"
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
deleted file mode 100644
index 1e856b68..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor
-
-import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.BlueprintSvcLogicContext
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.NodeTemplateExecutionService
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext
-import org.onap.ccsdk.sli.core.sli.SvcLogicException
-import org.onap.ccsdk.sli.core.sli.SvcLogicNode
-import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor
-import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicExpressionResolver
-import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceBase
-import org.slf4j.LoggerFactory
-import org.springframework.stereotype.Service
-
-@Service
-open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService: NodeTemplateExecutionService)
- : ExecuteNodeExecutor() {
-
- private val log = LoggerFactory.getLogger(ComponentExecuteNodeExecutor::class.java)
-
- @Throws(SvcLogicException::class)
- override fun execute(svc: SvcLogicServiceBase, node: SvcLogicNode, svcLogicContext: SvcLogicContext)
- : SvcLogicNode = runBlocking {
-
- var outValue: String
-
- val ctx = svcLogicContext as BlueprintSvcLogicContext
-
- val nodeTemplateName = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx)
-
- val executionInput = ctx.getRequest() as ExecutionServiceInput
-
- try { // Get the Request from the Context and Set to the Function Input and Invoke the function
- val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(ctx.getBluePrintService(),
- nodeTemplateName, executionInput)
-
- ctx.setResponse(executionOutput)
-
- outValue = executionOutput.status.message
- ctx.status = executionOutput.status.message
-
- } catch (e: Exception) {
- log.error("Could not execute plugin($nodeTemplateName) : ", e)
- outValue = "failure"
- ctx.status = "failure"
- }
-
- getNextNode(node, outValue)
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt
deleted file mode 100644
index ada36ac0..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.utils
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicGraph
-import org.onap.ccsdk.sli.core.sli.SvcLogicParser
-
-object SvcGraphUtils {
-
- @JvmStatic
- fun getSvcGraphFromClassPathFile(fileName: String): SvcLogicGraph {
- val url = SvcGraphUtils::class.java.classLoader.getResource(fileName)
- return getSvcGraphFromFile(url.path)
- }
-
- @JvmStatic
- fun getSvcGraphFromFile(fileName: String): SvcLogicGraph {
- val svcLogicParser = SvcLogicParser()
- return svcLogicParser.parse(fileName).first
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
deleted file mode 100644
index 7ac9bc33..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
-
-import kotlinx.coroutines.runBlocking
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.junit4.SpringRunner
-
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [WorkflowServiceConfiguration::class])
-class BluePrintWorkflowExecutionServiceImplTest {
-
- @Autowired
- lateinit var bluePrintWorkflowExecutionService: BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>
-
- @Test
- fun testBluePrintWorkflowExecutionService() {
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json",
- ExecutionServiceInput::class.java)!!
-
- runBlocking {
- bluePrintWorkflowExecutionService.executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput,
- hashMapOf())
- }
- }
-
-}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
deleted file mode 100644
index b374e7d4..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
-
-import kotlinx.coroutines.runBlocking
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.mock.PrototypeComponentFunction
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.mock.SingletonComponentFunction
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.context.ApplicationContext
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertEquals
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [WorkflowServiceConfiguration::class, ComponentExecuteNodeExecutor::class])
-class BlueprintServiceLogicTest {
-
- private val log = LoggerFactory.getLogger(BlueprintServiceLogicTest::class.java)
-
- @Autowired
- lateinit var applicationContext: ApplicationContext
-
- @Autowired
- lateinit var dgWorkflowExecutionService: DGWorkflowExecutionService
-
- @Test
- fun testExecuteGraphWithSingleComponent() {
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!!
-
- runBlocking {
- dgWorkflowExecutionService.executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf())
- }
-
-
- }
-
- @Test
- fun testExecuteGraphWithMultipleComponents() {
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/assign-activate-input.json", ExecutionServiceInput::class.java)!!
-
- runBlocking {
- dgWorkflowExecutionService.executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf())
- }
-
- }
-
- @Test
- fun testSingleton() {
- val singleton1 = applicationContext.getBean(SingletonComponentFunction::class.java)
- singleton1.stepName = "step1"
- val singleton2 = applicationContext.getBean(SingletonComponentFunction::class.java)
- assertEquals(singleton1.stepName, singleton2.stepName, " failed to get singleton data")
- }
-
- @Test
- fun testProtoTypeFunction() {
- val stepName1 = "step1"
- val stepName2 = "step2"
- val proto1 = applicationContext.getBean(PrototypeComponentFunction::class.java)
- proto1.stepName = stepName1
-
- val proto2 = applicationContext.getBean(PrototypeComponentFunction::class.java)
- proto2.stepName = stepName2
-
- assertEquals(stepName1, proto1.stepName, " Failed to match the step1 name")
- assertEquals(stepName2, proto2.stepName, " Failed to match the step2 name")
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt
deleted file mode 100644
index 2e36fb5f..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
-
-import kotlinx.coroutines.runBlocking
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.junit4.SpringRunner
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [WorkflowServiceConfiguration::class, ComponentExecuteNodeExecutor::class])
-class DGWorkflowExecutionServiceTest {
-
- private val log = LoggerFactory.getLogger(BlueprintServiceLogicTest::class.java)
-
- @Autowired
- lateinit var dgWorkflowExecutionService: DGWorkflowExecutionService
-
-
- @Test
- fun testExecuteDirectedGraph() {
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!!
-
- runBlocking {
- dgWorkflowExecutionService.executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf())
- }
-
- }
-
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
deleted file mode 100644
index 4c124562..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.mock
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Component
-
-@Configuration
-open class MockComponentConfiguration {
-
- @Bean(name = ["component-resource-resolution", "component-netconf-executor", "component-jython-executor"])
- open fun createComponentFunction(): AbstractComponentFunction {
- return MockComponentFunction()
- }
-}
-
-class MockComponentFunction : AbstractComponentFunction() {
-
- private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
-
- override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing component : $operationInputs")
-
- bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
- "assignment-params", "params".asJsonPrimitive())
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- log.info("Recovering component..")
- }
-}
-
-@Component("singleton-function")
-@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
-class SingletonComponentFunction : AbstractComponentFunction() {
-
- private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
-
- override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing component : $operationInputs")
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- log.info("Recovering component..")
- }
-}
-
-@Component("prototype-function")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-class PrototypeComponentFunction : AbstractComponentFunction() {
-
- private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
-
- override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing component : $operationInputs")
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- log.info("Recovering component..")
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json
deleted file mode 100644
index d63b1d31..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "commonHeader": {
- "originatorId": "System",
- "requestId": "1234",
- "subRequestId": "1234-12234"
- },
- "actionIdentifiers": {
- "blueprintName": "baseconfiguration",
- "blueprintVersion": "1.0.0",
- "actionName": "assign-activate",
- "mode": "sync"
- },
- "payload": {
- "assign-activate-request": {
- "assign-activate-properties": {
- "request-id": "1234",
- "action-name": "assign-activate",
- "scope-type": "vnf-type",
- "hostname": "localhost"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json
deleted file mode 100644
index ce7bc8e5..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "commonHeader": {
- "originatorId": "System",
- "requestId": "1234",
- "subRequestId": "1234-12234"
- },
- "actionIdentifiers": {
- "blueprintName": "baseconfiguration",
- "blueprintVersion": "1.0.0",
- "actionName": "resource-assignment",
- "mode": "sync"
- },
- "payload": {
- "resource-assignment-request": {
- "resource-assignment-properties": {
- "request-id": "1234",
- "action-name": "resource-assignment",
- "scope-type": "vnf-type",
- "hostname": "localhost"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml
deleted file mode 100644
index 95947ad3..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
deleted file mode 100755
index f1c601ff..00000000
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ /dev/null
@@ -1,564 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~ Modifications Copyright © 2019 Bell Canada.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>blueprintsprocessor</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>parent</artifactId>
- <packaging>pom</packaging>
- <name>Blueprints Processor Parent</name>
- <description>Blueprints Processor Parent</description>
- <properties>
- <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
- <spring.boot.version>2.1.3.RELEASE</spring.boot.version>
- <spring.version>5.1.5.RELEASE</spring.version>
- <kotlin.version>1.3.21</kotlin.version>
- <kotlin.maven.version>1.3.21</kotlin.maven.version>
- <kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
- <grpc.version>1.18.0</grpc.version>
- <!-- TODO("Migrate SSHD to 2.x version") -->
- <sshd.version>1.7.0</sshd.version>
- <jsch.version>0.1.55</jsch.version>
- <protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
- <eelf.version>1.0.0</eelf.version>
- <sli.version>0.4.1-SNAPSHOT</sli.version>
- <guava.version>27.0.1-jre</guava.version>
- <jython.version>2.7.1</jython.version>
- <springfox.swagger2.version>2.9.2</springfox.swagger2.version>
- <h2database.version>1.4.197</h2database.version>
- <onap.logger.slf4j>1.2.2</onap.logger.slf4j>
- <powermock.version>1.7.4</powermock.version>
- <mockk.version>1.9</mockk.version>
- <dmaap.client.version>1.1.5</dmaap.client.version>
- </properties>
- <dependencyManagement>
- <dependencies>
- <!-- Spring Boot -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>${spring.boot.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <!-- Logging Dependencies -->
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>${eelf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- <version>${onap.logger.slf4j}</version>
- </dependency>
-
- <!--Swagger Dependencies -->
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>${springfox.swagger2.version}</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>${springfox.swagger2.version}</version>
- </dependency>
-
- <!-- Common Utils Dependencies -->
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.2.1</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2.2</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.6</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- <version>1.15</version>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>1.7</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- </dependency>
- <dependency>
- <groupId>org.python</groupId>
- <artifactId>jython-standalone</artifactId>
- <version>${jython.version}</version>
- </dependency>
-
- <!-- Kotlin Dependencies -->
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-common</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <!--Use kotlin-compiler-embeddable instead koltin-compiler wrap-->
- <!--guava dependency inside kotlin-compiler creating classpath issues at runtime-->
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-scripting-jvm-host</artifactId>
- <version>${kotlin.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compile</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler-embeddable</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-util</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-runtime</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-core</artifactId>
- <version>${kotlin.couroutines.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-reactor</artifactId>
- <version>${kotlin.couroutines.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-reflect</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk8</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk7</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
-
- <!-- GRPC Dependencies -->
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-core</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-netty</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-protobuf</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-stub</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java-util</artifactId>
- <version>${protobuff.java.utils.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.components</groupId>
- <artifactId>proto-definition</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Adaptors -->
- <dependency>
- <groupId>org.apache.sshd</groupId>
- <artifactId>sshd-core</artifactId>
- <version>${sshd.version}</version>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>${jsch.version}</version>
- </dependency>
-
- <!-- SLI Version -->
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-provider</artifactId>
- <version>${sli.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.commons</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
-
- <!-- Blueprint Processor Application Module Dependencies -->
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>processor-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>db-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>rest-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>dmaap-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>execution-service</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>workflow-service</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>resource-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>selfservice-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>application</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Functions -->
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>resource-resolution</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>python-executor</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>netconf-executor</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId>
- <artifactId>restconf-executor</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Controller Blueprints Application Dependency -->
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-scripts</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>db-resources</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Database -->
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>${h2database.version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- Test Dependency -->
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- <version>${mockk.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <version>${kotlin.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- <version>${kotlin.couroutines.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-testing</artifactId>
- <version>${grpc.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</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.commons</groupId>
- <artifactId>commons-compress</artifactId>
- </dependency>
- <dependency>
- <groupId>com.jayway.jsonpath</groupId>
- <artifactId>json-path</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk8</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-reactor</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-kotlin</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler-embeddable</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-scripting-jvm-host</artifactId>
- <!--Use kotlin-compiler-embeddable as koltin-compiler wrap-->
- <!--guava dependency creating classpath issues at runtime-->
- <exclusions>
- <exclusion>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- GRPC Dependencies -->
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-netty</artifactId>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-protobuf</artifactId>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-stub</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java-util</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-maven-plugin</artifactId>
- <version>${kotlin.maven.version}</version>
- <executions>
- <execution>
- <id>compile</id>
- <goals>
- <goal>compile</goal>
- </goals>
- <configuration>
- <sourceDirs>
- <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
- <sourceDir>${project.basedir}/src/main/java</sourceDir>
- </sourceDirs>
- </configuration>
- </execution>
- <execution>
- <id>test-compile</id>
- <goals>
- <goal>test-compile</goal>
- </goals>
- <configuration>
- <sourceDirs>
- <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
- <sourceDir>${project.basedir}/src/test/java</sourceDir>
- </sourceDirs>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.5.1</version>
- <configuration>
- <source>${maven.compiler.source}</source>
- <target>${maven.compiler.target}</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/ms/blueprintsprocessor/pom.xml b/ms/blueprintsprocessor/pom.xml
deleted file mode 100755
index 2f257678..00000000
--- a/ms/blueprintsprocessor/pom.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2019 Bell Canada.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>ccsdk-apps-ms</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <artifactId>blueprintsprocessor</artifactId>
- <packaging>pom</packaging>
- <name>Blueprints Processor Root</name>
- <description>Blueprints Processor Root</description>
-
- <properties>
- <service.name>BlueprintsProcessor</service.name>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
- <build.number>${maven.build.timestamp}</build.number>
- <java.version>1.8</java.version>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.source>1.8</maven.compiler.source>
- <ccsdk.project.version>${project.version}</ccsdk.project.version>
- </properties>
-
- <modules>
- <module>parent</module>
- <module>modules</module>
- <module>functions</module>
- <module>application</module>
- <module>distribution</module>
- </modules>
-
-</project>
diff --git a/ms/cds-sdc-listener/application/pom.xml b/ms/cds-sdc-listener/application/pom.xml
deleted file mode 100644
index 1df385fe..00000000
--- a/ms/cds-sdc-listener/application/pom.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright (C) 2019 Bell Canada. All rights reserved.
- ~
- ~ NOTICE: All the intellectual and technical concepts contained herein are
- ~ proprietary to Bell Canada and are protected by trade secret or copyright law.
- ~ Unauthorized copying of this file, via any medium is strictly prohibited.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>spring-boot-1-starter-parent</artifactId>
- <version>1.2.2-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>cds-sdc-listener-application</artifactId>
- <name>CDS-SDC Listener Application </name>
-
- <dependencies>
- <!-- Spring boot -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-devtools</artifactId>
- <optional>true</optional>
- </dependency>
-
- <!-- SDC Distribution client dependency -->
- <dependency>
- <groupId>org.onap.sdc.sdc-distribution-client</groupId>
- <artifactId>sdc-distribution-client</artifactId>
- <version>1.3.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.jmockit</groupId>
- <artifactId>jmockit</artifactId>
- <version>1.19</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>repackage</id>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerApplication.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerApplication.java
deleted file mode 100644
index 3bd34fb0..00000000
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerApplication.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
- *
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- */
-
-package org.onap.ccsdk.apps.cdssdclistener;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-
-@SpringBootApplication
-@EnableConfigurationProperties(CdsSdcListenerConfiguration.class)
-public class CdsSdcListenerApplication {
- public static void main(String[] args) {
- SpringApplication.run(CdsSdcListenerApplication.class, args);
- }
-}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClient.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClient.java
deleted file mode 100644
index af0bb40b..00000000
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClient.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
- *
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- */
-package org.onap.ccsdk.apps.cdssdclistener;
-
-import java.util.Optional;
-import org.onap.ccsdk.apps.cdssdclistener.exceptions.CdsSdcListenerException;
-import org.onap.sdc.api.IDistributionClient;
-import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.impl.DistributionClientFactory;
-import org.onap.sdc.utils.DistributionActionResultEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.event.ApplicationReadyEvent;
-import org.springframework.context.event.EventListener;
-import org.springframework.stereotype.Component;
-
-@Component
-public class CdsSdcListenerClient {
-
- private static Logger LOG = LoggerFactory.getLogger(CdsSdcListenerClient.class);
-
- @Autowired
- private CdsSdcListenerConfiguration configuration;
-
- @Autowired
- private CdsSdcListenerNotificationCallback notification;
-
- @Autowired
- private CdsSdcListenerDto listenerDto;
-
- private IDistributionClient distributionClient;
-
- /**
- * This method initializes the SDC Distribution client.
- */
- @EventListener(ApplicationReadyEvent.class)
- public void initSdcClient() throws CdsSdcListenerException {
- LOG.info("Initialize the SDC distribution client");
-
- distributionClient = Optional.of(DistributionClientFactory.createDistributionClient())
- .orElseThrow(() -> new CdsSdcListenerException("Could not able to create SDC Distribution client"));
-
- listenerDto.setDistributionClient(distributionClient);
-
- IDistributionClientResult result = distributionClient.init(configuration, notification);
-
- startSdcClientBasedOnTheResult(result);
- }
-
- private void startSdcClientBasedOnTheResult(IDistributionClientResult result) throws CdsSdcListenerException {
- if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
- throw new CdsSdcListenerException(
- "SDC distribution client init failed with reason:" + result.getDistributionMessageResult());
- }
-
- // Start the client.
- result = this.distributionClient.start();
-
- if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
- throw new CdsSdcListenerException(
- "Startup of the SDC distribution client failed with reason: " + result.getDistributionMessageResult());
- }
- }
-
- private void closeSdcDistributionclient() throws CdsSdcListenerException {
-
- IDistributionClientResult status = this.distributionClient.stop();
-
- LOG.info("Closing SDC distribution client");
- if (status.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
- throw new CdsSdcListenerException(
- "Failed to close the SDC distribution client due to : " + status.getDistributionMessageResult());
- }
- }
-}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfiguration.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfiguration.java
deleted file mode 100644
index 0cbb917f..00000000
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfiguration.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
- *
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- */
-
-package org.onap.ccsdk.apps.cdssdclistener;
-
-import java.util.List;
-import org.onap.sdc.api.consumer.IConfiguration;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-/**
- * In order to initiate a SDC distribution client we need to supply some pre-configuration values that
- * distribution client needs.
- */
-@ConfigurationProperties("listenerservice")
-public class CdsSdcListenerConfiguration implements IConfiguration {
-
- public static final String TOSCA_CSAR = "TOSCA_CSAR";
-
- @Value("${listenerservice.config.asdcAddress}")
- private String asdcAddress;
-
- @Value("${listenerservice.config.messageBusAddress}")
- private List<String> messageBusAddress;
-
- @Value("${listenerservice.config.user}")
- private String user;
-
- @Value("${listenerservice.config.password}")
- private String password;
-
- @Value("${listenerservice.config.pollingTimeout}")
- private int pollingTimeout;
-
- @Value("${listenerservice.config.pollingInterval}")
- private int pollingInterval;
-
- @Value("${listenerservice.config.relevantArtifactTypes}")
- private List<String> relevantArtifactTypes;
-
- @Value("${listenerservice.config.consumerGroup}")
- private String consumerGroup;
-
- @Value("${listenerservice.config.environmentName}")
- private String envName;
-
- @Value("${listenerservice.config.consumerId}")
- private String consumerId;
-
- @Value("${listenerservice.config.activateServerTLSAuth}")
- private boolean activateServerTLSAuth;
-
- @Value("${listenerservice.config.isUseHttpsWithDmaap}")
- private boolean isUseHttpsWithDmaap;
-
-
- @Override
- public String getAsdcAddress() {
- return asdcAddress;
- }
-
- @Override
- public List<String> getMsgBusAddress() {
- return messageBusAddress;
- }
-
- @Override
- public String getUser() {
- return user;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- @Override
- public int getPollingInterval() {
- return pollingInterval;
- }
-
- @Override
- public int getPollingTimeout() {
- return pollingTimeout;
- }
-
- @Override
- public List<String> getRelevantArtifactTypes() {
- return relevantArtifactTypes;
- }
-
- @Override
- public String getConsumerGroup() {
- return consumerGroup;
- }
-
- @Override
- public String getEnvironmentName() {
- return envName;
- }
-
- @Override
- public String getConsumerID() {
- return consumerId;
- }
-
- @Override
- public String getKeyStorePath() {
- return null;
- }
-
- @Override
- public String getKeyStorePassword() {
- return null;
- }
-
- @Override
- public boolean activateServerTLSAuth() {
- return activateServerTLSAuth;
- }
-
- @Override
- public boolean isFilterInEmptyResources() {
- return false;
- }
-
- @Override
- public Boolean isUseHttpsWithDmaap() {
- return isUseHttpsWithDmaap;
- }
-}
-
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerDto.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerDto.java
deleted file mode 100644
index afa753e5..00000000
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerDto.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
- *
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- */
-package org.onap.ccsdk.apps.cdssdclistener;
-
-import org.onap.sdc.api.IDistributionClient;
-
-public class CdsSdcListenerDto {
-
- private IDistributionClient distributionClient;
-
- public IDistributionClient getDistributionClient() {
- return distributionClient;
- }
-
- public void setDistributionClient(IDistributionClient distributionClient) {
- this.distributionClient = distributionClient;
- }
-}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerNotificationCallback.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerNotificationCallback.java
deleted file mode 100644
index 35747635..00000000
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerNotificationCallback.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
- *
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- */
-
-package org.onap.ccsdk.apps.cdssdclistener;
-
-import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS;
-import java.util.List;
-import org.onap.sdc.api.IDistributionClient;
-import org.onap.sdc.api.consumer.INotificationCallback;
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class CdsSdcListenerNotificationCallback implements INotificationCallback {
-
- @Autowired
- private CdsSdcListenerDto cdsSdcListenerDto;
-
- private static final Logger LOGGER = LoggerFactory.getLogger(CdsSdcListenerNotificationCallback.class);
-
- @Override
- public void activateCallback(INotificationData notificationData) {
- LOGGER.info(notificationData.getDistributionID(), "The UUID generated by SDC {}");
- processNotification(notificationData);
- }
-
- private void processNotification(INotificationData notificationData) {
- downlaodCsarArtifacts(notificationData.getServiceArtifacts());
- }
-
- /**
- * Download the TOSCA CSAR artifact.
- * @param artifactInfo - An object consists of Artifact information.
- */
- private void downlaodCsarArtifacts(List<IArtifactInfo> artifactInfo) {
- final IDistributionClient distributionClient = cdsSdcListenerDto.getDistributionClient();
-
- artifactInfo.forEach(info -> {
- final String url = info.getArtifactURL();
- final String id = info.getArtifactUUID();
- if (info.getArtifactType().equals(CdsSdcListenerConfiguration.TOSCA_CSAR)) {
- LOGGER.info("Trying to download the artifact from : {} and UUID is {} ", url, id);
-
- IDistributionClientDownloadResult result = distributionClient.download(info);
-
- if (!result.getDistributionActionResult().equals(SUCCESS)) {
- LOGGER.info("Failed to download the artifact from : {} due to {} ", url,
- result.getDistributionActionResult());
- } else {
- parseCBAFileFromCsar(result);
- }
- }
- });
- }
-
- private void parseCBAFileFromCsar(IDistributionClientDownloadResult result) {
-
- }
-}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/exceptions/CdsSdcListenerException.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/exceptions/CdsSdcListenerException.java
deleted file mode 100644
index 3f83b6ac..00000000
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/exceptions/CdsSdcListenerException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
- *
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- */
-
-package org.onap.ccsdk.apps.cdssdclistener.exceptions;
-
-public class CdsSdcListenerException extends Exception {
-
- /**
- * @param message The message to dump
- */
- public CdsSdcListenerException(final String message) {
- super(message);
- }
-
- /**
- * @param message The message to dump
- * @param cause The Throwable cause object
- */
- public CdsSdcListenerException(final String message, final Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerService.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerService.java
deleted file mode 100644
index d6c2c4f4..00000000
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerService.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
- *
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- */
-
-package org.onap.ccsdk.apps.cdssdclistener.service;
-
-import java.io.File;
-
-public interface ListenerService {
-
- void extractBluePrint(File file);
-
- void storeBluePrint(File file);
-}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerServiceImpl.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerServiceImpl.java
deleted file mode 100644
index 864c485c..00000000
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerServiceImpl.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
- *
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- */
-
-package org.onap.ccsdk.apps.cdssdclistener.service;
-
-import java.io.File;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ListenerServiceImpl implements ListenerService {
-
- @Override
- public void extractBluePrint(File file) {
- //TODO
-
- }
-
- @Override
- public void storeBluePrint(File file) {
- //TODO
- }
-}
diff --git a/ms/cds-sdc-listener/application/src/main/resources/application.yml b/ms/cds-sdc-listener/application/src/main/resources/application.yml
deleted file mode 100644
index 1daef585..00000000
--- a/ms/cds-sdc-listener/application/src/main/resources/application.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-listenerservice:
- config:
- asdcAddress: localhost:8443
- messageBusAddress: localhost
- user: vid
- password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
- pollingInterval: 15
- pollingTimeout: 15
- relevantArtifactTypes: TOSCA_CSAR
- consumerGroup: cds-id-local
- environmentName: AUTO
- consumerId: cds-id-local
- keyStorePassword:
- keyStorePath:
- activateServerTLSAuth : false
- isUseHttpsWithDmaap: false
-
diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClientTest.java b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClientTest.java
deleted file mode 100644
index 3a634b8c..00000000
--- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClientTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
- *
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- */
-
-package org.onap.ccsdk.apps.cdssdclistener;
-
-import mockit.Expectations;
-import mockit.Injectable;
-import mockit.Mock;
-import mockit.MockUp;
-import mockit.Tested;
-import mockit.VerificationsInOrder;
-import mockit.integration.junit4.JMockit;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.ccsdk.apps.cdssdclistener.exceptions.CdsSdcListenerException;
-import org.onap.sdc.api.IDistributionClient;
-import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.impl.DistributionClientFactory;
-import org.onap.sdc.impl.DistributionClientResultImpl;
-import org.onap.sdc.utils.DistributionActionResultEnum;
-
-@RunWith(JMockit.class)
-public class CdsSdcListenerClientTest {
-
- @Tested
- private CdsSdcListenerClient cdsSdcListenerClient;
-
- @Test
- public void testInitCdsClientSuccesfully(@Injectable IDistributionClient distributionClient,
- @Injectable CdsSdcListenerConfiguration configuration,
- @Injectable CdsSdcListenerNotificationCallback notification,
- @Injectable CdsSdcListenerDto cdsSdcListenerDto) throws CdsSdcListenerException {
-
- // Arrange
- new MockUp<DistributionClientFactory>() {
- @Mock
- public IDistributionClient createDistributionClient() {
- return distributionClient;
- }
- };
-
- new Expectations() {{
- distributionClient.init(configuration, notification);
- result = getResult();
- }};
-
- new Expectations() {{
- distributionClient.start();
- result = getResult();
- }};
-
- // Act
- cdsSdcListenerClient.initSdcClient();
-
- // Verify
- new VerificationsInOrder() {{
- distributionClient.init(configuration, notification);
- distributionClient.start();
- }};
- }
-
- public IDistributionClientResult getResult() {
- return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,
- DistributionActionResultEnum.SUCCESS.name());
- }
-}
diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfigurationTest.java b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfigurationTest.java
deleted file mode 100644
index 886049df..00000000
--- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfigurationTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
- *
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- */
-
-package org.onap.ccsdk.apps.cdssdclistener;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@EnableConfigurationProperties(CdsSdcListenerConfiguration.class)
-@SpringBootTest(classes = {CdsSdcListenerConfigurationTest.class})
-public class CdsSdcListenerConfigurationTest {
-
- @Autowired
- private CdsSdcListenerConfiguration listenerConfiguration;
-
- @Test
- public void testCdsSdcListenerConfiguration() {
- assertEquals(listenerConfiguration.getAsdcAddress(), "localhost:8443");
- assertEquals(listenerConfiguration.getMsgBusAddress().stream().findFirst().get(), "localhost");
- assertEquals(listenerConfiguration.getUser(), "vid");
- assertEquals(listenerConfiguration.getPassword(), "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U");
- assertEquals(listenerConfiguration.getPollingInterval(), 15);
- assertEquals(listenerConfiguration.getPollingTimeout(), 15);
- assertEquals(listenerConfiguration.getRelevantArtifactTypes().stream().findFirst().get(), "TOSCA_CSAR");
- assertEquals(listenerConfiguration.getConsumerGroup(), "cds-id-local");
- assertEquals(listenerConfiguration.getEnvironmentName(), "AUTO");
- assertEquals(listenerConfiguration.getConsumerID(), "cds-id-local");
- assertEquals(listenerConfiguration.activateServerTLSAuth(), false);
- }
-}
diff --git a/ms/cds-sdc-listener/distribution/pom.xml b/ms/cds-sdc-listener/distribution/pom.xml
deleted file mode 100644
index 60711f69..00000000
--- a/ms/cds-sdc-listener/distribution/pom.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright (C) 2019 Bell Canada. All rights reserved.
- ~
- ~ NOTICE: All the intellectual and technical concepts contained herein are
- ~ proprietary to Bell Canada and are protected by trade secret or copyright law.
- ~ Unauthorized copying of this file, via any medium is strictly prohibited.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>cds-sdc-listener</artifactId>
- <groupId>org.onap.ccsdk.apps</groupId>
- <version>0.4.1-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>cds-sdc-listener-distribution</artifactId>
- <name>CDS-SDC Listener Distribution</name>
-
- <properties>
- <image.name>onap/ccsdk-cdssdclistener</image.name>
- <docker.push.phase>deploy</docker.push.phase>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <id>copy-dockerfile</id>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <phase>validate</phase>
- <configuration>
- <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/docker</directory>
- <includes>
- <include>*</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <!-- Maven plugin for managing docker images and containers -->
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.26.1</version>
- <inherited>false</inherited>
- <configuration>
- <images>
- <image>
- <name>${image.name}</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
- </tags>
- </build>
- </image>
- </images>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <id>generate-images</id>
- <phase>package</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- <execution>
- <id>push-images</id>
- <phase>${docker.push.phase}</phase>
- <goals>
- <goal>build</goal>
- <goal>push</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
diff --git a/ms/cds-sdc-listener/pom.xml b/ms/cds-sdc-listener/pom.xml
deleted file mode 100644
index 538185eb..00000000
--- a/ms/cds-sdc-listener/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright (C) 2019 Bell Canada. All rights reserved.
- ~
- ~ NOTICE: All the intellectual and technical concepts contained herein are
- ~ proprietary to Bell Canada and are protected by trade secret or copyright law.
- ~ Unauthorized copying of this file, via any medium is strictly prohibited.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>ccsdk-apps-ms</artifactId>
- <groupId>org.onap.ccsdk.apps</groupId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>cds-sdc-listener</artifactId>
- <name>CDS-SDC Listener Root</name>
- <description>A microservice to get the cba file from SDC and store it into database at runtime</description>
- <packaging>pom</packaging>
-
- <modules>
- <module>application</module>
- <!-- Module is not currently working
- <module>distribution</module>
- -->
- </modules>
-
-</project>
diff --git a/ms/controllerblueprints/.gitignore b/ms/controllerblueprints/.gitignore
deleted file mode 100644
index 4b5c1c0a..00000000
--- a/ms/controllerblueprints/.gitignore
+++ /dev/null
@@ -1,25 +0,0 @@
-/target/
-/logs/
-.classpath
-.settings/
-
-# Target dirs in all projects
-**/target-ide/*
-**/target/*
-**/logs/*
-**/debug-logs/*
-**/tokens/*
-
-# Added for Intellij IDEA IDE
-**/debug-logs/*
-**/.idea/*
-**/*.iml
-**/*.project
-**/.springBeans
-**/.directory
-
-
-**/*versionsBackup
-**/blackDuckHub*
-**/*.jsonld
-/target-ide/
diff --git a/ms/controllerblueprints/README.md b/ms/controllerblueprints/README.md
deleted file mode 100755
index 3ca48d1c..00000000
--- a/ms/controllerblueprints/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-Application VM Arguments :
-
--DappName=ControllerBluePrints
--Dms_name=org.onap.ccsdk.apps.controllerblueprints
--DappVersion=1.0.0
--Dlogging.config=etc/logback.xml
--Dspring.config.location=opt/app/onap/config/
--Dspring.datasource.url=jdbc:mysql://127.0.0.1:3306/sdnctl
--Dspring.datasource.username=sdnctl
--Dspring.datasource.password=sdnctl
--Dcontrollerblueprints.loadInitialData=true
--Dspring.profiles.active=dev
-
diff --git a/ms/controllerblueprints/README_FIRST.txt b/ms/controllerblueprints/README_FIRST.txt
deleted file mode 100644
index e69de29b..00000000
--- a/ms/controllerblueprints/README_FIRST.txt
+++ /dev/null
diff --git a/ms/controllerblueprints/application/pom.xml b/ms/controllerblueprints/application/pom.xml
deleted file mode 100644
index 4a733549..00000000
--- a/ms/controllerblueprints/application/pom.xml
+++ /dev/null
@@ -1,254 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
- </parent>
- <artifactId>application</artifactId>
- <name>Controller Blueprints Application</name>
- <properties>
- <swagger.directory>${basedir}/target/src/main/resources/swagger-ui</swagger.directory>
- <java.version>1.8</java.version>
- <name.space>org.onap.ccsdk.apps</name.space> <!-- <name.space>${namespace}</name.space> -->
- <serviceArtifactName>controllerblueprints</serviceArtifactName>
- <!-- Sonar -->
- <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
- <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
- <sonar.surefire.reportsPath>${basedir}/target/surefire-reports</sonar.surefire.reportsPath>
- <sonar.failsafe.reportsPath>${basedir}/target/failsafe-reports</sonar.failsafe.reportsPath>
- <jacoco.path>${basedir}/target/jacoco_report</jacoco.path>
- <jacoco.itPath>${basedir}/target/jacoco_itReport</jacoco.itPath>
- <sonar.jacoco.reportPath>${basedir}/target/jacoco-ut.exec</sonar.jacoco.reportPath>
- <sonar.jacoco.itReportPath>${basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
- <sonar.language>java</sonar.language>
- <ilib.version>2.0.7</ilib.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>service</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-security</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <!--config and resource files -->
- <directory>${basedir}/etc</directory>
- <targetPath>${basedir}/target/etc</targetPath>
- <filtering>true</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
- <!--config and resource files -->
- <directory>${basedir}/src/main/resources</directory>
- <targetPath>${basedir}/target/src/main/resources</targetPath>
- <filtering>true</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <id>copy-dockerfile</id>
- <goals>
- <goal>copy-resources</goal>
- </goals><!-- here the phase you need -->
- <phase>validate</phase>
- <configuration>
- <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/docker</directory>
- <includes>
- <include>*</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>0.7.5.201505241946</version>
- <executions>
- <!-- Prepares the property pointing to the JaCoCo runtime agent which
- is passed as VM argument when Maven the Surefire plugin is executed. -->
- <execution>
- <id>pre-unit-test</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- <configuration>
- <!-- Sets the path to the file which contains the execution data. -->
- <destFile>${sonar.jacoco.reportPath}</destFile>
- <propertyName>surefireArgLine</propertyName>
- </configuration>
- </execution>
- <!-- Ensures that the code coverage report for unit tests is created
- after unit tests have been run. -->
- <execution>
- <id>post-unit-test</id>
- <phase>test</phase>
- <goals>
- <goal>report</goal>
- </goals>
- <configuration>
- <!-- Sets the path to the file which contains the execution data. -->
- <dataFile>${sonar.jacoco.reportPath}</dataFile>
- <!-- Sets the output directory for the code coverage report. -->
- <outputDirectory>${jacoco.path}</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>ant-test</id>
- <phase>package</phase>
- <configuration>
- <tasks>
- <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <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>
- <plugin>
- <groupId>com.github.kongchen</groupId>
- <artifactId>swagger-maven-plugin</artifactId>
- <version>3.1.7</version>
- <configuration>
- <apiSources>
- <apiSource>
- <springmvc>true</springmvc>
- <locations>org.onap.ccsdk.apps.controllerblueprints.service.rs
- </locations>
- <schemes>
- <scheme>http</scheme>
- <scheme>https</scheme>
- </schemes>
- <basePath>/api/v1</basePath>
- <info>
- <title>Controller Blueprints</title>
- <version>${project.version}</version>
- <description>
- Controller blueprints API for VNF Self Service.
- </description>
- <termsOfService>
- Terms of service
- </termsOfService>
- <contact>
- <email>brindasanth@gmail.com</email>
- <name>Brinda Santh</name>
- <url>http://onap.com</url>
- </contact>
- <license>
- <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
- <name>Apache 2.0</name>
- </license>
- </info>
- <swaggerDirectory>${swagger.directory}</swaggerDirectory>
- </apiSource>
- </apiSources>
- </configuration>
- <executions>
- <execution>
- <phase>compile</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-
-</project>
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
deleted file mode 100644
index c4759b56..00000000
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-/**
- * ApplicationConstants.java Purpose: Provide ControllerBlueprintsApplication Constant Information
- *
- * @author Brinda Santh
- * @version 1.0
- */
-@SuppressWarnings("unused")
-public final class ApplicationConstants {
-
-}
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplication.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplication.java
deleted file mode 100644
index e925c69c..00000000
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplication.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.web.reactive.config.EnableWebFlux;
-
-/**
- * @author Brinda Santh
- */
-@SpringBootApplication
-@EnableWebFlux
-@ComponentScan(basePackages = {"org.onap.ccsdk.apps.controllerblueprints"})
-@EnableAutoConfiguration
-public class ControllerBlueprintsApplication {
- private static EELFLogger log = EELFManager.getInstance().getLogger(ControllerBlueprintsApplication.class);
-
- public static void main(String[] args) {
- log.info("****** Starting Controlled Blueprints Application ******");
- SpringApplication.run(ControllerBlueprintsApplication.class, args);
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java
deleted file mode 100644
index 5b154ff2..00000000
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-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/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java
deleted file mode 100644
index ca633283..00000000
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-import com.google.common.collect.Lists;
-import org.jetbrains.annotations.NotNull;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.RequestMethod;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.builders.ResponseMessageBuilder;
-import springfox.documentation.schema.ModelRef;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Contact;
-import springfox.documentation.service.Header;
-import springfox.documentation.service.ResponseMessage;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * SwaggerConfig
- *
- * @author Brinda Santh 8/13/2018
- */
-@Deprecated
-//@Configuration
-//@EnableSwagger2
-@SuppressWarnings("unused")
-public class SwaggerConfig {
- @Value("${appVersion}")
- private String appVersion;
- @Value("${swagger.contact.name}")
- private String contactName;
- @Value("${swagger.contact.url}")
- private String contactUrl;
- @Value("${swagger.contact.email}")
- private String contactEmail;
- private String stringModelRef = "string";
-
- @Bean
- @SuppressWarnings("unused")
- public Docket api() {
- return new Docket(DocumentationType.SWAGGER_2)
- .globalResponseMessage(RequestMethod.GET, getDefaultGetResponseMessages())
- .globalResponseMessage(RequestMethod.POST, getDefaultPostResponseMessages())
- .globalResponseMessage(RequestMethod.PUT, getDefaultPutResponseMessages())
- .globalResponseMessage(RequestMethod.DELETE, getDefaultDeleteResponseMessages())
- .select()
- .apis(RequestHandlerSelectors.any())
- .paths(PathSelectors.any())
- .build()
- .apiInfo(apiInfo());
- }
-
- private ApiInfo apiInfo() {
- return new ApiInfo(
- "Controller Blueprints API",
- "Controller blueprints API for VNF Self Service.",
- appVersion,
- "Terms of service",
- new Contact(contactName, contactUrl, contactEmail),
- "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", Collections.emptyList());
- }
-
- private List<ResponseMessage> getDefaultGetResponseMessages() {
- List<ResponseMessage> defaultResponseMessages = Lists.newArrayList();
- Map<String, Header> defaultHeaders = getDefaultResponseHeaders();
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.OK, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.BAD_REQUEST, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.UNAUTHORIZED, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.FORBIDDEN, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.NOT_FOUND, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.INTERNAL_SERVER_ERROR, defaultHeaders));
- return defaultResponseMessages;
- }
-
- private List<ResponseMessage> getDefaultPostResponseMessages() {
- List<ResponseMessage> defaultResponseMessages = Lists.newArrayList();
- Map<String, Header> defaultHeaders = getDefaultResponseHeaders();
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.OK, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.CREATED, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.BAD_REQUEST, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.UNAUTHORIZED, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.FORBIDDEN, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.INTERNAL_SERVER_ERROR, defaultHeaders));
- return defaultResponseMessages;
- }
-
- private List<ResponseMessage> getDefaultPutResponseMessages() {
- List<ResponseMessage> defaultResponseMessages = Lists.newArrayList();
- Map<String, Header> defaultHeaders = getDefaultResponseHeaders();
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.OK, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.BAD_REQUEST, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.UNAUTHORIZED, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.FORBIDDEN, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.INTERNAL_SERVER_ERROR, defaultHeaders));
- return defaultResponseMessages;
- }
-
- private List<ResponseMessage> getDefaultDeleteResponseMessages() {
- List<ResponseMessage> defaultResponseMessages = Lists.newArrayList();
- Map<String, Header> defaultHeaders = getDefaultResponseHeaders();
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.OK, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.BAD_REQUEST, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.UNAUTHORIZED, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.FORBIDDEN, defaultHeaders));
- defaultResponseMessages.add(getResponseBuilder(HttpStatus.INTERNAL_SERVER_ERROR, defaultHeaders));
- return defaultResponseMessages;
- }
-
- private ResponseMessage getResponseBuilder(@NotNull HttpStatus httpStatus, Map<String, Header> defaultHeaders) {
- ResponseMessageBuilder responseMessageBuilder = new ResponseMessageBuilder();
- responseMessageBuilder.code(httpStatus.value())
- .message(httpStatus.getReasonPhrase())
- .headersWithDescription(defaultHeaders)
- .build();
- return responseMessageBuilder.build();
- }
-
- private Map<String, Header> getDefaultResponseHeaders() {
- Map<String, Header> defaultHeaders = new HashMap<>();
- defaultHeaders.put(BluePrintConstants.RESPONSE_HEADER_TRANSACTION_ID,
- new Header(BluePrintConstants.RESPONSE_HEADER_TRANSACTION_ID, "Transaction Id", new ModelRef(stringModelRef)));
- defaultHeaders.put(BluePrintConstants.RESPONSE_HEADER_LATEST_VERSION,
- new Header(BluePrintConstants.RESPONSE_HEADER_LATEST_VERSION, "API Latest Version", new ModelRef(stringModelRef)));
- defaultHeaders.put(BluePrintConstants.RESPONSE_HEADER_MINOR_VERSION,
- new Header(BluePrintConstants.RESPONSE_HEADER_MINOR_VERSION, "API Minor Version", new ModelRef(stringModelRef)));
- defaultHeaders.put(BluePrintConstants.RESPONSE_HEADER_PATCH_VERSION,
- new Header(BluePrintConstants.RESPONSE_HEADER_PATCH_VERSION, "API Patch Version", new ModelRef(stringModelRef)));
- return defaultHeaders;
- }
-}
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebConfig.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebConfig.java
deleted file mode 100644
index 45faa1b5..00000000
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/WebConfig.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.reactive.config.CorsRegistry;
-import org.springframework.web.reactive.config.ResourceHandlerRegistry;
-import org.springframework.web.reactive.config.WebFluxConfigurationSupport;
-
-/**
- * WebConfig
- *
- * @author Brinda Santh 8/13/2018
- */
-@Configuration
-@SuppressWarnings("unused")
-public class WebConfig extends WebFluxConfigurationSupport {
- @Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler("swagger-ui.html")
- .addResourceLocations("classpath:/META-INF/resources/");
-
- registry.addResourceHandler("/webjars/**")
- .addResourceLocations("classpath:/META-INF/resources/webjars/");
-
- }
-
- @Override
- public void addCorsMappings(CorsRegistry corsRegistry) {
- corsRegistry.addMapping("/**")
- .allowedOrigins("*")
- .allowedMethods("*")
- .allowedHeaders("DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range")
- .maxAge(3600);
- }
-}
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/filters/ApplicationLoggingFilter.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/filters/ApplicationLoggingFilter.java
deleted file mode 100644
index 367ea7d9..00000000
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/filters/ApplicationLoggingFilter.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.filters;
-
-import com.google.common.base.Preconditions;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.server.reactive.ServerHttpRequest;
-import org.springframework.http.server.reactive.ServerHttpResponse;
-import org.springframework.web.server.ServerWebExchange;
-import org.springframework.web.server.WebFilter;
-import org.springframework.web.server.WebFilterChain;
-import reactor.core.publisher.Mono;
-
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.UUID;
-
-/**
- * ApplicationLoggingFilter
- *
- * @author Brinda Santh 8/14/2018
- */
-@Configuration
-@SuppressWarnings("unused")
-public class ApplicationLoggingFilter implements WebFilter {
- private static Logger log = LoggerFactory.getLogger(ApplicationLoggingFilter.class);
-
- @SuppressWarnings("unused")
- @Value("${appVersion}")
- private String appVersion;
-
- @Override
- public Mono<Void> filter(ServerWebExchange serverWebExchange, WebFilterChain webFilterChain) {
- try {
-
- ServerHttpRequest request = serverWebExchange.getRequest();
- ServerHttpResponse response = serverWebExchange.getResponse();
-
- String[] tokens = StringUtils.split(appVersion, '.');
- Preconditions.checkNotNull(tokens, "failed to split application versions");
- Preconditions.checkArgument(tokens.length == 3, "failed to tokenize application versions");
- HttpHeaders header = response.getHeaders();
-
- String requestID = defaultToUUID(request.getHeaders().getFirst("X-ONAP-RequestID"));
- String invocationID = defaultToUUID(request.getHeaders().getFirst("X-ONAP-InvocationID"));
- String partnerName = defaultToEmpty(request.getHeaders().getFirst("X-ONAP-PartnerName"));
- MDC.put("InvokeTimestamp", ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
- MDC.put("RequestID", requestID);
- MDC.put("InvocationID", invocationID);
- MDC.put("PartnerName", partnerName);
- MDC.put("ClientIPAddress", defaultToEmpty(request.getRemoteAddress().getAddress()));
- MDC.put("ServerFQDN", defaultToEmpty(request.getRemoteAddress().getHostString()));
-
- header.add(BluePrintConstants.RESPONSE_HEADER_TRANSACTION_ID, requestID);
- header.add(BluePrintConstants.RESPONSE_HEADER_MINOR_VERSION, tokens[1]);
- header.add(BluePrintConstants.RESPONSE_HEADER_PATCH_VERSION, tokens[2]);
- header.add(BluePrintConstants.RESPONSE_HEADER_LATEST_VERSION, appVersion);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return webFilterChain.filter(serverWebExchange);
-
- }
-
- private static String defaultToUUID(String in) {
- return in == null ? UUID.randomUUID().toString() : in;
- }
-
- private static String defaultToEmpty(Object in) {
- return in == null ? "" : in.toString();
- }
-
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java
deleted file mode 100644
index 334574f7..00000000
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.security;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
-import org.springframework.security.config.web.server.ServerHttpSecurity;
-import org.springframework.security.core.userdetails.MapReactiveUserDetailsService;
-import org.springframework.security.core.userdetails.User;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.web.server.SecurityWebFilterChain;
-
-@SuppressWarnings("unused")
-@EnableWebFluxSecurity
-public class ApplicationSecurityConfigurerAdapter {
-
- @Value("${basic-auth.user-name}")
- private String userName;
-
- @Value("${basic-auth.hashed-pwd}")
- private String userHashedPassword;
-
- private static EELFLogger log = EELFManager.getInstance().getLogger(ApplicationSecurityConfigurerAdapter.class);
-
- @Bean
- public SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) throws Exception {
-
- http.csrf().disable();
- http.authorizeExchange()
- .pathMatchers("/webjars/**", "/actuator/**").permitAll()
- .anyExchange().authenticated()
- .and().httpBasic();
-
- return http.build();
- }
-
- @Bean
- public MapReactiveUserDetailsService userDetailsService() {
- User.UserBuilder userBuilder = User.builder();
- UserDetails defaultUser = userBuilder
- .username(userName)
- .password(userHashedPassword).roles("USER").build();
- return new MapReactiveUserDetailsService(defaultUser);
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/resources/application-dev.properties b/ms/controllerblueprints/application/src/main/resources/application-dev.properties
deleted file mode 100755
index 3401ece0..00000000
--- a/ms/controllerblueprints/application/src/main/resources/application-dev.properties
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-appName=ControllerBluePrints
-ms_name=org.onap.ccsdk.apps.controllerblueprints
-appVersion=1.0.0
-
-# Basic Authentication
-basic-auth.user-name=ccsdkapps
-basic-auth.hashed-pwd={bcrypt}$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y
-
-#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
-
-logging.level.org.springframework.web=INFO
-logging.level.org.hibernate.SQL=warn
-logging.level.org.hibernate.type.descriptor.sql=debug
-
-#To Remove Null in JSON API Response
-spring.jackson.default-property-inclusion=non_null
-
-#Swagger Configuration
-swagger.contact.name=Brinda Santh Muthuramalingam
-swagger.contact.url=www.onap.com
-swagger.contact.email=brindasanth@onap.com
-
-spring.jpa.properties.hibernate.show_sql=true
-spring.jpa.properties.hibernate.use_sql_comments=true
-spring.jpa.properties.hibernate.format_sql=true
-
-# spring.datasource.url, spring.datasource.username,spring.datasource.password may be overridden by ENV variables
-spring.datasource.url=jdbc:mysql://localhost:3306/sdnctl
-spring.datasource.username=sdnctl
-spring.datasource.password=sdnctl
-spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
-spring.jpa.show-sql=true
-spring.jpa.hibernate.ddl-auto=none
-spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
-spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
-# Load Resource Source Mappings
-resourceSourceMappings=processor-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
-# Controller Blueprints Core Configuration
-controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
-controllerblueprints.blueprintArchivePath=/etc/blueprints/archive
-controllerblueprints.blueprintEnrichmentPath=/etc/blueprints/enrichment
-# Controller Blueprint Load Configurations
-controllerblueprints.loadInitialData=true
-controllerblueprints.loadBluePrint=false
-controllerblueprints.loadBluePrintPaths=./../../../components/model-catalog/blueprint-model/test-blueprint
-controllerblueprints.loadModelType=true
-controllerblueprints.loadModeTypePaths=./../../../components/model-catalog/definition-type/starter-type
-controllerblueprints.loadResourceDictionary=true
-controllerblueprints.loadResourceDictionaryPaths=./../../../components/model-catalog/resource-dictionary/starter-dictionary
-
-# CBA file extension
-controllerblueprints.loadCbaExtension=zip
-
-# Web server config
-server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/resources/application.properties b/ms/controllerblueprints/application/src/main/resources/application.properties
deleted file mode 100755
index 8789c24e..00000000
--- a/ms/controllerblueprints/application/src/main/resources/application.properties
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-# Modifications Copyright © 2018 IBM.
-# Modifications Copyright © 2019 Bell Canada.
-#
-# 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.
-#
-appName=ControllerBluePrints
-ms_name=org.onap.ccsdk.apps.controllerblueprints
-appVersion=1.0.0
-
-# Basic Authentication
-basic-auth.user-name=ccsdkapps
-basic-auth.hashed-pwd={bcrypt}$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y
-
-#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
-
-logging.level.org.springframework.web=INFO
-logging.level.org.hibernate.SQL=warn
-logging.level.org.hibernate.type.descriptor.sql=debug
-
-#To Remove Null in JSON API Response
-spring.jackson.default-property-inclusion=non_null
-
-#Swagger Configuration
-swagger.contact.name=CCSDK team
-swagger.contact.url=www.onap.org
-swagger.contact.email=onap-discuss@lists.onap.org
-
-spring.jpa.properties.hibernate.show_sql=true
-spring.jpa.properties.hibernate.use_sql_comments=true
-spring.jpa.properties.hibernate.format_sql=true
-
-# spring.datasource.url, spring.datasource.username,spring.datasource.password may be overridden by ENV variables
-spring.datasource.url=jdbc:mysql://db:3306/sdnctl
-spring.datasource.username=sdnctl
-spring.datasource.password=sdnctl
-spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
-spring.jpa.show-sql=true
-spring.jpa.hibernate.ddl-auto=none
-spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
-spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
-
-# Load Resource Source Mappings
-resourceSourceMappings=processor-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
-
-# Controller Blueprints Core Configuration
-controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
-controllerblueprints.blueprintArchivePath=/etc/blueprints/archive
-controllerblueprints.blueprintEnrichmentPath=/etc/blueprints/enrichment
-# Controller Blueprint Load Configurations
-# blueprints.load.initial-data may be overridden by ENV variables
-controllerblueprints.loadInitialData=true
-controllerblueprints.loadBluePrint=true
-controllerblueprints.loadBluePrintPaths=/opt/app/onap//model-catalog/blueprint-model/service-blueprint
-controllerblueprints.loadModelType=true
-controllerblueprints.loadModeTypePaths=/opt/app/onap//model-catalog/definition-type/starter-type
-controllerblueprints.loadResourceDictionary=true
-controllerblueprints.loadResourceDictionaryPaths=/opt/app/onap//model-catalog/resource-dictionary/starter-dictionary
-
-# CBA file extension
-controllerblueprints.loadCbaExtension=zip
-
-# Web server config
-server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/resources/logback.xml b/ms/controllerblueprints/application/src/main/resources/logback.xml
deleted file mode 100644
index 2db82a12..00000000
--- a/ms/controllerblueprints/application/src/main/resources/logback.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
-
- <property name="localPattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{100} - %msg%n" />
-
- <property name="defaultPattern" value="%date{ISO8601,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}| %msg%n" />
-
- <property name="debugLoggerPattern" value="%date{ISO8601,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}|[%caller{3}]| %msg%n" />
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="info"/>
- <logger name="org.springframework.web" level="info"/>
- <logger name="org.springframework.security.web.authentication" level="warn"/>
- <logger name="org.hibernate" level="error"/>
- <logger name="org.onap.ccsdk.apps" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/controllerblueprints/application/src/main/resources/sql/data.sql b/ms/controllerblueprints/application/src/main/resources/sql/data.sql
deleted file mode 100644
index e69de29b..00000000
--- a/ms/controllerblueprints/application/src/main/resources/sql/data.sql
+++ /dev/null
diff --git a/ms/controllerblueprints/application/src/main/resources/sql/schema-local.sql b/ms/controllerblueprints/application/src/main/resources/sql/schema-local.sql
deleted file mode 100644
index 47e0cce7..00000000
--- a/ms/controllerblueprints/application/src/main/resources/sql/schema-local.sql
+++ /dev/null
@@ -1,83 +0,0 @@
--- 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,
- data_type VARCHAR(100) NOT NULL,
- entry_schema VARCHAR(100) 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/application/src/main/resources/sql/schema.sql b/ms/controllerblueprints/application/src/main/resources/sql/schema.sql
deleted file mode 100644
index 9c38bec0..00000000
--- a/ms/controllerblueprints/application/src/main/resources/sql/schema.sql
+++ /dev/null
@@ -1,78 +0,0 @@
--- -----------------------------------------------------
--- 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,
- data_type VARCHAR(100) NOT NULL,
- entry_schema VARCHAR(100) 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/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java
deleted file mode 100644
index cf9b3e71..00000000
--- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-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.boot.test.web.client.TestRestTemplate;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.client.support.BasicAuthorizationInterceptor;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class ControllerBlueprintsApplicationTest {
- @Autowired
- private TestRestTemplate restTemplate;
-
- @Before
- public void setUp(){
- BasicAuthorizationInterceptor bai = new BasicAuthorizationInterceptor("ccsdkapps", "ccsdkapps");
- this.restTemplate.getRestTemplate().getInterceptors().add(bai);
- }
-
- @Test
- public void testConfigModel() {
- HttpHeaders headers = new HttpHeaders();
- headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
-// ResponseEntity<BlueprintModel> entity = this.restTemplate
-// .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),BlueprintModel.class);
-// assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
-// Assert.assertNotNull("failed to get response Config model",entity.getBody());
- }
-
- @Test
- public void testConfigModelFailure() {
- HttpHeaders headers = new HttpHeaders();
- headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
-// ResponseEntity<BlueprintModel> entity = this.restTemplate
-// .exchange("/api/v1/config-model-not-found/1", HttpMethod.GET, new HttpEntity<>(headers),BlueprintModel.class);
-// assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
-// Assert.assertNotNull("failed to get response Config model",entity.getBody());
- }
-}
diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java
deleted file mode 100644
index 995644fd..00000000
--- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Assert;
-import org.junit.Test;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-
-/**
- * VersionSplitTest
- *
- * @author Brinda Santh
- */
-public class VersionSplitTest {
- private static EELFLogger log = EELFManager.getInstance().getLogger(VersionSplitTest.class);
-
- @Test
- public void testVersionSplit() {
- String version = "1.03.04";
- String[] tokens = StringUtils.split(version, '.');
- Assert.assertNotNull("failed to tokenize", tokens);
- Assert.assertEquals("failed to three token ", 3, tokens.length);
- }
-
- @Test
- public void encodeTest() {
- String name = "ccsdkapps";
- BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
- String encodedValue = bCryptPasswordEncoder.encode(name);
- Assert.assertTrue("Failed to match", bCryptPasswordEncoder.matches(name, encodedValue));
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/test/resources/application.properties b/ms/controllerblueprints/application/src/test/resources/application.properties
deleted file mode 100755
index 8ad9f2c0..00000000
--- a/ms/controllerblueprints/application/src/test/resources/application.properties
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-# Modifications Copyright © 2018 IBM.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-spring.main.banner-mode=off
-
-appName=ControllerBluePrints
-ms_name=org.onap.ccsdk.apps.controllerblueprints
-appVersion=1.0.0
-
-# Basic Authentication
-basic-auth.user-name=ccsdkapps
-basic-auth.hashed-pwd={bcrypt}$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y
-
-#To Remove Null in JSON API Response
-spring.jackson.default-property-inclusion=non_null
-
-#Swagger Configuration
-swagger.contact.name=Brinda Santh Muthuramalingam
-swagger.contact.url=www.onap.com
-swagger.contact.email=brindasanth@onap.com
-
-# Load Resource Source Mappings
-resourceSourceMappings=processor-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
-
-# Controller Blueprints Core Configuration
-controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
-controllerblueprints.blueprintArchivePath=./target/blueprints/archive
-controllerblueprints.blueprintEnrichmentPath=./target/blueprints/enrichment
-# Controller Blueprint Load Configurations
-controllerblueprints.loadInitialData=false
-controllerblueprints.loadBluePrint=false
-controllerblueprints.loadBluePrintPaths=./../../../../components/model-catalog/blueprint-model/test-blueprint
-controllerblueprints.loadModelType=false
-controllerblueprints.loadModeTypePaths=./../../../../components/model-catalog/definition-type/starter-type
-controllerblueprints.loadResourceDictionary=false
-controllerblueprints.loadResourceDictionaryPaths=./../../../../components/model-catalog/resource-dictionary/starter-dictionary
-
-# CBA file extension
-controllerblueprints.loadCbaExtension=zip
-
-# CBA examples for tests cases
-controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint
-
-# Web server config
-server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/test/resources/logback.xml b/ms/controllerblueprints/application/src/test/resources/logback.xml
deleted file mode 100644
index 53388bc9..00000000
--- a/ms/controllerblueprints/application/src/test/resources/logback.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.controllerblueprints" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/controllerblueprints/distribution/pom.xml b/ms/controllerblueprints/distribution/pom.xml
deleted file mode 100755
index 4a1b6049..00000000
--- a/ms/controllerblueprints/distribution/pom.xml
+++ /dev/null
@@ -1,184 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2019 Bell Canada.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
- </parent>
- <artifactId>distribution</artifactId>
- <packaging>pom</packaging>
- <name>Controller Blueprints Distribution</name>
- <properties>
- <assembly.id>maven</assembly.id>
- <name.space>org.onap.ccsdk.apps</name.space> <!-- <name.space>${namespace}</name.space> -->
- <serviceArtifactName>controllerblueprints</serviceArtifactName>
- <image.name>onap/ccsdk-controllerblueprints</image.name>
- <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
- <docker.push.phase>deploy</docker.push.phase>
- <docker.verbose>true</docker.verbose>
- <ccsdk.project.version>${project.version}</ccsdk.project.version>
- <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>application</artifactId>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <id>copy-dockerfile</id>
- <goals>
- <goal>copy-resources</goal>
- </goals><!-- here the phase you need -->
- <phase>validate</phase>
- <configuration>
- <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/docker</directory>
- <includes>
- <include>*</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>ant-test</id>
- <phase>package</phase>
- <configuration>
- <tasks>
- <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!--build the final artifact for docker deployment -->
- <artifactId>maven-assembly-plugin</artifactId>
- <version>3.1.0</version>
- <configuration>
- <!-- <skipAssembly>${skip.assembly}</skipAssembly>-->
- <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
- <descriptors>
- <descriptor>src/main/docker/distribution.xml</descriptor>
- </descriptors>
- <tarLongFileMode>posix</tarLongFileMode>
- </configuration>
- <executions>
- <execution>
- <id>${assembly.id}</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.groovy.maven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <source>${basedir}/../../../TagVersion.groovy</source>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.26.1</version>
- <inherited>false</inherited>
- <configuration>
- <images>
- <image>
- <name>${image.name}</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
- <tags>
- <tag>${project.docker.latestminortag.version}</tag>
- <tag>${project.docker.latestfulltag.version}</tag>
- <tag>${project.docker.latesttagtimestamp.version}</tag>
- </tags>
- </build>
- </image>
- </images>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <id>generate-images</id>
- <phase>package</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- <execution>
- <id>push-images</id>
- <phase>${docker.push.phase}</phase>
- <goals>
- <goal>build</goal>
- <goal>push</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- </profiles>
-</project>
diff --git a/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml b/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml
deleted file mode 100755
index 450a3541..00000000
--- a/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-version: '3.3'
-
-services:
- db:
- image: mariadb:latest
- container_name: ccsdk-mariadb
- ports:
- - "3306:3306"
- volumes:
- - ~/vm_mysql:/var/lib/mysql
- restart: always
- environment:
- MYSQL_ROOT_PASSWORD: sdnctl
- MYSQL_DATABASE: sdnctl
- MYSQL_USER: sdnctl
- MYSQL_PASSWORD: sdnctl
- controller-blueprints:
- depends_on:
- - db
- image: onap/ccsdk-controllerblueprints:latest
- container_name: cb-rest
- ports:
- - "8080:8080"
- restart: always
- environment:
- APPLICATIONNAME: ControllerBluePrints
- BUNDLEVERSION: 1.0.0
- APP_CONFIG_HOME: /opt/app/onap/config
- STICKYSELECTORKEY:
- ENVCONTEXT: dev \ No newline at end of file
diff --git a/ms/controllerblueprints/distribution/src/main/docker/Dockerfile b/ms/controllerblueprints/distribution/src/main/docker/Dockerfile
deleted file mode 100755
index d3e10b76..00000000
--- a/ms/controllerblueprints/distribution/src/main/docker/Dockerfile
+++ /dev/null
@@ -1,18 +0,0 @@
-FROM anapsix/alpine-java:8_jdk
-
-ENV HTTP_PROXY ${HTTP_PROXY}
-ENV HTTPS_PROXY ${HTTPS_PROXY}
-
-# add entrypoint
-COPY run.source /etc/run.source
-COPY startService.sh /startService.sh
-RUN chmod 777 /startService.sh && dos2unix /startService.sh
-
-# add application
-COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz
-RUN tar -xzf /source.tar.gz -C /tmp \
- && cp -rf /tmp/@project.build.finalName@/opt / \
- && rm -rf /source.tar.gz \
- && rm -rf /tmp/@project.build.finalName@
-
-ENTRYPOINT /startService.sh \ No newline at end of file
diff --git a/ms/controllerblueprints/distribution/src/main/docker/distribution.xml b/ms/controllerblueprints/distribution/src/main/docker/distribution.xml
deleted file mode 100755
index 74dc4400..00000000
--- a/ms/controllerblueprints/distribution/src/main/docker/distribution.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2019 Bell Canada.
- ~
- ~ 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.
- -->
-
-<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
- <!-- create a tar.gz file containing the projects dependencies -->
- <id>${assembly.id}</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/opt/app/onap/lib</outputDirectory>
- </dependencySet>
- </dependencySets>
- <fileSets>
- <fileSet>
- <directory>${project.basedir}/../application/src/main/resources</directory>
- <includes>
- <include>application.properties</include>
- <include>logback.xml</include>
- </includes>
- <outputDirectory>/opt/app/onap/config</outputDirectory>
- <useDefaultExcludes>true</useDefaultExcludes>
- </fileSet>
- <fileSet>
- <directory>${project.basedir}/../../../components/model-catalog</directory>
- <outputDirectory>/opt/app/onap/model-catalog</outputDirectory>
- <useDefaultExcludes>true</useDefaultExcludes>
- <excludes>
- <exclude>${project.basedir}/../../../components/model-catalog/proto-definition</exclude>
- </excludes>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/ms/controllerblueprints/distribution/src/main/docker/run.source b/ms/controllerblueprints/distribution/src/main/docker/run.source
deleted file mode 100755
index 1d0ac070..00000000
--- a/ms/controllerblueprints/distribution/src/main/docker/run.source
+++ /dev/null
@@ -1,13 +0,0 @@
-java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sources:${APP_CONFIG_HOME}:${APP_HOME}" \
--DappName=${APPLICATIONNAME} -DappVersion=${BUNDLEVERSION} \
--DrouteOffer=${ROUTEOFFER} \
--DVERSION_ROUTEOFFER_ENVCONTEXT=${BUNDLEVERSION}/${STICKYSELECTORKEY}/${ENVCONTEXT} \
--DSecurityFilePath=/etc \
--DREST_NAME_NORMALIZER_PATTERN_FILE=/etc/PatternInputs.txt \
--Dms_name=org.onap.ccsdk.apps.controllerblueprints \
--Dlogging.config=${APP_CONFIG_HOME}/logback.xml \
--Djava.security.egd=file:/dev/./urandom \
--DAPPNAME=${APP_NAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \
--Dspring.config.location=${APP_CONFIG_HOME}/ \
--Dblueprints.load.initial-data=${INIT_DATA_LOAD} \
-org.onap.ccsdk.apps.controllerblueprints.ControllerBlueprintsApplication
diff --git a/ms/controllerblueprints/distribution/src/main/docker/startService.sh b/ms/controllerblueprints/distribution/src/main/docker/startService.sh
deleted file mode 100755
index 7077c224..00000000
--- a/ms/controllerblueprints/distribution/src/main/docker/startService.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-nodeName=ControllerBlueprints_1.0.0_$(cat /proc/self/cgroup | grep docker | sed s/\\//\\n/g | tail -1)
-
-echo "APP Config HOME : ${APP_CONFIG_HOME}"
-export APP_HOME=/opt/app/onap
-
-source /etc/run.source
diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-bpmn-camunda.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-bpmn-camunda.json
deleted file mode 100644
index cae06c18..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-bpmn-camunda.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "description": " Camunda BPM File",
- "version": "1.0.0",
- "file_ext": [
- "bpmn"
- ],
- "derived_from": "tosca.artifacts.Implementation"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-directed-graph.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-directed-graph.json
deleted file mode 100644
index 10bf7d2c..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-directed-graph.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "description": "Directed Graph File",
- "version": "1.0.0",
- "file_ext": [
- "json",
- "xml"
- ],
- "derived_from": "tosca.artifacts.Implementation"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-mapping-resource.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-mapping-resource.json
deleted file mode 100644
index 9123efd1..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-mapping-resource.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "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/blueprint-core/load/model_type/artifact_type/artifact-script-python.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-script-python.json
deleted file mode 100644
index 22af3b0a..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-script-python.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "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/blueprint-core/load/model_type/artifact_type/artifact-template-velocity.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-template-velocity.json
deleted file mode 100644
index 20f94c94..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-template-velocity.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "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/blueprint-core/load/model_type/artifact_type/tosca.artifacts.Implementation.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/tosca.artifacts.Implementation.json
deleted file mode 100644
index d75f3376..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/tosca.artifacts.Implementation.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "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/blueprint-core/load/model_type/data_type/datatype-property.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-property.json
deleted file mode 100644
index d3ecffd1..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-property.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "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/blueprint-core/load/model_type/data_type/datatype-resource-assignment.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-resource-assignment.json
deleted file mode 100644
index 8fa595a1..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-resource-assignment.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "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/blueprint-core/load/model_type/data_type/dt-license-key.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-license-key.json
deleted file mode 100644
index 27e25fe1..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-license-key.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "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/blueprint-core/load/model_type/data_type/dt-v4-aggregate.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-v4-aggregate.json
deleted file mode 100644
index 4f7be2db..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-v4-aggregate.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "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/blueprint-core/load/model_type/data_type/tosca.datatypes.Credential.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/tosca.datatypes.Credential.json
deleted file mode 100644
index 68d91652..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/tosca.datatypes.Credential.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "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/blueprint-core/load/model_type/node_type/artifact-config-template.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/artifact-config-template.json
deleted file mode 100644
index 057038fd..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/artifact-config-template.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "description": "This is Configuration Velocity Template",
- "version": "1.0.0",
- "properties": {
- "action-names": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "capabilities": {
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "content": {
- "required": true,
- "type": "string"
- }
- }
- },
- "mapping": {
- "type": "tosca.capabilities.Mapping",
- "properties": {
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Artifact"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-config-generator.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-config-generator.json
deleted file mode 100644
index 05bf7fe2..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-config-generator.json
+++ /dev/null
@@ -1,72 +0,0 @@
-{
- "description": "This is Generate Configuration Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-onap-ccsdk-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/blueprint-core/load/model_type/node_type/component-netconf-executor.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-netconf-executor.json
deleted file mode 100644
index 22f5c9b3..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-netconf-executor.json
+++ /dev/null
@@ -1,79 +0,0 @@
-{
- "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-onap-ccsdk-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/blueprint-core/load/model_type/node_type/component-resource-assignment.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-resource-assignment.json
deleted file mode 100644
index e009f858..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-resource-assignment.json
+++ /dev/null
@@ -1,68 +0,0 @@
-{
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "ResourceAssignmentComponent": {
- "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/blueprint-core/load/model_type/node_type/dg-activate-netconf.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-activate-netconf.json
deleted file mode 100644
index 57667de9..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-activate-netconf.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "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"
- }
- },
- "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/blueprint-core/load/model_type/node_type/dg-config-generator.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-config-generator.json
deleted file mode 100644
index 679c4641..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-config-generator.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "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"
- }
- },
- "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/blueprint-core/load/model_type/node_type/dg-resource-assign-activate.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assign-activate.json
deleted file mode 100644
index 87b052b6..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assign-activate.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "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"
- }
- },
- "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/blueprint-core/load/model_type/node_type/dg-resource-assignment.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assignment.json
deleted file mode 100644
index 9de599b0..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assignment.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "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"
- }
- },
- "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/blueprint-core/load/model_type/node_type/tosca.nodes.Artifact.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Artifact.json
deleted file mode 100644
index 4db3f73c..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Artifact.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "description": "This is Deprecated Artifact Node Type.",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Component.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Component.json
deleted file mode 100644
index d559216a..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Component.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "description": "This is default Component Node",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.DG.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.DG.json
deleted file mode 100644
index eb8cac0a..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.DG.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "description": "This is Directed Graph Node Type",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Vnf.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Vnf.json
deleted file mode 100644
index c2f5b868..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Vnf.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "description": "This is VNF Node Type",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.component.Python.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.component.Python.json
deleted file mode 100644
index 908e5682..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.component.Python.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "description": "This is Python Component",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/vnf-netconf-device.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/vnf-netconf-device.json
deleted file mode 100644
index b226a0cf..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/vnf-netconf-device.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "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/blueprint-core/pom.xml b/ms/controllerblueprints/modules/blueprint-core/pom.xml
deleted file mode 100644
index ee321b71..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/pom.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <artifactId>blueprint-core</artifactId>
- <name>Controller Blueprints Core</name>
-
- <dependencies>
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-xml</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-yaml</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-jsonSchema</artifactId>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- </dependency>
- <!--Testing dependencies-->
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
deleted file mode 100644
index 4b578912..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core
-
-/**
- * BluePrintConstants
- *
- * @author Brinda Santh
- */
-object BluePrintConstants {
-
- const val RESPONSE_HEADER_TRANSACTION_ID: String = "X-ONAP-RequestID"
- const val RESPONSE_HEADER_MINOR_VERSION: String = "X-MinorVersion"
- const val RESPONSE_HEADER_PATCH_VERSION: String = "X-PatchVersion"
- const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion"
-
- const val STATUS_SUCCESS: String = "success"
- const val STATUS_PROCESSING: String = "processing"
- const val STATUS_FAILURE: String = "failure"
-
- const val FLAG_Y: String = "Y"
- const val FLAG_N: String = "N"
-
- 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_DOUBLE: String = "double"
- const val DATA_TYPE_BOOLEAN: String = "boolean"
- const val DATA_TYPE_TIMESTAMP: String = "timestamp"
- const val DATA_TYPE_NULL: String = "null"
- const val DATA_TYPE_LIST: String = "list"
- const val DATA_TYPE_MAP: String = "map"
- const val DATA_TYPE_JSON: String = "json"
-
- const val SCRIPT_KOTLIN = "kotlin"
- const val SCRIPT_JYTHON = "jython"
- const val SCRIPT_INTERNAL = "internal"
-
- const val USER_SYSTEM: String = "System"
-
- const val PATH_DIVIDER: String = "/"
- const val PATH_SERVICE_TEMPLATE: String = "service_template"
- const val PATH_TOPOLOGY_TEMPLATE: String = "topology_template"
- const val PATH_METADATA: String = "metadata"
- const val PATH_NODE_TYPES: String = "node_types"
- const val PATH_POLICY_TYPES: String = "policy_types"
- const val PATH_RELATIONSHIP_TYPES: String = "relationship_types"
- const val PATH_ARTIFACT_TYPES: String = "artifact_types"
- const val PATH_DATA_TYPES: String = "data_types"
- const val PATH_INPUTS: String = "inputs"
- const val PATH_NODE_WORKFLOWS: String = "workflows"
- const val PATH_NODE_TEMPLATES: String = "node_templates"
- const val PATH_CAPABILITIES: String = "capabilities"
- const val PATH_REQUIREMENTS: String = "requirements"
- const val PATH_INTERFACES: String = "interfaces"
- const val PATH_OPERATIONS: String = "operations"
- const val PATH_OUTPUTS: String = "outputs"
- const val PATH_PROPERTIES: String = "properties"
- const val PATH_ATTRIBUTES: String = "attributes"
- const val PATH_ARTIFACTS: String = "artifacts"
-
- const val MODEL_DIR_MODEL_TYPE: String = "definition-type"
-
- const val MODEL_DEFINITION_TYPE_NODE_TYPE: String = "node_type"
- const val MODEL_DEFINITION_TYPE_ARTIFACT_TYPE: String = "artifact_type"
- const val MODEL_DEFINITION_TYPE_CAPABILITY_TYPE: String = "capability_type"
- const val MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE: String = "relationship_type"
- const val MODEL_DEFINITION_TYPE_DATA_TYPE: String = "data_type"
-
- const val MODEL_TYPE_DATATYPES_ROOT: String = "tosca.datatypes.Root"
- const val MODEL_TYPE_NODES_ROOT: String = "tosca.nodes.Root"
- const val MODEL_TYPE_GROUPS_ROOT: String = "tosca.groups.Root"
- const val MODEL_TYPE_RELATIONSHIPS_ROOT: String = "tosca.relationships.Root"
- const val MODEL_TYPE_ARTIFACTS_ROOT: String = "tosca.artifacts.Root"
- const val MODEL_TYPE_CAPABILITIES_ROOT: String = "tosca.capabilities.Root"
- const val MODEL_TYPE_INTERFACES_ROOT: String = "tosca.interfaces.Root"
-
- const val MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON = "tosca.relationships.DependsOn"
- const val MODEL_TYPE_RELATIONSHIPS_HOSTED_ON = "tosca.relationships.HostedOn"
- const val MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO = "tosca.relationships.ConnectsTo"
- const val MODEL_TYPE_RELATIONSHIPS_ATTACH_TO = "tosca.relationships.AttachesTo"
- const val MODEL_TYPE_RELATIONSHIPS_ROUTES_TO = "tosca.relationships.RoutesTo"
-
- const val MODEL_TYPE_NODE_DG = "tosca.nodes.DG"
- const val MODEL_TYPE_NODE_COMPONENT = "tosca.nodes.Component"
- const val MODEL_TYPE_NODE_VNF = "tosca.nodes.Vnf"
- const val MODEL_TYPE_NODE_RESOURCE_SOURCE = "tosca.nodes.ResourceSource"
-
- const val MODEL_TYPE_NODES_COMPONENT_JAVA: String = "tosca.nodes.component.Java"
- const val MODEL_TYPE_NODES_COMPONENT_BUNDLE: String = "tosca.nodes.component.Bundle"
- const val MODEL_TYPE_NODES_COMPONENT_SCRIPT: String = "tosca.nodes.component.Script"
- const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python"
- const val MODEL_TYPE_NODES_COMPONENT_JYTHON: String = "tosca.nodes.component.Jython"
- const val MODEL_TYPE_NODES_COMPONENT_KOTLIN: String = "tosca.nodes.component.Kotlin"
- const val MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript"
-
- const val MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION = "tosca.artifacts.Implementation"
-
- const val MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic"
-
- const val MODEL_TYPE_CAPABILITY_TYPE_NODE = "tosca.capabilities.Node"
- const val MODEL_TYPE_CAPABILITY_TYPE_COMPUTE = "tosca.capabilities.Compute"
- const val MODEL_TYPE_CAPABILITY_TYPE_NETWORK = "tosca.capabilities.Network"
- const val MODEL_TYPE_CAPABILITY_TYPE_STORAGE = "tosca.capabilities.Storage"
- const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT = "tosca.capabilities.Endpoint"
- const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC = "tosca.capabilities.Endpoint.Public"
- const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN = "tosca.capabilities.Endpoint.Admin"
- const val MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE = "tosca.capabilities.Endpoint.Database"
- const val MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT = "tosca.capabilities.Attachment"
- const val MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM = "tosca.capabilities.OperatingSystem"
- const val MODEL_TYPE_CAPABILITY_TYPE_BINDABLE = "tosca.capabilities.network.Bindable"
- // Custom capabilities
- const val MODEL_TYPE_CAPABILITY_TYPE_CONTENT = "tosca.capabilities.Content"
- const val MODEL_TYPE_CAPABILITY_TYPE_MAPPING = "tosca.capabilities.Mapping"
- const val MODEL_TYPE_CAPABILITY_TYPE_NETCONF = "tosca.capabilities.Netconf"
- const val MODEL_TYPE_CAPABILITY_TYPE_SSH = "tosca.capabilities.Ssh"
- const val MODEL_TYPE_CAPABILITY_TYPE_SFTP = "tosca.capabilities.Sftp"
-
- const val EXPRESSION_DSL_REFERENCE: String = "*"
- 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_VALID: String = "blueprint-valid"
- const val PROPERTY_BLUEPRINT_BASE_PATH: String = "blueprint-basePath"
- const val PROPERTY_BLUEPRINT_RUNTIME: String = "blueprint-runtime"
- const val PROPERTY_BLUEPRINT_INPUTS_DATA: String = "blueprint-inputs-data"
- const val PROPERTY_BLUEPRINT_CONTEXT: String = "blueprint-context"
- const val PROPERTY_BLUEPRINT_NAME: String = "template_name"
- const val PROPERTY_BLUEPRINT_VERSION: String = "template_version"
-
- const val TOSCA_METADATA_DIR: String = "TOSCA-Metadata"
- const val TOSCA_METADATA_ENTRY_DEFINITION_FILE: String = "TOSCA-Metadata/TOSCA.meta"
- const val TOSCA_DEFINITIONS_DIR: String = "Definitions"
- const val TOSCA_PLANS_DIR: String = "Plans"
- const val TOSCA_SCRIPTS_DIR: String = "Scripts"
- const val TOSCA_MAPPINGS_DIR: String = "Mappings"
- const val TOSCA_TEMPLATES_DIR: String = "Templates"
- const val TOSCA_ENVIRONMENTS_DIR: String = "Environments"
- const val TOSCA_SCRIPTS_KOTLIN_DIR: String = "$TOSCA_SCRIPTS_DIR/kotlin"
- const val TOSCA_SCRIPTS_JYTHON_DIR: String = "$TOSCA_SCRIPTS_DIR/python"
-
- const val PROPERTY_ENV = "ENV"
- const val PROPERTY_APP = "APP"
- const val PROPERTY_BPP = "BPP"
- const val PROPERTY_SELF = "SELF"
-
- const val METADATA_TEMPLATE_NAME = "template_name"
- const val METADATA_TEMPLATE_VERSION = "template_version"
- const val METADATA_TEMPLATE_AUTHOR = "template_author"
- const val METADATA_TEMPLATE_TAGS = "template_tags"
- const val METADATA_WORKFLOW_NAME = "workflow_name"
-
- const val PAYLOAD_DATA = "payload-data"
- const val PROPERTY_CURRENT_STEP = "current-step"
- const val PROPERTY_CURRENT_NODE_TEMPLATE = "current-node-template"
- const val PROPERTY_CURRENT_INTERFACE = "current-interface"
- const val PROPERTY_CURRENT_OPERATION = "current-operation"
- const val PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation"
- const val PROPERTY_EXECUTION_REQUEST = "execution-request"
-
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintError.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintError.kt
deleted file mode 100644
index ea5bda42..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintError.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core
-
-class BluePrintError {
- var errors: MutableList<String> = arrayListOf()
-
- fun addError(type: String, name: String, error: String) {
- this.errors.add("$type : $name : $error")
- }
-
- fun addError(error: String) {
- this.errors.add(error)
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintException.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintException.kt
deleted file mode 100644
index 5acdf8e4..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintException.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core
-/**
- *
- *
- * @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/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintProcessorException.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintProcessorException.kt
deleted file mode 100644
index 6ebabb7a..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintProcessorException.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core
-
-/**
- *
- *
- * @author Brinda Santh
- */
-class BluePrintProcessorException : RuntimeException {
- 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/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt
deleted file mode 100644
index cf400fa7..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core
-
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
-
-/**
- *
- *
- * @author Brinda Santh
- */
-object BluePrintTypes {
-
- @JvmStatic
- val validNodeTypeDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- BluePrintConstants.MODEL_TYPE_NODE_DG,
- BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
- BluePrintConstants.MODEL_TYPE_NODE_VNF,
- BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_BUNDLE,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_SCRIPT,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_PYTHON,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JYTHON,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT
- )
-
- @JvmStatic
- val validArtifactTypeDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_ARTIFACTS_ROOT,
- BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION
- )
-
- @JvmStatic
- val validDataTypeDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT,
- BluePrintConstants.MODEL_TYPE_DATA_TYPE_DYNAMIC
- )
-
- @JvmStatic
- val validRelationShipDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ATTACH_TO,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROUTES_TO
- )
-
- @JvmStatic
- val validCapabilityTypes: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_CAPABILITIES_ROOT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NODE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_COMPUTE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETWORK,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_STORAGE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_BINDABLE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_CONTENT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_MAPPING,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETCONF,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SSH,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SFTP
- )
-
- @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.addAll(validPrimitiveTypes())
- validTypes.addAll(validComplexTypes())
- validTypes.addAll(validCollectionTypes())
- 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_DOUBLE)
- validTypes.add(BluePrintConstants.DATA_TYPE_BOOLEAN)
- validTypes.add(BluePrintConstants.DATA_TYPE_TIMESTAMP)
- validTypes.add(BluePrintConstants.DATA_TYPE_NULL)
- return validTypes
- }
-
- @JvmStatic
- fun validComplexTypes(): List<String> {
- val validTypes: MutableList<String> = arrayListOf()
- validTypes.add(BluePrintConstants.DATA_TYPE_JSON)
- 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 validPrimitiveOrCollectionPrimitive(propertyDefinition: PropertyDefinition): Boolean {
- val entrySchema = propertyDefinition.entrySchema?.type ?: BluePrintConstants.DATA_TYPE_NULL
- return BluePrintTypes.validPropertyTypes().contains(propertyDefinition.type)
- && BluePrintTypes.validPrimitiveTypes().contains(entrySchema)
- }
-
- @JvmStatic
- fun validCommands(): List<String> {
- return listOf(BluePrintConstants.EXPRESSION_DSL_REFERENCE,
- 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/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
deleted file mode 100644
index 68858dc5..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.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 CAPABILITY_PROPERTY_MAPPING = "mapping"
-}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt
deleted file mode 100644
index 121dfa26..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core
-
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.*
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.slf4j.helpers.MessageFormatter
-import kotlin.reflect.KClass
-
-/**
- *
- *
- * @author Brinda Santh
- */
-
-fun String.asJsonPrimitive(): TextNode {
- return TextNode(this)
-}
-
-fun Boolean.asJsonPrimitive(): BooleanNode {
- return BooleanNode.valueOf(this)
-}
-
-fun Int.asJsonPrimitive(): IntNode {
- return IntNode.valueOf(this)
-}
-
-fun Double.asJsonPrimitive(): DoubleNode {
- return DoubleNode.valueOf(this)
-}
-
-fun MutableMap<String, *>.asJsonNode(): JsonNode {
- return JacksonUtils.jsonNodeFromObject(this)
-}
-
-fun MutableMap<String, *>.asObjectNode(): ObjectNode {
- return JacksonUtils.objectNodeFromObject(this)
-}
-
-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, *>.castOptionalValue(key: String, valueType: KClass<T>): T? {
- if (containsKey(key)) {
- return get(key) as? T
- } else {
- return null
- }
-}
-
-fun <T : Any> MutableMap<String, *>.castValue(key: String, valueType: KClass<T>): T {
- if (containsKey(key)) {
- return get(key) as T
- } else {
- throw BluePrintException("couldn't find the key $key")
- }
-}
-
-/**
- * Convert Json to map of json node, the root fields will be map keys
- */
-fun JsonNode.rootFieldsToMap(): MutableMap<String, JsonNode> {
- if (this is ObjectNode) {
- val propertyMap: MutableMap<String, JsonNode> = hashMapOf()
- this.fields().forEach {
- propertyMap[it.key] = it.value
- }
- return propertyMap
- } else {
- throw BluePrintException("json node should be Object Node Type")
- }
-}
-
-
-fun MutableMap<String, JsonNode>.putJsonElement(key: String, value: Any) {
- when (value) {
- is JsonNode ->
- this[key] = value
- is String ->
- this[key] = TextNode(value)
- is Boolean ->
- this[key] = BooleanNode.valueOf(value)
- is Int ->
- this[key] = IntNode.valueOf(value.toInt())
- is Double ->
- this[key] = DoubleNode.valueOf(value.toDouble())
- else ->
- this[key] = JacksonUtils.jsonNodeFromObject(value)
- }
-}
-
-fun MutableMap<String, JsonNode>.getAsString(key: String): String {
- return this[key]?.asText() ?: throw BluePrintException("couldn't find value for key($key)")
-}
-
-fun MutableMap<String, JsonNode>.getAsBoolean(key: String): Boolean {
- return this[key]?.asBoolean() ?: throw BluePrintException("couldn't find value for key($key)")
-}
-
-fun MutableMap<String, JsonNode>.getAsInt(key: String): Int {
- return this[key]?.asInt() ?: throw BluePrintException("couldn't find value for key($key)")
-}
-
-fun MutableMap<String, JsonNode>.getAsDouble(key: String): Double {
- return this[key]?.asDouble() ?: throw BluePrintException("couldn't find value for key($key)")
-}
-
-// Checks
-
-fun checkNotEmpty(value: String?): Boolean {
- return value != null && value.isNotBlank()
-}
-
-fun checkNotEmptyOrThrow(value: String?, message: String? = value.plus(" is null/empty ")): Boolean {
- val notEmpty = checkNotEmpty(value)
- if (!notEmpty) {
- throw BluePrintException(message!!)
- }
- return notEmpty
-}
-
-fun checkEqualsOrThrow(value1: String?, value2: String?, lazyMessage: () -> Any): Boolean {
- if (value1.equals(value2, ignoreCase = true)) {
- return true
- } else {
- throw BluePrintException(lazyMessage().toString())
- }
-}
-
-fun nullToEmpty(value: String?): String {
- return if (checkNotEmpty(value)) value!! else ""
-}
-
-fun returnNotEmptyOrThrow(value: String?, lazyMessage: () -> Any): String {
- if (checkNotEmpty(value)) {
- return value!!
- } else {
- throw IllegalStateException(lazyMessage().toString())
- }
-}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/FileExtensionFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/FileExtensionFunctions.kt
deleted file mode 100644
index ff896ba9..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/FileExtensionFunctions.kt
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core
-
-import org.apache.commons.io.FileUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintArchiveUtils
-import java.io.File
-import java.io.InputStream
-import java.nio.file.Path
-import java.nio.file.Paths
-
-fun InputStream.toFile(path: String): File {
- val file = File(path)
- file.outputStream().use { this.copyTo(it) }
- return file
-}
-
-fun File.reCreateDirs(): File {
- if (this.exists()) {
- this.deleteRecursively()
- }
- // this.mkdirs()
- FileUtils.forceMkdir(this)
- check(this.exists()) {
- throw BluePrintException("failed to re create dir(${this.absolutePath})")
- }
- return this
-}
-
-fun File.compress(targetZipFileName: String): File {
- return this.compress(Paths.get(targetZipFileName).toFile())
-}
-
-/**
- * Compress the current Dir to the target zip file and return the target zip file
- */
-fun File.compress(targetZipFile: File): File {
- BluePrintArchiveUtils.compress(this, targetZipFile, true)
- return targetZipFile
-}
-
-fun File.deCompress(targetFileName: String): File {
- return this.deCompress(Paths.get(targetFileName).toFile())
-}
-
-/**
- * De-Compress the current zip file to the target file and return the target file
- */
-fun File.deCompress(targetFile: File): File {
- BluePrintArchiveUtils.deCompress(this, targetFile.path)
- return targetFile
-}
-
-fun deleteDir(path: String, vararg more: String?) {
- normalizedFile(path, *more).deleteRecursively()
-}
-
-fun normalizedFile(path: String, vararg more: String?): File {
- return Paths.get(path, *more).toFile().normalize()
-}
-
-fun normalizedPath(path: String, vararg more: String?): Path {
- return Paths.get(path, *more).normalize().toAbsolutePath()
-}
-
-fun normalizedPathName(path: String, vararg more: String?): String {
- return normalizedPath(path, *more).toString()
-}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/common/ApplicationConstants.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/common/ApplicationConstants.kt
deleted file mode 100644
index 994ea5b7..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/common/ApplicationConstants.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada
- *
- * 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.common
-
-object ApplicationConstants {
- const val ACTIVE_Y = "Y"
- const val ACTIVE_N = "N"
- const val ASDC_ARTIFACT_TYPE_SDNC_MODEL = "SDNC_MODEL"
-}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/config/BluePrintLoadConfiguration.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
deleted file mode 100644
index 235cfd56..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.config
-
-open class BluePrintLoadConfiguration {
-
- lateinit var blueprintDeployPath: String
- lateinit var blueprintArchivePath: String
- lateinit var blueprintEnrichmentPath: String
-
- var loadInitialData: Boolean = false
- var loadBluePrint: Boolean = false
- var loadBluePrintPaths: String? = null
-
- var loadModelType: Boolean = false
- var loadModeTypePaths: String? = null
-
- var loadResourceDictionary: Boolean = false
- var loadResourceDictionaryPaths: String? = null
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintExpressionData.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintExpressionData.kt
deleted file mode 100644
index 6a8df801..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintExpressionData.kt
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@file:Suppress("unused")
-
-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 dslExpression: DSLExpression? = 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
-)
-
-data class DSLExpression(
- val propertyName: String
-)
-
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
deleted file mode 100644
index 56acf612..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018-2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@file:Suppress("unused")
-
-package org.onap.ccsdk.apps.controllerblueprints.core.data
-
-import com.fasterxml.jackson.annotation.JsonIgnore
-import com.fasterxml.jackson.annotation.JsonProperty
-import com.fasterxml.jackson.annotation.JsonPropertyOrder
-import com.fasterxml.jackson.databind.JsonNode
-import io.swagger.annotations.ApiModelProperty
-
-/**
- *
- *
- * @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.Credential
- The 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: JsonNode? = 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<JsonNode>? = null
- @get:JsonProperty("length")
- var length: Any? = null
- @get:JsonProperty("min_length")
- var minLength: Any? = null
- @get:JsonProperty("max_length")
- var maxLength: Any? = null
- var pattern: String? = null
- var schema: 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
- lateinit var type: String
- lateinit var file: String
- var repository: String? = null
- var description: String? = null
- @get:JsonProperty("deploy_Path")
- var deployPath: String? = null
- var properties: MutableMap<String, JsonNode>? = 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
- lateinit var type: String
- @get:JsonProperty("default")
- var defaultValue: JsonNode? = null
- var status: String? = null
- var constraints: MutableList<ConstraintClause>? = null
- @get:JsonProperty("entry_schema")
- var entrySchema: EntrySchema? = null
- // Mainly used in Workflow Outputs
- @get:ApiModelProperty(notes = "Property Value, It may be Expression or Json type values")
- var value: JsonNode? = 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
- var required: Boolean? = null
- lateinit var type: String
- @JsonProperty("default")
- var defaultValue: JsonNode? = null
- var status: String? = null
- var constraints: MutableList<ConstraintClause>? = null
- @JsonProperty("entry_schema")
- var entrySchema: EntrySchema? = 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 {
- lateinit var primary: String
- 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
- @get:JsonProperty("target_filter")
- var targetFilter: EventFilterDefinition? = null
- var condition: ConditionClause? = null
- var constraint: ConditionClause? = null
- var method: String? = null
- lateinit var action: String
-}
-
-/*
- 3.5.17 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 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 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
- lateinit var type: String
- 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<ConstraintClause>? = 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<ConstraintClause>? = 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.
- */
-
-open 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
- var outputs: 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.
- */
-
-@JsonPropertyOrder(value = ["toscaDefinitionsVersion", "description", "metadata", "imports", "dsl_definitions",
- "topologyTemplate"])
-class ServiceTemplate : Cloneable {
- @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, JsonNode>? = 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("relationship_types")
- var relationshipTypes: MutableMap<String, RelationshipType>? = null
- @get:JsonProperty("node_types")
- var nodeTypes: MutableMap<String, NodeType>? = null
- @get:JsonProperty("policy_types")
- var policyTypes: MutableMap<String, PolicyType>? = null
- @get:JsonProperty("topology_template")
- var topologyTemplate: TopologyTemplate? = null
-
- override public fun clone(): ServiceTemplate {
- return super.clone() as ServiceTemplate
- }
-}
-
-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/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BlueprintErrorCode.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BlueprintErrorCode.kt
deleted file mode 100644
index bef174b9..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BlueprintErrorCode.kt
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright © 2018-2019 Bell Canada 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 java.util.HashMap
-
-/**
- * ErrorCode.java Purpose: Maintain a list of HTTP status codes
- *
- * @author Steve Siani
- * @version 1.0
- */
-enum class ErrorCode (val value: Int, val httpCode: Int) {
-
- /// TODO: Add more attribute for each needed application protocol
- // TODO: Example: INVALID_FILE_EXTENSION(2, 415, 25)
- GENERIC_FAILURE(1, 500) {
- override fun message(detailMsg: String): String {
- return "Generic failure. Details : {$detailMsg}"
- }
- },
- INVALID_FILE_EXTENSION(2, 415) {
- override fun message(detailMsg: String): String {
- return "Unexpected file extension. Details : {$detailMsg}"
- }
- },
- BLUEPRINT_PATH_MISSING(3, 503) {
- override fun message(detailMsg: String): String {
- return "Blueprint path missing or wrong. Details : {$detailMsg}"
- }
- },
- BLUEPRINT_WRITING_FAIL(4, 503) {
- override fun message(detailMsg: String): String {
- return "Fail to write blueprint files. Details : {$detailMsg}"
- }
- },
- IO_FILE_INTERRUPT(5, 503) {
- override fun message(detailMsg: String): String {
- return "IO file system interruption. Details : {$detailMsg}"
- }
- },
- INVALID_REQUEST_FORMAT(6, 400) {
- override fun message(detailMsg: String): String {
- return "Bad request. Details : {$detailMsg}"
- }
- },
- UNAUTHORIZED_REQUEST(7, 401) {
- override fun message(detailMsg: String): String {
- return "The request requires user authentication. Details : {$detailMsg}"
- }
- },
- REQUEST_NOT_FOUND(8, 404) {
- override fun message(detailMsg: String): String {
- return "Request mapping doesn't exist. Details : {$detailMsg}"
- }
- },
- RESOURCE_NOT_FOUND(9, 404) {
- override fun message(detailMsg: String): String {
- return "No response was found for this request in the server. Details : {$detailMsg}"
- }
- },
- CONFLICT_ADDING_RESOURCE(10, 409) {
- override fun message(detailMsg: String): String {
- return "Duplicated entry while saving Blueprint. Details : {$detailMsg}"
- }
- };
-
- abstract fun message(detailMsg: String): String
-
- companion object {
-
- private val map = HashMap<Int, ErrorCode>()
-
- init {
- for (errorCode in ErrorCode.values()) {
- map[errorCode.value] = errorCode
- }
- }
-
- fun valueOf(value: Int): ErrorCode? {
- return if (map.containsKey(value)) map[value] else map[1]
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintCatalogService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
deleted file mode 100755
index c99cdf74..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
-
-import org.jetbrains.annotations.NotNull
-import org.jetbrains.annotations.Nullable
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import java.io.File
-import java.nio.file.Path
-
-interface BluePrintCatalogService {
-
- /**
- * Save the CBA to database.
- * @param blueprintFile Either a directory, or an archive
- * @param validate whether to validate blueprint content. Default true.
- * @return The unique blueprint identifier
- * @throws BluePrintException if process failed
- */
- @NotNull
- @Throws(BluePrintException::class)
- fun saveToDatabase(@NotNull blueprintFile: File, @Nullable validate: Boolean = true): String
-
- /**
- * Retrieve the CBA from database either archived or extracted.
- * @param name Name of the blueprint
- * @param version Version of the blueprint
- * @param extract true to extract the content, false for archived content. Default to true
- * @return Path where CBA is located
- * @throws BluePrintException if process failed
- */
- @NotNull
- @Throws(BluePrintException::class)
- fun getFromDatabase(@NotNull name: String, @NotNull version: String, @Nullable extract: Boolean = true): Path
-
- /**
- * Delete the CBA from database.
- * @param name Name of the blueprint
- * @param version Version of the blueprint
- * @throws BluePrintException if process failed
- */
- @NotNull
- @Throws(BluePrintException::class)
- fun deleteFromDatabase(@NotNull name: String, @NotNull version: String)
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
deleted file mode 100644
index 0aa01e8f..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-
-interface BluePrintEnhancer<T> {
- fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T)
-}
-
-interface BluePrintServiceTemplateEnhancer : BluePrintEnhancer<ServiceTemplate>
-
-interface BluePrintTopologyTemplateEnhancer : BluePrintEnhancer<TopologyTemplate>
-
-interface BluePrintWorkflowEnhancer : BluePrintEnhancer<Workflow>
-
-interface BluePrintNodeTemplateEnhancer : BluePrintEnhancer<NodeTemplate>
-
-interface BluePrintNodeTypeEnhancer : BluePrintEnhancer<NodeType>
-
-interface BluePrintArtifactDefinitionEnhancer : BluePrintEnhancer<ArtifactDefinition>
-
-interface BluePrintPolicyTypeEnhancer : BluePrintEnhancer<PolicyType>
-
-interface BluePrintPropertyDefinitionEnhancer : BluePrintEnhancer<PropertyDefinition>
-
-interface BluePrintAttributeDefinitionEnhancer : BluePrintEnhancer<AttributeDefinition>
-
-
-interface BluePrintEnhancerService {
-
- @Throws(BluePrintException::class)
- suspend fun enhance(basePath: String, enrichedBasePath: String): BluePrintContext
-
- @Throws(BluePrintException::class)
- suspend fun enhance(basePath: String): BluePrintContext
-}
-
-interface BluePrintTypeEnhancerService {
-
- fun getServiceTemplateEnhancers(): List<BluePrintServiceTemplateEnhancer>
-
- fun getTopologyTemplateEnhancers(): List<BluePrintTopologyTemplateEnhancer>
-
- fun getWorkflowEnhancers(): List<BluePrintWorkflowEnhancer>
-
- fun getNodeTemplateEnhancers(): List<BluePrintNodeTemplateEnhancer>
-
- fun getNodeTypeEnhancers(): List<BluePrintNodeTypeEnhancer>
-
- fun getArtifactDefinitionEnhancers(): List<BluePrintArtifactDefinitionEnhancer>
-
- fun getPolicyTypeEnhancers(): List<BluePrintPolicyTypeEnhancer>
-
- fun getPropertyDefinitionEnhancers(): List<BluePrintPropertyDefinitionEnhancer>
-
- fun getAttributeDefinitionEnhancers(): List<BluePrintAttributeDefinitionEnhancer>
-
- fun enhanceServiceTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) {
- val enhancers = getServiceTemplateEnhancers()
- doEnhancement(bluePrintRuntimeService, name, serviceTemplate, enhancers)
- }
-
- fun enhanceTopologyTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) {
- val enhancers = getTopologyTemplateEnhancers()
- doEnhancement(bluePrintRuntimeService, name, topologyTemplate, enhancers)
- }
-
- fun enhanceWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, workflow: Workflow) {
- val enhancers = getWorkflowEnhancers()
- doEnhancement(bluePrintRuntimeService, name, workflow, enhancers)
- }
-
- fun enhanceNodeTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) {
- val enhancers = getNodeTemplateEnhancers()
- doEnhancement(bluePrintRuntimeService, name, nodeTemplate, enhancers)
- }
-
- fun enhanceNodeType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeType: NodeType) {
- val enhancers = getNodeTypeEnhancers()
- doEnhancement(bluePrintRuntimeService, name, nodeType, enhancers)
- }
-
- fun enhanceArtifactDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactDefinition: ArtifactDefinition) {
- val enhancers = getArtifactDefinitionEnhancers()
- doEnhancement(bluePrintRuntimeService, name, artifactDefinition, enhancers)
- }
-
- fun enhancePolicyType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, policyType: PolicyType) {
- val enhancers = getPolicyTypeEnhancers()
- doEnhancement(bluePrintRuntimeService, name, policyType, enhancers)
- }
-
- fun enhancePropertyDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, properties: MutableMap<String, PropertyDefinition>) {
- properties.forEach { propertyName, propertyDefinition ->
- enhancePropertyDefinition(bluePrintRuntimeService, propertyName, propertyDefinition)
- }
- }
-
- fun enhancePropertyDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) {
- val enhancers = getPropertyDefinitionEnhancers()
- doEnhancement(bluePrintRuntimeService, name, propertyDefinition, enhancers)
- }
-
- fun enhanceAttributeDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, attributes: MutableMap<String, AttributeDefinition>) {
- attributes.forEach { attributeName, attributeDefinition ->
- enhanceAttributeDefinition(bluePrintRuntimeService, attributeName, attributeDefinition)
- }
- }
-
- fun enhanceAttributeDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition) {
- val enhancers = getAttributeDefinitionEnhancers()
- doEnhancement(bluePrintRuntimeService, name, attributeDefinition, enhancers)
- }
-
- @Suppress("UNCHECKED_CAST")
- private fun <T> doEnhancement(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, definition: Any, enhancers: List<BluePrintEnhancer<T>>) {
- if (enhancers.isNotEmpty()) {
- enhancers.forEach {
- it.enhance(bluePrintRuntimeService, name, definition as T)
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt
deleted file mode 100644
index e5ba6f4c..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import java.io.Serializable
-
-/**
- * BluePrintRepoFileService
- * @author Brinda Santh
- *
- */
-
-interface BluePrintRepoService : 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
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintScriptsService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintScriptsService.kt
deleted file mode 100644
index ac682553..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintScriptsService.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
-
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-
-interface BluePrintScriptsService {
-
- fun <T> scriptInstance(blueprintContext: BluePrintContext, scriptClassName: String,
- reCompile: Boolean): T
-
- fun <T> scriptInstance(scriptClassName: String): T
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt
deleted file mode 100644
index c536aef7..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
-
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-
-interface BluePrintWorkflowExecutionService<Input, Output> {
-
- suspend fun executeBluePrintWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- executionServiceInput: Input,
- properties: MutableMap<String, Any> = hashMapOf()): Output
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt
deleted file mode 100644
index 0b9f1f18..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import java.util.function.Function
-
-
-interface BlueprintFunctionNode<T, R> : Function<T, R> {
-
- fun getName(): String
-
- @Throws(BluePrintProcessorException::class)
- fun prepareRequest(executionRequest: T): T
-
- @Throws(BluePrintProcessorException::class)
- fun process(executionRequest: T)
-
- @Throws(BluePrintProcessorException::class)
- fun recover(runtimeException: RuntimeException, executionRequest: T)
-
- @Throws(BluePrintProcessorException::class)
- fun prepareResponse(): R
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt
deleted file mode 100644
index a485c677..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-
-
-interface BluePrintValidator<T> {
-
- fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T)
-
-}
-
-
-interface BluePrintServiceTemplateValidator : BluePrintValidator<ServiceTemplate>
-
-interface BluePrintTopologyTemplateValidator : BluePrintValidator<TopologyTemplate>
-
-interface BluePrintArtifactTypeValidator : BluePrintValidator<ArtifactType>
-
-interface BluePrintArtifactDefinitionValidator : BluePrintValidator<ArtifactDefinition>
-
-interface BluePrintDataTypeValidator : BluePrintValidator<DataType>
-
-interface BluePrintNodeTypeValidator : BluePrintValidator<NodeType>
-
-interface BluePrintNodeTemplateValidator : BluePrintValidator<NodeTemplate>
-
-interface BluePrintWorkflowValidator : BluePrintValidator<Workflow>
-
-interface BluePrintPropertyDefinitionValidator : BluePrintValidator<PropertyDefinition>
-
-interface BluePrintAttributeDefinitionValidator : BluePrintValidator<AttributeDefinition>
-
-/**
- * Blueprint Validation Interface.
- */
-interface BluePrintValidatorService {
-
- @Throws(BluePrintException::class)
- fun validateBluePrints(basePath: String): Boolean
-
- @Throws(BluePrintException::class)
- fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean
-}
-
-
-interface BluePrintTypeValidatorService {
-
- fun <T : BluePrintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T?
-
- fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>?
-
- fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>?
-
- fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator>
-
- fun getDataTypeValidators(): List<BluePrintDataTypeValidator>
-
- fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator>
-
- fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator>
-
- fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator>
-
- fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator>
-
- fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator>
-
- fun getWorkflowValidators(): List<BluePrintWorkflowValidator>
-
- fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator>
-
- fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator>
-
- fun validateServiceTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) {
- val validators = getServiceTemplateValidators()
- doValidation(bluePrintRuntimeService, name, serviceTemplate, validators)
- }
-
- fun validateArtifactType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) {
- val validators = getArtifactTypeValidators()
- doValidation(bluePrintRuntimeService, name, artifactType, validators)
- }
-
- fun validateArtifactDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
- val validators = getArtifactDefinitionsValidators()
- doValidation(bluePrintRuntimeService, name, artifactDefinition, validators)
- }
-
- fun validateDataType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, dataType: DataType) {
- val validators = getDataTypeValidators()
- doValidation(bluePrintRuntimeService, name, dataType, validators)
- }
-
- fun validateNodeType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeType: NodeType) {
- val validators = getNodeTypeValidators()
- doValidation(bluePrintRuntimeService, name, nodeType, validators)
- }
-
- fun validateTopologyTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) {
- val validators = getTopologyTemplateValidators()
- doValidation(bluePrintRuntimeService, name, topologyTemplate, validators)
- }
-
- fun validateNodeTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) {
- val validators = getNodeTemplateValidators()
- doValidation(bluePrintRuntimeService, name, nodeTemplate, validators)
- }
-
- fun validateWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, workflow: Workflow) {
- val validators = getWorkflowValidators()
- doValidation(bluePrintRuntimeService, name, workflow, validators)
- }
-
- fun validatePropertyDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, properties: MutableMap<String, PropertyDefinition>) {
- properties.forEach { propertyName, propertyDefinition ->
- validatePropertyDefinition(bluePrintRuntimeService, propertyName, propertyDefinition)
- }
- }
-
- fun validatePropertyDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) {
- val validators = getPropertyDefinitionValidators()
- doValidation(bluePrintRuntimeService, name, propertyDefinition, validators)
- }
-
- fun validateAttributeDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, attributes: MutableMap<String, AttributeDefinition>) {
- attributes.forEach { attributeName, attributeDefinition ->
- validateAttributeDefinition(bluePrintRuntimeService, attributeName, attributeDefinition)
- }
- }
-
- fun validateAttributeDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition) {
- val validators = getAttributeDefinitionValidators()
- doValidation(bluePrintRuntimeService, name, attributeDefinition, validators)
- }
-
- @Suppress("UNCHECKED_CAST")
- private fun <T> doValidation(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, definition: Any, validators: List<BluePrintValidator<T>>) {
- validators.forEach {
- it.validate(bluePrintRuntimeService, name, definition as T)
- }
- }
-}
-
-
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintChainedService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintChainedService.kt
deleted file mode 100644
index 3c637bde..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintChainedService.kt
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.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/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
deleted file mode 100644
index ca86c964..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@file:Suppress("unused")
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.fasterxml.jackson.databind.JsonNode
-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
-
-/**
- *
- *
- * @author Brinda Santh
- */
-class BluePrintContext(val serviceTemplate: ServiceTemplate) {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- /**
- * Blueprint CBA extracted file location
- */
- var rootPath = "."
- /**
- * Root Definition file path
- */
- var entryDefinition = ""
-
- fun imports(): List<ImportDefinition>? = serviceTemplate.imports
-
- fun dslDefinitions() = serviceTemplate.dslDefinitions
-
- val metadata: MutableMap<String, String>? = serviceTemplate.metadata
-
- fun dataTypes(): MutableMap<String, DataType>? = serviceTemplate.dataTypes
-
- fun inputs(): MutableMap<String, PropertyDefinition>? = serviceTemplate.topologyTemplate?.inputs
-
- fun blueprintJson(pretty: Boolean = false): String = print("json", pretty)
-
- private fun print(type: String? = "json", pretty: Boolean = false): String {
- return JacksonUtils.getJson(serviceTemplate, pretty)
- }
-
- fun name(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_NAME)
- ?: throw BluePrintException("could't get template name from meta data")
-
- fun version(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_VERSION)
- ?: throw BluePrintException("could't get template version from meta data")
-
- fun author(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_AUTHOR)
- ?: throw BluePrintException("could't get template author from meta data")
-
- // Workflow
- fun workflows(): MutableMap<String, Workflow>? = serviceTemplate.topologyTemplate?.workflows
-
- fun workflowByName(workFlowName: String): Workflow = workflows()?.get(workFlowName)
- ?: throw BluePrintException("could't get workflow($workFlowName)")
-
- fun workflowInputs(workFlowName: String) = workflowByName(workFlowName).inputs
-
- fun workflowStepByName(workFlowName: String, stepName: String): Step {
- return workflowByName(workFlowName).steps?.get(stepName)
- ?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)")
- }
-
- fun workflowStepNodeTemplate(workFlowName: String, stepName: String): String {
- return workflowStepByName(workFlowName, stepName).target
- ?: throw BluePrintException("could't get node template name for workflow($workFlowName)'s step($stepName)")
- }
-
- fun workflowFirstStepNodeTemplate(workFlowName: String): String {
- val firstStepName = workflowByName(workFlowName).steps?.keys?.first()
- ?: throw BluePrintException("could't get first step for workflow($workFlowName)")
- return workflowStepNodeTemplate(workFlowName, firstStepName)
- }
-
- fun workflowStepFirstCallOperation(workFlowName: String, stepName: String): String {
- return workflowStepByName(workFlowName, stepName).activities?.filter { it.callOperation != null }?.single()?.callOperation
- ?: throw BluePrintException("could't get first callOperation for WorkFlow($workFlowName) ")
- }
-
- // DSL
- fun dslPropertiesByName(name: String): JsonNode = dslDefinitions()?.get(name)
- ?: throw BluePrintException("could't get policy type for the dsl($name)")
-
- // Data Type
- fun dataTypeByName(name: String): DataType? = dataTypes()?.get(name)
-
- // Artifact Type
- fun artifactTypes(): MutableMap<String, ArtifactType>? = serviceTemplate.artifactTypes
-
- // Policy Types
- fun policyTypes(): MutableMap<String, PolicyType>? = serviceTemplate.policyTypes
-
- fun policyTypeByName(policyName: String) = policyTypes()?.get(policyName)
- ?: throw BluePrintException("could't get policy type for the name($policyName)")
-
- fun policyTypesDerivedFrom(name: String): MutableMap<String, PolicyType>? {
- return policyTypes()?.filterValues { policyType -> policyType.derivedFrom == name }?.toMutableMap()
- }
-
- fun policyTypesTarget(target: String): MutableMap<String, PolicyType>? {
- return policyTypes()?.filterValues { it.targets.contains(target) }?.toMutableMap()
- }
-
- fun policyTypesTargetNDerivedFrom(target: String, derivedFrom: String): MutableMap<String, PolicyType>? {
- return policyTypesDerivedFrom(derivedFrom)?.filterValues {
- it.targets.contains(target)
- }?.toMutableMap()
- }
-
- // Node Type Methods
- fun nodeTypes(): MutableMap<String, NodeType>? = serviceTemplate.nodeTypes
-
- fun nodeTypeByName(name: String): NodeType =
- nodeTypes()?.get(name)
- ?: throw BluePrintException("could't get node type for the name($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?.get(interfaceName)
- ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName)")
- }
-
- fun nodeTypeInterfaceOperation(nodeTypeName: String, interfaceName: String, operationName: String): OperationDefinition {
- return nodeTypeInterface(nodeTypeName, interfaceName).operations?.get(operationName)
- ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName) operation definition($operationName)")
- }
-
- fun interfaceNameForNodeType(nodeTypeName: String): String {
- return nodeTypeByName(nodeTypeName).interfaces?.keys?.first()
- ?: throw BluePrintException("could't get NodeType($nodeTypeName)'s first InterfaceDefinition name")
- }
-
- 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
- fun nodeTemplates(): MutableMap<String, NodeTemplate>? = serviceTemplate.topologyTemplate?.nodeTemplates
-
- fun nodeTemplateByName(name: String): NodeTemplate =
- nodeTemplates()?.get(name) ?: throw BluePrintException("could't 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)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($artifactName)")
- }
-
- fun nodeTemplateArtifactForArtifactType(nodeTemplateName: String, artifactType: String): ArtifactDefinition {
- return nodeTemplateArtifacts(nodeTemplateName)?.filter { it.value.type == artifactType }?.map { it.value }?.get(0)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)")
- }
-
- fun nodeTemplateFirstInterface(nodeTemplateName: String): InterfaceAssignment {
- return nodeTemplateByName(nodeTemplateName).interfaces?.values?.first()
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment")
- }
-
- fun nodeTemplateFirstInterfaceName(nodeTemplateName: String): String {
- return nodeTemplateByName(nodeTemplateName).interfaces?.keys?.first()
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment name")
- }
-
- fun nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName: String): String {
- return nodeTemplateFirstInterface(nodeTemplateName).operations?.keys?.first()
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment's first OperationAssignment name")
- }
-
- fun nodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>? {
- return nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName).inputs
- }
-
- fun nodeTemplateInterfaceOperationOutputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>? {
- return nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName).outputs
- }
-
- fun nodeTemplateInterface(nodeTemplateName: String, interfaceName: String): InterfaceAssignment {
- return nodeTemplateByName(nodeTemplateName).interfaces?.get(interfaceName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName)")
- }
-
- fun nodeTemplateInterfaceOperation(nodeTemplateName: String, interfaceName: String, operationName: String): OperationAssignment {
- return nodeTemplateInterface(nodeTemplateName, interfaceName).operations?.get(operationName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName) OperationAssignment($operationName)")
- }
-
- fun nodeTemplateCapability(nodeTemplateName: String, capabilityName: String): CapabilityAssignment {
- return nodeTemplateByName(nodeTemplateName).capabilities?.get(capabilityName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s CapabilityAssignment($capabilityName)")
- }
-
- fun nodeTemplateRequirement(nodeTemplateName: String, requirementName: String): RequirementAssignment {
- return nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first RequirementAssignment($requirementName)")
- }
-
- fun nodeTemplateRequirementNode(nodeTemplateName: String, requirementName: String): NodeTemplate {
- val filteredNodeTemplateName: String = nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)?.node
- ?: throw BluePrintException("could't NodeTemplate for NodeTemplate's($nodeTemplateName) requirement's ($requirementName) ")
- return nodeTemplateByName(filteredNodeTemplateName)
- }
-
- 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/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
deleted file mode 100644
index f23659ce..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.ArrayNode
-import com.fasterxml.jackson.databind.node.ObjectNode
-import com.fasterxml.jackson.databind.node.TextNode
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-
-/**
- *
- *
- * @author Brinda Santh
- */
-object BluePrintExpressionService {
- val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- @JvmStatic
- fun checkContainsExpression(propertyAssignmentNode: JsonNode): Boolean {
- val json = propertyAssignmentNode.toString()
- // FIXME("Check if any Optimisation needed")
- return (json.contains(BluePrintConstants.EXPRESSION_GET_INPUT)
- || json.contains(BluePrintConstants.EXPRESSION_GET_ATTRIBUTE)
- || json.contains(BluePrintConstants.EXPRESSION_GET_PROPERTY))
-
- }
-
- @JvmStatic
- fun getExpressionData(propertyAssignmentNode: JsonNode): ExpressionData {
- log.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) {
- BluePrintConstants.EXPRESSION_GET_INPUT -> {
- expressionData.inputExpression = populateInputExpression(propertyAssignmentNode)
- }
- BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> {
- expressionData.attributeExpression = populateAttributeExpression(propertyAssignmentNode)
- }
- BluePrintConstants.EXPRESSION_GET_PROPERTY -> {
- expressionData.propertyExpression = populatePropertyExpression(propertyAssignmentNode)
- }
- BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> {
- expressionData.operationOutputExpression = populateOperationOutputExpression(propertyAssignmentNode)
- }
- BluePrintConstants.EXPRESSION_GET_ARTIFACT -> {
- expressionData.artifactExpression = populateArtifactExpression(propertyAssignmentNode)
- }
- }
- }
- } else if (propertyAssignmentNode is TextNode
- && propertyAssignmentNode.textValue().startsWith(BluePrintConstants.EXPRESSION_DSL_REFERENCE)) {
- expressionData.isExpression = true
- expressionData.command = BluePrintConstants.EXPRESSION_DSL_REFERENCE
- expressionData.dslExpression = populateDSLExpression(propertyAssignmentNode)
- }
- return expressionData
- }
-
- @JvmStatic
- fun populateDSLExpression(jsonNode: TextNode): DSLExpression {
- return DSLExpression(propertyName = jsonNode.textValue()
- .removePrefix(BluePrintConstants.EXPRESSION_DSL_REFERENCE))
- }
-
- @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
- when {
- arrayNode.size() == 2 -> propertyName = arrayNode[1].textValue()
- arrayNode.size() == 3 -> {
- reqOrCapEntityName = arrayNode[1].textValue()
- propertyName = arrayNode[2].textValue()
- }
- arrayNode.size() > 3 -> {
- reqOrCapEntityName = arrayNode[1].textValue()
- propertyName = arrayNode[2].textValue()
- val propertyPaths: List<String> = arrayNode.filterIndexed { index, _ ->
- 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() >= 2) {
- 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 attributeName = ""
- var subAttributeName: String? = null
- when {
- arrayNode.size() == 2 -> attributeName = arrayNode[1].textValue()
- arrayNode.size() == 3 -> {
- reqOrCapEntityName = arrayNode[1].textValue()
- attributeName = arrayNode[2].textValue()
- }
- arrayNode.size() > 3 -> {
- reqOrCapEntityName = arrayNode[1].textValue()
- attributeName = arrayNode[2].textValue()
- val propertyPaths: List<String> = arrayNode.filterIndexed { index, _ ->
- index >= 3
- }.map { it.textValue() }
- subAttributeName = propertyPaths.joinToString("/")
- }
- }
- return AttributeExpression(modelableEntityName = arrayNode[0].asText(),
- reqOrCapEntityName = reqOrCapEntityName,
- attributeName = attributeName,
- subAttributeName = subAttributeName
- )
- }
-
- @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/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt
deleted file mode 100644
index c524773a..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintImportService.kt
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ImportDefinition
-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.net.URL
-import java.net.URLDecoder
-import java.nio.charset.Charset
-
-class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate, private val blueprintBasePath: String) {
- companion object {
- private const val PARENT_SERVICE_TEMPLATE: String = "parent"
- }
-
- private val log: Logger = LoggerFactory.getLogger(this::class.toString())
-
- private var importServiceTemplateMap: MutableMap<String, ServiceTemplate> = hashMapOf()
-
-
- suspend fun getImportResolvedServiceTemplate(): ServiceTemplate {
- // Populate Imported Service Templates
- traverseSchema(PARENT_SERVICE_TEMPLATE, parentServiceTemplate)
-
- importServiceTemplateMap.forEach { key, serviceTemplate ->
- ServiceTemplateUtils.merge(parentServiceTemplate, serviceTemplate)
- log.debug("merged service template $key")
- }
- return parentServiceTemplate
- }
-
- private suspend fun traverseSchema(key: String, serviceTemplate: ServiceTemplate) {
- if (key != PARENT_SERVICE_TEMPLATE) {
- importServiceTemplateMap[key] = serviceTemplate
- }
- val imports: List<ImportDefinition>? = serviceTemplate.imports
-
- imports?.let {
- serviceTemplate.imports?.forEach { importDefinition ->
- val childServiceTemplate = resolveImportDefinition(importDefinition)
- val keyName: String = importDefinition.file
- traverseSchema(keyName, childServiceTemplate)
- }
- }
- }
-
- private suspend fun resolveImportDefinition(importDefinition: ImportDefinition): ServiceTemplate {
- var serviceTemplate: ServiceTemplate? = null
- val file: String = importDefinition.file
- val decodedSystemId: String = URLDecoder.decode(file, Charset.defaultCharset().toString())
- log.trace("file ({}), decodedSystemId ({}) ", file, decodedSystemId)
- try {
- if (decodedSystemId.startsWith("http", true)
- || decodedSystemId.startsWith("https", true)) {
- val givenUrl: String = URL(decodedSystemId).toString()
- val systemUrl: String = File(".").toURI().toURL().toString()
- log.trace("givenUrl ({}), systemUrl ({}) ", givenUrl, systemUrl)
- if (givenUrl.startsWith(systemUrl)) {
-
- }
- } else {
- if (!decodedSystemId.startsWith("/")) {
- importDefinition.file = StringBuilder().append(blueprintBasePath).append(File.separator).append(file).toString()
- }
- serviceTemplate = ServiceTemplateUtils.getServiceTemplate(importDefinition.file)
- }
- } catch (e: Exception) {
- throw BluePrintException("failed to populate service template for ${importDefinition.file}", e)
- }
- if (serviceTemplate == null) {
- throw BluePrintException("failed to populate service template for : ${importDefinition.file}")
- }
- return serviceTemplate
- }
-
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt
deleted file mode 100644
index 5d6ca757..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-
-open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoService {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintRepoFileService::class.toString())
-
- private val dataTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
- private val nodeTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE)
- private val artifactTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE)
- private val capabilityTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE)
- private val relationshipTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE)
- private val extension = ".json"
-
- override fun getDataType(dataTypeName: String): DataType {
- val fileName = dataTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(dataTypeName).plus(extension)
- return getModelType(fileName, DataType::class.java)
- }
-
- override fun getNodeType(nodeTypeName: String): NodeType {
- val fileName = nodeTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(nodeTypeName).plus(extension)
- return getModelType(fileName, NodeType::class.java)
- }
-
- override fun getArtifactType(artifactTypeName: String): ArtifactType {
- val fileName = artifactTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(artifactTypeName).plus(extension)
- return getModelType(fileName, ArtifactType::class.java)
- }
-
- override fun getRelationshipType(relationshipTypeName: String): RelationshipType {
- val fileName = relationshipTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(relationshipTypeName).plus(extension)
- return getModelType(fileName, RelationshipType::class.java)
- }
-
- override fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition {
- val fileName = capabilityTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(capabilityDefinitionName).plus(extension)
- return getModelType(fileName, CapabilityDefinition::class.java)
- }
-
- private fun <T> getModelType(fileName: String, valueType: Class<T>): T {
- return JacksonUtils.readValueFromFile(fileName, valueType)
- ?: throw BluePrintException("couldn't get file($fileName) for type(${valueType.name}")
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
deleted file mode 100644
index 7958adf7..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018-2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.NullNode
-import com.fasterxml.jackson.databind.node.ObjectNode
-import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
-import org.onap.ccsdk.apps.controllerblueprints.core.*
-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.BluePrintMetadataUtils
-import java.io.File
-
-interface BluePrintRuntimeService<T> {
-
- fun id(): String
-
- fun bluePrintContext(): BluePrintContext
-
- fun getExecutionContext(): T
-
- fun setExecutionContext(executionContext: T)
-
- fun put(key: String, value: JsonNode)
-
- fun get(key: String): JsonNode?
-
- fun check(key: String): Boolean
-
- fun cleanRuntime()
-
- fun getAsString(key: String): String?
-
- fun getAsBoolean(key: String): Boolean?
-
- fun getAsInt(key: String): Int?
-
- fun getAsDouble(key: String): Double?
-
- fun getBluePrintError(): BluePrintError
-
- fun setBluePrintError(bluePrintError: BluePrintError)
-
- fun loadEnvironments(type: String, fileName: String)
-
- fun resolveNodeTemplatePropertyAssignments(nodeTemplateName: String,
- propertyDefinitions: MutableMap<String, PropertyDefinition>,
- propertyAssignments: MutableMap<String, JsonNode>): MutableMap<String, JsonNode>
-
- fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>)
- : MutableMap<String, JsonNode>
-
- fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>)
- : MutableMap<String, JsonNode>
-
- fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode>
-
- fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String): MutableMap<String,
- JsonNode>
-
- fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String,
- operationName: String): MutableMap<String, JsonNode>
-
- fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String, interfaceName: String,
- operationName: String): MutableMap<String, JsonNode>
-
- fun resolveNodeTemplateArtifact(nodeTemplateName: String, artifactName: String): String
-
- fun resolveNodeTemplateArtifactDefinition(nodeTemplateName: String, artifactName: String): ArtifactDefinition
-
- fun resolveDSLExpression(dslPropertyName: String): JsonNode
-
- fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode)
-
- fun setWorkflowInputValue(workflowName: String, propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode)
-
- fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode)
-
- fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode)
-
- fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String, value: JsonNode)
-
- fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String, value: JsonNode)
-
- fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String, value: JsonNode)
-
- fun getInputValue(propertyName: String): JsonNode
-
- fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String): JsonNode
-
- fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode?
-
- fun getNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String): JsonNode?
-
- fun assignInputs(jsonNode: JsonNode)
-
- fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode)
-
- fun resolveWorkflowOutputs(workflowName: String): MutableMap<String, JsonNode>
-
- fun getJsonForNodeTemplateAttributeProperties(nodeTemplateName: String, keys: List<String>): JsonNode
-}
-
-/**
- *
- *
- * @author Brinda Santh
- */
-open class DefaultBluePrintRuntimeService(private var id: String, private var bluePrintContext: BluePrintContext)
- : BluePrintRuntimeService<MutableMap<String, JsonNode>> {
-
- @Transient
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintRuntimeService::class.toString())
-
- private var store: MutableMap<String, JsonNode> = hashMapOf()
-
- private var bluePrintError = BluePrintError()
-
- init {
- /**
- * Load Blueprint Environments Properties
- */
- val absoluteEnvFilePath = bluePrintContext.rootPath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
- loadEnvironments(BluePrintConstants.PROPERTY_BPP, absoluteEnvFilePath)
-
- }
-
- override fun id(): String {
- return id
- }
-
- override fun bluePrintContext(): BluePrintContext {
- return bluePrintContext
- }
-
- override fun getExecutionContext(): MutableMap<String, JsonNode> {
- return store
- }
-
- @Suppress("UNCHECKED_CAST")
- override fun setExecutionContext(executionContext: MutableMap<String, JsonNode>) {
- this.store = executionContext
- }
-
- override fun put(key: String, value: JsonNode) {
- store[key] = value
- }
-
- override fun get(key: String): JsonNode {
- return store[key] ?: throw BluePrintProcessorException("failed to get execution property($key)")
- }
-
- override fun check(key: String): Boolean {
- return store.containsKey(key)
- }
-
- override fun cleanRuntime() {
- store.clear()
- }
-
- private fun getJsonNode(key: String): JsonNode {
- return get(key)
- }
-
- override fun getAsString(key: String): String? {
- return get(key).asText()
- }
-
- override fun getAsBoolean(key: String): Boolean? {
- return get(key).asBoolean()
- }
-
- override fun getAsInt(key: String): Int? {
- return get(key).asInt()
- }
-
- override fun getAsDouble(key: String): Double? {
- return get(key).asDouble()
- }
-
- override fun getBluePrintError(): BluePrintError {
- return this.bluePrintError
- }
-
- override fun setBluePrintError(bluePrintError: BluePrintError) {
- this.bluePrintError = bluePrintError
- }
-
- override fun loadEnvironments(type: String, fileName: String) {
- BluePrintMetadataUtils.environmentFileProperties(fileName).forEach { key, value ->
- setNodeTemplateAttributeValue(type, key.toString(), value.toString()
- .asJsonPrimitive())
- }
- }
-
- /**
- * Resolve any property assignments for the node
- */
- override fun resolveNodeTemplatePropertyAssignments(nodeTemplateName: String,
- propertyDefinitions: MutableMap<String, PropertyDefinition>,
- propertyAssignments: MutableMap<String, JsonNode>)
- : MutableMap<String, JsonNode> {
-
- val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
-
- propertyDefinitions.forEach { nodeTypePropertyName, nodeTypeProperty ->
- // Get the Express or Value for the Node Template
- val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
-
- var resolvedValue: JsonNode = NullNode.getInstance()
- if (propertyAssignment != null) {
- // Resolve the Expressing
- val propertyAssignmentExpression = PropertyAssignmentService(this)
- resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName,
- nodeTypePropertyName, propertyAssignment)
- } else {
- // Assign default value to the Operation
- nodeTypeProperty.defaultValue?.let {
- resolvedValue = nodeTypeProperty.defaultValue!!
- }
- }
- // Set for Return of method
- propertyAssignmentValue[nodeTypePropertyName] = resolvedValue
- }
- return propertyAssignmentValue
- }
-
- override fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>)
- : MutableMap<String, JsonNode> {
- val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
-
- propertyDefinitions.forEach { propertyName, propertyDefinition ->
- val propertyAssignmentExpression = PropertyAssignmentService(this)
- val expression = propertyDefinition.value ?: propertyDefinition.defaultValue
- if (expression != null) {
- propertyAssignmentValue[propertyName] = propertyAssignmentExpression.resolveAssignmentExpression(name,
- propertyName, expression)
- }
- }
- return propertyAssignmentValue
- }
-
- override fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>)
- : MutableMap<String, JsonNode> {
-
- val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
-
- propertyAssignments.forEach { propertyName, propertyExpression ->
- val propertyAssignmentExpression = PropertyAssignmentService(this)
- propertyAssignmentValue[propertyName] = propertyAssignmentExpression.resolveAssignmentExpression(name,
- propertyName, propertyExpression)
- }
- return propertyAssignmentValue
- }
-
- override fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName)
-
- val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
-
- val propertyAssignments: MutableMap<String, JsonNode> = nodeTemplate.properties!!
-
- // Get the Node Type Definitions
- val nodeTypePropertieDefinitions: MutableMap<String, PropertyDefinition> = bluePrintContext
- .nodeTypeChainedProperties(nodeTemplate.type)!!
-
- /**
- * Resolve the NodeTemplate Property Assignment Values.
- */
- return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypePropertieDefinitions,
- propertyAssignments)
- }
-
- override fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String):
- MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateCapabilityProperties for node template($nodeTemplateName) capability " +
- "($capabilityName)")
- val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
-
- val propertyAssignments = nodeTemplate.capabilities?.get(capabilityName)?.properties ?: hashMapOf()
-
- val propertyDefinitions = bluePrintContext.nodeTemplateNodeType(nodeTemplateName)
- .capabilities?.get(capabilityName)?.properties ?: hashMapOf()
-
- /**
- * Resolve the Capability Property Assignment Values.
- */
- return resolveNodeTemplatePropertyAssignments(nodeTemplateName, propertyDefinitions,
- propertyAssignments)
- }
-
- override fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,
- interfaceName: String,
- operationName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateInterfaceOperationInputs for node template ($nodeTemplateName),interface name " +
- "($interfaceName), operationName($operationName)")
-
- val propertyAssignments: MutableMap<String, JsonNode> =
- bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
- ?: hashMapOf()
-
- val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
-
- val nodeTypeInterfaceOperationInputs: MutableMap<String, PropertyDefinition> =
- bluePrintContext.nodeTypeInterfaceOperationInputs(nodeTypeName, interfaceName, operationName)
- ?: hashMapOf()
-
- log.info("input definition for node template ($nodeTemplateName), values ($propertyAssignments)")
-
- /**
- * Resolve the Property Input Assignment Values.
- */
- return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypeInterfaceOperationInputs,
- propertyAssignments)
-
- }
-
-
- override fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String,
- interfaceName: String,
- operationName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateInterfaceOperationOutputs for node template ($nodeTemplateName),interface name " +
- "($interfaceName), operationName($operationName)")
-
- val propertyAssignments: MutableMap<String, JsonNode> =
- bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
- ?: hashMapOf()
-
- val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
-
- val nodeTypeInterfaceOperationOutputs: MutableMap<String, PropertyDefinition> =
- bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName)
- ?: hashMapOf()
- /**
- * Resolve the Property Output Assignment Values.
- */
- val propertyAssignmentValue = resolveNodeTemplatePropertyAssignments(nodeTemplateName,
- nodeTypeInterfaceOperationOutputs, propertyAssignments)
-
- // Store operation output values into context
- propertyAssignmentValue.forEach { key, value ->
- setNodeTemplateOperationOutputValue(nodeTemplateName, interfaceName, operationName, key, value)
- }
- return propertyAssignmentValue
- }
-
- override fun resolveNodeTemplateArtifact(nodeTemplateName: String, artifactName: String): String {
- val artifactDefinition: ArtifactDefinition = resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
- val propertyAssignmentExpression = PropertyAssignmentService(this)
- return propertyAssignmentExpression.artifactContent(artifactDefinition)
- }
-
- override fun resolveNodeTemplateArtifactDefinition(nodeTemplateName: String, artifactName: String): ArtifactDefinition {
- val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
-
- return nodeTemplate.artifacts?.get(artifactName)
- ?: throw BluePrintProcessorException("failed to get artifat definition($artifactName) from the node " +
- "template")
-
- }
-
- /**
- * Read the DSL Property reference, If there is any expression, then resolve those expression and return as Json
- * Type
- */
- override fun resolveDSLExpression(dslPropertyName: String): JsonNode {
- val propertyAssignments = bluePrintContext.dslPropertiesByName(dslPropertyName)
- return if (BluePrintExpressionService.checkContainsExpression(propertyAssignments)
- && propertyAssignments is ObjectNode) {
-
- val rootKeyMap = propertyAssignments.rootFieldsToMap()
- val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
- rootKeyMap.forEach { propertyName, propertyValue ->
- val propertyAssignmentExpression = PropertyAssignmentService(this)
- propertyAssignmentValue[propertyName] = propertyAssignmentExpression
- .resolveAssignmentExpression("DSL", propertyName, propertyValue)
- }
- propertyAssignmentValue.asJsonNode()
- } else {
- propertyAssignments
- }
- }
-
- override fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode) {
- val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- log.trace("setting input path ({}), values ({})", path, value)
- put(path, value)
- }
-
- override fun setWorkflowInputValue(workflowName: String, propertyName: String,
- propertyDefinition: PropertyDefinition, value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS)
- .append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- put(path, value)
- }
-
- override fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode) {
-
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- put(path, value)
- }
-
- override fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode) {
-
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
- .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
- put(path, value)
- }
-
- override fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
- value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- log.trace("setting operation property path ({}), values ({})", path, value)
- put(path, value)
- }
-
- override fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String,
- value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- put(path, value)
- }
-
- override fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String,
- value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- put(path, value)
- }
-
-
- override fun getInputValue(propertyName: String): JsonNode {
- val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- return getJsonNode(path)
- }
-
- override fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- return getJsonNode(path)
- }
-
- override fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- return getJsonNode(path)
- }
-
- override fun getNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
- .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
- return getJsonNode(path)
- }
-
- override fun assignInputs(jsonNode: JsonNode) {
- log.info("assignInputs from input JSON ({})", jsonNode.toString())
- bluePrintContext.inputs()?.forEach { propertyName, property ->
- val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
- ?: NullNode.getInstance()
- setInputValue(propertyName, property, valueNode)
- }
- }
-
- override fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode) {
- log.info("assign workflow {} input value ({})", workflowName, jsonNode.toString())
-
- val dynamicInputPropertiesName = "$workflowName-properties"
-
- bluePrintContext.workflowByName(workflowName).inputs?.forEach { propertyName, property ->
- if (propertyName != dynamicInputPropertiesName) {
- val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
- ?: NullNode.getInstance()
- setInputValue(propertyName, property, valueNode)
- }
- }
- // Load Dynamic data Types
- val workflowDynamicInputs: JsonNode? = jsonNode.get(dynamicInputPropertiesName)
-
- workflowDynamicInputs?.let {
- bluePrintContext.dataTypeByName("dt-$dynamicInputPropertiesName")?.properties?.forEach { propertyName, property ->
- val valueNode: JsonNode = workflowDynamicInputs.at(BluePrintConstants.PATH_DIVIDER + propertyName)
- ?: NullNode.getInstance()
- setInputValue(propertyName, property, valueNode)
-
- }
- }
- }
-
- override fun resolveWorkflowOutputs(workflowName: String): MutableMap<String, JsonNode> {
- log.info("resolveWorkflowOutputs for workflow($workflowName)")
- val outputs = bluePrintContext.workflowByName(workflowName).outputs ?: mutableMapOf()
- return resolvePropertyDefinitions("WORKFLOW", outputs)
- }
-
- override fun getJsonForNodeTemplateAttributeProperties(nodeTemplateName: String, keys: List<String>): JsonNode {
-
- val jsonNode: ObjectNode = jacksonObjectMapper().createObjectNode()
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
- .append(BluePrintConstants.PATH_DIVIDER).toString()
- store.keys.filter {
- it.startsWith(path)
- }.map {
- val key = it.replace(path, "")
- if (keys.contains(key)) {
- val value = store[it] as JsonNode
- jsonNode.set(key, value)
- }
- }
- return jsonNode
- }
-
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateService.kt
deleted file mode 100644
index 4fa69cad..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateService.kt
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-import com.fasterxml.jackson.core.io.CharTypes
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.ObjectMapper
-import com.fasterxml.jackson.databind.node.JsonNodeFactory
-import com.fasterxml.jackson.databind.node.TextNode
-import org.apache.commons.lang3.BooleanUtils
-import org.apache.commons.lang3.StringUtils
-import org.apache.velocity.VelocityContext
-import org.apache.velocity.app.Velocity
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import java.io.StringWriter
-
-open class BluePrintTemplateService {
-
- companion object {
-
- /**
- * Generate Content from Velocity Template and JSON Content or property map.
- */
- fun generateContent(template: String, json: String = "",
- ignoreJsonNull: Boolean = false,
- additionalContext: Map<String, Any> = hashMapOf()): String {
- Velocity.init()
- val mapper = ObjectMapper()
- val nodeFactory = BluePrintJsonNodeFactory()
- mapper.nodeFactory = nodeFactory
-
- val velocityContext = VelocityContext()
- velocityContext.put("StringUtils", StringUtils::class.java)
- velocityContext.put("BooleanUtils", BooleanUtils::class.java)
-
- // Add the Custom Velocity Context API
- additionalContext.forEach { name, value -> velocityContext.put(name, value) }
-
- // Add the JSON Data to the context
- if (json.isNotEmpty()) {
- val jsonNode = mapper.readValue<JsonNode>(json, JsonNode::class.java)
- ?: throw BluePrintProcessorException("couldn't get json node from json")
- if (ignoreJsonNull)
- JacksonUtils.removeJsonNullNode(jsonNode)
- jsonNode.fields().forEach { entry ->
- velocityContext.put(entry.key, entry.value)
- }
- }
-
- val stringWriter = StringWriter()
- Velocity.evaluate(velocityContext, stringWriter, "TemplateData", template)
- stringWriter.flush()
- return stringWriter.toString()
- }
- }
-}
-
-/**
- * Customise JsonNodeFactory adn TextNode, Since it introduces quotes for string data.
- */
-open class BluePrintJsonNodeFactory : JsonNodeFactory() {
- override fun textNode(text: String): TextNode {
- return BluePrintTextNode(text)
- }
-}
-
-open class BluePrintTextNode(v: String) : TextNode(v) {
- override fun toString(): String {
- var len = this._value.length
- len = len + 2 + (len shr 4)
- val sb = StringBuilder(len)
- CharTypes.appendQuoted(sb, this._value)
- return sb.toString()
- }
-
-}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
deleted file mode 100644
index 06602a17..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
+++ /dev/null
@@ -1,608 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-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.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-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>)
-}
-
-@Deprecated("Decomposed implementation moved to blueprint-validation module")
-open class BluePrintValidatorDefaultService : BluePrintValidatorService {
-
- val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintValidatorDefaultService::class.toString())
-
- lateinit var bluePrintContext: BluePrintContext
- lateinit var serviceTemplate: ServiceTemplate
- lateinit var properties: MutableMap<String, Any>
- var message: StringBuilder = StringBuilder()
- private val separator: String = BluePrintConstants.PATH_DIVIDER
- 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) {
- log.error("validation failed in the path : {}", paths.joinToString(separator), e)
- log.error("validation trace message :{} ", message)
- throw BluePrintException(e,
- format("failed to validate blueprint on path ({}) with message {}"
- , paths.joinToString(separator), e.message))
- }
- }
-
- @Throws(BluePrintException::class)
- open fun validateMetadata(metaDataMap: MutableMap<String, String>) {
- paths.add("metadata")
-
- val templateName = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_NAME]
- val templateVersion = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_VERSION]
- val templateTags = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_TAGS]
- val templateAuthor = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]
-
- Preconditions.checkArgument(StringUtils.isNotBlank(templateName), "failed to get template name metadata")
- Preconditions.checkArgument(StringUtils.isNotBlank(templateVersion), "failed to get template version metadata")
- Preconditions.checkArgument(StringUtils.isNotBlank(templateTags), "failed to get template tags metadata")
- Preconditions.checkArgument(StringUtils.isNotBlank(templateAuthor), "failed to get template author 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(separator))
- 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("--> DataType :" + paths.joinToString(separator))
- 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(separator))
- val derivedFrom: String = nodeType.derivedFrom
- //Check Derived From
- checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
-
- if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
- serviceTemplate.nodeTypes?.get(derivedFrom)
- ?: throw BluePrintException(format("Failed to get derivedFrom NodeType({})'s for NodeType({}) ",
- derivedFrom, nodeTypeName))
- }
-
- nodeType.properties?.let { validatePropertyDefinitions(nodeType.properties!!) }
- nodeType.capabilities?.let { validateCapabilityDefinitions(nodeTypeName, nodeType) }
- nodeType.requirements?.let { validateRequirementDefinitions(nodeTypeName, nodeType) }
- nodeType.interfaces?.let { validateInterfaceDefinitions(nodeType.interfaces!!) }
- paths.removeAt(paths.lastIndex)
- }
-
- @Throws(BluePrintException::class)
- open fun checkValidNodeTypesDerivedFrom(nodeTypeName: String, derivedFrom: String) {
- check(BluePrintTypes.validNodeTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException(format("Failed to get node type ({})'s derivedFrom({}) definition ", nodeTypeName, derivedFrom))
- }
- }
-
- @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(separator))
- 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("---> NodeTemplate :" + paths.joinToString(separator))
- val type: String = nodeTemplate.type
-
- val nodeType: NodeType = serviceTemplate.nodeTypes?.get(type)
- ?: throw BluePrintException(format("Failed to get NodeType({}) definition for NodeTemplate({})", type, nodeTemplateName))
-
- nodeTemplate.artifacts?.let { validateArtifactDefinitions(nodeTemplate.artifacts!!) }
- nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) }
- nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeType, nodeTemplateName, nodeTemplate) }
- nodeTemplate.requirements?.let { validateRequirementAssignments(nodeType, nodeTemplateName, nodeTemplate) }
- nodeTemplate.interfaces?.let { validateInterfaceAssignments(nodeType, nodeTemplateName, nodeTemplate) }
- paths.removeAt(paths.lastIndex)
- }
-
- @Throws(BluePrintException::class)
- open fun validateArtifactDefinitions(artifacts: MutableMap<String, ArtifactDefinition>) {
- paths.add("artifacts")
- artifacts.forEach { artifactDefinitionName, artifactDefinition ->
- paths.add(artifactDefinitionName)
- message.appendln("Validating artifact " + paths.joinToString(separator))
- val type: String = artifactDefinition.type
- ?: throw BluePrintException(format("type is missing for ArtifactDefinition({})", artifactDefinitionName))
- // Check Artifact Type
- checkValidArtifactType(artifactDefinitionName, type)
-
- val file: String = artifactDefinition.file
- ?: throw BluePrintException(format("file is missing for ArtifactDefinition({})", artifactDefinitionName))
-
- paths.removeAt(paths.lastIndex)
- }
- 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(separator))
- // Step Validation Start
- paths.add("steps")
- workflow.steps?.forEach { stepName, _ ->
- paths.add(stepName)
- message.appendln("----> Steps :" + paths.joinToString(separator))
- 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
- when {
- BluePrintTypes.validPrimitiveTypes().contains(dataType) -> {
- // Do Nothing
- }
- BluePrintTypes.validCollectionTypes().contains(dataType) -> {
- val entrySchemaType: String = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, propertyName))
- checkPrimitiveOrComplex(entrySchemaType, propertyName)
- }
- else -> checkPropertyDataType(dataType, propertyName)
- }
- message.appendln("property " + paths.joinToString(separator) + " 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))
-
- validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
-
- }
- }
-
- @Throws(BluePrintException::class)
- open fun validatePropertyAssignment(propertyName: String, propertyDefinition: PropertyDefinition,
- propertyAssignment: JsonNode) {
- // Check and Validate if Expression Node
- val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment)
- if (!expressionData.isExpression) {
- checkPropertyValue(propertyName, propertyDefinition, propertyAssignment)
- }
- }
-
- @Throws(BluePrintException::class)
- open fun validateCapabilityAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
- val capabilities = nodeTemplate.capabilities
- paths.add("capabilities")
- capabilities?.forEach { capabilityName, capabilityAssignment ->
- paths.add(capabilityName)
-
- val capabilityDefinition = nodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) capability definition ({}) " +
- "from NodeType({}) ", nodeTemplateName, capabilityName, nodeTemplate.type))
-
- validateCapabilityAssignment(nodeTemplateName, capabilityName, capabilityDefinition, capabilityAssignment)
-
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- @Throws(BluePrintException::class)
- open fun validateCapabilityAssignment(nodeTemplateName: String, capabilityName: String,
- capabilityDefinition: CapabilityDefinition, capabilityAssignment: CapabilityAssignment) {
-
- capabilityAssignment.properties?.let { validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!) }
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateRequirementAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
- val requirements = nodeTemplate.requirements
- paths.add("requirements")
- requirements?.forEach { requirementName, requirementAssignment ->
- paths.add(requirementName)
- val requirementDefinition = nodeType.requirements?.get(requirementName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) requirement definition ({}) from" +
- " NodeType({}) ", nodeTemplateName, requirementName, nodeTemplate.type))
- // Validate Requirement Assignment
- validateRequirementAssignment(nodeTemplateName, requirementName, requirementDefinition, requirementAssignment)
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String,
- requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) {
- log.info("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName, requirementAssignmentName)
- val requirementNodeTemplateName = requirementAssignment.node!!
- val capabilityName = requirementAssignment.capability
- val relationship = requirementAssignment.relationship!!
-
- check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
- throw BluePrintException(format("Failed to get relationship type ({}) for NodeTemplate({})'s requirement({}) ",
- relationship, nodeTemplateName, requirementAssignmentName))
- }
-
- val relationShipNodeTemplate = serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
- ?: throw BluePrintException(format("Failed to get requirement NodeTemplate({})'s for NodeTemplate({}) requirement({}) ",
- requirementNodeTemplateName, nodeTemplateName, requirementAssignmentName))
-
- relationShipNodeTemplate.capabilities?.get(capabilityName)
- ?: throw BluePrintException(format("Failed to get requirement NodeTemplate({})'s capability({}) for NodeTemplate ({})'s requirement({}) ",
- requirementNodeTemplateName, capabilityName, nodeTemplateName, requirementAssignmentName))
-
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateInterfaceAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
-
- val interfaces = nodeTemplate.interfaces
- paths.add("interfaces")
- interfaces?.forEach { interfaceAssignmentName, interfaceAssignment ->
- paths.add(interfaceAssignmentName)
- val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) interface definition ({}) from" +
- " NodeType({}) ", nodeTemplateName, interfaceAssignmentName, nodeTemplate.type))
-
- validateInterfaceAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
-
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateInterfaceAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
-
- val operations = interfaceAssignment.operations
- operations?.let {
- validateInterfaceOperationsAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
- }
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateInterfaceOperationsAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
-
- val operations = interfaceAssignment.operations
- operations?.let {
- it.forEach { operationAssignmentName, operationAssignments ->
-
- val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) ",
- nodeTemplateName, operationAssignmentName))
-
- log.info("Validation NodeTemplate({}) Interface({}) Operation ({})", nodeTemplateName,
- interfaceAssignmentName, operationAssignmentName)
-
- val inputs = operationAssignments.inputs
- val outputs = operationAssignments.outputs
-
- inputs?.forEach { propertyName, propertyAssignment ->
- val propertyDefinition = operationDefinition.inputs?.get(propertyName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) " +
- "property definition({})", nodeTemplateName, operationAssignmentName, propertyName))
- // Check the property values with property definition
- validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
- }
-
- outputs?.forEach { propertyName, propertyAssignment ->
- val propertyDefinition = operationDefinition.outputs?.get(propertyName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) " +
- "output property definition({})", nodeTemplateName, operationAssignmentName,
- propertyName))
- // Check the property values with property definition
- validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
- }
-
- }
- }
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateCapabilityDefinitions(nodeTypeName: String, nodeType: NodeType) {
- val capabilities = nodeType.capabilities
- paths.add("capabilities")
- capabilities?.forEach { capabilityName, capabilityDefinition ->
- paths.add(capabilityName)
-
- validateCapabilityDefinition(nodeTypeName, nodeType, capabilityName, capabilityDefinition)
-
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- @Throws(BluePrintException::class)
- open fun validateCapabilityDefinition(nodeTypeName: String, nodeType: NodeType, capabilityName: String,
- capabilityDefinition: CapabilityDefinition) {
- val capabilityType = capabilityDefinition.type
- check(BluePrintTypes.validCapabilityTypes.contains(capabilityType)) {
- throw BluePrintException(format("Failed to get CapabilityType({}) for NodeType({})",
- capabilityType, nodeTypeName))
- }
- }
-
- @Throws(BluePrintException::class)
- open fun validateRequirementDefinitions(nodeName: String, nodeType: NodeType) {
- paths.add("requirements")
- val requirements = nodeType.requirements
-
- requirements?.forEach { requirementDefinitionName, requirementDefinition ->
- paths.add(requirementDefinitionName)
- message.appendln("Validating : " + paths.joinToString(separator))
- validateRequirementDefinition(nodeName, nodeType, requirementDefinitionName, requirementDefinition)
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- @Throws(BluePrintException::class)
- open fun validateRequirementDefinition(nodeTypeName: String, nodeType: NodeType, requirementDefinitionName: String,
- requirementDefinition: RequirementDefinition) {
-
- log.info("Validating NodeType({}) RequirementDefinition ({}) ", nodeTypeName, requirementDefinitionName)
- val requirementNodeTypeName = requirementDefinition.node!!
- val capabilityName = requirementDefinition.capability
- val relationship = requirementDefinition.relationship!!
-
- check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
- throw BluePrintException(format("Failed to get relationship({}) for NodeType({})'s requirement({}) ",
- relationship, nodeTypeName, requirementDefinitionName))
- }
-
- val relationShipNodeType = serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
- ?: throw BluePrintException(format("Failed to get requirement NodeType({})'s for requirement({}) ",
- requirementNodeTypeName, requirementDefinitionName))
-
- relationShipNodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException(format("Failed to get requirement NodeType({})'s capability({}) for NodeType ({})'s requirement({}) ",
- requirementNodeTypeName, capabilityName, nodeTypeName, requirementDefinitionName))
-
- }
-
-
- @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(separator))
- 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(separator))
- 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) {
- checkNotEmptyOrThrow(implementation.primary)
- }
-
- @Throws(BluePrintException::class)
- open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) {
-
- val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: throw BluePrintException("failed to artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
-
- checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
- }
-
- @Throws(BluePrintException::class)
- open fun checkValidArtifactTypeDerivedFrom(artifactTypeName: String, derivedFrom: String) {
- check(BluePrintTypes.validArtifactTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException("failed to get artifactType($artifactTypeName)'s derivedFrom($derivedFrom) definition")
- }
- }
-
- @Throws(BluePrintException::class)
- open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) {
- check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException(format("Failed to get DataType({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom))
- }
- }
-
- @Throws(BluePrintException::class)
- open fun checkValidRelationshipTypeDerivedFrom(relationshipTypeName: String, derivedFrom: String) {
- check(BluePrintTypes.validRelationShipDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException(format("Failed to get relationship type ({})'s derivedFrom({}) definition ", relationshipTypeName, derivedFrom))
- }
- }
-
- open fun checkPropertyValue(propertyName: String, propertyDefinition: PropertyDefinition, propertyAssignment: JsonNode) {
- val propertyType = propertyDefinition.type
- val isValid: Boolean
-
- if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
- isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment)
-
- } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
-
- val entrySchemaType = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
-
- if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) {
- checkPropertyDataType(entrySchemaType, propertyName)
- }
- isValid = JacksonUtils.checkJsonNodeValueOfCollectionType(propertyType, propertyAssignment)
- } else {
- checkPropertyDataType(propertyType, propertyName)
- isValid = true
- }
-
- check(isValid) {
- throw BluePrintException(format("property({}) defined of type({}) is not comptable with the value ({})",
- propertyName, propertyType, propertyAssignment))
- }
- }
-
- private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
-
- val dataType = serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
-
- checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
-
- }
-
- private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean {
- if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
- return true
- } else {
- throw BluePrintException(format("DataType({}) for the property({}) is not valid", dataType, propertyName))
- }
- }
-
- private fun checkDataType(key: String): Boolean {
- return serviceTemplate.dataTypes?.containsKey(key) ?: false
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt
deleted file mode 100644
index 62a7b09e..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-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.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.format
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JsonParserUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.ResourceResolverUtils
-
-/**
- *
- *
- * @author Brinda Santh
- */
-class PropertyAssignmentService(var bluePrintRuntimeService: BluePrintRuntimeService<MutableMap<String, JsonNode>>) {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- private var bluePrintContext: BluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
-/*
-
-If Property Assignment is Expression.
- Get the Expression
- Recursively resolve the expression
- */
-
- fun resolveAssignmentExpression(nodeTemplateName: String, assignmentName: String,
- assignment: JsonNode): JsonNode {
- val valueNode: JsonNode
- log.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) {
- BluePrintConstants.EXPRESSION_GET_INPUT -> {
- valueNode = bluePrintRuntimeService.getInputValue(expressionData.inputExpression?.propertyName!!)
- }
- BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> {
- valueNode = resolveAttributeExpression(nodeTemplateName, expressionData.attributeExpression!!)
- }
- BluePrintConstants.EXPRESSION_GET_PROPERTY -> {
- valueNode = resolvePropertyExpression(nodeTemplateName, expressionData.propertyExpression!!)
- }
- BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> {
- valueNode = resolveOperationOutputExpression(nodeTemplateName, expressionData.operationOutputExpression!!)
- }
- BluePrintConstants.EXPRESSION_GET_ARTIFACT -> {
- valueNode = resolveArtifactExpression(nodeTemplateName, expressionData.artifactExpression!!)
- }
- BluePrintConstants.EXPRESSION_DSL_REFERENCE -> {
- valueNode = bluePrintRuntimeService.resolveDSLExpression(expressionData.dslExpression!!.propertyName)
- }
- BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE -> {
-
- }
- else -> {
- throw BluePrintException(format("for property ({}), command ({}) is not supported ", propName, command))
- }
- }
- }
- return valueNode
- }
-
- /*
- get_attribute: [ <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
-
- val attributeName = attributeExpression.attributeName
- val subAttributeName: String? = attributeExpression.subAttributeName
-
- var attributeNodeTemplateName = nodeTemplateName
- /**
- * Attributes are dynamic runtime properties information. There are multiple types of Attributes,
- * ENV : Environment Variables
- * APP : Application properties ( ie Spring resolved properties )
- * BPP : Blueprint Properties, Specific to Blue Print execution.
- * SELF : Current Node Template properties.
- */
- when (attributeExpression.modelableEntityName) {
- BluePrintConstants.PROPERTY_ENV -> {
- val environmentValue = System.getProperty(attributeName)
- valueNode = environmentValue.asJsonPrimitive()
- }
- BluePrintConstants.PROPERTY_APP -> {
- TODO("Get property from application properties")
- }
- BluePrintConstants.PROPERTY_BPP -> {
- valueNode = bluePrintRuntimeService.getNodeTemplateAttributeValue(BluePrintConstants.PROPERTY_BPP, attributeName)
- ?: throw BluePrintException("failed to get env attribute name ($attributeName) ")
- }
- else -> {
- if (!attributeExpression.modelableEntityName.equals(BluePrintConstants.PROPERTY_SELF, true)) {
- attributeNodeTemplateName = attributeExpression.modelableEntityName
- }
-
- var attributeDefinition: AttributeDefinition = bluePrintContext
- .nodeTemplateNodeType(attributeNodeTemplateName).attributes?.get(attributeName)
- ?: throw BluePrintException("failed to get attribute definitions for node template ($attributeNodeTemplateName)'s attribute name ($attributeName) ")
-
- valueNode = bluePrintRuntimeService.getNodeTemplateAttributeValue(attributeNodeTemplateName, attributeName)
- ?: throw BluePrintException("failed to get node template ($attributeNodeTemplateName)'s attribute name ($attributeName) ")
- }
-
- }
- if (subAttributeName != null) {
- if (valueNode.isObject || valueNode.isArray)
- valueNode = JsonParserUtils.parse(valueNode, subAttributeName)
- }
- 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
-
- val propertyName = propertyExpression.propertyName
- val subPropertyName: String? = propertyExpression.subPropertyName
-
- var propertyNodeTemplateName = nodeTemplateName
-
- if (!propertyExpression.modelableEntityName.equals(BluePrintConstants.PROPERTY_SELF, true)) {
- propertyNodeTemplateName = propertyExpression.modelableEntityName
- }
-
- val nodeTemplatePropertyExpression = bluePrintContext.nodeTemplateByName(propertyNodeTemplateName).properties?.get(propertyName)
- ?: throw BluePrintException(format("failed to get property definitions for node template ({})'s property name ({}) ", nodeTemplateName, propertyName))
-
- var propertyDefinition: PropertyDefinition = bluePrintContext.nodeTemplateNodeType(propertyNodeTemplateName).properties?.get(propertyName)!!
-
- log.info("node template name ({}), property Name ({}) resolved value ({})", propertyNodeTemplateName, propertyName, nodeTemplatePropertyExpression)
-
- // Check it it is a nested expression
- valueNode = resolveAssignmentExpression(propertyNodeTemplateName, propertyName, nodeTemplatePropertyExpression)
-
- if (subPropertyName != null) {
- if (valueNode.isObject || valueNode.isArray)
- valueNode = JsonParserUtils.parse(valueNode, 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(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 = bluePrintContext.rootPath
-
- if (artifactDefinition.repository != null) {
- TODO()
- } else if (artifactDefinition.file != null) {
- return ResourceResolverUtils.getFileContent(artifactDefinition.file, bluePrintBasePath)
- }
- return ""
- }
-}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
deleted file mode 100755
index 1176f713..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.compress.archivers.zip.ZipArchiveEntry
-import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
-import org.apache.commons.io.IOUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.slf4j.LoggerFactory
-import java.io.BufferedInputStream
-import java.io.File
-import java.io.FileInputStream
-import java.io.IOException
-import java.nio.charset.Charset
-import java.util.zip.ZipFile
-
-class BluePrintArchiveUtils {
-
- companion object {
- private val log = LoggerFactory.getLogger(BluePrintArchiveUtils::class.java)
-
- /**
- * Create a new Zip from a root directory
- *
- * @param source the base directory
- * @param destination the output filename
- * @param absolute store absolute filepath (from directory) or only filename
- * @return True if OK
- */
- fun compress(source: File, destination: File, absolute: Boolean): Boolean {
- try {
- destination.createNewFile()
- ZipArchiveOutputStream(destination).use {
- recurseFiles(source, source, it, absolute)
- }
- } catch (e: Exception) {
- log.error("Fail to compress folder($source) to path(${destination.path})", e)
- return false
- }
- return true
- }
-
- /**
- * Recursive traversal to add files
- *
- * @param root
- * @param file
- * @param zaos
- * @param absolute
- * @throws IOException
- */
- @Throws(IOException::class)
- private fun recurseFiles(root: File, file: File, zaos: ZipArchiveOutputStream,
- absolute: Boolean) {
- if (file.isDirectory) {
- // recursive call
- val files = file.listFiles()
- for (fileChild in files!!) {
- recurseFiles(root, fileChild, zaos, absolute)
- }
- } else if (!file.name.endsWith(".zip") && !file.name.endsWith(".ZIP")) {
- val filename = if (absolute) {
- file.absolutePath.substring(root.absolutePath.length)
- } else {
- file.name
- }
- val zae = ZipArchiveEntry(filename)
- zae.size = file.length()
- zaos.putArchiveEntry(zae)
- FileInputStream(file).use {
- IOUtils.copy(it, zaos)
- it.close()
- }
- zaos.closeArchiveEntry()
- }
- }
-
-
- fun deCompress(zipFile: File, targetPath: String): File {
- val zip = ZipFile(zipFile, Charset.defaultCharset())
- val enumeration = zip.entries()
- while (enumeration.hasMoreElements()) {
- val entry = enumeration.nextElement()
- val destFilePath = File(targetPath, entry.name)
- destFilePath.parentFile.mkdirs()
-
- if (entry.isDirectory)
- continue
-
- val bufferedIs = BufferedInputStream(zip.getInputStream(entry))
- bufferedIs.use {
- destFilePath.outputStream().buffered(1024).use { bos ->
- bufferedIs.copyTo(bos)
- }
- }
- }
-
- val destinationDir = File(targetPath)
- check(destinationDir.isDirectory && destinationDir.exists()) {
- throw BluePrintProcessorException("failed to decompress blueprint(${zipFile.absolutePath}) to ($targetPath) ")
- }
-
- return destinationDir
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt
deleted file mode 100755
index 9746bf57..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import kotlinx.coroutines.runBlocking
-import org.apache.commons.io.FileUtils
-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.data.ErrorCode
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ImportDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import java.io.File
-import java.io.FileFilter
-import java.nio.file.Files
-import java.nio.file.Path
-import java.nio.file.Paths
-import java.nio.file.StandardOpenOption
-
-
-class BluePrintFileUtils {
- companion object {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- fun createEmptyBluePrint(basePath: String) {
-
- val blueprintDir = File(basePath)
- FileUtils.deleteDirectory(blueprintDir)
-
- Files.createDirectories(blueprintDir.toPath())
-
- val metaDataDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_METADATA_DIR))
- Files.createDirectories(metaDataDir.toPath())
-
- val metaFile = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants
- .TOSCA_METADATA_ENTRY_DEFINITION_FILE))
- Files.write(metaFile.toPath(), getMetaDataContent().toByteArray(), StandardOpenOption.CREATE_NEW)
-
- val definitionsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR))
- Files.createDirectories(definitionsDir.toPath())
-
- val scriptsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_SCRIPTS_DIR))
- Files.createDirectories(scriptsDir.toPath())
-
- val plansDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_PLANS_DIR))
- Files.createDirectories(plansDir.toPath())
-
- val templatesDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_TEMPLATES_DIR))
- Files.createDirectories(templatesDir.toPath())
-
- }
-
- fun copyBluePrint(sourcePath: String, targetPath: String) {
- val sourceFile = File(sourcePath)
- val targetFile = File(targetPath)
- sourceFile.copyRecursively(targetFile, true)
- }
-
- fun deleteBluePrintTypes(basePath: String) {
- val definitionPath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR)
- log.info("deleting definition types under : $definitionPath")
-
- val definitionDir = File(definitionPath)
- // Find the Type Definitions
- val fileFilter = FileFilter { pathname -> pathname.absolutePath.endsWith("_types.json") }
- // Delete the Type Files
- definitionDir.listFiles(fileFilter).forEach {
- Files.deleteIfExists(it.toPath())
- }
- }
-
- fun writeEnhancedBluePrint(blueprintContext: BluePrintContext) {
-
- // Write Blueprint Types
- writeBluePrintTypes(blueprintContext)
- // Re Populate the Imports
- populateDefaultImports(blueprintContext)
- // Rewrite the Entry Definition Files
- writeEntryDefinitionFile(blueprintContext)
-
- }
-
- fun writeBluePrintTypes(blueprintContext: BluePrintContext) {
-
- val basePath = blueprintContext.rootPath
- val definitionPath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR)
- val definitionDir = File(definitionPath)
-
- check(definitionDir.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
- "path(${definitionDir.absolutePath})")
- }
-
- blueprintContext.serviceTemplate.dataTypes?.let {
- val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, it.toSortedMap(), true)
- writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_DATA_TYPES, dataTypesContent)
- }
-
- blueprintContext.serviceTemplate.relationshipTypes?.let {
- val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_RELATIONSHIP_TYPES, it.toSortedMap(), true)
- writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_RELATIONSHIP_TYPES, nodeTypesContent)
- }
-
- blueprintContext.serviceTemplate.artifactTypes?.let {
- val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, it.toSortedMap(), true)
- writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent)
- }
-
- blueprintContext.serviceTemplate.nodeTypes?.let {
- val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, it.toSortedMap(), true)
- writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_NODE_TYPES, nodeTypesContent)
- }
-
- blueprintContext.serviceTemplate.policyTypes?.let {
- val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_POLICY_TYPES, it.toSortedMap(), true)
- writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_POLICY_TYPES, nodeTypesContent)
- }
- }
-
- private fun populateDefaultImports(blueprintContext: BluePrintContext) {
- // Get the Default Types
- val types = arrayListOf(BluePrintConstants.PATH_DATA_TYPES, BluePrintConstants.PATH_RELATIONSHIP_TYPES,
- BluePrintConstants.PATH_ARTIFACT_TYPES, BluePrintConstants.PATH_NODE_TYPES,
- BluePrintConstants.PATH_POLICY_TYPES)
-
- // Clean Type Imports
- cleanImportTypes(blueprintContext.serviceTemplate)
-
- val imports = mutableListOf<ImportDefinition>()
- types.forEach { typeName ->
- val import = ImportDefinition()
- import.file = BluePrintConstants.TOSCA_DEFINITIONS_DIR.plus("/$typeName.json")
- imports.add(import)
- }
-
- blueprintContext.serviceTemplate.imports = imports
- }
-
- fun cleanImportTypes(serviceTemplate: ServiceTemplate) {
- // Clean the Type imports
- val toDeleteTypes = serviceTemplate.imports?.filter {
- it.file.endsWith("_types.json")
- }
-
- if (toDeleteTypes != null && toDeleteTypes.isNotEmpty()) {
- serviceTemplate.imports?.removeAll(toDeleteTypes)
- }
- }
-
- /**
- * Re Generate the Blueprint Service Template Definition file based on BluePrint Context.
- */
- private fun writeEntryDefinitionFile(blueprintContext: BluePrintContext) {
-
- val absoluteEntryDefinitionFile = blueprintContext.rootPath.plus(File.separator).plus(blueprintContext.entryDefinition)
-
- val serviceTemplate = blueprintContext.serviceTemplate
-
- // Clone the Service Template
- val writeServiceTemplate = serviceTemplate.clone()
- writeServiceTemplate.dataTypes = null
- writeServiceTemplate.artifactTypes = null
- writeServiceTemplate.policyTypes = null
- writeServiceTemplate.relationshipTypes = null
- writeServiceTemplate.nodeTypes = null
-
- // Write the Service Template
- writeDefinitionFile(absoluteEntryDefinitionFile, JacksonUtils.getJson(writeServiceTemplate, true))
- }
-
- fun writeDefinitionFile(definitionFileName: String, content: String) = runBlocking {
- val definitionFile = File(definitionFileName)
- // Delete the File If exists
- Files.deleteIfExists(definitionFile.toPath())
-
- Files.write(definitionFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW)
- check(definitionFile.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write definition file under " +
- "path(${definitionFile.absolutePath})")
- }
- }
-
- private fun writeTypeFile(definitionPath: String, type: String, content: String) = runBlocking {
- val typeFile = File(definitionPath.plus(File.separator).plus("$type.json"))
-
- Files.write(typeFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW)
- check(typeFile.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write $type.json file under " +
- "path(${typeFile.absolutePath})")
- }
- }
-
- private fun getMetaDataContent(): String {
- return "TOSCA-Meta-File-Version: 1.0.0" +
- "\nCSAR-Version: <VERSION>" +
- "\nCreated-By: <AUTHOR NAME>" +
- "\nEntry-Definitions: Definitions/<BLUEPRINT_NAME>.json" +
- "\nTemplate-Tags: <TAGS>"
- }
-
-
- fun getBluePrintFile(fileName: String, targetPath: Path) : File {
- val filePath = targetPath.resolve(fileName).toString()
- val file = File(filePath)
- check(file.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
- "path(${file.absolutePath})")
- }
- return file
- }
-
- fun getCbaStorageDirectory(path: String): Path {
- check(StringUtils.isNotBlank(path)) {
- throw BluePrintException(ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get " +
- "Blueprint folder under path($path)")
- }
-
- val fileStorageLocation = Paths.get(path).toAbsolutePath().normalize()
-
- if (!Files.exists(fileStorageLocation))
- Files.createDirectories(fileStorageLocation)
-
- return fileStorageLocation
- }
-
- fun stripFileExtension(fileName: String): String {
- val dotIndexe = fileName.lastIndexOf('.')
-
- // In case dot is in first position, we are dealing with a hidden file rather than an extension
- return if (dotIndexe > 0) fileName.substring(0, dotIndexe) else fileName
- }
-
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
deleted file mode 100644
index 8ba2e275..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.fasterxml.jackson.databind.JsonNode
-import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ToscaMetaData
-import org.onap.ccsdk.apps.controllerblueprints.core.normalizedFile
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintImportService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.DefaultBluePrintRuntimeService
-import java.io.File
-import java.nio.charset.Charset
-import java.util.*
-
-class BluePrintMetadataUtils {
- companion object {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
-
- fun toscaMetaData(basePath: String): ToscaMetaData {
- val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)
- return toscaMetaDataFromMetaFile(toscaMetaPath)
- }
-
- fun entryDefinitionFile(basePath: String): String {
- val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)
- return toscaMetaDataFromMetaFile(toscaMetaPath).entityDefinitions
- }
-
- fun bluePrintEnvProperties(basePath: String): Properties {
- val blueprintsEnvFilePath = basePath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
- return environmentFileProperties(blueprintsEnvFilePath)
- }
-
- fun environmentFileProperties(pathName: String): Properties {
- val properties = Properties()
- val envDir = File(pathName)
- // Verify if the environment directory exists
- if (envDir.exists() && envDir.isDirectory) {
- //Find all available environment files
- envDir.listFiles()
- .filter { it.name.endsWith(".properties") }
- .forEach {
- properties.load(it.inputStream())
- }
- }
- return properties
- }
-
- fun toscaMetaDataFromMetaFile(metaFilePath: String): ToscaMetaData {
- val toscaMetaData = ToscaMetaData()
- val lines = normalizedFile(metaFilePath).readLines(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 getBluePrintRuntime(id: String, blueprintBasePath: String): BluePrintRuntimeService<MutableMap<String, JsonNode>> {
-
- val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath)
-
- val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext)
- bluePrintRuntimeService.put(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH, blueprintBasePath.asJsonPrimitive())
- bluePrintRuntimeService.put(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID, id.asJsonPrimitive())
-
- return bluePrintRuntimeService
- }
-
- suspend fun getBaseEnhancementBluePrintRuntime(id: String, blueprintBasePath: String)
- : BluePrintRuntimeService<MutableMap<String, JsonNode>> {
-
- val bluePrintContext: BluePrintContext = getBaseEnhancementBluePrintContext(blueprintBasePath)
-
- val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext)
- bluePrintRuntimeService.put(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH, blueprintBasePath.asJsonPrimitive())
- bluePrintRuntimeService.put(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID, id.asJsonPrimitive())
-
- return bluePrintRuntimeService
- }
-
- fun getBluePrintRuntime(id: String, blueprintBasePath: String, executionContext: MutableMap<String, JsonNode>):
- BluePrintRuntimeService<MutableMap<String, JsonNode>> {
- val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath)
- val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext)
- executionContext.forEach {
- bluePrintRuntimeService.put(it.key, it.value)
- }
-
- bluePrintRuntimeService.setExecutionContext(executionContext)
- return bluePrintRuntimeService
- }
-
- fun getBluePrintContext(blueprintBasePath: String): BluePrintContext = runBlocking {
-
- val toscaMetaData: ToscaMetaData = toscaMetaData(blueprintBasePath)
-
- log.info("Reading blueprint path($blueprintBasePath) and entry definition file (${toscaMetaData.entityDefinitions})")
-
- readBlueprintFile(toscaMetaData.entityDefinitions, blueprintBasePath)
- }
-
- private suspend fun getBaseEnhancementBluePrintContext(blueprintBasePath: String): BluePrintContext {
- val toscaMetaData: ToscaMetaData = toscaMetaData(blueprintBasePath)
- // Clean Type files
- BluePrintFileUtils.deleteBluePrintTypes(blueprintBasePath)
- val rootFilePath: String = blueprintBasePath.plus(File.separator).plus(toscaMetaData.entityDefinitions)
- val rootServiceTemplate = ServiceTemplateUtils.getServiceTemplate(rootFilePath)
-
- // Clean the Import Definitions
- BluePrintFileUtils.cleanImportTypes(rootServiceTemplate)
-
- val blueprintContext = BluePrintContext(rootServiceTemplate)
- blueprintContext.rootPath = blueprintBasePath
- blueprintContext.entryDefinition = toscaMetaData.entityDefinitions
- return blueprintContext
- }
-
- private suspend fun readBlueprintFile(entityDefinitions: String, basePath: String): BluePrintContext {
- val rootFilePath: String = basePath.plus(File.separator).plus(entityDefinitions)
- val rootServiceTemplate = ServiceTemplateUtils.getServiceTemplate(rootFilePath)
- // Recursively Import Template files
- val schemaImportResolverUtils = BluePrintImportService(rootServiceTemplate, basePath)
- val completeServiceTemplate = schemaImportResolverUtils.getImportResolvedServiceTemplate()
- val blueprintContext = BluePrintContext(completeServiceTemplate)
- blueprintContext.rootPath = basePath
- blueprintContext.entryDefinition = entityDefinitions
- return blueprintContext
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
deleted file mode 100644
index d20fc553..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-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
-
-/**
- *
- *
- * @author Brinda Santh
- */
-object BluePrintRuntimeUtils {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- fun assignInputsFromFile(bluePrintContext: BluePrintContext, fileName: String, context: MutableMap<String, JsonNode>) {
- val jsonNode: JsonNode = JacksonUtils.jsonNodeFromFile(fileName)
- return assignInputs(bluePrintContext, jsonNode, context)
- }
-
- fun assignInputsFromClassPathFile(bluePrintContext: BluePrintContext, fileName: String, context: MutableMap<String,
- JsonNode>) {
- val jsonNode = JacksonUtils.jsonNodeFromClassPathFile(fileName)
- return assignInputs(bluePrintContext, jsonNode, context)
- }
-
- fun assignInputsFromContent(bluePrintContext: BluePrintContext, content: String, context: MutableMap<String, JsonNode>) {
- val jsonNode: JsonNode = JacksonUtils.jsonNode(content)
- return assignInputs(bluePrintContext, jsonNode, context)
- }
-
- fun assignInputs(bluePrintContext: BluePrintContext, jsonNode: JsonNode, context: MutableMap<String, JsonNode>) {
- log.info("assignInputs from input JSON ({})", jsonNode.toString())
- bluePrintContext.inputs()?.forEach { propertyName, _ ->
- val valueNode: JsonNode = jsonNode.at("/".plus(propertyName)) ?: NullNode.getInstance()
-
- val path = BluePrintConstants.PATH_INPUTS.plus(BluePrintConstants.PATH_DIVIDER).plus(propertyName)
- log.trace("setting input path ({}), values ({})", path, valueNode)
- context[path] = valueNode
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtils.kt
deleted file mode 100644
index 45d8fd4e..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtils.kt
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.fasterxml.jackson.databind.JsonNode
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.withContext
-import org.apache.commons.io.IOUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.normalizedFile
-import java.io.File
-import java.nio.charset.Charset
-
-class JacksonReactorUtils {
- companion object {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- suspend fun getContent(fileName: String): String {
- //log.info("Reading File($fileName)")
- return getContent(normalizedFile(fileName))
- }
-
- suspend fun getContent(file: File): String = withContext(Dispatchers.IO) {
- // log.info("Reading File(${file.absolutePath})")
- file.readText(Charsets.UTF_8)
- }
-
- suspend fun getClassPathFileContent(fileName: String): String = withContext(Dispatchers.IO) {
- //log.trace("Reading Classpath File($fileName)")
- IOUtils.toString(JacksonUtils::class.java.classLoader
- .getResourceAsStream(fileName), Charset.defaultCharset())
- }
-
- suspend fun <T> readValueFromFile(fileName: String, valueType: Class<T>): T? {
- val content: String = getContent(fileName)
- return JacksonUtils.readValue(content, valueType)
- }
-
- suspend fun <T> readValueFromClassPathFile(fileName: String, valueType: Class<T>): T? {
- val content: String = getClassPathFileContent(fileName)
- return JacksonUtils.readValue(content, valueType)
- }
-
- suspend fun jsonNodeFromClassPathFile(fileName: String): JsonNode {
- val content: String = getClassPathFileContent(fileName)
- return JacksonUtils.jsonNode(content)
- }
-
- suspend fun jsonNodeFromFile(fileName: String): JsonNode {
- val content: String = getContent(fileName)
- return JacksonUtils.jsonNode(content)
- }
-
- suspend fun <T> getListFromFile(fileName: String, valueType: Class<T>): List<T> {
- val content: String = getContent(fileName)
- return JacksonUtils.getListFromJson(content, valueType)
- }
-
- suspend fun <T> getListFromClassPathFile(fileName: String, valueType: Class<T>): List<T> {
- val content: String = getClassPathFileContent(fileName)
- return JacksonUtils.getListFromJson(content, valueType)
- }
-
- suspend fun <T> getMapFromFile(file: File, valueType: Class<T>): MutableMap<String, T> {
- val content: String = getContent(file)
- return JacksonUtils.getMapFromJson(content, valueType)
- }
-
- suspend fun <T> getMapFromClassPathFile(fileName: String, valueType: Class<T>): MutableMap<String, T> {
- val content: String = getClassPathFileContent(fileName)
- return JacksonUtils.getMapFromJson(content, valueType)
- }
-
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
deleted file mode 100644
index 7c515984..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.fasterxml.jackson.annotation.JsonInclude
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.SerializationFeature
-import com.fasterxml.jackson.databind.node.*
-import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.async
-import kotlinx.coroutines.runBlocking
-import kotlinx.coroutines.withContext
-import org.apache.commons.io.IOUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.*
-import java.io.File
-import java.nio.charset.Charset
-
-/**
- *
- *
- * @author Brinda Santh
- */
-class JacksonUtils {
- companion object {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
- inline fun <reified T : Any> readValue(content: String): T =
- jacksonObjectMapper().readValue(content, T::class.java)
-
- fun <T> readValue(content: String, valueType: Class<T>): T? {
- return jacksonObjectMapper().readValue(content, valueType)
- }
-
- fun <T> readValue(node: JsonNode, valueType: Class<T>): T? {
- return jacksonObjectMapper().treeToValue(node, valueType)
- }
-
- fun removeJsonNullNode(node: JsonNode) {
- val it = node.iterator()
- while (it.hasNext()) {
- val child = it.next()
- if (child.isNull) {
- it.remove()
- } else {
- removeJsonNullNode(child)
- }
- }
- }
-
-
- fun getContent(fileName: String): String = getContent(normalizedFile(fileName))
-
- fun getContent(file: File): String = runBlocking {
- async {
- try {
- file.readText(Charsets.UTF_8)
- } catch (e: Exception) {
- throw BluePrintException("couldn't get file (${file.absolutePath}) content : ${e.message}")
- }
- }.await()
- }
-
- fun getClassPathFileContent(fileName: String): String {
- return runBlocking {
- withContext(Dispatchers.Default) {
- IOUtils.toString(JacksonUtils::class.java.classLoader
- .getResourceAsStream(fileName), Charset.defaultCharset())
- }
- }
- }
-
- fun <T> readValueFromFile(fileName: String, valueType: Class<T>): T? {
- val content: String = getContent(fileName)
- return readValue(content, valueType)
- }
-
- fun <T> readValueFromClassPathFile(fileName: String, valueType: Class<T>): T? {
- val content: String = getClassPathFileContent(fileName)
- return readValue(content, valueType)
- }
-
- fun objectNodeFromObject(from: kotlin.Any): ObjectNode {
- return jacksonObjectMapper().convertValue(from, ObjectNode::class.java)
- }
-
- fun jsonNodeFromObject(from: kotlin.Any): JsonNode {
- return jacksonObjectMapper().convertValue(from, JsonNode::class.java)
- }
-
- fun jsonNodeFromClassPathFile(fileName: String): JsonNode {
- val content: String = getClassPathFileContent(fileName)
- return jsonNode(content)
- }
-
- fun jsonNodeFromFile(fileName: String): JsonNode {
- val content: String = getContent(fileName)
- return jsonNode(content)
- }
-
- fun jsonNode(content: String): JsonNode {
- return jacksonObjectMapper().readTree(content)
- }
-
- fun getJson(any: kotlin.Any): String {
- return getJson(any, false)
- }
-
- fun getWrappedJson(wrapper: String, any: kotlin.Any, pretty: Boolean = false): String {
- val wrapperMap = hashMapOf<String, Any>()
- wrapperMap[wrapper] = any
- return getJson(wrapperMap, pretty)
- }
-
- 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)
- }
-
- fun getJsonNode(any: kotlin.Any?, pretty: Boolean = false): JsonNode {
- val objectMapper = jacksonObjectMapper()
- objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
- if (pretty) {
- objectMapper.enable(SerializationFeature.INDENT_OUTPUT)
- }
- return objectMapper.valueToTree(any)
- }
-
- fun <T> getListFromJsonNode(node: JsonNode, valueType: Class<T>): List<T> {
- return getListFromJson(node.toString(), valueType)
- }
-
- 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)
- }
-
- fun <T> getListFromFile(fileName: String, valueType: Class<T>): List<T> {
- val content: String = getContent(fileName)
- return getListFromJson(content, valueType)
- }
-
- fun <T> getListFromClassPathFile(fileName: String, valueType: Class<T>): List<T> {
- val content: String = getClassPathFileContent(fileName)
- return getListFromJson(content, valueType)
- }
-
- fun <T> getMapFromJson(content: String, valueType: Class<T>): MutableMap<String, T> {
- val objectMapper = jacksonObjectMapper()
- val mapType = objectMapper.typeFactory.constructMapType(Map::class.java, String::class.java, valueType)
- return objectMapper.readValue(content, mapType)
- }
-
- fun <T> getMapFromFile(file: File, valueType: Class<T>): MutableMap<String, T> {
- val content: String = getContent(file)
- return getMapFromJson(content, valueType)
- }
-
- fun <T> getMapFromFile(fileName: String, valueType: Class<T>): MutableMap<String, T> = getMapFromFile(File(fileName), valueType)
-
- fun <T> getInstanceFromMap(properties: MutableMap<String, JsonNode>, classType: Class<T>): T {
- return readValue(getJson(properties), classType)
- ?: throw BluePrintProcessorException("failed to transform content ($properties) to type ($classType)")
- }
-
- fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean {
- if (BluePrintTypes.validPrimitiveTypes().contains(type.toLowerCase())) {
- return checkJsonNodeValueOfPrimitiveType(type, jsonNode)
- } else if (BluePrintTypes.validCollectionTypes().contains(type)) {
- return checkJsonNodeValueOfCollectionType(type, jsonNode)
- }
- return false
- }
-
- fun checkIfPrimitiveType(primitiveType: String): Boolean {
- return when (primitiveType.toLowerCase()) {
- BluePrintConstants.DATA_TYPE_STRING -> true
- BluePrintConstants.DATA_TYPE_BOOLEAN -> true
- BluePrintConstants.DATA_TYPE_INTEGER -> true
- BluePrintConstants.DATA_TYPE_FLOAT -> true
- BluePrintConstants.DATA_TYPE_DOUBLE -> true
- BluePrintConstants.DATA_TYPE_TIMESTAMP -> true
- else -> false
- }
- }
-
- fun checkJsonNodeValueOfPrimitiveType(primitiveType: String, jsonNode: JsonNode): Boolean {
- return when (primitiveType.toLowerCase()) {
- BluePrintConstants.DATA_TYPE_STRING -> jsonNode.isTextual
- BluePrintConstants.DATA_TYPE_BOOLEAN -> jsonNode.isBoolean
- BluePrintConstants.DATA_TYPE_INTEGER -> jsonNode.isInt
- BluePrintConstants.DATA_TYPE_FLOAT -> jsonNode.isDouble
- BluePrintConstants.DATA_TYPE_DOUBLE -> jsonNode.isDouble
- BluePrintConstants.DATA_TYPE_TIMESTAMP -> jsonNode.isTextual
- else -> false
- }
- }
-
- fun checkJsonNodeValueOfCollectionType(type: String, jsonNode: JsonNode): Boolean {
- return when (type.toLowerCase()) {
- BluePrintConstants.DATA_TYPE_LIST -> jsonNode.isArray
- BluePrintConstants.DATA_TYPE_MAP -> jsonNode.isContainerNode
- else -> false
- }
- }
-
- fun getValue(value: JsonNode): Any {
- return when (value) {
- is BooleanNode -> value.booleanValue()
- is IntNode -> value.intValue()
- is FloatNode -> value.floatValue()
- is DoubleNode -> value.doubleValue()
- is TextNode -> value.textValue()
- else -> value
- }
- }
-
- fun getValue(value: Any, type: String): Any {
- return when (type.toLowerCase()) {
- BluePrintConstants.DATA_TYPE_BOOLEAN -> (value as BooleanNode).booleanValue()
- BluePrintConstants.DATA_TYPE_INTEGER -> (value as IntNode).intValue()
- BluePrintConstants.DATA_TYPE_FLOAT -> (value as FloatNode).floatValue()
- BluePrintConstants.DATA_TYPE_DOUBLE -> (value as DoubleNode).doubleValue()
- BluePrintConstants.DATA_TYPE_STRING -> (value as TextNode).textValue()
- else -> (value as JsonNode)
- }
- }
-
- fun populatePrimitiveValues(key: String, value: Any, primitiveType: String, objectNode: ObjectNode) {
- when (primitiveType.toLowerCase()) {
- BluePrintConstants.DATA_TYPE_BOOLEAN -> objectNode.put(key, (value as BooleanNode).booleanValue())
- BluePrintConstants.DATA_TYPE_INTEGER -> objectNode.put(key, (value as IntNode).intValue())
- BluePrintConstants.DATA_TYPE_FLOAT -> objectNode.put(key, (value as FloatNode).floatValue())
- BluePrintConstants.DATA_TYPE_DOUBLE -> objectNode.put(key, (value as DoubleNode).doubleValue())
- else -> objectNode.put(key, (value as TextNode).textValue())
- }
- }
-
- fun populatePrimitiveValues(value: Any, primitiveType: String, arrayNode: ArrayNode) {
- when (primitiveType.toLowerCase()) {
- BluePrintConstants.DATA_TYPE_BOOLEAN -> arrayNode.add(value as Boolean)
- BluePrintConstants.DATA_TYPE_INTEGER -> arrayNode.add(value as Int)
- BluePrintConstants.DATA_TYPE_FLOAT -> arrayNode.add(value as Float)
- BluePrintConstants.DATA_TYPE_DOUBLE -> arrayNode.add(value as Double)
- BluePrintConstants.DATA_TYPE_TIMESTAMP -> arrayNode.add(value as String)
- else -> arrayNode.add(value as String)
- }
- }
-
- fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) {
- when (primitiveType.toLowerCase()) {
- BluePrintConstants.DATA_TYPE_BOOLEAN -> objectNode.put(key, false)
- BluePrintConstants.DATA_TYPE_INTEGER -> objectNode.put(key, 0)
- BluePrintConstants.DATA_TYPE_FLOAT -> objectNode.put(key, 0.0)
- BluePrintConstants.DATA_TYPE_DOUBLE -> objectNode.put(key, 0.0)
- else -> objectNode.put(key, "")
- }
- }
-
- fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) {
- when (primitiveType.toLowerCase()) {
- BluePrintConstants.DATA_TYPE_BOOLEAN -> arrayNode.add(false)
- BluePrintConstants.DATA_TYPE_INTEGER -> arrayNode.add(0)
- BluePrintConstants.DATA_TYPE_FLOAT -> arrayNode.add(0.0)
- BluePrintConstants.DATA_TYPE_DOUBLE -> arrayNode.add(0.0)
- else -> arrayNode.add("")
- }
- }
-
- 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)) {
- populatePrimitiveValues(key, nodeValue, type, objectNode)
- } else {
- objectNode.set(key, nodeValue)
- }
- }
-
- fun convertPrimitiveResourceValue(type: String, value: String): JsonNode {
- return when (type.toLowerCase()) {
- BluePrintConstants.DATA_TYPE_BOOLEAN -> jsonNodeFromObject(java.lang.Boolean.valueOf(value))
- BluePrintConstants.DATA_TYPE_INTEGER -> jsonNodeFromObject(Integer.valueOf(value))
- BluePrintConstants.DATA_TYPE_FLOAT -> jsonNodeFromObject(java.lang.Float.valueOf(value))
- BluePrintConstants.DATA_TYPE_DOUBLE -> jsonNodeFromObject(java.lang.Double.valueOf(value))
- else -> getJsonNode(value)
- }
- }
-
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtils.kt
deleted file mode 100644
index 4bdaaa56..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtils.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-
-import com.fasterxml.jackson.databind.JsonNode
-import com.jayway.jsonpath.Configuration
-import com.jayway.jsonpath.JsonPath
-import com.jayway.jsonpath.Option
-import com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider
-import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider
-
-class JsonParserUtils {
- companion object {
-
- //TODO("Optimise this")
- val JACKSON_JSON_NODE_CONFIGURATION = Configuration.builder()
- .mappingProvider(JacksonMappingProvider()).jsonProvider(JacksonJsonNodeJsonProvider()).build()
-
- val PATH_CONFIGURATION = Configuration.builder().options(Option.AS_PATH_LIST).build()
-
- fun paths(jsonContent: String, expression: String): List<String> {
- return JsonPath.using(PATH_CONFIGURATION).parse(jsonContent).read(expression)
- }
-
- fun paths(jsonNode: JsonNode, expression: String): List<String> {
- return paths(jsonNode.toString(), expression)
- }
-
- fun parse(jsonContent: String, expression: String): JsonNode {
- return JsonPath.using(JACKSON_JSON_NODE_CONFIGURATION).parse(jsonContent).read(expression)
- }
-
- fun parse(jsonNode: JsonNode, expression: String): JsonNode {
- return parse(jsonNode.toString(), expression)
- }
-
- fun parseNSet(jsonContent: String, expression: String, value: JsonNode): JsonNode {
- return JsonPath.using(JACKSON_JSON_NODE_CONFIGURATION).parse(jsonContent).set(expression, value).json()
- }
-
- fun parseNSet(jsonNode: JsonNode, expression: String, valueNode: JsonNode): JsonNode {
- return parseNSet(jsonNode.toString(), expression, valueNode)
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ResourceResolverUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ResourceResolverUtils.kt
deleted file mode 100644
index 762e47fb..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ResourceResolverUtils.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmpty
-import java.io.File
-import java.net.URL
-
-/**
- *
- *
- * @author Brinda Santh
- */
-object ResourceResolverUtils {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- fun getFileContent(filename: String, basePath: String?): String {
- log.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()
- log.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)
- }
- }
- }
- //FIXME("Convert into reactive")
- return JacksonUtils.getContent(resolvedFileName)
- } 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/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt
deleted file mode 100644
index 28916772..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/ServiceTemplateUtils.kt
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.data.TopologyTemplate
-
-/**
- *
- *
- * @author Brinda Santh
- */
-object ServiceTemplateUtils {
-
- suspend fun getServiceTemplate(fileName: String): ServiceTemplate {
- val content: String = JacksonReactorUtils.getContent(fileName)
- return getServiceTemplateFromContent(content)
- }
-
- fun getServiceTemplateFromContent(content: String): ServiceTemplate {
- return JacksonUtils.readValue(content)
- }
-
- fun merge(parentServiceTemplate: ServiceTemplate, toMerge: ServiceTemplate, removeImports: Boolean? = true): ServiceTemplate {
- if (removeImports!!) {
- parentServiceTemplate.imports = null
- toMerge.imports = null
- }
-
- toMerge.metadata?.let {
- parentServiceTemplate.metadata = parentServiceTemplate.metadata ?: hashMapOf()
- parentServiceTemplate.metadata?.putAll(toMerge.metadata as MutableMap)
- }
-
- toMerge.dslDefinitions?.let {
- parentServiceTemplate.dslDefinitions = parentServiceTemplate.dslDefinitions ?: hashMapOf()
- parentServiceTemplate.dslDefinitions?.putAll(toMerge.dslDefinitions as MutableMap)
- }
-
- toMerge.dataTypes?.let {
- parentServiceTemplate.dataTypes = parentServiceTemplate.dataTypes ?: hashMapOf()
- parentServiceTemplate.dataTypes?.putAll(toMerge.dataTypes as MutableMap)
- }
-
- toMerge.nodeTypes?.let {
- parentServiceTemplate.nodeTypes = parentServiceTemplate.nodeTypes ?: hashMapOf()
- parentServiceTemplate.nodeTypes?.putAll(toMerge.nodeTypes as MutableMap)
- }
-
- toMerge.artifactTypes?.let {
- parentServiceTemplate.artifactTypes = parentServiceTemplate.artifactTypes ?: hashMapOf()
- parentServiceTemplate.artifactTypes?.putAll(toMerge.artifactTypes as MutableMap)
- }
-
- toMerge.repositories?.let {
- parentServiceTemplate.repositories = parentServiceTemplate.repositories ?: hashMapOf()
- parentServiceTemplate.repositories?.putAll(toMerge.repositories as MutableMap)
- }
-
- parentServiceTemplate.topologyTemplate = parentServiceTemplate.topologyTemplate ?: TopologyTemplate()
-
- toMerge.topologyTemplate?.inputs?.let {
- parentServiceTemplate.topologyTemplate?.inputs = parentServiceTemplate.topologyTemplate?.inputs
- ?: hashMapOf()
- parentServiceTemplate.topologyTemplate?.inputs?.putAll(parentServiceTemplate.topologyTemplate?.inputs as MutableMap)
- }
-
- toMerge.topologyTemplate?.nodeTemplates?.let {
- parentServiceTemplate.topologyTemplate?.nodeTemplates = parentServiceTemplate.topologyTemplate?.nodeTemplates
- ?: hashMapOf()
- parentServiceTemplate.topologyTemplate?.nodeTemplates?.putAll(parentServiceTemplate.topologyTemplate?.nodeTemplates as MutableMap)
- }
-
- toMerge.topologyTemplate?.relationshipTemplates?.let {
- parentServiceTemplate.topologyTemplate?.relationshipTemplates = parentServiceTemplate.topologyTemplate?.relationshipTemplates
- ?: hashMapOf()
- parentServiceTemplate.topologyTemplate?.relationshipTemplates?.putAll(parentServiceTemplate.topologyTemplate?.relationshipTemplates as MutableMap)
- }
-
- toMerge.topologyTemplate?.policies?.let {
- parentServiceTemplate.topologyTemplate?.policies = parentServiceTemplate.topologyTemplate?.policies
- ?: hashMapOf()
- parentServiceTemplate.topologyTemplate?.policies?.putAll(parentServiceTemplate.topologyTemplate?.policies as MutableMap)
- }
-
- toMerge.topologyTemplate?.workflows?.let {
- parentServiceTemplate.topologyTemplate?.workflows = parentServiceTemplate.topologyTemplate?.workflows
- ?: hashMapOf()
- parentServiceTemplate.topologyTemplate?.workflows?.putAll(parentServiceTemplate.topologyTemplate?.workflows as MutableMap)
- }
- return parentServiceTemplate
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtils.kt
deleted file mode 100644
index b3adab08..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtils.kt
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.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> {
- val 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<*, *> {
- val 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/blueprint-core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory b/ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
deleted file mode 100644
index 89838f44..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt
deleted file mode 100644
index 1b315a21..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctionsTest.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core
-
-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/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt
deleted file mode 100644
index 1bd95f32..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import kotlin.test.assertNotNull
-
-/**
- *
- *
- * @author Brinda Santh
- */
-class BluePrintContextTest {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- val blueprintBasePath: String = ("./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
- @Test
- fun testBluePrintContextCreation() {
- val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath)
- assertNotNull(bluePrintContext, "Failed to populate Blueprint context")
- }
-
- @Test
- fun testChainedProperty() {
- val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath)
- val nodeType = bluePrintContext.nodeTypeChained("component-resource-resolution")
- assertNotNull(nodeType, "Failed to get chained node type")
- log.trace("Properties {}", JacksonUtils.getJson(nodeType, true))
- }
-
-
-}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
deleted file mode 100644
index 58910055..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.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.asJsonPrimitive
-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\", \"resource\"] }")
- 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("resource", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName")
-
- val node1: JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }")
- val expressionData1: ExpressionData = BluePrintExpressionService.getExpressionData(node1)
- assertNotNull(expressionData1, " Failed to populate expression data")
- assertEquals(expressionData1.isExpression, true, "Failed to identify as expression")
- assertNotNull(expressionData1.attributeExpression, " Failed to populate attribute expression data")
- assertEquals("SELF", expressionData1.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
- assertEquals("attribute-name", expressionData1.attributeExpression?.attributeName, " Failed to get expected attributeName")
- assertEquals("resource/name", expressionData1.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")
- }
-
- @Test
- fun testDSLExpression() {
- val node: JsonNode = "*dynamic-rest-source".asJsonPrimitive()
- val expressionData: ExpressionData = BluePrintExpressionService.getExpressionData(node)
- assertNotNull(expressionData, " Failed to populate expression data")
- assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
- assertNotNull(expressionData.dslExpression, " Failed to populate dsl expression data")
- assertEquals("dynamic-rest-source", expressionData.dslExpression!!.propertyName,
- " Failed to populate dsl property name")
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
deleted file mode 100644
index 6f942a36..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import kotlin.test.assertNotNull
-
-/**
- * BluePrintRepoFileServiceTest
- * @author Brinda Santh
- *
- */
-class BluePrintRepoFileServiceTest {
-
- private val basePath = "load/model_type"
- private val bluePrintRepoFileService = BluePrintRepoFileService(basePath)
-
- @Test
- fun testGetDataType() {
- val dataType = bluePrintRepoFileService.getDataType("dt-v4-aggregate")
- assertNotNull(dataType, "Failed to get DataType from repo")
- }
-
- @Test
- fun testGetNodeType() {
- val nodeType = bluePrintRepoFileService.getNodeType("component-resource-assignment")
- assertNotNull(nodeType, "Failed to get NodeType from repo")
- }
-
- @Test
- fun testGetArtifactType() {
- val nodeType = bluePrintRepoFileService.getArtifactType("artifact-template-velocity")
- assertNotNull(nodeType, "Failed to get ArtifactType from repo")
- }
-
- @Test(expected = BluePrintException::class)
- fun testModelNotFound() {
- val dataType = bluePrintRepoFileService.getDataType("dt-not-found")
- assertNotNull(dataType, "Failed to get DataType from repo")
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
deleted file mode 100644
index dc56b520..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018-2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.NullNode
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintRuntimeUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
-
-/**
- *
- *
- * @author Brinda Santh
- */
-class BluePrintRuntimeServiceTest {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- @Test
- fun `test Resolve NodeTemplate Properties`() {
- log.info("************************ testResolveNodeTemplateProperties **********************")
-
- val bluePrintRuntimeService = getBluePrintRuntimeService()
-
- val inputDataPath = "src/test/resources/data/default-context.json"
-
- val inputNode: JsonNode = JacksonUtils.jsonNodeFromFile(inputDataPath)
- bluePrintRuntimeService.assignInputs(inputNode)
-
- val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService
- .resolveNodeTemplateProperties("activate-process")
-
- assertNotNull(propContext, "Failed to populate interface property values")
- }
-
- @Test
- fun `test resolve NodeTemplate Capability Properties`() {
- log.info("************************ testResolveNodeTemplateRequirementProperties **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
-
- val executionContext = bluePrintRuntimeService.getExecutionContext()
-
- BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(),
- "data/default-context.json", executionContext)
-
- val assignmentParams = "{\n" +
- " \"ipAddress\": \"127.0.0.1\",\n" +
- " \"hostName\": \"vnf-host\"\n" +
- " }"
-
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params",
- JacksonUtils.jsonNode(assignmentParams))
-
- val capProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device",
- "netconf")
- assertNotNull(capProperties, "Failed to populate capability property values")
- assertEquals(capProperties["target-ip-address"], "127.0.0.1".asJsonPrimitive(), "Failed to populate parameter target-ip-address")
- assertEquals(capProperties["port-number"], JacksonUtils.jsonNodeFromObject(830), "Failed to populate parameter port-number")
- }
-
- @Test
- fun `test Resolve NodeTemplate Interface Operation Inputs`() {
- log.info("************************ testResolveNodeTemplateInterfaceOperationInputs **********************")
-
- val bluePrintRuntimeService = getBluePrintRuntimeService()
-
- val executionContext = bluePrintRuntimeService.getExecutionContext()
-
- BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(),
- "data/default-context.json", executionContext)
-
- val inContext: MutableMap<String, JsonNode> = bluePrintRuntimeService
- .resolveNodeTemplateInterfaceOperationInputs("resource-assignment",
- "ResourceResolutionComponent", "process")
-
- assertNotNull(inContext, "Failed to populate interface input property values")
- assertEquals(inContext["action-name"], JacksonUtils.jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
- assertEquals(inContext["request-id"], JacksonUtils.jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
- }
-
- @Test
- fun `test Resolve NodeTemplate Interface Operation Outputs`() {
- log.info("************************ testResolveNodeTemplateInterfaceOperationOutputs **********************")
-
- val bluePrintRuntimeService = getBluePrintRuntimeService()
-
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params", NullNode.getInstance())
-
- bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment",
- "ResourceResolutionComponent", "process")
-
- val outputStatus = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment",
- "ResourceResolutionComponent", "process", "status")
- assertEquals("success".asJsonPrimitive(), outputStatus, "Failed to get operation property status")
-
- val outputParams = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment",
- "ResourceResolutionComponent", "process", "resource-assignment-params")
- assertEquals(NullNode.getInstance(), outputParams, "Failed to get operation property resource-assignment-params")
-
- }
-
- @Test
- fun `test NodeTemplate Context Property`() {
- log.info("************************ testNodeTemplateContextProperty **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
-
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context1",
- JacksonUtils.jsonNodeFromObject("context1-value"))
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context2",
- JacksonUtils.jsonNodeFromObject("context2-value"))
-
- val keys = listOf("context1", "context2")
-
- val jsonValueNode = bluePrintRuntimeService.getJsonForNodeTemplateAttributeProperties("resource-assignment-ra-component", keys)
- assertNotNull(jsonValueNode, "Failed to get Json for Node Template Context Properties")
- log.info("JSON Prepared Value Context {}", jsonValueNode)
-
- }
-
- @Test
- fun `test Resolve DSL Properties`() {
- log.info("************************ resolveDSLExpression **********************")
-
- val bluePrintRuntimeService = getBluePrintRuntimeService()
-
- bluePrintRuntimeService.setInputValue("rest-user-name", PropertyDefinition(), "sample-username"
- .asJsonPrimitive())
-
- val resolvedJsonNode: JsonNode = bluePrintRuntimeService.resolveDSLExpression("dynamic-rest-source")
- assertNotNull(resolvedJsonNode, "Failed to populate dsl property values")
- }
-
- @Test
- fun `test Resolve Workflow Outputs`() {
- log.info("************************ resolvePropertyAssignments **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
-
- val assignmentParams = "{\"ipAddress\": \"127.0.0.1\", \"hostName\": \"vnf-host\"}"
-
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params",
- JacksonUtils.jsonNode(assignmentParams))
-
- val resolvedJsonNode = bluePrintRuntimeService.resolveWorkflowOutputs("resource-assignment")
- assertNotNull(resolvedJsonNode, "Failed to populate workflow output property values")
- }
-
- private fun getBluePrintRuntimeService(): BluePrintRuntimeService<MutableMap<String, JsonNode>> {
- val blueprintBasePath: String = ("./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
- val blueprintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
- val checkBasePath = blueprintRuntime.get(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH)
-
- assertEquals(blueprintBasePath.asJsonPrimitive(), checkBasePath, "Failed to get base path after runtime creation")
-
- return blueprintRuntime
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
deleted file mode 100644
index 663a3751..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.service
-
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import kotlin.test.assertNotNull
-
-class BluePrintTemplateServiceTest {
-
- @Test
- fun testGenerateContent() {
-
- val template = JacksonUtils.getClassPathFileContent("templates/base-config-template.vtl")
- val json = JacksonUtils.getClassPathFileContent("templates/base-config-data.json")
-
- val content = BluePrintTemplateService.generateContent(template, json)
- assertNotNull(content, "failed to generate content for velocity template")
-
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
deleted file mode 100644
index 12931731..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import kotlinx.coroutines.runBlocking
-import org.junit.Test
-import java.io.File
-import java.nio.file.Paths
-import kotlin.test.assertTrue
-
-
-class BluePrintFileUtilsTest {
-
- @Test
- fun testNewBlueprint() = runBlocking {
- val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-new-test")
- BluePrintFileUtils.createEmptyBluePrint(targetPath)
-
- }
-
- @Test
- fun testBlueprintCopy() = runBlocking {
- val sourcePath: String = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
-
- val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-copy-test")
-
- val targetDir = File(targetPath)
- targetDir.deleteOnExit()
- // Copy the BP file
- BluePrintFileUtils.copyBluePrint(sourcePath, targetDir.absolutePath)
-
- assertTrue(targetDir.exists(), "faield to copy blueprint to ${targetDir.absolutePath}")
-
- // Delete Type Files
- BluePrintFileUtils.deleteBluePrintTypes(targetDir.absolutePath)
-
- // Generate the Type Files
- val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(sourcePath)
- bluePrintContext.rootPath = targetDir.absolutePath
-
- BluePrintFileUtils.writeBluePrintTypes(bluePrintContext)
-
-
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
deleted file mode 100644
index 366ce4a8..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ToscaMetaData
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
-import kotlin.test.assertNull
-
-class BluePrintMetadataUtilsTest {
-
- @Test
- fun testToscaMetaData() {
-
- val basePath: String = "./../../../../components/model-catalog/blueprint-model/test-blueprint/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")
-
- }
-
- @Test
- fun environmentDataTest() {
- val environmentPath = "./src/test/resources/environments"
-
- val properties = BluePrintMetadataUtils.bluePrintEnvProperties(environmentPath)
-
- assertNotNull(properties, "Could not read the properties")
- assertEquals(properties.getProperty("blueprintsprocessor.database.alt1.username"), "username1", "failed 1")
- assertEquals(properties.getProperty("blueprintsprocessor.database.alt1.password"), "password1", "failed 2")
- assertEquals(properties.getProperty("blueprintsprocessor.database.alt2.username"), "username2", "failed 3")
- assertEquals(properties.getProperty("blueprintsprocessor.database.alt2.password"), "password2", "failed 4")
- assertNull(properties.getProperty("blueprintsprocessor.database.alt3.password"), "failed 5")
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt
deleted file mode 100644
index 9cf8d62a..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import kotlinx.coroutines.runBlocking
-import org.junit.Test
-
-class JacksonReactorUtilsTest {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- @Test
- fun testJsonNodeFromClassPathFile() {
- runBlocking {
- val filePath = "data/default-context.json"
- JacksonReactorUtils.jsonNodeFromClassPathFile(filePath)
- }
- }
-
- @Test
- fun testJsonNodeFromFile() {
- runBlocking {
- val filePath = "src/test/resources/data/default-context.json"
- JacksonReactorUtils.jsonNodeFromFile(filePath)
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt
deleted file mode 100644
index 12156d65..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtilsTest.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-
-/**
- * JacksonUtilsTest
- * @author Brinda Santh
- * ${DATA}
- */
-class JacksonUtilsTest {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- @Test
- fun testJsonNodeFromClassPathFile() {
- val filePath = "data/default-context.json"
- JacksonUtils.jsonNodeFromClassPathFile(filePath)
- }
-
- @Test
- fun testJsonNodeFromFile() {
- val filePath = "src/test/resources/data/default-context.json"
- JacksonUtils.jsonNodeFromFile(filePath)
- }
-
- @Test
- fun testGetListFromJson() {
- val content = "[\"good\",\"boy\" ]"
- val nodeType = JacksonUtils.getListFromJson(content, String::class.java)
- assertNotNull(nodeType, "Failed to get String array from content")
- }
-
-
- @Test
- fun testJsonValue() {
- val filePath = "data/alltype-data.json"
- val rootJson = JacksonUtils.jsonNodeFromClassPathFile(filePath)
- assertNotNull(rootJson, "Failed to get all type data json node")
- val intValue = rootJson.get("intValue")
- assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_INTEGER, intValue), "Failed to get as int value")
- val floatValue = rootJson.get("floatValue")
- assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_FLOAT, floatValue), "Failed to get as float value")
- val stringValue = rootJson.get("stringValue")
- assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_STRING, stringValue), "Failed to get as string value")
- val booleanValue = rootJson.get("booleanValue")
- assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_BOOLEAN, booleanValue), "Failed to get as boolean value")
- val arrayStringValue = rootJson.get("arrayStringValue")
- assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_LIST, arrayStringValue), "Failed to get as List value")
- val mapValue = rootJson.get("mapValue")
- assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_MAP, mapValue), "Failed to get as Map value")
-
- assertTrue(!JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_LIST, stringValue), "Negative type failed")
-
-
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtilsTest.kt
deleted file mode 100644
index 1f003999..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtilsTest.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import kotlin.test.assertEquals
-
-class JsonParserUtilsTest {
-
- @Test
- fun `test parse Node`() {
- val dataNode = JacksonUtils.jsonNodeFromClassPathFile("data/default-context.json")
-
- val parsedNode = JsonParserUtils.parse(dataNode, "$.request-id")
-
- assertEquals(parsedNode, "12345".asJsonPrimitive(), "failed to parse json request-id")
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
deleted file mode 100644
index 5999dbfa..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.utils
-
-import org.junit.Test
-
-class TopologicalSortingUtilsTest {
-
- @Test
- fun testSorting(): Unit {
- val graph: TopologicalSortingUtils<String> = TopologicalSortingUtils()
- graph.add("bundle-id", "bundle-mac")
- graph.add("bundle-id", "bundle-ip")
- graph.add("bundle-mac", "bundle-ip")
- graph.add("bundle-ip", "bundle-mac")
-
- println("The current graph: " + graph)
- println("In-degrees: " + graph.inDegree())
- println("Out-degrees: " + graph.outDegree())
- println("A topological sort of the vertices: " + graph.topSort())
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/componentnode/default.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/componentnode/default.json
deleted file mode 100644
index a1982631..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/componentnode/default.json
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "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-onap-ccsdk-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-onap-ccsdk-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/blueprint-core/src/test/resources/data/alltype-data.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/alltype-data.json
deleted file mode 100644
index 055b0965..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/alltype-data.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "intValue" : 1,
- "floatValue" : 1.34,
- "booleanValue" : true,
- "stringValue" : "sample-String",
- "timeValue" : "2018-09-29",
- "arrayStringValue" : ["one", "two"],
- "mapValue" : {"profile_name1":"profile_name1",
- "profile_name2":"profile_name2"}
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json
deleted file mode 100644
index 9f733f0f..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "request-id": "12345",
- "hostname": "localhost",
- "template_name": "baseconfiguration",
- "template_version": "1.0.0",
- "action-name": "sample-action"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json
deleted file mode 100644
index cac8770a..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json
+++ /dev/null
@@ -1,261 +0,0 @@
-{
- "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"
- },
- "primary-config-data": {
- "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"
- }
- }
- }
- },
- "primary-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"
- }
- }
- }
- },
- "primary-config-data": {
- "type": "object",
- "properties": {
- "names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "network-resource-discovery": {
- "type": "object",
- "properties": {
- "names": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "primary-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/blueprint-core/src/test/resources/environments/Environments/environment1.properties b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment1.properties
deleted file mode 100644
index d735087b..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment1.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-blueprintsprocessor.database.alt1.username=username1
-blueprintsprocessor.database.alt1.password=password1 \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment2.properties b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment2.properties
deleted file mode 100644
index 5530a8f8..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment2.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-blueprintsprocessor.database.alt2.username=username2
-blueprintsprocessor.database.alt2.password=password2 \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/convert.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/convert.json
deleted file mode 100644
index f7893ce5..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/convert.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "type": "sdnc-component-getResourceAssignment",
- "interfaces": {
- "ResourceAssignmentService": {
- "operations": {
- "getResourceAssignment": {
- "inputs": {
- "assignment-mappings": [
- {
- "name": "service-name",
- "mapping-field": "service",
- "mapping-category": "SDN",
- "required": true
- },
- {
- "name": "region-name",
- "mapping-field": "region",
- "mapping-category": "SDN",
- "required": true
- }
- ],
- "pre-data": {
- "get_input": "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/blueprint-core/src/test/resources/properties/default.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/default.json
deleted file mode 100644
index 9f17574e..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/default.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "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/blueprint-core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts
deleted file mode 100644
index 44cc957d..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/scripts/SampleBlueprintFunctionNode.kts
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
-
-open class SampleBlueprintFunctionNode : BlueprintFunctionNode<String, String>{
-
- override fun getName(): String {
- return "Kotlin-Script-Function-Node"
- }
-
- override fun prepareRequest(executionRequest: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun process(executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun prepareResponse(): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun apply(t: String): String {
- return "$t-status"
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data.json
deleted file mode 100755
index 2acc6fcd..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "node0_hostname": "sdnc-host",
- "node0_backup_router_address": "2001:1890:1253::192:168:100:1",
- "servers": [
- "Server1",
- "Server2",
- "Server3"
- ],
- "tacplus-servers": [
- {
- "tacplus-server-name": "tacplus-server-name1",
- "tacplus-server-source-address": "enc-dsdsasa1"
- },
- {
- "tacplus-server-name": "tacplus-server-name2",
- "tacplus-server-source-address": "enc-dsdsasa2"
- }
- ],
- "classes": [
- {
- "name": "superuser-class",
- "idle-timeout": 5,
- "permissions": "all"
- },
- {
- "name": "tacacs-adv-class",
- "idle-timeout": 5
- },
- {
- "name": "tacacs-base-class",
- "idle-timeout": 5
- }
- ],
- "system-password": "teamops-system-password",
- "root-password": "teamops-root-password"
-}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-template.vtl b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-template.vtl
deleted file mode 100755
index f7b1269b..00000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-template.vtl
+++ /dev/null
@@ -1,61 +0,0 @@
-<configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm"
-xmlns:a="http://xml.juniper.net/junos/15.1X49/junos">
- <version>15.1X49-D50.3</version>
- <groups>
- <name>node0</name>
- <system>
- #foreach($server in ${servers})
- <server-host-name>$StringUtils.upperCase("$server")</server-host-name>
- #end
- </system>
- <system>
- <host-name>${node0_hostname}</host-name>
- <backup-router>
- <address>${node0_backup_router_address}</address>
- <destination>$node0_backup_router_address</destination>
- </backup-router>
- #foreach($tacplus-server in ${tacplus-servers})
- <tacplus-server>
- <name>$tacplus-server.tacplus-server-name</name>
- <source-address>$tacplus-server.tacplus-server-source-address</source-address>
- </tacplus-server>
- #end
- <login>
- <message>ONAP information assets</message>
- #foreach($class in ${classes})
- <class>
- <name>$class.name</name>
- <idle-timeout>$class.idle-timeout</idle-timeout>
- #if ($class.permissions)
- <permissions>$class.permissions</permissions>
- #end
- </class>
- #end
- <user>
- <name>readonly</name>
- <full-name>Read Only Account Access</full-name>
- <uid>1001</uid>
- <class>tacacs-base-class</class>
- </user>
- <user>
- <name>readwrite</name>
- <full-name>Read - Write Account Access</full-name>
- <uid>1002</uid>
- <class>tacacs-adv-class</class>
- <authentication>
- <encrypted-password>${system-password}</encrypted-password>
- </authentication>
- </user>
- <user>
- <name>readwrite</name>
- <full-name>Emergency Access Only</full-name>
- <uid>1000</uid>
- <class>superuser-class</class>
- <authentication>
- <encrypted-password>${root-password}</encrypted-password>
- </authentication>
- </user>
- </login>
- </system>
- </groups>
-</configuration> \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/pom.xml b/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
deleted file mode 100644
index 81f0cc77..00000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>modules</artifactId>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>blueprint-scripts</artifactId>
- <name>Controller Blueprints Scripts</name>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler-embeddable</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-scripting-jvm-host</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-runtime</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt
deleted file mode 100644
index 8ac915bd..00000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.scripts
-
-import java.io.File
-import java.io.Serializable
-import java.net.URL
-import java.net.URLClassLoader
-import kotlin.reflect.KClass
-import kotlin.script.experimental.api.*
-
-open class BluePrintCompiledScript<out JarFile : File>(
- private val scriptCompilationConfiguration: ScriptCompilationConfiguration,
- private val compiledJar: File) :
- CompiledScript<JarFile>, Serializable {
-
- lateinit var scriptClassFQName: String
-
- override val compilationConfiguration: ScriptCompilationConfiguration
- get() = scriptCompilationConfiguration
-
- override suspend fun getClass(scriptEvaluationConfiguration: ScriptEvaluationConfiguration?): ResultWithDiagnostics<KClass<*>> = try {
-
- val baseClassLoader = Thread.currentThread().contextClassLoader
-
- val urls = arrayListOf<URL>()
- urls.add(compiledJar.toURI().toURL())
- val classLoaderWithDependencies = URLClassLoader(urls.toTypedArray(), baseClassLoader)
-
- val clazz = classLoaderWithDependencies.loadClass(scriptClassFQName).kotlin
- clazz.asSuccess()
- } catch (e: Throwable) {
- ResultWithDiagnostics.Failure(
- ScriptDiagnostic(
- "Unable to instantiate class $scriptClassFQName",
- exception = e
- )
- )
- }
-
-}
-
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt
deleted file mode 100644
index 572724d0..00000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.scripts
-
-import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
-import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoots
-import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback
-import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
-import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
-import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
-import org.jetbrains.kotlin.cli.common.messages.MessageCollector
-import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
-import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
-import org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler
-import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
-import org.jetbrains.kotlin.com.intellij.openapi.util.Disposer
-import org.jetbrains.kotlin.config.*
-import org.slf4j.LoggerFactory
-import java.io.File
-import kotlin.script.experimental.api.*
-import kotlin.script.experimental.host.ScriptingHostConfiguration
-import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty
-import kotlin.script.experimental.jvmhost.KJvmCompilerProxy
-
-open class BluePrintsCompilerProxy(private val hostConfiguration: ScriptingHostConfiguration) : KJvmCompilerProxy {
-
- private val log = LoggerFactory.getLogger(BluePrintsCompilerProxy::class.java)!!
-
- override fun compile(script: SourceCode, scriptCompilationConfiguration: ScriptCompilationConfiguration)
- : ResultWithDiagnostics<CompiledScript<*>> {
-
- val messageCollector = ScriptDiagnosticsMessageCollector()
-
- fun failure(vararg diagnostics: ScriptDiagnostic): ResultWithDiagnostics.Failure =
- ResultWithDiagnostics.Failure(*messageCollector.diagnostics.toTypedArray(), *diagnostics)
-
- // Compile the Code
- try {
-
- log.trace("Scripting Host Configuration : $hostConfiguration")
-
- setIdeaIoUseFallback()
-
- val blueprintSourceCode = script as BluePrintSourceCode
-
- val compiledJarFile = blueprintSourceCode.targetJarFile
-
- if (!compiledJarFile.exists() || blueprintSourceCode.regenerate) {
-
- var environment: KotlinCoreEnvironment? = null
-
- val rootDisposable = Disposer.newDisposable()
-
- try {
-
- val compilerConfiguration = CompilerConfiguration().apply {
-
- put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector)
- put(CommonConfigurationKeys.MODULE_NAME, blueprintSourceCode.moduleName)
- put(JVMConfigurationKeys.OUTPUT_JAR, compiledJarFile)
- put(JVMConfigurationKeys.RETAIN_OUTPUT_IN_MEMORY, false)
-
- // Load Current Class loader to Compilation Class loader
- val currentClassLoader = classpathFromClasspathProperty()
- currentClassLoader?.forEach {
- add(CLIConfigurationKeys.CONTENT_ROOTS, JvmClasspathRoot(it))
- }
-
- // Add all Kotlin Sources
- addKotlinSourceRoots(blueprintSourceCode.blueprintKotlinSources)
-
- languageVersionSettings = LanguageVersionSettingsImpl(
- LanguageVersion.LATEST_STABLE, ApiVersion.LATEST_STABLE, mapOf(AnalysisFlags.skipMetadataVersionCheck to true)
- )
- }
-
- //log.info("Executing with compiler configuration : $compilerConfiguration")
-
- environment = KotlinCoreEnvironment.createForProduction(rootDisposable, compilerConfiguration,
- EnvironmentConfigFiles.JVM_CONFIG_FILES)
-
- // Compile Kotlin Sources
- val compiled = KotlinToJVMBytecodeCompiler.compileBunchOfSources(environment)
-
- val analyzerWithCompilerReport = AnalyzerWithCompilerReport(messageCollector,
- environment.configuration.languageVersionSettings)
-
- if (analyzerWithCompilerReport.hasErrors()) {
- return ResultWithDiagnostics.Failure(messageCollector.diagnostics)
- }
- } finally {
- rootDisposable.dispose()
- }
- }
-
- val res = BluePrintCompiledScript<File>(scriptCompilationConfiguration, compiledJarFile)
-
- return ResultWithDiagnostics.Success(res, messageCollector.diagnostics)
-
- } catch (ex: Throwable) {
- return failure(ex.asDiagnostics())
- }
- }
-}
-
-class ScriptDiagnosticsMessageCollector : MessageCollector {
-
- private val _diagnostics = arrayListOf<ScriptDiagnostic>()
-
- val diagnostics: List<ScriptDiagnostic> get() = _diagnostics
-
- override fun clear() {
- _diagnostics.clear()
- }
-
- override fun hasErrors(): Boolean =
- _diagnostics.any { it.severity == ScriptDiagnostic.Severity.ERROR }
-
-
- override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
- val mappedSeverity = when (severity) {
- CompilerMessageSeverity.EXCEPTION,
- CompilerMessageSeverity.ERROR -> ScriptDiagnostic.Severity.ERROR
- CompilerMessageSeverity.STRONG_WARNING,
- CompilerMessageSeverity.WARNING -> ScriptDiagnostic.Severity.WARNING
- CompilerMessageSeverity.INFO -> ScriptDiagnostic.Severity.INFO
- CompilerMessageSeverity.LOGGING -> ScriptDiagnostic.Severity.DEBUG
- else -> null
- }
- if (mappedSeverity != null) {
- val mappedLocation = location?.let {
- if (it.line < 0 && it.column < 0) null // special location created by CompilerMessageLocation.create
- else SourceCode.Location(SourceCode.Position(it.line, it.column))
- }
- _diagnostics.add(ScriptDiagnostic(message, mappedSeverity, location?.path, mappedLocation))
- }
- }
-}
-
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptingHost.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptingHost.kt
deleted file mode 100644
index df721e0f..00000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptingHost.kt
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.scripts
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.slf4j.LoggerFactory
-import java.util.*
-import kotlin.script.experimental.api.*
-import kotlin.script.experimental.host.BasicScriptingHost
-import kotlin.script.experimental.jvm.defaultJvmScriptingHostConfiguration
-import kotlin.script.experimental.jvmhost.JvmScriptCompiler
-import kotlin.script.experimental.jvmhost.impl.withDefaults
-
-val blueprintScriptCompiler = JvmScriptCompiler(defaultJvmScriptingHostConfiguration,
- BluePrintsCompilerProxy(defaultJvmScriptingHostConfiguration.withDefaults()))
-
-open class BlueprintScriptingHost(evaluator: ScriptEvaluator) : BasicScriptingHost(blueprintScriptCompiler, evaluator) {
-
- override fun eval(
- script: SourceCode,
- scriptCompilationConfiguration: ScriptCompilationConfiguration,
- configuration: ScriptEvaluationConfiguration?
- ): ResultWithDiagnostics<EvaluationResult> =
-
- runInCoroutineContext {
-
- compiler(script, scriptCompilationConfiguration)
- .onSuccess {
- evaluator(it, configuration)
- }.onFailure { failedResult ->
- val messages = failedResult.reports?.joinToString("\n")
- throw BluePrintProcessorException(messages)
- }
- }
-}
-
-open class BluePrintScriptEvaluator(private val scriptClassName: String) : ScriptEvaluator {
-
- private val log = LoggerFactory.getLogger(BluePrintScriptEvaluator::class.java)!!
-
- override suspend operator fun invoke(
- compiledScript: CompiledScript<*>,
- scriptEvaluationConfiguration: ScriptEvaluationConfiguration?
- ): ResultWithDiagnostics<EvaluationResult> =
- try {
- log.debug("Getting script class name($scriptClassName) from the compiled sources ")
- val bluePrintCompiledScript = compiledScript as BluePrintCompiledScript
- bluePrintCompiledScript.scriptClassFQName = scriptClassName
-
- val res = compiledScript.getClass(scriptEvaluationConfiguration)
- when (res) {
- is ResultWithDiagnostics.Failure -> res
- is ResultWithDiagnostics.Success -> {
-
- val scriptClass = res.value
- val args = ArrayList<Any?>()
- scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.providedProperties)?.forEach {
- args.add(it.value)
- }
- scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.implicitReceivers)?.let {
- args.addAll(it)
- }
- scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.constructorArgs)?.let {
- args.addAll(it)
- }
-
- val instance = scriptClass.java.constructors.single().newInstance(*args.toArray())
- ?: throw BluePrintProcessorException("failed to create instance from the script")
-
- log.info("Created script instance of type ${instance.javaClass}")
-
- ResultWithDiagnostics.Success(EvaluationResult(ResultValue.Value(scriptClass.qualifiedName!!,
- instance, "", instance),
- scriptEvaluationConfiguration))
- }
- }
- } catch (e: Throwable) {
- ResultWithDiagnostics.Failure(e.asDiagnostics("Error evaluating script"))
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptsConfiguration.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptsConfiguration.kt
deleted file mode 100644
index c4e2cfba..00000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptsConfiguration.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.scripts
-
-import java.io.File
-import kotlin.script.experimental.annotations.KotlinScript
-import kotlin.script.experimental.api.*
-import kotlin.script.experimental.jvm.jvm
-import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty
-
-@KotlinScript(
- fileExtension = "cba.kts",
- compilationConfiguration = BluePrintScripCompilationConfiguration::class,
- displayName = "Controller Blueprint Archive Kotlin Scripts"
-)
-abstract class BluePrintKotlinScript
-
-object BluePrintScripCompilationConfiguration : ScriptCompilationConfiguration(
- {
- jvm {
- //classpathFromClassloader(BluePrintScripCompilationConfiguration::class.java.classLoader)
- classpathFromClasspathProperty()
- }
- ide{
- acceptedLocations(ScriptAcceptedLocation.Everywhere)
- }
-
- }
-)
-
-open class BluePrintSourceCode : SourceCode {
- lateinit var blueprintKotlinSources: MutableList<String>
- lateinit var moduleName: String
- lateinit var targetJarFile: File
- var regenerate: Boolean = false
-
- override val text: String
- get() = ""
-
- override val locationId: String? = null
-
- override val name: String?
- get() = moduleName
-}
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptsServiceImpl.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptsServiceImpl.kt
deleted file mode 100644
index 4840fc9b..00000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptsServiceImpl.kt
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.scripts
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintScriptsService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.springframework.stereotype.Service
-import java.io.File
-import java.util.*
-import kotlin.script.experimental.api.ResultValue
-import kotlin.script.experimental.api.resultOrNull
-import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
-
-@Service
-open class BluePrintScriptsServiceImpl : BluePrintScriptsService {
-
- override fun <T> scriptInstance(blueprintContext: BluePrintContext, scriptClassName: String,
- reCompile: Boolean): T {
-
- val kotlinScriptPath = blueprintContext.rootPath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_SCRIPTS_KOTLIN_DIR)
-
- val compiledJar = kotlinScriptPath.plus(File.separator)
- .plus(getBluePrintScriptsJarName(blueprintContext))
-
- val scriptSource = BluePrintSourceCode()
-
- val sources: MutableList<String> = arrayListOf()
- sources.add(kotlinScriptPath)
- scriptSource.blueprintKotlinSources = sources
- scriptSource.moduleName = "${blueprintContext.name()}-${blueprintContext.version()}-cba-kts"
- scriptSource.targetJarFile = File(compiledJar)
- scriptSource.regenerate = reCompile
-
- val compilationConfiguration = createJvmCompilationConfigurationFromTemplate<BluePrintKotlinScript>()
- val scriptEvaluator = BluePrintScriptEvaluator(scriptClassName)
-
- val compiledResponse = BlueprintScriptingHost(scriptEvaluator).eval(scriptSource, compilationConfiguration,
- null)
-
- val returnValue = compiledResponse.resultOrNull()?.returnValue as? ResultValue.Value
-
- return returnValue?.value!! as T
- }
-
- override fun <T> scriptInstance(scriptClassName: String): T {
- val args = ArrayList<Any?>()
- return Thread.currentThread().contextClassLoader.loadClass(scriptClassName).constructors
- .single().newInstance(*args.toArray()) as T
- }
-}
-
-fun getBluePrintScriptsJarName(blueprintContext: BluePrintContext): String {
- return "${blueprintContext.name()}-${blueprintContext.version()}-cba-kts.jar"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript b/ms/controllerblueprints/modules/blueprint-scripts/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript
deleted file mode 100644
index e69de29b..00000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript
+++ /dev/null
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt
deleted file mode 100644
index e84347d2..00000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.scripts
-
-
-import org.apache.commons.io.FileUtils
-import org.junit.Test
-import java.io.File
-import kotlin.script.experimental.jvm.util.classpathFromClass
-import kotlin.script.experimental.jvm.util.classpathFromClassloader
-import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty
-import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
-
-class BlueprintScriptingHostTest {
-
- private fun viewClassPathInfo() {
-
- println(" *********** classpathFromClass *********** ")
- classpathFromClass(BlueprintScriptingHostTest::class.java.classLoader,
- BlueprintScriptingHostTest::class)!!
- .forEach(::println)
-
- println(" *********** classpathFromClassloader *********** ")
- classpathFromClassloader(BlueprintScriptingHostTest::class.java.classLoader)!!
- .forEach(::println)
-
- println(" *********** classpathFromClasspathProperty *********** ")
- classpathFromClasspathProperty()!!
- .forEach(::println)
- }
-
- @Test
- fun `test same script two folders`() {
-
- FileUtils.forceMkdir(File("target/scripts1/"))
- FileUtils.forceMkdir(File("target/scripts2/"))
-
- val scriptSource1 = BluePrintSourceCode()
- scriptSource1.moduleName = "blueprint-test-script"
-
- scriptSource1.targetJarFile = File("target/scripts1/blueprint-script-generated.jar")
- val sources1: MutableList<String> = arrayListOf()
- sources1.add("src/test/resources/scripts1")
- scriptSource1.blueprintKotlinSources = sources1
-
- val scriptClassName = "Simple_cba\$SampleComponentFunction"
-
- val compilationConfiguration = createJvmCompilationConfigurationFromTemplate<BluePrintKotlinScript>()
-
- val scriptEvaluator = BluePrintScriptEvaluator(scriptClassName)
-
- val scriptSource2 = BluePrintSourceCode()
- scriptSource2.moduleName = "blueprint-test-script"
-
- scriptSource2.targetJarFile = File("target/scripts2/blueprint-script-generated.jar")
- val sources2: MutableList<String> = arrayListOf()
- sources2.add("src/test/resources/scripts2")
- scriptSource2.blueprintKotlinSources = sources2
-
- for (i in 1..2) {
- val evalResponse = BlueprintScriptingHost(scriptEvaluator).eval(scriptSource1, compilationConfiguration,
- null)
- }
-
- for (i in 1..2) {
- val evalResponse = BlueprintScriptingHost(scriptEvaluator).eval(scriptSource2, compilationConfiguration,
- null)
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts b/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts
deleted file mode 100644
index 9f61c649..00000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
-import org.springframework.stereotype.Service
-
-@Service
-open class SampleComponentFunction : BlueprintFunctionNode<String, String> {
-
- override fun getName(): String {
- println("Printing Name....." + "sample".asJsonPrimitive())
- return "my Name"
- }
-
- override fun prepareRequest(executionRequest: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun process(executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun prepareResponse(): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun apply(t: String): String {
- return "Script 1 response - $t"
- }
-}
-
-val blueprintFunction = SampleComponentFunction()
-
-val serviceTemplate = ServiceTemplate()
-
-println("Simple script printing....")
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts b/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts
deleted file mode 100644
index 84517254..00000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
-import org.springframework.stereotype.Service
-
-@Service
-open class SampleComponentFunction : BlueprintFunctionNode<String, String> {
-
- override fun getName(): String {
- println("Printing Name....." + "sample".asJsonPrimitive())
- return "my Name"
- }
-
- override fun prepareRequest(executionRequest: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun process(executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun prepareResponse(): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun apply(t: String): String {
- return "Script 2 response - $t"
- }
-}
-
-val blueprintFunction = SampleComponentFunction()
-
-val serviceTemplate = ServiceTemplate()
-
-println("Simple script printing....")
diff --git a/ms/controllerblueprints/modules/blueprint-validation/pom.xml b/ms/controllerblueprints/modules/blueprint-validation/pom.xml
deleted file mode 100644
index 7ac6a020..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/pom.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <artifactId>blueprint-validation</artifactId>
- <name>Controller Blueprints Validation Service</name>
-
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
- </dependency>
-
-
- <!--Testing dependencies-->
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- </dependency>
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
deleted file mode 100644
index a3625e40..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-import java.io.File
-
-@Service("default-artifact-definition-validator")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintArtifactDefinitionValidatorImpl(
- private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactDefinitionValidator {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintArtifactDefinitionValidatorImpl::class.toString())
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var bluePrintContext: BluePrintContext
- var paths: MutableList<String> = arrayListOf()
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
-
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- paths.add(name)
- val type: String = artifactDefinition.type
- log.trace("Validation ArtifactDefinition of type {$type}")
- // Check Artifact Type
- checkValidArtifactType(name, type)
-
- val file: String = artifactDefinition.file
-
- val completePath = bluePrintContext.rootPath.plus(File.separator).plus(file)
-
- check(File(completePath).exists()) {
- throw BluePrintException("couldn't find file ($completePath)")
- }
-
- // Perform Extension Validation
- validateExtension("$type-artifact-definition-validator", name, artifactDefinition)
-
- paths.removeAt(paths.lastIndex)
- }
-
- open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) {
-
- val artifactType = bluePrintContext.serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: throw BluePrintException("failed to get artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
-
- checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
- }
-
- @Throws(BluePrintException::class)
- open fun checkValidArtifactTypeDerivedFrom(artifactTypeName: String, derivedFrom: String) {
- check(BluePrintTypes.validArtifactTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException("failed to get artifactType($artifactTypeName)'s derivedFrom($derivedFrom) definition")
- }
- }
-
- private fun validateExtension(referencePrefix: String, name: String, artifactDefinition: ArtifactDefinition) {
-
- val customValidators = bluePrintTypeValidatorService
- .bluePrintValidators(referencePrefix, BluePrintArtifactDefinitionValidator::class.java)
-
- customValidators?.let {
- it.forEach { validator ->
- validator.validate(bluePrintRuntimeService, name, artifactDefinition)
- }
-
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
deleted file mode 100644
index 4824d2e9..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.stereotype.Service
-
-@Service("default-artifact-type-validator")
-open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactTypeValidator {
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) {
-
- artifactType.properties?.let {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, artifactType.properties!!)
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
deleted file mode 100644
index 11dbf058..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.data.AttributeDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.format
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service("default-attribute-definition-validator")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintAttributeDefinitionValidator {
-
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- attributeDefinition: AttributeDefinition) {
-
- log.trace("Validating AttributeDefinition($name)")
- this.bluePrintRuntimeService = bluePrintRuntimeService
- val dataType: String = attributeDefinition.type
-
- when {
- BluePrintTypes.validPrimitiveTypes().contains(dataType) -> {
- // Do Nothing
- }
- BluePrintTypes.validCollectionTypes().contains(dataType) -> {
- val entrySchemaType: String = attributeDefinition.entrySchema?.type
- ?: throw BluePrintException("Entry schema for DataType ($dataType) for the property ($name) not found")
- checkPrimitiveOrComplex(entrySchemaType, name)
- }
- else -> checkPropertyDataType(dataType, name)
- }
- }
-
- private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean {
- if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
- return true
- } else {
- throw BluePrintException("DataType($dataType) for the attribute($propertyName) is not valid")
- }
- }
-
- private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
-
- val dataType = bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
-
- checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
- }
-
- private fun checkDataType(key: String): Boolean {
- return bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.containsKey(key) ?: false
- }
-
- open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) {
- check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ")
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
deleted file mode 100644
index 1494bbc4..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintDataTypeValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.stereotype.Service
-
-@Service("default-data-type-validator")
-open class BluePrintDataTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintDataTypeValidator {
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, dataType: DataType) {
- dataType.properties?.let {
-
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, dataType.properties!!)
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
deleted file mode 100644
index c8985774..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants
-import org.onap.ccsdk.apps.controllerblueprints.validation.extension.ResourceDefinitionValidator
-import org.springframework.stereotype.Service
-import java.io.File
-import java.util.*
-
-
-@Service
-open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService,
- private val resourceDefinitionValidator: ResourceDefinitionValidator)
- : BluePrintValidatorService {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintDesignTimeValidatorService::class.toString())
-
- override fun validateBluePrints(basePath: String): Boolean {
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(UUID.randomUUID().toString(), basePath)
- return validateBluePrints(bluePrintRuntimeService)
- }
-
- override fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean {
-
- bluePrintTypeValidatorService.validateServiceTemplate(bluePrintRuntimeService, "service_template",
- bluePrintRuntimeService.bluePrintContext().serviceTemplate)
-
- // Validate Resource Definitions
- validateResourceDefinitions(bluePrintRuntimeService)
-
- if (bluePrintRuntimeService.getBluePrintError().errors.size > 0) {
- throw BluePrintException("failed in blueprint validation : ${bluePrintRuntimeService.getBluePrintError().errors.joinToString("\n")}")
- }
- return true
- }
-
- private fun validateResourceDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>) {
- // Validate Resource Dictionary
- val blueprintBasePath = bluePrintRuntimeService.bluePrintContext().rootPath
-
- val resourceDefinitionsPath = blueprintBasePath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator)
- .plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
-
- val resourceDefinitionFile = File(resourceDefinitionsPath)
-
- if (resourceDefinitionFile.exists()) {
- val resourceDefinitionMap = JacksonUtils.getMapFromFile(resourceDefinitionFile, ResourceDefinition::class.java)
-
- resourceDefinitionMap?.forEach { resourceDefinitionName, resourceDefinition ->
- resourceDefinitionValidator.validate(bluePrintRuntimeService, resourceDefinitionName, resourceDefinition)
- }
- }
- }
-}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
deleted file mode 100644
index 601ba4f5..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.fasterxml.jackson.databind.JsonNode
-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.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintExpressionService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-
-@Service("default-node-template-validator")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTemplateValidator {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintNodeTemplateValidatorImpl::class.toString())
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var bluePrintContext: BluePrintContext
- var paths: MutableList<String> = arrayListOf()
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) {
- log.info("Validating NodeTemplate($name)")
-
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- paths.add(name)
-
- val type: String = nodeTemplate.type
-
- val nodeType: NodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(type)
- ?: throw BluePrintException("Failed to get NodeType($type) definition for NodeTemplate($name)")
-
- nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) }
- nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeType, name, nodeTemplate) }
- nodeTemplate.requirements?.let { validateRequirementAssignments(nodeType, name, nodeTemplate) }
- nodeTemplate.interfaces?.let { validateInterfaceAssignments(nodeType, name, nodeTemplate) }
- nodeTemplate.artifacts?.let { validateArtifactDefinitions(nodeTemplate.artifacts!!) }
-
- // Perform Extension Validation
- validateExtension("$type-node-template-validator", name, nodeTemplate)
-
- paths.removeAt(paths.lastIndex)
- }
-
- @Throws(BluePrintException::class)
- open fun validateArtifactDefinitions(artifacts: MutableMap<String, ArtifactDefinition>) {
- paths.add("artifacts")
- artifacts.forEach { artifactDefinitionName, artifactDefinition ->
- bluePrintTypeValidatorService.validateArtifactDefinition(bluePrintRuntimeService,
- artifactDefinitionName, artifactDefinition)
- }
- 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("failed to get definition for the property ($propertyName)")
-
- validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
-
- }
- }
-
- @Throws(BluePrintException::class)
- open fun validatePropertyAssignment(propertyName: String, propertyDefinition: PropertyDefinition,
- propertyAssignment: JsonNode) {
- // Check and Validate if Expression Node
- val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment)
- if (!expressionData.isExpression) {
- checkPropertyValue(propertyName, propertyDefinition, propertyAssignment)
- }
- }
-
- @Throws(BluePrintException::class)
- open fun validateCapabilityAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
- val capabilities = nodeTemplate.capabilities
- paths.add("capabilities")
- capabilities?.forEach { capabilityName, capabilityAssignment ->
- paths.add(capabilityName)
-
- val capabilityDefinition = nodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) capability definition ($capabilityName) " +
- "from NodeType(${nodeTemplate.type})")
-
- validateCapabilityAssignment(nodeTemplateName, capabilityName, capabilityDefinition, capabilityAssignment)
-
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- @Throws(BluePrintException::class)
- open fun validateCapabilityAssignment(nodeTemplateName: String, capabilityName: String,
- capabilityDefinition: CapabilityDefinition, capabilityAssignment: CapabilityAssignment) {
-
- capabilityAssignment.properties?.let { validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!) }
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateRequirementAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
- val requirements = nodeTemplate.requirements
- paths.add("requirements")
- requirements?.forEach { requirementName, requirementAssignment ->
- paths.add(requirementName)
- val requirementDefinition = nodeType.requirements?.get(requirementName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) requirement definition ($requirementName) from" +
- " NodeType(${nodeTemplate.type})")
- // Validate Requirement Assignment
- validateRequirementAssignment(nodeTemplateName, requirementName, requirementDefinition, requirementAssignment)
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String,
- requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) {
- log.info("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName, requirementAssignmentName)
- val requirementNodeTemplateName = requirementAssignment.node!!
- val capabilityName = requirementAssignment.capability
- val relationship = requirementAssignment.relationship!!
-
- check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
- throw BluePrintException("Failed to get relationship type ($relationship) for NodeTemplate($nodeTemplateName)'s requirement($requirementAssignmentName)")
- }
-
- val relationShipNodeTemplate = bluePrintContext.serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
- ?: throw BluePrintException("Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
- "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)")
-
- relationShipNodeTemplate.capabilities?.get(capabilityName)
- ?: throw BluePrintException("Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
- "capability($capabilityName) for NodeTemplate ($nodeTemplateName)'s requirement($requirementAssignmentName)")
-
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateInterfaceAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
-
- val interfaces = nodeTemplate.interfaces
- paths.add("interfaces")
- interfaces?.forEach { interfaceAssignmentName, interfaceAssignment ->
- paths.add(interfaceAssignmentName)
- val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) interface definition ($interfaceAssignmentName) from" +
- " NodeType(${nodeTemplate.type})")
-
- validateInterfaceAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
-
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateInterfaceAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
-
- val operations = interfaceAssignment.operations
- operations?.let {
- validateInterfaceOperationsAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
- }
-
- }
-
- @Throws(BluePrintException::class)
- open fun validateInterfaceOperationsAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
-
- val operations = interfaceAssignment.operations
- operations?.let {
- it.forEach { operationAssignmentName, operationAssignments ->
-
- val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)")
-
- log.info("Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation ($operationAssignmentName)")
-
- val inputs = operationAssignments.inputs
- val outputs = operationAssignments.outputs
-
- inputs?.forEach { propertyName, propertyAssignment ->
- val propertyDefinition = operationDefinition.inputs?.get(propertyName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation " +
- "definition ($operationAssignmentName) property definition($propertyName)")
- // Check the property values with property definition
- validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
- }
-
- outputs?.forEach { propertyName, propertyAssignment ->
- val propertyDefinition = operationDefinition.outputs?.get(propertyName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName) " +
- "output property definition($propertyName)")
- // Check the property values with property definition
- validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
- }
-
- }
- }
-
- }
-
- open fun checkPropertyValue(propertyName: String, propertyDefinition: PropertyDefinition, propertyAssignment: JsonNode) {
- val propertyType = propertyDefinition.type
- val isValid: Boolean
-
- if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
- isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment)
-
- } else if (BluePrintTypes.validComplexTypes().contains(propertyType)) {
- isValid = true
- } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
-
- val entrySchemaType = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
-
- if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) {
- checkPropertyDataType(entrySchemaType, propertyName)
- }
- isValid = JacksonUtils.checkJsonNodeValueOfCollectionType(propertyType, propertyAssignment)
- } else {
- checkPropertyDataType(propertyType, propertyName)
- isValid = true
- }
-
- check(isValid) {
- throw BluePrintException("property(propertyName) defined of type(propertyType) is not comptable with the value (propertyAssignment)")
- }
- }
-
- private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
-
- val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException("DataType ($dataTypeName) for the property ($propertyName) not found")
-
- checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
-
- }
-
- private fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) {
- check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ")
- }
- }
-
- private fun validateExtension(referencePrefix: String, name: String, nodeTemplate: NodeTemplate) {
- val customValidator = bluePrintTypeValidatorService
- .bluePrintValidator(referencePrefix, BluePrintNodeTemplateValidator::class.java)
-
- customValidator?.let {
- it.validate(bluePrintRuntimeService, name, nodeTemplate)
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
deleted file mode 100644
index 1108c1b5..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyOrThrow
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-
-@Service("default-node-type-validator")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTypeValidator {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var bluePrintContext: BluePrintContext
- var paths: MutableList<String> = arrayListOf()
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTypeName: String, nodeType: NodeType) {
- log.trace("Validating NodeType($nodeTypeName)")
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- paths.add(nodeTypeName)
-
- val derivedFrom: String = nodeType.derivedFrom
- //Check Derived From
- checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
-
- if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
- bluePrintContext.serviceTemplate.nodeTypes?.get(derivedFrom)
- ?: throw BluePrintException("Failed to get derivedFrom NodeType($derivedFrom)'s for NodeType($nodeTypeName)")
- }
-
- nodeType.attributes?.let {
- bluePrintTypeValidatorService.validateAttributeDefinitions(bluePrintRuntimeService, nodeType.attributes!!)
- }
-
- nodeType.properties?.let {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, nodeType.properties!!)
- }
-
- nodeType.capabilities?.let { validateCapabilityDefinitions(nodeTypeName, nodeType) }
- nodeType.requirements?.let { validateRequirementDefinitions(nodeTypeName, nodeType) }
- nodeType.interfaces?.let { validateInterfaceDefinitions(nodeType.interfaces!!) }
-
- paths.removeAt(paths.lastIndex)
- }
-
- fun checkValidNodeTypesDerivedFrom(nodeTypeName: String, derivedFrom: String) {
- check(BluePrintTypes.validNodeTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException("Failed to get node type ($nodeTypeName)'s derivedFrom($derivedFrom) definition ")
- }
- }
-
- open fun validateCapabilityDefinitions(nodeTypeName: String, nodeType: NodeType) {
- val capabilities = nodeType.capabilities
- paths.add("capabilities")
- capabilities?.forEach { capabilityName, capabilityDefinition ->
- paths.add(capabilityName)
-
- validateCapabilityDefinition(nodeTypeName, nodeType, capabilityName, capabilityDefinition)
-
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- open fun validateCapabilityDefinition(nodeTypeName: String, nodeType: NodeType, capabilityName: String,
- capabilityDefinition: CapabilityDefinition) {
- val capabilityType = capabilityDefinition.type
- check(BluePrintTypes.validCapabilityTypes.contains(capabilityType)) {
- throw BluePrintException("failed to get CapabilityType($capabilityType) for NodeType($nodeTypeName)")
- }
- }
-
- open fun validateRequirementDefinitions(nodeName: String, nodeType: NodeType) {
- paths.add("requirements")
- val requirements = nodeType.requirements
-
- requirements?.forEach { requirementDefinitionName, requirementDefinition ->
- paths.add(requirementDefinitionName)
- validateRequirementDefinition(nodeName, nodeType, requirementDefinitionName, requirementDefinition)
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- open fun validateRequirementDefinition(nodeTypeName: String, nodeType: NodeType, requirementDefinitionName: String,
- requirementDefinition: RequirementDefinition) {
-
- log.info("validating NodeType({}) RequirementDefinition ({}) ", nodeTypeName, requirementDefinitionName)
- val requirementNodeTypeName = requirementDefinition.node!!
- val capabilityName = requirementDefinition.capability
- val relationship = requirementDefinition.relationship!!
-
- check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
- throw BluePrintException("failed to get relationship($relationship) for NodeType($nodeTypeName)'s requirement($requirementDefinitionName)")
- }
-
- val relationShipNodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
- ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s for requirement($requirementDefinitionName) ")
-
- relationShipNodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s " +
- "capability($nodeTypeName) for NodeType ($capabilityName)'s requirement($requirementDefinitionName) ")
-
- }
-
- open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) {
- paths.add("interfaces")
- interfaces.forEach { interfaceName, interfaceDefinition ->
- paths.add(interfaceName)
- interfaceDefinition.operations?.let { validateOperationDefinitions(interfaceDefinition.operations!!) }
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- open fun validateOperationDefinitions(operations: MutableMap<String, OperationDefinition>) {
- paths.add("operations")
- operations.forEach { opertaionName, operationDefinition ->
- paths.add(opertaionName)
- operationDefinition.implementation?.let { validateImplementation(operationDefinition.implementation!!) }
-
- operationDefinition.inputs?.let {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, operationDefinition.inputs!!)
- }
-
- operationDefinition.outputs?.let {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, operationDefinition.outputs!!)
- }
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- open fun validateImplementation(implementation: Implementation) {
- checkNotEmptyOrThrow(implementation.primary)
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
deleted file mode 100644
index 62a82286..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.format
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service("default-property-definition-validator")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintPropertyDefinitionValidator {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) {
- this.bluePrintRuntimeService = bluePrintRuntimeService
-
-
- log.trace("Validating PropertyDefinition($name)")
-
- val dataType: String = propertyDefinition.type
-
- when {
- BluePrintTypes.validPrimitiveTypes().contains(dataType) -> {
- // Do Nothing
- }
- BluePrintTypes.validComplexTypes().contains(dataType) -> {
- // Do Nothing
- }
- BluePrintTypes.validCollectionTypes().contains(dataType) -> {
- val entrySchemaType: String = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, name))
- checkPrimitiveOrComplex(entrySchemaType, name)
- }
- else -> checkPropertyDataType(dataType, name)
- }
- }
-
-
- private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean {
- if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
- return true
- } else {
- throw BluePrintException(format("DataType({}) for the property({}) is not valid", dataType, propertyName))
- }
- }
-
- private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
-
- val dataType = bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
-
- checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
- }
-
- private fun checkDataType(key: String): Boolean {
- return bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.containsKey(key) ?: false
- }
-
- open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) {
- check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException(format("Failed to get DataType({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom))
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
deleted file mode 100644
index 37d3d1bd..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.google.common.base.Preconditions
-import org.apache.commons.lang3.StringUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service("default-service-template-validator")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintServiceTemplateValidator {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var error: BluePrintError
-
- var paths: MutableList<String> = arrayListOf()
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) {
- log.trace("Validating Service Template..")
- try {
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.error = bluePrintRuntimeService.getBluePrintError()
-
- serviceTemplate.metadata?.let { validateMetadata(serviceTemplate.metadata!!) }
- serviceTemplate.dataTypes?.let { validateDataTypes(serviceTemplate.dataTypes!!) }
- serviceTemplate.artifactTypes?.let { validateArtifactTypes(serviceTemplate.artifactTypes!!) }
- serviceTemplate.nodeTypes?.let { validateNodeTypes(serviceTemplate.nodeTypes!!) }
- serviceTemplate.topologyTemplate?.let { validateTopologyTemplate(serviceTemplate.topologyTemplate!!) }
- } catch (e: Exception) {
- log.error("failed in blueprint service template validation", e)
- error.addError(BluePrintConstants.PATH_SERVICE_TEMPLATE, paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!)
- }
- }
-
- fun validateMetadata(metaDataMap: MutableMap<String, String>) {
-
- paths.add(BluePrintConstants.PATH_METADATA)
-
- val templateName = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_NAME]
- val templateVersion = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_VERSION]
- val templateTags = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_TAGS]
- val templateAuthor = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]
-
- Preconditions.checkArgument(StringUtils.isNotBlank(templateName), "failed to get template name metadata")
- Preconditions.checkArgument(StringUtils.isNotBlank(templateVersion), "failed to get template version metadata")
- Preconditions.checkArgument(StringUtils.isNotBlank(templateTags), "failed to get template tags metadata")
- Preconditions.checkArgument(StringUtils.isNotBlank(templateAuthor), "failed to get template author metadata")
-
- paths.removeAt(paths.lastIndex)
- }
-
-
- fun validateDataTypes(dataTypes: MutableMap<String, DataType>) {
-
- paths.add(BluePrintConstants.PATH_DATA_TYPES)
- dataTypes.forEach { dataTypeName, dataType ->
- // Validate Single Data Type
- bluePrintTypeValidatorService.validateDataType(bluePrintRuntimeService, dataTypeName, dataType)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- fun validateArtifactTypes(artifactTypes: MutableMap<String, ArtifactType>) {
- paths.add(BluePrintConstants.PATH_ARTIFACT_TYPES)
- artifactTypes.forEach { artifactName, artifactType ->
- // Validate Single Artifact Type
- bluePrintTypeValidatorService.validateArtifactType(bluePrintRuntimeService, artifactName, artifactType)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- fun validateNodeTypes(nodeTypes: MutableMap<String, NodeType>) {
- paths.add(BluePrintConstants.PATH_NODE_TYPES)
- nodeTypes.forEach { nodeTypeName, nodeType ->
- // Validate Single Node Type
- bluePrintTypeValidatorService.validateNodeType(bluePrintRuntimeService, nodeTypeName, nodeType)
- }
- paths.removeAt(paths.lastIndex)
- }
-
- fun validateTopologyTemplate(topologyTemplate: TopologyTemplate) {
- paths.add(BluePrintConstants.PATH_TOPOLOGY_TEMPLATE)
- bluePrintTypeValidatorService.validateTopologyTemplate(bluePrintRuntimeService, "topologyTemplate", topologyTemplate)
- paths.removeAt(paths.lastIndex)
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
deleted file mode 100644
index 841d86ea..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.data.TopologyTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service("default-topology-template-validator")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintTopologyTemplateValidator {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) {
- log.trace("Validating Topology Template..")
- this.bluePrintRuntimeService = bluePrintRuntimeService
-
- // Validate Inputs
- topologyTemplate.inputs?.let { validateInputs(topologyTemplate.inputs!!) }
- // Validate Node Templates
- topologyTemplate.nodeTemplates?.let { validateNodeTemplates(topologyTemplate.nodeTemplates!!) }
- // Validate Workflow
- topologyTemplate.workflows?.let { validateWorkflows(topologyTemplate.workflows!!) }
- }
-
- @Throws(BluePrintException::class)
- fun validateInputs(inputs: MutableMap<String, PropertyDefinition>) {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, inputs)
- }
-
-
- @Throws(BluePrintException::class)
- fun validateNodeTemplates(nodeTemplates: MutableMap<String, NodeTemplate>) {
-
- nodeTemplates.forEach { nodeTemplateName, nodeTemplate ->
- // Validate Single Node Template
- bluePrintTypeValidatorService.validateNodeTemplate(bluePrintRuntimeService, nodeTemplateName, nodeTemplate)
- }
- }
-
- @Throws(BluePrintException::class)
- open fun validateWorkflows(workflows: MutableMap<String, Workflow>) {
-
- workflows.forEach { workflowName, workflow ->
- // Validate Single workflow
- bluePrintTypeValidatorService.validateWorkflow(bluePrintRuntimeService, workflowName, workflow)
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
deleted file mode 100644
index d8c008ff..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.*
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.context.ApplicationContext
-import org.springframework.stereotype.Service
-
-@Service
-class BluePrintTypeValidatorServiceImpl : BluePrintTypeValidatorService {
-
- companion object {
- const val PREFIX_DEFAULT = "default"
- }
-
- @Autowired
- private lateinit var context: ApplicationContext
-
- override fun <T : BluePrintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T? {
- return if (context.containsBean(referenceName)) {
- context.getBean(referenceName, classType)
- } else {
- null
- }
- }
-
- override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? {
- return context.getBeansOfType(classType)
- .filter { it.key.startsWith(referenceNamePrefix) }
- .mapNotNull { it.value }
- }
-
- override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? {
- return context.getBeansOfType(classType).mapNotNull { it.value }
- }
-
- override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> {
- return bluePrintValidators(PREFIX_DEFAULT, BluePrintServiceTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ServiceTemplate validators")
- }
-
- override fun getDataTypeValidators(): List<BluePrintDataTypeValidator> {
- return bluePrintValidators(PREFIX_DEFAULT, BluePrintDataTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default DataType validators")
- }
-
- override fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> {
- return bluePrintValidators(PREFIX_DEFAULT, BluePrintArtifactTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ArtifactType validators")
- }
-
- override fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator> {
- return bluePrintValidators(PREFIX_DEFAULT, BluePrintArtifactDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ArtifactDefinition validators")
- }
-
- override fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> {
- return bluePrintValidators(PREFIX_DEFAULT, BluePrintNodeTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default NodeType validators")
- }
-
- override fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> {
- return bluePrintValidators(PREFIX_DEFAULT, BluePrintTopologyTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default TopologyTemplate validators")
- }
-
- override fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> {
- return bluePrintValidators(PREFIX_DEFAULT, BluePrintNodeTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default NodeTemplate validators")
- }
-
- override fun getWorkflowValidators(): List<BluePrintWorkflowValidator> {
- return bluePrintValidators(PREFIX_DEFAULT, BluePrintWorkflowValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default Workflow validators")
- }
-
- override fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> {
- return bluePrintValidators(PREFIX_DEFAULT, BluePrintPropertyDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default PropertyDefinition validators")
- }
-
- override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> {
- return bluePrintValidators(PREFIX_DEFAULT, BluePrintAttributeDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default AttributeDefinition validators")
- }
-}
-
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintValidationConfiguration.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintValidationConfiguration.kt
deleted file mode 100644
index bad14791..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintValidationConfiguration.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Configuration
-
-@Configuration
-@ComponentScan
-open class BluePrintValidationConfiguration \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
deleted file mode 100644
index 519358b1..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service("default-workflow-validator")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintWorkflowValidator {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
- var paths: MutableList<String> = arrayListOf()
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, workflowName: String, workflow: Workflow) {
- log.info("Validating Workflow($workflowName)")
-
- this.bluePrintRuntimeService = bluePrintRuntimeService
-
-
- paths.add(workflowName)
- paths.joinToString(BluePrintConstants.PATH_DIVIDER)
-
- // Step Validation Start
- paths.add("steps")
- workflow.steps?.forEach { stepName, step ->
- paths.add(stepName)
- paths.joinToString(BluePrintConstants.PATH_DIVIDER)
-
- // Validate target
- step.target?.let {
- try {
- val nodeTemplate = bluePrintRuntimeService.bluePrintContext().nodeTemplateByName(it)
-
- val nodeTypeDerivedFrom = bluePrintRuntimeService.bluePrintContext().nodeTemplateNodeType(it).derivedFrom
-
- check(nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_DG
- || nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_COMPONENT) {
- "NodeType(${nodeTemplate.type}) derived from is '$nodeTypeDerivedFrom', Expected " +
- "'${BluePrintConstants.MODEL_TYPE_NODE_DG}' or '${BluePrintConstants.MODEL_TYPE_NODE_COMPONENT}'"
- }
- } catch (e: Exception) {
- bluePrintRuntimeService.getBluePrintError()
- .addError("Failed to validate Workflow($workflowName)'s step($stepName)'s " +
- "definition", paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!)
- }
- }
- paths.removeAt(paths.lastIndex)
- }
- paths.removeAt(paths.lastIndex)
- // Step Validation Ends
- paths.removeAt(paths.lastIndex)
-
- workflow.inputs?.let {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, workflow.inputs!!)
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
deleted file mode 100644
index 002dd9fb..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation.extension
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-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.service.ResourceAssignmentValidationServiceImpl
-import org.springframework.stereotype.Service
-import java.io.File
-
-@Service("artifact-mapping-resource-artifact-definition-validator")
-open class ArtifactMappingResourceValidator(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService)
- : BluePrintArtifactDefinitionValidator {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(ArtifactMappingResourceValidator::class.toString())
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
-
- val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
- val file: String = artifactDefinition.file
- val completePath = bluePrintContext.rootPath.plus(File.separator).plus(file)
- log.trace("Validation artifact-mapping-resource($completePath)")
- val resourceAssignment = JacksonUtils.getListFromFile(completePath, ResourceAssignment::class.java)
- val resourceAssignmentValidationService = ResourceAssignmentValidationServiceImpl()
- resourceAssignmentValidationService.validate(resourceAssignment)
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
deleted file mode 100644
index 6975ec61..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation.extension
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-interface ResourceDefinitionValidator : BluePrintValidator<ResourceDefinition>
-
-@Service
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ResourceDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : ResourceDefinitionValidator {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceDefinitionValidatorImpl::class.java)
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- resourceDefinition: ResourceDefinition) {
- log.trace("validating resource definition($name)")
- resourceDefinition.sources.forEach { name, nodeTemplate ->
- bluePrintTypeValidatorService.validateNodeTemplate(bluePrintRuntimeService, name, nodeTemplate)
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt b/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
deleted file mode 100644
index d844d1ec..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import io.mockk.every
-import io.mockk.mockk
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType
-import org.onap.ccsdk.apps.controllerblueprints.core.data.Step
-import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.DefaultBluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.validation.extension.ResourceDefinitionValidator
-import kotlin.test.assertEquals
-import kotlin.test.assertTrue
-
-class BluePrintDesignTimeValidatorServiceTest {
-
- private val blueprintBasePath: String = ("./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
- private val bluePrintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
- private val mockBluePrintTypeValidatorService = MockBluePrintTypeValidatorService()
- private val resourceDefinitionValidator = mockk<ResourceDefinitionValidator>()
- private val defaultBluePrintValidatorService = BluePrintDesignTimeValidatorService(mockBluePrintTypeValidatorService, resourceDefinitionValidator)
- private val workflowValidator = BluePrintWorkflowValidatorImpl(mockBluePrintTypeValidatorService)
-
- @Test
- fun testValidateOfType() {
- every { resourceDefinitionValidator.validate(bluePrintRuntime, any(), any()) } returns Unit
-
- val valid = defaultBluePrintValidatorService.validateBluePrints(bluePrintRuntime)
- assertTrue(valid, "failed in blueprint Validation")
- }
-
- @Test
- fun testValidateWorkflowFailToFoundNodeTemplate() {
- val workflowName = "resource-assignment"
-
- val step = Step()
- step.target = "TestCaseFailNoNodeTemplate"
- val workflow = Workflow()
- workflow.steps = mutableMapOf("test" to step)
- workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
-
- assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size)
- assertEquals("Failed to validate Workflow(resource-assignment)'s step(test)'s definition : resource-assignment/steps/test : could't get node template for the name(TestCaseFailNoNodeTemplate)", bluePrintRuntime.getBluePrintError().errors[0])
- }
-
- @Test
- fun testValidateWorkflowFailNodeTemplateNotDgGeneric() {
- val workflowName = "resource-assignment"
- val nodeTemplateName = "resource-assignment-process"
-
- val nodeTemplate = mockk<NodeTemplate>()
- every { nodeTemplate.type } returns "TestNodeType"
-
- val nodeType = mockk<NodeType>()
- every { nodeType.derivedFrom } returns "tosca.nodes.TEST"
-
- val blueprintContext = mockk<BluePrintContext>()
- every { blueprintContext.nodeTemplateByName(nodeTemplateName) } returns nodeTemplate
- every { blueprintContext.nodeTemplateNodeType(nodeTemplateName) } returns nodeType
-
- val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234")
-
- every { bluePrintRuntime.getBluePrintError() } returns BluePrintError()
- every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
-
- val step = Step()
- step.target = nodeTemplateName
- val workflow = Workflow()
- workflow.steps = mutableMapOf("test" to step)
- workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
-
- assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size)
- assertEquals("Failed to validate Workflow(resource-assignment)'s step(test)'s definition : " +
- "resource-assignment/steps/test : NodeType(TestNodeType) derived from is 'tosca.nodes.TEST', " +
- "Expected 'tosca.nodes.DG' or 'tosca.nodes.Component'", bluePrintRuntime.getBluePrintError().errors[0])
- }
-
- @Test
- fun testValidateWorkflowSuccess() {
- val workflowName = "resource-assignment"
- workflowValidator.validate(bluePrintRuntime, workflowName, bluePrintRuntime.bluePrintContext().workflowByName(workflowName))
- }
-
-}
-
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt b/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
deleted file mode 100644
index 65574c22..00000000
--- a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.validation
-
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.*
-
-class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService {
-
- override fun <T : BluePrintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T? {
- return null
- }
-
- override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? {
- return null
- }
-
- override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? {
- return null
- }
-
- override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> {
- return listOf(BluePrintServiceTemplateValidatorImpl(this))
- }
-
- override fun getDataTypeValidators(): List<BluePrintDataTypeValidator> {
- return listOf(BluePrintDataTypeValidatorImpl(this))
- }
-
- override fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> {
- return listOf(BluePrintArtifactTypeValidatorImpl(this))
- }
-
- override fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator> {
- return listOf(BluePrintArtifactDefinitionValidatorImpl(this))
- }
-
- override fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> {
- return listOf(BluePrintNodeTypeValidatorImpl(this))
- }
-
- override fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> {
- return listOf(BluePrintTopologyTemplateValidatorImpl(this))
- }
-
- override fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> {
- return listOf(BluePrintNodeTemplateValidatorImpl(this))
- }
-
- override fun getWorkflowValidators(): List<BluePrintWorkflowValidator> {
- return listOf(BluePrintWorkflowValidatorImpl(this))
- }
-
- override fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> {
- return listOf(BluePrintPropertyDefinitionValidatorImpl(this))
- }
-
- override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> {
- return listOf(BluePrintAttributeDefinitionValidatorImpl(this))
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/db-resources/pom.xml b/ms/controllerblueprints/modules/db-resources/pom.xml
deleted file mode 100644
index d1c3c44c..00000000
--- a/ms/controllerblueprints/modules/db-resources/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <artifactId>db-resources</artifactId>
- <name>Controller Blueprints DB Resources</name>
-
- <properties>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt
deleted file mode 100644
index e4323152..00000000
--- a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.db.resources
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintArchiveUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import java.io.File
-import java.nio.file.Path
-import java.util.*
-import javax.persistence.MappedSuperclass
-
-@MappedSuperclass
-abstract class BlueprintCatalogServiceImpl(private val blueprintValidator: BluePrintValidatorService)
- : BluePrintCatalogService {
-
- override fun saveToDatabase(blueprintFile: File, validate: Boolean): String {
- val extractedDirectory: File
- val archivedDirectory: File
- val toDeleteDirectory: File
- val blueprintId = UUID.randomUUID().toString()
-
- if (blueprintFile.isDirectory) {
- extractedDirectory = blueprintFile
- archivedDirectory = File("$blueprintFile.zip")
- toDeleteDirectory = archivedDirectory
-
- if (!BluePrintArchiveUtils.compress(blueprintFile, archivedDirectory, true)) {
- throw BluePrintException("Fail to compress blueprint")
- }
- } else {
- val targetDir = "${blueprintFile.parent}/${BluePrintFileUtils.stripFileExtension(blueprintFile.name)}"
-
- extractedDirectory = BluePrintArchiveUtils.deCompress(blueprintFile, targetDir)
- archivedDirectory = blueprintFile
- toDeleteDirectory = extractedDirectory
- }
-
- var valid = BluePrintConstants.FLAG_N
- if (validate) {
- blueprintValidator.validateBluePrints(extractedDirectory.path)
- valid = BluePrintConstants.FLAG_Y
- }
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(blueprintId, extractedDirectory.path)
- val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
- metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = blueprintId
- metadata[BluePrintConstants.PROPERTY_BLUEPRINT_VALID] = valid
-
- save(metadata, archivedDirectory)
-
- toDeleteDirectory.deleteRecursively()
-
- return blueprintId
- }
-
- override fun getFromDatabase(name: String, version: String, extract: Boolean): Path = get(name, version, extract)
- ?: throw BluePrintException("Could not find blueprint $name:$version from database")
-
- override fun deleteFromDatabase(name: String, version: String) = delete(name, version)
-
- abstract fun save(metadata: MutableMap<String, String>, archiveFile: File)
- abstract fun get(name: String, version: String, extract: Boolean): Path?
- abstract fun delete(name: String, version: String)
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelContentRepository.kt b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelContentRepository.kt
deleted file mode 100644
index 680f1b2c..00000000
--- a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelContentRepository.kt
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.db.resources.repository
-
-import org.jetbrains.annotations.NotNull
-import java.util.Optional
-import org.springframework.data.jpa.repository.JpaRepository
-import org.springframework.data.repository.NoRepositoryBean
-
-/**
- * @param <T> Model
- * @param <B> ModelContent
- */
-@NoRepositoryBean
-interface ModelContentRepository<T, B> : JpaRepository<B, String> {
-
- /**
- * This is a findById method
- *
- * @param id id
- * @return Optional<T>
- */
- @NotNull
- override fun findById(@NotNull id: String): Optional<B>
-
- /**
- * This is a findTopByBlueprintModelAndContentType method
- *
- * @param blueprintModel blueprintModel
- * @param contentType contentType
- * @return B?
- */
- fun findTopByBlueprintModelAndContentType(blueprintModel: T, contentType: String): B?
-
- /**
- * This is a findByBlueprintModelAndContentType method
- *
- * @param blueprintModel blueprintModel
- * @param contentType contentType
- * @return List<B>
- */
- fun findByBlueprintModelAndContentType(blueprintModel: T, contentType: String): List<B>
-
- /**
- * This is a findByBlueprintModel method
- *
- * @param blueprintModel T
- * @return List<B>
- */
- fun findByBlueprintModel(blueprintModel: T): List<B>
-
- /**
- * This is a findByBlueprintModelAndContentTypeAndName method
- *
- * @param blueprintModel blueprintModel
- * @param contentType contentType
- * @param name name
- * @return B?
- */
- fun findByBlueprintModelAndContentTypeAndName(blueprintModel: T, contentType: String, name: String): B?
-
- /**
- * This is a deleteByMdeleteByBlueprintModelodelName method
- *
- * @param blueprintModel T
- */
- fun deleteByBlueprintModel(blueprintModel: T)
-
- /**
- * This is a deleteById method
- *
- * @param id id
- */
- override fun deleteById(@NotNull id: String)
-
-}
diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelRepository.kt b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelRepository.kt
deleted file mode 100644
index e796c366..00000000
--- a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelRepository.kt
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.db.resources.repository
-
-import org.jetbrains.annotations.NotNull
-import org.springframework.data.jpa.repository.JpaRepository
-import org.springframework.data.repository.NoRepositoryBean
-import java.util.*
-import javax.transaction.Transactional
-
-/**
- * @param <T> Model
- */
-@NoRepositoryBean
-interface ModelRepository<T> : JpaRepository<T, String> {
-
- /**
- * This is a findById method
- *
- * @param id id
- * @return Optional<T>
- */
- @NotNull
- override fun findById(@NotNull id: String): Optional<T>
-
- /**
- * This is a findByArtifactNameAndArtifactVersion method
- *
- * @param artifactName artifactName
- * @param artifactVersion artifactVersion
- * @return T?
- */
- fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): T?
-
- /**
- * This is a findTopByArtifactNameOrderByArtifactIdDesc method
- *
- * @param artifactName artifactName
- * @return T?
- */
- fun findTopByArtifactNameOrderByArtifactVersionDesc(artifactName: String): T?
-
- /**
- * This is a findTopByArtifactName method
- *
- * @param artifactName artifactName
- * @return List<T>
- */
- fun findTopByArtifactName(artifactName: String): List<T>
-
- /**
- * This is a findByTagsContainingIgnoreCase method
- *
- * @param tags tags
- * @return List<T>
- */
- fun findByTagsContainingIgnoreCase(tags: String): List<T>
-
- /**
- * This is a deleteByArtifactNameAndArtifactVersion method
- *
- * @param artifactName artifactName
- * @param artifactVersion artifactVersion
- */
- @Transactional
- fun deleteByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String)
-
- /**
- * This is a deleteById method
- *
- * @param id id
- */
- override fun deleteById(@NotNull id: String)
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt b/ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt
deleted file mode 100644
index 60541c3f..00000000
--- a/ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.db.resources
-
-// TODO
-class BlueprintCatalogServiceImplTest \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
deleted file mode 100644
index 8263f881..00000000
--- a/ms/controllerblueprints/modules/pom.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
- </parent>
- <artifactId>modules</artifactId>
- <name>Controller Blueprints Modules</name>
- <packaging>pom</packaging>
-
- <modules>
- <module>blueprint-core</module>
- <module>resource-dict</module>
- <module>db-resources</module>
- <module>blueprint-scripts</module>
- <module>blueprint-validation</module>
- <module>service</module>
- </modules>
-
- <dependencies>
- <!-- Test Dependencies -->
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <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/load/model_type/node_type/source-component-java.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json
deleted file mode 100644
index 95a9801d..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "description": "This is Custom Java Component Resource Source Node Type",
- "version": "1.0.0",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default" : "DYNAMIC",
- "constraints": [
- {
- "validValues": [
- "DYNAMIC"
- ]
- }
- ]
- },
- "class-name": {
- "required": true,
- "type": "string",
- "description" : "Fully Qualified Class Name ( <Package Name> + . + <Class Name> )"
- },
- "key-dependencies": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.nodes.ResourceSource"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json
deleted file mode 100644
index 13e234e1..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "description": "This is Default Resource Source Node Type",
- "version": "1.0.0",
- "properties": {
- "key": {
- "required": false,
- "type": "string"
- },
- "key-dependencies": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.nodes.ResourceSource"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json
deleted file mode 100644
index 126ea30b..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "description": "This is Input Resource Source Node Type",
- "version": "1.0.0",
- "properties": {
- "key": {
- "required": false,
- "type": "string"
- },
- "key-dependencies": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.nodes.ResourceSource"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-primary-db.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-primary-db.json
deleted file mode 100644
index 661a9503..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-primary-db.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "description": "This is Database Resource Source Node Type",
- "version": "1.0.0",
- "properties": {
- "type": {
- "required": true,
- "type": "string",
- "constraints": [
- {
- "valid_values": [
- "SQL",
- "PLSQL"
- ]
- }
- ]
- },
- "query": {
- "required": true,
- "type": "string"
- },
- "input-key-mapping": {
- "required": false,
- "type": "map",
- "entry_schema": {
- "type": "string"
- }
- },
- "output-key-mapping": {
- "required": false,
- "type": "map",
- "entry_schema": {
- "type": "string"
- }
- },
- "key-dependencies": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.nodes.ResourceSource"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json
deleted file mode 100644
index f8dd8b6f..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json
+++ /dev/null
@@ -1,61 +0,0 @@
-{
- "description": "This is Rest Resource Source Node Type",
- "version": "1.0.0",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "JSON",
- "constraints": [
- {
- "valid_values": [
- "JSON"
- ]
- }
- ]
- },
- "url-path": {
- "required": true,
- "type": "string"
- },
- "path": {
- "required": true,
- "type": "string"
- },
- "expression-type": {
- "required": false,
- "type": "string",
- "default": "JSON_PATH",
- "constraints": [
- {
- "valid_values": [
- "JSON_PATH",
- "JSON_POINTER"
- ]
- }
- ]
- },
- "input-key-mapping": {
- "required": false,
- "type": "map",
- "entry_schema": {
- "type": "string"
- }
- },
- "output-key-mapping": {
- "required": false,
- "type": "map",
- "entry_schema": {
- "type": "string"
- }
- },
- "key-dependencies": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.nodes.ResourceSource"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json
deleted file mode 100644
index 2ef553e2..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "description": "TOSCA base type for Resource Sources",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/address.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/address.json
deleted file mode 100644
index e999938c..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/address.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "address",
- "tags" : "address",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "address",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "address"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic-cloud-region.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic-cloud-region.json
deleted file mode 100644
index 2528fc7f..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic-cloud-region.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "aic-cloud-region",
- "tags" : "aic-cloud-region",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "aic-cloud-region",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "aic-cloud-region"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic_clli.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic_clli.json
deleted file mode 100644
index 9e5a6d52..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic_clli.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "aic_clli",
- "tags" : "aic_clli",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "aic_clli",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "aic_clli"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/availability_zone_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/availability_zone_0.json
deleted file mode 100644
index fc88ced6..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/availability_zone_0.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "availability_zone_0",
- "tags" : "availability_zone_0",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "availability_zone_0",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "availability_zone_0"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json
deleted file mode 100644
index 42059ad8..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com",
- "name": "default-source",
- "property" :{
- "description": "name of the ",
- "type": "string"
- },
- "updated-by": "brindasanth@onap.com",
- "sources": {
- "default": {
- "type": "source-default",
- "properties": {
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json
deleted file mode 100644
index e876c537..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "input-source",
- "property" :{
- "description": "name of the ",
- "type": "string"
- },
- "updated-by": "brindasanth@onap.com",
- "tags": null,
- "sources": {
- "input": {
- "type": "source-input",
- "properties": {
- "key": "action-name"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
deleted file mode 100644
index 67661ecd..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "tags": "oam-local-ipv4-address",
- "name": "mdsal-source",
- "property" :{
- "description": "based on service-instance-id,network-role,v4-ip-type and vm-type get the ipv4-gateway-prefix from the SDN-GC mdsal",
- "type": "string"
- },
- "updated-by": "brindasanth@onap.com",
- "sources": {
- "primary-config-data": {
- "type": "source-rest",
- "properties": {
- "type": "JSON",
- "url-path": "config/L3VNF-API:services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$vm-type/vm-networks/$network-role/v4-assigned-ip-list/$v4-ip-type",
- "path": "/v4-assigned-ip-list/0/v4-ip-prefix",
- "input-key-mapping": {
- "service-instance-id": "service-instance-id",
- "network-role": "network-role",
- "v4-ip-type": "v4-ip-type",
- "vm-type": "vm-type"
- },
- "output-key-mapping": {
- "oam-local-ipv4-address": "v4-ip-prefix"
- },
- "key-dependencies": [
- "service-instance-id",
- "network-role",
- "v4-ip-type",
- "vm-type"
- ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/name_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/name_0.json
deleted file mode 100644
index 6be5bc18..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/name_0.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "name_0",
- "tags" : "name_0",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "name_0",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "name_0"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json
deleted file mode 100644
index 6da5ea22..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "nf-role",
- "tags" : "nf-role",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vnf/nf-role",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.VF_MODEL.nf_role as vf_model_role from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnfmodelcustomizationuuid",
- "input-key-mapping" : {
- "vnfmodelcustomizationuuid" : "vnf-model-customization-uuid"
- },
- "output-key-mapping" : {
- "nf-role" : "vf_model_role"
- },
- "key-dependencies" : [ "vnf-model-customization-uuid" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json
deleted file mode 100644
index 4e1ba2b0..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "nfc-naming-code",
- "tags" : "nfc-naming-code",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "nfc-naming-code",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid",
- "input-key-mapping" : {
- "vfccustomizationuuid" : "vfccustomizationuuid"
- },
- "output-key-mapping" : {
- "nfc-naming-code" : "nfc_naming_code"
- },
- "key-dependencies" : [ "vfccustomizationuuid" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json
deleted file mode 100644
index b359320b..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name" : "onap_private_net_cidr",
- "tags" : "onap_private_net_cidr",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "onap_private_net_cidr",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = private",
- "output-key-mapping" : {
- "onap_private_net_cidr" : "prefix"
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_id.json
deleted file mode 100644
index 75cc6963..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_id.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "onap_private_net_id",
- "tags" : "onap_private_net_id",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "onap_private_net_id",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "onap_private_net_id"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/primary-db-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/primary-db-source.json
deleted file mode 100644
index 26e62e85..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/primary-db-source.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "name": "primary-db-source",
- "property" :{
- "description": "name of the ",
- "type": "string"
- },
- "updated-by": "brindasanth@onap.com",
- "tags": "bundle-id, brindasanth@onap.com",
- "sources": {
- "primary-db": {
- "type": "source-primary-db",
- "properties": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json
deleted file mode 100644
index 4f4868d9..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name" : "private-prefix-id",
- "tags" : "private-prefix-id",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "private-prefix-id",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = private",
- "output-key-mapping" : {
- "private-prefix-id" : "prefix_id"
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json
deleted file mode 100644
index dd418d55..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name" : "protected-prefix-id",
- "tags" : "protected-prefix-id",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "protected-prefix-id",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = protected",
- "output-key-mapping" : {
- "protected-prefix-id" : "prefix_id"
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json
deleted file mode 100644
index dcd32c7c..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name" : "protected_private_net_cidr",
- "tags" : "protected_private_net_cidr",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "protected_private_net_cidr",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = protected",
- "output-key-mapping" : {
- "protected_private_net_cidr" : "prefix"
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/public_net_id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/public_net_id.json
deleted file mode 100644
index 17ad96bd..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/public_net_id.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "public_net_id",
- "tags" : "public_net_id",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "public_net_id",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "public_net_id"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/service-instance-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/service-instance-id.json
deleted file mode 100644
index db089f0d..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/service-instance-id.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "service-instance-id",
- "tags" : "service-instance-id, tosca.datatypes.Root, data_type",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "To be provided",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "service-instance-id"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json
deleted file mode 100644
index 1e4cd7bd..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name" : "unprotected-prefix-id",
- "tags" : "unprotected-prefix-id",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "unprotected-prefix-id",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = unprotected",
- "output-key-mapping" : {
- "unprotected-prefix-id" : "prefix_id"
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json
deleted file mode 100644
index 241147c3..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name" : "unprotected_private_net_cidr",
- "tags" : "unprotected_private_net_cidr",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "unprotected_private_net_cidr",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = unprotected",
- "output-key-mapping" : {
- "unprotected_private_net_cidr" : "prefix"
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-id.json
deleted file mode 100644
index 5203bb30..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-id.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "vf-module-id",
- "tags" : "vf-module-id",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vf-module-id",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vf-module-id"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json
deleted file mode 100644
index faa7ea49..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "vf-module-label",
- "tags" : "vf-module-label",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vf-module-label",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid",
- "input-key-mapping" : {
- "customizationid" : "vf-module-model-customization-uuid"
- },
- "output-key-mapping" : {
- "vf-module-label" : "vf_module_label"
- },
- "key-dependencies" : [ "vf-module-model-customization-uuid" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json
deleted file mode 100644
index dd479187..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "vf-module-model-customization-uuid",
- "tags" : "vf-module-model-customization-uuid",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vf-module-model-customization-uuid",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vf-module-model-customization-uuid"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json
deleted file mode 100644
index dbd51bbd..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "vf-module-type",
- "tags" : "vf-module-type",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vf-module-type",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid",
- "input-key-mapping" : {
- "customizationid" : "vf-module-model-customization-uuid"
- },
- "output-key-mapping" : {
- "vf-module-type" : "vf_module_type"
- },
- "key-dependencies" : [ "vf-module-model-customization-uuid" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json
deleted file mode 100644
index 70792f86..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "vf-naming-policy",
- "tags" : "vf-naming-policy",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vf-naming-policy",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid",
- "input-key-mapping" : {
- "vnf_model_customization_uuid" : "vnf-model-customization-uuid"
- },
- "output-key-mapping" : {
- "vf-naming-policy" : "vf_naming_policy"
- },
- "key-dependencies" : [ "vnf-model-customization-uuid" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json
deleted file mode 100644
index a21982c0..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "vf-nf-code",
- "tags" : "vf-nf-code",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vf-nf-code",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.VF_MODEL.nf_code as vf_nf_code from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:customizationid",
- "input-key-mapping" : {
- "customizationid" : "vnf-model-customization-uuid"
- },
- "output-key-mapping" : {
- "vf-nf-code" : "vf_nf_code"
- },
- "key-dependencies" : [ "vnf-model-customization-uuid" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf_module_name.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf_module_name.json
deleted file mode 100644
index 3d958919..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf_module_name.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "vf_module_name",
- "tags" : "vf_module_name",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vf_module_name",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vf_module_name"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json
deleted file mode 100644
index 9f3e7cf1..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "vfccustomizationuuid",
- "tags" : "vfccustomizationuuid, tosca.datatypes.Root, data_type",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vfccustomizationuuid",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select sdnctl.VF_MODULE_TO_VFC_MAPPING.vfc_customization_uuid as vnf_customid from sdnctl.VF_MODULE_TO_VFC_MAPPING where vm_count = 1 and sdnctl.VF_MODULE_TO_VFC_MAPPING.vf_module_customization_uuid=:vfmodulecustomizationuuid",
- "input-key-mapping" : {
- "vfmodulecustomizationuuid" : "vf-module-model-customization-uuid"
- },
- "output-key-mapping" : {
- "vfccustomizationuuid" : "vnf_customid"
- },
- "key-dependencies" : [ "vf-module-model-customization-uuid" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
deleted file mode 100644
index 59f51516..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "name" : "vfw_private_ip_0",
- "tags" : "vfw_private_ip_0",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vfw_private_ip_0",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vfw_private_ip_0"
- }
- },
- "primary-config-data" : {
- "type" : "source-rest",
- "properties" : {
- "type" : "JSON",
- "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vfw_private_ip_0",
- "path" : "/param/0/value",
- "expression-type" : "JSON_POINTER",
- "input-key-mapping" : {
- "service-instance-id" : "service-instance-id",
- "vnf-id" : "vnf-id",
- "vf-module-id" : "vf-module-id"
- },
- "output-key-mapping" : {
- "vfw_private_ip_0" : "value"
- },
- "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
deleted file mode 100644
index 6dda72f7..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "name" : "vfw_private_ip_1",
- "tags" : "vfw_private_ip_1",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vfw_private_ip_1",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vfw_private_ip_1"
- }
- },
- "primary-config-data" : {
- "type" : "source-rest",
- "properties" : {
- "type" : "JSON",
- "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vfw_private_ip_1",
- "path" : "/param/0/value",
- "expression-type" : "JSON_POINTER",
- "input-key-mapping" : {
- "service-instance-id" : "service-instance-id",
- "vnf-id" : "vnf-id",
- "vf-module-id" : "vf-module-id"
- },
- "output-key-mapping" : {
- "vfw_private_ip_1" : "value"
- },
- "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_2.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_2.json
deleted file mode 100644
index 9e510647..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_2.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "vfw_private_ip_2",
- "tags" : "vfw_private_ip_2",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vfw_private_ip_2",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vfw_private_ip_2"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json
deleted file mode 100644
index dabb2381..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "vm-type",
- "tags" : "vm-type",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vm-type",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select vfc_model.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
- "input-key-mapping" : {
- "vfccustomizationuuid" : "vfccustomizationuuid"
- },
- "output-key-mapping" : {
- "vm-type" : "vm_type"
- },
- "key-dependencies" : [ "vfccustomizationuuid" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-id.json
deleted file mode 100644
index 5ea0fbcf..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-id.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "vnf-id",
- "tags" : "vnf-id",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vnf-id",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vnf-id"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json
deleted file mode 100644
index d36fe740..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "vnf-model-customization-uuid",
- "tags" : "vnf-model-customization-uuid",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vnf-model-customization-uuid",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vnf-model-customization-uuid"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json
deleted file mode 100644
index 4c0320ac..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "name" : "vnf-name",
- "tags" : "vnf-name, tosca.datatypes.Root, data_type",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vnf-name",
- "type" : "string"
- },
- "sources" : {
- "primary-config-data" : {
- "type" : "source-rest",
- "properties" : {
- "type" : "JSON",
- "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name",
- "path" : "/param/0/value",
- "expression-type" : "JSON_POINTER",
- "input-key-mapping" : {
- "service-instance-id" : "service-instance-id",
- "vnf-id" : "vnf-id"
- },
- "output-key-mapping" : {
- "vnf-name" : "value"
- },
- "key-dependencies" : [ "service-instance-id", "vnf-id" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json
deleted file mode 100644
index c90f5b8a..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "name" : "vnf_name",
- "tags" : "vnf_name",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vnf_name",
- "type" : "string"
- },
- "sources" : {
- "primary-config-data" : {
- "type" : "source-rest",
- "properties" : {
- "type" : "JSON",
- "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name",
- "path" : "/param/0/value",
- "expression-type" : "JSON_POINTER",
- "input-key-mapping" : {
- "service-instance-id" : "service-instance-id",
- "vnf-id" : "vnf-id"
- },
- "output-key-mapping" : {
- "vnf_name" : "value"
- },
- "key-dependencies" : [ "service-instance-id", "vnf-id" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json
deleted file mode 100644
index 8ce692cc..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "vnfc-model-invariant-uuid",
- "tags" : "vnfc-model-invariant-uuid",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vnfc-model-invariant-uuid for vFW template",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select vfc_model.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
- "input-key-mapping" : {
- "vfccustomizationuuid" : "vfccustomizationuuid"
- },
- "output-key-mapping" : {
- "vnfc-model-invariant-uuid" : "vfc_invariant_uuid"
- },
- "key-dependencies" : [ "vfccustomizationuuid" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json
deleted file mode 100644
index d74a6bae..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name" : "vnfc-model-version",
- "tags" : "vnfc-model-version",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vnfc-model-version for vFW template",
- "type" : "string"
- },
- "sources" : {
- "primary-db" : {
- "type" : "source-primary-db",
- "properties" : {
- "type" : "SQL",
- "query" : "select vfc_model.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
- "input-key-mapping" : {
- "vfccustomizationuuid" : "vfccustomizationuuid"
- },
- "output-key-mapping" : {
- "vnfc-model-version" : "vnfc_model_version"
- },
- "key-dependencies" : [ "vfccustomizationuuid" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
deleted file mode 100644
index 9bef3c79..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "name" : "vpg_private_ip_0",
- "tags" : "vpg_private_ip_0",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vpg_private_ip_0",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vpg_private_ip_0"
- }
- },
- "primary-config-data" : {
- "type" : "source-rest",
- "properties" : {
- "type" : "JSON",
- "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vpg_private_ip_0",
- "path" : "/param/0/value",
- "expression-type" : "JSON_POINTER",
- "input-key-mapping" : {
- "service-instance-id" : "service-instance-id",
- "vnf-id" : "vnf-id",
- "vf-module-id" : "vf-module-id"
- },
- "output-key-mapping" : {
- "vpg_private_ip_0" : "value"
- },
- "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_1.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_1.json
deleted file mode 100644
index 23c42e0c..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_1.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "vpg_private_ip_1",
- "tags" : "vpg_private_ip_1",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vpg_private_ip_1",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vpg_private_ip_1"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
deleted file mode 100644
index 52a4542c..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "name" : "vsn_private_ip_0",
- "tags" : "vsn_private_ip_0",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vsn_private_ip_0",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vsn_private_ip_0"
- }
- },
- "primary-config-data" : {
- "type" : "source-rest",
- "properties" : {
- "type" : "JSON",
- "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vsn_private_ip_0",
- "path" : "/param/0/value",
- "expression-type" : "JSON_POINTER",
- "input-key-mapping" : {
- "service-instance-id" : "service-instance-id",
- "vnf-id" : "vnf-id",
- "vf-module-id" : "vf-module-id"
- },
- "output-key-mapping" : {
- "vsn_private_ip_0" : "value"
- },
- "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ]
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_1.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_1.json
deleted file mode 100644
index 88750b25..00000000
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_1.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name" : "vsn_private_ip_1",
- "tags" : "vsn_private_ip_1",
- "updated-by" : "Singal, Kapil <ks220y@att.com>",
- "property" : {
- "description" : "vsn_private_ip_1",
- "type" : "string"
- },
- "sources" : {
- "input" : {
- "type" : "source-input",
- "properties" : {
- "key" : "vsn_private_ip_1"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/pom.xml b/ms/controllerblueprints/modules/resource-dict/pom.xml
deleted file mode 100644
index 22533dbe..00000000
--- a/ms/controllerblueprints/modules/resource-dict/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <artifactId>resource-dict</artifactId>
- <name>Controller Blueprints Resource Dictionary</name>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
-</project>
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt
deleted file mode 100644
index d141ed0c..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- * Modifications Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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.NodeTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
-import java.io.Serializable
-import java.util.*
-
-open class ResourceDefinition {
-
- @JsonProperty(value = "name", required = true)
- lateinit var name: String
-
- @JsonProperty(value = "property", required = true)
- lateinit var property: PropertyDefinition
-
- var tags: String? = null
-
- @JsonProperty(value = "updated-by")
- lateinit var updatedBy: String
-
- @JsonProperty(value = "sources", required = true)
- lateinit var sources: MutableMap<String, NodeTemplate>
-}
-
-open class ResourceAssignment {
-
- @JsonProperty(value = "name", required = true)
- lateinit var name: String
-
- @JsonProperty(value = "property")
- var property: PropertyDefinition? = null
-
- @JsonProperty("input-param")
- var inputParameter: Boolean = false
-
- @JsonProperty("dictionary-name")
- var dictionaryName: String? = null
-
- @JsonProperty("dictionary-source")
- var dictionarySource: String? = null
-
- @JsonProperty("dependencies")
- var dependencies: MutableList<String>? = null
-
- @JsonProperty("version")
- var version: Int = 0
-
- @JsonProperty("status")
- var status: String? = null
-
- @JsonProperty("message")
- var message: String? = null
-
- @JsonProperty("updated-date")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- var updatedDate: Date? = null
-
- @JsonProperty("updated-by")
- var updatedBy: String? = null
-
- override fun toString(): String {
- return StringBuilder()
- .append("[")
- .append("name=", name)
- .append(", dictionaryName=", dictionaryName)
- .append(", dictionarySource=", dictionarySource)
- .append("]")
- .toString()
- }
-}
-
-/**
- * Interface for Source Definitions (ex Input Source,
- * Default Source, Database Source, Rest Sources, etc)
- */
-interface ResourceSource : Serializable
-
-
-open class ResourceSourceMapping {
- lateinit var resourceSourceMappings: MutableMap<String, String>
-}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
deleted file mode 100644
index 75368684..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict
-
-/**
- * ResourceDictionaryConstants
- *
- * @author Brinda Santh
- */
-object ResourceDictionaryConstants {
- const val SOURCE_INPUT = "input"
- const val SOURCE_DEFAULT = "default"
- //const val SOURCE_PRIMARY_CONFIG_DATA = "rest"
- const val SOURCE_PROCESSOR_DB = "processor-db"
- const val SOURCE_PRIMARY_CONFIG_DATA = "primary-config-data"
- const val SOURCE_PRIMARY_DB = "primary-db"
-
- const val MODEL_DIR_RESOURCE_DEFINITION: String = "resource_dictionary"
-
- const val PROPERTY_TYPE = "type"
- const val PROPERTY_INPUT_KEY_MAPPING = "input-key-mapping"
- const val PROPERTY_OUTPUT_KEY_MAPPING = "output-key-mapping"
- const val PROPERTY_KEY_DEPENDENCIES = "key-dependencies"
-
- const val PATH_RESOURCE_DEFINITION_TYPE = "resources_definition_types"
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt
deleted file mode 100644
index 876aca9f..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.format
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping
-
-/**
- * ResourceSourceMappingFactory.
- *
- * @author Brinda Santh
- */
-object ResourceSourceMappingFactory {
-
- private val resourceSourceMappings: MutableMap<String, String> = hashMapOf()
-
- fun registerSourceMapping(sourceInstance: String, nodeTypeName: String) {
- resourceSourceMappings[sourceInstance] = nodeTypeName
- }
-
- fun getRegisterSourceMapping(sourceInstance: String): String {
- return resourceSourceMappings[sourceInstance]
- ?: throw BluePrintException(format("failed to get source({}) mapping", sourceInstance))
- }
-
- fun getRegisterSourceMapping(): ResourceSourceMapping {
- val resourceSourceMapping = ResourceSourceMapping()
- resourceSourceMapping.resourceSourceMappings = resourceSourceMappings
- return resourceSourceMapping
- }
-}
-
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
deleted file mode 100644
index cd1dd431..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.apache.commons.collections.CollectionUtils
-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.utils.TopologicalSortingUtils
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import java.io.Serializable
-
-/**
- * ResourceAssignmentValidationService.
- *
- * @author Brinda Santh
- */
-interface ResourceAssignmentValidationService : Serializable {
-
- @Throws(BluePrintException::class)
- fun validate(resourceAssignments: List<ResourceAssignment>): Boolean
-}
-
-/**
- * ResourceAssignmentValidationServiceImpl.
- *
- * @author Brinda Santh
- */
-open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidationService {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationServiceImpl::class.java)
-
- open var resourceAssignmentMap: Map<String, ResourceAssignment> = hashMapOf()
- open val validationMessage = StrBuilder()
-
- override fun validate(resourceAssignments: List<ResourceAssignment>): Boolean {
- try {
- validateTemplateNDictionaryKeys(resourceAssignments)
- validateCyclicDependency(resourceAssignments)
- if (StringUtils.isNotBlank(validationMessage)) {
- throw BluePrintException("Resource Assignment Validation Failure")
- }
- } catch (e: Exception) {
- throw BluePrintException("Resource Assignment Validation :" + validationMessage.toString(), e)
- }
- return true
- }
-
-
- open fun validateTemplateNDictionaryKeys(resourceAssignments: List<ResourceAssignment>) {
-
- resourceAssignmentMap = resourceAssignments.map { it.name to it }.toMap()
-
- // Check the Resource Assignment has Duplicate Key Names
- val duplicateKeyNames = resourceAssignments.groupBy { it.name }
- .filter { it.value.size > 1 }
- .map { it.key }
-
- if (duplicateKeyNames.isNotEmpty()) {
- validationMessage.appendln(String.format("Duplicate Assignment Template Keys (%s) is Present", duplicateKeyNames))
- }
-
- // Collect all the dependencies as a single list
- val dependenciesNames = resourceAssignments.mapNotNull { it.dependencies }.flatten()
-
- // Check all the dependencies keys have Resource Assignment mappings.
- val notPresentDictionaries = dependenciesNames.filter { !resourceAssignmentMap.containsKey(it) }.distinct()
- if (notPresentDictionaries.isNotEmpty()) {
- validationMessage.appendln(String.format("No assignments for Dictionary Keys (%s)", notPresentDictionaries))
- }
-
- if (StringUtils.isNotBlank(validationMessage)) {
- throw BluePrintException("Resource Assignment Validation Failure")
- }
- }
-
- open fun validateCyclicDependency(resourceAssignments: List<ResourceAssignment>) {
- val startResourceAssignment = ResourceAssignment()
- startResourceAssignment.name = "*"
-
- val topologySorting = TopologicalSortingUtils<ResourceAssignment>()
-
- resourceAssignmentMap.map { it.value }.map { resourceAssignment ->
- if (CollectionUtils.isNotEmpty(resourceAssignment.dependencies)) {
- resourceAssignment.dependencies!!.map {
- log.trace("Topological Graph link from {} to {}", it, resourceAssignment.name)
- topologySorting.add(resourceAssignmentMap[it]!!, resourceAssignment)
- }
- } else {
- topologySorting.add(startResourceAssignment, resourceAssignment)
- }
- }
-
- if (!topologySorting.isDag) {
- val graph = getTopologicalGraph(topologySorting)
- validationMessage.appendln("Cyclic Dependency :$graph")
- }
- }
-
- open fun getTopologicalGraph(topologySorting: TopologicalSortingUtils<ResourceAssignment>): String {
- val s = StringBuilder()
- val neighbors = topologySorting.getNeighbors()
-
- neighbors.forEach { v, vs ->
- if (v.name == "*") {
- s.append("\n * -> [")
- for (resourceAssignment in vs) {
- s.append("(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name
- + "),")
- }
- s.append("]")
- } else {
- s.append("\n (" + v.dictionaryName + ":" + v.name + ") -> [")
- for (resourceAssignment in vs) {
- s.append("(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name
- + "),")
- }
- s.append("]")
- }
- }
- return s.toString()
- }
-
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
deleted file mode 100644
index cd92f42c..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils
-
-import com.att.eelf.configuration.EELFLogger
-import org.apache.commons.collections.CollectionUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.TopologicalSortingUtils
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import com.att.eelf.configuration.EELFManager
-import java.util.ArrayList
-/**
- * BulkResourceSequencingUtils.
- *
- * @author Brinda Santh
- */
-object BulkResourceSequencingUtils {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BulkResourceSequencingUtils::class.java)
-
- @JvmStatic
- fun process(resourceAssignments: MutableList<ResourceAssignment>): List<List<ResourceAssignment>> {
- val resourceAssignmentMap: MutableMap<String, ResourceAssignment> = hashMapOf()
- val sequenceBatchResourceAssignment = ArrayList<List<ResourceAssignment>>()
- log.info("Assignments ({})", resourceAssignments)
- // Prepare Map
- resourceAssignments.forEach { resourceAssignment ->
- log.trace("Processing Key ({})", resourceAssignment.name)
- resourceAssignmentMap.put(resourceAssignment.name, resourceAssignment)
- }
-
- val startResourceAssignment = ResourceAssignment()
- startResourceAssignment.name = "*"
-
- // Preepare Sorting Map
- val topologySorting = TopologicalSortingUtils<ResourceAssignment>()
- resourceAssignmentMap.forEach { _, resourceAssignment ->
- if (CollectionUtils.isNotEmpty(resourceAssignment.dependencies)) {
- for (dependency in resourceAssignment.dependencies!!) {
- topologySorting.add(resourceAssignmentMap[dependency]!!, resourceAssignment)
- }
- } else {
- topologySorting.add(startResourceAssignment, resourceAssignment)
- }
- }
-
- val sequencedResourceAssignments: MutableList<ResourceAssignment> = topologySorting.topSort()!! as MutableList<ResourceAssignment>
- log.info("Sorted Sequenced Assignments ({})", sequencedResourceAssignments)
-
- var batchResourceAssignment: MutableList<ResourceAssignment>? = null
- var batchAssignmentName: MutableList<String>? = null
-
- // Prepare Sorting
- sequencedResourceAssignments.forEachIndexed { index, resourceAssignment ->
-
- var previousResourceAssignment: ResourceAssignment? = null
-
- if (index > 0) {
- previousResourceAssignment = sequencedResourceAssignments[index - 1]
- }
-
- var dependencyPresence = false
- if (batchAssignmentName != null && resourceAssignment.dependencies != null) {
- dependencyPresence = CollectionUtils.containsAny(batchAssignmentName, resourceAssignment.dependencies)
- }
-
- log.trace("({}) -> Checking ({}), with ({}), result ({})", resourceAssignment.name,
- batchAssignmentName, resourceAssignment.dependencies, dependencyPresence)
-
- if (previousResourceAssignment != null && resourceAssignment.dictionarySource != null
- && resourceAssignment.dictionarySource!!.equals(previousResourceAssignment.dictionarySource, true)
- && !dependencyPresence) {
- batchResourceAssignment!!.add(resourceAssignment)
- batchAssignmentName!!.add(resourceAssignment.name)
- } else {
- if (batchResourceAssignment != null) {
- sequenceBatchResourceAssignment.add(batchResourceAssignment!!)
- log.trace("Created old Set ({})", batchAssignmentName)
- }
- batchResourceAssignment = arrayListOf()
- batchResourceAssignment!!.add(resourceAssignment)
-
- batchAssignmentName = arrayListOf()
- batchAssignmentName!!.add(resourceAssignment.name)
- }
-
- if (index == sequencedResourceAssignments.size - 1) {
- log.trace("Created old Set ({})", batchAssignmentName)
- sequenceBatchResourceAssignment.add(batchResourceAssignment!!)
- }
- }
- log.info("Batched Sequence : ({})", sequenceBatchResourceAssignment)
-
- return sequenceBatchResourceAssignment
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
deleted file mode 100644
index 69ee1cfd..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.NullNode
-import org.apache.commons.collections.MapUtils
-import org.apache.commons.lang3.StringUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils
-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.ResourceDefinition
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants
-import java.io.File
-
-
-object ResourceDictionaryUtils {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceDictionaryUtils::class.java)
-
- @JvmStatic
- fun populateSourceMapping(resourceAssignment: ResourceAssignment,
- resourceDefinition: ResourceDefinition) {
-
- if (StringUtils.isBlank(resourceAssignment.dictionarySource)) {
-
- if (MapUtils.isNotEmpty(resourceDefinition.sources)) {
- val source = findFirstSource(resourceDefinition.sources)
-
- // Populate and Assign First Source
- if (StringUtils.isNotBlank(source)) {
- // Set Dictionary Source
- resourceAssignment.dictionarySource = source
- } else {
- resourceAssignment.dictionarySource = ResourceDictionaryConstants.SOURCE_INPUT
- }
- log.info("auto map resourceAssignment : {}", resourceAssignment)
- } else {
- resourceAssignment.dictionarySource = ResourceDictionaryConstants.SOURCE_INPUT
- }
- }
- }
-
- @JvmStatic
- fun findFirstSource(sources: Map<String, NodeTemplate>): String? {
- var source: String? = null
- if (MapUtils.isNotEmpty(sources)) {
- source = sources.keys.stream().findFirst().get()
- }
- return source
- }
-
- @JvmStatic
- fun assignInputs(data: JsonNode, context: MutableMap<String, Any>) {
- log.trace("assignInputs from input JSON ({})", data.toString())
- data.fields().forEach { field ->
- val valueNode: JsonNode = data.at("/".plus(field.key)) ?: NullNode.getInstance()
-
- val path = BluePrintConstants.PATH_INPUTS.plus(BluePrintConstants.PATH_DIVIDER).plus(field.key)
- log.trace("setting path ({}), values ({})", path, valueNode)
- context[path] = valueNode
- }
- }
-
- fun getResourceAssignmentFromFile(filePath: String): List<ResourceAssignment> {
- return JacksonUtils.getListFromFile(filePath, ResourceAssignment::class.java)
- ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
- }
-
- fun writeResourceDefinitionTypes(basePath: String, resourceDefinitions: List<ResourceDefinition>) {
- val resourceDefinitionMap = resourceDefinitions.map { it.name to it }.toMap()
- writeResourceDefinitionTypes(basePath, resourceDefinitionMap)
-
- }
-
- fun writeResourceDefinitionTypes(basePath: String, resourceDefinitionMap: Map<String, ResourceDefinition>) {
- val typePath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR)
- .plus(File.separator).plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
- val resourceDefinitionContent = JacksonUtils.getJson(resourceDefinitionMap.toSortedMap(), true)
- BluePrintFileUtils.writeDefinitionFile(typePath, resourceDefinitionContent)
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java
deleted file mode 100644
index d059d1ba..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ResourceDefinitionTest {
- private EELFLogger log = EELFManager.getInstance().getLogger(ResourceDefinitionTest.class);
- private String basePath = "load/resource_dictionary";
-
- @Test
- public void testDictionaryDefinitionInputSource(){
-
- String fileName = basePath + "/input-source.json";
- ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition);
- }
-
- @Test
- public void testDictionaryDefinitionDefaultSource(){
-
- String fileName = basePath + "/default-source.json";
- ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition);
- }
-
- @Test
- public void testDictionaryDefinitionDBSource(){
-
- String fileName = basePath + "/primary-db-source.json";
- ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for primary-db type", resourceDefinition);
- }
-
- @Test
- public void testDictionaryDefinitionMDSALSource(){
- String fileName = basePath + "/mdsal-source.json";
- ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition);
- }
-}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
deleted file mode 100644
index 3950ae36..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory;
-
-import org.junit.Test;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping;
-import org.springframework.util.Assert;
-
-public class ResourceSourceMappingFactoryTest {
-
- @Test
- public void testRegisterResourceMapping() {
-
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-db", "source-primary-db");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-config-data", "source-rest");
-
- String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("primary-db");
- Assert.notNull(nodeTypeName, "Failed to get primary-db mapping");
-
- ResourceSourceMapping resourceSourceMapping = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping();
- Assert.notNull(resourceSourceMapping, "Failed to get resource source mapping");
- Assert.notNull(resourceSourceMapping.getResourceSourceMappings(), "Failed to get resource source mappings");
-
- }
-
-}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
deleted file mode 100644
index 8905dab6..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service
-
-import com.att.eelf.configuration.EELFLogger
-import org.junit.Assert
-import org.junit.Test
-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.ResourceAssignment
-import com.att.eelf.configuration.EELFManager
-import org.junit.Before
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils
-
-/**
- * ResourceAssignmentValidationServiceTest.
- *
- * @author Brinda Santh
- */
-class ResourceAssignmentValidationServiceTest {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationServiceTest::class.java)
- @Before
- fun setUp() {
- // Setup dummy Source Instance Mapping
- ResourceDictionaryTestUtils.setUpResourceSourceMapping()
- }
-
- @Test
- fun testValidateSuccess() {
- log.info("**************** testValidateSuccess *****************")
- val assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment::class.java)
- val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl()
- val result = resourceAssignmentValidator.validate(assignments!!)
- Assert.assertTrue("Failed to Validate", result)
- }
-
- @Test(expected = BluePrintException::class)
- fun testValidateDuplicate() {
- log.info(" **************** testValidateDuplicate *****************")
- val assignments = JacksonUtils.getListFromClassPathFile("validation/duplicate.json", ResourceAssignment::class.java)
- val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl()
- resourceAssignmentValidator.validate(assignments!!)
- }
-
- @Test(expected = BluePrintException::class)
- fun testValidateCyclic() {
- log.info(" **************** testValidateCyclic *****************")
- val assignments = JacksonUtils.getListFromClassPathFile("validation/cyclic.json", ResourceAssignment::class.java)
- val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl()
- resourceAssignmentValidator.validate(assignments!!)
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java
deleted file mode 100644
index c1b9f500..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
-import java.util.List;
-/**
- * BulkResourceSequencingUtils.
- *
- * @author Brinda Santh
- */
-public class BulkResourceSequencingUtilsTest {
-
- @Test
- public void testProcess(){
- List<ResourceAssignment> assignments = JacksonUtils.Companion.getListFromClassPathFile("validation/success.json", ResourceAssignment.class);
- Assert.assertNotNull("failed to get ResourceAssignment from validation/success.json ", assignments);
- BulkResourceSequencingUtils.process(assignments);
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
deleted file mode 100644
index 45fc739d..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils;
-
-
-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.data.NodeTemplate;
-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.ResourceDefinition;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-import java.util.HashMap;
-import java.util.Map;
-/**
- * ResourceDictionaryUtilsTest.
- *
- * @author Brinda Santh
- */
-public class ResourceDictionaryUtilsTest {
- private static final EELFLogger log = EELFManager.getInstance().getLogger(ResourceDictionaryUtilsTest.class);
-
- @Test
- public void testPopulateSourceMapping() {
-
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("sample-assignment");
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- Map<String, NodeTemplate> sources = new HashMap<>();
- resourceDefinition.setSources(sources);
- // To Check Empty Source
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertEquals("Expected Empty source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, resourceAssignment.getDictionarySource());
-
- // To Check First Source
- resourceAssignment.setDictionarySource(null);
- sources.put(ResourceDictionaryConstants.SOURCE_DEFAULT, new NodeTemplate());
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertEquals("Expected First source Default, but.", ResourceDictionaryConstants.SOURCE_DEFAULT, resourceAssignment.getDictionarySource());
-
- // To Check Assigned Source
- resourceAssignment.setDictionarySource(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB);
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertEquals("Expected Assigned source DB, but.", ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, resourceAssignment.getDictionarySource());
-
- }
-
- @Test
- public void testFindFirstSource() {
- //To check if Empty Source
- Map<String, NodeTemplate> sources = new HashMap<>();
- String firstSource = ResourceDictionaryUtils.findFirstSource(sources);
- Assert.assertNull("Source populated, which is not expected.", firstSource);
-
- // TO check the first Source
- sources.put(ResourceDictionaryConstants.SOURCE_INPUT, new NodeTemplate());
- String inputFirstSource = ResourceDictionaryUtils.findFirstSource(sources);
- Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, inputFirstSource);
-
- // TO check the multiple Source
- sources.put(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, new NodeTemplate());
- String multipleFirstSource = ResourceDictionaryUtils.findFirstSource(sources);
- Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, multipleFirstSource);
-
- }
-
- @Test
- public void testAssignInputs() {
- JsonNode data = JacksonUtils.Companion.jsonNodeFromClassPathFile("data/resource-assignment-input.json");
- Map<String, Object> context = new HashMap<>();
- ResourceDictionaryUtils.assignInputs(data, context);
- String path = BluePrintConstants.PATH_INPUTS.concat(BluePrintConstants.PATH_DIVIDER).concat("mapValue");
- log.info("populated context {}", context);
- Assert.assertTrue(String.format("failed to get variable : %s",path),context.containsKey(path));
-
- }
-
-
-}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
deleted file mode 100644
index ed2bfc0a..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils
-
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
-
-object ResourceDictionaryTestUtils {
-
- @JvmStatic
- fun setUpResourceSourceMapping() {
- ResourceSourceMappingFactory.registerSourceMapping("primary-db", "source-primary-db")
- ResourceSourceMappingFactory.registerSourceMapping("input", "source-input")
- ResourceSourceMappingFactory.registerSourceMapping("default", "source-default")
- ResourceSourceMappingFactory.registerSourceMapping("primary-config-data", "source-rest")
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json
deleted file mode 100644
index d79c9068..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "intValue" : 1,
- "floatValue" : 1.34,
- "booleanValue" : true,
- "stringValue" : "sample-String",
- "timeValue" : "2018-09-29",
- "arrayStringValue" : ["one", "two"],
- "mapValue" : {"profile_name1":"profile_name1",
- "profile_name2":"profile_name2"}
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json
deleted file mode 100644
index 3bfa4167..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json
+++ /dev/null
@@ -1,111 +0,0 @@
-[
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "service-instance-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "service-instance-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-ip",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-ip",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "vnf-id",
- "bundle-id"
- ]
- },
- {
- "name": "managed-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "vnf-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-name",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "managed-ip1",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip1",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "loopback-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "loopback-ip",
- "dictionary-source": "primary-db",
- "dependencies": [
- "bundle-mac",
- "managed-ip1"
- ]
- }
-]
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json
deleted file mode 100644
index 473920d6..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json
+++ /dev/null
@@ -1,110 +0,0 @@
-[
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "service-instance-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "service-instance-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-ip",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-ip",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "vnf-id",
- "bundle-id"
- ]
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "vnf-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-name",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "managed-ip1",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip1",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "loopback-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "loopback-ip",
- "dictionary-source": "primary-db",
- "dependencies": [
- "bundle-mac"
- ]
- }
-]
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json
deleted file mode 100644
index f8fe623f..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json
+++ /dev/null
@@ -1,110 +0,0 @@
-[
- {
- "name": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "service-instance-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "service-instance-id",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-ip",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-ip",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "vnf-id"
- ]
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "vnf-id",
- "bundle-id"
- ]
- },
- {
- "name": "managed-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "vnf-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-name",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "managed-ip1",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "managed-ip1",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "loopback-ip"
- ]
- },
- {
- "name": "loopback-ip",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "loopback-ip",
- "dictionary-source": "primary-db",
- "dependencies": [
- "bundle-mac"
- ]
- }
-]
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml
deleted file mode 100644
index cb2cf6ab..00000000
--- a/ms/controllerblueprints/modules/service/pom.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <artifactId>service</artifactId>
- <name>Controller Blueprints Service</name>
-
- <properties>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-reactor</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>db-resources</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-scripts</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-webflux</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</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>
- </dependencies>
-</project>
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java
deleted file mode 100644
index fc7410f9..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.apache.commons.collections.CollectionUtils;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import java.util.List;
-
-@Component
-@SuppressWarnings("unused")
-public class ApplicationRegistrationService {
- private static EELFLogger log = EELFManager.getInstance().getLogger(ApplicationRegistrationService.class);
-
- @Value("#{'${resourceSourceMappings}'.split(',')}")
- private List<String> resourceSourceMappings;
-
- @PostConstruct
- public void register() {
- registerDictionarySources();
- }
-
- public void registerDictionarySources() {
- log.info("Registering Dictionary Sources : {}", resourceSourceMappings);
- if (CollectionUtils.isNotEmpty(resourceSourceMappings)) {
- resourceSourceMappings.forEach(resourceSourceMapping -> {
- String[] mappingKeyValue = resourceSourceMapping.split("=");
- if (mappingKeyValue != null && mappingKeyValue.length == 2) {
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping(mappingKeyValue[0].trim(), mappingKeyValue[1].trim());
- } else {
- log.warn("failed to get resource source mapping {}", resourceSourceMapping);
- }
- });
- }
- }
-}
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
deleted file mode 100644
index 1965ac90..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.google.common.base.Preconditions;
-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.resource.dict.ResourceAssignment;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
-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.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
-@SuppressWarnings("unused")
-public class AutoResourceMappingService {
-
- private static EELFLogger log = EELFManager.getInstance().getLogger(AutoResourceMappingService.class);
-
- private ResourceDictionaryRepository dataDictionaryRepository;
-
- /**
- * This is a AutoResourceMappingService constructor
- *
- * @param dataDictionaryRepository dataDictionaryRepository
- */
- public AutoResourceMappingService(ResourceDictionaryRepository dataDictionaryRepository) {
- this.dataDictionaryRepository = dataDictionaryRepository;
- }
-
- /**
- * This is a autoMap service to map the template keys automatically to Dictionary fields.
- *
- * @param resourceAssignments 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);
-
- }
- }
- }
- 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 && dbDataDictionary.getDefinition() != null) {
-
- ResourceDefinition dictionaryDefinition = dbDataDictionary.getDefinition();
-
- 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<>();
- 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(resourceAssignments, dependencieName)) {
- names.add(dependencieName);
- }
- }
- }
- }
- }
-
- if (!names.isEmpty()) {
- dictionaries = dataDictionaryRepository.findByNameIn(names);
- }
- if (dictionaries != null) {
- for (ResourceDictionary resourcedictionary : dictionaries) {
- ResourceDefinition dictionaryDefinition = resourcedictionary.getDefinition();
- Preconditions.checkNotNull(dictionaryDefinition, "failed to get Resource Definition from dictionary definition");
- 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);
- resourceAssignments.add(resourceAssignment);
- }
- }
- return resourceAssignments;
-
- }
-
-
- private 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/SchemaGeneratorService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/SchemaGeneratorService.java
deleted file mode 100644
index 3a1535ac..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/SchemaGeneratorService.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-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 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
- */
-@Deprecated
-public class SchemaGeneratorService {
- private static EELFLogger log = EELFManager.getInstance().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.Companion.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/common/ErrorMessage.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java
deleted file mode 100644
index 5486262f..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.common;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-import java.io.Serializable;
-import java.util.Date;
-
-@JsonInclude(Include.NON_NULL)
-@JsonTypeName("errorMessage")
-@JsonTypeInfo(include= JsonTypeInfo.As.WRAPPER_OBJECT, use=JsonTypeInfo.Id.NAME)
-public class ErrorMessage implements Serializable {
- private String message;
- private Integer code;
- private String debugMessage;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- private Date timestamp = new Date();
-
- public ErrorMessage(String message, Integer code, String debugMessage){
- this.message = message;
- this.code = code;
- this.debugMessage = debugMessage;
- }
-
- 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 getDebugMessage() {
- return debugMessage;
- }
-
- public void setDebugMessage(String developerMessage) {
- this.debugMessage = developerMessage;
- }
-
- public Date getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-} \ 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
deleted file mode 100644
index 77de8e7c..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.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 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;
- public static final String INPUTS="inputs";
-
- /**
- * This is a SwaggerGenerator constructor
- */
- public SwaggerGenerator(ServiceTemplate serviceTemplate) {
- this.serviceTemplate = serviceTemplate;
- }
-
- /**
- * This is a generateSwagger
- *
- * @return String
- */
- public String generateSwagger() {
-
- Swagger swagger = new Swagger().info(getInfo());
-
- swagger.setPaths(getPaths());
- swagger.setDefinitions(getDefinition());
-
-
- return swagger.toString();
- }
-
- 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());
- 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/BlueprintModel.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/BlueprintModel.java
deleted file mode 100755
index 245e4a80..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/BlueprintModel.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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 io.swagger.annotations.ApiModelProperty;
-import org.hibernate.annotations.Proxy;
-import org.springframework.data.annotation.LastModifiedDate;
-import org.springframework.data.jpa.domain.support.AuditingEntityListener;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * BlueprintModel.java Purpose: Provide Configuration Generator BlueprintModel Entity
- *
- * @author Brinda Santh
- * @version 1.0
- */
-
-@EntityListeners({AuditingEntityListener.class})
-@Entity
-@Table(name = "CONFIG_MODEL", uniqueConstraints=@UniqueConstraint(columnNames={"artifact_name","artifact_version"}))
-@Proxy(lazy=false)
-public class BlueprintModel implements Serializable {
- private static final long serialVersionUID = 1L;
- @Id
- @Column(name = "config_model_id")
- private String 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;
-
- @Column(name = "artifact_version", nullable = false)
- @ApiModelProperty(required=true)
- private String artifactVersion;
-
- @Lob
- @Column(name = "artifact_description")
- private String artifactDescription;
-
- @Column(name = "internal_version")
- private Integer internalVersion;
-
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- @LastModifiedDate
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "creation_date")
- private Date createdDate = new Date();
-
- @Column(name = "artifact_name", nullable = false)
- @ApiModelProperty(required=true)
- private String artifactName;
-
- @Column(name = "published", nullable = false)
- @ApiModelProperty(required=true)
- private String published;
-
- @Column(name = "updated_by", nullable = false)
- @ApiModelProperty(required=true)
- private String updatedBy;
-
- @Lob
- @Column(name = "tags", nullable = false)
- @ApiModelProperty(required=true)
- private String tags;
-
- @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = CascadeType.ALL)
- private BlueprintModelContent blueprintModelContent;
-
- public String getId() {
- return id;
- }
-
- public void setId(String 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 BlueprintModelContent getBlueprintModelContent() {
- return blueprintModelContent;
- }
-
- public void setBlueprintModelContent(BlueprintModelContent blueprintModelContent) {
- this.blueprintModelContent = blueprintModelContent;
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/BlueprintModelContent.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/BlueprintModelContent.java
deleted file mode 100644
index 0bfa0f12..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/BlueprintModelContent.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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 io.swagger.annotations.ApiModelProperty;
-import org.springframework.data.annotation.LastModifiedDate;
-import org.springframework.data.jpa.domain.support.AuditingEntityListener;
-
-import javax.persistence.*;
-import java.io.Serializable;
-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 BlueprintModelContent implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @Id
- @Column(name = "config_model_content_id")
- private String id;
-
- @Column(name = "name", nullable = false)
- @ApiModelProperty(required=true)
- private String name;
-
- @Column(name = "content_type", nullable = false)
- @ApiModelProperty(required=true)
- private String contentType;
-
- @OneToOne
- @JoinColumn(name = "config_model_id")
- private BlueprintModel blueprintModel;
-
- @Lob
- @Column(name = "description")
- private String description;
-
- @Lob
- @Column(name = "content", nullable = false)
- @ApiModelProperty(required=true)
- private byte[] content;
-
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- @LastModifiedDate
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "updated_date")
- private Date creationDate = new Date();
-
- @Override
- public String toString() {
- return "[" + "id = " + id +
- ", name = " + name +
- ", contentType = " + contentType +
- "]";
- }
-
- @Override
- public boolean equals(Object o) {
-
- if (o == this) {
- return true;
- }
- if (!(o instanceof BlueprintModelContent)) {
- return false;
- }
- BlueprintModelContent blueprintModelContent = (BlueprintModelContent) o;
- return Objects.equals(id, blueprintModelContent.id) && Objects.equals(name, blueprintModelContent.name)
- && Objects.equals(contentType, blueprintModelContent.contentType);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, name, contentType);
- }
-
- public String getId() {
- return id;
- }
-
-
- public void setId(String 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 BlueprintModel getBlueprintModel() {
- return blueprintModel;
- }
-
-
- public void setBlueprintModel(BlueprintModel blueprintModel) {
- this.blueprintModel = blueprintModel;
- }
-
-
- public String getDescription() {
- return description;
- }
-
-
- public void setDescription(String description) {
- this.description = description;
- }
-
-
- public byte[] getContent() {
- return content;
- }
-
-
- public void setContent(byte[] 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/BlueprintModelSearch.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/BlueprintModelSearch.java
deleted file mode 100644
index 33753b2f..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/BlueprintModelSearch.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.JsonTypeInfo;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import org.springframework.data.annotation.LastModifiedDate;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.util.Date;
-
-@Entity
-@Table(name = "CONFIG_MODEL")
-@JsonTypeName("blueprintModel")
-@JsonTypeInfo(include= JsonTypeInfo.As.WRAPPER_OBJECT, use=JsonTypeInfo.Id.NAME)
-public class BlueprintModelSearch implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- @Column(name = "config_model_id")
- private String id;
-
- @Column(name = "artifact_uuid")
- private String artifactUUId;
-
- @Column(name = "artifact_type")
- private String artifactType;
-
- @Column(name = "artifact_version", nullable = false)
- private String artifactVersion;
-
- @Lob
- @Column(name = "artifact_description")
- private String artifactDescription;
-
- @Column(name = "internal_version")
- private Integer internalVersion;
-
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- @LastModifiedDate
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "creation_date")
- private Date createdDate = new Date();
-
- @Column(name = "artifact_name", nullable = false)
- private String artifactName;
-
- @Column(name = "published", nullable = false)
- private String published;
-
- @Column(name = "updated_by", nullable = false)
- private String updatedBy;
-
- @Lob
- @Column(name = "tags", nullable = false)
- private String tags;
-
- public String getId() {
- return id;
- }
-
- public void setId(String 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/JpaJsonNodeConverter.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaJsonNodeConverter.java
deleted file mode 100644
index 074483a7..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaJsonNodeConverter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.domain;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-
-import javax.persistence.AttributeConverter;
-import javax.persistence.Converter;
-/**
- * @author Brinda Santh
- */
-@Converter
-public class JpaJsonNodeConverter implements
- AttributeConverter<JsonNode, String> {
-
- @Override
- public String convertToDatabaseColumn(JsonNode node) {
- return JacksonUtils.Companion.getJson(node, true);
- }
-
- @Override
- public JsonNode convertToEntityAttribute(String dbData) {
- return JacksonUtils.Companion.jsonNode(dbData);
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java
deleted file mode 100644
index e28cdcd5..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.domain;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
-
-import javax.persistence.AttributeConverter;
-import javax.persistence.Converter;
-/**
- * @author Brinda Santh
- */
-@Converter
-public class JpaResourceDefinitionConverter implements
- AttributeConverter<ResourceDefinition, String> {
- @Override
- public String convertToDatabaseColumn(ResourceDefinition resourceDefinition) {
- return JacksonUtils.Companion.getJson(resourceDefinition);
- }
-
- @Override
- public ResourceDefinition convertToEntityAttribute(String content) {
- return JacksonUtils.Companion.readValue(content, ResourceDefinition.class);
- }
-}
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
deleted file mode 100644
index 65a135c1..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.domain;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.databind.JsonNode;
-import io.swagger.annotations.ApiModelProperty;
-import org.springframework.data.annotation.LastModifiedDate;
-import org.springframework.data.jpa.domain.support.AuditingEntityListener;
-
-import javax.persistence.*;
-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
- @Column(name = "model_name", nullable = false)
- @ApiModelProperty(required=true)
- private String modelName;
-
- @Column(name = "derived_from", nullable = false)
- @ApiModelProperty(required=true)
- private String derivedFrom;
-
- @Column(name = "definition_type", nullable = false)
- @ApiModelProperty(required=true)
- private String definitionType;
-
- @Lob
- @Convert(converter = JpaJsonNodeConverter.class)
- @Column(name = "definition", nullable = false)
- @ApiModelProperty(required=true)
- private JsonNode definition;
-
- @Lob
- @Column(name = "description", nullable = false)
- @ApiModelProperty(required=true)
- private String description;
-
- @Column(name = "version", nullable = false)
- @ApiModelProperty(required=true)
- private String version;
-
- @Lob
- @Column(name = "tags", nullable = false)
- @ApiModelProperty(required=true)
- private String tags;
-
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- @LastModifiedDate
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "creation_date")
- private Date creationDate;
-
- @Column(name = "updated_by", nullable = false)
- @ApiModelProperty(required=true)
- private String updatedBy;
-
- @Override
- public String toString() {
- return "[" + "modelName = " + modelName +
- ", derivedFrom = " + derivedFrom +
- ", definitionType = " + definitionType +
- ", description = " + description +
- ", creationDate = " + creationDate +
- ", version = " + version +
- ", updatedBy = " + updatedBy +
- ", tags = " + tags +
- "]";
- }
-
- 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 JsonNode getDefinition() {
- return definition;
- }
-
- public void setDefinition(JsonNode definition) {
- this.definition = definition;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String 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
deleted file mode 100644
index 5352d9c9..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.domain;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.annotations.ApiModelProperty;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
-import org.springframework.data.annotation.LastModifiedDate;
-import org.springframework.data.jpa.domain.support.AuditingEntityListener;
-
-import javax.persistence.*;
-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
- @Column(name = "name", nullable = false)
- @ApiModelProperty(required=true)
- private String name;
-
- @Column(name = "data_type", nullable = false)
- @ApiModelProperty(required=true)
- private String dataType;
-
- @Column(name = "entry_schema")
- private String entrySchema;
-
- @Lob
- @Convert(converter = JpaResourceDefinitionConverter.class)
- @Column(name = "definition", nullable = false)
- @ApiModelProperty(required=true)
- private ResourceDefinition definition;
-
- @Lob
- @Column(name = "description", nullable = false)
- @ApiModelProperty(required=true)
- private String description;
-
- @Lob
- @Column(name = "tags", nullable = false)
- @ApiModelProperty(required=true)
- private String tags;
-
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- @LastModifiedDate
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "creation_date")
- private Date creationDate;
-
- @Column(name = "updated_by", nullable = false)
- @ApiModelProperty(required=true)
- private String updatedBy;
-
- @Override
- public String toString() {
- return "[" + ", name = " + name +
- ", dataType = " + dataType +
- ", entrySchema = " + entrySchema +
- ", definition =" + definition +
- ", description = " + description +
- ", updatedBy = " + updatedBy +
- ", tags = " + tags +
- ", creationDate = " + creationDate +
- "]";
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getEntrySchema() {
- return entrySchema;
- }
-
- public void setEntrySchema(String entrySchema) {
- this.entrySchema = entrySchema;
- }
-
- public ResourceDefinition getDefinition() {
- return definition;
- }
-
- public void setDefinition(ResourceDefinition 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
deleted file mode 100644
index 2250828a..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/model/AutoMapResponse.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.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/ControllerBlueprintModelSearchRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelSearchRepository.java
deleted file mode 100644
index 343f8c67..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelSearchRepository.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.BlueprintModelSearch;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import javax.validation.constraints.NotNull;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * ControllerBlueprintModelSearchRepository.java Purpose: Provide Configuration Generator AsdcArtifactsRepository
- *
- * @author Brinda Santh
- * @version 1.0
- */
-@Repository
-public interface ControllerBlueprintModelSearchRepository extends JpaRepository<BlueprintModelSearch, Long> {
-
- /**
- * This is a findById method
- *
- * @param id id
- * @return Optional<BlueprintModelSearch>
- */
- @NotNull
- Optional<BlueprintModelSearch> findById(@NotNull String id);
-
- /**
- * This is a findAll method
- * @return List<BlueprintModelSearch>
- */
- @Override
- List<BlueprintModelSearch> findAll();
-
- /**
- * This is a findByArtifactNameAndArtifactVersion method
- *
- * @param artifactName artifactName
- * @param artifactVersion artifactVersion
- * @return Optional<AsdcArtifacts>
- */
- Optional<BlueprintModelSearch> findByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);
-
- /**
- * This is a findByTagsContainingIgnoreCase method
- *
- * @param tags
- * @return Optional<BlueprintModelSearch>
- */
- List<BlueprintModelSearch> findByTagsContainingIgnoreCase(String tags);
-}
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
deleted file mode 100644
index c53040e2..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryRepository.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.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 name
- * @return Optional<ResourceMapping>
- */
- Optional<ResourceDictionary> findByName(String name);
-
- /**
- * This is a findByNameIn method
- *
- * @param names names
- * @return Optional<ResourceMapping>
- */
- List<ResourceDictionary> findByNameIn(List<String> names);
-
- /**
- * This is a findByTagsContainingIgnoreCase method
- *
- * @param tags tags
- * @return Optional<ModelType>
- */
- List<ResourceDictionary> findByTagsContainingIgnoreCase(String tags);
-
- /**
- * This is a deleteByName method
- *
- * @param name name
- */
- void deleteByName(String name);
-
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt
deleted file mode 100644
index 88589eb7..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.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.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ModelTypeRepository
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository
-import org.springframework.stereotype.Service
-
-interface ResourceDefinitionRepoService : BluePrintRepoService {
-
- @Throws(BluePrintException::class)
- fun getResourceDefinition(resourceDefinitionName: String): ResourceDefinition
-}
-
-@Service
-open class BluePrintRepoFileService(private val modelTypeRepository: ModelTypeRepository,
- private val resourceDictionaryRepository: ResourceDictionaryRepository) : ResourceDefinitionRepoService {
-
- @Throws(BluePrintException::class)
- override fun getNodeType(nodeTypeName: String): NodeType {
- return getModelType(nodeTypeName, NodeType::class.java)
- ?: throw BluePrintException("couldn't get NodeType($nodeTypeName)")
- }
-
- @Throws(BluePrintException::class)
- override fun getDataType(dataTypeName: String): DataType {
- return getModelType(dataTypeName, DataType::class.java)
- ?: throw BluePrintException("couldn't get DataType($dataTypeName)")
- }
-
- @Throws(BluePrintException::class)
- override fun getArtifactType(artifactTypeName: String): ArtifactType {
- return getModelType(artifactTypeName, ArtifactType::class.java)
- ?: throw BluePrintException("couldn't get ArtifactType($artifactTypeName)")
- }
-
- @Throws(BluePrintException::class)
- override fun getRelationshipType(relationshipTypeName: String): RelationshipType {
- return getModelType(relationshipTypeName, RelationshipType::class.java)
- ?: throw BluePrintException("couldn't get RelationshipType($relationshipTypeName)")
- }
-
- @Throws(BluePrintException::class)
- override fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition {
- return getModelType(capabilityDefinitionName, CapabilityDefinition::class.java)
- ?: throw BluePrintException("couldn't get CapabilityDefinition($capabilityDefinitionName)")
- }
-
- @Throws(BluePrintException::class)
- override fun getResourceDefinition(resourceDefinitionName: String): ResourceDefinition {
- val dbResourceDictionary = resourceDictionaryRepository.findByName(resourceDefinitionName)
- return if (dbResourceDictionary.isPresent) {
- dbResourceDictionary.get().definition
- } else {
- throw BluePrintException(String.format("failed to get resource dictionary (%s) from repo", resourceDefinitionName))
- }
- }
-
- @Throws(BluePrintException::class)
- private fun <T> getModelType(modelName: String, valueClass: Class<T>): T? {
- Preconditions.checkArgument(StringUtils.isNotBlank(modelName),
- "Failed to get model from repo, model name is missing")
-
- val modelDefinition = getModelDefinition(modelName)
- Preconditions.checkNotNull(modelDefinition,
- String.format("Failed to get model content for model name (%s)", modelName))
-
- return JacksonUtils.readValue(modelDefinition, valueClass)
- }
-
- @Throws(BluePrintException::class)
- private fun getModelDefinition(modelName: String): JsonNode {
- val modelDefinition: JsonNode
- val modelTypeDb = modelTypeRepository.findByModelName(modelName)
- if (modelTypeDb != null) {
- modelDefinition = modelTypeDb.definition
- } else {
- throw BluePrintException(String.format("failed to get model definition (%s) from repo", modelName))
- }
- return modelDefinition
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt
deleted file mode 100644
index 2c4ee746..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service
-
-import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.context.properties.bind.Bindable
-import org.springframework.boot.context.properties.bind.Binder
-import org.springframework.boot.context.properties.source.ConfigurationPropertySources
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.core.env.Environment
-import org.springframework.stereotype.Service
-
-@Configuration
-open class ControllerBluePrintCoreConfiguration(private val bluePrintProperties: ControllerBlueprintProperties) {
-
- companion object {
- const val PREFIX_BLUEPRINT_LOAD_CONFIGURATION = "controllerblueprints"
- }
-
- @Bean
- open fun controlelrBlueprintLoadConfiguration(): BluePrintLoadConfiguration {
- return bluePrintProperties
- .propertyBeanType(PREFIX_BLUEPRINT_LOAD_CONFIGURATION, BluePrintLoadConfiguration::class.java)
- }
-}
-
-@Configuration
-open class ControllerBlueprintPropertyConfiguration {
- @Autowired
- lateinit var environment: Environment
-
- @Bean
- open fun controllerBluePrintPropertyBinder(): Binder {
- val configurationPropertySource = ConfigurationPropertySources.get(environment)
- return Binder(configurationPropertySource)
- }
-}
-
-@Service
-open class ControllerBlueprintProperties(var bluePrintPropertyBinder: Binder) {
- fun <T> propertyBeanType(prefix: String, type: Class<T>): T {
- return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get()
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelController.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelController.kt
deleted file mode 100644
index 4974bcd1..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelController.kt
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.controller
-
-import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch
-import org.onap.ccsdk.apps.controllerblueprints.service.handler.BluePrintModelHandler
-import org.springframework.core.io.Resource
-import org.springframework.http.MediaType
-import org.springframework.http.ResponseEntity
-import org.springframework.http.codec.multipart.FilePart
-import org.springframework.web.bind.annotation.*
-import reactor.core.publisher.Mono
-
-/**
- * BlueprintModelController Purpose: Handle controllerBlueprint API request
- *
- * @author Vinal Patel
- * @version 1.0
- */
-@RestController
-@RequestMapping("/api/v1/blueprint-model")
-open class BlueprintModelController(private val bluePrintModelHandler: BluePrintModelHandler) {
-
- @PostMapping("", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
- @ResponseBody
- @Throws(BluePrintException::class)
- fun saveBlueprint(@RequestPart("file") file: FilePart): Mono<BlueprintModelSearch> {
- return bluePrintModelHandler.saveBlueprintModel(file)
- }
-
- @GetMapping("", produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- fun allBlueprintModel(): List<BlueprintModelSearch> {
- return this.bluePrintModelHandler.allBlueprintModel()
- }
-
- @DeleteMapping("/{id}")
- @Throws(BluePrintException::class)
- fun deleteBlueprint(@PathVariable(value = "id") id: String) {
- this.bluePrintModelHandler.deleteBlueprintModel(id)
- }
-
- @GetMapping("/by-name/{name}/version/{version}", produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- @Throws(BluePrintException::class)
- fun getBlueprintByNameAndVersion(@PathVariable(value = "name") name: String,
- @PathVariable(value = "version") version: String): BlueprintModelSearch {
- return this.bluePrintModelHandler.getBlueprintModelSearchByNameAndVersion(name, version)
- }
-
- @GetMapping("/download/by-name/{name}/version/{version}", produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- @Throws(BluePrintException::class)
- fun downloadBlueprintByNameAndVersion(@PathVariable(value = "name") name: String,
- @PathVariable(value = "version") version: String): ResponseEntity<Resource> {
- return this.bluePrintModelHandler.downloadBlueprintModelFileByNameAndVersion(name, version)
- }
-
- @GetMapping("/{id}", produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- @Throws(BluePrintException::class)
- fun getBlueprintModel(@PathVariable(value = "id") id: String): BlueprintModelSearch {
- return this.bluePrintModelHandler.getBlueprintModelSearch(id)
- }
-
- @GetMapping("/download/{id}", produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- @Throws(BluePrintException::class)
- fun downloadBluePrint(@PathVariable(value = "id") id: String): ResponseEntity<Resource> {
- return this.bluePrintModelHandler.downloadBlueprintModelFile(id)
- }
-
- @PostMapping("/enrich", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType
- .MULTIPART_FORM_DATA_VALUE])
- @ResponseBody
- @Throws(BluePrintException::class)
- fun enrichBlueprint(@RequestPart("file") file: FilePart): ResponseEntity<Resource> = runBlocking {
- bluePrintModelHandler.enrichBlueprint(file)
- }
-
- @PostMapping("/publish", produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- @Throws(BluePrintException::class)
- fun publishBlueprint(@RequestPart("file") file: FilePart): BlueprintModelSearch = runBlocking {
- bluePrintModelHandler.publishBlueprint(file)
- }
-
- @GetMapping("/search/{tags}", produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- fun searchBlueprintModels(@PathVariable(value = "tags") tags: String): List<BlueprintModelSearch> {
- return this.bluePrintModelHandler.searchBlueprintModels(tags)
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt
deleted file mode 100644
index 04753391..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright © 2018-2019 Bell Canada 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.controller
-
-import org.springframework.web.bind.annotation.RestControllerAdvice
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ErrorCode
-import org.onap.ccsdk.apps.controllerblueprints.service.common.ErrorMessage
-import org.springframework.http.HttpStatus
-import org.springframework.http.ResponseEntity
-import org.springframework.web.bind.annotation.ExceptionHandler
-
-/**
- * ControllerBlueprintExceptionHandler Purpose: Handle exceptions in controllerBlueprint API and provide the right
- * HTTP code status
- *
- * @author Vinal Patel
- * @version 1.0
- */
-@RestControllerAdvice("org.onap.ccsdk.apps.controllerblueprints")
-open class ControllerBlueprintExeptionHandler {
-
- @ExceptionHandler
- fun ControllerBlueprintException(e: BluePrintException): ResponseEntity<ErrorMessage> {
- var errorCode = ErrorCode.valueOf(e.code)
- val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message")
- return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode))
- }
-
- @ExceptionHandler
- fun ControllerBlueprintException(e: Exception): ResponseEntity<ErrorMessage> {
- var errorCode = ErrorCode.GENERIC_FAILURE
- val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message")
- return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode))
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeController.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeController.kt
deleted file mode 100644
index db82849e..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeController.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.controller
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
-import org.onap.ccsdk.apps.controllerblueprints.service.handler.ModelTypeHandler
-import org.springframework.http.MediaType
-import org.springframework.web.bind.annotation.*
-
-@RestController
-@RequestMapping(value = arrayOf("/api/v1/model-type"))
-open class ModelTypeController(private val modelTypeHandler: ModelTypeHandler) {
-
- @GetMapping(path = arrayOf("/{name}"), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
- fun getModelTypeByName(@PathVariable(value = "name") name: String): ModelType? {
- return modelTypeHandler.getModelTypeByName(name)
- }
-
- @GetMapping(path = arrayOf("/search/{tags}"), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
- fun searchModelTypes(@PathVariable(value = "tags") tags: String): List<ModelType> {
- return modelTypeHandler.searchModelTypes(tags)
- }
-
- @GetMapping(path = arrayOf("/by-definition/{definitionType}"), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
- @ResponseBody
- fun getModelTypeByDefinitionType(@PathVariable(value = "definitionType") definitionType: String): List<ModelType> {
- return modelTypeHandler.getModelTypeByDefinitionType(definitionType)
- }
-
- @PostMapping(path = arrayOf(""), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE), consumes = arrayOf(MediaType.APPLICATION_JSON_VALUE))
- @ResponseBody
- @Throws(BluePrintException::class)
- fun saveModelType(@RequestBody modelType: ModelType): ModelType {
- return modelTypeHandler.saveModel(modelType)
- }
-
- @DeleteMapping(path = arrayOf("/{name}"))
- fun deleteModelTypeByName(@PathVariable(value = "name") name: String) {
- modelTypeHandler.deleteByModelName(name)
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryController.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryController.kt
deleted file mode 100644
index 38397faa..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryController.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.controller
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary
-import org.onap.ccsdk.apps.controllerblueprints.service.handler.ResourceDictionaryHandler
-import org.springframework.http.MediaType
-import org.springframework.web.bind.annotation.*
-
-@RestController
-@RequestMapping(value = ["/api/v1/dictionary"])
-open class ResourceDictionaryController(private val resourceDictionaryHandler: ResourceDictionaryHandler) {
-
- @GetMapping(path = ["/{name}"], produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- @Throws(BluePrintException::class)
- fun getResourceDictionaryByName(@PathVariable(value = "name") name: String): ResourceDictionary {
- return resourceDictionaryHandler.getResourceDictionaryByName(name)
- }
-
- @PostMapping(path = [""], produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- @Throws(BluePrintException::class)
- fun saveResourceDictionary(@RequestBody dataDictionary: ResourceDictionary): ResourceDictionary {
- return resourceDictionaryHandler.saveResourceDictionary(dataDictionary)
- }
-
- @DeleteMapping(path = ["/{name}"])
- fun deleteResourceDictionaryByName(@PathVariable(value = "name") name: String) {
- resourceDictionaryHandler.deleteResourceDictionary(name)
- }
-
- @PostMapping(path = ["/by-names"], produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- fun searchResourceDictionaryByNames(@RequestBody names: List<String>): List<ResourceDictionary> {
- return resourceDictionaryHandler.searchResourceDictionaryByNames(names)
- }
-
- @GetMapping(path = ["/search/{tags}"], produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- fun searchResourceDictionaryByTags(@PathVariable(value = "tags") tags: String): List<ResourceDictionary> {
- return resourceDictionaryHandler.searchResourceDictionaryByTags(tags)
-
- }
-
- @GetMapping(path = ["/source-mapping"], produces = [MediaType.APPLICATION_JSON_VALUE])
- @ResponseBody
- fun getResourceSourceMapping(): ResourceSourceMapping {
- return resourceDictionaryHandler.getResourceSourceMapping()
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
deleted file mode 100644
index 3b14d82f..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionEnhancer
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-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.utils.BluePrintEnhancerUtils
-import org.springframework.stereotype.Service
-
-@Service
-open class BluePrintArtifactDefinitionEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- private val resourceAssignmentEnhancerService: ResourceAssignmentEnhancerService)
- : BluePrintArtifactDefinitionEnhancer {
-
- companion object {
- const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
- }
-
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintArtifactDefinitionEnhancerImpl::class.toString())
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var bluePrintContext: BluePrintContext
-
-
- override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactDefinition: ArtifactDefinition) {
- log.info("enhancing ArtifactDefinition($name)")
-
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- val artifactTypeName = artifactDefinition.type
- ?: throw BluePrintException("artifact type is missing for ArtifactDefinition($name)")
-
- // Populate Artifact Type
- BluePrintEnhancerUtils.populateArtifactType(bluePrintContext, bluePrintRepoService, artifactTypeName)
-
- when (artifactTypeName) {
- ARTIFACT_TYPE_MAPPING_SOURCE -> {
- enhanceMappingType(name, artifactDefinition)
- }
- }
- }
-
- // Enhance Resource Mapping
- open fun enhanceMappingType(name: String, artifactDefinition: ArtifactDefinition) {
-
- val artifactFilePath = "${bluePrintContext.rootPath}/${artifactDefinition.file}"
-
- val alreadyEnhancedKey = "enhanced-${artifactDefinition.file}"
- val alreadyEnhanced = bluePrintRuntimeService.check(alreadyEnhancedKey)
-
- log.info("enhancing resource mapping file(${artifactDefinition.file}) already enhanced($alreadyEnhanced)")
-
- if (!alreadyEnhanced) {
- val resourceAssignments: MutableList<ResourceAssignment> = JacksonUtils.getListFromFile(artifactFilePath, ResourceAssignment::class.java)
- as? MutableList<ResourceAssignment>
- ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($artifactFilePath)")
-
- // Call Resource Assignment Enhancer
- resourceAssignmentEnhancerService.enhanceBluePrint(bluePrintTypeEnhancerService, bluePrintRuntimeService, resourceAssignments)
-
- bluePrintRuntimeService.put(alreadyEnhancedKey, true.asJsonPrimitive())
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt
deleted file mode 100644
index f69e344f..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.data.AttributeDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionEnhancer
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils
-
-class BluePrintAttributeDefinitionEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
- : BluePrintAttributeDefinitionEnhancer {
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var bluePrintContext: BluePrintContext
-
- override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition) {
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- val propertyType = attributeDefinition.type
- if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
-
- } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
- val entrySchema = attributeDefinition.entrySchema
- ?: throw BluePrintException("Entry Schema is missing for collection property($name)")
-
- if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema.type)) {
- BluePrintEnhancerUtils.populateDataTypes(bluePrintContext, bluePrintRepoService, entrySchema.type)
- }
- } else {
- BluePrintEnhancerUtils.populateDataTypes(bluePrintContext, bluePrintRepoService, propertyType)
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt
deleted file mode 100644
index da755d16..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils
-import org.springframework.stereotype.Service
-import java.util.*
-
-@Service
-open class BluePrintEnhancerServiceImpl(private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- private val resourceDefinitionEnhancerService: ResourceDefinitionEnhancerService) : BluePrintEnhancerService {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintEnhancerServiceImpl::class.toString())
-
- override suspend fun enhance(basePath: String, enrichedBasePath: String): BluePrintContext {
-
- // Copy the Blueprint Content to Target Location
- BluePrintFileUtils.copyBluePrint(basePath, enrichedBasePath)
-
- // Enhance the Blueprint
- return enhance(enrichedBasePath)
- }
-
- @Throws(BluePrintException::class)
- override suspend fun enhance(basePath: String): BluePrintContext {
-
- log.info("Enhancing blueprint($basePath)")
- val blueprintRuntimeService = BluePrintMetadataUtils
- .getBaseEnhancementBluePrintRuntime(UUID.randomUUID().toString(), basePath)
-
- try {
-
- bluePrintTypeEnhancerService.enhanceServiceTemplate(blueprintRuntimeService, "service_template",
- blueprintRuntimeService.bluePrintContext().serviceTemplate)
-
- log.info("##### Enhancing blueprint Resource Definitions")
- val resourceDefinitions = resourceDefinitionEnhancerService.enhance(bluePrintTypeEnhancerService,
- blueprintRuntimeService)
-
- // Write the Enhanced Blueprint Definitions
- BluePrintFileUtils.writeEnhancedBluePrint(blueprintRuntimeService.bluePrintContext())
-
- // Write the Enhanced Blueprint Resource Definitions
- ResourceDictionaryUtils.writeResourceDefinitionTypes(basePath, resourceDefinitions)
-
- if (blueprintRuntimeService.getBluePrintError().errors.isNotEmpty()) {
- throw BluePrintException(blueprintRuntimeService.getBluePrintError().errors.toString())
- }
-
- } catch (e: Exception) {
- throw e
- }
- return blueprintRuntimeService.bluePrintContext()
- }
-
-}
-
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTemplateEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTemplateEnhancerImpl.kt
deleted file mode 100644
index 0765f903..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTemplateEnhancerImpl.kt
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTemplateEnhancer
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintNodeTemplateEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
- : BluePrintNodeTemplateEnhancer {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintNodeTemplateEnhancerImpl::class.toString())
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var bluePrintContext: BluePrintContext
-
-
- override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) {
- log.info("***** Enhancing NodeTemplate($name)")
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
-
- val nodeTypeName = nodeTemplate.type
- // Get NodeType from Repo and Update Service Template
- val nodeType = BluePrintEnhancerUtils.populateNodeType(bluePrintContext, bluePrintRepoService, nodeTypeName)
-
- // Enrich NodeType
- bluePrintTypeEnhancerService.enhanceNodeType(bluePrintRuntimeService, nodeTypeName, nodeType)
-
- //Enrich Node Template Artifacts
- enhanceNodeTemplateArtifactDefinition(name, nodeTemplate)
- }
-
- open fun enhanceNodeTemplateArtifactDefinition(nodeTemplateName: String, nodeTemplate: NodeTemplate) {
-
- nodeTemplate.artifacts?.forEach { artifactDefinitionName, artifactDefinition ->
- // Enhance Artifacct Definitions
- bluePrintTypeEnhancerService.enhanceArtifactDefinition(bluePrintRuntimeService, artifactDefinitionName, artifactDefinition)
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTypeEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTypeEnhancerImpl.kt
deleted file mode 100644
index 6ff0b39b..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTypeEnhancerImpl.kt
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.data.InterfaceDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType
-import org.onap.ccsdk.apps.controllerblueprints.core.data.OperationDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTypeEnhancer
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintNodeTypeEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) : BluePrintNodeTypeEnhancer {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintNodeTypeEnhancerImpl::class.toString())
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var bluePrintContext: BluePrintContext
-
-
- override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeType: NodeType) {
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
-
- val derivedFrom = nodeType.derivedFrom
-
- if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
- val derivedFromNodeType = BluePrintEnhancerUtils.populateNodeType(bluePrintContext, bluePrintRepoService, name)
- // Enrich NodeType
- enhance(bluePrintRuntimeService, derivedFrom, derivedFromNodeType)
- }
-
- // NodeType Attribute Definitions
- enrichNodeTypeAttributes(name, nodeType)
-
- // NodeType Property Definitions
- enrichNodeTypeProperties(name, nodeType)
-
- //NodeType Requirement
- enrichNodeTypeRequirements(name, nodeType)
-
- //NodeType Capability
- enrichNodeTypeCapabilityProperties(name, nodeType)
-
- //NodeType Interface
- enrichNodeTypeInterfaces(name, nodeType)
-
- }
-
- open fun enrichNodeTypeAttributes(nodeTypeName: String, nodeType: NodeType) {
- nodeType.attributes?.let {
- bluePrintTypeEnhancerService.enhanceAttributeDefinitions(bluePrintRuntimeService, nodeType.attributes!!)
- }
- }
-
- open fun enrichNodeTypeProperties(nodeTypeName: String, nodeType: NodeType) {
- nodeType.properties?.let {
- bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintRuntimeService, nodeType.properties!!)
- }
- }
-
- open fun enrichNodeTypeRequirements(nodeTypeName: String, nodeType: NodeType) {
-
- nodeType.requirements?.forEach { requirementName, requirementDefinition ->
- // Populate Requirement Node
- requirementDefinition.node?.let { requirementNodeTypeName ->
- // Get Requirement NodeType from Repo and Update Service Template
- val requirementNodeType = BluePrintEnhancerUtils.populateNodeType(bluePrintContext,
- bluePrintRepoService, requirementNodeTypeName)
- // Enhance Node Type
- enhance(bluePrintRuntimeService, requirementNodeTypeName, requirementNodeType)
-
- // Enhance Relationship Type
- val relationShipTypeName = requirementDefinition.relationship
- ?: throw BluePrintException("couldn't get relationship name for the NodeType($nodeTypeName) " +
- "Requirement($requirementName)")
- enrichRelationShipType(relationShipTypeName)
- }
- }
- }
-
- open fun enrichNodeTypeCapabilityProperties(nodeTypeName: String, nodeType: NodeType) {
- nodeType.capabilities?.forEach { _, capabilityDefinition ->
- capabilityDefinition.properties?.let { properties ->
- bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintRuntimeService, properties)
- }
- }
- }
-
- open fun enrichNodeTypeInterfaces(nodeTypeName: String, nodeType: NodeType) {
- nodeType.interfaces?.forEach { interfaceName, interfaceObj ->
- // Populate Node type Interface Operation
- log.debug("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)
- enrichNodeTypeInterfaceOperationOutputs(nodeTypeName, operationName, operation)
- }
- }
-
- open fun enrichNodeTypeInterfaceOperationInputs(nodeTypeName: String, operationName: String, operation: OperationDefinition) {
- operation.inputs?.let { inputs ->
- bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintRuntimeService, inputs)
- }
- }
-
- open fun enrichNodeTypeInterfaceOperationOutputs(nodeTypeName: String, operationName: String,
- operation: OperationDefinition) {
- operation.outputs?.let { inputs ->
- bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintRuntimeService, inputs)
- }
- }
-
- /**
- * Get the Relationship Type from database and add to Blueprint Context
- */
- open fun enrichRelationShipType(relationshipName: String) {
- BluePrintEnhancerUtils.populateRelationshipType(bluePrintContext, bluePrintRepoService, relationshipName)
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPolicyTypeEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPolicyTypeEnhancerImpl.kt
deleted file mode 100644
index 80a84fcd..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPolicyTypeEnhancerImpl.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PolicyType
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintPolicyTypeEnhancer
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-class BluePrintPolicyTypeEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
- : BluePrintPolicyTypeEnhancer {
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
-
- override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: PolicyType) {
-
- this.bluePrintRuntimeService = bluePrintRuntimeService
-
- // TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt
deleted file mode 100644
index 1675e8cd..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionEnhancer
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintPropertyDefinitionEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
- : BluePrintPropertyDefinitionEnhancer {
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var bluePrintContext: BluePrintContext
-
- override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) {
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- val propertyType = propertyDefinition.type
- if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)
- || BluePrintTypes.validComplexTypes().contains(propertyType)) {
- // Do Nothing,
- } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
- val entrySchema = propertyDefinition.entrySchema
- ?: throw BluePrintException("Entry Schema is missing for collection property($name)")
-
- if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema.type)) {
- BluePrintEnhancerUtils.populateDataTypes(bluePrintContext, bluePrintRepoService, entrySchema.type)
- }
- } else {
- BluePrintEnhancerUtils.populateDataTypes(bluePrintContext, bluePrintRepoService, propertyType)
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintServiceTemplateEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintServiceTemplateEnhancerImpl.kt
deleted file mode 100644
index 8c269e54..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintServiceTemplateEnhancerImpl.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintServiceTemplateEnhancer
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintServiceTemplateEnhancerImpl(private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
- : BluePrintServiceTemplateEnhancer {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateEnhancerImpl::class.toString())
-
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var bluePrintContext: BluePrintContext
-
- override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: ServiceTemplate) {
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- initialCleanUp()
- enhanceTopologyTemplate()
- }
-
- open fun initialCleanUp() {
- bluePrintContext.serviceTemplate.artifactTypes?.clear()
- bluePrintContext.serviceTemplate.nodeTypes?.clear()
- bluePrintContext.serviceTemplate.dataTypes?.clear()
- bluePrintContext.serviceTemplate.policyTypes?.clear()
- bluePrintContext.serviceTemplate.relationshipTypes?.clear()
-
- bluePrintContext.serviceTemplate.artifactTypes = mutableMapOf()
- bluePrintContext.serviceTemplate.nodeTypes = mutableMapOf()
- bluePrintContext.serviceTemplate.dataTypes = mutableMapOf()
- bluePrintContext.serviceTemplate.policyTypes = mutableMapOf()
- bluePrintContext.serviceTemplate.relationshipTypes = mutableMapOf()
- log.info("reinitialized all type definitions")
-
- }
-
- open fun enhanceTopologyTemplate() {
- bluePrintContext.serviceTemplate.topologyTemplate?.let { topologyTemplate ->
- bluePrintTypeEnhancerService.enhanceTopologyTemplate(bluePrintRuntimeService, "topology_template", topologyTemplate)
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt
deleted file mode 100644
index 428d490b..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import org.onap.ccsdk.apps.controllerblueprints.core.data.TopologyTemplate
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTopologyTemplateEnhancer
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintTopologyTemplateEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) : BluePrintTopologyTemplateEnhancer {
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
- override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: TopologyTemplate) {
- this.bluePrintRuntimeService = bluePrintRuntimeService
-
- enhanceTopologyTemplateInputs(type)
- enhanceTopologyTemplateNodeTemplates(type)
- enhanceTopologyTemplateWorkflows(type)
- }
-
- open fun enhanceTopologyTemplateInputs(topologyTemplate: TopologyTemplate) {
- topologyTemplate.inputs?.let { inputs ->
- bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintRuntimeService, inputs)
- }
- }
-
- open fun enhanceTopologyTemplateNodeTemplates(topologyTemplate: TopologyTemplate) {
- topologyTemplate.nodeTemplates?.forEach { nodeTemplateName, nodeTemplate ->
- bluePrintTypeEnhancerService.enhanceNodeTemplate(bluePrintRuntimeService, nodeTemplateName, nodeTemplate)
- }
- }
-
- open fun enhanceTopologyTemplateWorkflows(topologyTemplate: TopologyTemplate) {
- topologyTemplate.workflows?.forEach { workflowName, workflow ->
- bluePrintTypeEnhancerService.enhanceWorkflow(bluePrintRuntimeService, workflowName, workflow)
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTypeEnhancerServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTypeEnhancerServiceImpl.kt
deleted file mode 100644
index 02a19c3f..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTypeEnhancerServiceImpl.kt
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.*
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.context.ApplicationContext
-import org.springframework.stereotype.Service
-
-@Service
-open class BluePrintTypeEnhancerServiceImpl : BluePrintTypeEnhancerService {
-
- @Autowired
- private lateinit var context: ApplicationContext
-
- override fun getServiceTemplateEnhancers(): List<BluePrintServiceTemplateEnhancer> {
- return context.getBeansOfType(BluePrintServiceTemplateEnhancer::class.java).map { it.value }
- }
-
- override fun getTopologyTemplateEnhancers(): List<BluePrintTopologyTemplateEnhancer> {
- return context.getBeansOfType(BluePrintTopologyTemplateEnhancer::class.java).map { it.value }
- }
-
- override fun getWorkflowEnhancers(): List<BluePrintWorkflowEnhancer> {
- return context.getBeansOfType(BluePrintWorkflowEnhancer::class.java).map { it.value }
- }
-
- override fun getNodeTemplateEnhancers(): List<BluePrintNodeTemplateEnhancer> {
- return context.getBeansOfType(BluePrintNodeTemplateEnhancer::class.java).map { it.value }
- }
-
- override fun getNodeTypeEnhancers(): List<BluePrintNodeTypeEnhancer> {
- return context.getBeansOfType(BluePrintNodeTypeEnhancer::class.java).map { it.value }
- }
-
- override fun getArtifactDefinitionEnhancers(): List<BluePrintArtifactDefinitionEnhancer> {
- return context.getBeansOfType(BluePrintArtifactDefinitionEnhancer::class.java).map { it.value }
- }
-
- override fun getPolicyTypeEnhancers(): List<BluePrintPolicyTypeEnhancer> {
- return context.getBeansOfType(BluePrintPolicyTypeEnhancer::class.java).map { it.value }
- }
-
- override fun getPropertyDefinitionEnhancers(): List<BluePrintPropertyDefinitionEnhancer> {
- return context.getBeansOfType(BluePrintPropertyDefinitionEnhancer::class.java).map { it.value }
- }
-
- override fun getAttributeDefinitionEnhancers(): List<BluePrintAttributeDefinitionEnhancer> {
- return context.getBeansOfType(BluePrintAttributeDefinitionEnhancer::class.java).map { it.value }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt
deleted file mode 100644
index fc9ee504..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
-import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowEnhancer
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-@Service
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- private val resourceAssignmentEnhancerService: ResourceAssignmentEnhancerService)
- : BluePrintWorkflowEnhancer {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintWorkflowEnhancerImpl::class.toString())
-
- companion object {
- const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
- const val PROPERTY_DEPENDENCY_NODE_TEMPLATES = "dependency-node-templates"
- }
-
- lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- lateinit var bluePrintContext: BluePrintContext
-
- private val workflowDataTypes: MutableMap<String, DataType> = hashMapOf()
-
- override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, workflow: Workflow) {
- log.info("##### Enhancing Workflow($name)")
- this.bluePrintRuntimeService = bluePrintRuntimeService
- this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
- val dynamicPropertyName = "$name-properties"
- if (workflow.inputs == null) {
- workflow.inputs = hashMapOf()
- }
- // Clean Dynamic Property Field, If present
- workflow.inputs?.remove(dynamicPropertyName)
-
- // Enrich Only for Resource Assignment and Dynamic Input Properties if any
- enhanceStepTargets(name, workflow)
-
- // Enrich Workflow Inputs
- enhanceWorkflowInputs(name, workflow)
- }
-
- open fun enhanceWorkflowInputs(name: String, workflow: Workflow) {
-
- workflow.inputs?.let { inputs ->
- bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintRuntimeService, inputs)
- }
- }
-
- private fun enhanceStepTargets(name: String, workflow: Workflow) {
-
- // Get the first Step Target NodeTemplate name( It may be Component or DG Node Template)
- val firstNodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(name)
-
- val derivedFrom = bluePrintContext.nodeTemplateNodeType(firstNodeTemplateName).derivedFrom
-
- when {
- derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_COMPONENT, true) -> {
- // DO Nothing
- }
- derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_DG, true) -> {
- enhanceDGStepTargets(name, workflow, firstNodeTemplateName)
- }
- else -> {
- throw BluePrintProcessorException("couldn't execute workflow($name) step mapped " +
- "to node template($firstNodeTemplateName) derived from($derivedFrom)")
- }
- }
-
- }
-
- private fun enhanceDGStepTargets(name: String, workflow: Workflow, dgNodeTemplateName: String) {
-
- val dgNodeTemplate = bluePrintContext.nodeTemplateByName(dgNodeTemplateName)
-
- // Get the Dependent Component Node Template Names
- val dependencyNodeTemplateNodes = dgNodeTemplate.properties?.get(PROPERTY_DEPENDENCY_NODE_TEMPLATES)
- ?: throw BluePrintException("couldn't get property($PROPERTY_DEPENDENCY_NODE_TEMPLATES) ")
-
- val dependencyNodeTemplates = JacksonUtils.getListFromJsonNode(dependencyNodeTemplateNodes, String::class.java)
-
- log.info("workflow($name) dependent component NodeTemplates($dependencyNodeTemplates)")
-
- // Check and Get Resource Assignment File
- val resourceAssignmentArtifacts = dependencyNodeTemplates?.mapNotNull { componentNodeTemplateName ->
- log.info("identified workflow($name) targets($componentNodeTemplateName)")
-
- val resourceAssignmentArtifacts = bluePrintContext.nodeTemplateByName(componentNodeTemplateName)
- .artifacts?.filter {
- it.value.type == ARTIFACT_TYPE_MAPPING_SOURCE
- }?.map {
- log.info("resource assignment artifacts(${it.key}) for NodeType(${componentNodeTemplateName})")
- it.value.file
- }
- resourceAssignmentArtifacts
- }?.flatten()
-
- log.info("workflow($name) resource assignment files($resourceAssignmentArtifacts")
-
- if (resourceAssignmentArtifacts != null && resourceAssignmentArtifacts.isNotEmpty()) {
-
- // Add Workflow Dynamic Property
- addWorkFlowDynamicPropertyDefinitions(name, workflow)
-
- resourceAssignmentArtifacts.forEach { fileName ->
- // Enhance Resource Assignment File
- val resourceAssignmentProperties = enhanceResourceAssignmentFile(fileName!!)
- // Add Workflow Dynamic DataType
- addWorkFlowDynamicDataType(name, resourceAssignmentProperties)
- }
- }
- }
-
- // Enhancement for Dynamic Properties, Resource Assignment Properties, Resource Sources
- private fun enhanceResourceAssignmentFile(fileName: String): MutableMap<String, PropertyDefinition> {
-
- val filePath = "${bluePrintContext.rootPath}/$fileName"
-
- log.info("enriching artifacts file(${filePath}")
-
- val resourceAssignmentProperties: MutableMap<String, PropertyDefinition> = hashMapOf()
-
- val resourceAssignments: MutableList<ResourceAssignment> = JacksonUtils.getListFromFile(filePath, ResourceAssignment::class.java)
- as? MutableList<ResourceAssignment>
- ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
-
- val alreadyEnhancedKey = "enhanced-$fileName"
- val alreadyEnhanced = bluePrintRuntimeService.check(alreadyEnhancedKey)
-
- log.info("enhancing workflow resource mapping file($fileName) already enhanced($alreadyEnhanced)")
-
- if (!alreadyEnhanced) {
- // Call Resource Assignment Enhancer
- resourceAssignmentEnhancerService.enhanceBluePrint(bluePrintTypeEnhancerService, bluePrintRuntimeService, resourceAssignments)
- bluePrintRuntimeService.put(alreadyEnhancedKey, true.asJsonPrimitive())
- }
-
- resourceAssignments.forEach { resourceAssignment ->
- resourceAssignmentProperties[resourceAssignment.name] = resourceAssignment.property!!
- }
- return resourceAssignmentProperties
- }
-
- private fun addWorkFlowDynamicPropertyDefinitions(name: String, workflow: Workflow) {
- val dynamicPropertyName = "$name-properties"
- val propertyDefinition = PropertyDefinition()
- propertyDefinition.description = "Dynamic PropertyDefinition for workflow($name)."
- propertyDefinition.type = "dt-$dynamicPropertyName"
- propertyDefinition.required = true
- // Add to Workflow Inputs
- workflow.inputs?.put(dynamicPropertyName, propertyDefinition)
- }
-
- private fun addWorkFlowDynamicDataType(workflowName: String, mappingProperties: MutableMap<String, PropertyDefinition>) {
-
- val dataTypeName = "dt-$workflowName-properties"
-
- var dynamicDataType: DataType? = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName)
-
- if (dynamicDataType == null) {
- log.info("dataType not present for the recipe({})", dataTypeName)
- dynamicDataType = DataType()
- dynamicDataType.version = "1.0.0"
- dynamicDataType.description = "Dynamic DataType definition for workflow($workflowName)."
- dynamicDataType.derivedFrom = BluePrintConstants.MODEL_TYPE_DATA_TYPE_DYNAMIC
-
- val dataTypeProperties: MutableMap<String, PropertyDefinition> = hashMapOf()
- dynamicDataType.properties = dataTypeProperties
-
- // Overwrite WorkFlow DataType
- bluePrintContext.serviceTemplate.dataTypes?.put(dataTypeName, dynamicDataType)
-
- } else {
- log.info("dynamic dataType($dataTypeName) already present for workflow($workflowName).")
- }
- // Merge all the Recipe Properties
- mappingProperties.forEach { propertyName, propertyDefinition ->
- dynamicDataType.properties?.put(propertyName, propertyDefinition)
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt
deleted file mode 100644
index 4d1f44a6..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
-import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDefinitionRepoService
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
-
-/**
- * ResourceAssignmentEnhancerService.
- *
- * @author Brinda Santh
- */
-interface ResourceAssignmentEnhancerService {
-
- @Throws(BluePrintException::class)
- fun enhanceBluePrint(bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- bluePrintRuntimeService: BluePrintRuntimeService<*>,
- resourceAssignments: List<ResourceAssignment>)
-}
-
-/**
- * ResourceAssignmentEnhancerDefaultService.
- *
- * @author Brinda Santh
- */
-@Service
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ResourceAssignmentEnhancerServiceImpl(private val resourceDefinitionRepoService: ResourceDefinitionRepoService)
- : ResourceAssignmentEnhancerService {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentEnhancerServiceImpl::class.java)
-
- /**
- * Get the defined source instance from the ResourceAssignment,
- * then get the NodeType of the Sources assigned
- */
- override fun enhanceBluePrint(bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- bluePrintRuntimeService: BluePrintRuntimeService<*>,
- resourceAssignments: List<ResourceAssignment>) {
-
- val uniqueSourceNodeTypeNames = hashSetOf<String>()
-
- // Iterate the Resource Assignment and
- resourceAssignments.map { resourceAssignment ->
- val dictionaryName = resourceAssignment.dictionaryName!!
- val dictionarySource = resourceAssignment.dictionarySource!!
- log.debug("Enriching assignment name(${resourceAssignment.name}), dictionary name($dictionaryName), source($dictionarySource)")
- val sourceNodeTypeName = ResourceSourceMappingFactory.getRegisterSourceMapping(dictionarySource)
-
- // Add Unique Node Types
- uniqueSourceNodeTypeNames.add(sourceNodeTypeName)
-
- // TODO("Candidate for Optimisation")
- if (checkResourceDefinitionNeeded(resourceAssignment)) {
-
- bluePrintTypeEnhancerService.enhancePropertyDefinition(bluePrintRuntimeService, resourceAssignment.name,
- resourceAssignment.property!!);
-
- // Get the Resource Definition from Repo
- val resourceDefinition: ResourceDefinition = getResourceDefinition(dictionaryName)
-
- val sourceNodeTemplate = resourceDefinition.sources.get(dictionarySource)
- ?: throw BluePrintException("failed to get assigned dictionarySource($dictionarySource) from resourceDefinition($dictionaryName)")
-
- // Enrich as NodeTemplate
- bluePrintTypeEnhancerService.enhanceNodeTemplate(bluePrintRuntimeService, dictionarySource, sourceNodeTemplate)
- }
- }
- // Enrich the ResourceSource NodeTypes
- uniqueSourceNodeTypeNames.map { nodeTypeName ->
- val nodeType = resourceDefinitionRepoService.getNodeType(nodeTypeName)
- bluePrintTypeEnhancerService.enhanceNodeType(bluePrintRuntimeService, nodeTypeName, nodeType)
- }
-
- }
-
- private fun checkResourceDefinitionNeeded(resourceAssignment: ResourceAssignment): Boolean {
- return !((resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_INPUT)
- || resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_DEFAULT))
- && BluePrintTypes.validPrimitiveOrCollectionPrimitive(resourceAssignment.property!!))
- }
-
- private fun getResourceDefinition(name: String): ResourceDefinition {
- return resourceDefinitionRepoService.getResourceDefinition(name)
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt
deleted file mode 100644
index 816b3566..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
-import kotlinx.coroutines.Deferred
-import kotlinx.coroutines.async
-import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils
-import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDefinitionRepoService
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils
-import org.springframework.stereotype.Service
-
-interface ResourceDefinitionEnhancerService {
-
- @Throws(BluePrintException::class)
- fun enhance(bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- bluePrintRuntimeService: BluePrintRuntimeService<*>): List<ResourceDefinition>
-}
-
-@Service
-class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoService: ResourceDefinitionRepoService) :
- ResourceDefinitionEnhancerService {
-
- private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceDefinitionEnhancerService::class.toString())
-
- companion object {
- const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
- }
-
- // Enhance the Resource Definition
- // 1. Get the Resource Mapping files from all NodeTemplates.
- // 2. Get all the Unique Resource assignments from all mapping files
- // 3. Collect the Resource Definition for Resource Assignment names from database.
- // 4. Create the Resource Definition under blueprint base path.
- override fun enhance(bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- bluePrintRuntimeService: BluePrintRuntimeService<*>): List<ResourceDefinition> {
-
- var resourceDefinitions: List<ResourceDefinition> = mutableListOf()
-
- val blueprintContext = bluePrintRuntimeService.bluePrintContext()
-
- val mappingFiles = getAllResourceMappingFiles(blueprintContext)
- log.info("resources assignment files ($mappingFiles)")
- if (mappingFiles != null) {
- resourceDefinitions = getResourceDefinition(blueprintContext, mappingFiles)
- // Enriching Resource Definition Sources
- enrichResourceDefinitionSources(bluePrintRuntimeService.bluePrintContext(), resourceDefinitions)
- }
- return resourceDefinitions
- }
-
- // Get all the Mapping files from all node templates.
- private fun getAllResourceMappingFiles(blueprintContext: BluePrintContext): List<String>? {
-
- return blueprintContext.nodeTemplates()?.mapNotNull { nodeTemplateMap ->
-
- // Return only Mapping Artifact File Names
- nodeTemplateMap.value.artifacts?.filter { artifactDefinitionMap ->
- artifactDefinitionMap.value.type == ARTIFACT_TYPE_MAPPING_SOURCE
- }?.mapNotNull { artifactDefinitionMap ->
- artifactDefinitionMap.value.file
- }
-
- }?.flatten()?.distinct()
- }
-
- // Convert file content to ResourceAssignments asynchronously
- private fun getResourceDefinition(blueprintContext: BluePrintContext, files: List<String>) = runBlocking {
- val blueprintBasePath = blueprintContext.rootPath
- val deferredResourceAssignments = mutableListOf<Deferred<List<ResourceAssignment>>>()
- for (file in files) {
- log.info("processing file ($file)")
- deferredResourceAssignments += async {
- ResourceDictionaryUtils.getResourceAssignmentFromFile("$blueprintBasePath/$file")
- }
- }
-
- val resourceAssignments = mutableListOf<ResourceAssignment>()
- for (deferredResourceAssignment in deferredResourceAssignments) {
- resourceAssignments.addAll(deferredResourceAssignment.await())
- }
-
- val distinctResourceAssignments = resourceAssignments.distinctBy { it.name }
- generateResourceDictionary(blueprintBasePath, distinctResourceAssignments)
- //log.info("distinct Resource assignment ($distinctResourceAssignments)")
- }
-
-
- // Read the Resource Definitions from the Database and write to type file.
- private fun generateResourceDictionary(blueprintBasePath: String, resourceAssignments: List<ResourceAssignment>)
- : List<ResourceDefinition> {
- val resourceKeys = resourceAssignments.mapNotNull { it.dictionaryName }.distinct().sorted()
- log.info("distinct resource keys ($resourceKeys)")
-
- //TODO("Optimise DB single Query to multiple Query")
- return resourceKeys.map { resourceKey ->
- getResourceDefinition(resourceKey)
- }
- }
-
- private fun enrichResourceDefinitionSources(bluePrintContext: BluePrintContext,
- resourceDefinitions: List<ResourceDefinition>) {
- val sources = resourceDefinitions
- .map { it.sources }
- .map {
- it.values
- .map { nodeTemplate ->
- nodeTemplate.type
- }
- }
- .flatten().distinct()
- log.info("Enriching Resource Definition sources Node Template: $sources")
- sources.forEach {
- BluePrintEnhancerUtils.populateNodeType(bluePrintContext, resourceDefinitionRepoService, it)
- }
- }
-
- // Get the Resource Definition from Database
- private fun getResourceDefinition(name: String): ResourceDefinition {
- return resourceDefinitionRepoService.getResourceDefinition(name)
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt
deleted file mode 100644
index 11087bc5..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.handler
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ErrorCode
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.normalizedPathName
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelContentRepository
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelRepository
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelSearchRepository
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils
-import org.springframework.core.io.ByteArrayResource
-import org.springframework.core.io.Resource
-import org.springframework.http.HttpHeaders
-import org.springframework.http.MediaType
-import org.springframework.http.ResponseEntity
-import org.springframework.http.codec.multipart.FilePart
-import org.springframework.stereotype.Service
-import org.springframework.transaction.annotation.Transactional
-import reactor.core.publisher.Mono
-import java.io.File
-import java.io.IOException
-import java.util.*
-
-/**
- * BlueprintModelHandler Purpose: Handler service to handle the request from BlurPrintModelRest
- *
- * @author Brinda Santh
- * @version 1.0
- */
-
-@Service
-open class BluePrintModelHandler(private val bluePrintCatalogService: BluePrintCatalogService,
- private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val blueprintModelSearchRepository: ControllerBlueprintModelSearchRepository,
- private val blueprintModelRepository: ControllerBlueprintModelRepository,
- private val blueprintModelContentRepository: ControllerBlueprintModelContentRepository,
- private val bluePrintEnhancerService: BluePrintEnhancerService) {
-
- /**
- * This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
- *
- * @return List<BlueprintModelSearch> list of the controller blueprint archives
- </BlueprintModelSearch> */
- open fun allBlueprintModel(): List<BlueprintModelSearch> {
- return blueprintModelSearchRepository.findAll()
- }
-
- /**
- * This is a saveBlueprintModel method
- *
- * @param filePart filePart
- * @return Mono<BlueprintModelSearch>
- * @throws BluePrintException BluePrintException
- </BlueprintModelSearch> */
- @Throws(BluePrintException::class)
- open fun saveBlueprintModel(filePart: FilePart): Mono<BlueprintModelSearch> {
- try {
- val cbaLocation = BluePrintFileUtils.getCbaStorageDirectory(bluePrintLoadConfiguration.blueprintArchivePath)
- return BluePrintEnhancerUtils.saveCBAFile(filePart, cbaLocation).map { fileName ->
- var blueprintId: String? = null
- try {
- blueprintId = bluePrintCatalogService.saveToDatabase(cbaLocation.resolve(fileName).toFile(), false)
- } catch (e: BluePrintException) {
- // FIXME handle expection
- }
- blueprintModelSearchRepository.findById(blueprintId!!).get()
- }
- } catch (e: IOException) {
- throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- String.format("I/O Error while uploading the CBA file: %s", e.message), e)
- }
-
- }
-
-
- /**
- * This is a searchBlueprintModels method
- *
- * @param tags tags
- * @return List<BlueprintModelSearch>
- </BlueprintModelSearch> */
- open fun searchBlueprintModels(tags: String): List<BlueprintModelSearch> {
- return blueprintModelSearchRepository.findByTagsContainingIgnoreCase(tags)
- }
-
- /**
- * This is a getBlueprintModelSearchByNameAndVersion method
- *
- * @param name name
- * @param version version
- * @return BlueprintModelSearch
- * @throws BluePrintException BluePrintException
- */
- @Throws(BluePrintException::class)
- open fun getBlueprintModelSearchByNameAndVersion(name: String, version: String): BlueprintModelSearch {
- val blueprintModelSearch: BlueprintModelSearch
- val dbBlueprintModel = blueprintModelSearchRepository
- .findByArtifactNameAndArtifactVersion(name, version)
- if (dbBlueprintModel.isPresent) {
- blueprintModelSearch = dbBlueprintModel.get()
- } else {
- throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version))
- }
- return blueprintModelSearch
- }
-
- /**
- * This is a downloadBlueprintModelFileByNameAndVersion method to download a Blueprint by Name and Version
- *
- * @param name name
- * @param version version
- * @return ResponseEntity<Resource>
- * @throws BluePrintException BluePrintException
- </Resource> */
- @Throws(BluePrintException::class)
- open fun downloadBlueprintModelFileByNameAndVersion(name: String,
- version: String): ResponseEntity<Resource> {
- val blueprintModel: BlueprintModel
- try {
- blueprintModel = getBlueprintModelByNameAndVersion(name, version)
- } catch (e: BluePrintException) {
- throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, String.format("Error while " + "downloading the CBA file: %s", e.message), e)
- }
-
- val fileName = blueprintModel.id + ".zip"
- val file = blueprintModel.blueprintModelContent.content
- return prepareResourceEntity(fileName, file)
- }
-
- /**
- * This is a downloadBlueprintModelFile method to find the target file to download and return a file resource
- *
- * @return ResponseEntity<Resource>
- * @throws BluePrintException BluePrintException
- </Resource> */
- @Throws(BluePrintException::class)
- open fun downloadBlueprintModelFile(id: String): ResponseEntity<Resource> {
- val blueprintModel: BlueprintModel
- try {
- blueprintModel = getBlueprintModel(id)
- } catch (e: BluePrintException) {
- throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, String.format("Error while " + "downloading the CBA file: %s", e.message), e)
- }
-
- val fileName = blueprintModel.id + ".zip"
- val file = blueprintModel.blueprintModelContent.content
- return prepareResourceEntity(fileName, file)
- }
-
- /**
- * @return ResponseEntity<Resource>
- </Resource> */
- private fun prepareResourceEntity(fileName: String, file: ByteArray): ResponseEntity<Resource> {
- return ResponseEntity.ok()
- .contentType(MediaType.parseMediaType("text/plain"))
- .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"$fileName\"")
- .body(ByteArrayResource(file))
- }
-
- /**
- * This is a getBlueprintModel method
- *
- * @param id id
- * @return BlueprintModel
- * @throws BluePrintException BluePrintException
- */
- @Throws(BluePrintException::class)
- open fun getBlueprintModel(id: String): BlueprintModel {
- val blueprintModel: BlueprintModel
- val dbBlueprintModel = blueprintModelRepository.findById(id)
- if (dbBlueprintModel.isPresent) {
- blueprintModel = dbBlueprintModel.get()
- } else {
- val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
- throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
- }
- return blueprintModel
- }
-
- /**
- * This is a getBlueprintModelByNameAndVersion method
- *
- * @param name name
- * @param version version
- * @return BlueprintModel
- * @throws BluePrintException BluePrintException
- */
- @Throws(BluePrintException::class)
- open fun getBlueprintModelByNameAndVersion(name: String, version: String): BlueprintModel {
- val blueprintModel = blueprintModelRepository
- .findByArtifactNameAndArtifactVersion(name, version)
- if (blueprintModel != null) {
- return blueprintModel
- } else {
- val msg = String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version)
- throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
- }
- }
-
- /**
- * This is a getBlueprintModelSearch method
- *
- * @param id id
- * @return BlueprintModelSearch
- * @throws BluePrintException BluePrintException
- */
- @Throws(BluePrintException::class)
- open fun getBlueprintModelSearch(id: String): BlueprintModelSearch {
- val blueprintModelSearch: BlueprintModelSearch
- val dbBlueprintModel = blueprintModelSearchRepository.findById(id)
- if (dbBlueprintModel.isPresent) {
- blueprintModelSearch = dbBlueprintModel.get()
- } else {
- val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
- throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
- }
-
- return blueprintModelSearch
- }
-
- /**
- * This is a deleteBlueprintModel method
- *
- * @param id id
- * @throws BluePrintException BluePrintException
- */
- @Transactional
- @Throws(BluePrintException::class)
- open fun deleteBlueprintModel(id: String) {
- val dbBlueprintModel = blueprintModelRepository.findById(id)
- if (dbBlueprintModel.isPresent) {
- blueprintModelContentRepository.deleteByBlueprintModel(dbBlueprintModel.get())
- blueprintModelRepository.delete(dbBlueprintModel.get())
- } else {
- val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
- throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
- }
- }
-
- /**
- * This is a CBA enrichBlueprint method
- * Save the Zip File in archive location and extract the cba content.
- * Populate the Enhancement Location
- * Enhance the CBA content
- * Compress the Enhanced Content
- * Return back the the compressed content back to the caller.
- *
- * @param filePart filePart
- * @return ResponseEntity<Resource>
- * @throws BluePrintException BluePrintException
- */
- @Throws(BluePrintException::class)
- open suspend fun enrichBlueprint(filePart: FilePart): ResponseEntity<Resource> {
- val enhanceId = UUID.randomUUID().toString()
- val blueprintArchive = normalizedPathName(bluePrintLoadConfiguration.blueprintArchivePath, enhanceId)
- val blueprintEnrichmentDir = normalizedPathName(bluePrintLoadConfiguration.blueprintEnrichmentPath, enhanceId)
- try {
- BluePrintEnhancerUtils.decompressFilePart(filePart, blueprintArchive, blueprintEnrichmentDir)
-
- // Enhance the Blue Prints
- bluePrintEnhancerService.enhance(blueprintEnrichmentDir)
-
- return BluePrintEnhancerUtils.compressToFilePart(blueprintEnrichmentDir, blueprintArchive)
-
- } catch (e: IOException) {
- throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- "Error in Enriching CBA: ${e.message}", e)
- } finally {
- BluePrintEnhancerUtils.cleanEnhancer(blueprintArchive, blueprintEnrichmentDir)
- }
- }
-
- /**
- * This is a publishBlueprintModel method to change the status published to YES
- *
- * @param filePart filePart
- * @return BlueprintModelSearch
- * @throws BluePrintException BluePrintException
- */
- @Throws(BluePrintException::class)
- open suspend fun publishBlueprint(filePart: FilePart): BlueprintModelSearch {
- val publishId = UUID.randomUUID().toString()
- val blueprintArchive = bluePrintLoadConfiguration.blueprintArchivePath.plus(File.separator).plus(publishId)
- val blueprintEnrichmentDir = bluePrintLoadConfiguration.blueprintEnrichmentPath.plus(File.separator).plus(publishId)
- try {
- val compressedFilePart = BluePrintEnhancerUtils
- .extractCompressFilePart(filePart, blueprintArchive, blueprintEnrichmentDir)
-
- val blueprintId = bluePrintCatalogService.saveToDatabase(compressedFilePart, true)
-
- return blueprintModelSearchRepository.findById(blueprintId).get()
-
- } catch (e: Exception) {
- throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- "Error in Publishing CBA: ${e.message}", e)
- } finally {
- BluePrintEnhancerUtils.cleanEnhancer(blueprintArchive, blueprintEnrichmentDir)
- }
- }
-
- companion object {
-
- private const val BLUEPRINT_MODEL_ID_FAILURE_MSG = "failed to get blueprint model id(%s) from repo"
- private const val BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG = "failed to get blueprint model by name(%s)" + " and version(%s) from repo"
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ModelTypeHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ModelTypeHandler.kt
deleted file mode 100644
index 8099d07f..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ModelTypeHandler.kt
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.handler
-
-import com.att.eelf.configuration.EELFManager
-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
-
-@Service
-open class ModelTypeHandler(private val modelTypeRepository: ModelTypeRepository) {
-
- private val log = EELFManager.getInstance().getLogger(ModelTypeHandler::class.java)!!
-
- /**
- * This is a getModelTypeByName service
- *
- * @param modelTypeName modelTypeName
- * @return ModelType
- */
- fun getModelTypeByName(modelTypeName: String): ModelType? {
- log.info("Searching : $modelTypeName")
- check(modelTypeName.isNotBlank()) { "Model Name Information is missing." }
- return modelTypeRepository.findByModelName(modelTypeName)
- }
-
-
- /**
- * This is a searchModelTypes service
- *
- * @param tags tags
- * @return List<ModelType>
- </ModelType> */
- fun searchModelTypes(tags: String): List<ModelType> {
- check(tags.isNotBlank()) { "No Search Information provide" }
- return modelTypeRepository.findByTagsContainingIgnoreCase(tags)
- }
-
- /**
- * This is a saveModel service
- *
- * @param modelType modelType
- * @return ModelType
- * @throws BluePrintException BluePrintException
- */
- @Throws(BluePrintException::class)
- open fun saveModel(modelType: ModelType): ModelType {
- lateinit var dbModel: ModelType
- ModelTypeValidator.validateModelType(modelType)
- val dbModelType: ModelType? = modelTypeRepository.findByModelName(modelType.modelName)
- if (dbModelType != null) {
- dbModel = dbModelType
- dbModel.description = modelType.description
- dbModel.definition = modelType.definition
- dbModel.definitionType = modelType.definitionType
- dbModel.derivedFrom = modelType.derivedFrom
- dbModel.tags = modelType.tags
- dbModel.version = modelType.version
- dbModel.updatedBy = modelType.updatedBy
- dbModel = modelTypeRepository.save(dbModel)
- } else {
- dbModel = modelTypeRepository.save(modelType)
- }
- return dbModel
- }
-
-
- /**
- * This is a deleteByModelName service
- *
- * @param modelName modelName
- */
- open fun deleteByModelName(modelName: String) {
- check(modelName.isNotBlank()) { "Model Name Information is missing." }
- modelTypeRepository.deleteByModelName(modelName)
-
- }
-
- /**
- * This is a getModelTypeByDefinitionType service
- *
- * @param definitionType definitionType
- * @return List<ModelType>
- */
- fun getModelTypeByDefinitionType(definitionType: String): List<ModelType> {
- check(definitionType.isNotBlank()) { "Model definitionType Information is missing." }
- return modelTypeRepository.findByDefinitionType(definitionType)
- }
-
- /**
- * This is a getModelTypeByDerivedFrom service
- *
- * @param derivedFrom derivedFrom
- * @return List<ModelType>
- */
- fun getModelTypeByDerivedFrom(derivedFrom: String): List<ModelType> {
- check(derivedFrom.isNotBlank()) { "Model derivedFrom Information is missing." }
- return modelTypeRepository.findByDerivedFrom(derivedFrom)
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ResourceDictionaryHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ResourceDictionaryHandler.kt
deleted file mode 100644
index ec7d8aeb..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ResourceDictionaryHandler.kt
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.handler
-
-import com.google.common.base.Preconditions
-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.checkNotEmptyOrThrow
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository
-import org.springframework.stereotype.Service
-
-@Service
-class ResourceDictionaryHandler(private val resourceDictionaryRepository: ResourceDictionaryRepository) {
-
-
- /**
- * This is a getDataDictionaryByName service
- *
- * @param name name
- * @return DataDictionary
- * @throws BluePrintException BluePrintException
- */
- @Throws(BluePrintException::class)
- fun getResourceDictionaryByName(name: String): ResourceDictionary {
- Preconditions.checkArgument(StringUtils.isNotBlank(name), "Resource dictionary Name Information is missing.")
- val resourceDictionaryDb = resourceDictionaryRepository.findByName(name)
- return if (resourceDictionaryDb.isPresent) {
- resourceDictionaryDb.get()
- } else {
- throw BluePrintException(String.format("couldn't get resource dictionary for name (%s)", name))
- }
- }
-
- /**
- * This is a searchResourceDictionaryByNames service
- *
- * @param names names
- * @return List<ResourceDictionary>
- </ResourceDictionary> */
- fun searchResourceDictionaryByNames(names: List<String>): List<ResourceDictionary> {
- Preconditions.checkArgument(CollectionUtils.isNotEmpty(names), "No Search Information provide")
- return resourceDictionaryRepository.findByNameIn(names)
- }
-
- /**
- * This is a searchResourceDictionaryByTags service
- *
- * @param tags tags
- * @return List<ResourceDictionary>
- </ResourceDictionary> */
- fun searchResourceDictionaryByTags(tags: String): List<ResourceDictionary> {
- Preconditions.checkArgument(StringUtils.isNotBlank(tags), "No search tag information provide")
- return resourceDictionaryRepository.findByTagsContainingIgnoreCase(tags)
- }
-
- /**
- * This is a saveDataDictionary service
- *
- * @param resourceDictionary resourceDictionary
- * @return DataDictionary
- */
- @Throws(BluePrintException::class)
- fun saveResourceDictionary(resourceDictionary: ResourceDictionary): ResourceDictionary {
- var resourceDictionary = resourceDictionary
-
- val resourceDefinition = resourceDictionary.definition
- Preconditions.checkNotNull(resourceDefinition, "failed to get resource definition from content")
- // Validate the Resource Definitions
- //TODO( Save Validator)
- //validate(resourceDefinition)
-
- resourceDictionary.tags = resourceDefinition.tags
- resourceDefinition.updatedBy = resourceDictionary.updatedBy
- // Set the Property Definitions
- val propertyDefinition = resourceDefinition.property
- resourceDictionary.description = propertyDefinition.description
- resourceDictionary.dataType = propertyDefinition.type
- if (propertyDefinition.entrySchema != null) {
- resourceDictionary.entrySchema = propertyDefinition.entrySchema!!.type
- }
-
- validateResourceDictionary(resourceDictionary)
-
- val dbResourceDictionaryData = resourceDictionaryRepository.findByName(resourceDictionary.name)
- if (dbResourceDictionaryData.isPresent) {
- val dbResourceDictionary = dbResourceDictionaryData.get()
-
- dbResourceDictionary.name = resourceDictionary.name
- dbResourceDictionary.definition = resourceDictionary.definition
- dbResourceDictionary.description = resourceDictionary.description
- dbResourceDictionary.tags = resourceDictionary.tags
- dbResourceDictionary.updatedBy = resourceDictionary.updatedBy
- dbResourceDictionary.dataType = resourceDictionary.dataType
- dbResourceDictionary.entrySchema = resourceDictionary.entrySchema
- resourceDictionary = resourceDictionaryRepository.save(dbResourceDictionary)
- } else {
- resourceDictionary = resourceDictionaryRepository.save(resourceDictionary)
- }
-
- return resourceDictionary
- }
-
- /**
- * This is a deleteResourceDictionary service
- *
- * @param name name
- */
- fun deleteResourceDictionary(name: String) {
- check(name.isNotBlank()) { "Resource dictionary name is missing." }
- resourceDictionaryRepository.deleteByName(name)
- }
-
- /**
- * This is a getResourceSourceMapping service
- */
- fun getResourceSourceMapping(): ResourceSourceMapping {
- return ResourceSourceMappingFactory.getRegisterSourceMapping()
- }
-
- private fun validateResourceDictionary(resourceDictionary: ResourceDictionary): Boolean {
- checkNotEmptyOrThrow(resourceDictionary.name, "DataDictionary Definition name is missing.")
- checkNotNull(resourceDictionary.definition) { "DataDictionary Definition Information is missing." }
- checkNotEmptyOrThrow(resourceDictionary.description, "DataDictionary Definition Information is missing.")
- checkNotEmptyOrThrow(resourceDictionary.tags, "DataDictionary Definition tags is missing.")
- checkNotEmptyOrThrow(resourceDictionary.updatedBy, "DataDictionary Definition updatedBy is missing.")
- return true
-
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintCatalogLoadService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintCatalogLoadService.kt
deleted file mode 100644
index 948601cf..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintCatalogLoadService.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.load
-
-import com.att.eelf.configuration.EELFManager
-import kotlinx.coroutines.Deferred
-import kotlinx.coroutines.async
-import kotlinx.coroutines.runBlocking
-import org.apache.commons.lang3.text.StrBuilder
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.springframework.stereotype.Service
-import java.io.File
-
-@Service
-open class BluePrintCatalogLoadService(private val bluePrintCatalogService: BluePrintCatalogService) {
-
- private val log = EELFManager.getInstance().getLogger(BluePrintCatalogLoadService::class.java)
-
- open fun loadPathsBluePrintModelCatalog(paths: List<String>) {
- paths.forEach { loadPathBluePrintModelCatalog(it) }
- }
-
- open fun loadPathBluePrintModelCatalog(path: String) {
-
- val files = File(path).listFiles()
- runBlocking {
- val errorBuilder = StrBuilder()
- val deferredResults = mutableListOf<Deferred<Unit>>()
-
- for (file in files) {
- deferredResults += async {
- loadBluePrintModelCatalog(errorBuilder, file)
- }
- }
-
- for (deferredResult in deferredResults) {
- deferredResult.await()
- }
-
- if (!errorBuilder.isEmpty) {
- log.error(errorBuilder.toString())
- }
- }
- }
-
- open fun loadBluePrintModelCatalog(errorBuilder: StrBuilder, file: File) {
- try {
- bluePrintCatalogService.saveToDatabase(file)
- } catch (e: Exception) {
- errorBuilder.appendln("Couldn't load BlueprintModel(${file.name}: ${e.message}")
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt
deleted file mode 100644
index 8144a1e7..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.load
-
-import com.att.eelf.configuration.EELFManager
-import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.springframework.boot.context.event.ApplicationReadyEvent
-import org.springframework.context.event.EventListener
-import org.springframework.stereotype.Service
-
-@Service
-open class BluePrintDatabaseLoadService(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val modelTypeLoadService: ModelTypeLoadService,
- private val resourceDictionaryLoadService: ResourceDictionaryLoadService,
- private val bluePrintCatalogLoadService: BluePrintCatalogLoadService) {
-
- private val log = EELFManager.getInstance().getLogger(BluePrintDatabaseLoadService::class.java)
-
-
- @EventListener(ApplicationReadyEvent::class)
- open fun init() {
- if (bluePrintLoadConfiguration.loadInitialData) {
- initModelTypes()
- initResourceDictionary()
- initBluePrintCatalog()
- } else {
- log.info("Initial data load is disabled")
- }
- }
-
- open fun initModelTypes() {
- log.info("model types load configuration(${bluePrintLoadConfiguration.loadModelType}) " +
- "under paths(${bluePrintLoadConfiguration.loadModeTypePaths})")
-
- if (bluePrintLoadConfiguration.loadModelType) {
- val paths = bluePrintLoadConfiguration.loadModeTypePaths?.split(",")
- paths?.let {
- runBlocking {
- modelTypeLoadService.loadPathsModelType(paths)
- }
- }
- }
- }
-
- open fun initResourceDictionary() {
- log.info("resource dictionary load configuration(${bluePrintLoadConfiguration.loadResourceDictionary}) " +
- "under paths(${bluePrintLoadConfiguration.loadResourceDictionaryPaths})")
-
- if (bluePrintLoadConfiguration.loadResourceDictionary) {
- val paths = bluePrintLoadConfiguration.loadResourceDictionaryPaths?.split(",")
- paths?.let {
- resourceDictionaryLoadService.loadPathsResourceDictionary(paths)
- }
- }
- }
-
- open fun initBluePrintCatalog() {
- log.info("blueprint load configuration(${bluePrintLoadConfiguration.loadBluePrint}) " +
- "under paths(${bluePrintLoadConfiguration.loadBluePrintPaths})")
-
- if (bluePrintLoadConfiguration.loadBluePrint) {
- val paths = bluePrintLoadConfiguration.loadBluePrintPaths?.split(",")
- paths?.let {
- bluePrintCatalogLoadService.loadPathsBluePrintModelCatalog(paths)
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
deleted file mode 100755
index 17149e46..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.load
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.common.ApplicationConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ErrorCode
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.db.resources.BlueprintCatalogServiceImpl
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelContent
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelRepository
-import org.slf4j.LoggerFactory
-import org.springframework.dao.DataIntegrityViolationException
-import org.springframework.stereotype.Service
-import java.io.File
-import java.nio.file.Files
-import java.nio.file.Path
-import java.nio.file.Paths
-
-/**
- * Similar implementation in [org.onap.ccsdk.apps.blueprintsprocessor.db.BlueprintProcessorCatalogServiceImpl]
- */
-@Service
-class ControllerBlueprintCatalogServiceImpl(bluePrintValidatorService: BluePrintValidatorService,
- private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val blueprintModelRepository: ControllerBlueprintModelRepository)
- : BlueprintCatalogServiceImpl(bluePrintValidatorService) {
-
-
- private val log = LoggerFactory.getLogger(ControllerBlueprintCatalogServiceImpl::class.toString())
-
- init {
- log.info("BlueprintProcessorCatalogServiceImpl initialized")
- }
-
- override fun delete(name: String, version: String) = blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(name, version)
-
- override fun get(name: String, version: String, extract: Boolean): Path? {
- val path = if (extract) {
- Paths.get("${bluePrintLoadConfiguration.blueprintDeployPath}/$name/$version")
- } else {
- Paths.get("${bluePrintLoadConfiguration.blueprintArchivePath}/$name/$version.zip")
- }
- blueprintModelRepository.findByArtifactNameAndArtifactVersion(name, version)?.also {
- it.blueprintModelContent.run {
- path.toFile().writeBytes(this!!.content!!).let {
- return path
- }
- }
- }
- return null
- }
-
- override fun save(metadata: MutableMap<String, String>, archiveFile: File) {
-
- val artifactName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]
- val artifactVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]
-
-
- blueprintModelRepository.findByArtifactNameAndArtifactVersion(artifactName!!, artifactVersion!!)?.let {
- log.info("Overwriting blueprint model :$artifactName::$artifactVersion")
- blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(artifactName, artifactVersion)
- }
-
- val blueprintModel = BlueprintModel()
- blueprintModel.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID]
- blueprintModel.artifactType = ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL
- blueprintModel.published = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_VALID]
- ?: BluePrintConstants.FLAG_N
- blueprintModel.artifactName = artifactName
- blueprintModel.artifactVersion = artifactVersion
- blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]
- blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS]
- blueprintModel.artifactDescription = "Controller Blueprint for $artifactName:$artifactVersion"
-
- val blueprintModelContent = BlueprintModelContent()
- blueprintModelContent.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID]
- blueprintModelContent.contentType = "CBA_ZIP"
- blueprintModelContent.name = "$artifactName:$artifactVersion"
- blueprintModelContent.description = "$artifactName:$artifactVersion CBA Zip Content"
- blueprintModelContent.content = Files.readAllBytes(archiveFile.toPath())
- blueprintModelContent.blueprintModel = blueprintModel
- // Set the Blueprint Model Content into blueprintModel
- blueprintModel.blueprintModelContent = blueprintModelContent
-
- try {
- blueprintModelRepository.saveAndFlush(blueprintModel)
- } catch (ex: DataIntegrityViolationException) {
- throw BluePrintException(ErrorCode.CONFLICT_ADDING_RESOURCE.value, "The blueprint entry " +
- "is already exist in database: ${ex.message}", ex)
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt
deleted file mode 100644
index 061ef88e..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.load
-
-import com.att.eelf.configuration.EELFManager
-import kotlinx.coroutines.*
-import org.apache.commons.io.FilenameUtils
-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.*
-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.handler.ModelTypeHandler
-import org.springframework.stereotype.Service
-import java.io.File
-import java.nio.charset.Charset
-
-@Service
-open class ModelTypeLoadService(private val modelTypeHandler: ModelTypeHandler) {
-
- private val log = EELFManager.getInstance().getLogger(ModelTypeLoadService::class.java)
- private val updateBySystem = "System"
-
- open suspend fun loadPathsModelType(modelTypePaths: List<String>) {
- modelTypePaths.forEach { runBlocking { loadPathModelType(it) } }
- }
-
- /**
- * Load the Model Type file content from the defined path, Load of sequencing should be maintained.
- */
- open suspend fun loadPathModelType(modelTypePath: String) = runBlocking {
- log.info(" *************************** loadModelType **********************")
- try {
- val errorBuilder = StrBuilder()
-
- coroutineScope {
- val dataTypeFiles = File("$modelTypePath/data_type").listFiles()
-
- val deferredResults = mutableListOf<Deferred<Unit>>()
-
- for (file in dataTypeFiles) deferredResults += async {
- loadModelType(file, DataType::class.java, errorBuilder)
- }
-
- deferredResults.awaitAll()
- }
-
- coroutineScope {
- val artifactTypeFiles = File("$modelTypePath/artifact_type").listFiles()
-
- val deferredResults = mutableListOf<Deferred<Unit>>()
-
- for (file in artifactTypeFiles) deferredResults += async {
- loadModelType(file,
- ArtifactType::class.java, errorBuilder)
- }
-
- deferredResults.awaitAll()
- }
-
- coroutineScope {
- val relationshipTypeFiles = File("$modelTypePath/relationship_type").listFiles()
-
- val deferredResults = mutableListOf<Deferred<Unit>>()
-
- for (file in relationshipTypeFiles) deferredResults += async {
- loadModelType(file,
- RelationshipType::class.java, errorBuilder)
- }
-
- deferredResults.awaitAll()
- }
-
- coroutineScope {
- val nodeTypeFiles = File("$modelTypePath/node_type").listFiles()
-
- val deferredResults = mutableListOf<Deferred<Unit>>()
-
- for (file in nodeTypeFiles) deferredResults += async {
- loadModelType(file,
- NodeType::class.java, errorBuilder)
- }
- deferredResults.awaitAll()
- }
-
- if (!errorBuilder.isEmpty) {
- log.error(errorBuilder.toString())
- }
- } catch (e: Exception) {
- log.error("Failed to loade ModelTypes under($modelTypePath)", e)
- }
- }
-
- private inline fun <reified T> loadModelType(file: File, classType: Class<T>, errorBuilder: StrBuilder) {
- try {
- log.trace("Loading ${classType.name} (${file.name})")
- val dataKey = FilenameUtils.getBaseName(file.name)
- val definitionContent = file.readText(Charset.defaultCharset())
- val definition = JacksonUtils.readValue(definitionContent, classType) as EntityType
- //checkNotNull(definition) { "failed to get data type from file : ${file.name}" }
-
- val modelType = ModelType()
- val definitionType: String?
- when (T::class) {
- DataType::class -> {
- definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
- }
- RelationshipType::class -> {
- definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE
- }
- ArtifactType::class -> {
- definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE
- }
- NodeType::class -> {
- definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE
- }
- else -> {
- throw BluePrintException("couldn't process model type($classType) definition")
- }
- }
- modelType.definitionType = definitionType
- modelType.derivedFrom = definition.derivedFrom
- modelType.description = definition.description
- modelType.definition = JacksonUtils.jsonNode(definitionContent)
- modelType.modelName = dataKey
- modelType.version = definition.version
- modelType.updatedBy = updateBySystem
- modelType.tags = (dataKey + "," + definition.derivedFrom + "," + definitionType)
- modelTypeHandler.saveModel(modelType)
- log.trace("${classType.name}(${file.name}) loaded successfully ")
- } catch (e: Exception) {
- errorBuilder.appendln("Couldn't load ${classType.name}(${file.name}: ${e.message}")
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ResourceDictionaryLoadService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ResourceDictionaryLoadService.kt
deleted file mode 100644
index 8100cac3..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ResourceDictionaryLoadService.kt
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.load
-
-import com.att.eelf.configuration.EELFManager
-import kotlinx.coroutines.Deferred
-import kotlinx.coroutines.async
-import kotlinx.coroutines.runBlocking
-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.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary
-import org.onap.ccsdk.apps.controllerblueprints.service.handler.ResourceDictionaryHandler
-import org.springframework.stereotype.Service
-import java.io.File
-import java.nio.charset.Charset
-
-@Service
-open class ResourceDictionaryLoadService(private val resourceDictionaryHandler: ResourceDictionaryHandler) {
-
- private val log = EELFManager.getInstance().getLogger(ResourceDictionaryLoadService::class.java)
-
- open fun loadPathsResourceDictionary(paths: List<String>) {
- paths.forEach { loadPathResourceDictionary(it) }
- }
-
- open fun loadPathResourceDictionary(path: String) {
- log.info(" *************************** loadResourceDictionary **********************")
- val files = File(path).listFiles()
-
- runBlocking {
- val errorBuilder = StrBuilder()
- val deferredResults = mutableListOf<Deferred<Unit>>()
-
- for (file in files) {
- deferredResults += async {
- loadResourceDictionary(errorBuilder, file)
- }
- }
-
- for (deferredResult in deferredResults) {
- deferredResult.await()
- }
-
- if (!errorBuilder.isEmpty) {
- log.error(errorBuilder.toString())
- }
- }
- }
-
- private fun loadResourceDictionary(errorBuilder: StrBuilder, file: File) {
- try {
- log.trace("Loading NodeType(${file.name}")
- val definitionContent = file.readText(Charset.defaultCharset())
- val resourceDefinition = JacksonUtils.readValue(definitionContent, ResourceDefinition::class.java)
- if (resourceDefinition != null) {
-
- checkNotNull(resourceDefinition.property) { "Failed to get Property Definition" }
- val resourceDictionary = ResourceDictionary()
- resourceDictionary.name = resourceDefinition.name
- resourceDictionary.definition = resourceDefinition
-
- checkNotNull(resourceDefinition.property) { "Property field is missing" }
- resourceDictionary.description = resourceDefinition.property.description
- resourceDictionary.dataType = resourceDefinition.property.type
-
- if (resourceDefinition.property.entrySchema != null) {
- resourceDictionary.entrySchema = resourceDefinition.property.entrySchema!!.type
- }
- resourceDictionary.updatedBy = resourceDefinition.updatedBy
-
- if (StringUtils.isBlank(resourceDefinition.tags)) {
- resourceDictionary.tags = (resourceDefinition.name + ", " + resourceDefinition.updatedBy
- + ", " + resourceDefinition.updatedBy)
-
- } else {
- resourceDictionary.tags = resourceDefinition.tags
- }
- resourceDictionaryHandler.saveResourceDictionary(resourceDictionary)
-
- log.trace("Resource dictionary(${file.name}) loaded successfully ")
- } else {
- throw BluePrintException("couldn't get dictionary from content information")
- }
- } catch (e: Exception) {
- errorBuilder.appendln("Couldn't load Resource dictionary (${file.name}: ${e.message}")
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/BluePrintsReactRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/BluePrintsReactRepository.kt
deleted file mode 100644
index 141ba92c..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/BluePrintsReactRepository.kt
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.repository
-
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
-import org.springframework.stereotype.Service
-import reactor.core.publisher.Flux
-import reactor.core.publisher.Mono
-import reactor.core.scheduler.Schedulers
-
-/**
- * ModelTypeReactRepository.
- *
- * @author Brinda Santh
- */
-@Service
-open class ModelTypeReactRepository(private val modelTypeRepository: ModelTypeRepository) {
-
- fun save(modelType: ModelType): Mono<ModelType> {
- return Mono.justOrEmpty(modelTypeRepository.save(modelType))
- }
-
- fun findByModelName(modelName: String): Mono<ModelType> {
- return Mono.justOrEmpty(modelTypeRepository.findByModelName(modelName))
- }
-
- fun findByModelNameIn(modelNames: List<String>): Flux<ModelType> {
- return Flux.fromIterable(modelTypeRepository.findByModelNameIn(modelNames))
- .subscribeOn(Schedulers.elastic())
- }
-
- fun findByDerivedFrom(derivedFrom: String): Flux<ModelType> {
- return Flux.fromIterable(modelTypeRepository.findByDerivedFrom(derivedFrom))
- .subscribeOn(Schedulers.elastic())
- }
-
- fun findByDerivedFromIn(derivedFroms: List<String>): Flux<ModelType> {
- return Flux.fromIterable(modelTypeRepository.findByDerivedFromIn(derivedFroms))
- .subscribeOn(Schedulers.elastic())
- }
-
- fun findByDefinitionType(definitionType: String): Flux<ModelType> {
- return Flux.fromIterable(modelTypeRepository.findByDefinitionType(definitionType))
- .subscribeOn(Schedulers.elastic())
- }
-
- fun findByDefinitionTypeIn(definitionTypes: List<String>): Flux<ModelType> {
- return Flux.fromIterable(modelTypeRepository.findByDefinitionTypeIn(definitionTypes))
- .subscribeOn(Schedulers.elastic())
- }
-
- fun findByTagsContainingIgnoreCase(tags: String): Flux<ModelType> {
- return Flux.fromIterable(modelTypeRepository.findByTagsContainingIgnoreCase(tags))
- .subscribeOn(Schedulers.elastic())
- }
-
- fun deleteByModelName(modelName: String): Mono<Void> {
- modelTypeRepository.deleteByModelName(modelName)
- return Mono.empty()
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt
deleted file mode 100644
index 7cda7276..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * 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.db.resources.repository.ModelContentRepository
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelContent
-
-interface ControllerBlueprintModelContentRepository : ModelContentRepository<BlueprintModel, BlueprintModelContent>
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt
deleted file mode 100644
index ec117507..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * 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.db.resources.repository.ModelRepository
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel
-
-interface ControllerBlueprintModelRepository : ModelRepository<BlueprintModel>
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.kt
deleted file mode 100644
index 990cc651..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.repository
-
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
-import org.springframework.data.jpa.repository.JpaRepository
-import org.springframework.stereotype.Repository
-import javax.transaction.Transactional
-
-@Repository
-interface ModelTypeRepository : JpaRepository<ModelType, String> {
- /**
- * This is a findByModelName method
- *
- * @param modelName Model Name
- * @return Optional<ModelType>
- */
- fun findByModelName(modelName: String): ModelType?
- /**
- * This is a findByModelNameIn method
- *
- * @param modelNames Model Names
- * @return List<ModelType>
- */
- fun findByModelNameIn(modelNames: List<String>): List<ModelType>
- /**
- * This is a findByDerivedFrom method
- *
- * @param derivedFrom Derived From
- * @return List<ModelType>
- */
- fun findByDerivedFrom(derivedFrom: String): List<ModelType>
- /**
- * This is a findByDerivedFromIn method
- *
- * @param derivedFroms Derived Froms
- * @return List<ModelType>
- */
- fun findByDerivedFromIn(derivedFroms: List<String>): List<ModelType>
-
- /**
- * This is a findByDefinitionType method
- *
- * @param definitionType Definition Type
- * @return List<ModelType>
- */
- fun findByDefinitionType(definitionType: String): List<ModelType>
- /**
- * This is a findByDefinitionTypeIn method
- *
- * @param definitionTypes Definition Types
- * @return List<ModelType>
- */
- fun findByDefinitionTypeIn(definitionTypes: List<String>): List<ModelType>
-
- /**
- * This is a findByTagsContainingIgnoreCase method
- *
- * @param tags Tags
- * @return Optional<ModelType>
- */
- fun findByTagsContainingIgnoreCase(tags: String): List<ModelType>
-
- /**
- * This is a deleteByModelName method
- *
- * @param modelName ModelName
- */
- @Transactional
- fun deleteByModelName(modelName: String)
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepository.kt
deleted file mode 100644
index 0865b69d..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepository.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.repository
-
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary
-import org.springframework.stereotype.Service
-import reactor.core.publisher.Flux
-import reactor.core.publisher.Mono
-import reactor.core.scheduler.Schedulers
-
-/**
- * ResourceDictionaryReactRepository.
- *
- * @author Brinda Santh
- */
-@Service
-open class ResourceDictionaryReactRepository(private val resourceDictionaryRepository: ResourceDictionaryRepository) {
-
- fun save(resourceDictionary: ResourceDictionary): Mono<ResourceDictionary> {
- return Mono.justOrEmpty(resourceDictionaryRepository.save(resourceDictionary))
- }
-
- fun findByName(name: String): Mono<ResourceDictionary> {
- return Mono.justOrEmpty(resourceDictionaryRepository.findByName(name))
- }
-
- fun findByNameIn(names: List<String>): Flux<ResourceDictionary> {
- return Flux.fromIterable(resourceDictionaryRepository.findByNameIn(names))
- .subscribeOn(Schedulers.elastic())
- }
-
- fun findByTagsContainingIgnoreCase(tags: String): Flux<ResourceDictionary> {
- return Flux.fromIterable(resourceDictionaryRepository.findByTagsContainingIgnoreCase(tags))
- .subscribeOn(Schedulers.elastic())
- }
-
- fun deleteByName(name: String): Mono<Void> {
- resourceDictionaryRepository.deleteByName(name)
- return Mono.empty()
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt
deleted file mode 100644
index 41a7bf8a..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.utils
-
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.reactive.awaitSingle
-import kotlinx.coroutines.withContext
-import org.onap.ccsdk.apps.controllerblueprints.core.*
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintArchiveUtils
-import org.springframework.core.io.ByteArrayResource
-import org.springframework.core.io.Resource
-import org.springframework.http.HttpHeaders
-import org.springframework.http.MediaType
-import org.springframework.http.ResponseEntity
-import org.springframework.http.codec.multipart.FilePart
-import org.springframework.util.StringUtils
-import reactor.core.publisher.Mono
-import java.io.File
-import java.io.IOException
-import java.nio.file.Path
-import java.nio.file.Paths
-import java.util.*
-
-
-class BluePrintEnhancerUtils {
- companion object {
-
- fun populateDataTypes(bluePrintContext: BluePrintContext, bluePrintRepoService: BluePrintRepoService,
- dataTypeName: String): DataType {
- val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName)
- ?: bluePrintRepoService.getDataType(dataTypeName)
- ?: throw BluePrintException("couldn't get DataType($dataTypeName) from repo.")
- bluePrintContext.serviceTemplate.dataTypes?.put(dataTypeName, dataType)
- return dataType
- }
-
- fun populateRelationshipType(bluePrintContext: BluePrintContext, bluePrintRepoService: BluePrintRepoService,
- relationshipName: String): RelationshipType {
-
- val relationshipType = bluePrintContext.serviceTemplate.relationshipTypes?.get(relationshipName)
- ?: bluePrintRepoService.getRelationshipType(relationshipName)
- ?: throw BluePrintException("couldn't get RelationshipType($relationshipName) from repo.")
- bluePrintContext.serviceTemplate.relationshipTypes?.put(relationshipName, relationshipType)
- return relationshipType
- }
-
-
- fun populateNodeType(bluePrintContext: BluePrintContext, bluePrintRepoService: BluePrintRepoService,
- nodeTypeName: String): NodeType {
-
- val nodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(nodeTypeName)
- ?: bluePrintRepoService.getNodeType(nodeTypeName)
- ?: throw BluePrintException("couldn't get NodeType($nodeTypeName) from repo.")
- bluePrintContext.serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
- return nodeType
- }
-
- fun populateArtifactType(bluePrintContext: BluePrintContext, bluePrintRepoService: BluePrintRepoService,
- artifactTypeName: String): ArtifactType {
-
- val artifactType = bluePrintContext.serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: bluePrintRepoService.getArtifactType(artifactTypeName)
- ?: throw BluePrintException("couldn't get ArtifactType($artifactTypeName) from repo.")
- bluePrintContext.serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)
- return artifactType
- }
-
- private suspend fun copyFromFilePart(filePart: FilePart, targetFile: File): File {
- // Delete the Directory
- targetFile.deleteRecursively()
- return filePart.transferTo(targetFile)
- .thenReturn(targetFile)
- .awaitSingle()
- }
-
- suspend fun extractCompressFilePart(filePart: FilePart, archiveDir: String, enhanceDir: String): File {
- //Recreate the Base Directories
- normalizedFile(archiveDir).reCreateDirs()
- normalizedFile(enhanceDir).reCreateDirs()
- val filePartFile = normalizedFile(archiveDir, "cba.zip")
- // Copy the File Part to ZIP
- return copyFromFilePart(filePart, filePartFile)
- }
-
- suspend fun decompressFilePart(filePart: FilePart, archiveDir: String, enhanceDir: String): File {
- val filePartFile = extractCompressFilePart(filePart, archiveDir, enhanceDir)
- val deCompressFileName = normalizedPathName(enhanceDir)
- return filePartFile.deCompress(deCompressFileName)
- }
-
- suspend fun compressToFilePart(enhanceDir: String, archiveDir: String): ResponseEntity<Resource> {
- val compressedFile = normalizedFile(archiveDir, "enhanced-cba.zip")
- BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile, true)
- return prepareResourceEntity(compressedFile.name, compressedFile.readBytes())
- }
-
- suspend fun prepareResourceEntity(fileName: String, file: ByteArray): ResponseEntity<Resource> {
- return ResponseEntity.ok()
- .contentType(MediaType.parseMediaType("text/plain"))
- .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"$fileName\"")
- .body(ByteArrayResource(file))
- }
-
- suspend fun cleanEnhancer(archiveLocation: String, enhancementLocation: String) = withContext(Dispatchers.Default) {
- deleteDir(archiveLocation)
- deleteDir(enhancementLocation)
- }
-
- /**
- * This is a saveCBAFile method
- * take a [FilePart], transfer it to disk using a Flux of FilePart and return a [Mono] representing the CBA file name
- *
- * @param (filePart, targetDirectory) - the request part containing the file to be saved and the default directory where to save
- * @return a [Mono] String representing the result of the operation
- * @throws (BluePrintException, IOException) BluePrintException, IOException
- */
- @Throws(BluePrintException::class, IOException::class)
- fun saveCBAFile(filePart: FilePart, targetDirectory: Path): Mono<String> {
-
- // Normalize file name
- val fileName = StringUtils.cleanPath(filePart.filename())
-
- // Check if the file's extension is "CBA"
- if (StringUtils.getFilenameExtension(fileName) != "zip") {
- throw BluePrintException(ErrorCode.INVALID_FILE_EXTENSION.value, "Invalid file extension required ZIP")
- }
-
- // Change file name to match a pattern
- val changedFileName = UUID.randomUUID().toString() + ".zip"
- //String changedFileName = BluePrintFileUtils.Companion.getCBAGeneratedFileName(fileName, this.CBA_FILE_NAME_PATTERN);
-
- // Copy file to the target location (Replacing existing file with the same name)
- val targetLocation = targetDirectory.resolve(changedFileName)
-
- // if a file with the same name already exists in a repository, delete and recreate it
- val file = File(targetLocation.toString())
- if (file.exists())
- file.delete()
- file.createNewFile()
-
- return filePart.transferTo(file).thenReturn(changedFileName)
- }
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.kt
deleted file mode 100644
index 1428c81d..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.kt
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.validator
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-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.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
-
-class ModelTypeValidator {
- companion object {
- /**
- * This is a validateModelTypeDefinition
- *
- * @param definitionType definitionType
- * @param definitionContent definitionContent
- * @return boolean
- */
- fun validateModelTypeDefinition(definitionType: String, definitionContent: JsonNode): Boolean {
-
- when (definitionType) {
- BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE -> {
- JacksonUtils.readValue(definitionContent, DataType::class.java)
- ?: throw BluePrintException("Model type definition is not DataType valid content $definitionContent")
- }
- BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE -> {
- JacksonUtils.readValue(definitionContent, NodeType::class.java)
- ?: throw BluePrintException("Model type definition is not NodeType valid content $definitionContent")
- }
- BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE -> {
- JacksonUtils.readValue(definitionContent, ArtifactType::class.java)
- ?: throw BluePrintException("Model type definition is not ArtifactType valid content $definitionContent")
- }
- BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE -> {
- JacksonUtils.readValue(definitionContent, CapabilityDefinition::class.java)
- ?: throw BluePrintException("Model type definition is not CapabilityDefinition valid content $definitionContent")
- }
- BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE -> {
- JacksonUtils.readValue(definitionContent, RelationshipType::class.java)
- ?: throw BluePrintException("Model type definition is not RelationshipType valid content $definitionContent")
- }
- }
- return true
- }
-
- /**
- * This is a validateModelType method
- *
- * @param modelType modelType
- * @return boolean
- */
- fun validateModelType(modelType: ModelType?): Boolean {
- checkNotNull(modelType) { "Model Type Information is missing." }
-
- val validRootTypes = BluePrintTypes.validModelTypes()
-
- check(validRootTypes.contains(modelType.definitionType)) {
- "Not Valid Model Root Type(${modelType.definitionType}), It should be $validRootTypes"
- }
-
- validateModelTypeDefinition(modelType.definitionType, modelType.definition)
- return true
- }
- }
-
-}
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
deleted file mode 100644
index 5b5332fc..00000000
--- a/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json
+++ /dev/null
@@ -1,862 +0,0 @@
-{
- "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"
- },
- "template-name": {
- "required": true,
- "type": "string"
- },
- "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-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "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": {
-
- }
- }
- },
- "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.capabilities.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.capabilities.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.capabilities.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"
- }
- },
- "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"
- }
- },
- "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.capabilities.Content",
- "properties": {
- "content": {
- "required": true,
- "type": "string"
- }
- }
- },
- "mapping": {
- "type": "tosca.capabilities.Mapping",
- "properties": {
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Artifact"
- },
- "component-resource-assignment": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-onap-ccsdk-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
deleted file mode 100644
index e69de29b..00000000
--- a/ms/controllerblueprints/modules/service/src/main/resources/sql/data.sql
+++ /dev/null
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
deleted file mode 100644
index ad5fdd05..00000000
--- a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql
+++ /dev/null
@@ -1,83 +0,0 @@
--- 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 VARCHAR(100) NOT NULL,
- 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 VARCHAR(100) NOT NULL,
- 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,
- data_type VARCHAR(100) NOT NULL,
- entry_schema VARCHAR(100) 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
deleted file mode 100644
index 015b03b3..00000000
--- a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql
+++ /dev/null
@@ -1,78 +0,0 @@
--- -----------------------------------------------------
--- table CONFIG_MODEL
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL (
- config_model_id VARCHAR(100) NOT NULL,
- 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 VARCHAR(100) NOT NULL,
- 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,
- data_type VARCHAR(100) NOT NULL,
- entry_schema VARCHAR(100) 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
deleted file mode 100644
index db35fe66..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-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/TestApplication.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestApplication.java
deleted file mode 100644
index 537429f0..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestApplication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints;
-
-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/service/ModelTypeServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java
deleted file mode 100644
index a94df6ae..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ModelTypeServiceTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-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.core.BluePrintConstants;
-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.handler.ModelTypeHandler;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
-import org.springframework.test.annotation.Commit;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-@RunWith(SpringRunner.class)
-@DataJpaTest
-@Transactional(propagation = Propagation.NOT_SUPPORTED)
-@ContextConfiguration(classes = {TestApplication.class})
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ModelTypeServiceTest {
- private static EELFLogger log = EELFManager.getInstance().getLogger(ModelTypeServiceTest.class);
- @Autowired
- private ModelTypeHandler modelTypeHandler;
-
- String modelName = "test-datatype";
-
- @Test
- @Commit
- public void test01SaveModelType() throws Exception {
- log.info("**************** test01SaveModelType ********************");
-
- String content = JacksonUtils.Companion.getClassPathFileContent("model_type/data_type/datatype-property.json");
- ModelType modelType = new ModelType();
- modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
- modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);
- modelType.setDescription("Definition for Sample Datatype ");
- modelType.setDefinition(JacksonUtils.Companion.jsonNode(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 = modelTypeHandler.saveModel(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 = modelTypeHandler.getModelTypeByName(modelType.getModelName());
- Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType.getModelName() + ")",
- dbModelType);
-
- // Model Update
- modelType.setUpdatedBy("bs2796@xxx.com");
- modelType = modelTypeHandler.saveModel(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 = modelTypeHandler.searchModelTypes(tags);
- Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes);
- Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.size() > 0);
-
- }
-
- @Test
- public void test03GetModelType() throws Exception {
- log.info("************************* test03GetModelType *********************************");
- ModelType dbModelType = modelTypeHandler.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 =
- modelTypeHandler.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
- Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes);
- Assert.assertTrue("Failed to find getModelTypeByDefinitionType by count", dbDatatypeModelTypes.size() > 0);
-
- List<ModelType> dbModelTypeByDerivedFroms =
- modelTypeHandler.getModelTypeByDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);
- Assert.assertNotNull("Failed to find getModelTypeByDerivedFrom by tags", dbModelTypeByDerivedFroms);
- Assert.assertTrue("Failed to find getModelTypeByDerivedFrom by count", dbModelTypeByDerivedFroms.size() > 0);
-
- }
-
- @Test
- public void test04DeleteModelType() throws Exception {
- log.info(
- "************************ test03DeleteModelType ***********************");
- ModelType dbResourceMapping = modelTypeHandler.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());
-
- modelTypeHandler.deleteByModelName(dbResourceMapping.getModelName());
- }
-} \ No newline at end of file
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
deleted file mode 100644
index ed208db9..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.common;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-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 java.io.File;
-import java.nio.charset.Charset;
-
-
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class SchemaGeneratorServiceTest {
-
- private static EELFLogger log = EELFManager.getInstance().getLogger(SchemaGeneratorServiceTest.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/repository/ModelTypeReactRepositoryTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeReactRepositoryTest.java
deleted file mode 100644
index 739ce51b..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeReactRepositoryTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.repository;
-
-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.core.BluePrintConstants;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
-import org.springframework.test.annotation.Commit;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * ModelTypeReactRepositoryTest.
- *
- * @author Brinda Santh
- */
-
-@RunWith(SpringRunner.class)
-@DataJpaTest
-@ContextConfiguration(classes = {TestApplication.class})
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ModelTypeReactRepositoryTest {
-
- @Autowired
- private ModelTypeReactRepository modelTypeReactRepository;
-
- String modelName = "test-datatype";
-
- @Test
- @Commit
- public void test01Save() {
- String content = JacksonUtils.Companion.getClassPathFileContent("model_type/data_type/datatype-property.json");
- ModelType modelType = new ModelType();
- modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
- modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);
- modelType.setDescription("Definition for Sample Datatype ");
- modelType.setDefinition(JacksonUtils.Companion.jsonNode(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 dbModelType = modelTypeReactRepository.save(modelType).block();
- Assert.assertNotNull("Failed to get Saved ModelType", dbModelType);
- }
-
- @Test
- public void test02Finds() {
- ModelType dbFindByModelName = modelTypeReactRepository.findByModelName(modelName).block();
- Assert.assertNotNull("Failed to findByModelName ", dbFindByModelName);
-
- List<ModelType> dbFindByDefinitionType =
- modelTypeReactRepository.findByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE).collectList().block();
- Assert.assertNotNull("Failed to findByDefinitionType ", dbFindByDefinitionType);
- Assert.assertTrue("Failed to findByDefinitionType count", dbFindByDefinitionType.size() > 0);
-
- List<ModelType> dbFindByDerivedFrom =
- modelTypeReactRepository.findByDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT).collectList().block();
- Assert.assertNotNull("Failed to find findByDerivedFrom", dbFindByDerivedFrom);
- Assert.assertTrue("Failed to find findByDerivedFrom by count", dbFindByDerivedFrom.size() > 0);
-
- List<ModelType> dbFindByModelNameIn =
- modelTypeReactRepository.findByModelNameIn(Arrays.asList(modelName)).collectList().block();
- Assert.assertNotNull("Failed to findByModelNameIn ", dbFindByModelNameIn);
- Assert.assertTrue("Failed to findByModelNameIn by count", dbFindByModelNameIn.size() > 0);
-
- List<ModelType> dbFindByDefinitionTypeIn =
- modelTypeReactRepository.findByDefinitionTypeIn(Arrays.asList(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)).collectList().block();
- Assert.assertNotNull("Failed to findByDefinitionTypeIn", dbFindByDefinitionTypeIn);
- Assert.assertTrue("Failed to findByDefinitionTypeIn by count", dbFindByDefinitionTypeIn.size() > 0);
-
- List<ModelType> dbFindByDerivedFromIn =
- modelTypeReactRepository.findByDerivedFromIn(Arrays.asList(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)).collectList().block();
- Assert.assertNotNull("Failed to find findByDerivedFromIn", dbFindByDerivedFromIn);
- Assert.assertTrue("Failed to find findByDerivedFromIn by count", dbFindByDerivedFromIn.size() > 0);
- }
-
- @Test
- @Commit
- public void test03Delete() {
- modelTypeReactRepository.deleteByModelName(modelName).block();
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java
deleted file mode 100644
index 330eaa84..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- * Modifications Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.repository;
-
-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.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
-import org.springframework.test.annotation.Commit;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * ResourceDictionaryReactRepositoryTest.
- *
- * @author Brinda Santh
- */
-
-@RunWith(SpringRunner.class)
-@DataJpaTest
-@ContextConfiguration(classes = {TestApplication.class})
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ResourceDictionaryReactRepositoryTest {
-
- private String sourceName = "test-source";
-
- @Autowired
- protected ResourceDictionaryReactRepository resourceDictionaryReactRepository;
-
- @Test
- @Commit
- public void test01Save() {
- ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile("./../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-primary-db-source.json", ResourceDefinition.class);
- Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition);
- resourceDefinition.setName(sourceName);
-
- ResourceDictionary resourceDictionary = transformResourceDictionary(resourceDefinition);
- ResourceDictionary dbResourceDictionary = resourceDictionaryReactRepository.save(resourceDictionary).block();
- Assert.assertNotNull("Failed to save ResourceDictionary", dbResourceDictionary);
- }
-
- @Test
- public void test02FindByNameReact() {
- ResourceDictionary dbResourceDictionary = resourceDictionaryReactRepository.findByName(sourceName).block();
- Assert.assertNotNull("Failed to query React Resource Dictionary by Name", dbResourceDictionary);
- }
-
- @Test
- public void test03FindByNameInReact() {
- List<ResourceDictionary> dbResourceDictionaries =
- resourceDictionaryReactRepository.findByNameIn(Arrays.asList(sourceName)).collectList().block();
- Assert.assertNotNull("Failed to query React Resource Dictionary by Names", dbResourceDictionaries);
- }
-
- @Test
- public void test04FindByTagsContainingIgnoreCaseReact() {
- List<ResourceDictionary> dbTagsResourceDictionaries =
- resourceDictionaryReactRepository.findByTagsContainingIgnoreCase(sourceName).collectList().block();
- Assert.assertNotNull("Failed to query React Resource Dictionary by Tags", dbTagsResourceDictionaries);
- }
-
- @Test
- @Commit
- public void test05Delete() {
- resourceDictionaryReactRepository.deleteByName(sourceName).block();
- }
-
- private ResourceDictionary transformResourceDictionary(ResourceDefinition resourceDefinition) {
- ResourceDictionary resourceDictionary = new ResourceDictionary();
- resourceDictionary.setName(resourceDefinition.getName());
- resourceDictionary.setDataType(resourceDefinition.getProperty().getType());
- resourceDictionary.setDescription(resourceDefinition.getProperty().getDescription());
- resourceDictionary.setTags(resourceDefinition.getTags());
- resourceDictionary.setUpdatedBy(resourceDefinition.getUpdatedBy());
- resourceDictionary.setDefinition(resourceDefinition);
- return resourceDictionary;
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelControllerTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelControllerTest.kt
deleted file mode 100644
index d504c293..00000000
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelControllerTest.kt
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada Intellectual Property.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.controller
-
-import com.google.gson.Gson
-import org.json.JSONException
-import org.json.JSONObject
-import org.junit.After
-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.core.utils.BluePrintArchiveUtils
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.beans.factory.annotation.Value
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.core.io.ByteArrayResource
-import org.springframework.http.HttpMethod
-import org.springframework.http.HttpStatus
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.junit4.SpringRunner
-import org.springframework.test.web.reactive.server.WebTestClient
-import org.springframework.util.Base64Utils
-import org.springframework.web.reactive.function.BodyInserters
-import java.io.File
-import java.io.IOException
-import java.nio.charset.StandardCharsets.UTF_8
-import java.nio.file.Files
-import java.nio.file.Paths
-
-/**
- * BlueprintModelControllerTest Purpose: Integration test at API level
- *
- * @author Vinal Patel
- * @version 1.0
- */
-
-@RunWith(SpringRunner::class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(classes = [TestApplication::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.controllerblueprints"])
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-@EnableAutoConfiguration
-class BlueprintModelControllerTest {
-
- companion object {
-
- private var id: String? = null
- private var name: String? = null
- private var version: String? = null
- private var tag: String? = null
- private var result: String? = null
- }
-
- @Value("\${controllerblueprints.loadBluePrintPaths}")
- private val loadBluePrintPaths: String? = null
-
- @Autowired
- private val webTestClient: WebTestClient? = null
-
- @Value("\${controllerblueprints.loadBlueprintsExamplesPath}")
- private val blueprintArchivePath: String? = null
-
- private val filename = "test.zip"
- private var blueprintFile: File? = null
- private var zipBlueprintFile: File? = null
-
- @Before
- @Throws(Exception::class)
- fun setUp() {
- blueprintFile = File(loadBluePrintPaths+"/baseconfiguration")
- if (blueprintFile!!.isDirectory) {
- zipBlueprintFile = File(Paths.get(blueprintArchivePath).resolve(filename).toString())
- BluePrintArchiveUtils.compress(blueprintFile!!, zipBlueprintFile!!, true)
- }
- }
-
- @After
- @Throws(Exception::class)
- fun tearDown() {
- zipBlueprintFile!!.delete()
- }
-
- @Test
- @Throws(IOException::class, JSONException::class)
- fun test1_saveBluePrint() {
- webTestClient(HttpMethod.POST,
- BodyInserters.fromMultipartData("file", object : ByteArrayResource(Files.readAllBytes(zipBlueprintFile!!.toPath())) {
- override fun getFilename(): String? {
- return "test.zip"
- }
- }),
- "/api/v1/blueprint-model",
- HttpStatus.OK, true)
- }
-
- @Test
- @Throws(JSONException::class)
- fun test2_getBluePrintByNameAndVersion() {
- webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/by-name/$name/version/$version", HttpStatus.OK, false)
- }
-
-
- @Test
- @Throws(JSONException::class)
- fun test3_getBlueprintModel() {
- webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/$id", HttpStatus.OK, false)
- }
-
- @Test
- @Throws(JSONException::class)
- fun test4_getAllBlueprintModel() {
- webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model", HttpStatus.OK, false)
- }
-
- @Test
- @Throws(JSONException::class)
- fun test5_downloadBluePrint() {
- webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/download/$id", HttpStatus.OK, false)
- }
-
- @Test
- fun test6_publishBlueprintModel() {
- }
-
- @Test
- @Throws(JSONException::class)
- fun test7_searchBlueprintModels() {
- webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/search/$name", HttpStatus.OK, false)
- }
-
- @Test
- @Throws(JSONException::class)
- fun test8_downloadBlueprintByNameAndVersion() {
- webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/download/by-name/$name/version/$version", HttpStatus.OK, false)
- }
-
- @Test
- fun test9_deleteBluePrint() {
- //TODO: Use webTestClient function
- //webTestClient(HttpMethod.DELETE, null, "/api/v1/blueprint-model/" + id, HttpStatus.OK, false);
- webTestClient!!.delete().uri("/api/v1/blueprint-model/$id")
- .header("Authorization", "Basic " + Base64Utils
- .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
- .exchange()
- .expectStatus().is2xxSuccessful
- }
-
- @Throws(JSONException::class)
- private fun webTestClient(requestMethod: HttpMethod, body: BodyInserters.MultipartInserter?, uri: String, expectedResponceStatus: HttpStatus, setParam: Boolean) {
-
- result = String(webTestClient!!.method(requestMethod).uri(uri)
- .header("Authorization", "Basic " + Base64Utils
- .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
- .body(body)
- .exchange()
- .expectStatus().isEqualTo(expectedResponceStatus)
- .expectBody()
- .returnResult().responseBody!!)
-
- if (setParam) {
- val jsonResponse = JSONObject(result)
- val blueprintModelSearchJSON = jsonResponse.getJSONObject("blueprintModel")
- val gson = Gson()
- val blueprintModelSearch = gson.fromJson(blueprintModelSearchJSON.toString(), BlueprintModelSearch::class.java)
- id = blueprintModelSearch.id
- name = blueprintModelSearch.artifactName
- version = blueprintModelSearch.artifactVersion
- tag = blueprintModelSearch.tags
- }
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeControllerTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeControllerTest.kt
deleted file mode 100644
index 6fd0d1f0..00000000
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeControllerTest.kt
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.controller
-
-import com.att.eelf.configuration.EELFManager
-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.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
-import org.springframework.test.annotation.Commit
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.junit4.SpringRunner
-
-@RunWith(SpringRunner::class)
-@DataJpaTest
-@ContextConfiguration(classes = [TestApplication::class])
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-class ModelTypeControllerTest {
-
- private val log = EELFManager.getInstance().getLogger(ModelTypeControllerTest::class.java)!!
-
- @Autowired
- internal var modelTypeController: ModelTypeController? = null
-
- private var modelName = "test-datatype"
-
- @Test
- @Commit
- @Throws(Exception::class)
- fun test01SaveModelType() {
- log.info("**************** test01SaveModelType ********************")
-
- val content = JacksonUtils.getClassPathFileContent("model_type/data_type/datatype-property.json")
- var modelType = ModelType()
- modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
- modelType.derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT
- modelType.description = "Definition for Sample Datatype "
- modelType.definition = JacksonUtils.jsonNode(content)
- modelType.modelName = modelName
- modelType.version = "1.0.0"
- modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
- + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
- modelType.updatedBy = "xxxxxx@xxx.com"
- modelType = modelTypeController!!.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.modelName)
-
- val dbModelType = modelTypeController!!.getModelTypeByName(modelType.modelName)
- Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType!!.modelName + ")",
- dbModelType)
-
- // Model Update
- modelType.updatedBy = "bs2796@xxx.com"
- modelType = modelTypeController!!.saveModelType(modelType)
- Assert.assertNotNull("Failed to get Saved ModelType", modelType)
- Assert.assertEquals("Failed to get Saved getUpdatedBy ", "bs2796@xxx.com", modelType.updatedBy)
-
- }
-
- @Test
- @Throws(Exception::class)
- fun test02SearchModelTypes() {
- log.info("*********************** test02SearchModelTypes ***************************")
-
- val tags = "test-datatype"
-
- val dbModelTypes = modelTypeController!!.searchModelTypes(tags)
- Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes)
- Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.isNotEmpty())
-
- }
-
- @Test
- @Throws(Exception::class)
- fun test03GetModelType() {
- log.info("************************* test03GetModelType *********************************")
- val dbModelType = modelTypeController!!.getModelTypeByName(modelName)
- Assert.assertNotNull("Failed to get response for api call getModelByName $modelName", dbModelType)
- Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbModelType!!.modelName)
-
- val dbDatatypeModelTypes = modelTypeController!!.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
- Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes)
- Assert.assertTrue("Failed to find getModelTypeByDefinitionType by count", dbDatatypeModelTypes.isNotEmpty())
- }
-
- @Test
- @Commit
- @Throws(Exception::class)
- fun test04DeleteModelType() {
- log.info(
- "************************ test03DeleteModelType ***********************")
- val dbResourceMapping = modelTypeController!!.getModelTypeByName(modelName)
- Assert.assertNotNull("Failed to get response for api call getModelByName ", dbResourceMapping)
- Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbResourceMapping!!.modelName)
-
- modelTypeController!!.deleteModelTypeByName(dbResourceMapping.modelName)
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryControllerTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryControllerTest.kt
deleted file mode 100644
index 96c14261..00000000
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ResourceDictionaryControllerTest.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.controller
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.controllerblueprints.TestApplication
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [TestApplication::class])
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.controllerblueprints"])
-class ResourceDictionaryControllerTest {
-
- @Autowired
- lateinit var resourceDictionaryController: ResourceDictionaryController
-
- @Test
- fun testResourceDictionaryControllerPresence() {
- assertNotNull(resourceDictionaryController, "failed to initialise ResourceDictionaryController")
- }
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/mock/MockFilePart.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/mock/MockFilePart.kt
deleted file mode 100644
index 60420aa6..00000000
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/mock/MockFilePart.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.controller.mock
-
-import org.apache.commons.io.FilenameUtils
-import org.slf4j.LoggerFactory
-import org.springframework.core.io.buffer.DataBuffer
-import org.springframework.http.HttpHeaders
-import org.springframework.http.codec.multipart.FilePart
-import org.springframework.util.FileCopyUtils
-import reactor.core.publisher.Flux
-import reactor.core.publisher.Mono
-import java.io.File
-import java.nio.file.Path
-
-class MockFilePart(private val fileName: String) : FilePart {
- val log = LoggerFactory.getLogger(MockFilePart::class.java)!!
- override fun content(): Flux<DataBuffer> {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun headers(): HttpHeaders {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun filename(): String {
- return FilenameUtils.getName(fileName)
- }
-
- override fun name(): String {
- return FilenameUtils.getBaseName(fileName)
- }
-
- override fun transferTo(path: Path): Mono<Void> {
- log.info("Copying file($fileName to ${path}")
- FileCopyUtils.copy(File(fileName), path.toFile())
- return Mono.empty()
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
deleted file mode 100644
index 62a37bef..00000000
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
-
-import kotlinx.coroutines.runBlocking
-import org.junit.Assert
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.controllerblueprints.TestApplication
-import org.onap.ccsdk.apps.controllerblueprints.core.deleteDir
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintEnhancerService
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.normalizedPathName
-import org.onap.ccsdk.apps.controllerblueprints.service.load.ModelTypeLoadService
-import org.onap.ccsdk.apps.controllerblueprints.service.load.ResourceDictionaryLoadService
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = arrayOf(TestApplication::class))
-@TestPropertySource(locations = arrayOf("classpath:application.properties"))
-class BluePrintEnhancerServiceImplTest {
-
- @Autowired
- lateinit var modelTypeLoadService: ModelTypeLoadService
-
- @Autowired
- lateinit var resourceDictionaryLoadService: ResourceDictionaryLoadService
-
- @Autowired
- lateinit var bluePrintEnhancerService: BluePrintEnhancerService
-
- @Autowired
- lateinit var bluePrintValidatorService: BluePrintValidatorService
-
- @Before
- fun init() {
- runBlocking {
- modelTypeLoadService.loadPathModelType("./../../../../components/model-catalog/definition-type/starter-type")
- resourceDictionaryLoadService.loadPathResourceDictionary("./../../../../components/model-catalog/resource-dictionary/starter-dictionary")
- resourceDictionaryLoadService.loadPathResourceDictionary("./../../../../components/model-catalog/resource-dictionary/test-dictionary")
- }
- }
-
- @Test
- @Throws(Exception::class)
- fun testEnhancementAndValidation() {
-
- val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
- testComponentInvokeEnhancementAndValidation(basePath, "base-enhance")
- }
-
- @Test
- @Throws(Exception::class)
- fun testComponentInvokeEnhancementAndValidation() {
- val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/component_invoke"
- testComponentInvokeEnhancementAndValidation(basePath, "component-enhance")
- }
-
- @Test
- @Throws(Exception::class)
- fun testGoldenEnhancementAndValidation() {
- val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/golden"
- testComponentInvokeEnhancementAndValidation(basePath, "golden-enhance")
- }
-
- @Test
- @Throws(Exception::class)
- fun testCapabilityRestconfEnhancementAndValidation() {
- val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/capability_restconf"
- testComponentInvokeEnhancementAndValidation(basePath, "capability_restconf-enhance")
-
- }
-
- private fun testComponentInvokeEnhancementAndValidation(basePath: String, targetDirName: String) {
- runBlocking {
- val targetPath = normalizedPathName("target/blueprints/enrichment", targetDirName)
-
- deleteDir(targetPath)
-
- val bluePrintContext = bluePrintEnhancerService.enhance(basePath, targetPath)
- Assert.assertNotNull("failed to get blueprintContext ", bluePrintContext)
-
- // Validate the Generated BluePrints
- val valid = bluePrintValidatorService.validateBluePrints(targetPath)
- Assert.assertTrue("blueprint($basePath) validation failed ", valid)
-
- deleteDir(targetPath)
- }
- }
-
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt
deleted file mode 100644
index 6bd10525..00000000
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.utils
-
-import kotlinx.coroutines.runBlocking
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.*
-import org.onap.ccsdk.apps.controllerblueprints.service.controller.mock.MockFilePart
-import java.nio.file.Paths
-import java.util.*
-import kotlin.test.assertTrue
-
-class BluePrintEnhancerUtilsTest {
-
- private val blueprintDir = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
- private val blueprintArchivePath: String = "./target/blueprints/archive"
- private val blueprintEnrichmentPath: String = "./target/blueprints/enrichment"
- private var zipBlueprintFileName = normalizedPathName(blueprintArchivePath, "test.zip")
-
- @Before
- fun setUp() {
- val archiveDir = normalizedFile(blueprintArchivePath).reCreateDirs()
- assertTrue(archiveDir.exists(), "failed to create archiveDir(${archiveDir.absolutePath}")
- val enhancerDir = normalizedFile(blueprintEnrichmentPath).reCreateDirs()
- assertTrue(enhancerDir.exists(), "failed to create enhancerDir(${enhancerDir.absolutePath}")
- val blueprintFile = Paths.get(blueprintDir).toFile().normalize()
- val testZipFile = blueprintFile.compress(zipBlueprintFileName)
- assertTrue(testZipFile.exists(), "Failed to create blueprint test zip(${testZipFile.absolutePath}")
- }
-
- @After
- fun tearDown() {
- deleteDir(blueprintArchivePath)
- deleteDir(blueprintEnrichmentPath)
- }
-
- @Test
- fun testFilePartCompressionNDeCompression() {
- val filePart = MockFilePart(zipBlueprintFileName)
-
- runBlocking {
- val enhanceId = UUID.randomUUID().toString()
- val blueprintArchiveLocation = normalizedPathName(blueprintArchivePath, enhanceId)
- val blueprintEnrichmentLocation = normalizedPathName(blueprintEnrichmentPath, enhanceId)
- BluePrintEnhancerUtils.decompressFilePart(filePart, blueprintArchiveLocation, blueprintEnrichmentLocation)
- BluePrintEnhancerUtils.compressToFilePart(blueprintEnrichmentLocation, blueprintArchiveLocation)
- }
- }
-}
-
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.kt
deleted file mode 100644
index db4ee5c9..00000000
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.validator
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
-
-class ModelTypeValidatorTest {
-
- @Test(expected = IllegalStateException::class)
- @Throws(Exception::class)
- fun testvalidateModelType() {
- val modelType = ModelType()
- modelType.definitionType = ""
- modelType.derivedFrom = ""
- modelType.description = ""
- val definitionContent: JsonNode? = null
- modelType.definition = definitionContent
- modelType.modelName = ""
- modelType.version = ""
- modelType.tags = ""
- modelType.updatedBy = ""
- ModelTypeValidator.validateModelType(modelType)
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties
deleted file mode 100755
index 011bad32..00000000
--- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-# Modifications Copyright © 2018 IBM.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-spring.main.banner-mode=off
-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
-# Load Resource Source Mappings
-resourceSourceMappings=processor-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
-# Controller Blueprints Core Configuration
-controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
-controllerblueprints.blueprintArchivePath=./target/blueprints/archive
-controllerblueprints.blueprintEnrichmentPath=./target/blueprints/enrichment
-# Controller Blueprint Load Configurations
-controllerblueprints.loadInitialData=false
-controllerblueprints.loadBluePrint=false
-controllerblueprints.loadBluePrintPaths=./../../../../components/model-catalog/blueprint-model/test-blueprint
-controllerblueprints.loadModelType=false
-controllerblueprints.loadModeTypePaths=./../../../../components/model-catalog/definition-type/starter-type
-controllerblueprints.loadResourceDictionary=false
-controllerblueprints.loadResourceDictionaryPaths=./../../../../components/model-catalog/resource-dictionary/starter-dictionary
-
-# CBA file extension
-controllerblueprints.loadCbaExtension=zip
-
-# CBA examples for tests cases
-controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
deleted file mode 100644
index 3ed188b9..00000000
--- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
+++ /dev/null
@@ -1,62 +0,0 @@
-[
- {
- "name": "rs-db-source",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "sample-db-source",
- "dictionary-source": "primary-db",
- "dependencies": [
- "input-source"
- ]
- },
- {
- "name": "ra-default-source",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "sample-default-source",
- "dictionary-source": "default",
- "dependencies": []
- },
- {
- "name": "ra-input-source",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "sample-input-source",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "ra-list-input-source",
- "input-param": true,
- "property": {
- "type": "list",
- "required": true,
- "entry_schema": {
- "type": "string"
- }
- },
- "dictionary-name": "ra-list-input-source",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "ra-complex-input-source",
- "input-param": true,
- "property": {
- "type": "dt-v4-aggregate",
- "required": true
- },
- "dictionary-name": "sample-mdsal-source",
- "dictionary-source": "primary-config-data",
- "dependencies": []
- }
-]
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
deleted file mode 100644
index 2e48b6d8..00000000
--- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
+++ /dev/null
@@ -1,351 +0,0 @@
-{
- "metadata": {
- "template_author": "Brinda Santh",
- "template_name": "enhance-template",
- "template_version": "1.0.0",
- "template_tags": "brinda, VPE",
- "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": [
- "SELF",
- "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": {
- "NetconfExecutorComponent": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": {
- "get_input": "action-name"
- },
- "template-name": {
- "get_input": "template_name"
- },
- "template-version": {
- "get_input": "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": [
- "SELF",
- "netconf-executor-baseconfig.response-data"
- ]
- },
- "status": {
- "get_attribute": [
- "SELF",
- "netconf-executor-baseconfig.status"
- ]
- }
- },
- "implementation": {
- "primary": "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
- }
- }
- }
- }
- },
- "type": "component-netconf-executor"
- },
- "resource-assignment-ra-component": {
- "capabilities": {
- "component-node": {}
- },
- "interfaces": {
- "ResourceAssignmentComponent": {
- "operations": {
- "process": {
- "inputs": {
- "template-names": [
- "base-config-template",
- "licence-template"
- ],
- "action-name": {
- "get_input": "action-name"
- },
- "template-name": {
- "get_input": "template_name"
- },
- "template-version": {
- "get_input": "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": {}
- },
- "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": {}
- },
- "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": "rs-db-source",
- "property": {
- "required": true,
- "type": "string"
- },
- "input-param": false,
- "dictionary-name": "sample-db-source",
- "dictionary-source": "primary-db",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "mdsal-source",
- "property": {
- "description": "",
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "dt-v4-aggregate"
- }
- },
- "input-param": false,
- "dictionary-name": "sample-mdsal-source",
- "dictionary-source": "primary-config-data",
- "dependencies": [
- "service-instance-id"
- ],
- "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": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "dt-license-key"
- }
- },
- "input-param": false,
- "dictionary-name": "sample-licenses",
- "dictionary-source": "primary-config-data",
- "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
deleted file mode 100644
index 6937c719..00000000
--- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
+++ /dev/null
@@ -1,327 +0,0 @@
-{
- "metadata" : {
- "template_author" : "Brinda Santh",
- "template_name" : "enhance-template",
- "template_version" : "1.0.0",
- "template_tags" : "brinda, VPE",
- "service-type" : "Sample Service",
- "release" : "1806",
- "vnf-type" : "VPE"
- },
- "tosca_definitions_version" : "controller_blueprint_1_0_0",
- "artifact_types" : { },
- "data_types" : {
- },
- "node_types" : {
- },
- "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" : [ "SELF", "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" : {
- "NetconfExecutorComponent" : {
- "operations" : {
- "process" : {
- "implementation" : {
- "primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
- },
- "inputs" : {
- "action-name" : {
- "get_input" : "action-name"
- },
- "template-name" : {
- "get_input" : "template_name"
- },
- "template-version" : {
- "get_input" : "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" : [ "SELF", "netconf-executor-baseconfig.response-data" ]
- },
- "status" : {
- "get_attribute" : [ "SELF", "netconf-executor-baseconfig.status" ]
- }
- }
- }
- }
- }
- }
- },
- "resource-assignment-ra-component" : {
- "type" : "component-resource-assignment",
- "capabilities" : {
- "component-node" : { }
- },
- "interfaces" : {
- "ResourceAssignmentComponent" : {
- "operations" : {
- "process" : {
- "inputs" : {
- "template-names" : [ "base-config-template", "licence-template" ],
- "action-name" : {
- "get_input" : "action-name"
- },
- "template-name" : {
- "get_input" : "template_name"
- },
- "template-version" : {
- "get_input" : "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" : { }
- },
- "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" : { }
- },
- "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" : "rs-db-source",
- "property" : {
- "required" : true,
- "type" : "string"
- },
- "input-param" : false,
- "dictionary-name" : "sample-db-source",
- "dictionary-source" : "primary-db",
- "dependencies" : [ "hostname" ],
- "version" : 0
- }, {
- "name" : "mdsal-source",
- "property" : {
- "description" : "",
- "required" : true,
- "type" : "list",
- "entry_schema" : {
- "type" : "dt-v4-aggregate"
- }
- },
- "input-param" : false,
- "dictionary-name" : "sample-mdsal-source",
- "dictionary-source" : "primary-config-data",
- "dependencies" : [ "service-instance-id" ],
- "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" : {
- "required" : true,
- "type" : "list",
- "entry_schema" : {
- "type" : "dt-license-key"
- }
- },
- "input-param" : false,
- "dictionary-name" : "sample-licenses",
- "dictionary-source" : "primary-config-data",
- "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/logback.xml b/ms/controllerblueprints/modules/service/src/test/resources/logback.xml
deleted file mode 100644
index 2546a838..00000000
--- a/ms/controllerblueprints/modules/service/src/test/resources/logback.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
- ~ Copyright © 2018 IBM.
- ~ Modifications Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
-
- <property name="localPattern" value="[%-8thread] %d{HH:mm:ss.SSS} %-5level %logger{50} - %msg%n" />
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>${localPattern}</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.springframework.web" level="warn"/>
- <logger name="org.hibernate" level="error"/>
- <logger name="org.onap.ccsdk.apps" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/model_type/data_type/datatype-property.json b/ms/controllerblueprints/modules/service/src/test/resources/model_type/data_type/datatype-property.json
deleted file mode 100644
index 5584b10e..00000000
--- a/ms/controllerblueprints/modules/service/src/test/resources/model_type/data_type/datatype-property.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "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/test/resources/resourcedictionary/automap.json b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json
deleted file mode 100644
index c6dd7948..00000000
--- a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json
+++ /dev/null
@@ -1,14 +0,0 @@
-[
- {
- "name": "sample-input-source"
- },
- {
- "name": "sample-default-source"
- },
- {
- "name": "sample-db-source"
- },
- {
- "name": "sample-mdsal-source"
- }
-] \ 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
deleted file mode 100644
index 334fb24e..00000000
--- a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "ipaddress",
- "property": {
- "description": "name of the ",
- "type": "list",
- "entry_schema": {
- "type": "dt-v4-aggregate"
- }
- },
- "updated-by": "Brinda Santh (bs2796)",
- "tags": "ipaddress",
- "sources": {
- "input": {
- "type": "source-input"
- }
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
deleted file mode 100644
index 44a5ec84..00000000
--- a/ms/controllerblueprints/parent/pom.xml
+++ /dev/null
@@ -1,451 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>controllerblueprints</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>parent</artifactId>
- <name>Controller Blueprints Parent</name>
- <packaging>pom</packaging>
- <properties>
- <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
- <spring.boot.version>2.1.3.RELEASE</spring.boot.version>
- <spring.version>5.1.5.RELEASE</spring.version>
- <kotlin.version>1.3.21</kotlin.version>
- <kotlin.maven.version>1.3.21</kotlin.maven.version>
- <kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
- <grpc.version>1.18.0</grpc.version>
- <protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
- <eelf.version>1.0.0</eelf.version>
- <guava.version>27.0.1-jre</guava.version>
- <springfox.swagger2.version>2.9.2</springfox.swagger2.version>
- <h2database.version>1.4.197</h2database.version>
- <onap.logger.slf4j>1.2.2</onap.logger.slf4j>
- <powermock.version>1.7.4</powermock.version>
- <mockk.version>1.9</mockk.version>
- </properties>
- <dependencyManagement>
- <dependencies>
- <!-- Spring boot -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${spring.boot.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>${eelf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- <version>${onap.logger.slf4j}</version>
- </dependency>
-
- <!--Swagger Dependencies -->
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>${springfox.swagger2.version}</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>${springfox.swagger2.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.2.1</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2.2</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.6</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- <version>1.15</version>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>1.7</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- </dependency>
-
- <!-- Kotlin Dependencies -->
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-common</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <!--Use kotlin-compiler-embeddable instead koltin-compiler wrap-->
- <!--guava dependency inside kotlin-compiler creating classpath issues at runtime-->
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-scripting-jvm-host</artifactId>
- <version>${kotlin.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compile</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler-embeddable</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-util</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-runtime</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-core</artifactId>
- <version>${kotlin.couroutines.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-reactor</artifactId>
- <version>${kotlin.couroutines.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-reflect</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk8</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk7</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
-
- <!-- GRPC Dependencies -->
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-core</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-netty</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-protobuf</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-stub</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java-util</artifactId>
- <version>${protobuff.java.utils.version}</version>
- </dependency>
-
- <!-- Database -->
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>${h2database.version}</version>
- </dependency>
-
-
- <!-- Application Components -->
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>db-resources</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-scripts</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>service</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>application</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Testing Dependencies -->
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- <version>${mockk.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <version>${kotlin.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- <version>${kotlin.couroutines.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-testing</artifactId>
- <version>${grpc.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</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.commons</groupId>
- <artifactId>commons-compress</artifactId>
- </dependency>
- <dependency>
- <groupId>com.jayway.jsonpath</groupId>
- <artifactId>json-path</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk8</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-reactor</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-kotlin</artifactId>
- </dependency>
- <!-- GRPC Dependencies -->
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-netty</artifactId>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-protobuf</artifactId>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-stub</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java-util</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>3.0.1</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>kotlin-maven-plugin</artifactId>
- <groupId>org.jetbrains.kotlin</groupId>
- <version>${kotlin.maven.version}</version>
- <executions>
- <execution>
- <id>compile</id>
- <goals>
- <goal>compile</goal>
- </goals>
- <configuration>
- <sourceDirs>
- <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
- <sourceDir>${project.basedir}/src/main/java</sourceDir>
- </sourceDirs>
- </configuration>
- </execution>
- <execution>
- <id>test-compile</id>
- <goals>
- <goal>test-compile</goal>
- </goals>
- <configuration>
- <sourceDirs>
- <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
- <sourceDir>${project.basedir}/src/test/java</sourceDir>
- </sourceDirs>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.5.1</version>
- <configuration>
- <source>${maven.compiler.source}</source>
- <target>${maven.compiler.target}</target>
- </configuration>
- <executions>
- <!-- Replacing default-compile as it is treated specially by maven -->
- <execution>
- <id>default-compile</id>
- <phase>none</phase>
- </execution>
- <!-- Replacing default-testCompile as it is treated specially by maven -->
- <execution>
- <id>default-testCompile</id>
- <phase>none</phase>
- </execution>
- <execution>
- <id>java-compile</id>
- <phase>compile</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- <execution>
- <id>java-test-compile</id>
- <phase>test-compile</phase>
- <goals>
- <goal>testCompile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/ms/controllerblueprints/pom.xml b/ms/controllerblueprints/pom.xml
deleted file mode 100644
index 39808233..00000000
--- a/ms/controllerblueprints/pom.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>ccsdk-apps-ms</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>controllerblueprints</artifactId>
- <name>Controller Blueprints Root</name>
- <version>0.4.2-SNAPSHOT</version>
- <properties>
- <service.name>ControllerBlueprints</service.name>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
- <build.number>${maven.build.timestamp}</build.number>
- <java.version>1.8</java.version>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.source>1.8</maven.compiler.source>
- <ccsdk.project.version>${project.version}</ccsdk.project.version>
- </properties>
- <packaging>pom</packaging>
- <modules>
- <module>parent</module>
- <module>modules</module>
- <module>application</module>
- <module>distribution</module>
- </modules>
-</project>
diff --git a/ms/controllerblueprints/repoproject.txt b/ms/controllerblueprints/repoproject.txt
deleted file mode 100644
index 91a5c8e6..00000000
--- a/ms/controllerblueprints/repoproject.txt
+++ /dev/null
@@ -1 +0,0 @@
-ST_SDNCMS
diff --git a/ms/controllerblueprints/time.txt b/ms/controllerblueprints/time.txt
deleted file mode 100644
index 6ed29fb4..00000000
--- a/ms/controllerblueprints/time.txt
+++ /dev/null
@@ -1 +0,0 @@
-Current time : 17:38:06
diff --git a/ms/pom.xml b/ms/pom.xml
index 2811d20c..6f2801e0 100644
--- a/ms/pom.xml
+++ b/ms/pom.xml
@@ -35,10 +35,7 @@
<description>Micro-services</description>
<modules>
- <module>controllerblueprints</module>
- <module>blueprintsprocessor</module>
<module>neng</module>
<module>vlantag-api</module>
- <module>cds-sdc-listener</module>
</modules>
</project>