diff options
5 files changed, 74 insertions, 26 deletions
diff --git a/components/model-catalog/proto-definition/proto/BluePrintManagement.proto b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto index 2e0693c28..8c6cadb4c 100644 --- a/components/model-catalog/proto-definition/proto/BluePrintManagement.proto +++ b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto @@ -21,8 +21,9 @@ message BluePrintDownloadInput { message BluePrintRemoveInput { org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader commonHeader = 1; - string blueprintName = 2; - string blueprintVersion = 3; + org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers actionIdentifiers = 2; + // Extra optional dynamic properties used to remove. + google.protobuf.Struct properties = 3; } message BluePrintManagementOutput { @@ -55,6 +56,11 @@ enum UploadAction { PUBLISH = 3; } +enum RemoveAction { + // Delete CBA from database, deploy path and clean cache. + DEFAULT = 0; +} + service BluePrintManagementService { rpc downloadBlueprint (BluePrintDownloadInput) returns (BluePrintManagementOutput); rpc uploadBlueprint (BluePrintUploadInput) returns (BluePrintManagementOutput); diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties index 3b1a18953..e177c18cf 100755 --- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties +++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties @@ -29,8 +29,7 @@ endpoints.user.password=ccsdkapps ### START -Controller Blueprints Properties # Load Resource Source Mappings -resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability,vault-data=source-rest - +resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability,vault-data=source-rest,rest=source-rest,script=source-capability # Controller Blueprints Core Configuration blueprintsprocessor.blueprintDeployPath=blueprints/deploy blueprintsprocessor.blueprintArchivePath=blueprints/archive @@ -53,29 +52,38 @@ blueprintsprocessor.loadCbaExtension=zip blueprintsprocessor.grpcEnable=false blueprintsprocessor.httpPort=8081 blueprintsprocessor.grpcPort=9111 -###NOTE: for remote executor tests, need to enable grpc and it's properties. -###blueprintsprocessor.grpcEnable=false -# Assuming running locally -###blueprintsprocessor.grpcclient.remote-python.type=token-auth -###blueprintsprocessor.grpcclient.remote-python.host=localhost -###blueprintsprocessor.grpcclient.remote-python.port=50051 -###blueprintsprocessor.grpcclient.remote-python.token=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== + +# Command executor +# grpc if debugging locally and do not need it by setting +# blueprintsprocessor.grpcEnable=false +blueprintsprocessor.grpcclient.remote-python.type=token-auth +blueprintsprocessor.grpcclient.remote-python.host=localhost +blueprintsprocessor.grpcclient.remote-python.port=50051 +blueprintsprocessor.grpcclient.remote-python.token=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== # Blueprint Processor File Execution and Handling Properties ### use absolute paths if testing inside docker ### blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy ### blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive ### blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/working -# Primary Database Configuration + + +# db blueprintsprocessor.db.url=jdbc:mysql://localhost:3306/sdnctl blueprintsprocessor.db.username=sdnctl blueprintsprocessor.db.password=sdnctl blueprintsprocessor.db.driverClassName=org.mariadb.jdbc.Driver blueprintsprocessor.db.hibernateHbm2ddlAuto=update -blueprintsprocessor.db.hibernateDDLAuto=none +blueprintsprocessor.db.hibernateDDLAuto=update blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.MySQL5InnoDBDialect +# processor-db endpoint +blueprintsprocessor.db.processor-db.type=maria-db +blueprintsprocessor.db.processor-db.url=jdbc:mysql://localhost:3306/sdnctl +blueprintsprocessor.db.processor-db.username=root +blueprintsprocessor.db.processor-db.password=secretpassword + # Python executor ### If testing in docker, use the absolute paths as Docker view of filesystem will not respect relative paths. ### Don't forget to create directory /opt/app/onap and share it with Docker containers on your system. @@ -92,6 +100,18 @@ blueprintsprocessor.restclient.sdncodl.url=http://localhost:8282/ blueprintsprocessor.restclient.sdncodl.username=admin blueprintsprocessor.restclient.sdncodl.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U +# Config Data REST client settings +blueprintsprocessor.restclient.sdnc.type=basic-auth +blueprintsprocessor.restclient.sdnc.url=http://sdnc:8282 +blueprintsprocessor.restclient.sdnc.username=admin +blueprintsprocessor.restclient.sdnc.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + +# Primary AAI Data REST Client settings +blueprintsprocessor.restclient.aai-data.type=basic-auth +blueprintsprocessor.restclient.aai-data.url=https://aai:8443 +blueprintsprocessor.restclient.aai-data.username=aai@aai.onap.org +blueprintsprocessor.restclient.aai-data.password=demo123456! + # Executor Options blueprintprocessor.resourceResolution.enabled=true blueprintprocessor.netconfExecutor.enabled=true @@ -113,4 +133,4 @@ blueprintsprocessor.messageconsumer.self-service-api.pollMillSec=1000 blueprintsprocessor.messageproducer.self-service-api.type=kafka-basic-auth blueprintsprocessor.messageproducer.self-service-api.bootstrapServers=127.0.0.1:9092 blueprintsprocessor.messageproducer.self-service-api.clientId=default-client-id -blueprintsprocessor.messageproducer.self-service-api.topic=producer.t
\ No newline at end of file +blueprintsprocessor.messageproducer.self-service-api.topic=producer.t diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties index 37e39655a..66c7b3594 100755 --- a/ms/blueprintsprocessor/application/src/main/resources/application.properties +++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties @@ -16,7 +16,7 @@ # Web server config ### START -Controller Blueprints Properties # Load Resource Source Mappings -resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability,rest=source-rest,vault-data=source-rest +resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability,rest=source-rest,vault-data=source-rest,script=source-capability # Controller Blueprints Core Configuration blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy @@ -38,11 +38,11 @@ controllerblueprints.loadCbaExtension=zip ### END -Controller Blueprints Properties -blueprintsprocessor.grpcEnable=false +blueprintsprocessor.grpcEnable=true blueprintsprocessor.httpPort=8080 blueprintsprocessor.grpcPort=9111 -# Primary Database Configuration +# db blueprintsprocessor.db.url=jdbc:mysql://db:3306/sdnctl blueprintsprocessor.db.username=sdnctl blueprintsprocessor.db.password=sdnctl @@ -52,6 +52,12 @@ blueprintsprocessor.db.hibernateDDLAuto=update blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.MySQL5InnoDBDialect +# processor-db endpoint +blueprintsprocessor.db.processor-db.type=maria-db +blueprintsprocessor.db.processor-db.url=jdbc:mysql://mariadb-galera:3306/sdnctl +blueprintsprocessor.db.processor-db.username=root +blueprintsprocessor.db.processor-db.password=secretpassword + # 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,/opt/app/onap/scripts/jython/ccsdk_restconf @@ -77,13 +83,13 @@ blueprintprocessor.restConfExecutor.enabled=true blueprintsprocessor.cliExecutor.enabled=true blueprintprocessor.remoteScriptCommand.enabled=true +# Command executor blueprintsprocessor.grpcclient.remote-python.type=token-auth blueprintsprocessor.grpcclient.remote-python.host=localhost blueprintsprocessor.grpcclient.remote-python.port=50051 blueprintsprocessor.grpcclient.remote-python.token=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== - -# Primary Config Data REST client settings +# Config Data REST client settings blueprintsprocessor.restclient.sdnc.type=basic-auth blueprintsprocessor.restclient.sdnc.url=http://sdnc:8282 blueprintsprocessor.restclient.sdnc.username=admin @@ -91,7 +97,7 @@ blueprintsprocessor.restclient.sdnc.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoG # Primary AAI Data REST Client settings blueprintsprocessor.restclient.aai-data.type=basic-auth -blueprintsprocessor.restclient.aai-data.url=https://aai.onap:8443 +blueprintsprocessor.restclient.aai-data.url=https://aai:8443 blueprintsprocessor.restclient.aai-data.username=aai@aai.onap.org blueprintsprocessor.restclient.aai-data.password=demo123456! diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt index a3bf3709d..0f804b8b2 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt @@ -129,14 +129,28 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu StreamObserver<BluePrintManagementOutput>) { runBlocking { - val blueprintName = request.blueprintName - val blueprintVersion = request.blueprintVersion + val blueprintName = request.actionIdentifiers.blueprintName + val blueprintVersion = request.actionIdentifiers.blueprintVersion val blueprint = "blueprint $blueprintName:$blueprintVersion" log.info("request(${request.commonHeader.requestId}): Received delete $blueprint") + + /** Get the Remove Action */ + val removeAction = request.actionIdentifiers?.actionName.emptyTONull() + ?: RemoveAction.DEFAULT.toString() + try { - bluePrintModelHandler.deleteBlueprintModel(blueprintName, blueprintVersion) - responseObserver.onNext(successStatus(request.commonHeader)) + when (removeAction) { + RemoveAction.DEFAULT.toString() -> { + bluePrintModelHandler.deleteBlueprintModel(blueprintName, blueprintVersion) + responseObserver.onNext(successStatus(request.commonHeader)) + } + else -> { + responseObserver.onNext(failStatus(request.commonHeader, + "Remove action($removeAction) not implemented", + BluePrintProcessorException("Not implemented"))) + } + } } catch (e: Exception) { responseObserver.onNext(failStatus(request.commonHeader, "request(${request.commonHeader.requestId}): Failed to delete $blueprint", e)) diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt index 691cfd760..54dd46ef7 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt @@ -183,8 +183,10 @@ class BluePrintManagementGRPCHandlerTest { return BluePrintRemoveInput.newBuilder() .setCommonHeader(commonHeader) - .setBlueprintName("sample") - .setBlueprintVersion("1.0.0") + .setActionIdentifiers(ActionIdentifiers.newBuilder() + .setBlueprintName("sample") + .setBlueprintVersion("1.0.0") + .setActionName(RemoveAction.DEFAULT.toString()).build()) .build() } } |