summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/.gitignore32
-rwxr-xr-xms/blueprintsprocessor/application/pom.xml2
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java2
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application.properties2
-rw-r--r--ms/blueprintsprocessor/application/src/main/resources/logback.xml72
-rw-r--r--ms/blueprintsprocessor/application/src/main/resources/sql/schema-local.sql22
-rw-r--r--ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql22
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/test/resources/logback-test.xml82
-rw-r--r--ms/blueprintsprocessor/cba-parent/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/distribution/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml32
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/resources/logback-test.xml70
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt9
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt13
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/pom.xml4
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml74
-rwxr-xr-xms/blueprintsprocessor/functions/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/resources/logback-test.xml70
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json62
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml74
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/inputs/input.json36
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/requests/sample-resourceresolution-request.json64
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt6
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt4
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintProcessorCatalogServiceImpl.kt4
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/ControllerBlueprintCatalogServiceImpl.kt13
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/logback-test.xml70
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/resources/logback-test.xml80
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml10
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/modules/commons/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/resources/application.properties32
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/resources/logback-test.xml70
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt193
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt27
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt (renamed from ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ControllerBlueprintExceptionHandler.kt)4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt133
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/AutoResourceMappingService.kt174
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt124
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt (renamed from ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt)72
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt36
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/test-cba.zipbin0 -> 9554 bytes
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/pom.xml11
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/application-test.properties66
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/logback.xml70
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml17
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt152
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt26
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt53
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt95
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt139
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/cba-for-kafka-integration_enriched.zipbin9781 -> 0 bytes
-rw-r--r--ms/blueprintsprocessor/modules/outbounds/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/pom.xml6
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json36
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json40
-rwxr-xr-xms/blueprintsprocessor/modules/services/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml70
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml13
-rwxr-xr-xms/blueprintsprocessor/pom.xml2
-rwxr-xr-xms/command-executor/pom.xml2
-rw-r--r--ms/controllerblueprints/.gitignore25
-rwxr-xr-xms/controllerblueprints/README.md26
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/pom.xml2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt4
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt27
-rw-r--r--ms/controllerblueprints/modules/blueprint-proto/krotoPlusConfig.asciipb6
-rw-r--r--ms/controllerblueprints/modules/blueprint-proto/pom.xml113
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/pom.xml2
-rw-r--r--ms/controllerblueprints/modules/pom.xml3
-rw-r--r--ms/controllerblueprints/modules/resource-dict/pom.xml2
-rw-r--r--ms/controllerblueprints/parent/pom.xml8
-rw-r--r--ms/controllerblueprints/pom.xml4
-rw-r--r--ms/pom.xml4
-rw-r--r--ms/sdclistener/application/pom.xml8
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java43
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java33
-rwxr-xr-xms/sdclistener/distribution/pom.xml2
-rwxr-xr-xms/sdclistener/parent/pom.xml17
-rw-r--r--ms/sdclistener/pom.xml2
100 files changed, 1470 insertions, 1523 deletions
diff --git a/ms/blueprintsprocessor/.gitignore b/ms/blueprintsprocessor/.gitignore
deleted file mode 100644
index 04f991d12..000000000
--- 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/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml
index 655d7ee88..a67b10d4a 100755
--- a/ms/blueprintsprocessor/application/pom.xml
+++ b/ms/blueprintsprocessor/application/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>application</artifactId>
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java
index 5ad6ee205..9214121e4 100644
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java
+++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java
@@ -18,8 +18,8 @@ package org.onap.ccsdk.cds.blueprintsprocessor;
import io.grpc.Server;
import io.grpc.ServerBuilder;
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BluePrintManagementGRPCHandler;
import org.onap.ccsdk.cds.blueprintsprocessor.security.BasicAuthServerInterceptor;
-import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.BluePrintManagementGRPCHandler;
import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.BluePrintProcessingGRPCHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties
index 75d9cbaad..37eb87c13 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
+resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability,rest=source-rest
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
diff --git a/ms/blueprintsprocessor/application/src/main/resources/logback.xml b/ms/blueprintsprocessor/application/src/main/resources/logback.xml
index 1c3c7dc4b..872ee4f15 100644
--- a/ms/blueprintsprocessor/application/src/main/resources/logback.xml
+++ b/ms/blueprintsprocessor/application/src/main/resources/logback.xml
@@ -1,36 +1,36 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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="info"/>
- <logger name="org.springframework.web" level="info"/>
- <logger name="org.hibernate" level="error"/>
- <logger name="org.onap.ccsdk.cds" level="info"/>
-
- <root level="info">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ 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="info"/>
+ <logger name="org.springframework.web" level="info"/>
+ <logger name="org.hibernate" level="error"/>
+ <logger name="org.onap.ccsdk.cds" level="info"/>
+
+ <root level="info">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/application/src/main/resources/sql/schema-local.sql b/ms/blueprintsprocessor/application/src/main/resources/sql/schema-local.sql
index ad048b017..05df4200a 100644
--- a/ms/blueprintsprocessor/application/src/main/resources/sql/schema-local.sql
+++ b/ms/blueprintsprocessor/application/src/main/resources/sql/schema-local.sql
@@ -6,8 +6,8 @@
-- -----------------------------------------------------
-- table CONFIG_MODEL
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_MODEL (
- config_model_id INT(11) NOT NULL AUTO_INCREMENT,
+CREATE TABLE IF NOT EXISTS sdnctl.BLUEPRINT_MODEL (
+ blueprint_model_id VARCHAR(50) NOT NULL,
service_uuid VARCHAR(50) NULL DEFAULT NULL,
distribution_id VARCHAR(50) NULL DEFAULT NULL,
service_name VARCHAR(255) NULL DEFAULT NULL,
@@ -27,25 +27,25 @@ CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_MODEL (
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)
+ primary key PK_BLUEPRINT_MODEL (blueprint_model_id),
+ UNIQUE KEY UK_BLUEPRINT_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,
+CREATE TABLE IF NOT EXISTS sdnctl.BLUEPRINT_MODEL_CONTENT (
+ blueprint_model_content_id VARCHAR(50) NOT NULL,
+ blueprint_model_id VARCHAR(50) 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
+ content LONGBLOB NULL DEFAULT NULL,
+ PRIMARY KEY PK_BLUEPRINT_MODEL_CONTENT (blueprint_model_content_id),
+ UNIQUE KEY UK_BLUEPRINT_MODEL_CONTENT (blueprint_model_id, name, content_type),
+ FOREIGN KEY FK_BLUEPRINT_MODEL_CONTENT (blueprint_model_id) REFERENCES sdnctl.BLUEPRINT_MODEL(blueprint_model_id) ON DELETE CASCADE
) ENGINE=InnoDB;
-- -----------------------------------------------------
diff --git a/ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql b/ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql
index 58564dce5..8bf39eed2 100644
--- a/ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql
+++ b/ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql
@@ -1,8 +1,8 @@
-- -----------------------------------------------------
-- table CONFIG_MODEL
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL (
- config_model_id INT(11) NOT NULL AUTO_INCREMENT,
+CREATE TABLE IF NOT EXISTS configurator.BLUEPRINT_MODEL (
+ blueprint_model_id VARCHAR(50) NOT NULL,
service_uuid VARCHAR(50) NULL DEFAULT NULL,
distribution_id VARCHAR(50) NULL DEFAULT NULL,
service_name VARCHAR(255) NULL DEFAULT NULL,
@@ -22,25 +22,25 @@ CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL (
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)
+ primary key PK_BLUEPRINT_MODEL (blueprint_model_id),
+ UNIQUE KEY UK_BLUEPRINT_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,
+CREATE TABLE IF NOT EXISTS configurator.BLUEPRINT_MODEL_CONTENT (
+ blueprint_model_content_id VARCHAR(50) NOT NULL,
+ blueprint_model_id VARCHAR(50) 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
+ content LONGBLOB NULL DEFAULT NULL,
+ PRIMARY KEY PK_BLUEPRINT_MODEL_CONTENT (blueprint_model_content_id),
+ UNIQUE KEY UK_BLUEPRINT_MODEL_CONTENT (blueprint_model_id, name, content_type),
+ FOREIGN KEY FK_BLUEPRINT_MODEL_CONTENT (blueprint_model_id) REFERENCES configurator.BLUEPRINT_MODEL(blueprint_model_id) ON delete CASCADE
) ENGINE=InnoDB;
-- -----------------------------------------------------
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt
index dfa0a8563..ce7434f8e 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt
@@ -190,7 +190,7 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi
val body = toMultiValueMap("file", getBlueprintAsResource(blueprintName))
webTestClient
.post()
- .uri("/api/v1/execution-service/upload")
+ .uri("/api/v1/blueprint-model/publish")
.header("Authorization", TestSecuritySettings.clientAuthToken())
.syncBody(body)
.exchange()
diff --git a/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml
index eaa51c0a3..70d94f5a7 100644
--- a/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml
+++ b/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml
@@ -1,41 +1,41 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications 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.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %-40.40logger{39} : %msg%n</pattern>
- </encoder>
- </appender>
-
- <logger name="org.springframework.web.HttpLogging" level="trace"/>
- <logger name="org.springframework.web.reactive.function.client.ExchangeFunctions" level="trace"/>
-
- <!-- Helpful to optimize Spring Context caching to speed-up tests
- and prevent resorting to @DirtiesContext as much as possible -->
- <logger name="org.springframework.test.context.cache" level="debug"/>
-
- <!-- Please refer to https://thoughts-on-java.org/hibernate-logging-guide/
- for a lengthy discussion on good Hibernate logging practices -->
- <logger name="org.hibernate.SQL" level="debug"/>
- <logger name="org.hibernate.type.descriptor.sql" level="trace"/>
-
- <root level="info">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~ Modifications 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.
+ -->
+
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} %-5level %-40.40logger{39} : %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.springframework.web.HttpLogging" level="trace"/>
+ <logger name="org.springframework.web.reactive.function.client.ExchangeFunctions" level="trace"/>
+
+ <!-- Helpful to optimize Spring Context caching to speed-up tests
+ and prevent resorting to @DirtiesContext as much as possible -->
+ <logger name="org.springframework.test.context.cache" level="debug"/>
+
+ <!-- Please refer to https://thoughts-on-java.org/hibernate-logging-guide/
+ for a lengthy discussion on good Hibernate logging practices -->
+ <logger name="org.hibernate.SQL" level="debug"/>
+ <logger name="org.hibernate.type.descriptor.sql" level="trace"/>
+
+ <root level="info">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/cba-parent/pom.xml b/ms/blueprintsprocessor/cba-parent/pom.xml
index 0ee0da4e9..a1b6beff4 100644
--- a/ms/blueprintsprocessor/cba-parent/pom.xml
+++ b/ms/blueprintsprocessor/cba-parent/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>cba-parent</artifactId>
diff --git a/ms/blueprintsprocessor/distribution/pom.xml b/ms/blueprintsprocessor/distribution/pom.xml
index d6d9c56cd..4037c98e6 100755
--- a/ms/blueprintsprocessor/distribution/pom.xml
+++ b/ms/blueprintsprocessor/distribution/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>distribution</artifactId>
diff --git a/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml b/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml
index 848083e63..2d1f1ae80 100755
--- a/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml
+++ b/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml
@@ -1,16 +1,16 @@
-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
+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
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml b/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml
index 96254b705..8b59b17f7 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>functions</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/resources/logback-test.xml
index 5b36ac046..4313fa509 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/resources/logback-test.xml
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/resources/logback-test.xml
@@ -1,35 +1,35 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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{55} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ 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{55} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="warn"/>
+ <logger name="org.hibernate" level="info"/>
+ <logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/functions/cli-executor/pom.xml b/ms/blueprintsprocessor/functions/cli-executor/pom.xml
index 53882b0b0..89f409a70 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/pom.xml
+++ b/ms/blueprintsprocessor/functions/cli-executor/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>functions</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
index cf27cc2de..15365e176 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
@@ -19,11 +19,12 @@
package internal.scripts
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.cliDeviceInfo
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.getSshClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor
-import org.onap.ccsdk.cds.blueprintsprocessor.ssh.sshClientService
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
+
import org.slf4j.LoggerFactory
open class TestCliScriptFunction : AbstractScriptComponentFunction() {
@@ -54,10 +55,10 @@ open class Check : AbstractScriptComponentFunction() {
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
// Get the Device Information from the DSL Model
- val deviceInformation = bluePrintRuntimeService.resolveDSLExpression("device-properties")
+ val deviceInformation = cliDeviceInfo("device-properties")
// Get the Client Service
- val sshClientService = BluePrintDependencyService.sshClientService(deviceInformation)
+ val sshClientService = getSshClientService(deviceInformation)
sshClientService.startSessionNB()
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt
index bc9b7103c..ad95759a9 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt
@@ -17,7 +17,20 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.BlueprintSshClientService
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.sshClientService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
+
/**
* Register the CLI module exposed dependency
*/
+fun AbstractComponentFunction.cliDeviceInfo(requirementName: String): JsonNode {
+ return bluePrintRuntimeService.resolveDSLExpression(requirementName)
+}
+
+fun AbstractComponentFunction.getSshClientService(cliDeviceInfo: JsonNode): BlueprintSshClientService {
+ return BluePrintDependencyService.sshClientService(cliDeviceInfo)
+}
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/pom.xml b/ms/blueprintsprocessor/functions/config-snapshots/pom.xml
index 0867135c4..0ad979683 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/pom.xml
+++ b/ms/blueprintsprocessor/functions/config-snapshots/pom.xml
@@ -18,13 +18,13 @@
<parent>
<artifactId>functions</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
<artifactId>config-snapshots</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<name>Blueprints Processor Function - Config Snapshots</name>
<description>Blueprints Processor Function - Config Snapshots</description>
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/pom.xml b/ms/blueprintsprocessor/functions/netconf-executor/pom.xml
index ff9d0f7f8..f163c0e1a 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/pom.xml
+++ b/ms/blueprintsprocessor/functions/netconf-executor/pom.xml
@@ -18,7 +18,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>functions</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
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
index cc7ac83ad..da4cf9a1b 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml
@@ -1,37 +1,37 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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.apache.sshd" level="warn"/>
- <logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/>
- <logger name="org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core" level="warn"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ 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.apache.sshd" level="warn"/>
+ <logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/>
+ <logger name="org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core" level="warn"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/functions/pom.xml b/ms/blueprintsprocessor/functions/pom.xml
index c2ac510c1..73daf22a5 100755
--- a/ms/blueprintsprocessor/functions/pom.xml
+++ b/ms/blueprintsprocessor/functions/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/ms/blueprintsprocessor/functions/python-executor/pom.xml b/ms/blueprintsprocessor/functions/python-executor/pom.xml
index 68ba95e3a..872e5a61c 100644
--- a/ms/blueprintsprocessor/functions/python-executor/pom.xml
+++ b/ms/blueprintsprocessor/functions/python-executor/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>functions</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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
index 0c8d93bf0..e04e741c9 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/logback-test.xml
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/logback-test.xml
@@ -1,35 +1,35 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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.cds.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ 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.cds.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
index 7142f0457..694589de1 100644
--- 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
@@ -1,31 +1,31 @@
-{
- "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"
- }
- }
- }
-}
+{
+ "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
index 6f2d34973..be524fe22 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/pom.xml
+++ b/ms/blueprintsprocessor/functions/resource-resolution/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>functions</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
<artifactId>resource-resolution</artifactId>
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
index 305c59f62..f379f37ed 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml
@@ -1,37 +1,37 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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 [%thread] %logger{50} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.mockserver.mock" level="warn"/>
- <logger name="org.onap.ccsdk.cds.controllerblueprints" level="warn"/>
- <logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ 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 [%thread] %logger{50} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="warn"/>
+ <logger name="org.hibernate" level="info"/>
+ <logger name="org.mockserver.mock" level="warn"/>
+ <logger name="org.onap.ccsdk.cds.controllerblueprints" level="warn"/>
+ <logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
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
index cd6fac128..52a8a4f84 100644
--- 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
@@ -1,18 +1,18 @@
-{
- "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"
- ]
-}
+{
+ "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
index 6a7b4c2a2..cc653ccd6 100644
--- 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
@@ -1,32 +1,32 @@
-{
- "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"
- }
- }
- }
-}
+{
+ "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
index 53f0f4e47..c1dd50126 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/pom.xml
+++ b/ms/blueprintsprocessor/functions/restconf-executor/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>functions</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
index 783d8efbe..67b84240c 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>db-lib</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
index 17ffd5bac..74a611fbb 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
@@ -34,11 +34,11 @@ import javax.persistence.*
@EntityListeners(AuditingEntityListener::class)
@Entity
-@Table(name = "CONFIG_MODEL", uniqueConstraints = [UniqueConstraint(columnNames = ["artifact_name", "artifact_version"])])
+@Table(name = "BLUEPRINT_MODEL", uniqueConstraints = [UniqueConstraint(columnNames = ["artifact_name", "artifact_version"])])
@Proxy(lazy = false)
class BlueprintModel : Serializable {
@Id
- @Column(name = "config_model_id")
+ @Column(name = "blueprint_model_id")
var id: String? = null
@Column(name = "service_uuid")
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
index e0d26a7ae..bed6e4e38 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
@@ -32,11 +32,11 @@ import javax.persistence.*
*/
@EntityListeners(AuditingEntityListener::class)
@Entity
-@Table(name = "CONFIG_MODEL_CONTENT")
+@Table(name = "BLUEPRINT_MODEL_CONTENT")
class BlueprintModelContent : Serializable {
@Id
- @Column(name = "config_model_content_id")
+ @Column(name = "blueprint_model_content_id")
var id: String? = null
@Column(name = "name", nullable = false)
@@ -48,7 +48,7 @@ class BlueprintModelContent : Serializable {
lateinit var contentType: String
@OneToOne
- @JoinColumn(name = "config_model_id")
+ @JoinColumn(name = "blueprint_model_id")
var blueprintModel: BlueprintModel? = null
@Lob
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
index f00d5cadf..f47124dd0 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
@@ -32,13 +32,13 @@ import javax.persistence.*
*/
@Entity
-@Table(name = "CONFIG_MODEL")
+@Table(name = "BLUEPRINT_MODEL")
@JsonTypeName("blueprintModel")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
class BlueprintModelSearch : Serializable {
@Id
- @Column(name = "config_model_id")
+ @Column(name = "blueprint_model_id")
var id: String? = null
@Column(name = "artifact_uuid")
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintProcessorCatalogServiceImpl.kt
index 9ce45d11e..3e0f3516f 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintProcessorCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintProcessorCatalogServiceImpl.kt
@@ -117,6 +117,10 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(artifactName, artifactVersion)
val deployFile =
normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath, artifactName, artifactVersion)
+
+ val cacheKey = BluePrintFileUtils.compileCacheKey(deployFile)
+ BluePrintCompileCache.cleanClassLoader(cacheKey)
+
deleteNBDir(deployFile).let {
if (it) log.info("Deleted deployed blueprint model :$artifactName::$artifactVersion")
else log.info("Fail to delete deployed blueprint model :$artifactName::$artifactVersion")
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/ControllerBlueprintCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/ControllerBlueprintCatalogServiceImpl.kt
index 66b5d00c4..4c02fda12 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/ControllerBlueprintCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/ControllerBlueprintCatalogServiceImpl.kt
@@ -21,14 +21,13 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db.service
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.common.ApplicationConstants
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
-import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
-import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPath
+import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.slf4j.LoggerFactory
import org.springframework.dao.DataIntegrityViolationException
import org.springframework.stereotype.Service
@@ -85,6 +84,12 @@ class ControllerBlueprintCatalogServiceImpl(bluePrintDesignTimeValidatorService:
throw BluePrintException("Not a valid Archive file(${archiveFile.absolutePath})")
}
+ // cleanup up deploy folder for the Blueprint
+ val blueprintDeploy = normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath,
+ artifactName, artifactVersion)
+ val cacheKey = BluePrintFileUtils.compileCacheKey(blueprintDeploy)
+ BluePrintCompileCache.cleanClassLoader(cacheKey)
+
blueprintModelRepository.findByArtifactNameAndArtifactVersion(artifactName!!, artifactVersion!!)?.let {
log.info("Overwriting blueprint model :$artifactName::$artifactVersion")
blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(artifactName, artifactVersion)
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
index 355cd3ace..365c41c9e 100644
--- 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
@@ -1,35 +1,35 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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.cds.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ 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.cds.blueprintsprocessor" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
index b8d418f27..3ed0424ee 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>dmaap-lib</artifactId>
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
index ebb41b854..cff57423d 100644
--- 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
@@ -1,40 +1,40 @@
-<!--
- ~ ============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.cds.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ ============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.cds.blueprintsprocessor" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
index ad16eb908..5cc29a65e 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>commons</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -30,16 +30,16 @@
<dependencies>
<dependency>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <artifactId>blueprint-proto</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>processor-core</artifactId>
</dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.components</groupId>
- <artifactId>proto-definition</artifactId>
- </dependency>
</dependencies>
</project>
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
index 2a67da10a..b5b8c46a3 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>commons</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml
index 8c88db424..37dd5d77e 100755
--- a/ms/blueprintsprocessor/modules/commons/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>commons</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
index 8ebbc6768..673d1277c 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>processor-core</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
index 7602853f8..7c6cceb23 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>rest-lib</artifactId>
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
index 2ce871476..c10e96ee2 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/resources/application.properties
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/resources/application.properties
@@ -1,16 +1,16 @@
-#
-# 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.
-#
-
+#
+# 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/resources/logback-test.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/resources/logback-test.xml
index 355cd3ace..365c41c9e 100644
--- 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
@@ -1,35 +1,35 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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.cds.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ 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.cds.blueprintsprocessor" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
index a13d0cc9c..ff09b83f3 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>commons</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml
index f34a1ec4b..b09a8ac41 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml
@@ -19,12 +19,12 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>inbounds</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>configs-api</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Blueprints Processor Resource Configurations API</name>
<description>Blueprints Processor Resource Configurations API</description>
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml
index 8f6d32ee2..12cb8ae71 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>inbounds</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>designer-api</artifactId>
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
new file mode 100644
index 000000000..a3bf3709d
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
@@ -0,0 +1,193 @@
+/*
+ * 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.cds.blueprintsprocessor.designer.api
+
+import com.google.protobuf.ByteString
+import com.google.protobuf.util.JsonFormat
+import io.grpc.stub.StreamObserver
+import kotlinx.coroutines.runBlocking
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.BluePrintModelHandler
+import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
+import org.onap.ccsdk.cds.controllerblueprints.common.api.Status
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
+import org.onap.ccsdk.cds.controllerblueprints.core.emptyTONull
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.currentTimestamp
+import org.onap.ccsdk.cds.controllerblueprints.management.api.*
+import org.slf4j.LoggerFactory
+import org.springframework.security.access.prepost.PreAuthorize
+import org.springframework.stereotype.Service
+
+//TODO("Convert to coroutines handler")
+@Service
+open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: BluePrintModelHandler)
+ : BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase() {
+
+ private val log = LoggerFactory.getLogger(BluePrintManagementGRPCHandler::class.java)
+
+ @PreAuthorize("hasRole('USER')")
+ override fun uploadBlueprint(request: BluePrintUploadInput, responseObserver:
+ StreamObserver<BluePrintManagementOutput>) {
+
+ runBlocking {
+ //TODO("catch if request id is missing")
+ log.info("request(${request.commonHeader.requestId})")
+ try {
+ /** Get the file byte array */
+ val byteArray = request.fileChunk.chunk.toByteArray()
+ /** Get the Upload Action */
+ val uploadAction = request.actionIdentifiers?.actionName.emptyTONull()
+ ?: UploadAction.DRAFT.toString()
+
+ when (uploadAction) {
+ UploadAction.DRAFT.toString() -> {
+ val blueprintModel = bluePrintModelHandler.upload(byteArray, false)
+ responseObserver.onNext(successStatus(request.commonHeader, blueprintModel.asJsonString()))
+ }
+ UploadAction.PUBLISH.toString() -> {
+ val blueprintModel = bluePrintModelHandler.upload(byteArray, true)
+ responseObserver.onNext(successStatus(request.commonHeader, blueprintModel.asJsonString()))
+ }
+ UploadAction.VALIDATE.toString() -> {
+ //TODO("Not Implemented")
+ responseObserver.onNext(failStatus(request.commonHeader,
+ "Upload action($uploadAction) not implemented",
+ BluePrintProcessorException("Not Implemented")))
+ }
+ UploadAction.ENRICH.toString() -> {
+ val enrichedByteArray = bluePrintModelHandler.enrichBlueprintFileSource(byteArray)
+ responseObserver.onNext(outputWithFileBytes(request.commonHeader, enrichedByteArray))
+ }
+ else -> {
+ responseObserver.onNext(failStatus(request.commonHeader,
+ "Upload action($uploadAction) not implemented",
+ BluePrintProcessorException("Not implemented")))
+ }
+ }
+ } catch (e: Exception) {
+ responseObserver.onNext(failStatus(request.commonHeader,
+ "request(${request.commonHeader.requestId}): Failed to upload CBA", e))
+ } finally {
+ responseObserver.onCompleted()
+ }
+ }
+ }
+
+ @PreAuthorize("hasRole('USER')")
+ override fun downloadBlueprint(request: BluePrintDownloadInput,
+ responseObserver: StreamObserver<BluePrintManagementOutput>) {
+ runBlocking {
+ val blueprintName = request.actionIdentifiers.blueprintName
+ val blueprintVersion = request.actionIdentifiers.blueprintVersion
+ val blueprint = "blueprint $blueprintName:$blueprintVersion"
+
+ /** Get the Search Action */
+ val searchAction = request.actionIdentifiers?.actionName.emptyTONull()
+ ?: DownloadAction.SEARCH.toString()
+
+ log.info("request(${request.commonHeader.requestId}): Received download $blueprint")
+ try {
+ when (searchAction) {
+ DownloadAction.SEARCH.toString() -> {
+ val downloadByteArray = bluePrintModelHandler.download(blueprintName, blueprintVersion)
+ responseObserver.onNext(outputWithFileBytes(request.commonHeader, downloadByteArray))
+ }
+ else -> {
+ responseObserver.onNext(failStatus(request.commonHeader,
+ "Search action($searchAction) not implemented",
+ BluePrintProcessorException("Not implemented")))
+ }
+ }
+ } catch (e: Exception) {
+ responseObserver.onNext(failStatus(request.commonHeader,
+ "request(${request.commonHeader.requestId}): Failed to delete $blueprint", e))
+ } finally {
+ responseObserver.onCompleted()
+ }
+ }
+ }
+
+ @PreAuthorize("hasRole('USER')")
+ override fun removeBlueprint(request: BluePrintRemoveInput, responseObserver:
+ StreamObserver<BluePrintManagementOutput>) {
+
+ runBlocking {
+ val blueprintName = request.blueprintName
+ val blueprintVersion = request.blueprintVersion
+ val blueprint = "blueprint $blueprintName:$blueprintVersion"
+
+ log.info("request(${request.commonHeader.requestId}): Received delete $blueprint")
+ try {
+ bluePrintModelHandler.deleteBlueprintModel(blueprintName, blueprintVersion)
+ responseObserver.onNext(successStatus(request.commonHeader))
+ } catch (e: Exception) {
+ responseObserver.onNext(failStatus(request.commonHeader,
+ "request(${request.commonHeader.requestId}): Failed to delete $blueprint", e))
+ } finally {
+ responseObserver.onCompleted()
+ }
+ }
+ }
+
+ private fun outputWithFileBytes(header: CommonHeader, byteArray: ByteArray): BluePrintManagementOutput =
+ BluePrintManagementOutput.newBuilder()
+ .setCommonHeader(header)
+ .setFileChunk(FileChunk.newBuilder().setChunk(ByteString.copyFrom(byteArray)))
+ .setStatus(Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(BluePrintConstants.STATUS_SUCCESS)
+ .setCode(200)
+ .build())
+ .build()
+
+ private fun successStatus(header: CommonHeader, propertyContent: String? = null): BluePrintManagementOutput {
+ // Populate Response Payload
+ val propertiesBuilder = BluePrintManagementOutput.newBuilder().propertiesBuilder
+ propertyContent?.let {
+ JsonFormat.parser().merge(propertyContent, propertiesBuilder)
+ }
+ return BluePrintManagementOutput.newBuilder()
+ .setCommonHeader(header)
+ .setProperties(propertiesBuilder.build())
+ .setStatus(Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(BluePrintConstants.STATUS_SUCCESS)
+ .setCode(200)
+ .build())
+ .build()
+ }
+
+ private fun failStatus(header: CommonHeader, message: String, e: Exception): BluePrintManagementOutput {
+ log.error(message, e)
+ return BluePrintManagementOutput.newBuilder()
+ .setCommonHeader(header)
+ .setStatus(Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(BluePrintConstants.STATUS_FAILURE)
+ .setErrorMessage(message)
+ .setCode(500)
+ .build())
+ .build()
+// return io.grpc.Status.INTERNAL
+// .withDescription(message)
+// .withCause(e)
+// .asException()
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
index f67ed25c3..4d13486c3 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
@@ -17,14 +17,17 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
+import io.swagger.annotations.ApiOperation
+import io.swagger.annotations.ApiParam
import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.BluePrintModelHandler
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
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.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
/**
@@ -40,18 +43,21 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@PostMapping("", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
@ResponseBody
@Throws(BluePrintException::class)
+ @PreAuthorize("hasRole('USER')")
fun saveBlueprint(@RequestPart("file") filePart: FilePart): BlueprintModelSearch = runBlocking {
bluePrintModelHandler.saveBlueprintModel(filePart)
}
@GetMapping("", produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
+ @PreAuthorize("hasRole('USER')")
fun allBlueprintModel(): List<BlueprintModelSearch> {
return this.bluePrintModelHandler.allBlueprintModel()
}
@DeleteMapping("/{id}")
@Throws(BluePrintException::class)
+ @PreAuthorize("hasRole('USER')")
fun deleteBlueprint(@PathVariable(value = "id") id: String) {
this.bluePrintModelHandler.deleteBlueprintModel(id)
}
@@ -59,6 +65,7 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@GetMapping("/by-name/{name}/version/{version}", produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
@Throws(BluePrintException::class)
+ @PreAuthorize("hasRole('USER')")
fun getBlueprintByNameAndVersion(@PathVariable(value = "name") name: String,
@PathVariable(value = "version") version: String): BlueprintModelSearch {
return this.bluePrintModelHandler.getBlueprintModelSearchByNameAndVersion(name, version)
@@ -67,6 +74,7 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@GetMapping("/download/by-name/{name}/version/{version}", produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
@Throws(BluePrintException::class)
+ @PreAuthorize("hasRole('USER')")
fun downloadBlueprintByNameAndVersion(@PathVariable(value = "name") name: String,
@PathVariable(value = "version") version: String): ResponseEntity<Resource> {
return this.bluePrintModelHandler.downloadBlueprintModelFileByNameAndVersion(name, version)
@@ -75,6 +83,7 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@GetMapping("/{id}", produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
@Throws(BluePrintException::class)
+ @PreAuthorize("hasRole('USER')")
fun getBlueprintModel(@PathVariable(value = "id") id: String): BlueprintModelSearch {
return this.bluePrintModelHandler.getBlueprintModelSearch(id)
}
@@ -82,6 +91,7 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@GetMapping("/download/{id}", produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
@Throws(BluePrintException::class)
+ @PreAuthorize("hasRole('USER')")
fun downloadBluePrint(@PathVariable(value = "id") id: String): ResponseEntity<Resource> {
return this.bluePrintModelHandler.downloadBlueprintModelFile(id)
}
@@ -90,6 +100,7 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
.MULTIPART_FORM_DATA_VALUE])
@ResponseBody
@Throws(BluePrintException::class)
+ @PreAuthorize("hasRole('USER')")
fun enrichBlueprint(@RequestPart("file") file: FilePart): ResponseEntity<Resource> = runBlocking {
bluePrintModelHandler.enrichBlueprint(file)
}
@@ -97,13 +108,27 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@PostMapping("/publish", produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
@Throws(BluePrintException::class)
+ @PreAuthorize("hasRole('USER')")
fun publishBlueprint(@RequestPart("file") file: FilePart): BlueprintModelSearch = runBlocking {
bluePrintModelHandler.publishBlueprint(file)
}
@GetMapping("/search/{tags}", produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
+ @PreAuthorize("hasRole('USER')")
fun searchBlueprintModels(@PathVariable(value = "tags") tags: String): List<BlueprintModelSearch> {
return this.bluePrintModelHandler.searchBlueprintModels(tags)
}
+
+ @DeleteMapping("/name/{name}/version/{version}")
+ @ApiOperation(value = "Delete a CBA",
+ notes = "Delete the CBA package identified by its name and version.",
+ produces = MediaType.APPLICATION_JSON_VALUE)
+ @PreAuthorize("hasRole('USER')")
+ fun deleteBlueprint(@ApiParam(value = "Name of the CBA.", required = true)
+ @PathVariable(value = "name") name: String,
+ @ApiParam(value = "Version of the CBA.", required = true)
+ @PathVariable(value = "version") version: String) = runBlocking {
+ bluePrintModelHandler.deleteBlueprintModel(name, version)
+ }
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ControllerBlueprintExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt
index 0d2a7b7dc..c140c9a07 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ControllerBlueprintExceptionHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt
@@ -32,10 +32,10 @@ import org.springframework.web.bind.annotation.RestControllerAdvice
* @version 1.0
*/
@RestControllerAdvice("org.onap.ccsdk.cds.controllerblueprints")
-open class ControllerBlueprintExceptionHandler {
+open class DesignerBlueprintExceptionHandler {
companion object ControllerBlueprintExceptionHandler {
- val LOG = LoggerFactory.getLogger(ControllerBlueprintExceptionHandler::class.java)
+ val LOG = LoggerFactory.getLogger(DesignerBlueprintExceptionHandler::class.java)
}
@ExceptionHandler
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
index c074573dd..526e92cea 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
@@ -29,7 +29,8 @@ import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfigur
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
-import org.slf4j.LoggerFactory
+import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.springframework.core.io.ByteArrayResource
import org.springframework.core.io.Resource
import org.springframework.http.HttpHeaders
@@ -38,7 +39,6 @@ import org.springframework.http.ResponseEntity
import org.springframework.http.codec.multipart.FilePart
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
-import java.io.File
import java.io.IOException
import java.util.*
@@ -50,14 +50,14 @@ import java.util.*
*/
@Service
-open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: BluePrintCatalogService,
+open class BluePrintModelHandler(private val blueprintsProcessorCatalogService: BluePrintCatalogService,
private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
private val blueprintModelSearchRepository: BlueprintModelSearchRepository,
private val blueprintModelRepository: BlueprintModelRepository,
private val blueprintModelContentRepository: BlueprintModelContentRepository,
private val bluePrintEnhancerService: BluePrintEnhancerService) {
- private val log = LoggerFactory.getLogger(BluePrintModelHandler::class.java)!!
+ private val log = logger(BluePrintModelHandler::class)
/**
* This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
@@ -77,29 +77,11 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService:
</BlueprintModelSearch> */
@Throws(BluePrintException::class)
open suspend fun saveBlueprintModel(filePart: FilePart): BlueprintModelSearch {
- val saveId = UUID.randomUUID().toString()
- val blueprintArchive = normalizedPathName(bluePrintLoadConfiguration.blueprintArchivePath, saveId)
try {
- //Recreate the Dir
- normalizedFile(bluePrintLoadConfiguration.blueprintArchivePath, saveId).reCreateDirs()
- val deCompressedFile = normalizedFile(blueprintArchive, "cba.zip")
- // Copy the File Part to Local File
- BluePrintEnhancerUtils.copyFromFilePart(filePart, deCompressedFile)
- // Save the Copied file to Database
- val blueprintId = controllerBlueprintsCatalogService.saveToDatabase(saveId, deCompressedFile, false)
- // Check and Return the Saved File
- val blueprintModelSearch = blueprintModelSearchRepository.findById(blueprintId)
- ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, blueprintId))
-
- log.info("Save($saveId) successful for blueprint(${blueprintModelSearch.artifactName}) " +
- "version(${blueprintModelSearch.artifactVersion})")
- return blueprintModelSearch
+ return upload(filePart, false)
} catch (e: IOException) {
throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
"Error in Save CBA: ${e.message}", e)
- } finally {
- deleteDir(blueprintArchive)
}
}
@@ -141,19 +123,14 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService:
@Throws(BluePrintException::class)
open fun downloadBlueprintModelFileByNameAndVersion(name: String,
version: String): ResponseEntity<Resource> {
- val blueprintModel: BlueprintModel
try {
- blueprintModel = getBlueprintModelByNameAndVersion(name, version)
+ val archiveByteArray = download(name, version)
+ val fileName = "${name}_$version.zip"
+ return prepareResourceEntity(fileName, archiveByteArray)
} 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
- ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format("Error while downloading the CBA file: couldn't get model content"))
- return prepareResourceEntity(fileName, file)
}
/**
@@ -171,7 +148,7 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService:
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 fileName = "${blueprintModel.artifactName}_${blueprintModel.artifactVersion}.zip"
val file = blueprintModel.blueprintModelContent?.content
?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
String.format("Error while downloading the CBA file: couldn't get model content"))
@@ -261,6 +238,10 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService:
}
}
+ open suspend fun deleteBlueprintModel(name: String, version: String) {
+ blueprintsProcessorCatalogService.deleteFromDatabase(name, version)
+ }
+
/**
* This is a CBA enrichBlueprint method
* Save the Zip File in archive location and extract the cba content.
@@ -275,22 +256,12 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService:
*/
@Throws(BluePrintException::class)
open suspend fun enrichBlueprint(filePart: FilePart): ResponseEntity<Resource> {
- val enhanceId = UUID.randomUUID().toString()
- val blueprintArchive = normalizedPathName(bluePrintLoadConfiguration.blueprintArchivePath, enhanceId)
- val blueprintWorkingDir = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, enhanceId)
try {
- BluePrintEnhancerUtils.decompressFilePart(filePart, blueprintArchive, blueprintWorkingDir)
-
- // Enhance the Blue Prints
- bluePrintEnhancerService.enhance(blueprintWorkingDir)
-
- return BluePrintEnhancerUtils.compressToFilePart(blueprintWorkingDir, blueprintArchive)
-
+ val enhancedByteArray = enrichBlueprintFileSource(filePart)
+ return BluePrintEnhancerUtils.prepareResourceEntity("enhanced-cba.zip", enhancedByteArray)
} catch (e: IOException) {
throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
"Error in Enriching CBA: ${e.message}", e)
- } finally {
- BluePrintEnhancerUtils.cleanEnhancer(blueprintArchive, blueprintWorkingDir)
}
}
@@ -303,22 +274,80 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService:
*/
@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 blueprintWorkingDir = bluePrintLoadConfiguration.blueprintWorkingPath.plus(File.separator).plus(publishId)
try {
- val compressedFilePart = BluePrintEnhancerUtils
- .extractCompressFilePart(filePart, blueprintArchive, blueprintWorkingDir)
+ return upload(filePart, true)
+ } catch (e: Exception) {
+ throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
+ "Error in Publishing CBA: ${e.message}", e)
+ }
+ }
- val blueprintId = controllerBlueprintsCatalogService.saveToDatabase(publishId, compressedFilePart, true)
+ /** Common CBA Save and Publish function for RestController and GRPC Handler, the [fileSource] may be
+ * byteArray or File Part type.*/
+ open suspend fun upload(fileSource: Any, validate: Boolean): BlueprintModelSearch {
+ val saveId = UUID.randomUUID().toString()
+ val blueprintArchive = normalizedPathName(bluePrintLoadConfiguration.blueprintArchivePath, saveId)
+ val blueprintWorking = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, saveId)
+ try {
+ val compressedFile = normalizedFile(blueprintArchive, "cba.zip")
+ when (fileSource) {
+ is FilePart -> BluePrintEnhancerUtils.filePartAsFile(fileSource, compressedFile)
+ is ByteArray -> BluePrintEnhancerUtils.byteArrayAsFile(fileSource, compressedFile)
+ }
+ // Save the Copied file to Database
+ val blueprintId = blueprintsProcessorCatalogService.saveToDatabase(saveId, compressedFile, validate)
return blueprintModelSearchRepository.findById(blueprintId)
?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, blueprintId))
- } catch (e: Exception) {
+ } catch (e: IOException) {
throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- "Error in Publishing CBA: ${e.message}", e)
+ "Error in Upload CBA: ${e.message}", e)
+ } finally {
+ // Clean blueprint script cache
+ val cacheKey = BluePrintFileUtils
+ .compileCacheKey(normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, saveId))
+ BluePrintCompileCache.cleanClassLoader(cacheKey)
+ deleteNBDir(blueprintArchive)
+ deleteNBDir(blueprintWorking)
+ }
+ }
+
+ /** Common CBA download function for RestController and GRPC Handler, the [fileSource] may be
+ * byteArray or File Part type.*/
+ open fun download(name: String, version: String): ByteArray {
+ try {
+ val blueprintModel = getBlueprintModelByNameAndVersion(name, version)
+ return blueprintModel.blueprintModelContent?.content
+ ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format("Error while downloading the CBA file: couldn't get model content"))
+ } catch (e: BluePrintException) {
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format("Error while " + "downloading the CBA file: %s", e.message), e)
+ }
+ }
+
+ /** Common CBA Enrich function for RestController and GRPC Handler, the [fileSource] may be
+ * byteArray or File Part type.*/
+ open suspend fun enrichBlueprintFileSource(fileSource: Any): ByteArray {
+ val enhanceId = UUID.randomUUID().toString()
+ val blueprintArchive = normalizedPathName(bluePrintLoadConfiguration.blueprintArchivePath, enhanceId)
+ val blueprintWorkingDir = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, enhanceId)
+ try {
+ when (fileSource) {
+ is FilePart -> BluePrintEnhancerUtils
+ .copyFilePartToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
+ is ByteArray -> BluePrintEnhancerUtils
+ .copyByteArrayToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
+ } // Enhance the Blue Prints
+ bluePrintEnhancerService.enhance(blueprintWorkingDir)
+
+ return BluePrintEnhancerUtils.compressEnhanceDirAndReturnByteArray(blueprintWorkingDir, blueprintArchive)
+
+ } catch (e: IOException) {
+ throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
+ "Error in Enriching CBA: ${e.message}", e)
} finally {
BluePrintEnhancerUtils.cleanEnhancer(blueprintArchive, blueprintWorkingDir)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/AutoResourceMappingService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/AutoResourceMappingService.kt
deleted file mode 100644
index be562642f..000000000
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/AutoResourceMappingService.kt
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Huawei.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service
-
-import com.google.common.base.Preconditions
-import org.apache.commons.collections.CollectionUtils
-import org.apache.commons.lang3.StringUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.AutoMapResponse
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ResourceDictionaryRepository
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
-import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils
-import org.slf4j.LoggerFactory
-import org.springframework.stereotype.Service
-import java.util.*
-
-@Service
-open class AutoResourceMappingService(private val dataDictionaryRepository: ResourceDictionaryRepository) {
-
- private val log = LoggerFactory.getLogger(AutoResourceMappingService::class.java)
-
- @Throws(BluePrintException::class)
- fun autoMap(resourceAssignments: MutableList<ResourceAssignment>):
- AutoMapResponse {
- val autoMapResponse = AutoMapResponse()
- try {
- if (CollectionUtils.isNotEmpty(resourceAssignments)) {
- // Create the Dictionary definitions for the ResourceAssignment Names
- val dictionaryMap = getDictionaryDefinitions(resourceAssignments)
-
- for (resourceAssignment in resourceAssignments) {
- if (StringUtils.isNotBlank(resourceAssignment.name)
- && StringUtils.isBlank(resourceAssignment.dictionaryName)) {
- populateDictionaryMapping(dictionaryMap, resourceAssignment)
- log.info("Mapped Resource : {}", resourceAssignment)
- }
- }
- }
- val dictionaries = getDictionaryDefinitionsList(resourceAssignments)
- val resourceAssignmentsFinal = getAllAutoMapResourceAssignments(resourceAssignments)
- autoMapResponse.dataDictionaries = dictionaries
- autoMapResponse.resourceAssignments = resourceAssignmentsFinal
- } catch (e: Exception) {
- log.error(String.format("Failed in auto process %s", e.message))
- throw BluePrintException(e, e.message!!)
- }
-
- return autoMapResponse
- }
-
- private fun populateDictionaryMapping(dictionaryMap: Map<String, ResourceDictionary>, resourceAssignment: ResourceAssignment) {
- val dbDataDictionary = dictionaryMap[resourceAssignment.name]
- if (dbDataDictionary != null && dbDataDictionary.definition != null) {
-
- val dictionaryDefinition = dbDataDictionary.definition
-
- if (dictionaryDefinition != null && StringUtils.isNotBlank(dictionaryDefinition.name)
- && StringUtils.isBlank(resourceAssignment.dictionaryName)) {
-
- resourceAssignment.dictionaryName = dbDataDictionary.name
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition)
- }
- }
- }
-
- private fun getDictionaryDefinitions(resourceAssignments: List<ResourceAssignment>): Map<String, ResourceDictionary> {
- val dictionaryMap = HashMap<String, ResourceDictionary>()
- val names = ArrayList<String>()
- for (resourceAssignment in resourceAssignments) {
- if (StringUtils.isNotBlank(resourceAssignment.name)) {
- names.add(resourceAssignment.name)
- }
- }
- if (CollectionUtils.isNotEmpty(names)) {
-
- val dictionaries = dataDictionaryRepository.findByNameIn(names)
- if (CollectionUtils.isNotEmpty(dictionaries)) {
- for (dataDictionary in dictionaries) {
- if (StringUtils.isNotBlank(dataDictionary.name)) {
- dictionaryMap[dataDictionary.name] = dataDictionary
- }
- }
- }
- }
- return dictionaryMap
-
- }
- private fun getDictionaryDefinitionsList(resourceAssignments: List<ResourceAssignment>): List<ResourceDictionary>? {
- var dictionaries: List<ResourceDictionary>? = null
- val names = ArrayList<String>()
- for (resourceAssignment in resourceAssignments) {
- if (StringUtils.isNotBlank(resourceAssignment.dictionaryName)) {
-
- if (!names.contains(resourceAssignment.dictionaryName)) {
- names.add(resourceAssignment.dictionaryName!!)
- }
-
- if (resourceAssignment.dependencies != null && !resourceAssignment.dependencies!!.isEmpty()) {
- val dependencyNames = resourceAssignment.dependencies
- for (dependencyName in dependencyNames!!) {
- if (StringUtils.isNotBlank(dependencyName) && !names.contains(dependencyName)) {
- names.add(dependencyName)
- }
- }
- }
- }
- }
- if (CollectionUtils.isNotEmpty(names)) {
- dictionaries = dataDictionaryRepository.findByNameIn(names)
- }
- return dictionaries
-
- }
-
- private fun getAllAutoMapResourceAssignments(resourceAssignments: MutableList<ResourceAssignment>): List<ResourceAssignment> {
- var dictionaries: List<ResourceDictionary>? = null
- val names = ArrayList<String>()
- for (resourceAssignment in resourceAssignments) {
- if (StringUtils.isNotBlank(resourceAssignment.dictionaryName)) {
- if (resourceAssignment.dependencies != null && !resourceAssignment.dependencies!!.isEmpty()) {
- val dependencyNames = resourceAssignment.dependencies
- for (dependencyName in dependencyNames!!) {
- if (StringUtils.isNotBlank(dependencyName) && !names.contains(dependencyName)
- && !checkAssignmentsExists(resourceAssignments, dependencyName)) {
- names.add(dependencyName)
- }
- }
- }
- }
- }
-
- if (!names.isEmpty()) {
- dictionaries = dataDictionaryRepository.findByNameIn(names)
- }
- if (dictionaries != null) {
- for (rscDictionary in dictionaries) {
- val dictionaryDefinition = rscDictionary.definition
- Preconditions.checkNotNull(dictionaryDefinition, "failed to get Resource Definition from dictionary definition")
- val property = PropertyDefinition()
- property.required = true
- val resourceAssignment = ResourceAssignment()
- resourceAssignment.name = rscDictionary.name
- resourceAssignment.dictionaryName = rscDictionary.name
- resourceAssignment.version = 0
- resourceAssignment.property = property
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition)
- resourceAssignments.add(resourceAssignment)
- }
- }
- return resourceAssignments
- }
-
-
- private fun checkAssignmentsExists(resourceAssignmentsWithDepencies: List<ResourceAssignment>, resourceName: String): Boolean {
- return resourceAssignmentsWithDepencies.stream().anyMatch { names -> names.name.equals(resourceName, ignoreCase = true) }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
index 6eab5cd3f..c79d1b526 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
@@ -18,11 +18,12 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils
-import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.reactive.awaitSingle
-import kotlinx.coroutines.withContext
import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils
@@ -32,17 +33,13 @@ 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 {
+ val log = logger(BluePrintEnhancerUtils)
fun populateDataTypes(bluePrintContext: BluePrintContext, bluePrintRepoService: BluePrintRepoService,
dataTypeName: String): DataType {
@@ -84,81 +81,88 @@ class BluePrintEnhancerUtils {
return artifactType
}
- suspend fun copyFromFilePart(filePart: FilePart, targetFile: File): File {
+ suspend fun byteArrayAsFile(byteArray: ByteArray, targetFile: File): File {
+ // Recreate Folder
+ targetFile.parentFile.reCreateNBDirs()
+ targetFile.writeBytes(byteArray).apply {
+ log.info("CBA file(${targetFile.absolutePath} written successfully")
+ }
+ return targetFile
+ }
+
+
+ suspend fun filePartAsFile(filePart: FilePart, targetFile: File): File {
// Delete the Directory
- targetFile.deleteRecursively()
+ targetFile.parentFile.reCreateNBDirs()
return filePart.transferTo(targetFile)
.thenReturn(targetFile)
.awaitSingle()
}
- suspend fun extractCompressFilePart(filePart: FilePart, archiveDir: String, enhanceDir: String): File {
+ private suspend fun byteArrayAsArchiveFile(byteArray: ByteArray, archiveDir: String, enhanceDir: String): File {
+ //Recreate the Base Directories
+ normalizedFile(archiveDir).reCreateNBDirs()
+ normalizedFile(enhanceDir).reCreateNBDirs()
+ val archiveFile = normalizedFile(archiveDir, "cba.zip")
+ // Copy the File Part to ZIP
+ return byteArrayAsFile(byteArray, archiveFile)
+ }
+
+ private suspend fun filePartAsArchiveFile(filePart: FilePart, archiveDir: String, enhanceDir: String): File {
//Recreate the Base Directories
- normalizedFile(archiveDir).reCreateDirs()
- normalizedFile(enhanceDir).reCreateDirs()
- val filePartFile = normalizedFile(archiveDir, "cba.zip")
+ normalizedFile(archiveDir).reCreateNBDirs()
+ normalizedFile(enhanceDir).reCreateNBDirs()
+ val archiveFile = normalizedFile(archiveDir, "cba.zip")
// Copy the File Part to ZIP
- return copyFromFilePart(filePart, filePartFile)
+ return filePartAsFile(filePart, archiveFile)
+ }
+
+ /** copy the [byteArray] zip file to [archiveDir] and then decompress to [enhanceDir] */
+ suspend fun copyByteArrayToEnhanceDir(byteArray: ByteArray, archiveDir: String, enhanceDir: String): File {
+ val archiveFile = byteArrayAsArchiveFile(byteArray, archiveDir, enhanceDir)
+ val deCompressFileName = normalizedPathName(enhanceDir)
+ return archiveFile.deCompress(deCompressFileName)
}
- suspend fun decompressFilePart(filePart: FilePart, archiveDir: String, enhanceDir: String): File {
- val filePartFile = extractCompressFilePart(filePart, archiveDir, enhanceDir)
+ /** copy the [filePart] zip file to [archiveDir] and then decompress to [enhanceDir] */
+ suspend fun copyFilePartToEnhanceDir(filePart: FilePart, archiveDir: String, enhanceDir: String): File {
+ val filePartFile = filePartAsArchiveFile(filePart, archiveDir, enhanceDir)
val deCompressFileName = normalizedPathName(enhanceDir)
return filePartFile.deCompress(deCompressFileName)
}
- suspend fun compressToFilePart(enhanceDir: String, archiveDir: String,
- outputFileName:String="enhanced-cba.zip"): ResponseEntity<Resource> {
+ /** compress [enhanceDir] to [archiveDir] and return ByteArray */
+ suspend fun compressEnhanceDirAndReturnByteArray(enhanceDir: String, archiveDir: String,
+ outputFileName: String = "enhanced-cba.zip"): ByteArray {
val compressedFile = normalizedFile(archiveDir, outputFileName)
BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
- return prepareResourceEntity(compressedFile.name, compressedFile.readBytes())
+ return compressedFile.readBytes()
}
- suspend fun prepareResourceEntity(fileName: String, file: ByteArray): ResponseEntity<Resource> {
+ /** compress [enhanceDir] to [archiveDir] and return ResponseEntity */
+ suspend fun compressEnhanceDirAndReturnFilePart(enhanceDir: String, archiveDir: String,
+ outputFileName: String = "enhanced-cba.zip")
+ : ResponseEntity<Resource> {
+ val compressedFile = normalizedFile(archiveDir, outputFileName)
+ BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
+ return prepareResourceEntity(compressedFile)
+ }
+
+ /** convert [file] to ResourceEntity */
+ suspend fun prepareResourceEntity(file: File): ResponseEntity<Resource> {
+ return prepareResourceEntity(file.name, file.readBytes())
+ }
+ /** convert [byteArray] to ResourceEntity with [fileName]*/
+ fun prepareResourceEntity(fileName: String, byteArray: 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)
+ .body(ByteArrayResource(byteArray))
}
- /**
- * 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)
+ suspend fun cleanEnhancer(archiveLocation: String, enhancementLocation: String) {
+ deleteNBDir(archiveLocation)
+ deleteNBDir(enhancementLocation)
}
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
index 9629aa4b5..691cfd760 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
@@ -16,15 +16,20 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
import com.google.protobuf.ByteString
import io.grpc.testing.GrpcServerRule
+import kotlinx.coroutines.runBlocking
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.GRPCLibConstants
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TokenAuthGrpcClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.TokenAuthGrpcClientService
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.controllerblueprints.management.api.*
@@ -34,15 +39,13 @@ 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.AfterTest
-import kotlin.test.BeforeTest
-import kotlin.test.assertEquals
-import kotlin.test.assertTrue
+import kotlin.test.*
@RunWith(SpringRunner::class)
@EnableAutoConfiguration
@DirtiesContext
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
+@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
+ "org.onap.ccsdk.cds.controllerblueprints"])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintManagementGRPCHandlerTest {
@@ -65,15 +68,26 @@ class BluePrintManagementGRPCHandlerTest {
}
@Test
- fun `test upload blueprint`() {
+ fun `test upload and download blueprint`() {
val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
val id = "123_upload"
val req = createUploadInputRequest(id, UploadAction.PUBLISH.toString())
val output = blockingStub.uploadBlueprint(req)
assertEquals(200, output.status.code)
- assertTrue(output.status.message.contains("Successfully uploaded CBA"))
+ assertTrue(output.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
+ "failed to get success status")
assertEquals(id, output.commonHeader.requestId)
+
+ val downloadId = "123_download"
+ val downloadReq = createDownloadInputRequest(downloadId, DownloadAction.SEARCH.toString())
+
+ val downloadOutput = blockingStub.downloadBlueprint(downloadReq)
+ assertEquals(200, downloadOutput.status.code)
+ assertTrue(downloadOutput.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
+ "failed to get success status")
+ assertNotNull(downloadOutput.fileChunk?.chunk, "failed to get cba file chunks")
+ assertEquals(downloadId, downloadOutput.commonHeader.requestId)
}
@Test
@@ -84,7 +98,8 @@ class BluePrintManagementGRPCHandlerTest {
var output = blockingStub.uploadBlueprint(req)
assertEquals(200, output.status.code)
- assertTrue(output.status.message.contains("Successfully uploaded CBA"))
+ assertTrue(output.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
+ "failed to get success status")
assertEquals(id, output.commonHeader.requestId)
val removeReq = createRemoveInputRequest(id)
@@ -92,6 +107,28 @@ class BluePrintManagementGRPCHandlerTest {
assertEquals(200, output.status.code)
}
+ /** This is Integration test sample, Do not enable this test case in server build, this is for local desktop testing*/
+ private fun integrationTestGrpcManagement() {
+ runBlocking {
+ val tokenAuthGrpcClientProperties = TokenAuthGrpcClientProperties().apply {
+ host = "127.0.0.1"
+ port = 9111
+ type = GRPCLibConstants.TYPE_TOKEN_AUTH
+ token = "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=="
+ }
+ val basicAuthGrpcClientService = TokenAuthGrpcClientService(tokenAuthGrpcClientProperties)
+ val channel = basicAuthGrpcClientService.channel()
+
+ val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(channel)
+
+ val bluePrintUploadInput = createUploadInputRequest("12345", UploadAction.DRAFT.toString())
+
+ val bluePrintManagementOutput = blockingStub.uploadBlueprint(bluePrintUploadInput)
+ assertNotNull(bluePrintManagementOutput, "failed to get response")
+ }
+ }
+
+
private fun createUploadInputRequest(id: String, action: String): BluePrintUploadInput {
val file = normalizedFile("./src/test/resources/test-cba.zip")
assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
@@ -119,6 +156,23 @@ class BluePrintManagementGRPCHandlerTest {
.build()
}
+ private fun createDownloadInputRequest(id: String, action: String): BluePrintDownloadInput {
+ val commonHeader = CommonHeader
+ .newBuilder()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId(id)
+ .setSubRequestId("1234-56").build()
+
+ return BluePrintDownloadInput.newBuilder()
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(ActionIdentifiers.newBuilder()
+ .setBlueprintName("baseconfiguration")
+ .setBlueprintVersion("1.0.0")
+ .setActionName(action).build())
+ .build()
+ }
+
private fun createRemoveInputRequest(id: String): BluePrintRemoveInput {
val commonHeader = CommonHeader
.newBuilder()
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
index 877584ed6..0d834d21c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
@@ -32,7 +32,6 @@ import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.core.io.ByteArrayResource
@@ -67,7 +66,7 @@ import kotlin.test.assertTrue
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class BlueprintModelControllerTest {
- private val log = LoggerFactory.getLogger(BlueprintModelControllerTest::class.java)!!
+ private val log = logger(BlueprintModelControllerTest::class)
companion object {
private var bp: BlueprintModelSearch? = null
@@ -176,6 +175,31 @@ class BlueprintModelControllerTest {
@Test
fun test07_publishBlueprintModel() {
+ bp = runBlocking {
+ val body = MultipartBodyBuilder().apply {
+ part("file", object : ByteArrayResource(testZipFile!!.readBytes()) {
+ override fun getFilename(): String {
+ return "test.zip"
+ }
+ })
+ }.build()
+
+ val publishBP = webTestClient
+ .post()
+ .uri("/api/v1/blueprint-model/publish")
+ .body(BodyInserters.fromMultipartData(body))
+ .exchange()
+ .expectStatus().isOk
+ .returnResult<BlueprintModelSearch>()
+ .responseBody
+ .awaitSingle()
+
+ assertNotNull(publishBP, "failed to get response")
+ assertEquals("baseconfiguration", publishBP.artifactName, "mismatch artifact name")
+ assertEquals("1.0.0", publishBP.artifactVersion, "mismatch artifact version")
+ assertEquals("Y", publishBP.published, "mismatch publish")
+ publishBP
+ }
}
@Test
@@ -196,7 +220,13 @@ class BlueprintModelControllerTest {
@Test
fun test10_deleteBluePrint() {
- webTestClient.delete().uri("/api/v1/blueprint-model/${bp!!.id}")
+// webTestClient.delete().uri("/api/v1/blueprint-model/${bp!!.id}")
+// .header("Authorization", "Basic " + Base64Utils
+// .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
+// .exchange()
+// .expectStatus().is2xxSuccessful
+
+ webTestClient.delete().uri("/api/v1/blueprint-model/name/${bp!!.artifactName}/version/${bp!!.artifactVersion}")
.header("Authorization", "Basic " + Base64Utils
.encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
.exchange()
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt
index e34238eb9..599987361 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt
@@ -58,8 +58,8 @@ class BluePrintEnhancerUtilsTest {
val enhanceId = UUID.randomUUID().toString()
val blueprintArchiveLocation = normalizedPathName(blueprintArchivePath, enhanceId)
val blueprintEnrichmentLocation = normalizedPathName(blueprintEnrichmentPath, enhanceId)
- BluePrintEnhancerUtils.decompressFilePart(filePart, blueprintArchiveLocation, blueprintEnrichmentLocation)
- BluePrintEnhancerUtils.compressToFilePart(blueprintEnrichmentLocation, blueprintArchiveLocation)
+ BluePrintEnhancerUtils.copyFilePartToEnhanceDir(filePart, blueprintArchiveLocation, blueprintEnrichmentLocation)
+ BluePrintEnhancerUtils.compressEnhanceDirAndReturnFilePart(blueprintEnrichmentLocation, blueprintArchiveLocation)
}
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/test-cba.zip b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/test-cba.zip
new file mode 100644
index 000000000..785ec6c00
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/test-cba.zip
Binary files differ
diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml
index 66fdd95ae..a1d716110 100644
--- a/ms/blueprintsprocessor/modules/inbounds/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>inbounds</artifactId>
@@ -37,6 +37,10 @@
</modules>
<dependencies>
<dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>workflow-service</artifactId>
</dependency>
@@ -82,6 +86,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-testing</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
index cf8c61ac7..da233b882 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>inbounds</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>resource-api</artifactId>
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/application-test.properties
index 7d74687ab..cb7837ba4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/application-test.properties
@@ -1,33 +1,33 @@
-#
-# 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.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.username=sa
-blueprintsprocessor.db.password=
-blueprintsprocessor.db.driverClassName=org.h2.Driver
-blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.hibernateDDLAuto=update
-blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
-# Controller Blueprints Core Configuration
-blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
-blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
-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
+#
+# 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.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
+# Controller Blueprints Core Configuration
+blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
+blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
+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/resource-api/src/test/resources/logback.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/logback.xml
index 56b077424..c546502cf 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/logback.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/logback.xml
@@ -1,35 +1,35 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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.cds.blueprintsprocessor" level="info"/>
-
- <root level="info">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ 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.cds.blueprintsprocessor" level="info"/>
+
+ <root level="info">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
index 2c241cc4f..b5cac581a 100755
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>inbounds</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>selfservice-api</artifactId>
@@ -33,16 +33,9 @@
<dependencies>
<dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <artifactId>blueprint-proto</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.onap.ccsdk.cds.components</groupId>
- <artifactId>proto-definition</artifactId>
- <version>${project.version}</version>
- </dependency>
-
<dependency>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>blueprint-core</artifactId>
@@ -51,10 +44,6 @@
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>blueprint-validation</artifactId>
</dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-testing</artifactId>
- </dependency>
<!-- For Message libraries -->
<dependency>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
deleted file mode 100644
index 0116680cf..000000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
+++ /dev/null
@@ -1,152 +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.cds.blueprintsprocessor.selfservice.api
-
-import io.grpc.StatusException
-import io.grpc.stub.StreamObserver
-import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.currentTimestamp
-import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
-import org.onap.ccsdk.cds.controllerblueprints.common.api.Status
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
-import org.onap.ccsdk.cds.controllerblueprints.management.api.*
-import org.slf4j.LoggerFactory
-import org.springframework.security.access.prepost.PreAuthorize
-import org.springframework.stereotype.Service
-import java.io.File
-import java.util.*
-
-// TODO("move to management-api or designer-api module")
-@Service
-open class BluePrintManagementGRPCHandler(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val blueprintsProcessorCatalogService: BluePrintCatalogService)
- : BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase() {
-
- private val log = LoggerFactory.getLogger(BluePrintManagementGRPCHandler::class.java)
-
- @PreAuthorize("hasRole('USER')")
- override fun uploadBlueprint(request: BluePrintUploadInput, responseObserver:
- StreamObserver<BluePrintManagementOutput>) {
- runBlocking {
-
- log.info("request(${request.commonHeader.requestId})")
- val uploadId = UUID.randomUUID().toString()
- val blueprintArchive = normalizedPathName(bluePrintLoadConfiguration.blueprintArchivePath, uploadId)
- val blueprintWorking = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, uploadId)
- try {
- val cbaFile = normalizedFile(blueprintArchive, "cba.zip")
-
- saveToDisk(request, cbaFile)
-
- val uploadAction = request.actionIdentifiers?.actionName.emptyTONull()
- ?: UploadAction.DRAFT.toString()
-
- when (uploadAction) {
- UploadAction.DRAFT.toString() -> {
- val blueprintId = blueprintsProcessorCatalogService.saveToDatabase(uploadId, cbaFile, false)
- responseObserver.onNext(successStatus("Successfully uploaded CBA($blueprintId)...",
- request.commonHeader))
- }
- UploadAction.PUBLISH.toString() -> {
- val blueprintId = blueprintsProcessorCatalogService.saveToDatabase(uploadId, cbaFile, true)
- responseObserver.onNext(successStatus("Successfully uploaded CBA($blueprintId)...",
- request.commonHeader))
- }
- UploadAction.VALIDATE.toString() -> {
- //TODO("Not Implemented")
- responseObserver.onError(failStatus("Not Implemented",
- BluePrintProcessorException("Not Implemented")))
- }
- UploadAction.ENRICH.toString() -> {
- //TODO("Not Implemented")
- responseObserver.onError(failStatus("Not Implemented",
- BluePrintProcessorException("Not Implemented")))
- }
- }
- responseObserver.onCompleted()
- } catch (e: Exception) {
- responseObserver.onError(failStatus("request(${request.commonHeader.requestId}): Failed to upload CBA", e))
- } finally {
- // Clean blueprint script cache
- val cacheKey = BluePrintFileUtils
- .compileCacheKey(normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, uploadId))
- BluePrintCompileCache.cleanClassLoader(cacheKey)
- deleteNBDir(blueprintArchive)
- deleteNBDir(blueprintWorking)
- }
- }
- }
-
- @PreAuthorize("hasRole('USER')")
- override fun removeBlueprint(request: BluePrintRemoveInput, responseObserver:
- StreamObserver<BluePrintManagementOutput>) {
-
- runBlocking {
- val blueprintName = request.blueprintName
- val blueprintVersion = request.blueprintVersion
- val blueprint = "blueprint $blueprintName:$blueprintVersion"
-
- log.info("request(${request.commonHeader.requestId}): Received delete $blueprint")
-
-
- try {
- blueprintsProcessorCatalogService.deleteFromDatabase(blueprintName, blueprintVersion)
- responseObserver.onNext(successStatus("Successfully deleted $blueprint", request.commonHeader))
- responseObserver.onCompleted()
- } catch (e: Exception) {
- responseObserver.onError(failStatus("request(${request.commonHeader.requestId}): Failed to delete $blueprint", e))
- }
- }
- }
-
- private fun saveToDisk(request: BluePrintUploadInput, cbaFile: File) {
- log.info("request(${request.commonHeader.requestId}): Writing CBA File under :${cbaFile.absolutePath}")
-
- // Recreate Folder
- cbaFile.parentFile.reCreateDirs()
-
- // Write the File
- cbaFile.writeBytes(request.fileChunk.chunk.toByteArray()).apply {
- log.info("request(${request.commonHeader.requestId}): CBA file(${cbaFile.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/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
index d48f0c7e4..4441d2b4b 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
@@ -27,11 +27,9 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.determineHttpStatusCode
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
-import org.springframework.http.codec.multipart.FilePart
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
@@ -53,30 +51,6 @@ open class ExecutionServiceController {
"Success".asJsonPrimitive()
}
- @PostMapping(path = ["/upload"], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
- @ResponseBody
- @PreAuthorize("hasRole('USER')")
- @ApiOperation(value = "Upload a CBA",
- notes = "Upload the CBA package. This will also run validation on the CBA.",
- produces = MediaType.APPLICATION_JSON_VALUE)
- fun upload(@ApiParam(value = "The ZIP file containing the overall CBA package.", required = true)
- @RequestPart("file") filePart: FilePart): JsonNode = runBlocking {
- val uploadId = executionServiceHandler.upload(filePart)
- """{"upload-id" : "$uploadId"}""".asJsonType()
- }
-
- @DeleteMapping("/name/{name}/version/{version}")
- @ApiOperation(value = "Delete a CBA",
- notes = "Delete the CBA package identified by its name and version.",
- produces = MediaType.APPLICATION_JSON_VALUE)
- @PreAuthorize("hasRole('USER')")
- fun deleteBlueprint(@ApiParam(value = "Name of the CBA.", required = true)
- @PathVariable(value = "name") name: String,
- @ApiParam(value = "Version of the CBA.", required = true)
- @PathVariable(value = "version") version: String) = runBlocking {
- executionServiceHandler.remove(name, version)
- }
-
@RequestMapping(path = ["/process"], method = [RequestMethod.POST], produces = [MediaType.APPLICATION_JSON_VALUE])
@ApiOperation(value = "Execute a CBA workflow (action)",
notes = "Execute the appropriate CBA's action based on the ExecutionServiceInput object passed as input.",
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
index 2f8878034..20af589a1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
@@ -21,24 +21,16 @@ import io.grpc.stub.StreamObserver
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
-import kotlinx.coroutines.reactive.awaitSingle
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.toProto
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
-import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.slf4j.LoggerFactory
-import org.springframework.http.codec.multipart.FilePart
import org.springframework.stereotype.Service
-import java.io.File
-import java.io.IOException
-import java.util.*
import java.util.stream.Collectors
@Service
@@ -49,37 +41,6 @@ class ExecutionServiceHandler(private val bluePrintLoadConfiguration: BluePrintL
private val log = LoggerFactory.getLogger(ExecutionServiceHandler::class.toString())
- //TODO("Remove from self service api and move to designer api module")
- suspend fun upload(filePart: FilePart): String {
- val saveId = UUID.randomUUID().toString()
- val blueprintArchive = normalizedPathName(bluePrintLoadConfiguration.blueprintArchivePath, saveId)
- val blueprintWorking = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, saveId)
- try {
-
- val compressedFile = normalizedFile(blueprintArchive, "cba.zip")
- compressedFile.parentFile.reCreateNBDirs()
- // Copy the File Part to Local File
- copyFromFilePart(filePart, compressedFile)
- // Save the Copied file to Database
- return blueprintsProcessorCatalogService.saveToDatabase(saveId, compressedFile, true)
- } catch (e: IOException) {
- throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- "Error in Upload CBA: ${e.message}", e)
- } finally {
- // Clean blueprint script cache
- val cacheKey = BluePrintFileUtils
- .compileCacheKey(normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath,saveId))
- BluePrintCompileCache.cleanClassLoader(cacheKey)
- deleteNBDir(blueprintArchive)
- deleteNBDir(blueprintWorking)
- }
- }
-
- //TODO("Remove from self service api and move to designer api module")
- suspend fun remove(name: String, version: String) {
- blueprintsProcessorCatalogService.deleteFromDatabase(name, version)
- }
-
suspend fun process(executionServiceInput: ExecutionServiceInput,
responseObserver: StreamObserver<org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput>) {
when {
@@ -97,8 +58,8 @@ class ExecutionServiceHandler(private val bluePrintLoadConfiguration: BluePrintL
responseObserver.onCompleted()
}
else -> responseObserver.onNext(response(executionServiceInput,
- "Failed to process request, 'actionIdentifiers.mode' not specified. Valid value are: 'sync' or 'async'.",
- true).toProto());
+ "Failed to process request, 'actionIdentifiers.mode' not specified. Valid value are: 'sync' or 'async'.",
+ true).toProto());
}
}
@@ -115,7 +76,7 @@ class ExecutionServiceHandler(private val bluePrintLoadConfiguration: BluePrintL
val blueprintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(requestId, basePath.toString())
val output = bluePrintWorkflowExecutionService.executeBluePrintWorkflow(blueprintRuntimeService,
- executionServiceInput, hashMapOf())
+ executionServiceInput, hashMapOf())
val errors = blueprintRuntimeService.getBluePrintError().errors
if (errors.isNotEmpty()) {
@@ -129,12 +90,6 @@ class ExecutionServiceHandler(private val bluePrintLoadConfiguration: BluePrintL
}
}
- private suspend fun copyFromFilePart(filePart: FilePart, targetFile: File): File {
- return filePart.transferTo(targetFile)
- .thenReturn(targetFile)
- .awaitSingle()
- }
-
private fun setErrorStatus(errorMessage: String, status: Status) {
status.errorMessage = errorMessage
status.eventType = EventType.EVENT_COMPONENT_FAILURE.name
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt
index 2cf1c1dd0..16fe36cfe 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt
@@ -22,20 +22,10 @@ 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.*
const val INTERNAL_SERVER_ERROR_HTTP_STATUS_CODE = 500
-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 {
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
index fc6c4890c..e1a498a6f 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
@@ -1,5 +1,6 @@
/*
- * Copyright © 2019 Bell Canada
+ * 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");
@@ -16,85 +17,93 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
-import kotlinx.coroutines.reactive.awaitSingle
import kotlinx.coroutines.runBlocking
-import org.junit.After
-import org.junit.Before
+import org.junit.Test
import org.junit.runner.RunWith
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
-import org.slf4j.LoggerFactory
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
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.annotation.DirtiesContext
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.test.web.reactive.server.returnResult
import org.springframework.web.reactive.function.BodyInserters
import java.io.File
-import java.nio.file.Files
-import java.nio.file.Paths
-import kotlin.test.Test
+import java.util.*
+import kotlin.test.AfterTest
+import kotlin.test.BeforeTest
+import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
-@EnableAutoConfiguration
-@ContextConfiguration(classes = [ExecutionServiceControllerTest::class, SecurityProperties::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-@DirtiesContext
@WebFluxTest
+@ContextConfiguration(classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class,
+ BluePrintCatalogService::class, SecurityProperties::class])
+@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
+ "org.onap.ccsdk.cds.controllerblueprints"])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
class ExecutionServiceControllerTest {
- private val log = LoggerFactory.getLogger(ExecutionServiceControllerTest::class.java)!!
-
+ @Autowired
+ lateinit var blueprintsProcessorCatalogService: BluePrintCatalogService
@Autowired
lateinit var webTestClient: WebTestClient
- var event: ExecutionServiceInput? = null
-
- @Before
- fun setup() {
+ @BeforeTest
+ fun init() {
deleteDir("target", "blueprints")
}
- @After
- fun clean() {
+ @AfterTest
+ fun cleanDir() {
deleteDir("target", "blueprints")
}
@Test
- fun uploadBluePrint() {
+ fun `test rest process`() {
runBlocking {
- val body = MultipartBodyBuilder().apply {
- part("file", object : ByteArrayResource(Files.readAllBytes(loadCbaArchive().toPath())) {
- override fun getFilename(): String {
- return "test-cba.zip"
- }
- })
- }.build()
+ blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
+
+ val executionServiceInput = JacksonUtils
+ .readValueFromClassPathFile("execution-input/default-input.json",
+ ExecutionServiceInput::class.java)!!
webTestClient
.post()
- .uri("/api/v1/execution-service/upload")
- .body(BodyInserters.fromMultipartData(body))
+ .uri("/api/v1/execution-service/process")
+ .body(BodyInserters.fromObject(executionServiceInput))
.exchange()
.expectStatus().isOk
- .returnResult<String>()
- .responseBody
- .awaitSingle()
}
}
- private fun loadCbaArchive(): File {
- return Paths.get("./src/test/resources/cba-for-kafka-integration_enriched.zip").toFile()
- }
-}
+ @Test
+ fun `rest resource process should return status code 500 in case of server-side exception`() {
+ runBlocking {
+ blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
+
+ val executionServiceInput = JacksonUtils
+ .readValueFromClassPathFile("execution-input/faulty-input.json",
+ ExecutionServiceInput::class.java)!!
+ webTestClient
+ .post()
+ .uri("/api/v1/execution-service/process")
+ .body(BodyInserters.fromObject(executionServiceInput))
+ .exchange()
+ .expectStatus().is5xxServerError
+ }
+ }
+ private fun loadTestCbaFile(): File {
+ val testCbaFile = normalizedFile("./src/test/resources/test-cba.zip")
+ assertTrue(testCbaFile.exists(), "couldn't get file ${testCbaFile.absolutePath}")
+ return testCbaFile
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
deleted file mode 100644
index a480b115b..000000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
+++ /dev/null
@@ -1,139 +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.cds.blueprintsprocessor.selfservice.api
-
-import kotlinx.coroutines.reactive.awaitSingle
-import kotlinx.coroutines.runBlocking
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.cds.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.test.web.reactive.server.returnResult
-import org.springframework.web.reactive.function.BodyInserters
-import java.io.File
-import java.nio.file.Files
-import java.nio.file.Paths
-import java.util.*
-import kotlin.test.AfterTest
-import kotlin.test.BeforeTest
-import kotlin.test.assertTrue
-
-@RunWith(SpringRunner::class)
-@WebFluxTest
-@ContextConfiguration(classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
- "org.onap.ccsdk.cds.controllerblueprints"])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-class ExecutionServiceHandlerTest {
-
- @Autowired
- lateinit var blueprintsProcessorCatalogService: BluePrintCatalogService
- @Autowired
- lateinit var webTestClient: WebTestClient
-
- @BeforeTest
- fun init() {
- deleteDir("target", "blueprints")
- }
-
- @AfterTest
- fun cleanDir() {
- deleteDir("target", "blueprints")
- }
-
-
- @Test
- fun `test rest upload blueprint`() {
- runBlocking {
- val body = MultipartBodyBuilder().apply {
- part("file", object : ByteArrayResource(Files.readAllBytes(loadTestCbaFile().toPath())) {
- override fun getFilename(): String {
- return "test-cba.zip"
- }
- })
- }.build()
-
- webTestClient
- .post()
- .uri("/api/v1/execution-service/upload")
- .body(BodyInserters.fromMultipartData(body))
- .exchange()
- .expectStatus().isOk
- .returnResult<String>()
- .responseBody
- .awaitSingle()
- }
-
- }
-
- @Test
- fun `test rest process`() {
- runBlocking {
- blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
-
- 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
- }
- }
-
- @Test
- fun `rest resource process should return status code 500 in case of server-side exception`() {
- runBlocking {
- blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
-
- val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile("execution-input/faulty-input.json",
- ExecutionServiceInput::class.java)!!
-
- webTestClient
- .post()
- .uri("/api/v1/execution-service/process")
- .body(BodyInserters.fromObject(executionServiceInput))
- .exchange()
- .expectStatus().is5xxServerError
- }
- }
-
- private fun loadTestCbaFile(): File {
- val testCbaFile = Paths.get("./src/test/resources/test-cba.zip").toFile()
- assertTrue(testCbaFile.exists(), "couldn't get file ${testCbaFile.absolutePath}")
- return testCbaFile
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/cba-for-kafka-integration_enriched.zip b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/cba-for-kafka-integration_enriched.zip
deleted file mode 100755
index 9581191d7..000000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/cba-for-kafka-integration_enriched.zip
+++ /dev/null
Binary files differ
diff --git a/ms/blueprintsprocessor/modules/outbounds/pom.xml b/ms/blueprintsprocessor/modules/outbounds/pom.xml
index 34b6912ac..34eba8366 100644
--- a/ms/blueprintsprocessor/modules/outbounds/pom.xml
+++ b/ms/blueprintsprocessor/modules/outbounds/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>outbounds</artifactId>
diff --git a/ms/blueprintsprocessor/modules/pom.xml b/ms/blueprintsprocessor/modules/pom.xml
index 86a581406..ea39e2aa9 100644
--- a/ms/blueprintsprocessor/modules/pom.xml
+++ b/ms/blueprintsprocessor/modules/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
index c232f059b..784906b4e 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>services</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>execution-service</artifactId>
@@ -57,10 +57,6 @@
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>resource-dict</artifactId>
</dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.components</groupId>
- <artifactId>proto-definition</artifactId>
- </dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
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
index cd6fac128..52a8a4f84 100644
--- 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
@@ -1,18 +1,18 @@
-{
- "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"
- ]
-}
+{
+ "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
index b28ac5a29..27eec8275 100644
--- 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
@@ -1,20 +1,20 @@
-{
- "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": {
- }
-}
+{
+ "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
index 6b9cb2e48..0a5f9b63f 100755
--- a/ms/blueprintsprocessor/modules/services/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>services</artifactId>
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
index 1a621f4af..c3effa5d3 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>services</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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
index 56e662286..32459375e 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml
@@ -1,35 +1,35 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<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.cds.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
+<!--
+ ~ 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.cds.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
index c748682a5..a8eb0d0e0 100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>blueprintsprocessor</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
@@ -248,11 +248,7 @@
<artifactId>protobuf-java-util</artifactId>
<version>${protobuff.java.utils.version}</version>
</dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.components</groupId>
- <artifactId>proto-definition</artifactId>
- <version>${project.version}</version>
- </dependency>
+
<!-- Adaptors -->
<dependency>
@@ -466,6 +462,11 @@
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <artifactId>blueprint-proto</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>blueprint-validation</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/ms/blueprintsprocessor/pom.xml b/ms/blueprintsprocessor/pom.xml
index abe737fee..7714d856e 100755
--- a/ms/blueprintsprocessor/pom.xml
+++ b/ms/blueprintsprocessor/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ms</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>blueprintsprocessor</artifactId>
diff --git a/ms/command-executor/pom.xml b/ms/command-executor/pom.xml
index 5a73fa0af..5861912ca 100755
--- a/ms/command-executor/pom.xml
+++ b/ms/command-executor/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ms</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>command-executor</artifactId>
diff --git a/ms/controllerblueprints/.gitignore b/ms/controllerblueprints/.gitignore
deleted file mode 100644
index 4b5c1c0a4..000000000
--- 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
index b96dbf71a..0cb7a131b 100755
--- a/ms/controllerblueprints/README.md
+++ b/ms/controllerblueprints/README.md
@@ -1,13 +1,13 @@
-Application VM Arguments :
-
--DappName=ControllerBluePrints
--Dms_name=org.onap.ccsdk.cds.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
-
+Application VM Arguments :
+
+-DappName=ControllerBluePrints
+-Dms_name=org.onap.ccsdk.cds.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/modules/blueprint-core/pom.xml b/ms/controllerblueprints/modules/blueprint-core/pom.xml
index 1c1385b9c..1cb912c1b 100644
--- a/ms/controllerblueprints/modules/blueprint-core/pom.xml
+++ b/ms/controllerblueprints/modules/blueprint-core/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>modules</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>blueprint-core</artifactId>
<name>Controller Blueprints Core</name>
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
index fa6b0ab97..f90e27f4d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
@@ -39,6 +39,10 @@ object BluePrintCompileCache {
fun cleanClassLoader(key: String) {
if(hasClassLoader(key)){
+ // Make sure to close all classloader loaded resources before we let go of it.
+ // This fixes a Delete failure message on filesystem that keeps locks on opened jars;
+ // like Windows and NFS.
+ classLoaderCache.get(key).close()
classLoaderCache.invalidate(key)
log.info("Cleaned compiled cache($key)")
}else{
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt
new file mode 100644
index 000000000..e01ba805d
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt
@@ -0,0 +1,27 @@
+/*
+ * 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.cds.controllerblueprints.core.utils
+
+import java.time.LocalDateTime
+import java.time.ZoneId
+import java.time.format.DateTimeFormatter
+
+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)
+}
diff --git a/ms/controllerblueprints/modules/blueprint-proto/krotoPlusConfig.asciipb b/ms/controllerblueprints/modules/blueprint-proto/krotoPlusConfig.asciipb
new file mode 100644
index 000000000..30255b96d
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-proto/krotoPlusConfig.asciipb
@@ -0,0 +1,6 @@
+grpc_coroutines {
+ filter { exclude_path: "google/*" }
+}
+grpc_stub_exts {
+ support_coroutines: true
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-proto/pom.xml b/ms/controllerblueprints/modules/blueprint-proto/pom.xml
new file mode 100644
index 000000000..7d4d60028
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-proto/pom.xml
@@ -0,0 +1,113 @@
+<?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>
+ <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <artifactId>modules</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>blueprint-proto</artifactId>
+ <name>Controller Blueprints Proto</name>
+ <description>Controller Blueprints Proto</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.github.marcoferrer.krotoplus</groupId>
+ <artifactId>kroto-plus-coroutines</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ <version>1.6.2</version>
+ </extension>
+ </extensions>
+ <plugins>
+ <plugin>
+ <groupId>org.xolstice.maven.plugins</groupId>
+ <artifactId>protobuf-maven-plugin</artifactId>
+ <version>0.6.1</version>
+ <configuration>
+ <protocArtifact>
+ com.google.protobuf:protoc:3.6.1:exe:${os.detected.classifier}
+ </protocArtifact>
+ <protoSourceRoot>${project.basedir}/../../../../components/model-catalog/proto-definition/proto
+ </protoSourceRoot>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>grpc-java</id>
+ <goals>
+ <goal>compile-custom</goal>
+ </goals>
+ <configuration>
+ <pluginId>grpc-java</pluginId>
+ <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
+ </pluginArtifact>
+ </configuration>
+ </execution>
+<!-- <execution>-->
+<!-- <id>grpc-coroutines</id>-->
+<!-- <goals>-->
+<!-- <goal>compile-custom</goal>-->
+<!-- </goals>-->
+<!-- <configuration>-->
+<!-- <pluginId>kroto-plus</pluginId>-->
+<!-- <pluginArtifact>-->
+<!-- com.github.marcoferrer.krotoplus:protoc-gen-kroto-plus:${kroto-plus.version}:jar:jvm8-->
+<!-- </pluginArtifact>-->
+<!-- <pluginParameter>ConfigPath=${project.basedir}/krotoPlusConfig.asciipb</pluginParameter>-->
+<!-- </configuration>-->
+<!-- </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}/target/generated-sources/protobuf/java</sourceDir>
+ <sourceDir>${project.basedir}/target/generated-sources/protobuf/grpc-java</sourceDir>
+<!-- <sourceDir>${project.basedir}/target/generated-sources/protobuf/kroto-plus</sourceDir>-->
+ </sourceDirs>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ms/controllerblueprints/modules/blueprint-validation/pom.xml b/ms/controllerblueprints/modules/blueprint-validation/pom.xml
index 57865fcf0..04c751127 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/pom.xml
+++ b/ms/controllerblueprints/modules/blueprint-validation/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>modules</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>blueprint-validation</artifactId>
<name>Controller Blueprints Validation Service</name>
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
index 4bc962f04..6cb4ea80a 100644
--- a/ms/controllerblueprints/modules/pom.xml
+++ b/ms/controllerblueprints/modules/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>parent</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>modules</artifactId>
@@ -31,6 +31,7 @@
<module>blueprint-core</module>
<module>resource-dict</module>
<module>blueprint-validation</module>
+ <module>blueprint-proto</module>
</modules>
<dependencies>
diff --git a/ms/controllerblueprints/modules/resource-dict/pom.xml b/ms/controllerblueprints/modules/resource-dict/pom.xml
index b210b100b..4ee4f91a0 100644
--- a/ms/controllerblueprints/modules/resource-dict/pom.xml
+++ b/ms/controllerblueprints/modules/resource-dict/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>modules</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>resource-dict</artifactId>
<name>Controller Blueprints Resource Dictionary</name>
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
index 3021c4032..86a721149 100644
--- a/ms/controllerblueprints/parent/pom.xml
+++ b/ms/controllerblueprints/parent/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>controllerblueprints</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>parent</artifactId>
@@ -30,6 +30,7 @@
<properties>
<eelf.version>1.0.0</eelf.version>
<guava.version>27.0.1-jre</guava.version>
+ <kroto-plus.version>0.5.0</kroto-plus.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>
@@ -200,6 +201,11 @@
<artifactId>protobuf-java-util</artifactId>
<version>${protobuff.java.utils.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.github.marcoferrer.krotoplus</groupId>
+ <artifactId>kroto-plus-coroutines</artifactId>
+ <version>${kroto-plus.version}</version>
+ </dependency>
<!-- Database -->
<dependency>
diff --git a/ms/controllerblueprints/pom.xml b/ms/controllerblueprints/pom.xml
index 909dfa4fe..8abb36e67 100644
--- a/ms/controllerblueprints/pom.xml
+++ b/ms/controllerblueprints/pom.xml
@@ -18,13 +18,13 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ms</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>controllerblueprints</artifactId>
<name>Controller Blueprints Root</name>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<properties>
<service.name>ControllerBlueprints</service.name>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/ms/pom.xml b/ms/pom.xml
index 973222c1a..ba5a5b0c7 100644
--- a/ms/pom.xml
+++ b/ms/pom.xml
@@ -20,12 +20,12 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>parent</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>ms</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Micro-services Root</name>
diff --git a/ms/sdclistener/application/pom.xml b/ms/sdclistener/application/pom.xml
index eb0323bd3..7b12e14ea 100644
--- a/ms/sdclistener/application/pom.xml
+++ b/ms/sdclistener/application/pom.xml
@@ -19,13 +19,13 @@
<parent>
<groupId>org.onap.ccsdk.cds.sdclistener</groupId>
<artifactId>parent</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>application</artifactId>
<packaging>jar</packaging>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<name>SDC Listener Application</name>
<properties>
@@ -90,8 +90,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.components</groupId>
- <artifactId>proto-definition</artifactId>
+ <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <artifactId>blueprint-proto</artifactId>
</dependency>
<dependency>
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
index 77f3ea536..1937af75c 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
@@ -15,30 +15,16 @@
*/
package org.onap.ccsdk.cds.sdclistener.service;
-import static java.lang.String.format;
-import static org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus.NotificationType.SDC_LISTENER_COMPONENT;
-import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_ERROR;
-import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK;
import com.google.protobuf.ByteString;
import io.grpc.ManagedChannel;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.regex.Pattern;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
import org.apache.commons.io.FileUtils;
import org.apache.tomcat.util.http.fileupload.IOUtils;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput;
import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk;
+import org.onap.ccsdk.cds.controllerblueprints.management.api.UploadAction;
import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor;
import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
import org.onap.ccsdk.cds.sdclistener.handler.BluePrintProcesssorHandler;
@@ -52,6 +38,22 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.UUID;
+import java.util.regex.Pattern;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import static java.lang.String.format;
+import static org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus.NotificationType.SDC_LISTENER_COMPONENT;
+import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_ERROR;
+import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK;
+
@Component
@ConfigurationProperties("listenerservice")
public class ListenerServiceImpl implements ListenerService {
@@ -216,6 +218,13 @@ public class ListenerServiceImpl implements ListenerService {
FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build();
FileUtil.deleteFile(file, path);
return BluePrintUploadInput.newBuilder()
+ .setCommonHeader(CommonHeader.newBuilder()
+ .setRequestId(UUID.randomUUID().toString())
+ .setSubRequestId(UUID.randomUUID().toString())
+ .setOriginatorId("SDC-LISTENER")
+ .build())
+ .setActionIdentifiers(ActionIdentifiers.newBuilder()
+ .setActionName(UploadAction.PUBLISH.toString()).build())
.setFileChunk(fileChunk)
.build();
}
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java
index ee20f8771..7a92c0040 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java
@@ -15,33 +15,39 @@
*/
package org.onap.ccsdk.cds.sdclistener.handler;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import com.google.protobuf.ByteString;
import io.grpc.ManagedChannel;
import io.grpc.inprocess.InProcessChannelBuilder;
import io.grpc.inprocess.InProcessServerBuilder;
import io.grpc.stub.StreamObserver;
import io.grpc.testing.GrpcCleanupRule;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Paths;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput;
import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase;
import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput;
import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk;
+import org.onap.ccsdk.cds.controllerblueprints.management.api.UploadAction;
+import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor;
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;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
@RunWith(SpringRunner.class)
@EnableConfigurationProperties({BluePrintProcesssorHandler.class, SdcListenerAuthClientInterceptor.class})
@SpringBootTest(classes = {BluePrintProcessorHandlerTest.class})
@@ -66,7 +72,7 @@ public class BluePrintProcessorHandlerTest {
final BluePrintManagementServiceImplBase serviceImplBase = new BluePrintManagementServiceImplBase() {
@Override
public void uploadBlueprint(BluePrintUploadInput request,
- StreamObserver<BluePrintManagementOutput> responseObserver) {
+ StreamObserver<BluePrintManagementOutput> responseObserver) {
responseObserver.onNext(getBluePrintManagementOutput());
responseObserver.onCompleted();
}
@@ -77,7 +83,7 @@ public class BluePrintProcessorHandlerTest {
// Create a server, add service, start, and register.
grpcCleanup.register(
- InProcessServerBuilder.forName(serverName).addService(serviceImplBase).directExecutor().build().start());
+ InProcessServerBuilder.forName(serverName).addService(serviceImplBase).directExecutor().build().start());
// Create a client channel.
channel = grpcCleanup.register(InProcessChannelBuilder.forName(serverName).directExecutor().build());
@@ -101,7 +107,16 @@ public class BluePrintProcessorHandlerTest {
byte[] bytes = FileUtils.readFileToByteArray(file);
FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build();
- return BluePrintUploadInput.newBuilder().setFileChunk(fileChunk).build();
+
+ return BluePrintUploadInput.newBuilder()
+ .setCommonHeader(CommonHeader.newBuilder()
+ .setRequestId(UUID.randomUUID().toString())
+ .setSubRequestId(UUID.randomUUID().toString())
+ .setOriginatorId("SDC-LISTENER")
+ .build())
+ .setActionIdentifiers(ActionIdentifiers.newBuilder()
+ .setActionName(UploadAction.PUBLISH.toString()).build())
+ .setFileChunk(fileChunk).build();
}
private BluePrintManagementOutput getBluePrintManagementOutput() {
diff --git a/ms/sdclistener/distribution/pom.xml b/ms/sdclistener/distribution/pom.xml
index be68cd218..8f0120fa5 100755
--- a/ms/sdclistener/distribution/pom.xml
+++ b/ms/sdclistener/distribution/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.sdclistener</groupId>
<artifactId>parent</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>distribution</artifactId>
diff --git a/ms/sdclistener/parent/pom.xml b/ms/sdclistener/parent/pom.xml
index 0648ed76f..05bfdeff4 100755
--- a/ms/sdclistener/parent/pom.xml
+++ b/ms/sdclistener/parent/pom.xml
@@ -16,12 +16,13 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>sdclistener</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.cds.sdclistener</groupId>
<artifactId>parent</artifactId>
@@ -110,9 +111,15 @@
<version>${protobuff.java.utils.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.components</groupId>
- <artifactId>proto-definition</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <artifactId>blueprint-proto</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
diff --git a/ms/sdclistener/pom.xml b/ms/sdclistener/pom.xml
index b3113889a..42c6a1acd 100644
--- a/ms/sdclistener/pom.xml
+++ b/ms/sdclistener/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ms</artifactId>
- <version>0.6.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>