diff options
Diffstat (limited to 'ms/blueprintsprocessor')
63 files changed, 1430 insertions, 758 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 64452a061..a67b10d4a 100755 --- a/ms/blueprintsprocessor/application/pom.xml +++ b/ms/blueprintsprocessor/application/pom.xml @@ -70,6 +70,11 @@ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>configs-api</artifactId> </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>health-api</artifactId> + </dependency> + <!-- Functions --> <dependency> diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.java index 82693c4fd..ce802b7b5 100644 --- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.java +++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.java @@ -28,7 +28,6 @@ import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import java.util.Collections; -import springfox.documentation.swagger2.annotations.EnableSwagger2WebFlux; /** * SwaggerConfig @@ -36,7 +35,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2WebFlux; * @author Brinda Santh 8/13/2018 */ @Configuration -@EnableSwagger2WebFlux +//@EnableSwagger2WebFlux public class SwaggerConfig { @Bean diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties index 2fd595102..3ae9414a9 100755 --- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties +++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties @@ -26,7 +26,7 @@ server.port=8081 ### 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,vault-data=source-rest # Controller Blueprints Core Configuration blueprintsprocessor.blueprintDeployPath=blueprints/deploy diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties index 37eb87c13..8fe00e709 100755 --- a/ms/blueprintsprocessor/application/src/main/resources/application.properties +++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties @@ -16,7 +16,7 @@ # Web server config ### START -Controller Blueprints Properties # Load Resource Source Mappings -resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability,rest=source-rest +resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability,rest=source-rest,vault-data=source-rest # 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/resources/application.properties b/ms/blueprintsprocessor/application/src/test/resources/application.properties index 766498fdc..d56e9582c 100644 --- a/ms/blueprintsprocessor/application/src/test/resources/application.properties +++ b/ms/blueprintsprocessor/application/src/test/resources/application.properties @@ -77,3 +77,7 @@ blueprintsprocessor.messageclient.self-service-api.consumerTopic=receiver.t blueprintsprocessor.messageclient.self-service-api.groupId=receiver-id blueprintsprocessor.messageclient.self-service-api.clientId=default-client-id blueprintsprocessor.messageclient.self-service-api.kafkaEnable=false + + +endpoints.user.name=ccsdkapps +endpoints.user.password=ccsdkapps 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/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/distribution/src/main/docker/startService.sh b/ms/blueprintsprocessor/distribution/src/main/docker/startService.sh index d1e09ddc3..14d772e41 100644 --- a/ms/blueprintsprocessor/distribution/src/main/docker/startService.sh +++ b/ms/blueprintsprocessor/distribution/src/main/docker/startService.sh @@ -5,6 +5,6 @@ nodeName=BlueprintsProcessor_1.0.0_$(cat /proc/self/cgroup | grep docker | sed s echo "APP Config HOME : ${APP_CONFIG_HOME}" export APP_HOME=/opt/app/onap -keytool -import -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -alias ONAP -import -file $APP_CONFIG_HOME/ONAP_RootCA.cer +keytool -import -noprompt -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -alias ONAP -import -file $APP_CONFIG_HOME/ONAP_RootCA.cer source /etc/run.source diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml b/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml index 8b59b17f7..9613030cd 100644 --- a/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml +++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml @@ -24,6 +24,7 @@ <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId> <artifactId>ansible-awx-executor</artifactId> + <version>0.7.0-SNAPSHOT</version> <name>Blueprints Processor Function - Ansible AWX Executor</name> <description>Blueprints Processor Function - Ansible Executor</description> 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 89f409a70..b45fdb3f8 100644 --- a/ms/blueprintsprocessor/functions/cli-executor/pom.xml +++ b/ms/blueprintsprocessor/functions/cli-executor/pom.xml @@ -23,6 +23,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId> <artifactId>cli-executor</artifactId> + <version>0.7.0-SNAPSHOT</version> <name>Blueprints Processor Function - CLI Executor</name> <description>Blueprints Processor Function - CLI Executor</description> diff --git a/ms/blueprintsprocessor/functions/netconf-executor/pom.xml b/ms/blueprintsprocessor/functions/netconf-executor/pom.xml index f163c0e1a..a10dfba38 100644 --- a/ms/blueprintsprocessor/functions/netconf-executor/pom.xml +++ b/ms/blueprintsprocessor/functions/netconf-executor/pom.xml @@ -23,6 +23,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId> <artifactId>netconf-executor</artifactId> + <version>0.7.0-SNAPSHOT</version> <name>Blueprints Processor Function - Netconf Executor</name> <description>Blueprints Processor Function - Netconf Executor</description> 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/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 be524fe22..66210f258 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/pom.xml +++ b/ms/blueprintsprocessor/functions/resource-resolution/pom.xml @@ -23,6 +23,7 @@ </parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId> <artifactId>resource-resolution</artifactId> + <version>0.7.0-SNAPSHOT</version> <packaging>jar</packaging> <name>Blueprints Processor Function - Resource Resolution</name> <description>Blueprints Processor Function - Resource Resolution</description> diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt index 769644288..2a9218df3 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt @@ -29,4 +29,5 @@ object ResourceResolutionConstants { const val RESOURCE_RESOLUTION_INPUT_OCCURRENCE = "occurrence" const val RESOURCE_RESOLUTION_INPUT_RESOURCE_ID = "resource-id" const val RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE = "resource-type" + val DATA_DICTIONARY_SECRET_SOURCE_TYPES = arrayOf("vault-data") //Add more secret data dictionary source type here }
\ No newline at end of file diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt index da156096e..6515b11cd 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt @@ -19,6 +19,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.pro import com.fasterxml.jackson.databind.node.MissingNode import com.fasterxml.jackson.databind.node.NullNode +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.RestResourceSource import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils @@ -135,8 +136,12 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS val responseNode = checkNotNull(JacksonUtils.jsonNode(restResponse).at(path)) { "Failed to find path ($path) in response ($restResponse)" } - logger.info("populating value for output mapping ($outputKeyMapping), from json ($responseNode)") - + if (resourceAssignment.dictionarySource in DATA_DICTIONARY_SECRET_SOURCE_TYPES) { + logger.info("populating value for output mapping ($outputKeyMapping), from json (*************)") + } + else { + logger.info("populating value for output mapping ($outputKeyMapping), from json ($responseNode)") + } val parsedResponseNode = ResourceAssignmentUtils.parseResponseNode(responseNode, resourceAssignment, raRuntimeService, outputKeyMapping) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt index 117df1e5b..819246b99 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt @@ -71,9 +71,15 @@ class ResourceAssignmentUtils { try { if (resourceProp.type.isNotEmpty()) { - logger.info("Setting Resource Value ($value) for Resource Name " + - "(${resourceAssignment.name}), definition(${resourceAssignment.dictionaryName}) " + - "of type (${resourceProp.type})") + if (resourceAssignment.dictionarySource in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES) { + logger.info("Setting Resource Value (*********) for Resource Name " + + "(${resourceAssignment.name}) of type (${resourceProp.type})") + } + else { + logger.info("Setting Resource Value ($value) for Resource Name " + + "(${resourceAssignment.name}), definition(${resourceAssignment.dictionaryName}) " + + "of type (${resourceProp.type})") + } setResourceValue(resourceAssignment, raRuntimeService, value) resourceAssignment.updatedDate = Date() resourceAssignment.updatedBy = BluePrintConstants.USER_SYSTEM @@ -122,17 +128,29 @@ class ResourceAssignmentUtils { val mapper = ObjectMapper() val root: ObjectNode = mapper.createObjectNode() + var containsSecret = false assignments.forEach { if (isNotEmpty(it.name) && it.property != null) { val rName = it.name val type = nullToEmpty(it.property?.type).toLowerCase() val value = useDefaultValueIfNull(it, rName) - logger.info("Generating Resource name ($rName), type ($type), value ($value)") + if (it.dictionarySource in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES) { + logger.info("Generating Resource name ($rName), type ($type), value (************)") + containsSecret = true + } + else { + logger.info("Generating Resource name ($rName), type ($type), value ($value)") + } root.set(rName, value) } } result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(root) - logger.info("Generated Resource Param Data ($result)") + if (containsSecret) { + logger.info("Generated Resource Param Data (***********)") + } + else{ + logger.info("Generated Resource Param Data ($result)") + } } catch (e: Exception) { throw BluePrintProcessorException("Resource Assignment is failed with $e.message", e) } @@ -148,7 +166,12 @@ class ResourceAssignmentUtils { val rName = it.name val type = nullToEmpty(it.property?.type).toLowerCase() val value = useDefaultValueIfNull(it, rName) - logger.trace("Generating Resource name ($rName), type ($type), value ($value)") + if (it.dictionarySource in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES) { + logger.trace("Generating Resource name ($rName), type ($type), value (************)") + } + else { + logger.trace("Generating Resource name ($rName), type ($type), value ($value)") + } data[rName] = value } } @@ -200,9 +223,17 @@ class ResourceAssignmentUtils { throw BluePrintProcessorException("Couldn't get data dictionary type for dictionary name (${resourceAssignment.name})") } val type = resourceAssignment.property!!.type + + if (resourceAssignment.dictionarySource in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES) { + logger.info("For template key (${resourceAssignment.name}) setting value as (***************)") + } + else { + logger.info("For template key (${resourceAssignment.name}) setting value as ($responseNode)") + } + return when (type) { in BluePrintTypes.validPrimitiveTypes() -> { - parseResponseNodeForPrimitiveTypes(responseNode, resourceAssignment, outputKeyMapping) + parseResponseNodeForPrimitiveTypes(responseNode, outputKeyMapping) } in BluePrintTypes.validCollectionTypes() -> { // Array Types @@ -219,11 +250,8 @@ class ResourceAssignmentUtils { } } - private fun parseResponseNodeForPrimitiveTypes(responseNode: JsonNode, resourceAssignment: ResourceAssignment, + private fun parseResponseNodeForPrimitiveTypes(responseNode: JsonNode, outputKeyMapping: MutableMap<String, String>): JsonNode { - val dName = resourceAssignment.dictionaryName - logger.info("For template key (${resourceAssignment.name}) setting value as ($responseNode)") - var result: JsonNode? = responseNode if (responseNode.isComplexType()) { val key = outputKeyMapping.keys.firstOrNull() @@ -264,6 +292,7 @@ class ResourceAssignmentUtils { raRuntimeService: ResourceAssignmentRuntimeService, outputKeyMapping: MutableMap<String, String>): JsonNode { val dName = resourceAssignment.dictionaryName + val dSource = resourceAssignment.dictionarySource if ((resourceAssignment.property?.entrySchema?.type).isNullOrEmpty()) { throw BluePrintProcessorException("Couldn't get data type for dictionary type " + "(${resourceAssignment.property!!.type}) and dictionary name ($dName)") @@ -278,13 +307,14 @@ class ResourceAssignmentUtils { val responseArrayNode = responseNode.toList() for (responseSingleJsonNode in responseArrayNode) { val arrayChildNode = parseArrayNodeElementWithOutputKeyMapping(raRuntimeService, responseSingleJsonNode, - outputKeyMapping, entrySchemaType) + outputKeyMapping, entrySchemaType, dSource!!) arrayNode.add(arrayChildNode) } } is ObjectNode -> { val responseArrayNode = responseNode.rootFieldsToMap() - val arrayNodeResult = parseObjectNodeWithOutputKeyMapping(responseArrayNode, outputKeyMapping, entrySchemaType) + val arrayNodeResult = parseObjectNodeWithOutputKeyMapping(responseArrayNode, + outputKeyMapping, entrySchemaType, dSource!!) arrayNode.addAll(arrayNodeResult) } else -> { @@ -312,9 +342,6 @@ class ResourceAssignmentUtils { } } } - - logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)") - return arrayNode } @@ -322,12 +349,13 @@ class ResourceAssignmentUtils { raRuntimeService: ResourceAssignmentRuntimeService, outputKeyMapping: MutableMap<String, String>): JsonNode { val entrySchemaType = resourceAssignment.property!!.type + val dictionarySource = resourceAssignment.dictionarySource!! val dictionaryName = resourceAssignment.dictionaryName!! var result: ObjectNode if (checkOutputKeyMappingInDataTypeProperties(entrySchemaType, outputKeyMapping, raRuntimeService)) { - result = parseArrayNodeElementWithOutputKeyMapping(raRuntimeService, responseNode, outputKeyMapping, entrySchemaType) + result = parseArrayNodeElementWithOutputKeyMapping(raRuntimeService, responseNode, outputKeyMapping, entrySchemaType, dictionarySource!!) } else { val childNode = JacksonUtils.objectMapper.createObjectNode() @@ -340,6 +368,8 @@ class ResourceAssignmentUtils { NullNode.getInstance() } + logKeyValueResolvedResource(it.key, responseKeyValue, entrySchemaType, dictionarySource) + JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, entrySchemaType, childNode) } @@ -354,7 +384,8 @@ class ResourceAssignmentUtils { private fun parseArrayNodeElementWithOutputKeyMapping(raRuntimeService: ResourceAssignmentRuntimeService, responseSingleJsonNode: JsonNode, outputKeyMapping: - MutableMap<String, String>, entrySchemaType: String): ObjectNode { + MutableMap<String, String>, entrySchemaType: String, + dictionarySource: String): ObjectNode { val arrayChildNode = JacksonUtils.objectMapper.createObjectNode() outputKeyMapping.map { @@ -367,31 +398,29 @@ class ResourceAssignmentUtils { val propertyTypeForDataType = ResourceAssignmentUtils .getPropertyType(raRuntimeService, entrySchemaType, it.key) - logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), " + - "type ({$propertyTypeForDataType})") + logKeyValueResolvedResource(it.key, responseKeyValue, propertyTypeForDataType, dictionarySource) JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, propertyTypeForDataType, arrayChildNode) } - return arrayChildNode } private fun parseObjectNodeWithOutputKeyMapping(responseArrayNode: MutableMap<String, JsonNode>, outputKeyMapping: MutableMap<String, String>, - entrySchemaType: String): ArrayNode { + entrySchemaType: String, + dictionarySource: String): ArrayNode { val arrayNode = JacksonUtils.objectMapper.createArrayNode() outputKeyMapping.map { val objectNode = JacksonUtils.objectMapper.createObjectNode() val responseSingleJsonNode = responseArrayNode.filterKeys { key -> key == it.key }.entries.firstOrNull() - if (responseSingleJsonNode == null) { - JacksonUtils.populateJsonNodeValues(it.value, NullNode.getInstance(), entrySchemaType, objectNode) - } - else - { - JacksonUtils.populateJsonNodeValues(it.value, responseSingleJsonNode.value, entrySchemaType, objectNode) - } + val responseNode = responseSingleJsonNode?.value ?: NullNode.getInstance() + + logKeyValueResolvedResource(it.key, responseNode, entrySchemaType, dictionarySource) + + JacksonUtils.populateJsonNodeValues(it.value, responseNode, entrySchemaType, objectNode) + arrayNode.add(objectNode) } @@ -404,5 +433,16 @@ class ResourceAssignmentUtils { val result = outputKeyMapping.filterKeys { !dataTypeProps!!.containsKey(it) }.keys.firstOrNull() return result == null } + + private fun logKeyValueResolvedResource(key: String, value: JsonNode, type: String, dictionarySource: String) { + if (dictionarySource in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES) { + logger.info("For List Type Resource: key ($key), value (****************), " + + "type ({$type})") + } + else { + logger.info("For List Type Resource: key ($key), value ($value), " + + "type ({$type})") + } + } } }
\ No newline at end of file diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml 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 c1dd50126..2872a5a8f 100644 --- a/ms/blueprintsprocessor/functions/restconf-executor/pom.xml +++ b/ms/blueprintsprocessor/functions/restconf-executor/pom.xml @@ -23,6 +23,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId> <artifactId>restconf-executor</artifactId> + <version>0.7.0-SNAPSHOT</version> <name>Blueprints Processor Function - Restconf Executor</name> <description>Blueprints Processor Function - Restconf Executor</description> 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/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/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 e5214e139..5cc29a65e 100644 --- a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml @@ -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/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/inbounds/configs-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml index b09a8ac41..d4d030772 100644 --- a/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml @@ -21,8 +21,6 @@ <artifactId>inbounds</artifactId> <version>0.7.0-SNAPSHOT</version> </parent> - - <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>configs-api</artifactId> <version>0.7.0-SNAPSHOT</version> <packaging>jar</packaging> diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt index c48f1dd98..a3bf3709d 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt @@ -19,7 +19,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api import com.google.protobuf.ByteString -import io.grpc.StatusException +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 @@ -27,6 +27,7 @@ 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.* @@ -34,6 +35,7 @@ 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() { @@ -45,6 +47,7 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu StreamObserver<BluePrintManagementOutput>) { runBlocking { + //TODO("catch if request id is missing") log.info("request(${request.commonHeader.requestId})") try { /** Get the file byte array */ @@ -56,29 +59,67 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu when (uploadAction) { UploadAction.DRAFT.toString() -> { val blueprintModel = bluePrintModelHandler.upload(byteArray, false) - responseObserver.onNext(successStatus(request.commonHeader)) + responseObserver.onNext(successStatus(request.commonHeader, blueprintModel.asJsonString())) } UploadAction.PUBLISH.toString() -> { val blueprintModel = bluePrintModelHandler.upload(byteArray, true) - responseObserver.onNext(successStatus(request.commonHeader)) + responseObserver.onNext(successStatus(request.commonHeader, blueprintModel.asJsonString())) } UploadAction.VALIDATE.toString() -> { //TODO("Not Implemented") - responseObserver.onError(failStatus("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(enrichmentStatus(request.commonHeader, enrichedByteArray)) + responseObserver.onNext(outputWithFileBytes(request.commonHeader, enrichedByteArray)) } else -> { - responseObserver.onError(failStatus("Upload action($uploadAction) not implemented", - BluePrintProcessorException("Upload action($uploadAction) not implemented"))) + 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.onError(failStatus("request(${request.commonHeader.requestId}): Failed to upload CBA", e)) + responseObserver.onNext(failStatus(request.commonHeader, + "request(${request.commonHeader.requestId}): Failed to delete $blueprint", e)) + } finally { + responseObserver.onCompleted() } } } @@ -96,14 +137,16 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu try { bluePrintModelHandler.deleteBlueprintModel(blueprintName, blueprintVersion) responseObserver.onNext(successStatus(request.commonHeader)) - responseObserver.onCompleted() } catch (e: Exception) { - responseObserver.onError(failStatus("request(${request.commonHeader.requestId}): Failed to delete $blueprint", e)) + responseObserver.onNext(failStatus(request.commonHeader, + "request(${request.commonHeader.requestId}): Failed to delete $blueprint", e)) + } finally { + responseObserver.onCompleted() } } } - private fun enrichmentStatus(header: CommonHeader, byteArray: ByteArray): BluePrintManagementOutput = + private fun outputWithFileBytes(header: CommonHeader, byteArray: ByteArray): BluePrintManagementOutput = BluePrintManagementOutput.newBuilder() .setCommonHeader(header) .setFileChunk(FileChunk.newBuilder().setChunk(ByteString.copyFrom(byteArray))) @@ -114,21 +157,37 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu .build()) .build() - private fun successStatus(header: CommonHeader): BluePrintManagementOutput = - BluePrintManagementOutput.newBuilder() - .setCommonHeader(header) - .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(message: String, e: Exception): StatusException { + private fun failStatus(header: CommonHeader, message: String, e: Exception): BluePrintManagementOutput { log.error(message, e) - return io.grpc.Status.INTERNAL - .withDescription(message) - .withCause(e) - .asException() + 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/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt index 212ffd907..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 @@ -123,19 +123,14 @@ open class BluePrintModelHandler(private val blueprintsProcessorCatalogService: @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) } /** @@ -153,7 +148,7 @@ open class BluePrintModelHandler(private val blueprintsProcessorCatalogService: 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")) @@ -319,6 +314,20 @@ open class BluePrintModelHandler(private val blueprintsProcessorCatalogService: } } + /** 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 { diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt index 6e4e91abe..691cfd760 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt @@ -20,9 +20,13 @@ 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 @@ -35,10 +39,7 @@ 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 @@ -67,7 +68,7 @@ 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()) @@ -77,6 +78,16 @@ class BluePrintManagementGRPCHandlerTest { 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 @@ -96,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}") @@ -123,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/utils/BluePrintEnhancerUtilsTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt index 599987361..10bf887f6 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 @@ -22,13 +22,12 @@ import org.junit.Before import org.junit.Test import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.mock.MockFilePart import org.onap.ccsdk.cds.controllerblueprints.core.* -import java.nio.file.Paths import java.util.* import kotlin.test.assertTrue class BluePrintEnhancerUtilsTest { - private val blueprintDir = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + private val blueprintDir = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" private val blueprintArchivePath: String = "./target/blueprints/archive" private val blueprintEnrichmentPath: String = "./target/blueprints/enrichment" private var zipBlueprintFileName = normalizedPathName(blueprintArchivePath, "test.zip") @@ -39,7 +38,7 @@ class BluePrintEnhancerUtilsTest { assertTrue(archiveDir.exists(), "failed to create archiveDir(${archiveDir.absolutePath}") val enhancerDir = normalizedFile(blueprintEnrichmentPath).reCreateDirs() assertTrue(enhancerDir.exists(), "failed to create enhancerDir(${enhancerDir.absolutePath}") - val blueprintFile = Paths.get(blueprintDir).toFile().normalize() + val blueprintFile = normalizedFile(blueprintDir) val testZipFile = blueprintFile.compress(zipBlueprintFileName) assertTrue(testZipFile.exists(), "Failed to create blueprint test zip(${testZipFile.absolutePath}") } diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/health-api/pom.xml new file mode 100644 index 000000000..6037804af --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/pom.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2019-2020 Orange. + + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT 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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>inbounds</artifactId> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <version>0.7.0-SNAPSHOT</version> + </parent> + <artifactId>health-api</artifactId> + + <packaging>jar</packaging> + <name>Blueprints Processor Health API</name> + <description>checking system check health endpoints</description> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>rest-lib</artifactId> + </dependency> + </dependencies> +</project> diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/BasicAuthRestClientServiceConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/BasicAuthRestClientServiceConfiguration.kt new file mode 100644 index 000000000..0a97d37c5 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/BasicAuthRestClientServiceConfiguration.kt @@ -0,0 +1,50 @@ +/* + * Copyright © 2019-2020 Orange. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF 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.healthapi.configuration + +import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService +import org.springframework.beans.factory.annotation.Value +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.context.annotation.PropertySource + +@Configuration +@PropertySource("classpath:application.properties") +open class BasicAuthRestClientServiceConfiguration { + + @Value("\${endpoints.user.name}") + private val username: String? = null + + @Value("\${endpoints.user.password}") + private val password: String? = null + + @Bean + open fun getBasicAuthRestClientProperties(): BasicAuthRestClientProperties { + val basicAuthRestClientProperties = BasicAuthRestClientProperties() + basicAuthRestClientProperties.username = username.toString() + basicAuthRestClientProperties.password = password.toString() + return basicAuthRestClientProperties + } + + @Bean + open fun getBasicAuthRestClientService(): BasicAuthRestClientService { + return BasicAuthRestClientService(getBasicAuthRestClientProperties()) + } + + +} diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/HealthCheckController.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/HealthCheckController.kt new file mode 100644 index 000000000..1283ac5ac --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/HealthCheckController.kt @@ -0,0 +1,48 @@ +/* + * Copyright © 2019-2020 Orange. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF 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.healthapi.controller + +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.HealthCheckService +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.ResponseBody +import org.springframework.web.bind.annotation.RestController + +@RestController +@RequestMapping("/api/v1/health") +@Api(value = "/api/v1/health", + description = "gather all HealthCheckResponses for HealthChecks known to the runtime") +open class HealthCheckController { + + @Autowired + lateinit var healthApiService: HealthCheckService + + @RequestMapping(path = [""], + method = [RequestMethod.GET], + produces = [MediaType.APPLICATION_JSON_VALUE]) + @ResponseBody + @ApiOperation(value = "Health Check", hidden = true) + fun getSystemHealthCheckResponse(): ResponseEntity<HealthApiResponse> { + return ResponseEntity.ok().body(healthApiService.retrieveSystemStatus()) + } +} diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthApiResponse.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthApiResponse.kt new file mode 100644 index 000000000..4dac178e5 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthApiResponse.kt @@ -0,0 +1,6 @@ +package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain + + +data class HealthApiResponse(val status: HealthCheckStatus, val checks:List<HealthCheckResponse>) + + diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthCheckResponse.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthCheckResponse.kt new file mode 100644 index 000000000..acac867cb --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthCheckResponse.kt @@ -0,0 +1,6 @@ +package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain + + +data class HealthCheckResponse(val name: String, val status: HealthCheckStatus) + + diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthCheckStatus.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthCheckStatus.kt new file mode 100644 index 000000000..a891a40d3 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthCheckStatus.kt @@ -0,0 +1,6 @@ +package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain + +enum class HealthCheckStatus { + UP, + DOWN +}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceEndpoint.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceEndpoint.kt new file mode 100644 index 000000000..8fbc33b47 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceEndpoint.kt @@ -0,0 +1,5 @@ +package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain + + + +data class ServiceEndpoint(val serviceName: String, val serviceLink: String) diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/HealthCheckService.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/HealthCheckService.kt new file mode 100644 index 000000000..09fdb67f2 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/HealthCheckService.kt @@ -0,0 +1,91 @@ +/* + * Copyright © 2019-2020 Orange. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF 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.healthapi.service + +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckResponse +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.ServiceEndpoint +import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService +import org.slf4j.LoggerFactory +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.http.HttpMethod +import org.springframework.stereotype.Service + + +@Service +class HealthCheckService { + + private var logger = LoggerFactory.getLogger(HealthCheckService::class.java) + + @Autowired + lateinit var basicAuthRestClientService: BasicAuthRestClientService + + @Autowired + lateinit var restClientProperties: BasicAuthRestClientProperties + + + open fun setupServiceEndpoint(): List<ServiceEndpoint> { + return listOf(ServiceEndpoint("Execution service", "http://cds-blueprints-processor-http:8080/api/v1/execution-service/health-check"), + ServiceEndpoint("Template service", "http://cds-blueprints-processor-http:8080/api/v1/template/health-check"), + ServiceEndpoint("Resources service", "http://cds-blueprints-processor-http:8080/api/v1/resources/health-check"), + ServiceEndpoint("SDC Listener service", "http://cds-sdc-listener:8080/api/v1/sdclistener/health-check") + ) + } + + fun retrieveSystemStatus(): HealthApiResponse { + logger.info("Retrieve System Status") + var healthApiResponse: HealthApiResponse + val listOfResponse = mutableListOf<HealthCheckResponse>() + var systemStatus: HealthCheckStatus = HealthCheckStatus.UP + + for (serviceEndpoint in setupServiceEndpoint().parallelStream()) { + var serviceStatus: HealthCheckStatus = retrieveServiceStatus(serviceEndpoint) + if (serviceStatus.equals(HealthCheckStatus.DOWN)) + systemStatus = HealthCheckStatus.DOWN + + listOfResponse.add(HealthCheckResponse(serviceEndpoint.serviceName, serviceStatus)) + } + healthApiResponse = HealthApiResponse(systemStatus, listOfResponse) + return healthApiResponse + } + + private fun retrieveServiceStatus(serviceEndpoint: ServiceEndpoint): HealthCheckStatus { + var serviceStatus: HealthCheckStatus = HealthCheckStatus.UP + try { + addClientPropertiesConfiguration(serviceEndpoint) + val result: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "") + if (result == null || result.status != 200) { + serviceStatus = HealthCheckStatus.DOWN + + } + } catch (e: Exception) { + logger.error("service is down" + e) + serviceStatus = HealthCheckStatus.DOWN + + } + return serviceStatus + } + + private fun addClientPropertiesConfiguration(serviceEndpoint: ServiceEndpoint) { + restClientProperties.url = serviceEndpoint.serviceLink + } + + +} diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/resources/application.properties b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/resources/application.properties new file mode 100644 index 000000000..aca95b481 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/resources/application.properties @@ -0,0 +1,18 @@ +# +# Copyright � 2019-2020 Orange. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +endpoints.user.name=ccsdkapps +endpoints.user.password=ccsdkapps diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckApplicationTests.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckApplicationTests.kt new file mode 100644 index 000000000..cd02b65dc --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckApplicationTests.kt @@ -0,0 +1,55 @@ +/* + * Copyright © 2019-2020 Orange. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF 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.healthapi + + +import org.junit.Test +import org.junit.runner.RunWith +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService +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.test.context.ContextConfiguration +import org.springframework.test.context.TestPropertySource +import org.springframework.test.context.junit4.SpringRunner +import org.springframework.test.web.reactive.server.WebTestClient + + +@RunWith(SpringRunner::class) +@WebFluxTest +@ContextConfiguration(classes = [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 HealthCheckApplicationTests { + + + @Autowired + lateinit var webTestClient: WebTestClient + + @Test + fun testHealthApiUp() { + val result = webTestClient.get().uri("/api/v1/health") + .exchange() + .expectStatus().is2xxSuccessful + println(result) + } + + +} diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckServiceTest.java b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckServiceTest.java new file mode 100644 index 000000000..8fb5e58fc --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckServiceTest.java @@ -0,0 +1,137 @@ +/* + * Copyright © 2019-2020 Orange. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF 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.healthapi; + + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.anyString; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse; +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus; +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.HealthCheckService; +import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties; +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService; +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService.WebClientResponse; +import org.springframework.http.HttpMethod; + +@RunWith(MockitoJUnitRunner.class) +public class HealthCheckServiceTest { + + @Mock + private BasicAuthRestClientService basicAuthRestClientService; + + @Mock + private BasicAuthRestClientProperties restClientProperties; + + @InjectMocks + private HealthCheckService healthCheckService = new HealthCheckService(); + + @Before + public void setup() { + } + + @Test + public void testSystemIsCompletelyDown() { + + Mockito.when(basicAuthRestClientService.exchangeResource(anyString(), anyString(), anyString())). + thenThrow(new RuntimeException()); + HealthApiResponse healthApiResponse = healthCheckService.retrieveSystemStatus(); + assertNotNull(healthApiResponse); + Assert.assertEquals(healthApiResponse.getStatus(), HealthCheckStatus.DOWN); + healthApiResponse.getChecks().stream().forEach(serviceEndpoint -> { + assertNotNull(serviceEndpoint); + assertEquals(serviceEndpoint.getStatus(), HealthCheckStatus.DOWN); + + }); + + } + + + @Test + public void testSystemIsUPAndRunning() { + + Mockito.when(basicAuthRestClientService.exchangeResource(eq(HttpMethod.GET.name()), anyString(), anyString())). + thenReturn(new WebClientResponse<>(200, "Success")); + HealthApiResponse healthApiResponse = healthCheckService.retrieveSystemStatus(); + assertNotNull(healthApiResponse); + assertEquals(healthApiResponse.getStatus(), HealthCheckStatus.UP); + healthApiResponse.getChecks().stream().forEach(serviceEndpoint -> { + assertNotNull(serviceEndpoint); + assertEquals(serviceEndpoint.getStatus(), HealthCheckStatus.UP); + + }); + + } + + @Test + public void testServiceIsNotFound() { + Mockito.when(basicAuthRestClientService.exchangeResource(eq(HttpMethod.GET.name()), any(), anyString())). + thenReturn(new WebClientResponse<>(404, "failure")); + HealthApiResponse healthApiResponse = healthCheckService.retrieveSystemStatus(); + assertNotNull(healthApiResponse); + assertEquals(healthApiResponse.getStatus(), HealthCheckStatus.DOWN); + healthApiResponse.getChecks().stream().forEach(serviceEndpoint -> { + assertNotNull(serviceEndpoint); + assertEquals(serviceEndpoint.getStatus(), HealthCheckStatus.DOWN); + + }); + + } + + + @Test + public void testServiceInternalServerError() { + Mockito.when(basicAuthRestClientService.exchangeResource(eq(HttpMethod.GET.name()), any(), anyString())) + .thenReturn(new WebClientResponse<>(500, "failure")); + HealthApiResponse healthApiResponse = healthCheckService.retrieveSystemStatus(); + assertNotNull(healthApiResponse); + assertEquals(healthApiResponse.getStatus(), HealthCheckStatus.DOWN); + healthApiResponse.getChecks().stream().forEach(serviceEndpoint -> { + assertNotNull(serviceEndpoint); + assertEquals(serviceEndpoint.getStatus(), HealthCheckStatus.DOWN); + + }); + + } + + @Test + public void testServiceIsRedirected() { + Mockito.when(basicAuthRestClientService.exchangeResource(eq(HttpMethod.GET.name()), any(), anyString())) + .thenReturn(new WebClientResponse<>(300, "failure")); + HealthApiResponse healthApiResponse = healthCheckService.retrieveSystemStatus(); + assertNotNull(healthApiResponse); + assertEquals(healthApiResponse.getStatus(), HealthCheckStatus.DOWN); + healthApiResponse.getChecks().stream().forEach(serviceEndpoint -> { + assertNotNull(serviceEndpoint); + assertEquals(serviceEndpoint.getStatus(), HealthCheckStatus.DOWN); + + }); + + } + +} diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/resources/application-test.properties new file mode 100644 index 000000000..c9a5700c1 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/resources/application-test.properties @@ -0,0 +1,31 @@ +# 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. + +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 +server.socket=localhost:8080 diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/resources/logback.xml b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/resources/logback.xml new file mode 100644 index 000000000..ed92b8963 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/resources/logback.xml @@ -0,0 +1,35 @@ +<!-- + ~ 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. + --> + +<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/health-api/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000..1f0955d45 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml index 0542fe380..a1d716110 100644 --- a/ms/blueprintsprocessor/modules/inbounds/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml @@ -33,6 +33,7 @@ <module>designer-api</module> <module>resource-api</module> <module>selfservice-api</module> + <module>health-api</module> </modules> <dependencies> <dependency> 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 7c53e1c04..b5cac581a 100755 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml @@ -33,10 +33,9 @@ <dependencies> <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> <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> <artifactId>blueprint-core</artifactId> diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml index 4acc22433..784906b4e 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml @@ -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/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 5a54a7717..cd4056485 100755 --- a/ms/blueprintsprocessor/parent/pom.xml +++ b/ms/blueprintsprocessor/parent/pom.xml @@ -37,7 +37,7 @@ <jython.version>2.7.1</jython.version> <!-- Should be using released artifact as soon as available:--> <!-- https://github.com/springfox/springfox/milestone/44--> - <springfox.swagger2.version>3.0.0-SNAPSHOT</springfox.swagger2.version> + <springfox.swagger2.version>2.9.2</springfox.swagger2.version> <h2database.version>1.4.197</h2database.version> <onap.logger.slf4j>1.2.2</onap.logger.slf4j> <powermock.version>1.7.4</powermock.version> @@ -96,17 +96,17 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-spring-webflux</artifactId> - <version>${springfox.swagger2.version}</version> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </exclusion> - </exclusions> - </dependency> +<!-- <dependency>--> +<!-- <groupId>io.springfox</groupId>--> +<!-- <artifactId>springfox-spring-webflux</artifactId>--> +<!-- <version>${springfox.swagger2.version}</version>--> +<!-- <exclusions>--> +<!-- <exclusion>--> +<!-- <groupId>org.slf4j</groupId>--> +<!-- <artifactId>slf4j-api</artifactId>--> +<!-- </exclusion>--> +<!-- </exclusions>--> +<!-- </dependency>--> <!-- Common Utils Dependencies --> <dependency> @@ -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> @@ -371,6 +367,12 @@ <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>health-api</artifactId> + <version>${project.version}</version> + </dependency> + <!-- North Bound --> <dependency> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> @@ -460,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> @@ -569,10 +576,10 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-spring-webflux</artifactId> - </dependency> +<!-- <dependency>--> +<!-- <groupId>io.springfox</groupId>--> +<!-- <artifactId>springfox-spring-webflux</artifactId>--> +<!-- </dependency>--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> |