diff options
Diffstat (limited to 'ms')
255 files changed, 3055 insertions, 7730 deletions
diff --git a/ms/blueprintsprocessor/application/opt/app/onap/config/application.properties b/ms/blueprintsprocessor/application/opt/app/onap/config/application.properties deleted file mode 100755 index e69de29bb..000000000 --- a/ms/blueprintsprocessor/application/opt/app/onap/config/application.properties +++ /dev/null diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties index 3405edab7..2fd595102 100755 --- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties +++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties @@ -26,24 +26,24 @@ server.port=8081 ### START -Controller Blueprints Properties # Load Resource Source Mappings -resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=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 # Controller Blueprints Core Configuration -controllerblueprints.blueprintDeployPath=blueprints/deploy -controllerblueprints.blueprintArchivePath=blueprints/archive -controllerblueprints.blueprintWorkingPath=blueprints/work +blueprintsprocessor.blueprintDeployPath=blueprints/deploy +blueprintsprocessor.blueprintArchivePath=blueprints/archive +blueprintsprocessor.blueprintWorkingPath=blueprints/work # Controller Blueprint Load Configurations # blueprints.load.initial-data may be overridden by ENV variables -controllerblueprints.loadInitialData=true -controllerblueprints.loadBluePrint=false -controllerblueprints.loadBluePrintPaths=./../../../components/model-catalog/blueprint-model/service-blueprint -controllerblueprints.loadModelType=true -controllerblueprints.loadModeTypePaths=./../../../components/model-catalog/definition-type/starter-type -controllerblueprints.loadResourceDictionary=true -controllerblueprints.loadResourceDictionaryPaths=./../../../components/model-catalog/resource-dictionary/starter-dictionary +blueprintsprocessor.loadInitialData=true +blueprintsprocessor.loadBluePrint=false +blueprintsprocessor.loadBluePrintPaths=./../../../components/model-catalog/blueprint-model/service-blueprint +blueprintsprocessor.loadModelType=true +blueprintsprocessor.loadModeTypePaths=./../../../components/model-catalog/definition-type/starter-type +blueprintsprocessor.loadResourceDictionary=true +blueprintsprocessor.loadResourceDictionaryPaths=./../../../components/model-catalog/resource-dictionary/starter-dictionary # CBA file extension -controllerblueprints.loadCbaExtension=zip +blueprintsprocessor.loadCbaExtension=zip ### END -Controller Blueprints Properties @@ -63,9 +63,6 @@ blueprintsprocessor.grpcPort=9111 ### blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy ### blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive ### blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/working -blueprintsprocessor.blueprintDeployPath=blueprints/deploy -blueprintsprocessor.blueprintArchivePath=blueprints/archive -blueprintsprocessor.blueprintWorkingPath=blueprints/work # Primary Database Configuration blueprintsprocessor.db.url=jdbc:mysql://localhost:3306/sdnctl blueprintsprocessor.db.username=sdnctl @@ -102,10 +99,15 @@ blueprintsprocessor.cliExecutor.enabled=true blueprintprocessor.remoteScriptCommand.enabled=false # Kafka-message-lib Configurations -blueprintsprocessor.messageclient.self-service-api.topic=producer.t -blueprintsprocessor.messageclient.self-service-api.type=kafka-basic-auth -blueprintsprocessor.messageclient.self-service-api.bootstrapServers=127.0.0.1:9092 -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 +blueprintsprocessor.messageconsumer.self-service-api.kafkaEnable=false +blueprintsprocessor.messageconsumer.self-service-api.type=kafka-basic-auth +blueprintsprocessor.messageconsumer.self-service-api.bootstrapServers=127.0.0.1:9092 +blueprintsprocessor.messageconsumer.self-service-api.groupId=receiver-id +blueprintsprocessor.messageconsumer.self-service-api.topic=receiver.t +blueprintsprocessor.messageconsumer.self-service-api.clientId=default-client-id +blueprintsprocessor.messageconsumer.self-service-api.pollMillSec=1000 + +blueprintsprocessor.messageproducer.self-service-api.type=kafka-basic-auth +blueprintsprocessor.messageproducer.self-service-api.bootstrapServers=127.0.0.1:9092 +blueprintsprocessor.messageproducer.self-service-api.clientId=default-client-id +blueprintsprocessor.messageproducer.self-service-api.topic=producer.t
\ No newline at end of file diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties index 3ea588da3..75d9cbaad 100755 --- a/ms/blueprintsprocessor/application/src/main/resources/application.properties +++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties @@ -16,22 +16,22 @@ # Web server config ### START -Controller Blueprints Properties # Load Resource Source Mappings -resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=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 # Controller Blueprints Core Configuration -controllerblueprints.blueprintDeployPath=/opt/app/onap/blueprints/deploy -controllerblueprints.blueprintArchivePath=/opt/app/onap/blueprints/archive -controllerblueprints.blueprintWorkingPath=/opt/app/onap/blueprints/working +blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy +blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive +blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/working # Controller Blueprint Load Configurations # blueprints.load.initial-data may be overridden by ENV variables -controllerblueprints.loadInitialData=false -controllerblueprints.loadBluePrint=false -controllerblueprints.loadBluePrintPaths=/opt/app/onap/model-catalog/blueprint-model/service-blueprint -controllerblueprints.loadModelType=false -controllerblueprints.loadModeTypePaths=/opt/app/onap/model-catalog/definition-type/starter-type -controllerblueprints.loadResourceDictionary=false -controllerblueprints.loadResourceDictionaryPaths=/opt/app/onap/model-catalog/resource-dictionary/starter-dictionary +blueprintsprocessor.loadInitialData=false +blueprintsprocessor.loadBluePrint=false +blueprintsprocessor.loadBluePrintPaths=/opt/app/onap/model-catalog/blueprint-model/service-blueprint +blueprintsprocessor.loadModelType=false +blueprintsprocessor.loadModeTypePaths=/opt/app/onap/model-catalog/definition-type/starter-type +blueprintsprocessor.loadResourceDictionary=false +blueprintsprocessor.loadResourceDictionaryPaths=/opt/app/onap/model-catalog/resource-dictionary/starter-dictionary # CBA file extension controllerblueprints.loadCbaExtension=zip @@ -42,11 +42,6 @@ blueprintsprocessor.grpcEnable=false blueprintsprocessor.httpPort=8080 blueprintsprocessor.grpcPort=9111 -# Blueprint Processor File Execution and Handling Properties -blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy -blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive -blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/working - # Primary Database Configuration blueprintsprocessor.db.url=jdbc:mysql://db:3306/sdnctl blueprintsprocessor.db.username=sdnctl @@ -85,10 +80,10 @@ blueprintsprocessor.grpcclient.remote-python.token=Basic Y2NzZGthcHBzOmNjc2RrYXB # Primary Config Data REST client settings -blueprintsprocessor.restclient.config-data.type=basic-auth -blueprintsprocessor.restclient.config-data.url=http://sdnc:8282 -blueprintsprocessor.restclient.config-data.username=admin -blueprintsprocessor.restclient.config-data.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U +blueprintsprocessor.restclient.sdnc.type=basic-auth +blueprintsprocessor.restclient.sdnc.url=http://sdnc:8282 +blueprintsprocessor.restclient.sdnc.username=admin +blueprintsprocessor.restclient.sdnc.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U # Primary AAI Data REST Client settings blueprintsprocessor.restclient.aai-data.type=basic-auth @@ -97,10 +92,15 @@ blueprintsprocessor.restclient.aai-data.username=aai@aai.onap.org blueprintsprocessor.restclient.aai-data.password=demo123456! # Kafka-message-lib Configuration -blueprintsprocessor.messageclient.self-service-api.topic=producer.t -blueprintsprocessor.messageclient.self-service-api.type=kafka-basic-auth -blueprintsprocessor.messageclient.self-service-api.bootstrapServers=127.0.0.1:9092 -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 +blueprintsprocessor.messageconsumer.self-service-api.kafkaEnable=false +blueprintsprocessor.messageconsumer.self-service-api.type=kafka-basic-auth +blueprintsprocessor.messageconsumer.self-service-api.bootstrapServers=127.0.0.1:9092 +blueprintsprocessor.messageconsumer.self-service-api.topic=receiver.t +blueprintsprocessor.messageconsumer.self-service-api.groupId=receiver-id +blueprintsprocessor.messageconsumer.self-service-api.clientId=default-client-id +blueprintsprocessor.messageconsumer.self-service-api.pollMillSec=1000 + +blueprintsprocessor.messageproducer.self-service-api.type=kafka-basic-auth +blueprintsprocessor.messageproducer.self-service-api.bootstrapServers=127.0.0.1:9092 +blueprintsprocessor.messageproducer.self-service-api.clientId=default-client-id +blueprintsprocessor.messageproducer.self-service-api.topic=producer.t diff --git a/ms/controllerblueprints/application/src/main/resources/sql/data.sql b/ms/blueprintsprocessor/application/src/main/resources/sql/data.sql index e69de29bb..e69de29bb 100644 --- a/ms/controllerblueprints/application/src/main/resources/sql/data.sql +++ b/ms/blueprintsprocessor/application/src/main/resources/sql/data.sql diff --git a/ms/controllerblueprints/application/src/main/resources/sql/schema-local.sql b/ms/blueprintsprocessor/application/src/main/resources/sql/schema-local.sql index 47e0cce7a..ad048b017 100644 --- a/ms/controllerblueprints/application/src/main/resources/sql/schema-local.sql +++ b/ms/blueprintsprocessor/application/src/main/resources/sql/schema-local.sql @@ -1,83 +1,83 @@ --- drop table sdnctl.MODEL_TYPE;
--- drop table sdnctl.RESOURCE_DICTIONARY;
--- drop table sdnctl.CONFIG_MODEL_CONTENT;
--- drop table sdnctl.CONFIG_MODEL;
-
--- -----------------------------------------------------
--- table CONFIG_MODEL
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_MODEL (
- config_model_id INT(11) NOT NULL AUTO_INCREMENT,
- service_uuid VARCHAR(50) NULL DEFAULT NULL,
- distribution_id VARCHAR(50) NULL DEFAULT NULL,
- service_name VARCHAR(255) NULL DEFAULT NULL,
- service_description VARCHAR(255) NULL DEFAULT NULL,
- resource_uuid VARCHAR(255) NULL DEFAULT NULL,
- resource_instance_name VARCHAR(255) NULL DEFAULT NULL,
- resource_name varchar(255) null default null,
- resource_version varchar(50) null default null,
- resource_type varchar(50) null default null,
- artifact_uuid varchar(50) null default null,
- artifact_type varchar(50) not null,
- artifact_version varchar(25) not null,
- artifact_description longtext null default null,
- internal_version int(11) null default null,
- creation_date datetime not null default current_timestamp,
- artifact_name varchar(100) not null,
- published varchar(1) not null,
- updated_by varchar(100) not null,
- tags longtext null default null,
- primary key PK_CONFIG_MODEL (config_model_id),
- UNIQUE KEY UK_CONFIG_MODEL (artifact_name , artifact_version)
-) ENGINE=InnoDB;
-
-
--- -----------------------------------------------------
--- table CONFIG_MODEL_CONTENT
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_MODEL_CONTENT (
- config_model_content_id INT(11) NOT NULL AUTO_INCREMENT,
- config_model_id INT NOT NULL,
- name VARCHAR(100) NOT NULL,
- content_type VARCHAR(50) NOT NULL,
- description LONGTEXT NULL DEFAULT NULL,
- updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- content LONGTEXT NULL DEFAULT NULL,
- PRIMARY KEY PK_CONFIG_MODEL_CONTENT (config_model_content_id),
- UNIQUE KEY UK_CONFIG_MODEL_CONTENT (config_model_id, name, content_type),
- FOREIGN KEY FK_CONFIG_MODEL_CONTENT (config_model_id) REFERENCES sdnctl.CONFIG_MODEL(config_model_id) ON DELETE CASCADE
-) ENGINE=InnoDB;
-
--- -----------------------------------------------------
--- table MODEL_TYPE
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.MODEL_TYPE (
- model_name VARCHAR(100) NOT NULL,
- derived_from VARCHAR(100) NOT NULL,
- definition_type VARCHAR(100) NOT NULL,
- definition LONGTEXT NOT NULL,
- version VARCHAR(10) NOT NULL,
- description LONGTEXT NOT NULL,
- tags LONGTEXT NULL DEFAULT NULL,
- creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(100) NOT NULL,
- PRIMARY KEY PK_MODEL_TYPE (model_name),
- INDEX IX_MODEL_TYPE (model_name)
-) ENGINE=InnoDB;
-
-
--- -----------------------------------------------------
--- table RESOURCE_DICTIONARY
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.RESOURCE_DICTIONARY (
- name VARCHAR(100) NOT NULL,
- data_type VARCHAR(100) NOT NULL,
- entry_schema VARCHAR(100) NULL DEFAULT NULL,
- definition LONGTEXT NOT NULL,
- description LONGTEXT NOT NULL,
- tags LONGTEXT NOT NULL,
- creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(100) NOT NULL,
- primary key PK_RESOURCE_DICTIONARY (name),
- INDEX IX_RESOURCE_DICTIONARY (name)
+-- drop table sdnctl.MODEL_TYPE; +-- drop table sdnctl.RESOURCE_DICTIONARY; +-- drop table sdnctl.CONFIG_MODEL_CONTENT; +-- drop table sdnctl.CONFIG_MODEL; + +-- ----------------------------------------------------- +-- table CONFIG_MODEL +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_MODEL ( + config_model_id INT(11) NOT NULL AUTO_INCREMENT, + service_uuid VARCHAR(50) NULL DEFAULT NULL, + distribution_id VARCHAR(50) NULL DEFAULT NULL, + service_name VARCHAR(255) NULL DEFAULT NULL, + service_description VARCHAR(255) NULL DEFAULT NULL, + resource_uuid VARCHAR(255) NULL DEFAULT NULL, + resource_instance_name VARCHAR(255) NULL DEFAULT NULL, + resource_name varchar(255) null default null, + resource_version varchar(50) null default null, + resource_type varchar(50) null default null, + artifact_uuid varchar(50) null default null, + artifact_type varchar(50) not null, + artifact_version varchar(25) not null, + artifact_description longtext null default null, + internal_version int(11) null default null, + creation_date datetime not null default current_timestamp, + artifact_name varchar(100) not null, + published varchar(1) not null, + updated_by varchar(100) not null, + tags longtext null default null, + primary key PK_CONFIG_MODEL (config_model_id), + UNIQUE KEY UK_CONFIG_MODEL (artifact_name , artifact_version) +) ENGINE=InnoDB; + + +-- ----------------------------------------------------- +-- table CONFIG_MODEL_CONTENT +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_MODEL_CONTENT ( + config_model_content_id INT(11) NOT NULL AUTO_INCREMENT, + config_model_id INT NOT NULL, + name VARCHAR(100) NOT NULL, + content_type VARCHAR(50) NOT NULL, + description LONGTEXT NULL DEFAULT NULL, + updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + content LONGTEXT NULL DEFAULT NULL, + PRIMARY KEY PK_CONFIG_MODEL_CONTENT (config_model_content_id), + UNIQUE KEY UK_CONFIG_MODEL_CONTENT (config_model_id, name, content_type), + FOREIGN KEY FK_CONFIG_MODEL_CONTENT (config_model_id) REFERENCES sdnctl.CONFIG_MODEL(config_model_id) ON DELETE CASCADE +) ENGINE=InnoDB; + +-- ----------------------------------------------------- +-- table MODEL_TYPE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS sdnctl.MODEL_TYPE ( + model_name VARCHAR(100) NOT NULL, + derived_from VARCHAR(100) NOT NULL, + definition_type VARCHAR(100) NOT NULL, + definition LONGTEXT NOT NULL, + version VARCHAR(10) NOT NULL, + description LONGTEXT NOT NULL, + tags LONGTEXT NULL DEFAULT NULL, + creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_by VARCHAR(100) NOT NULL, + PRIMARY KEY PK_MODEL_TYPE (model_name), + INDEX IX_MODEL_TYPE (model_name) +) ENGINE=InnoDB; + + +-- ----------------------------------------------------- +-- table RESOURCE_DICTIONARY +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS sdnctl.RESOURCE_DICTIONARY ( + name VARCHAR(100) NOT NULL, + data_type VARCHAR(100) NOT NULL, + entry_schema VARCHAR(100) NULL DEFAULT NULL, + definition LONGTEXT NOT NULL, + description LONGTEXT NOT NULL, + tags LONGTEXT NOT NULL, + creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_by VARCHAR(100) NOT NULL, + primary key PK_RESOURCE_DICTIONARY (name), + INDEX IX_RESOURCE_DICTIONARY (name) ) ENGINE=InnoDB;
\ No newline at end of file diff --git a/ms/controllerblueprints/application/src/main/resources/sql/schema.sql b/ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql index 9c38bec0b..58564dce5 100644 --- a/ms/controllerblueprints/application/src/main/resources/sql/schema.sql +++ b/ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql @@ -1,78 +1,78 @@ --- -----------------------------------------------------
--- table CONFIG_MODEL
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL (
- config_model_id INT(11) NOT NULL AUTO_INCREMENT,
- service_uuid VARCHAR(50) NULL DEFAULT NULL,
- distribution_id VARCHAR(50) NULL DEFAULT NULL,
- service_name VARCHAR(255) NULL DEFAULT NULL,
- service_description VARCHAR(255) NULL DEFAULT NULL,
- resource_uuid VARCHAR(255) NULL DEFAULT NULL,
- resource_instance_name VARCHAR(255) NULL DEFAULT NULL,
- resource_name varchar(255) null default null,
- resource_version varchar(50) null default null,
- resource_type varchar(50) null default null,
- artifact_uuid varchar(50) null default null,
- artifact_type varchar(50) not null,
- artifact_version varchar(25) not null,
- artifact_description longtext null default null,
- internal_version int(11) null default null,
- creation_date datetime not null default current_timestamp,
- artifact_name varchar(100) not null,
- published varchar(1) not null,
- updated_by varchar(100) not null,
- tags longtext null default null,
- primary key PK_CONFIG_MODEL (config_model_id),
- UNIQUE KEY UK_CONFIG_MODEL (artifact_name , artifact_version)
-) ENGINE=InnoDB;
-
-
--- -----------------------------------------------------
--- table CONFIG_MODEL_CONTENT
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL_CONTENT (
- config_model_content_id INT(11) NOT NULL AUTO_INCREMENT,
- config_model_id INT NOT NULL,
- name VARCHAR(100) NOT NULL,
- content_type VARCHAR(50) NOT NULL,
- description LONGTEXT NULL DEFAULT NULL,
- updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- content LONGTEXT NULL DEFAULT NULL,
- PRIMARY KEY PK_CONFIG_MODEL_CONTENT (config_model_content_id),
- UNIQUE KEY UK_CONFIG_MODEL_CONTENT (config_model_id, name, content_type),
- FOREIGN KEY FK_CONFIG_MODEL_CONTENT (config_model_id) REFERENCES configurator.CONFIG_MODEL(config_model_id) ON DELETE CASCADE
-) ENGINE=InnoDB;
-
--- -----------------------------------------------------
--- table MODEL_TYPE
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS configurator.MODEL_TYPE (
- model_name VARCHAR(100) NOT NULL,
- derived_from VARCHAR(100) NOT NULL,
- definition_type VARCHAR(100) NOT NULL,
- definition LONGTEXT NOT NULL,
- version VARCHAR(10) NOT NULL,
- description LONGTEXT NOT NULL,
- tags LONGTEXT NULL DEFAULT NULL,
- creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(100) NOT NULL,
- PRIMARY KEY PK_MODEL_TYPE (model_name),
- INDEX IX_MODEL_TYPE (model_name)
-) ENGINE=InnoDB;
-
-
--- -----------------------------------------------------
--- table RESOURCE_DICTIONARY
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS configurator.RESOURCE_DICTIONARY (
- name VARCHAR(100) NOT NULL,
- data_type VARCHAR(100) NOT NULL,
- entry_schema VARCHAR(100) NULL DEFAULT NULL,
- definition LONGTEXT NOT NULL,
- description LONGTEXT NOT NULL,
- tags LONGTEXT NOT NULL,
- creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(100) NOT NULL,
- primary key PK_RESOURCE_DICTIONARY (name),
- INDEX IX_RESOURCE_DICTIONARY (name)
-) ENGINE=InnoDB;
+-- ----------------------------------------------------- +-- table CONFIG_MODEL +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL ( + config_model_id INT(11) NOT NULL AUTO_INCREMENT, + service_uuid VARCHAR(50) NULL DEFAULT NULL, + distribution_id VARCHAR(50) NULL DEFAULT NULL, + service_name VARCHAR(255) NULL DEFAULT NULL, + service_description VARCHAR(255) NULL DEFAULT NULL, + resource_uuid VARCHAR(255) NULL DEFAULT NULL, + resource_instance_name VARCHAR(255) NULL DEFAULT NULL, + resource_name varchar(255) null default null, + resource_version varchar(50) null default null, + resource_type varchar(50) null default null, + artifact_uuid varchar(50) null default null, + artifact_type varchar(50) not null, + artifact_version varchar(25) not null, + artifact_description longtext null default null, + internal_version int(11) null default null, + creation_date datetime not null default current_timestamp, + artifact_name varchar(100) not null, + published varchar(1) not null, + updated_by varchar(100) not null, + tags longtext null default null, + primary key PK_CONFIG_MODEL (config_model_id), + UNIQUE KEY UK_CONFIG_MODEL (artifact_name , artifact_version) +) ENGINE=InnoDB; + + +-- ----------------------------------------------------- +-- table CONFIG_MODEL_CONTENT +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL_CONTENT ( + config_model_content_id INT(11) NOT NULL AUTO_INCREMENT, + config_model_id INT NOT NULL, + name VARCHAR(100) NOT NULL, + content_type VARCHAR(50) NOT NULL, + description LONGTEXT NULL DEFAULT NULL, + updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + content LONGTEXT NULL DEFAULT NULL, + PRIMARY KEY PK_CONFIG_MODEL_CONTENT (config_model_content_id), + UNIQUE KEY UK_CONFIG_MODEL_CONTENT (config_model_id, name, content_type), + FOREIGN KEY FK_CONFIG_MODEL_CONTENT (config_model_id) REFERENCES configurator.CONFIG_MODEL(config_model_id) ON DELETE CASCADE +) ENGINE=InnoDB; + +-- ----------------------------------------------------- +-- table MODEL_TYPE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS configurator.MODEL_TYPE ( + model_name VARCHAR(100) NOT NULL, + derived_from VARCHAR(100) NOT NULL, + definition_type VARCHAR(100) NOT NULL, + definition LONGTEXT NOT NULL, + version VARCHAR(10) NOT NULL, + description LONGTEXT NOT NULL, + tags LONGTEXT NULL DEFAULT NULL, + creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_by VARCHAR(100) NOT NULL, + PRIMARY KEY PK_MODEL_TYPE (model_name), + INDEX IX_MODEL_TYPE (model_name) +) ENGINE=InnoDB; + + +-- ----------------------------------------------------- +-- table RESOURCE_DICTIONARY +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS configurator.RESOURCE_DICTIONARY ( + name VARCHAR(100) NOT NULL, + data_type VARCHAR(100) NOT NULL, + entry_schema VARCHAR(100) NULL DEFAULT NULL, + definition LONGTEXT NOT NULL, + description LONGTEXT NOT NULL, + tags LONGTEXT NOT NULL, + creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_by VARCHAR(100) NOT NULL, + primary key PK_RESOURCE_DICTIONARY (name), + INDEX IX_RESOURCE_DICTIONARY (name) +) ENGINE=InnoDB; diff --git a/ms/blueprintsprocessor/application/src/test/resources/application.properties b/ms/blueprintsprocessor/application/src/test/resources/application.properties index e50ebdefb..766498fdc 100644 --- a/ms/blueprintsprocessor/application/src/test/resources/application.properties +++ b/ms/blueprintsprocessor/application/src/test/resources/application.properties @@ -19,22 +19,22 @@ server.port=8080 ### START -Controller Blueprints Properties # Load Resource Source Mappings -resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=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 # Controller Blueprints Core Configuration -controllerblueprints.blueprintDeployPath=/opt/app/onap/blueprints/deploy -controllerblueprints.blueprintArchivePath=/opt/app/onap/blueprints/archive -controllerblueprints.blueprintWorkingPath=/opt/app/onap/blueprints/working +blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy +blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive +blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/working # Controller Blueprint Load Configurations # blueprints.load.initial-data may be overridden by ENV variables -controllerblueprints.loadInitialData=false -controllerblueprints.loadBluePrint=false -controllerblueprints.loadBluePrintPaths=/opt/app/onap/model-catalog/blueprint-model/service-blueprint -controllerblueprints.loadModelType=false -controllerblueprints.loadModeTypePaths=/opt/app/onap/model-catalog/definition-type/starter-type -controllerblueprints.loadResourceDictionary=false -controllerblueprints.loadResourceDictionaryPaths=/opt/app/onap/model-catalog/resource-dictionary/starter-dictionary +blueprintsprocessor.loadInitialData=false +blueprintsprocessor.loadBluePrint=false +blueprintsprocessor.loadBluePrintPaths=/opt/app/onap/model-catalog/blueprint-model/service-blueprint +blueprintsprocessor.loadModelType=false +blueprintsprocessor.loadModeTypePaths=/opt/app/onap/model-catalog/definition-type/starter-type +blueprintsprocessor.loadResourceDictionary=false +blueprintsprocessor.loadResourceDictionaryPaths=/opt/app/onap/model-catalog/resource-dictionary/starter-dictionary # CBA file extension controllerblueprints.loadCbaExtension=zip @@ -44,10 +44,7 @@ controllerblueprints.loadCbaExtension=zip blueprintsprocessor.grpcEnable=false blueprintsprocessor.httpPort=8080 blueprintsprocessor.grpcPort=9111 -# Blueprint Processor File Execution and Handling Properties -blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy -blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive -blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/work + # Primary Database Configuration blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE blueprintsprocessor.db.username=sa diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt index eafcaf44b..180ad7b48 100644 --- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt +++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt @@ -15,9 +15,10 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor +package org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots import com.github.fge.jsonpatch.diff.JsonDiff +import org.apache.logging.log4j.util.Strings import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshot import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshot.Status.RUNNING @@ -144,18 +145,20 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso */ private suspend fun compareConfigurationSnapshot(resourceId: String, resourceType: String, contentType : String) { + val cfgRunning = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, RUNNING) + val cfgCandidate = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, CANDIDATE) + + if (cfgRunning.isEmpty() || cfgCandidate.isEmpty()) { + setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, Strings.EMPTY) + return + } + when (contentType.toUpperCase()) { DIFF_JSON -> { - val cfgRunning = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, RUNNING) - val cfgCandidate = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, CANDIDATE) - val patchNode = JsonDiff.asJson(cfgRunning.jsonAsJsonType(), cfgCandidate.jsonAsJsonType()) setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, patchNode.toString()) } DIFF_XML -> { - val cfgRunning = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, RUNNING) - val cfgCandidate = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, CANDIDATE) - val myDiff = DiffBuilder .compare(Input.fromString(cfgRunning)) .withTest(Input.fromString(cfgCandidate)) diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt index 50c90f332..5fcba5b0c 100644 --- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt +++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt @@ -17,6 +17,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +import org.apache.logging.log4j.util.Strings import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshot.Status.RUNNING import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.slf4j.LoggerFactory @@ -40,7 +41,7 @@ class ResourceConfigSnapshotService(private val repository: ResourceConfigSnapsh status : ResourceConfigSnapshot.Status = RUNNING): String = withContext(Dispatchers.IO) { repository.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, status) - ?.config_snapshot ?: throw NoSuchElementException() + ?.config_snapshot ?: Strings.EMPTY } suspend fun write(snapshot: String, resId: String, resType: String, diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt index 79dd93037..c212908b9 100644 --- a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor +package org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots import com.fasterxml.jackson.databind.JsonNode import kotlinx.coroutines.runBlocking @@ -27,11 +27,12 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration -import org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor.ComponentConfigSnapshotsExecutor.Companion.DIFF_JSON -import org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor.ComponentConfigSnapshotsExecutor.Companion.DIFF_XML -import org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor.ComponentConfigSnapshotsExecutor.Companion.OPERATION_DIFF -import org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor.ComponentConfigSnapshotsExecutor.Companion.OPERATION_FETCH -import org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor.ComponentConfigSnapshotsExecutor.Companion.OPERATION_STORE +import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor +import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.DIFF_JSON +import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.DIFF_XML +import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.OPERATION_DIFF +import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.OPERATION_FETCH +import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.OPERATION_STORE import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshot import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshotService import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException @@ -192,9 +193,7 @@ class ComponentConfigSnapshotsExecutorTest { return@runBlocking } - // then; we should get error and the PAYLOAD payload in our output properties - assertTrue( bluePrintRuntimeService.getBluePrintError().errors.size > 0 ) - assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(), + assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName, ComponentConfigSnapshotsExecutor.OUTPUT_STATUS)) } @@ -234,7 +233,10 @@ class ComponentConfigSnapshotsExecutorTest { runBlocking { // when; asking for unknown content type diff operation; should get an error response try { - prepareRequestProperties(OPERATION_DIFF, "asdasd", "PNF", "YANG") + val resId = "121111" + val resType = "PNF" + cfgSnapshotService.write("snapshotConfig", resId, resType, ResourceConfigSnapshot.Status.CANDIDATE) + prepareRequestProperties(OPERATION_DIFF, resId, resType, "YANG") cfgSnapshotComponent.processNB(executionRequest) @@ -245,7 +247,6 @@ class ComponentConfigSnapshotsExecutorTest { } // then; we should get error in our output properties - assertTrue( bluePrintRuntimeService.getBluePrintError().errors.size == 1 ) assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName, ComponentConfigSnapshotsExecutor.OUTPUT_STATUS)) diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt index 2830cb547..3c989c154 100644 --- a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt +++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt @@ -48,18 +48,6 @@ class ResourceConfigSnapshotServiceTest { } } - @Test(expected = NoSuchElementException::class) - fun notFoundEntryReturnsExceptionTest() { - val tr = ResourceConfigSnapshot() - runBlocking { - every { - cfgRepository.findByResourceIdAndResourceTypeAndStatus(any(), any(), any()) - } returns tr - val snap = cfgService.findByResourceIdAndResourceTypeAndStatus("MISSING_ID", "UNKNOWN_TYPE") - assertTrue ( snap.isBlank(), "Not found but returned a non empty string" ) - } - } - @Test fun createNewResourceConfigSnapshotTest() { val tr = ResourceConfigSnapshot() 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 2a9218df3..769644288 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,5 +29,4 @@ 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/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt index 641175ca2..51170a9b2 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt @@ -28,6 +28,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.proc import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceDefinitionUtils.createResourceAssignments import org.onap.ccsdk.cds.controllerblueprints.core.* +import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintTemplateService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils @@ -151,7 +152,9 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments.toList()) resolvedContent = blueprintTemplateService.generateContent(bluePrintRuntimeService, nodeTemplateName, - artifactTemplate, resolvedParamJsonContent) + artifactTemplate, resolvedParamJsonContent, false, + mutableMapOf(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE to + properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE].asJsonPrimitive())) if (isToStore(properties)) { templateResolutionDBService.write(properties, resolvedContent, bluePrintRuntimeService, artifactPrefix) @@ -330,7 +333,9 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica resourceAssignmentList.forEach { if (compareOne(resourceResolution, it)) { log.info("Resource ({}) already resolve: value=({})", it.name, resourceResolution.value) - val value = resourceResolution.value!!.asJsonPrimitive() + + // Make sure to recreate value as per the defined type. + val value = resourceResolution.value!!.asJsonType(it.property!!.type) it.property!!.value = value it.status = resourceResolution.status ResourceAssignmentUtils.setResourceDataValue(it, raRuntimeService, value) 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 01cfd723b..117df1e5b 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 @@ -1,6 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2019 IBM. + * Modifications Copyright (c) 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. @@ -20,6 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.uti import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.node.ArrayNode +import com.fasterxml.jackson.databind.node.NullNode import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.databind.node.TextNode import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService @@ -194,85 +195,214 @@ class ResourceAssignmentUtils { @Throws(BluePrintProcessorException::class) fun parseResponseNode(responseNode: JsonNode, resourceAssignment: ResourceAssignment, raRuntimeService: ResourceAssignmentRuntimeService, outputKeyMapping: MutableMap<String, String>): JsonNode { + try { + if ((resourceAssignment.property?.type).isNullOrEmpty()) { + throw BluePrintProcessorException("Couldn't get data dictionary type for dictionary name (${resourceAssignment.name})") + } + val type = resourceAssignment.property!!.type + return when (type) { + in BluePrintTypes.validPrimitiveTypes() -> { + parseResponseNodeForPrimitiveTypes(responseNode, resourceAssignment, outputKeyMapping) + } + in BluePrintTypes.validCollectionTypes() -> { + // Array Types + parseResponseNodeForCollection(responseNode, resourceAssignment, raRuntimeService, outputKeyMapping) + } + else -> { + // Complex Types + parseResponseNodeForComplexType(responseNode, resourceAssignment, raRuntimeService, outputKeyMapping) + } + } + } catch (e: Exception) { + logger.error("Fail to parse response data, error message $e") + throw BluePrintProcessorException("${e.message}", e) + } + } + + private fun parseResponseNodeForPrimitiveTypes(responseNode: JsonNode, resourceAssignment: ResourceAssignment, + outputKeyMapping: MutableMap<String, String>): JsonNode { val dName = resourceAssignment.dictionaryName - val dSource = resourceAssignment.dictionarySource - val type = nullToEmpty(resourceAssignment.property?.type) - lateinit var entrySchemaType: String - when (type) { - in BluePrintTypes.validPrimitiveTypes() -> { - if (dSource !in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES) - logger.info("For template key (${resourceAssignment.name}) setting value as ($responseNode)") - val result = if (responseNode is ArrayNode) - responseNode.get(0) - else - responseNode - return if (result.isComplexType()) { - check(result.has(outputKeyMapping[dName])) { - "Fail to find output key mapping ($dName) in result." + logger.info("For template key (${resourceAssignment.name}) setting value as ($responseNode)") + + var result: JsonNode? = responseNode + if (responseNode.isComplexType()) { + val key = outputKeyMapping.keys.firstOrNull() + var returnNode: JsonNode? = responseNode + if (responseNode is ArrayNode) { + val arrayNode = responseNode.toList() + val firstElement = if (key.isNullOrEmpty()) { + arrayNode.first() + } + else{ + arrayNode.firstOrNull { element -> + element.isComplexType() && element.has(outputKeyMapping[key]) + } + } + + if (firstElement.isNull() || (firstElement!!.isComplexType() && !firstElement!!.has(outputKeyMapping[key])) + || (!result!!.isComplexType() && result is NullNode)) { + if (key.isNullOrEmpty()) { + throw BluePrintProcessorException("Fail to find mapping in the responseNode.") + } + else { + throw BluePrintProcessorException("Fail to find response with output key mapping ($key) in result.") } - result[outputKeyMapping[dName]] - } else { - result } + returnNode = firstElement } - in BluePrintTypes.validCollectionTypes() -> { - // Array Types - entrySchemaType = checkNotEmpty(resourceAssignment.property?.entrySchema?.type) { - "Entry schema is not defined for dictionary ($dName) info" + result = if (returnNode!!.isComplexType()) { + returnNode[outputKeyMapping[key]] + } + else { + returnNode + } + } + return result!! + } + + private fun parseResponseNodeForCollection(responseNode: JsonNode, resourceAssignment: ResourceAssignment, + raRuntimeService: ResourceAssignmentRuntimeService, + outputKeyMapping: MutableMap<String, String>): JsonNode { + val dName = resourceAssignment.dictionaryName + if ((resourceAssignment.property?.entrySchema?.type).isNullOrEmpty()) { + throw BluePrintProcessorException("Couldn't get data type for dictionary type " + + "(${resourceAssignment.property!!.type}) and dictionary name ($dName)") + } + val entrySchemaType = resourceAssignment.property!!.entrySchema!!.type + + var arrayNode = JacksonUtils.objectMapper.createArrayNode() + + if (outputKeyMapping.isNotEmpty()) { + when (responseNode) { + is ArrayNode -> { + val responseArrayNode = responseNode.toList() + for (responseSingleJsonNode in responseArrayNode) { + val arrayChildNode = parseArrayNodeElementWithOutputKeyMapping(raRuntimeService, responseSingleJsonNode, + outputKeyMapping, entrySchemaType) + arrayNode.add(arrayChildNode) + } } - val arrayNode = JacksonUtils.objectMapper.createArrayNode() - lateinit var responseValueNode: JsonNode - lateinit var propertyType: String - outputKeyMapping.map { - val arrayChildNode = JacksonUtils.objectMapper.createObjectNode() + is ObjectNode -> { val responseArrayNode = responseNode.rootFieldsToMap() - outer@ for ((key, responseSingleJsonNode) in responseArrayNode) { - if (key == it.key) { - if (entrySchemaType in BluePrintTypes.validPrimitiveTypes()) { - responseValueNode = responseSingleJsonNode - propertyType = entrySchemaType - - } else { - responseValueNode = responseSingleJsonNode.get(it.key) - propertyType = getPropertyType(raRuntimeService, entrySchemaType, it.key) - } - if (resourceAssignment.dictionarySource !in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES) - logger.info("For List Type Resource: key (${it.key}), value ($responseValueNode), " + - "type ({$propertyType})") - JacksonUtils.populateJsonNodeValues(it.value, - responseValueNode, propertyType, arrayChildNode) - arrayNode.add(arrayChildNode) - break@outer - } - } + val arrayNodeResult = parseObjectNodeWithOutputKeyMapping(responseArrayNode, outputKeyMapping, entrySchemaType) + arrayNode.addAll(arrayNodeResult) + } + else -> { + throw BluePrintProcessorException("Key-value response expected to match the responseNode.") } - if (resourceAssignment.dictionarySource !in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES) - logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)") - - return arrayNode } - else -> { - // Complex Types - entrySchemaType = checkNotEmpty(resourceAssignment.property?.type) { - "Entry schema is not defined for dictionary ($dName) info" + } + else { + when (responseNode) { + is ArrayNode -> { + responseNode.forEach { elementNode -> + arrayNode.add(elementNode) + } } - val objectNode = JacksonUtils.objectMapper.createObjectNode() + is ObjectNode -> { + val responseArrayNode = responseNode.rootFieldsToMap() + for ((key, responseSingleJsonNode) in responseArrayNode) { + val arrayChildNode = JacksonUtils.objectMapper.createObjectNode() + JacksonUtils.populateJsonNodeValues(key, responseSingleJsonNode, entrySchemaType, arrayChildNode) + arrayNode.add(arrayChildNode) + } + } + else -> { + arrayNode.add(responseNode) + } + } + } + + logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)") + + return arrayNode + } + + private fun parseResponseNodeForComplexType(responseNode: JsonNode, resourceAssignment: ResourceAssignment, + raRuntimeService: ResourceAssignmentRuntimeService, + outputKeyMapping: MutableMap<String, String>): JsonNode { + val entrySchemaType = resourceAssignment.property!!.type + val dictionaryName = resourceAssignment.dictionaryName!! + + var result: ObjectNode + if (checkOutputKeyMappingInDataTypeProperties(entrySchemaType, outputKeyMapping, raRuntimeService)) + { + result = parseArrayNodeElementWithOutputKeyMapping(raRuntimeService, responseNode, outputKeyMapping, entrySchemaType) + } + else { + val childNode = JacksonUtils.objectMapper.createObjectNode() + if (outputKeyMapping.isNotEmpty()) { outputKeyMapping.map { - val responseKeyValue = responseNode.get(it.key) - val propertyTypeForDataType = ResourceAssignmentUtils - .getPropertyType(raRuntimeService, entrySchemaType, it.key) + val responseKeyValue = if (responseNode.has(it.key)) { + responseNode.get(it.key) + } + else { + NullNode.getInstance() + } - if (resourceAssignment.dictionarySource !in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES) - logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), type ({$propertyTypeForDataType})") - JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, propertyTypeForDataType, objectNode) + JacksonUtils.populateJsonNodeValues(it.value, + responseKeyValue, entrySchemaType, childNode) } + } + else { + JacksonUtils.populateJsonNodeValues(dictionaryName, responseNode, entrySchemaType, childNode) + } + result = childNode + } + return result + } + + private fun parseArrayNodeElementWithOutputKeyMapping(raRuntimeService: ResourceAssignmentRuntimeService, + responseSingleJsonNode: JsonNode, outputKeyMapping: + MutableMap<String, String>, entrySchemaType: String): ObjectNode { + val arrayChildNode = JacksonUtils.objectMapper.createObjectNode() + + outputKeyMapping.map { + val responseKeyValue = if (responseSingleJsonNode.has(it.key)) { + responseSingleJsonNode.get(it.key) + } + else { + NullNode.getInstance() + } + val propertyTypeForDataType = ResourceAssignmentUtils + .getPropertyType(raRuntimeService, entrySchemaType, it.key) + + logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), " + + "type ({$propertyTypeForDataType})") - if (resourceAssignment.dictionarySource !in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES) - logger.info("For template key (${resourceAssignment.name}) setting value as ($objectNode)") + JacksonUtils.populateJsonNodeValues(it.value, + responseKeyValue, propertyTypeForDataType, arrayChildNode) + } + + return arrayChildNode + } + + private fun parseObjectNodeWithOutputKeyMapping(responseArrayNode: MutableMap<String, JsonNode>, + outputKeyMapping: MutableMap<String, String>, + entrySchemaType: String): ArrayNode { + val arrayNode = JacksonUtils.objectMapper.createArrayNode() + outputKeyMapping.map { + val objectNode = JacksonUtils.objectMapper.createObjectNode() + val responseSingleJsonNode = responseArrayNode.filterKeys { key -> key == it.key }.entries.firstOrNull() - return objectNode + if (responseSingleJsonNode == null) { + JacksonUtils.populateJsonNodeValues(it.value, NullNode.getInstance(), entrySchemaType, objectNode) } + else + { + JacksonUtils.populateJsonNodeValues(it.value, responseSingleJsonNode.value, entrySchemaType, objectNode) + } + arrayNode.add(objectNode) } + + return arrayNode + } + + private fun checkOutputKeyMappingInDataTypeProperties(dataTypeName: String, outputKeyMapping: MutableMap<String, String>, + raRuntimeService: ResourceAssignmentRuntimeService): Boolean { + val dataTypeProps = raRuntimeService.bluePrintContext().dataTypeByName(dataTypeName)?.properties + val result = outputKeyMapping.filterKeys { !dataTypeProps!!.containsKey(it) }.keys.firstOrNull() + return result == null } } }
\ No newline at end of file diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt index 153e88937..e6cf05955 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt @@ -20,7 +20,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties -import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintProcessorProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertiesService import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertySevice @@ -41,7 +41,7 @@ import kotlin.test.assertNotNull @ContextConfiguration(classes = [DatabaseResourceAssignmentProcessor::class, BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibPropertySevice::class, BluePrintDBLibConfiguration::class, BluePrintCoreConfiguration::class, MockDatabaseConfiguration::class, MockBlueprintProcessorCatalogServiceImpl::class, - BlueprintProcessorProperties::class]) + BlueprintPropertiesService::class]) @TestPropertySource(locations = ["classpath:application-test.properties"]) class DatabaseResourceResolutionProcessorTest { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt index 9c6aae250..6a37f5914 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt @@ -73,7 +73,7 @@ class RestResourceResolutionProcessorTest { val resourceAssignment = ResourceAssignment().apply { name = "rr-name" dictionaryName = "vnf_name" - dictionarySource = "config-data" + dictionarySource = "sdnc" property = PropertyDefinition().apply { type = "string" } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt index 9b87c12eb..9365c3e34 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (c) 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. @@ -18,16 +19,86 @@ * ============LICENSE_END========================================================= */ - package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.node.NullNode import com.fasterxml.jackson.databind.node.TextNode +import io.mockk.every +import io.mockk.spyk +import org.junit.Before import org.junit.Test +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType +import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType +import org.onap.ccsdk.cds.controllerblueprints.core.data.EntrySchema import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import kotlin.test.assertEquals +data class IpAddress(val port: String, val ip: String) +data class Host(val name: String, val ipAddress: IpAddress) +data class ExpectedResponseIp(val ip: String) +data class ExpectedResponsePort(val port: String) + class ResourceAssignmentUtilsTest { + private lateinit var resourceAssignmentRuntimeService: ResourceAssignmentRuntimeService + + @Before + fun setup() { + + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") + + resourceAssignmentRuntimeService = spyk(ResourceAssignmentRuntimeService("1234", bluePrintContext)) + + val propertiesDefinition1 = PropertyDefinition().apply { + type = "string" + id = "port" + } + + val propertiesDefinition2 = PropertyDefinition().apply { + type = "string" + id = "ip" + } + + val propertiesDefinition3 = PropertyDefinition().apply { + type = "string" + id = "name" + } + + val propertiesDefinition4 = PropertyDefinition().apply { + type = "ip-address" + id = "ipAddress" + } + + var mapOfPropertiesIpAddress = mutableMapOf<String, PropertyDefinition>() + mapOfPropertiesIpAddress["port"] = propertiesDefinition1 + mapOfPropertiesIpAddress["ip"] = propertiesDefinition2 + + var mapOfPropertiesHost = mutableMapOf<String, PropertyDefinition>() + mapOfPropertiesHost["name"] = propertiesDefinition3 + mapOfPropertiesHost["ipAddress"] = propertiesDefinition4 + + val myDataTypeIpaddress = DataType().apply { + id = "ip-address" + properties = mapOfPropertiesIpAddress + } + + val myDataTypeHost = DataType().apply { + id = "host" + properties = mapOfPropertiesHost + } + + every { resourceAssignmentRuntimeService.bluePrintContext().dataTypeByName("ip-address") } returns myDataTypeIpaddress + + every { resourceAssignmentRuntimeService.bluePrintContext().dataTypeByName("host") } returns myDataTypeHost + + every { resourceAssignmentRuntimeService.setNodeTemplateAttributeValue(any(), any(), any()) } returns Unit + } @Test fun `generateResourceDataForAssignments - positive test`() { @@ -43,7 +114,6 @@ class ResourceAssignmentUtilsTest { //then the assignment should produce a valid result val expected = "{\n" + " \"pnf-id\" : \"valid_value\"\n" + "}" assertEquals(expected, outcome, "unexpected outcome generated") - } @Test @@ -76,4 +146,243 @@ class ResourceAssignmentUtilsTest { } return resourceAssignmentForTest } + + @Test + fun parseResponseNodeTestForPrimitivesTypes(){ + // Input values for primitive type + val keyValue = mutableMapOf<String, String>() + keyValue["value"]= "1.2.3.1" + val expectedPrimitiveType = TextNode("1.2.3.1") + + var outcome = prepareResponseNodeForTest("sample-value", "string", + "", "1.2.3.1".asJsonPrimitive()) + assertEquals(expectedPrimitiveType, outcome, "Unexpected outcome returned for primitive type of simple String") + outcome = prepareResponseNodeForTest("sample-key-value", "string", "", keyValue) + assertEquals(expectedPrimitiveType, outcome, "Unexpected outcome returned for primitive type of key-value String") + } + + @Test + fun parseResponseNodeTestForCollectionsOfString(){ + // Input values for collection type + val mapOfString = mutableMapOf<String, String>() + mapOfString["value1"] = "1.2.3.1" + mapOfString["port"] = "8888" + mapOfString["value2"] = "1.2.3.2" + val arrayOfKeyValue = arrayListOf(ExpectedResponseIp("1.2.3.1"), + ExpectedResponsePort( "8888"), ExpectedResponseIp("1.2.3.2")) + + val mutableMapKeyValue = mutableMapOf<String, String>() + mutableMapKeyValue["value1"] = "1.2.3.1" + mutableMapKeyValue["port"] = "8888" + + //List + val expectedListOfString = arrayOfKeyValue.asJsonType() + var outcome = prepareResponseNodeForTest("listOfString", "list", + "string", mapOfString.asJsonType()) + assertEquals(expectedListOfString, outcome, "unexpected outcome returned for list of String") + + //Map + val expectedMapOfString = mutableMapOf<String, JsonNode>() + expectedMapOfString["ip"] = "1.2.3.1".asJsonPrimitive() + expectedMapOfString["port"] = "8888".asJsonPrimitive() + + val arrayNode = JacksonUtils.objectMapper.createArrayNode() + expectedMapOfString.map { + val arrayChildNode = JacksonUtils.objectMapper.createObjectNode() + arrayChildNode.set(it.key, it.value) + arrayNode.add(arrayChildNode) + } + val arrayChildNode1 = JacksonUtils.objectMapper.createObjectNode() + arrayChildNode1.set("ip", NullNode.getInstance()) + arrayNode.add(arrayChildNode1) + outcome = prepareResponseNodeForTest("mapOfString", "map", "string", + mutableMapKeyValue.asJsonType()) + assertEquals(arrayNode, outcome, "unexpected outcome returned for map of String") + } + + @Test + fun parseResponseNodeTestForCollectionsOfJsonNode(){ + // Input values for collection type + val mapOfString = mutableMapOf<String, JsonNode>() + mapOfString["value1"] = "1.2.3.1".asJsonPrimitive() + mapOfString["port"] = "8888".asJsonPrimitive() + mapOfString["value2"] = "1.2.3.2".asJsonPrimitive() + val arrayOfKeyValue = arrayListOf(ExpectedResponseIp("1.2.3.1"), + ExpectedResponsePort( "8888"), ExpectedResponseIp("1.2.3.2")) + + val mutableMapKeyValue = mutableMapOf<String, JsonNode>() + mutableMapKeyValue["value1"] = "1.2.3.1".asJsonPrimitive() + mutableMapKeyValue["port"] = "8888".asJsonPrimitive() + + //List + val expectedListOfString = arrayOfKeyValue.asJsonType() + var outcome = prepareResponseNodeForTest("listOfString", "list", + "string", mapOfString.asJsonType()) + assertEquals(expectedListOfString, outcome, "unexpected outcome returned for list of String") + + //Map + val expectedMapOfString = mutableMapOf<String, JsonNode>() + expectedMapOfString["ip"] = "1.2.3.1".asJsonPrimitive() + expectedMapOfString["port"] = "8888".asJsonPrimitive() + val arrayNode = JacksonUtils.objectMapper.createArrayNode() + expectedMapOfString.map { + val arrayChildNode = JacksonUtils.objectMapper.createObjectNode() + arrayChildNode.set(it.key, it.value) + arrayNode.add(arrayChildNode) + } + val arrayChildNode1 = JacksonUtils.objectMapper.createObjectNode() + arrayChildNode1.set("ip", NullNode.getInstance()) + arrayNode.add(arrayChildNode1) + outcome = prepareResponseNodeForTest("mapOfString", "map", + "string", mutableMapKeyValue.asJsonType()) + assertEquals(arrayNode, outcome, "unexpected outcome returned for map of String") + } + + @Test + fun parseResponseNodeTestForCollectionsOfComplexType(){ + // Input values for collection type + val mapOfComplexType = mutableMapOf<String, JsonNode>() + mapOfComplexType["value1"] = IpAddress("1111", "1.2.3.1").asJsonType() + mapOfComplexType["value2"] = IpAddress("2222", "1.2.3.2").asJsonType() + mapOfComplexType["value3"] = IpAddress("3333", "1.2.3.3").asJsonType() + + //List + val arrayNode = JacksonUtils.objectMapper.createArrayNode() + mapOfComplexType.map { + val arrayChildNode = JacksonUtils.objectMapper.createObjectNode() + arrayChildNode.set("ipAddress", it.value) + arrayNode.add(arrayChildNode) + } + var outcome = prepareResponseNodeForTest("listOfMyDataType", "list", + "ip-address", mapOfComplexType.asJsonType()) + assertEquals(arrayNode, outcome, "unexpected outcome returned for list of String") + } + + @Test + fun `parseResponseNodeTestForComplexType find one output key mapping`(){ + // Input values for complex type + val objectNode = JacksonUtils.objectMapper.createObjectNode() + + // Input values for collection type + val mapOfComplexType = mutableMapOf<String, JsonNode>() + mapOfComplexType["value"] = Host("my-ipAddress", IpAddress("1111", "1.2.3.1")).asJsonType() + mapOfComplexType["port"] = "8888".asJsonType() + mapOfComplexType["something"] = "1.2.3.2".asJsonType() + + val expectedComplexType = objectNode.set("ipAddress", Host("my-ipAddress", IpAddress("1111", "1.2.3.1")).asJsonType()) + val outcome = prepareResponseNodeForTest("complexTypeOneKeys", "host", + "", mapOfComplexType.asJsonType()) + assertEquals(expectedComplexType, outcome, "Unexpected outcome returned for complex type") + } + + @Test + fun `parseResponseNodeTestForComplexType find all output key mapping`(){ + // Input values for complex type + val objectNode = JacksonUtils.objectMapper.createObjectNode() + + // Input values for collection type + val mapOfComplexType = mutableMapOf<String, JsonNode>() + mapOfComplexType["name"] = "my-ipAddress".asJsonType() + mapOfComplexType["ipAddress"] = IpAddress("1111", "1.2.3.1").asJsonType() + + val expectedComplexType = Host("my-ipAddress", IpAddress("1111", "1.2.3.1")).asJsonType() + val outcome = prepareResponseNodeForTest("complexTypeAllKeys", "host", + "", mapOfComplexType.asJsonType()) + assertEquals(expectedComplexType, outcome, "Unexpected outcome returned for complex type") + } + + private fun prepareResponseNodeForTest(dictionary_source: String, sourceType: String, entrySchema: String, + response: Any): JsonNode { + + val resourceAssignment = when (sourceType) { + "list", "map" -> { + prepareRADataDictionaryCollection(dictionary_source, sourceType, entrySchema) + } + "string" -> { + prepareRADataDictionaryOfPrimaryType(dictionary_source) + } + else -> { + prepareRADataDictionaryComplexType(dictionary_source, sourceType, entrySchema) + } + } + + val responseNode = checkNotNull(JacksonUtils.getJsonNode(response)) { + "Failed to get database query result into Json node." + } + + val outputKeyMapping = prepareOutputKeyMapping(dictionary_source) + + return ResourceAssignmentUtils.parseResponseNode(responseNode, resourceAssignment, resourceAssignmentRuntimeService, outputKeyMapping) + } + + private fun prepareRADataDictionaryOfPrimaryType(dictionary_source: String): ResourceAssignment { + return ResourceAssignment().apply { + name = "ipAddress" + dictionaryName = "sample-ip" + dictionarySource = "$dictionary_source" + property = PropertyDefinition().apply { + type = "string" + } + } + } + + private fun prepareRADataDictionaryCollection(dictionary_source: String, sourceType: String, schema: String): ResourceAssignment { + return ResourceAssignment().apply { + name = "ipAddress-list" + dictionaryName = "sample-licenses" + dictionarySource = "$dictionary_source" + property = PropertyDefinition().apply { + type = "$sourceType" + entrySchema = EntrySchema().apply { + type = "$schema" + } + } + } + } + + private fun prepareRADataDictionaryComplexType(dictionary_source: String, sourceType: String, schema: String): ResourceAssignment { + return ResourceAssignment().apply { + name = "ipAddress-complexType" + dictionaryName = "sample-licenses" + dictionarySource = "$dictionary_source" + property = PropertyDefinition().apply { + type = "$sourceType" + } + } + } + + private fun prepareOutputKeyMapping(dictionary_source: String): MutableMap<String, String> { + val outputMapping = mutableMapOf<String, String>() + + when (dictionary_source) { + "listOfString", "mapOfString" -> { + //List of string + outputMapping["value1"] = "ip" + outputMapping["port"] = "port" + outputMapping["value2"] = "ip" + } + "listOfMyDataType", "mapOfMyDataType" -> { + //List or map of complex Type + outputMapping["value1"] = "ipAddress" + outputMapping["value2"] = "ipAddress" + outputMapping["value3"] = "ipAddress" + } + "sample-key-value", "sample-value" -> { + //Primary Type + if (dictionary_source=="sample-key-value") + outputMapping["sample-ip"] = "value" + } + else -> { + //Complex Type + if (dictionary_source == "complexTypeOneKeys") + outputMapping["value"] = "ipAddress" + else { + outputMapping["name"] = "name" + outputMapping["ipAddress"] = "ipAddress" + } + + } + } + return outputMapping + } }
\ No newline at end of file diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties index 3218a585d..4483ac835 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties @@ -30,10 +30,10 @@ blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints -blueprintsprocessor.restclient.config-data.type=basic-auth -blueprintsprocessor.restclient.config-data.url=http://127.0.0.1:9911 -blueprintsprocessor.restclient.config-data.username=sampleuser -blueprintsprocessor.restclient.config-data.password=sampletoken +blueprintsprocessor.restclient.sdnc.type=basic-auth +blueprintsprocessor.restclient.sdnc.url=http://127.0.0.1:9911 +blueprintsprocessor.restclient.sdnc.username=sampleuser +blueprintsprocessor.restclient.sdnc.password=sampletoken blueprintsprocessor.restclient.aai-data.type=basic-auth blueprintsprocessor.restclient.aai-data.url=http://127.0.0.1:30800 diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml index f6288d784..783d8efbe 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml @@ -35,10 +35,6 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>db-resources</artifactId> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> <artifactId>blueprint-validation</artifactId> </dependency> <dependency> 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 new file mode 100755 index 000000000..17ffd5bac --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt @@ -0,0 +1,117 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain + +import com.fasterxml.jackson.annotation.JsonFormat +import io.swagger.annotations.ApiModelProperty +import org.hibernate.annotations.Proxy +import org.springframework.data.annotation.LastModifiedDate +import org.springframework.data.jpa.domain.support.AuditingEntityListener +import java.io.Serializable +import java.util.* +import javax.persistence.* + +/** + * Provide BlueprintModel Entity + * + * @author Brinda Santh + * @version 1.0 + */ + +@EntityListeners(AuditingEntityListener::class) +@Entity +@Table(name = "CONFIG_MODEL", uniqueConstraints = [UniqueConstraint(columnNames = ["artifact_name", "artifact_version"])]) +@Proxy(lazy = false) +class BlueprintModel : Serializable { + @Id + @Column(name = "config_model_id") + var id: String? = null + + @Column(name = "service_uuid") + var serviceUUID: String? = null + + @Column(name = "distribution_id") + var distributionId: String? = null + + @Column(name = "service_name") + var serviceName: String? = null + + @Column(name = "service_description") + var serviceDescription: String? = null + + @Column(name = "resource_uuid") + var resourceUUID: String? = null + + @Column(name = "resource_instance_name") + var resourceInstanceName: String? = null + + @Column(name = "resource_name") + var resourceName: String? = null + + @Column(name = "resource_version") + var resourceVersion: String? = null + + @Column(name = "resource_type") + var resourceType: String? = null + + @Column(name = "artifact_uuid") + var artifactUUId: String? = null + + @Column(name = "artifact_type") + var artifactType: String? = null + + @Column(name = "artifact_version", nullable = false) + @ApiModelProperty(required = true) + lateinit var artifactVersion: String + + @Lob + @Column(name = "artifact_description") + var artifactDescription: String? = null + + @Column(name = "internal_version") + var internalVersion: Int? = null + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + @LastModifiedDate + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "creation_date") + var createdDate = Date() + + @Column(name = "artifact_name", nullable = false) + @ApiModelProperty(required = true) + lateinit var artifactName: String + + @Column(name = "published", nullable = false) + @ApiModelProperty(required = true) + lateinit var published: String + + @Column(name = "updated_by", nullable = false) + @ApiModelProperty(required = true) + lateinit var updatedBy: String + + @Lob + @Column(name = "tags", nullable = false) + @ApiModelProperty(required = true) + lateinit var tags: String + + @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = [CascadeType.ALL]) + var blueprintModelContent: BlueprintModelContent? = null + + companion object { + private const val serialVersionUID = 1L + } +} diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt index dc02d2fd0..e0d26a7ae 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt @@ -1,59 +1,55 @@ /* - * Copyright © 2019 Bell Canada + * Copyright © 2019 IBM. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF 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.db.primary.domain import com.fasterxml.jackson.annotation.JsonFormat import io.swagger.annotations.ApiModelProperty -import java.io.Serializable -import java.util.Date -import java.util.Objects -import javax.persistence.Column -import javax.persistence.Entity -import javax.persistence.EntityListeners -import javax.persistence.Id -import javax.persistence.JoinColumn -import javax.persistence.Lob -import javax.persistence.OneToOne -import javax.persistence.Table -import javax.persistence.Temporal -import javax.persistence.TemporalType import org.springframework.data.annotation.LastModifiedDate import org.springframework.data.jpa.domain.support.AuditingEntityListener +import java.io.Serializable +import java.util.* +import javax.persistence.* +/** + * Provide Blueprint Model Content Entity + * + * @author Brinda Santh + * @version 1.0 + */ @EntityListeners(AuditingEntityListener::class) @Entity -@Table(name = "BLUEPRINT_CONTENT_RUNTIME") -class BlueprintProcessorModelContent : Serializable { +@Table(name = "CONFIG_MODEL_CONTENT") +class BlueprintModelContent : Serializable { @Id - @Column(name = "blueprint_content_runtime_id") + @Column(name = "config_model_content_id") var id: String? = null @Column(name = "name", nullable = false) @ApiModelProperty(required = true) - var name: String? = null + lateinit var name: String @Column(name = "content_type", nullable = false) @ApiModelProperty(required = true) - var contentType: String? = null + lateinit var contentType: String @OneToOne - @JoinColumn(name = "blueprint_runtime_id") - var blueprintModel: BlueprintProcessorModel? = null + @JoinColumn(name = "config_model_id") + var blueprintModel: BlueprintModel? = null @Lob @Column(name = "description") @@ -62,7 +58,7 @@ class BlueprintProcessorModelContent : Serializable { @Lob @Column(name = "content", nullable = false) @ApiModelProperty(required = true) - var content: ByteArray? = null + lateinit var content: ByteArray @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") @LastModifiedDate @@ -82,10 +78,10 @@ class BlueprintProcessorModelContent : Serializable { if (o === this) { return true } - if (o !is BlueprintProcessorModelContent) { + if (o !is BlueprintModelContent) { return false } - val blueprintModelContent = o as BlueprintProcessorModelContent? + val blueprintModelContent = o as BlueprintModelContent? return (id == blueprintModelContent!!.id && name == blueprintModelContent.name && contentType == blueprintModelContent.contentType) } @@ -95,6 +91,7 @@ class BlueprintProcessorModelContent : Serializable { } companion object { + private const val serialVersionUID = 1L } 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 new file mode 100644 index 000000000..f00d5cadf --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt @@ -0,0 +1,82 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain + +import com.fasterxml.jackson.annotation.JsonFormat +import com.fasterxml.jackson.annotation.JsonTypeInfo +import com.fasterxml.jackson.annotation.JsonTypeName +import org.springframework.data.annotation.LastModifiedDate +import java.io.Serializable +import java.util.* +import javax.persistence.* + +/** + * Provide Blueprint Model Search Entity + * + * @author Brinda Santh + * @version 1.0 + */ + +@Entity +@Table(name = "CONFIG_MODEL") +@JsonTypeName("blueprintModel") +@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) +class BlueprintModelSearch : Serializable { + + @Id + @Column(name = "config_model_id") + var id: String? = null + + @Column(name = "artifact_uuid") + var artifactUUId: String? = null + + @Column(name = "artifact_type") + var artifactType: String? = null + + @Column(name = "artifact_version", nullable = false) + var artifactVersion: String? = null + + @Lob + @Column(name = "artifact_description") + var artifactDescription: String? = null + + @Column(name = "internal_version") + var internalVersion: Int? = null + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + @LastModifiedDate + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "creation_date") + var createdDate = Date() + + @Column(name = "artifact_name", nullable = false) + var artifactName: String? = null + + @Column(name = "published", nullable = false) + var published: String? = null + + @Column(name = "updated_by", nullable = false) + var updatedBy: String? = null + + @Lob + @Column(name = "tags", nullable = false) + var tags: String? = null + + companion object { + const val serialversionuid = 1L + } +} diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt deleted file mode 100755 index c565262db..000000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright © 2019 Bell Canada - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain - -import com.fasterxml.jackson.annotation.JsonFormat -import io.swagger.annotations.ApiModelProperty -import javax.persistence.Entity -import javax.persistence.EntityListeners -import javax.persistence.Table -import org.hibernate.annotations.Proxy -import org.springframework.data.annotation.LastModifiedDate -import org.springframework.data.jpa.domain.support.AuditingEntityListener -import java.io.Serializable -import java.util.* -import javax.persistence.CascadeType -import javax.persistence.Column -import javax.persistence.FetchType -import javax.persistence.Id -import javax.persistence.Lob -import javax.persistence.OneToOne -import javax.persistence.Temporal -import javax.persistence.TemporalType - -@EntityListeners(AuditingEntityListener::class) -@Entity -@Table(name = "BLUEPRINT_RUNTIME") -@Proxy(lazy = false) -class BlueprintProcessorModel : Serializable { - - @Id - @Column(name = "blueprint_runtime_id") - var id: String? = null - - @Column(name = "artifact_type") - var artifactType: String? = null - - @Column(name = "artifact_version", nullable = false) - @ApiModelProperty(required = true) - var artifactVersion: String? = null - - @Lob - @Column(name = "artifact_description") - var artifactDescription: String? = null - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - @LastModifiedDate - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "creation_date") - var createdDate = Date() - - @Column(name = "artifact_name", nullable = false) - @ApiModelProperty(required = true) - var artifactName: String? = null - - @Column(name = "updated_by", nullable = false) - @ApiModelProperty(required = true) - var updatedBy: String? = null - - @Lob - @Column(name = "tags", nullable = false) - @ApiModelProperty(required = true) - var tags: String? = null - - @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = [CascadeType.ALL]) - var blueprintModelContent: BlueprintProcessorModelContent? = null - - companion object { - private const val serialVersionUID = 1L - } -} diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelContentRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt index a2c37593b..7bbfbce79 100644 --- a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelContentRepository.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt @@ -15,19 +15,21 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.db.resources.repository +package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository import org.jetbrains.annotations.NotNull -import java.util.Optional +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent import org.springframework.data.jpa.repository.JpaRepository -import org.springframework.data.repository.NoRepositoryBean +import org.springframework.stereotype.Repository +import java.util.* /** * @param <T> Model * @param <B> ModelContent */ -@NoRepositoryBean -interface ModelContentRepository<T, B> : JpaRepository<B, String> { +@Repository +interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent, String> { /** * This is a findById method @@ -36,7 +38,7 @@ interface ModelContentRepository<T, B> : JpaRepository<B, String> { * @return Optional<T> */ @NotNull - override fun findById(@NotNull id: String): Optional<B> + override fun findById(@NotNull id: String): Optional<BlueprintModelContent> /** * This is a findTopByBlueprintModelAndContentType method @@ -45,7 +47,8 @@ interface ModelContentRepository<T, B> : JpaRepository<B, String> { * @param contentType contentType * @return B? */ - fun findTopByBlueprintModelAndContentType(blueprintModel: T, contentType: String): B? + fun findTopByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String) + : BlueprintModelContent? /** * This is a findByBlueprintModelAndContentType method @@ -54,7 +57,8 @@ interface ModelContentRepository<T, B> : JpaRepository<B, String> { * @param contentType contentType * @return List<B> */ - fun findByBlueprintModelAndContentType(blueprintModel: T, contentType: String): List<B> + fun findByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String) + : List<BlueprintModelContent> /** * This is a findByBlueprintModel method @@ -62,7 +66,7 @@ interface ModelContentRepository<T, B> : JpaRepository<B, String> { * @param blueprintModel T * @return List<B> */ - fun findByBlueprintModel(blueprintModel: T): List<B> + fun findByBlueprintModel(blueprintModel: BlueprintModel): List<BlueprintModelContent> /** * This is a findByBlueprintModelAndContentTypeAndName method @@ -72,14 +76,15 @@ interface ModelContentRepository<T, B> : JpaRepository<B, String> { * @param name name * @return B? */ - fun findByBlueprintModelAndContentTypeAndName(blueprintModel: T, contentType: String, name: String): B? + fun findByBlueprintModelAndContentTypeAndName(blueprintModel: BlueprintModel, + contentType: String, name: String): BlueprintModelContent? /** * This is a deleteByMdeleteByBlueprintModelodelName method * * @param blueprintModel T */ - fun deleteByBlueprintModel(blueprintModel: T) + fun deleteByBlueprintModel(blueprintModel: BlueprintModel) /** * This is a deleteById method diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelRepository.kt index c00b7b6e4..8ef352852 100644 --- a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelRepository.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelRepository.kt @@ -15,19 +15,20 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.db.resources.repository +package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository import org.jetbrains.annotations.NotNull +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel import org.springframework.data.jpa.repository.JpaRepository -import org.springframework.data.repository.NoRepositoryBean +import org.springframework.stereotype.Repository import java.util.* import javax.transaction.Transactional /** * @param <T> Model */ -@NoRepositoryBean -interface ModelRepository<T> : JpaRepository<T, String> { +@Repository +interface BlueprintModelRepository : JpaRepository<BlueprintModel, String> { /** * This is a findById method @@ -35,8 +36,7 @@ interface ModelRepository<T> : JpaRepository<T, String> { * @param id id * @return Optional<T> */ - @NotNull - override fun findById(@NotNull id: String): Optional<T> + override fun findById(id: String): Optional<BlueprintModel> /** * This is a findByArtifactNameAndArtifactVersion method @@ -45,7 +45,7 @@ interface ModelRepository<T> : JpaRepository<T, String> { * @param artifactVersion artifactVersion * @return T? */ - fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): T? + fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): BlueprintModel? /** * This is a findTopByArtifactNameOrderByArtifactIdDesc method @@ -53,7 +53,7 @@ interface ModelRepository<T> : JpaRepository<T, String> { * @param artifactName artifactName * @return T? */ - fun findTopByArtifactNameOrderByArtifactVersionDesc(artifactName: String): T? + fun findTopByArtifactNameOrderByArtifactVersionDesc(artifactName: String): BlueprintModel? /** * This is a findTopByArtifactName method @@ -61,7 +61,7 @@ interface ModelRepository<T> : JpaRepository<T, String> { * @param artifactName artifactName * @return List<T> */ - fun findTopByArtifactName(artifactName: String): List<T> + fun findTopByArtifactName(artifactName: String): List<BlueprintModel> /** * This is a findByTagsContainingIgnoreCase method @@ -69,7 +69,7 @@ interface ModelRepository<T> : JpaRepository<T, String> { * @param tags tags * @return List<T> */ - fun findByTagsContainingIgnoreCase(tags: String): List<T> + fun findByTagsContainingIgnoreCase(tags: String): List<BlueprintModel> /** * This is a deleteByArtifactNameAndArtifactVersion method diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ControllerBlueprintModelSearchRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt index bf77af66c..f5ef0740e 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ControllerBlueprintModelSearchRepository.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt @@ -14,21 +14,20 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.repository +package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository -import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelSearch +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch import org.springframework.data.jpa.repository.JpaRepository import org.springframework.stereotype.Repository -import java.util.* /** - * ControllerBlueprintModelSearchRepository.java Purpose: Provide Configuration Generator AsdcArtifactsRepository + * Provide Configuration Generator AsdcArtifactsRepository * * @author Brinda Santh * @version 1.0 */ @Repository -interface ControllerBlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, Long> { +interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, Long> { /** * This is a findById method @@ -36,7 +35,7 @@ interface ControllerBlueprintModelSearchRepository : JpaRepository<BlueprintMode * @param id id * @return Optional<BlueprintModelSearch> </BlueprintModelSearch> */ - fun findById(id: String): Optional<BlueprintModelSearch> + fun findById(id: String): BlueprintModelSearch? /** * This is a findAll method @@ -51,7 +50,7 @@ interface ControllerBlueprintModelSearchRepository : JpaRepository<BlueprintMode * @param artifactVersion artifactVersion * @return Optional<AsdcArtifacts> </AsdcArtifacts> */ - fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): Optional<BlueprintModelSearch> + fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): BlueprintModelSearch? /** * This is a findByTagsContainingIgnoreCase method diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt deleted file mode 100644 index c914af8f3..000000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2019 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository - -import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel -import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent -import org.onap.ccsdk.cds.controllerblueprints.db.resources.repository.ModelContentRepository - -interface BlueprintProcessorModelContentRepository : ModelContentRepository<BlueprintProcessorModel, BlueprintProcessorModelContent>
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt deleted file mode 100644 index 4f22bf07d..000000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2019 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository - -import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel -import org.onap.ccsdk.cds.controllerblueprints.db.resources.repository.ModelRepository - -interface BlueprintProcessorModelRepository : ModelRepository<BlueprintProcessorModel> diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintCatalogServiceImpl.kt index b3436a991..aef7c18a2 100644 --- a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintCatalogServiceImpl.kt @@ -16,10 +16,10 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.db.resources +package org.onap.ccsdk.cds.blueprintsprocessor.db.service import org.onap.ccsdk.cds.controllerblueprints.core.* -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils @@ -31,7 +31,7 @@ import javax.persistence.MappedSuperclass @MappedSuperclass abstract class BlueprintCatalogServiceImpl( - private val bluePrintPathConfiguration: BluePrintPathConfiguration, + private val bluePrintLoadConfiguration: BluePrintLoadConfiguration, private val blueprintValidator: BluePrintValidatorService) : BluePrintCatalogService { private val log = LoggerFactory.getLogger(BlueprintCatalogServiceImpl::class.java)!! @@ -44,7 +44,7 @@ abstract class BlueprintCatalogServiceImpl( if (blueprintFile.isDirectory) { log.info("Save processing($processingId) Working Dir(${blueprintFile.absolutePath})") workingDir = blueprintFile.absolutePath - archiveFile = normalizedFile(bluePrintPathConfiguration.blueprintArchivePath, processingId, "cba.zip") + archiveFile = normalizedFile(bluePrintLoadConfiguration.blueprintArchivePath, processingId, "cba.zip") if (!BluePrintArchiveUtils.compress(blueprintFile, archiveFile)) { throw BluePrintException("Fail to compress blueprint") @@ -52,7 +52,7 @@ abstract class BlueprintCatalogServiceImpl( } else { // Compressed File log.info("Save processing($processingId) CBA(${blueprintFile.absolutePath})") - workingDir = normalizedPathName(bluePrintPathConfiguration.blueprintWorkingPath, processingId) + workingDir = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, processingId) archiveFile = blueprintFile // Decompress the CBA file to working Directory blueprintFile.deCompress(workingDir) diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintProcessorCatalogServiceImpl.kt index 9d5d630de..9ce45d11e 100755 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintProcessorCatalogServiceImpl.kt @@ -16,45 +16,44 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.blueprintsprocessor.db +package org.onap.ccsdk.cds.blueprintsprocessor.db.service -import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel -import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent -import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintProcessorModelRepository +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository import org.onap.ccsdk.cds.controllerblueprints.core.* import org.onap.ccsdk.cds.controllerblueprints.core.common.ApplicationConstants -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils -import org.onap.ccsdk.cds.controllerblueprints.db.resources.BlueprintCatalogServiceImpl import org.slf4j.LoggerFactory import org.springframework.dao.DataIntegrityViolationException import org.springframework.stereotype.Service import java.io.File import java.nio.file.Path import java.util.* - +// TODO("Duplicate : Merge BlueprintProcessorCatalogServiceImpl and ControllerBlueprintCatalogServiceImpl") /** * Similar/Duplicate implementation in [org.onap.ccsdk.cds.controllerblueprints.service.load.ControllerBlueprintCatalogServiceImpl] */ @Service("blueprintsProcessorCatalogService") class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: BluePrintValidatorService, - private val bluePrintPathConfiguration: BluePrintPathConfiguration, - private val blueprintModelRepository: BlueprintProcessorModelRepository) - : BlueprintCatalogServiceImpl(bluePrintPathConfiguration, bluePrintRuntimeValidatorService) { + private val bluePrintLoadConfiguration: BluePrintLoadConfiguration, + private val blueprintModelRepository: BlueprintModelRepository) + : BlueprintCatalogServiceImpl(bluePrintLoadConfiguration, bluePrintRuntimeValidatorService) { private val log = LoggerFactory.getLogger(BlueprintProcessorCatalogServiceImpl::class.toString()) override suspend fun delete(name: String, version: String) { // Clean blueprint script cache val cacheKey = BluePrintFileUtils - .compileCacheKey(normalizedPathName(bluePrintPathConfiguration.blueprintDeployPath, name, version)) + .compileCacheKey(normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath, name, version)) BluePrintCompileCache.cleanClassLoader(cacheKey) log.info("removed cba file name($name), version($version) from cache") // Cleaning Deployed Blueprint - deleteNBDir(bluePrintPathConfiguration.blueprintDeployPath, name, version) + deleteNBDir(bluePrintLoadConfiguration.blueprintDeployPath, name, version) log.info("removed cba file name($name), version($version) from deploy location") // Cleaning Data Base blueprintModelRepository @@ -65,8 +64,8 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu override suspend fun get(name: String, version: String, extract: Boolean): Path? { - val deployFile = normalizedFile(bluePrintPathConfiguration.blueprintDeployPath, name, version) - val cbaFile = normalizedFile(bluePrintPathConfiguration.blueprintArchivePath, + val deployFile = normalizedFile(bluePrintLoadConfiguration.blueprintDeployPath, name, version) + val cbaFile = normalizedFile(bluePrintLoadConfiguration.blueprintArchivePath, UUID.randomUUID().toString(), "cba.zip") if (extract && deployFile.exists()) { @@ -117,23 +116,25 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu log.info("Overwriting blueprint model :$artifactName::$artifactVersion") blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(artifactName, artifactVersion) val deployFile = - normalizedPathName(bluePrintPathConfiguration.blueprintDeployPath, artifactName, artifactVersion) + normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath, artifactName, artifactVersion) deleteNBDir(deployFile).let { if (it) log.info("Deleted deployed blueprint model :$artifactName::$artifactVersion") else log.info("Fail to delete deployed blueprint model :$artifactName::$artifactVersion") } } - val blueprintModel = BlueprintProcessorModel() + val blueprintModel = BlueprintModel() blueprintModel.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] blueprintModel.artifactType = ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL + blueprintModel.published = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_VALID] + ?: BluePrintConstants.FLAG_N blueprintModel.artifactName = artifactName blueprintModel.artifactVersion = artifactVersion - blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR] - blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS] + blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]!! + blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS]!! blueprintModel.artifactDescription = "Controller Blueprint for $artifactName:$artifactVersion" - val blueprintModelContent = BlueprintProcessorModelContent() + val blueprintModelContent = BlueprintModelContent() blueprintModelContent.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] blueprintModelContent.contentType = "CBA_ZIP" blueprintModelContent.name = "$artifactName:$artifactVersion" diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/ControllerBlueprintCatalogServiceImpl.kt index 0e7a7d94a..66b5d00c4 100755 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/ControllerBlueprintCatalogServiceImpl.kt @@ -16,8 +16,11 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.load +package org.onap.ccsdk.cds.blueprintsprocessor.db.service +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.common.ApplicationConstants @@ -26,10 +29,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPath -import org.onap.ccsdk.cds.controllerblueprints.db.resources.BlueprintCatalogServiceImpl -import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModel -import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelContent -import org.onap.ccsdk.cds.controllerblueprints.service.repository.ControllerBlueprintModelRepository import org.slf4j.LoggerFactory import org.springframework.dao.DataIntegrityViolationException import org.springframework.stereotype.Service @@ -37,14 +36,14 @@ import java.io.File import java.nio.file.Files import java.nio.file.Path import java.util.* - +//TODO("Duplicate : Merge BlueprintProcessorCatalogServiceImpl and ControllerBlueprintCatalogServiceImpl") /** * Similar implementation in [org.onap.ccsdk.cds.blueprintsprocessor.db.BlueprintProcessorCatalogServiceImpl] */ @Service("controllerBlueprintsCatalogService") class ControllerBlueprintCatalogServiceImpl(bluePrintDesignTimeValidatorService: BluePrintValidatorService, private val bluePrintLoadConfiguration: BluePrintLoadConfiguration, - private val blueprintModelRepository: ControllerBlueprintModelRepository) + private val blueprintModelRepository: BlueprintModelRepository) : BlueprintCatalogServiceImpl(bluePrintLoadConfiguration, bluePrintDesignTimeValidatorService) { @@ -98,8 +97,8 @@ class ControllerBlueprintCatalogServiceImpl(bluePrintDesignTimeValidatorService: ?: BluePrintConstants.FLAG_N blueprintModel.artifactName = artifactName blueprintModel.artifactVersion = artifactVersion - blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR] - blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS] + blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]!! + blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS]!! blueprintModel.artifactDescription = "Controller Blueprint for $artifactName:$artifactVersion" val blueprintModelContent = BlueprintModelContent() diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt index fe8172b85..8058dc26e 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt @@ -22,12 +22,13 @@ import org.junit.Test import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.db.mock.MockBlueprintProcessorCatalogServiceImpl +import org.onap.ccsdk.cds.blueprintsprocessor.db.service.BlueprintCatalogServiceImpl +import org.onap.ccsdk.cds.blueprintsprocessor.db.service.BlueprintProcessorCatalogServiceImpl import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils -import org.onap.ccsdk.cds.controllerblueprints.db.resources.BlueprintCatalogServiceImpl import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.context.annotation.ComponentScan @@ -109,9 +110,9 @@ class BlueprintProcessorCatalogServiceImplTest { blueprintsProcessorCatalogService.get("baseconfiguration", "1.0.0", true) } - assertTrue(File(blueprintCoreConfiguration.bluePrintPathConfiguration().blueprintArchivePath + + assertTrue(File(blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath + "/baseconfiguration").deleteRecursively(),"Couldn't get blueprint archive " + - "${blueprintCoreConfiguration.bluePrintPathConfiguration().blueprintArchivePath}/baseconfiguration " + + "${blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath}/baseconfiguration " + "from data base.") } diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt index 644c51860..27a444bdc 100644 --- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt @@ -17,6 +17,11 @@ package org.onap.ccsdk.cds.blueprintsprocessor.message +import com.fasterxml.jackson.databind.JsonNode +import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BluePrintMessageLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BlueprintMessageConsumerService +import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BlueprintMessageProducerService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration @@ -26,10 +31,36 @@ import org.springframework.context.annotation.Configuration @EnableConfigurationProperties open class BluePrintMessageLibConfiguration +/** + * Exposed Dependency Service by this Message Lib Module + */ +fun BluePrintDependencyService.messageLibPropertyService(): BluePrintMessageLibPropertyService = + instance(MessageLibConstants.SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY) + +/** Extension functions for message producer service **/ +fun BluePrintDependencyService.messageProducerService(selector: String): BlueprintMessageProducerService { + return messageLibPropertyService().blueprintMessageProducerService(selector) +} + + +fun BluePrintDependencyService.messageProducerService(jsonNode: JsonNode): BlueprintMessageProducerService { + return messageLibPropertyService().blueprintMessageProducerService(jsonNode) +} + +/** Extension functions for message consumer service **/ +fun BluePrintDependencyService.messageConsumerService(selector: String): BlueprintMessageConsumerService { + return messageLibPropertyService().blueprintMessageConsumerService(selector) +} + +fun BluePrintDependencyService.messageConsumerService(jsonNode: JsonNode): BlueprintMessageConsumerService { + return messageLibPropertyService().blueprintMessageConsumerService(jsonNode) +} + class MessageLibConstants { companion object { const val SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY = "blueprint-message-lib-property-service" - const val PROPERTY_MESSAGE_CLIENT_PREFIX = "blueprintsprocessor.messageclient." + const val PROPERTY_MESSAGE_CONSUMER_PREFIX = "blueprintsprocessor.messageconsumer." + const val PROPERTY_MESSAGE_PRODUCER_PREFIX = "blueprintsprocessor.messageproducer." const val TYPE_KAFKA_BASIC_AUTH = "kafka-basic-auth" } }
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt index e621ec66f..ab04054fe 100644 --- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.message - +/** Producer Properties **/ open class MessageProducerProperties @@ -24,4 +24,18 @@ open class KafkaBasicAuthMessageProducerProperties : MessageProducerProperties() lateinit var bootstrapServers: String var topic: String? = null var clientId: String? = null -}
\ No newline at end of file +} + +/** Consumer Properties **/ + +open class MessageConsumerProperties + +open class KafkaMessageConsumerProperties : MessageConsumerProperties() { + lateinit var bootstrapServers: String + lateinit var groupId: String + var clientId: String? = null + var topic: String? = null + var pollMillSec: Long = 1000 +} + +open class KafkaBasicAuthMessageConsumerProperties : KafkaMessageConsumerProperties() diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt index fb01ce179..7c56ea432 100644 --- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt @@ -18,9 +18,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.message.service import com.fasterxml.jackson.databind.JsonNode import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties -import org.onap.ccsdk.cds.blueprintsprocessor.message.KafkaBasicAuthMessageProducerProperties -import org.onap.ccsdk.cds.blueprintsprocessor.message.MessageLibConstants -import org.onap.ccsdk.cds.blueprintsprocessor.message.MessageProducerProperties +import org.onap.ccsdk.cds.blueprintsprocessor.message.* import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.springframework.stereotype.Service @@ -28,22 +26,22 @@ import org.springframework.stereotype.Service @Service(MessageLibConstants.SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY) open class BluePrintMessageLibPropertyService(private var bluePrintProperties: BluePrintProperties) { - fun blueprintMessageClientService(jsonNode: JsonNode): BlueprintMessageProducerService { - val messageClientProperties = messageClientProperties(jsonNode) - return blueprintMessageClientService(messageClientProperties) + fun blueprintMessageProducerService(jsonNode: JsonNode): BlueprintMessageProducerService { + val messageClientProperties = messageProducerProperties(jsonNode) + return blueprintMessageProducerService(messageClientProperties) } - fun blueprintMessageClientService(selector: String): BlueprintMessageProducerService { - val prefix = "${MessageLibConstants.PROPERTY_MESSAGE_CLIENT_PREFIX}$selector" - val messageClientProperties = messageClientProperties(prefix) - return blueprintMessageClientService(messageClientProperties) + fun blueprintMessageProducerService(selector: String): BlueprintMessageProducerService { + val prefix = "${MessageLibConstants.PROPERTY_MESSAGE_PRODUCER_PREFIX}$selector" + val messageClientProperties = messageProducerProperties(prefix) + return blueprintMessageProducerService(messageClientProperties) } - fun messageClientProperties(prefix: String): MessageProducerProperties { + fun messageProducerProperties(prefix: String): MessageProducerProperties { val type = bluePrintProperties.propertyBeanType("$prefix.type", String::class.java) return when (type) { MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> { - kafkaBasicAuthMessageClientProperties(prefix) + kafkaBasicAuthMessageProducerProperties(prefix) } else -> { throw BluePrintProcessorException("Message adaptor($type) is not supported") @@ -51,7 +49,7 @@ open class BluePrintMessageLibPropertyService(private var bluePrintProperties: B } } - fun messageClientProperties(jsonNode: JsonNode): MessageProducerProperties { + fun messageProducerProperties(jsonNode: JsonNode): MessageProducerProperties { val type = jsonNode.get("type").textValue() return when (type) { MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> { @@ -63,7 +61,7 @@ open class BluePrintMessageLibPropertyService(private var bluePrintProperties: B } } - private fun blueprintMessageClientService(MessageProducerProperties: MessageProducerProperties) + private fun blueprintMessageProducerService(MessageProducerProperties: MessageProducerProperties) : BlueprintMessageProducerService { when (MessageProducerProperties) { @@ -76,9 +74,67 @@ open class BluePrintMessageLibPropertyService(private var bluePrintProperties: B } } - private fun kafkaBasicAuthMessageClientProperties(prefix: String): KafkaBasicAuthMessageProducerProperties { + private fun kafkaBasicAuthMessageProducerProperties(prefix: String): KafkaBasicAuthMessageProducerProperties { return bluePrintProperties.propertyBeanType( prefix, KafkaBasicAuthMessageProducerProperties::class.java) } + /** Consumer Property Lib Service Implementation **/ + + /** Return Message Consumer Service for [jsonNode] definitions. */ + fun blueprintMessageConsumerService(jsonNode: JsonNode): BlueprintMessageConsumerService { + val messageConsumerProperties = messageConsumerProperties(jsonNode) + return blueprintMessageConsumerService(messageConsumerProperties) + } + + /** Return Message Consumer Service for [selector] definitions. */ + fun blueprintMessageConsumerService(selector: String): BlueprintMessageConsumerService { + val prefix = "${MessageLibConstants.PROPERTY_MESSAGE_CONSUMER_PREFIX}$selector" + val messageClientProperties = messageConsumerProperties(prefix) + return blueprintMessageConsumerService(messageClientProperties) + } + + /** Return Message Consumer Properties for [prefix] definitions. */ + fun messageConsumerProperties(prefix: String): MessageConsumerProperties { + val type = bluePrintProperties.propertyBeanType("$prefix.type", String::class.java) + return when (type) { + MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> { + kafkaBasicAuthMessageConsumerProperties(prefix) + } + else -> { + throw BluePrintProcessorException("Message adaptor($type) is not supported") + } + } + } + + fun messageConsumerProperties(jsonNode: JsonNode): MessageConsumerProperties { + val type = jsonNode.get("type").textValue() + return when (type) { + MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> { + JacksonUtils.readValue(jsonNode, KafkaBasicAuthMessageConsumerProperties::class.java)!! + } + else -> { + throw BluePrintProcessorException("Message adaptor($type) is not supported") + } + } + } + + private fun blueprintMessageConsumerService(messageConsumerProperties: MessageConsumerProperties) + : BlueprintMessageConsumerService { + + when (messageConsumerProperties) { + is KafkaBasicAuthMessageConsumerProperties -> { + return KafkaBasicAuthMessageConsumerService(messageConsumerProperties) + } + else -> { + throw BluePrintProcessorException("couldn't get Message client service for") + } + } + } + + private fun kafkaBasicAuthMessageConsumerProperties(prefix: String): KafkaBasicAuthMessageConsumerProperties { + return bluePrintProperties.propertyBeanType( + prefix, KafkaBasicAuthMessageConsumerProperties::class.java) + } + } diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt new file mode 100644 index 000000000..25f0bf44d --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt @@ -0,0 +1,32 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.message.service + +import kotlinx.coroutines.channels.Channel + +interface BlueprintMessageConsumerService { + + /** Subscribe to the Kafka channel with [additionalConfig] */ + suspend fun subscribe(additionalConfig: Map<String, Any>?): Channel<String> + + /** Subscribe to the Kafka channel with [additionalConfig] for dynamic [topics]*/ + suspend fun subscribe(topics: List<String>, additionalConfig: Map<String, Any>? = null): Channel<String> + + /** close the channel, consumer and other resources */ + suspend fun shutDown() + +}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageConsumerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageConsumerService.kt new file mode 100644 index 000000000..5a9e61bfd --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageConsumerService.kt @@ -0,0 +1,116 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.message.service + +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking +import org.apache.kafka.clients.CommonClientConfigs +import org.apache.kafka.clients.consumer.Consumer +import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.common.serialization.StringDeserializer +import org.onap.ccsdk.cds.blueprintsprocessor.message.KafkaBasicAuthMessageConsumerProperties +import org.onap.ccsdk.cds.controllerblueprints.core.logger +import java.time.Duration +import kotlin.concurrent.thread + +class KafkaBasicAuthMessageConsumerService( + private val messageConsumerProperties: KafkaBasicAuthMessageConsumerProperties) + : BlueprintMessageConsumerService { + + private val channel = Channel<String>() + private var kafkaConsumer: Consumer<String, String>? = null + val log = logger(KafkaBasicAuthMessageConsumerService::class) + + @Volatile + var keepGoing = true + + fun kafkaConsumer(additionalConfig: Map<String, Any>? = null): Consumer<String, String> { + val configProperties = hashMapOf<String, Any>() + configProperties[CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG] = messageConsumerProperties.bootstrapServers + configProperties[ConsumerConfig.GROUP_ID_CONFIG] = messageConsumerProperties.groupId + configProperties[ConsumerConfig.AUTO_OFFSET_RESET_CONFIG] = "latest" + configProperties[ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG] = StringDeserializer::class.java + configProperties[ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG] = StringDeserializer::class.java + if (messageConsumerProperties.clientId != null) { + configProperties[ConsumerConfig.CLIENT_ID_CONFIG] = messageConsumerProperties.clientId!! + } + // TODO("Security Implementation based on type") + /** add or override already set properties */ + additionalConfig?.let { configProperties.putAll(it) } + /** Create Kafka consumer */ + return KafkaConsumer(configProperties) + } + + override suspend fun subscribe(additionalConfig: Map<String, Any>?): Channel<String> { + /** get to topic names */ + val consumerTopic = messageConsumerProperties.topic?.split(",")?.map { it.trim() } + check(!consumerTopic.isNullOrEmpty()) { "couldn't get topic information" } + return subscribe(consumerTopic, additionalConfig) + } + + + override suspend fun subscribe(consumerTopic: List<String>, additionalConfig: Map<String, Any>?): Channel<String> { + /** Create Kafka consumer */ + kafkaConsumer = kafkaConsumer(additionalConfig) + + checkNotNull(kafkaConsumer) { + "failed to create kafka consumer for " + + "server(${messageConsumerProperties.bootstrapServers})'s " + + "topics(${messageConsumerProperties.bootstrapServers})" + } + + kafkaConsumer!!.subscribe(consumerTopic) + log.info("Successfully consumed topic($consumerTopic)") + + thread(start = true, name = "KafkaConsumer") { + keepGoing = true + kafkaConsumer!!.use { kc -> + while (keepGoing) { + val consumerRecords = kc.poll(Duration.ofMillis(messageConsumerProperties.pollMillSec)) + runBlocking { + consumerRecords?.forEach { consumerRecord -> + /** execute the command block */ + consumerRecord.value()?.let { + launch { + if (!channel.isClosedForSend) { + channel.send(it) + } else { + log.error("Channel is closed to receive message") + } + } + } + } + } + } + log.info("message listener shutting down.....") + } + } + return channel + } + + override suspend fun shutDown() { + /** stop the polling loop */ + keepGoing = false + /** Close the Channel */ + channel.cancel() + /** TO shutdown gracefully, need to wait for the maximum poll time */ + delay(messageConsumerProperties.pollMillSec) + } +} diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt index 008e92437..1c93bb0fc 100644 --- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt @@ -83,7 +83,6 @@ class KafkaBasicAuthMessageProducerService( } fun messageTemplate(additionalConfig: Map<String, Any>? = null): KafkaTemplate<String, Any> { - log.info("Prepering templates") if (kafkaTemplate == null) { kafkaTemplate = KafkaTemplate(producerFactory(additionalConfig)) } diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt new file mode 100644 index 000000000..2b84eaa78 --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt @@ -0,0 +1,140 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.message.service + +import io.mockk.every +import io.mockk.spyk +import kotlinx.coroutines.channels.consumeEach +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking +import org.apache.kafka.clients.consumer.ConsumerRecord +import org.apache.kafka.clients.consumer.MockConsumer +import org.apache.kafka.clients.consumer.OffsetResetStrategy +import org.apache.kafka.common.TopicPartition +import org.junit.Test +import org.junit.runner.RunWith +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.message.BluePrintMessageLibConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.logger +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.test.annotation.DirtiesContext +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.TestPropertySource +import org.springframework.test.context.junit4.SpringRunner +import kotlin.test.assertNotNull +import kotlin.test.assertTrue + + +@RunWith(SpringRunner::class) +@DirtiesContext +@ContextConfiguration(classes = [BluePrintMessageLibConfiguration::class, + BlueprintPropertyConfiguration::class, BluePrintProperties::class]) +@TestPropertySource(properties = +["blueprintsprocessor.messageconsumer.sample.type=kafka-basic-auth", + "blueprintsprocessor.messageconsumer.sample.bootstrapServers=127.0.0.1:9092", + "blueprintsprocessor.messageconsumer.sample.groupId=sample-group", + "blueprintsprocessor.messageconsumer.sample.topic=default-topic", + "blueprintsprocessor.messageconsumer.sample.clientId=default-client-id", + "blueprintsprocessor.messageconsumer.sample.pollMillSec=10", + + "blueprintsprocessor.messageproducer.sample.type=kafka-basic-auth", + "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092", + "blueprintsprocessor.messageproducer.sample.topic=default-topic", + "blueprintsprocessor.messageproducer.sample.clientId=default-client-id" +]) +open class BlueprintMessageConsumerServiceTest { + val log = logger(BlueprintMessageConsumerServiceTest::class) + + @Autowired + lateinit var bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService + + @Test + fun testKafkaBasicAuthConsumerService() { + runBlocking { + val blueprintMessageConsumerService = bluePrintMessageLibPropertyService + .blueprintMessageConsumerService("sample") as KafkaBasicAuthMessageConsumerService + assertNotNull(blueprintMessageConsumerService, "failed to get blueprintMessageConsumerService") + + val spyBlueprintMessageConsumerService = spyk(blueprintMessageConsumerService, recordPrivateCalls = true) + + val topic = "default-topic" + val partitions: MutableList<TopicPartition> = arrayListOf() + val topicsCollection: MutableList<String> = arrayListOf() + partitions.add(TopicPartition(topic, 1)) + val partitionsBeginningMap: MutableMap<TopicPartition, Long> = mutableMapOf() + val partitionsEndMap: MutableMap<TopicPartition, Long> = mutableMapOf() + + val records: Long = 10 + partitions.forEach { partition -> + partitionsBeginningMap[partition] = 0L + partitionsEndMap[partition] = records + topicsCollection.add(partition.topic()) + } + val mockKafkaConsumer = MockConsumer<String, String>(OffsetResetStrategy.EARLIEST) + mockKafkaConsumer.subscribe(topicsCollection) + mockKafkaConsumer.rebalance(partitions) + mockKafkaConsumer.updateBeginningOffsets(partitionsBeginningMap) + mockKafkaConsumer.updateEndOffsets(partitionsEndMap) + for (i in 1..10) { + val record = ConsumerRecord<String, String>(topic, 1, i.toLong(), "key_$i", + "I am message $i") + mockKafkaConsumer.addRecord(record) + } + + every { spyBlueprintMessageConsumerService.kafkaConsumer(any()) } returns mockKafkaConsumer + val channel = spyBlueprintMessageConsumerService.subscribe(null) + launch { + channel.consumeEach { + assertTrue(it.startsWith("I am message"), "failed to get the actual message") + } + } + delay(10) + spyBlueprintMessageConsumerService.shutDown() + } + } + + /** Integration Kafka Testing, Enable and use this test case only for local desktop testing with real kafka broker */ + //@Test + fun testKafkaIntegration() { + runBlocking { + val blueprintMessageConsumerService = bluePrintMessageLibPropertyService + .blueprintMessageConsumerService("sample") as KafkaBasicAuthMessageConsumerService + assertNotNull(blueprintMessageConsumerService, "failed to get blueprintMessageConsumerService") + + val channel = blueprintMessageConsumerService.subscribe(null) + launch { + channel.consumeEach { + log.info("Consumed Message : $it") + } + } + + /** Send message with every 1 sec */ + val blueprintMessageProducerService = bluePrintMessageLibPropertyService + .blueprintMessageProducerService("sample") as KafkaBasicAuthMessageProducerService + launch { + repeat(5) { + delay(1000) + blueprintMessageProducerService.sendMessage("this is my message($it)") + } + } + delay(10000) + blueprintMessageConsumerService.shutDown() + } + } +}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt index 0f8367d7e..31bcc1517 100644 --- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt @@ -41,10 +41,10 @@ import kotlin.test.assertTrue @ContextConfiguration(classes = [BluePrintMessageLibConfiguration::class, BlueprintPropertyConfiguration::class, BluePrintProperties::class]) @TestPropertySource(properties = -["blueprintsprocessor.messageclient.sample.type=kafka-basic-auth", - "blueprintsprocessor.messageclient.sample.bootstrapServers=127:0.0.1:9092", - "blueprintsprocessor.messageclient.sample.topic=default-topic", - "blueprintsprocessor.messageclient.sample.clientId=default-client-id" +["blueprintsprocessor.messageproducer.sample.type=kafka-basic-auth", + "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092", + "blueprintsprocessor.messageproducer.sample.topic=default-topic", + "blueprintsprocessor.messageproducer.sample.clientId=default-client-id" ]) open class BlueprintMessageProducerServiceTest { @@ -52,10 +52,10 @@ open class BlueprintMessageProducerServiceTest { lateinit var bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService @Test - fun testKafkaBasicAuthClientService() { + fun testKafkaBasicAuthProducertService() { runBlocking { - val bluePrintMessageClientService = bluePrintMessageLibPropertyService - .blueprintMessageClientService("sample") as KafkaBasicAuthMessageProducerService + val blueprintMessageProducerService = bluePrintMessageLibPropertyService + .blueprintMessageProducerService("sample") as KafkaBasicAuthMessageProducerService val mockKafkaTemplate = mockk<KafkaTemplate<String, Any>>() @@ -64,11 +64,11 @@ open class BlueprintMessageProducerServiceTest { every { mockKafkaTemplate.send(any(), any()) } returns future - val spyBluePrintMessageClientService = spyk(bluePrintMessageClientService, recordPrivateCalls = true) + val spyBluePrintMessageProducerService = spyk(blueprintMessageProducerService, recordPrivateCalls = true) - every { spyBluePrintMessageClientService.messageTemplate(any()) } returns mockKafkaTemplate + every { spyBluePrintMessageProducerService.messageTemplate(any()) } returns mockKafkaTemplate - val response = spyBluePrintMessageClientService.sendMessage("Testing message") + val response = spyBluePrintMessageProducerService.sendMessage("Testing message") assertTrue(response, "failed to get command response") } } diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/resources/logback-test.xml index 626b8f911..3868440c7 100644 --- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/resources/logback-test.xml +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/resources/logback-test.xml @@ -19,7 +19,7 @@ <!-- 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> + <pattern>%d{HH:mm:ss.SSS} %-5level [%thread] %logger{50} - %msg%n</pattern> </encoder> </appender> diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt index 1cb66b8ab..9980b9efb 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt @@ -1,5 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +17,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.core -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired @@ -31,18 +32,17 @@ import org.springframework.core.env.Environment import org.springframework.stereotype.Service @Configuration -open class BluePrintCoreConfiguration(private val bluePrintProperties: BlueprintProcessorProperties) { +open class BluePrintCoreConfiguration(private val bluePrintPropertiesService: BlueprintPropertiesService) { companion object { const val PREFIX_BLUEPRINT_PROCESSOR = "blueprintsprocessor" } @Bean - open fun bluePrintPathConfiguration(): BluePrintPathConfiguration { - return bluePrintProperties - .propertyBeanType(PREFIX_BLUEPRINT_PROCESSOR, BluePrintPathConfiguration::class.java) + open fun bluePrintLoadConfiguration(): BluePrintLoadConfiguration { + return bluePrintPropertiesService + .propertyBeanType(PREFIX_BLUEPRINT_PROCESSOR, BluePrintLoadConfiguration::class.java) } - } @Configuration @@ -58,7 +58,7 @@ open class BlueprintPropertyConfiguration { } @Service -open class BlueprintProcessorProperties(private var bluePrintPropertyBinder: Binder) { +open class BlueprintPropertiesService(private var bluePrintPropertyBinder: Binder) { fun <T> propertyBeanType(prefix: String, type: Class<T>): T { return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get() } diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt index c45ebc127..5a6ba0661 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt @@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.core.api.data import com.fasterxml.jackson.annotation.JsonFormat +import com.fasterxml.jackson.annotation.JsonIgnore import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.ObjectNode import io.swagger.annotations.ApiModelProperty @@ -40,6 +41,7 @@ open class ExecutionServiceInput { " and the input for resource resolution located within the xxx-request block, contained within xxx-properties") lateinit var payload: ObjectNode @get:ApiModelProperty(hidden = true) + @get:JsonIgnore var stepData: StepData? = null } @@ -56,6 +58,7 @@ open class ExecutionServiceOutput { " and the input for resource resolution located within the xxx-request block, contained within xxx-properties") lateinit var payload: ObjectNode @get:ApiModelProperty(hidden = true) + @get:JsonIgnore var stepData: StepData? = null } diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml index 6d2596024..f34a1ec4b 100644 --- a/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml @@ -43,10 +43,5 @@ <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> <artifactId>blueprint-core</artifactId> </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt index c3f18fcba..b4c1ad0e0 100644 --- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt @@ -129,14 +129,15 @@ class ResourceConfigSnapshotControllerTest { } @Test - fun `get returns 404 if entry not found`() { + fun `get returns 200 if entry not found`() { runBlocking { webTestClient .get() .uri("/api/v1/configs?resourceId=MISSING&resourceType=PNF") .exchange() - .expectStatus().isNotFound + .expectStatus().is2xxSuccessful + .expectBody() } } diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml index 2586be255..8f6d32ee2 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml @@ -23,17 +23,7 @@ <modelVersion>4.0.0</modelVersion> <artifactId>designer-api</artifactId> <packaging>jar</packaging> - <name>Blueprints Designer API</name> - <description>Blueprints Designer API</description> + <name>Blueprints Processor Designer API</name> + <description>Blueprints Processor Designer API</description> - <properties> - <sonar.skip>true</sonar.skip> - </properties> - - <dependencies> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>service</artifactId> - </dependency> - </dependencies> </project> diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt index a214f961e..f67ed25c3 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelController.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.controller +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api import kotlinx.coroutines.runBlocking import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelSearch -import org.onap.ccsdk.cds.controllerblueprints.service.handler.BluePrintModelHandler +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.BluePrintModelHandler import org.springframework.core.io.Resource import org.springframework.http.MediaType import org.springframework.http.ResponseEntity diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ControllerBlueprintExceptionHandler.kt index 4537dbb9d..0d2a7b7dc 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ControllerBlueprintExceptionHandler.kt @@ -14,16 +14,15 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.controller +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api -import org.springframework.web.bind.annotation.RestControllerAdvice import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode -import org.onap.ccsdk.cds.controllerblueprints.service.common.ErrorMessage import org.slf4j.LoggerFactory import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.ExceptionHandler +import org.springframework.web.bind.annotation.RestControllerAdvice /** * ControllerBlueprintExceptionHandler Purpose: Handle exceptions in controllerBlueprint API and provide the right @@ -41,7 +40,7 @@ open class ControllerBlueprintExceptionHandler { @ExceptionHandler fun ControllerBlueprintExceptionHandler(e: BluePrintException): ResponseEntity<ErrorMessage> { - var errorCode = ErrorCode.valueOf(e.code) + val errorCode = ErrorCode.valueOf(e.code) val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message") LOG.error("Error: $errorCode ${e.message}") return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode)) @@ -49,7 +48,7 @@ open class ControllerBlueprintExceptionHandler { @ExceptionHandler fun ControllerBlueprintExceptionHandler(e: Exception): ResponseEntity<ErrorMessage> { - var errorCode = ErrorCode.GENERIC_FAILURE + val errorCode = ErrorCode.GENERIC_FAILURE val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message") LOG.error("Error: $errorCode ${e.message}") return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode)) diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt new file mode 100644 index 000000000..5259ee1c9 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt @@ -0,0 +1,46 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api + +import com.fasterxml.jackson.annotation.JsonFormat +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonTypeInfo +import com.fasterxml.jackson.annotation.JsonTypeName +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment +import java.io.Serializable +import java.util.* + +/** + * ArtifactRequest.java Purpose: Provide Configuration Generator ArtifactRequest Model + * + * @author Brinda Santh + * @version 1.0 + */ +class AutoMapResponse { + var resourceAssignments: List<ResourceAssignment>? = null + var dataDictionaries: List<ResourceDictionary>? = null +} + + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonTypeName("errorMessage") +@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) +class ErrorMessage(var message: String?, var code: Int?, var debugMessage: String?) : Serializable { + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + var timestamp = Date() +}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ModelTypeController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt index 341d63bf0..bac281356 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ModelTypeController.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.controller +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType -import org.onap.ccsdk.cds.controllerblueprints.service.handler.ModelTypeHandler import kotlinx.coroutines.runBlocking +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ModelTypeHandler +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.springframework.http.MediaType import org.springframework.web.bind.annotation.* diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ResourceDictionaryController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt index d728fc229..bae890a87 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ResourceDictionaryController.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.controller +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api +import kotlinx.coroutines.runBlocking +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ResourceDictionaryHandler import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceSourceMapping -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary -import org.onap.ccsdk.cds.controllerblueprints.service.handler.ResourceDictionaryHandler -import kotlinx.coroutines.runBlocking import org.springframework.http.MediaType import org.springframework.web.bind.annotation.* diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/JpaJsonNodeConverter.java b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaJsonNodeConverter.kt index f45c30fc6..97c7ab6a6 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/JpaJsonNodeConverter.java +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaJsonNodeConverter.kt @@ -14,27 +14,25 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.domain; +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain -import com.fasterxml.jackson.databind.JsonNode; -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils; +import com.fasterxml.jackson.databind.JsonNode +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils + +import javax.persistence.AttributeConverter +import javax.persistence.Converter -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; /** * @author Brinda Santh */ @Converter -public class JpaJsonNodeConverter implements - AttributeConverter<JsonNode, String> { +class JpaJsonNodeConverter : AttributeConverter<JsonNode, String> { - @Override - public String convertToDatabaseColumn(JsonNode node) { - return JacksonUtils.Companion.getJson(node, true); + override fun convertToDatabaseColumn(node: JsonNode): String { + return JacksonUtils.getJson(node, true) } - @Override - public JsonNode convertToEntityAttribute(String dbData) { - return JacksonUtils.Companion.jsonNode(dbData); + override fun convertToEntityAttribute(dbData: String): JsonNode { + return JacksonUtils.jsonNode(dbData) } }
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaResourceDefinitionConverter.kt index 60c069428..75cfede50 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaResourceDefinitionConverter.kt @@ -14,26 +14,24 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.domain; +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition; +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition + +import javax.persistence.AttributeConverter +import javax.persistence.Converter -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; /** * @author Brinda Santh */ @Converter -public class JpaResourceDefinitionConverter implements - AttributeConverter<ResourceDefinition, String> { - @Override - public String convertToDatabaseColumn(ResourceDefinition resourceDefinition) { - return JacksonUtils.Companion.getJson(resourceDefinition); +class JpaResourceDefinitionConverter : AttributeConverter<ResourceDefinition, String> { + override fun convertToDatabaseColumn(resourceDefinition: ResourceDefinition): String { + return JacksonUtils.getJson(resourceDefinition) } - @Override - public ResourceDefinition convertToEntityAttribute(String content) { - return JacksonUtils.Companion.readValue(content, ResourceDefinition.class); + override fun convertToEntityAttribute(content: String): ResourceDefinition? { + return JacksonUtils.readValue(content, ResourceDefinition::class.java) } } diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt new file mode 100644 index 000000000..a964e0416 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt @@ -0,0 +1,97 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain + +import com.fasterxml.jackson.annotation.JsonFormat +import com.fasterxml.jackson.databind.JsonNode +import io.swagger.annotations.ApiModelProperty +import org.springframework.data.annotation.LastModifiedDate +import org.springframework.data.jpa.domain.support.AuditingEntityListener +import java.io.Serializable +import java.util.* +import javax.persistence.* + +/** + * Provide ModelType Entity + * + * @author Brinda Santh + * @version 1.0 + */ +@EntityListeners(AuditingEntityListener::class) +@Entity +@Table(name = "MODEL_TYPE") +class ModelType : Serializable { + + @Id + @Column(name = "model_name", nullable = false) + @ApiModelProperty(required = true) + lateinit var modelName: String + + @Column(name = "derived_from", nullable = false) + @ApiModelProperty(required = true) + lateinit var derivedFrom: String + + @Column(name = "definition_type", nullable = false) + @ApiModelProperty(required = true) + lateinit var definitionType: String + + @Lob + @Convert(converter = JpaJsonNodeConverter::class) + @Column(name = "definition", nullable = false) + @ApiModelProperty(required = true) + lateinit var definition: JsonNode + + @Lob + @Column(name = "description", nullable = false) + @ApiModelProperty(required = true) + lateinit var description: String + + @Column(name = "version", nullable = false) + @ApiModelProperty(required = true) + lateinit var version: String + + @Lob + @Column(name = "tags", nullable = false) + @ApiModelProperty(required = true) + lateinit var tags: String + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + @LastModifiedDate + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "creation_date") + var creationDate: Date? = null + + @Column(name = "updated_by", nullable = false) + @ApiModelProperty(required = true) + lateinit var updatedBy: String + + override fun toString(): String { + return "[" + "modelName = " + modelName + + ", derivedFrom = " + derivedFrom + + ", definitionType = " + definitionType + + ", description = " + description + + ", creationDate = " + creationDate + + ", version = " + version + + ", updatedBy = " + updatedBy + + ", tags = " + tags + + "]" + } + + companion object { + private const val serialVersionUID = 1L + } +}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt new file mode 100644 index 000000000..ac5ea2070 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt @@ -0,0 +1,94 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain + +import com.fasterxml.jackson.annotation.JsonFormat +import io.swagger.annotations.ApiModelProperty +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition +import org.springframework.data.annotation.LastModifiedDate +import org.springframework.data.jpa.domain.support.AuditingEntityListener +import java.io.Serializable +import java.util.* +import javax.persistence.* + +/** + * Provide ResourceDictionary Entity + * + * @author Brinda Santh + * @version 1.0 + */ +@EntityListeners(AuditingEntityListener::class) +@Entity +@Table(name = "RESOURCE_DICTIONARY") +class ResourceDictionary : Serializable { + + @Id + @Column(name = "name", nullable = false) + @ApiModelProperty(required = true) + lateinit var name: String + + @Column(name = "data_type", nullable = false) + @ApiModelProperty(required = true) + lateinit var dataType: String + + @Column(name = "entry_schema") + var entrySchema: String? = null + + @Lob + @Convert(converter = JpaResourceDefinitionConverter::class) + @Column(name = "definition", nullable = false) + @ApiModelProperty(required = true) + lateinit var definition: ResourceDefinition + + @Lob + @Column(name = "description", nullable = false) + @ApiModelProperty(required = true) + lateinit var description: String + + @Lob + @Column(name = "tags", nullable = false) + @ApiModelProperty(required = true) + lateinit var tags: String + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + @LastModifiedDate + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "creation_date") + var creationDate: Date? = null + + @Column(name = "updated_by", nullable = false) + @ApiModelProperty(required = true) + lateinit var updatedBy: String + + override fun toString(): String { + return "[" + ", name = " + name + + ", dataType = " + dataType + + ", entrySchema = " + entrySchema + + ", definition =" + definition + + ", description = " + description + + ", updatedBy = " + updatedBy + + ", tags = " + tags + + ", creationDate = " + creationDate + + "]" + } + + companion object { + private const val serialVersionUID = 1L + } + + +} diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt index c6f821f99..552339be9 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt @@ -14,9 +14,9 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer -import org.slf4j.LoggerFactory +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive @@ -24,11 +24,11 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionEnhancer import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService +import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment -import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils import org.springframework.stereotype.Service @Service @@ -42,7 +42,7 @@ open class BluePrintArtifactDefinitionEnhancerImpl(private val bluePrintRepoServ } - private val log= LoggerFactory.getLogger(BluePrintArtifactDefinitionEnhancerImpl::class.toString()) + private val log = logger(BluePrintArtifactDefinitionEnhancerImpl::class) lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> lateinit var bluePrintContext: BluePrintContext diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt index 8713b4c6c..0b64ed503 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt @@ -14,8 +14,9 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition @@ -24,7 +25,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoServ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils class BluePrintAttributeDefinitionEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService, private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt index cad523e25..b4d149e16 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer -import org.slf4j.LoggerFactory import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService +import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils @@ -32,7 +32,7 @@ import java.util.* open class BluePrintEnhancerServiceImpl(private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService, private val resourceDefinitionEnhancerService: ResourceDefinitionEnhancerService) : BluePrintEnhancerService { - private val log= LoggerFactory.getLogger(BluePrintEnhancerServiceImpl::class.toString()) + private val log = logger(BluePrintEnhancerServiceImpl::class) override suspend fun enhance(basePath: String, enrichedBasePath: String): BluePrintContext { diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintNodeTemplateEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTemplateEnhancerImpl.kt index 0e53c2130..723d7bb27 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintNodeTemplateEnhancerImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTemplateEnhancerImpl.kt @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer -import org.slf4j.LoggerFactory +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateEnhancer import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService +import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.stereotype.Service @@ -35,7 +35,7 @@ open class BluePrintNodeTemplateEnhancerImpl(private val bluePrintRepoService: B private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) : BluePrintNodeTemplateEnhancer { - private val log= LoggerFactory.getLogger(BluePrintNodeTemplateEnhancerImpl::class.toString()) + private val log= logger(BluePrintNodeTemplateEnhancerImpl::class) lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> lateinit var bluePrintContext: BluePrintContext diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintNodeTypeEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt index 2b5d007ed..efb695b22 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintNodeTypeEnhancerImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt @@ -14,9 +14,9 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer -import org.slf4j.LoggerFactory +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition @@ -25,9 +25,9 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeEnhancer import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService +import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.stereotype.Service @@ -37,7 +37,7 @@ import org.springframework.stereotype.Service open class BluePrintNodeTypeEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService, private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) : BluePrintNodeTypeEnhancer { - private val log= LoggerFactory.getLogger(BluePrintNodeTypeEnhancerImpl::class.toString()) + private val log= logger(BluePrintNodeTypeEnhancerImpl::class) lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> lateinit var bluePrintContext: BluePrintContext diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintPolicyTypeEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPolicyTypeEnhancerImpl.kt index b0adc398f..83fd403e8 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintPolicyTypeEnhancerImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPolicyTypeEnhancerImpl.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPolicyTypeEnhancer diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt index 85de039de..b87cf9c6b 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt @@ -15,8 +15,9 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition @@ -25,7 +26,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoServ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.stereotype.Service diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintServiceTemplateEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintServiceTemplateEnhancerImpl.kt index a6acf0be0..65e5ff9e1 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintServiceTemplateEnhancerImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintServiceTemplateEnhancerImpl.kt @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer -import org.slf4j.LoggerFactory import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateEnhancer import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService +import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.springframework.beans.factory.config.ConfigurableBeanFactory @@ -30,7 +30,7 @@ import org.springframework.stereotype.Service @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) open class BluePrintServiceTemplateEnhancerImpl(private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) : BluePrintServiceTemplateEnhancer { - private val log= LoggerFactory.getLogger(BluePrintServiceTemplateEnhancerImpl::class.toString()) + private val log = logger(BluePrintServiceTemplateEnhancerImpl::class) lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt index e611a2224..c22370c33 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintTypeEnhancerServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt index 4f7656c8c..db361a248 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintTypeEnhancerServiceImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.* import org.springframework.beans.factory.annotation.Autowired diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt index a8765eee1..394289ced 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt @@ -15,13 +15,9 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer -import org.slf4j.LoggerFactory -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive +import org.onap.ccsdk.cds.controllerblueprints.core.* import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow @@ -42,7 +38,7 @@ open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BlueP private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService, private val resourceAssignmentEnhancerService: ResourceAssignmentEnhancerService) : BluePrintWorkflowEnhancer { - private val log= LoggerFactory.getLogger(BluePrintWorkflowEnhancerImpl::class.toString()) + private val log= logger(BluePrintWorkflowEnhancerImpl::class) companion object { const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource" @@ -224,7 +220,7 @@ open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BlueP log.info("dynamic dataType($dataTypeName) already present for workflow($workflowName).") } // Merge all the Recipe Properties - mappingProperties.forEach { propertyName, propertyDefinition -> + mappingProperties.forEach { (propertyName, propertyDefinition) -> dynamicDataType.properties?.put(propertyName, propertyDefinition) } } diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt index b51d88085..55eb42f89 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt @@ -14,18 +14,18 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer -import org.slf4j.LoggerFactory import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService +import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDictionaryConstants import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory -import org.onap.ccsdk.cds.controllerblueprints.service.ResourceDefinitionRepoService +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service.ResourceDefinitionRepoService import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.stereotype.Service @@ -52,7 +52,7 @@ interface ResourceAssignmentEnhancerService { @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) open class ResourceAssignmentEnhancerServiceImpl(private val resourceDefinitionRepoService: ResourceDefinitionRepoService) : ResourceAssignmentEnhancerService { - private val log= LoggerFactory.getLogger(ResourceAssignmentEnhancerServiceImpl::class.java) + private val log= logger(ResourceAssignmentEnhancerServiceImpl::class) /** * Get the defined source instance from the ResourceAssignment, @@ -83,7 +83,7 @@ open class ResourceAssignmentEnhancerServiceImpl(private val resourceDefinitionR // Get the Resource Definition from Repo val resourceDefinition: ResourceDefinition = getResourceDefinition(dictionaryName) - val sourceNodeTemplate = resourceDefinition.sources.get(dictionarySource) + val sourceNodeTemplate = resourceDefinition.sources[dictionarySource] ?: throw BluePrintException("failed to get assigned dictionarySource($dictionarySource) from resourceDefinition($dictionaryName)") // Enrich as NodeTemplate diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt index df499b26d..c018664e4 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt @@ -15,21 +15,21 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer -import org.slf4j.LoggerFactory import kotlinx.coroutines.Deferred import kotlinx.coroutines.async import kotlinx.coroutines.runBlocking import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService +import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils -import org.onap.ccsdk.cds.controllerblueprints.service.ResourceDefinitionRepoService -import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service.ResourceDefinitionRepoService +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils import org.springframework.stereotype.Service interface ResourceDefinitionEnhancerService { @@ -43,7 +43,7 @@ interface ResourceDefinitionEnhancerService { class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoService: ResourceDefinitionRepoService) : ResourceDefinitionEnhancerService { - private val log= LoggerFactory.getLogger(ResourceDefinitionEnhancerService::class.toString()) + private val log = logger(ResourceDefinitionEnhancerService::class) companion object { const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource" diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt index f40da68f6..c074573dd 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/BluePrintModelHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt @@ -16,19 +16,19 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.handler +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelContentRepository +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelSearchRepository +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils import org.onap.ccsdk.cds.controllerblueprints.core.* import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService -import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModel -import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelSearch -import org.onap.ccsdk.cds.controllerblueprints.service.repository.ControllerBlueprintModelContentRepository -import org.onap.ccsdk.cds.controllerblueprints.service.repository.ControllerBlueprintModelRepository -import org.onap.ccsdk.cds.controllerblueprints.service.repository.ControllerBlueprintModelSearchRepository -import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils import org.slf4j.LoggerFactory import org.springframework.core.io.ByteArrayResource import org.springframework.core.io.Resource @@ -52,9 +52,9 @@ import java.util.* @Service open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: BluePrintCatalogService, private val bluePrintLoadConfiguration: BluePrintLoadConfiguration, - private val blueprintModelSearchRepository: ControllerBlueprintModelSearchRepository, - private val blueprintModelRepository: ControllerBlueprintModelRepository, - private val blueprintModelContentRepository: ControllerBlueprintModelContentRepository, + private val blueprintModelSearchRepository: BlueprintModelSearchRepository, + private val blueprintModelRepository: BlueprintModelRepository, + private val blueprintModelContentRepository: BlueprintModelContentRepository, private val bluePrintEnhancerService: BluePrintEnhancerService) { private val log = LoggerFactory.getLogger(BluePrintModelHandler::class.java)!! @@ -88,7 +88,10 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: // Save the Copied file to Database val blueprintId = controllerBlueprintsCatalogService.saveToDatabase(saveId, deCompressedFile, false) // Check and Return the Saved File - val blueprintModelSearch = blueprintModelSearchRepository.findById(blueprintId).get() + val blueprintModelSearch = blueprintModelSearchRepository.findById(blueprintId) + ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, + String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, blueprintId)) + log.info("Save($saveId) successful for blueprint(${blueprintModelSearch.artifactName}) " + "version(${blueprintModelSearch.artifactVersion})") return blueprintModelSearch @@ -121,16 +124,10 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: */ @Throws(BluePrintException::class) open fun getBlueprintModelSearchByNameAndVersion(name: String, version: String): BlueprintModelSearch { - val blueprintModelSearch: BlueprintModelSearch - val dbBlueprintModel = blueprintModelSearchRepository - .findByArtifactNameAndArtifactVersion(name, version) - if (dbBlueprintModel.isPresent) { - blueprintModelSearch = dbBlueprintModel.get() - } else { - throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, - String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version)) - } - return blueprintModelSearch + return blueprintModelSearchRepository.findByArtifactNameAndArtifactVersion(name, version) + ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, + String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version)) + } /** @@ -148,11 +145,14 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: try { blueprintModel = getBlueprintModelByNameAndVersion(name, version) } catch (e: BluePrintException) { - throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, String.format("Error while " + "downloading the CBA file: %s", e.message), e) + 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 + 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) } @@ -172,7 +172,9 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: } val fileName = blueprintModel.id + ".zip" - val file = blueprintModel.blueprintModelContent.content + 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) } @@ -235,16 +237,9 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: */ @Throws(BluePrintException::class) open fun getBlueprintModelSearch(id: String): BlueprintModelSearch { - val blueprintModelSearch: BlueprintModelSearch - val dbBlueprintModel = blueprintModelSearchRepository.findById(id) - if (dbBlueprintModel.isPresent) { - blueprintModelSearch = dbBlueprintModel.get() - } else { - val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id) - throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg) - } - - return blueprintModelSearch + return blueprintModelSearchRepository.findById(id) + ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, + String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)) } /** @@ -257,7 +252,7 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: @Throws(BluePrintException::class) open fun deleteBlueprintModel(id: String) { val dbBlueprintModel = blueprintModelRepository.findById(id) - if (dbBlueprintModel.isPresent) { + if (dbBlueprintModel != null && dbBlueprintModel.isPresent) { blueprintModelContentRepository.deleteByBlueprintModel(dbBlueprintModel.get()) blueprintModelRepository.delete(dbBlueprintModel.get()) } else { @@ -317,7 +312,9 @@ open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: val blueprintId = controllerBlueprintsCatalogService.saveToDatabase(publishId, compressedFilePart, true) - return blueprintModelSearchRepository.findById(blueprintId).get() + return blueprintModelSearchRepository.findById(blueprintId) + ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, + String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, blueprintId)) } catch (e: Exception) { throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value, diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/ModelTypeHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt index d68fdd025..5c7ba275d 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/ModelTypeHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.handler +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ModelTypeRepository +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.ModelTypeValidator import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType -import org.onap.ccsdk.cds.controllerblueprints.service.repository.ModelTypeRepository -import org.onap.ccsdk.cds.controllerblueprints.service.validator.ModelTypeValidator +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.slf4j.LoggerFactory import org.springframework.stereotype.Service diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/ResourceDictionaryHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt index e339bcd68..8ba4c7b38 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/ResourceDictionaryHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt @@ -15,17 +15,17 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.handler +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler import com.google.common.base.Preconditions import org.apache.commons.collections.CollectionUtils import org.apache.commons.lang3.StringUtils +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ResourceDictionaryRepository import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceSourceMapping import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary -import org.onap.ccsdk.cds.controllerblueprints.service.repository.ResourceDictionaryRepository import org.springframework.stereotype.Service @Service @@ -88,11 +88,11 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour //TODO( Save Validator) //validate(resourceDefinition) - resourceDictionary.tags = resourceDefinition.tags + resourceDictionary.tags = resourceDefinition.tags!! resourceDefinition.updatedBy = resourceDictionary.updatedBy // Set the Property Definitions val propertyDefinition = resourceDefinition.property - resourceDictionary.description = propertyDefinition.description + resourceDictionary.description = propertyDefinition.description!! resourceDictionary.dataType = propertyDefinition.type if (propertyDefinition.entrySchema != null) { resourceDictionary.entrySchema = propertyDefinition.entrySchema!!.type diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/BluePrintCatalogLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintCatalogLoadService.kt index 9e456c7f9..36df06909 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/BluePrintCatalogLoadService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintCatalogLoadService.kt @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.load +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load import kotlinx.coroutines.Deferred import kotlinx.coroutines.async diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt index 11c91ab77..f30d156ef 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.load +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load import kotlinx.coroutines.runBlocking import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ModelTypeLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt index 0fd30f206..9f43740aa 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ModelTypeLoadService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt @@ -15,21 +15,21 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.load +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.coroutineScope import org.apache.commons.io.FilenameUtils import org.apache.commons.lang3.text.StrBuilder +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ModelTypeHandler import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.data.* import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.readNBText import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType -import org.onap.ccsdk.cds.controllerblueprints.service.handler.ModelTypeHandler import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import java.io.File @@ -131,7 +131,7 @@ open class ModelTypeLoadService(private val modelTypeHandler: ModelTypeHandler) } modelType.definitionType = definitionType modelType.derivedFrom = definition.derivedFrom - modelType.description = definition.description + modelType.description = definition.description!! modelType.definition = JacksonUtils.jsonNode(definitionContent) modelType.modelName = dataKey modelType.version = definition.version diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ResourceDictionaryLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt index 25db333a0..95073e99d 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ResourceDictionaryLoadService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt @@ -15,20 +15,20 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.load +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.coroutineScope import org.apache.commons.lang3.StringUtils import org.apache.commons.lang3.text.StrBuilder +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ResourceDictionaryHandler import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.readNBText import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary -import org.onap.ccsdk.cds.controllerblueprints.service.handler.ResourceDictionaryHandler import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import java.io.File @@ -82,7 +82,7 @@ open class ResourceDictionaryLoadService(private val resourceDictionaryHandler: resourceDictionary.definition = resourceDefinition checkNotNull(resourceDefinition.property) { "Property field is missing" } - resourceDictionary.description = resourceDefinition.property.description + resourceDictionary.description = resourceDefinition.property.description!! resourceDictionary.dataType = resourceDefinition.property.type if (resourceDefinition.property.entrySchema != null) { @@ -95,7 +95,7 @@ open class ResourceDictionaryLoadService(private val resourceDictionaryHandler: + ", " + resourceDefinition.updatedBy) } else { - resourceDictionary.tags = resourceDefinition.tags + resourceDictionary.tags = resourceDefinition.tags!! } resourceDictionaryHandler.saveResourceDictionary(resourceDictionary) diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/BluePrintsReactRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/BluePrintsReactRepository.kt index 0041fa7c8..1d69cd7cc 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/BluePrintsReactRepository.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/BluePrintsReactRepository.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2018 IBM. + * Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.repository +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.springframework.stereotype.Service import reactor.core.publisher.Flux import reactor.core.publisher.Mono import reactor.core.scheduler.Schedulers - +// TODO("Convert into coroutines") /** * ModelTypeReactRepository. * diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ModelTypeRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt index 4fefc8144..3e36947a4 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ModelTypeRepository.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt @@ -14,9 +14,9 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.repository +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.springframework.data.jpa.repository.JpaRepository import org.springframework.stereotype.Repository import javax.transaction.Transactional diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt index b1b633a10..68db371c6 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepository.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt @@ -14,9 +14,9 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.repository +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary import org.springframework.data.jpa.repository.JpaRepository import org.springframework.stereotype.Repository diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt new file mode 100644 index 000000000..edf4c8cf6 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt @@ -0,0 +1,54 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service + +import org.apache.commons.collections.CollectionUtils +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory +import org.slf4j.LoggerFactory +import org.springframework.beans.factory.annotation.Value +import org.springframework.stereotype.Component +import javax.annotation.PostConstruct + +@Component +class ApplicationRegistrationService { + + @Value("#{'\${resourceSourceMappings}'.split(',')}") + private val resourceSourceMappings: List<String>? = null + + @PostConstruct + fun register() { + registerDictionarySources() + } + + fun registerDictionarySources() { + log.info("Registering Dictionary Sources : {}", resourceSourceMappings) + if (CollectionUtils.isNotEmpty(resourceSourceMappings)) { + resourceSourceMappings!!.forEach { resourceSourceMapping -> + val mappingKeyValue = resourceSourceMapping.split("=".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() + if (mappingKeyValue != null && mappingKeyValue.size == 2) { + ResourceSourceMappingFactory.registerSourceMapping(mappingKeyValue[0].trim { it <= ' ' }, mappingKeyValue[1].trim { it <= ' ' }) + } else { + log.warn("failed to get resource source mapping {}", resourceSourceMapping) + } + } + } + } + + companion object { + private val log = LoggerFactory.getLogger(ApplicationRegistrationService::class.java) + } +} diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/AutoResourceMappingService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/AutoResourceMappingService.kt index 3ab9fee58..be562642f 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/AutoResourceMappingService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/AutoResourceMappingService.kt @@ -15,18 +15,18 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service import com.google.common.base.Preconditions import org.apache.commons.collections.CollectionUtils import org.apache.commons.lang3.StringUtils +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.AutoMapResponse +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ResourceDictionaryRepository import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary -import org.onap.ccsdk.cds.controllerblueprints.service.model.AutoMapResponse -import org.onap.ccsdk.cds.controllerblueprints.service.repository.ResourceDictionaryRepository import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import java.util.* diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/BluePrintRepoServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/BluePrintRepoServiceImpl.kt index e1fa1882d..f8e6163a5 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/BluePrintRepoServiceImpl.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/BluePrintRepoServiceImpl.kt @@ -15,18 +15,18 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service import com.fasterxml.jackson.databind.JsonNode import com.google.common.base.Preconditions import org.apache.commons.lang3.StringUtils +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ModelTypeRepository +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ResourceDictionaryRepository import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.data.* import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition -import org.onap.ccsdk.cds.controllerblueprints.service.repository.ModelTypeRepository -import org.onap.ccsdk.cds.controllerblueprints.service.repository.ResourceDictionaryRepository import org.springframework.stereotype.Service interface ResourceDefinitionRepoService : BluePrintRepoService { diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt index 97b9a813a..6eab5cd3f 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.utils +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.reactive.awaitSingle diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/validator/ModelTypeValidator.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt index 9bfb29c23..8ec0b9bab 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/validator/ModelTypeValidator.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt @@ -14,15 +14,15 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.validator +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils import com.fasterxml.jackson.databind.JsonNode +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.* import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType class ModelTypeValidator { companion object { diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt index 64bd3ff3e..877584ed6 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelControllerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.controller +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api import kotlinx.coroutines.reactive.awaitSingle import kotlinx.coroutines.runBlocking @@ -26,21 +26,21 @@ import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters -import org.onap.ccsdk.cds.controllerblueprints.TestApplication +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch import org.onap.ccsdk.cds.controllerblueprints.core.* -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration -import org.onap.ccsdk.cds.controllerblueprints.service.ControllerBluePrintCoreConfiguration -import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelSearch +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.boot.test.context.SpringBootTest -import org.springframework.context.annotation.ComponentScan import org.springframework.core.io.ByteArrayResource import org.springframework.http.HttpMethod import org.springframework.http.HttpStatus import org.springframework.http.client.MultipartBodyBuilder import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.TestPropertySource import org.springframework.test.context.junit4.SpringRunner import org.springframework.test.web.reactive.server.WebTestClient import org.springframework.test.web.reactive.server.returnResult @@ -48,7 +48,6 @@ import org.springframework.util.Base64Utils import org.springframework.web.reactive.function.BodyInserters import java.io.File import java.nio.charset.StandardCharsets.UTF_8 -import java.nio.file.Paths import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertTrue @@ -62,10 +61,10 @@ import kotlin.test.assertTrue @RunWith(SpringRunner::class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ContextConfiguration(classes = [TestApplication::class, ControllerBluePrintCoreConfiguration::class]) -@ComponentScan(basePackages = ["org.onap.ccsdk.cds.controllerblueprints"]) +@ContextConfiguration(classes = [DesignerApiTestConfiguration::class, + BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class]) +@TestPropertySource(locations = ["classpath:application-test.properties"]) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@EnableAutoConfiguration class BlueprintModelControllerTest { private val log = LoggerFactory.getLogger(BlueprintModelControllerTest::class.java)!! @@ -77,9 +76,9 @@ class BlueprintModelControllerTest { @Autowired lateinit var webTestClient: WebTestClient - private var bluePrintLoadConfiguration: BluePrintPathConfiguration? = null + private var bluePrintLoadConfiguration: BluePrintLoadConfiguration? = null - private val blueprintDir = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + private val blueprintDir = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" private var zipBlueprintFileName: String? = null private var testZipFile: File? = null @@ -89,7 +88,7 @@ class BlueprintModelControllerTest { fun setUp() { assertNotNull(webTestClient, " Failed to create WebTestClient") - bluePrintLoadConfiguration = BluePrintPathConfiguration().apply { + bluePrintLoadConfiguration = BluePrintLoadConfiguration().apply { blueprintArchivePath = "./target/blueprints/archive" blueprintWorkingPath = "./target/blueprints/work" blueprintDeployPath = "./target/blueprints/deploy" @@ -99,7 +98,7 @@ class BlueprintModelControllerTest { val archiveDir = normalizedFile(bluePrintLoadConfiguration!!.blueprintArchivePath).reCreateDirs() assertTrue(archiveDir.exists(), "failed to create archiveDir(${archiveDir.absolutePath}") - val blueprintFile = Paths.get(blueprintDir).toFile().normalize() + val blueprintFile = normalizedFile(blueprintDir) testZipFile = blueprintFile.compress(zipBlueprintFileName!!) assertNotNull(testZipFile, "test zip is null") assertTrue(testZipFile!!.exists(), "Failed to create blueprint test zip(${testZipFile!!.absolutePath}") diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt new file mode 100644 index 000000000..03e016b8e --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt @@ -0,0 +1,27 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api + +import org.springframework.boot.autoconfigure.EnableAutoConfiguration +import org.springframework.context.annotation.ComponentScan +import org.springframework.context.annotation.Configuration + +@Configuration +@ComponentScan(basePackages = ["org.onap.ccsdk.cds.controllerblueprints", + "org.onap.ccsdk.cds.blueprintsprocessor"]) +@EnableAutoConfiguration +open class DesignerApiTestConfiguration diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ModelTypeControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt index 4af8851a5..6fe7097e5 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ModelTypeControllerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt @@ -14,27 +14,30 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.controller +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api import org.junit.Assert import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters -import org.onap.ccsdk.cds.controllerblueprints.TestApplication +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest import org.springframework.test.annotation.Commit import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.TestPropertySource import org.springframework.test.context.junit4.SpringRunner @RunWith(SpringRunner::class) -@DataJpaTest -@ContextConfiguration(classes = [TestApplication::class]) +@ContextConfiguration(classes = [DesignerApiTestConfiguration::class, + BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class]) +@TestPropertySource(locations = ["classpath:application-test.properties"]) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class ModelTypeControllerTest { diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ResourceDictionaryControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt index cf139ec00..893622308 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ResourceDictionaryControllerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt @@ -14,22 +14,28 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.controller +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api +import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith -import org.onap.ccsdk.cds.controllerblueprints.TestApplication +import org.junit.runners.MethodSorters +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest -import org.springframework.context.annotation.ComponentScan import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.TestPropertySource import org.springframework.test.context.junit4.SpringRunner import kotlin.test.assertNotNull @RunWith(SpringRunner::class) -@ContextConfiguration(classes = [TestApplication::class]) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ComponentScan(basePackages = ["org.onap.ccsdk.cds.controllerblueprints"]) +@ContextConfiguration(classes = [DesignerApiTestConfiguration::class, + BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class]) +@TestPropertySource(locations = ["classpath:application-test.properties"]) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) class ResourceDictionaryControllerTest { @Autowired diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt index d09479b6c..974a3b9b7 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt @@ -15,27 +15,31 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.enhancer +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer import kotlinx.coroutines.runBlocking import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.onap.ccsdk.cds.controllerblueprints.TestApplication +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.ModelTypeLoadService +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.ResourceDictionaryLoadService import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName -import org.onap.ccsdk.cds.controllerblueprints.service.load.ModelTypeLoadService -import org.onap.ccsdk.cds.controllerblueprints.service.load.ResourceDictionaryLoadService import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration import org.springframework.test.context.TestPropertySource import org.springframework.test.context.junit4.SpringRunner @RunWith(SpringRunner::class) -@ContextConfiguration(classes = arrayOf(TestApplication::class)) -@TestPropertySource(locations = arrayOf("classpath:application.properties")) +@ContextConfiguration(classes = [DesignerApiTestConfiguration::class, + BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class]) +@TestPropertySource(locations = ["classpath:application-test.properties"]) class BluePrintEnhancerServiceImplTest { @Autowired @@ -56,11 +60,11 @@ class BluePrintEnhancerServiceImplTest { fun testEnhancementAndValidation() { runBlocking { - modelTypeLoadService.loadPathModelType("./../../../../components/model-catalog/definition-type/starter-type") + modelTypeLoadService.loadPathModelType("./../../../../../components/model-catalog/definition-type/starter-type") val dictPaths: MutableList<String> = arrayListOf() - dictPaths.add("./../../../../components/model-catalog/resource-dictionary/starter-dictionary") - dictPaths.add("./../../../../components/model-catalog/resource-dictionary/test-dictionary") + dictPaths.add("./../../../../../components/model-catalog/resource-dictionary/starter-dictionary") + dictPaths.add("./../../../../../components/model-catalog/resource-dictionary/test-dictionary") resourceDictionaryLoadService.loadPathsResourceDictionary(dictPaths) testBaseConfigEnhancementAndValidation() @@ -72,28 +76,28 @@ class BluePrintEnhancerServiceImplTest { } fun testBaseConfigEnhancementAndValidation() { - val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" testComponentInvokeEnhancementAndValidation(basePath, "base-enhance") } fun testVFWEnhancementAndValidation() { - val basePath = "./../../../../components/model-catalog/blueprint-model/service-blueprint/vFW" + val basePath = "./../../../../../components/model-catalog/blueprint-model/service-blueprint/vFW" testComponentInvokeEnhancementAndValidation(basePath, "vFW-enhance") } fun testGoldenEnhancementAndValidation() { - val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/golden" + val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/golden" testComponentInvokeEnhancementAndValidation(basePath, "golden-enhance") } fun testRemoteScriptsEnhancementAndValidation() { - val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts" + val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts" testComponentInvokeEnhancementAndValidation(basePath, "remote_scripts-enhance") } fun testCapabilityCliEnhancementAndValidation() { - val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/capability_cli" + val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/capability_cli" testComponentInvokeEnhancementAndValidation(basePath, "capability_cli-enhance") } diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/ModelTypeServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt index e55f2a511..00e78d247 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/ModelTypeServiceTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler import kotlinx.coroutines.runBlocking import org.junit.Assert @@ -22,25 +22,25 @@ import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters -import org.onap.ccsdk.cds.controllerblueprints.TestApplication +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType -import org.onap.ccsdk.cds.controllerblueprints.service.handler.ModelTypeHandler +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest import org.springframework.test.annotation.Commit import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.TestPropertySource import org.springframework.test.context.junit4.SpringRunner -import org.springframework.transaction.annotation.Propagation -import org.springframework.transaction.annotation.Transactional @RunWith(SpringRunner::class) -@DataJpaTest -@Transactional(propagation = Propagation.NOT_SUPPORTED) -@ContextConfiguration(classes = [TestApplication::class]) +@ContextConfiguration(classes = [DesignerApiTestConfiguration::class, + BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class]) +@TestPropertySource(locations = ["classpath:application-test.properties"]) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class ModelTypeServiceTest { @Autowired diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/mock/MockFilePart.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt index 2fb2129ae..3165a6e2f 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/mock/MockFilePart.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.controller.mock +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.mock import org.apache.commons.io.FilenameUtils import org.slf4j.LoggerFactory diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt new file mode 100644 index 000000000..55bc1e4af --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt @@ -0,0 +1,110 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository + +import org.junit.Assert +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.test.annotation.Commit +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.TestPropertySource +import org.springframework.test.context.junit4.SpringRunner +import java.nio.charset.Charset +import java.util.* + +/** + * ModelTypeReactRepositoryTest. + * + * @author Brinda Santh + */ + +@RunWith(SpringRunner::class) +@ContextConfiguration(classes = [DesignerApiTestConfiguration::class, + BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class]) +@TestPropertySource(locations = ["classpath:application-test.properties"]) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class ModelTypeReactRepositoryTest { + + @Autowired + private val modelTypeReactRepository: ModelTypeReactRepository? = null + + internal var modelName = "test-datatype" + + @Test + @Commit + fun test01Save() { + val content = normalizedFile("./src/test/resources/model_type/data_type/datatype-property.json") + .readText(Charset.defaultCharset()) + val modelType = ModelType() + modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE + modelType.derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + modelType.description = "Definition for Sample Datatype " + modelType.definition = JacksonUtils.jsonNode(content) + modelType.modelName = modelName + modelType.version = "1.0.0" + modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," + + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE) + modelType.updatedBy = "xxxxxx@xxx.com" + + val dbModelType = modelTypeReactRepository!!.save(modelType).block() + Assert.assertNotNull("Failed to get Saved ModelType", dbModelType) + } + + @Test + fun test02Finds() { + val dbFindByModelName = modelTypeReactRepository!!.findByModelName(modelName).block() + Assert.assertNotNull("Failed to findByModelName ", dbFindByModelName) + + val dbFindByDefinitionType = modelTypeReactRepository.findByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE).collectList().block() + Assert.assertNotNull("Failed to findByDefinitionType ", dbFindByDefinitionType) + Assert.assertTrue("Failed to findByDefinitionType count", dbFindByDefinitionType!!.size > 0) + + val dbFindByDerivedFrom = modelTypeReactRepository.findByDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT).collectList().block() + Assert.assertNotNull("Failed to find findByDerivedFrom", dbFindByDerivedFrom) + Assert.assertTrue("Failed to find findByDerivedFrom by count", dbFindByDerivedFrom!!.size > 0) + + val dbFindByModelNameIn = modelTypeReactRepository.findByModelNameIn(Arrays.asList(modelName)).collectList().block() + Assert.assertNotNull("Failed to findByModelNameIn ", dbFindByModelNameIn) + Assert.assertTrue("Failed to findByModelNameIn by count", dbFindByModelNameIn!!.size > 0) + + val dbFindByDefinitionTypeIn = modelTypeReactRepository.findByDefinitionTypeIn(Arrays.asList(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)).collectList().block() + Assert.assertNotNull("Failed to findByDefinitionTypeIn", dbFindByDefinitionTypeIn) + Assert.assertTrue("Failed to findByDefinitionTypeIn by count", dbFindByDefinitionTypeIn!!.size > 0) + + val dbFindByDerivedFromIn = modelTypeReactRepository.findByDerivedFromIn(Arrays.asList(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)).collectList().block() + Assert.assertNotNull("Failed to find findByDerivedFromIn", dbFindByDerivedFromIn) + Assert.assertTrue("Failed to find findByDerivedFromIn by count", dbFindByDerivedFromIn!!.size > 0) + } + + @Test + @Commit + fun test03Delete() { + modelTypeReactRepository!!.deleteByModelName(modelName).block() + } + +} diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt index 3f52d9183..70e1b8ed2 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt @@ -14,27 +14,31 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.repository +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository -import kotlinx.coroutines.runBlocking import org.junit.Assert import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters -import org.onap.ccsdk.cds.controllerblueprints.TestApplication +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest import org.springframework.test.annotation.Commit import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.TestPropertySource import org.springframework.test.context.junit4.SpringRunner +import org.springframework.transaction.annotation.Transactional @RunWith(SpringRunner::class) -@DataJpaTest -@ContextConfiguration(classes = [TestApplication::class]) +@ContextConfiguration(classes = [DesignerApiTestConfiguration::class, + BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class]) +@TestPropertySource(locations = ["classpath:application-test.properties"]) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class ResourceDictionaryReactRepositoryTest { @@ -46,7 +50,9 @@ class ResourceDictionaryReactRepositoryTest { @Test @Commit fun test01Save() { - val resourceDefinition = JacksonUtils.readValueFromFile("./../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json", ResourceDefinition::class.java) + val resourceDefinition = JacksonUtils + .readValueFromFile("./../../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json", + ResourceDefinition::class.java) Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition) resourceDefinition!!.name = sourceName @@ -74,19 +80,18 @@ class ResourceDictionaryReactRepositoryTest { } @Test + @Transactional @Commit fun test05Delete() { - runBlocking { - resourceDictionaryRepository.deleteByName(sourceName) - } + resourceDictionaryRepository.deleteByName(sourceName) } private fun transformResourceDictionary(resourceDefinition: ResourceDefinition): ResourceDictionary { val resourceDictionary = ResourceDictionary() resourceDictionary.name = resourceDefinition.name resourceDictionary.dataType = resourceDefinition.property.type - resourceDictionary.description = resourceDefinition.property.description - resourceDictionary.tags = resourceDefinition.tags + resourceDictionary.description = resourceDefinition.property.description!! + resourceDictionary.tags = resourceDefinition.tags!! resourceDictionary.updatedBy = resourceDefinition.updatedBy resourceDictionary.definition = resourceDefinition return resourceDictionary diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt index 100c3adeb..e34238eb9 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.utils +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils import kotlinx.coroutines.runBlocking import org.junit.After 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 org.onap.ccsdk.cds.controllerblueprints.service.controller.mock.MockFilePart import java.nio.file.Paths import java.util.* import kotlin.test.assertTrue diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/validator/ModelTypeValidatorTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidatorTest.kt index 728f431a7..3c263b349 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/validator/ModelTypeValidatorTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidatorTest.kt @@ -14,11 +14,11 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.validator +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils -import com.fasterxml.jackson.databind.JsonNode import org.junit.Test -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils class ModelTypeValidatorTest { @@ -29,8 +29,7 @@ class ModelTypeValidatorTest { modelType.definitionType = "" modelType.derivedFrom = "" modelType.description = "" - val definitionContent: JsonNode? = null - modelType.definition = definitionContent + modelType.definition = JacksonUtils.objectMapper.createObjectNode() modelType.modelName = "" modelType.version = "" modelType.tags = "" diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties new file mode 100755 index 000000000..e22e522ee --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties @@ -0,0 +1,41 @@ +# +# Copyright © 2019 IBM. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring.main.banner-mode=off +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false +logging.level.org.springframework.web=INFO +logging.level.org.hibernate.SQL=warn +logging.level.org.hibernate.type.descriptor.sql=debug + +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 + +# 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 +# Controller Blueprints Core Configuration +blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy +blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive +blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work + +# 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/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-resource-assignment.json index 31f729da8..fdf76ab44 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-resource-assignment.json @@ -1,62 +1,62 @@ -[
- {
- "name": "rs-db-source",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "sample-db-source",
- "dictionary-source": "processor-db",
- "dependencies": [
- "input-source"
- ]
- },
- {
- "name": "ra-default-source",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "sample-default-source",
- "dictionary-source": "default",
- "dependencies": []
- },
- {
- "name": "ra-input-source",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "sample-input-source",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "ra-list-input-source",
- "input-param": true,
- "property": {
- "type": "list",
- "required": true,
- "entry_schema": {
- "type": "string"
- }
- },
- "dictionary-name": "ra-list-input-source",
- "dictionary-source": "input",
- "dependencies": []
- },
- {
- "name": "ra-complex-input-source",
- "input-param": true,
- "property": {
- "type": "dt-v4-aggregate",
- "required": true
- },
- "dictionary-name": "sample-mdsal-source",
- "dictionary-source": "config-data",
- "dependencies": []
- }
-]
+[ + { + "name": "rs-db-source", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "sample-db-source", + "dictionary-source": "processor-db", + "dependencies": [ + "input-source" + ] + }, + { + "name": "ra-default-source", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "sample-default-source", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "ra-input-source", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "sample-input-source", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "ra-list-input-source", + "input-param": true, + "property": { + "type": "list", + "required": true, + "entry_schema": { + "type": "string" + } + }, + "dictionary-name": "ra-list-input-source", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "ra-complex-input-source", + "input-param": true, + "property": { + "type": "dt-v4-aggregate", + "required": true + }, + "dictionary-name": "sample-mdsal-source", + "dictionary-source": "sdnc", + "dependencies": [] + } +] diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-template.json index c9351237d..3692b7dcd 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-template.json @@ -1,351 +1,351 @@ -{
- "metadata": {
- "template_author": "Brinda Santh",
- "template_name": "enhance-template",
- "template_version": "1.0.0",
- "template_tags": "brinda, VPE",
- "service-type": "Sample Service",
- "release": "1806",
- "vnf-type": "VPE"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "required": true,
- "type": "string"
- }
- },
- "node_templates": {
- "vpe-netconf-device": {
- "capabilities": {
- "netconf": {
- "properties": {
- "login-key": "sdnc",
- "login-account": "sndc-local",
- "source": "local",
- "target-ip-address": {
- "get_attribute": [
- "SELF",
- "lo0-local-ipv4-address"
- ]
- },
- "port-number": 22,
- "connection-time-out": 30
- }
- }
- },
- "type": "vnf-netconf-device"
- },
- "activate-netconf-component": {
- "capabilities": {
- "component-node": {}
- },
- "requirements": {
- "netconf-connection": {
- "capability": "netconf",
- "node": "vpe-netconf-device",
- "relationship": "tosca.relationships.ConnectsTo"
- }
- },
- "interfaces": {
- "NetconfExecutorComponent": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": {
- "get_input": "action-name"
- },
- "template-name": {
- "get_input": "template_name"
- },
- "template-version": {
- "get_input": "template_version"
- },
- "resource-type": "vnf-type",
- "request-id": {
- "get_input": "request-id"
- },
- "resource-id": {
- "get_input": "hostname"
- },
- "execution-script": "execution-script"
- },
- "outputs": {
- "response-data": {
- "get_attribute": [
- "SELF",
- "netconf-executor-baseconfig.response-data"
- ]
- },
- "status": {
- "get_attribute": [
- "SELF",
- "netconf-executor-baseconfig.status"
- ]
- }
- },
- "implementation": {
- "primary": "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
- }
- }
- }
- }
- },
- "type": "component-netconf-executor"
- },
- "resource-assignment-ra-component": {
- "capabilities": {
- "component-node": {}
- },
- "interfaces": {
- "ResourceAssignmentComponent": {
- "operations": {
- "process": {
- "inputs": {
- "template-names": [
- "base-config-template",
- "licence-template"
- ],
- "action-name": {
- "get_input": "action-name"
- },
- "template-name": {
- "get_input": "template_name"
- },
- "template-version": {
- "get_input": "template-version"
- },
- "resource-type": "vnf-type",
- "request-id": {
- "get_input": "request-id"
- },
- "resource-id": {
- "get_input": "hostname"
- }
- },
- "outputs": {
- "resource-assignment-params": "success",
- "status": "status"
- }
- }
- }
- }
- },
- "type": "component-resource-assignment"
- },
- "resource-assignment-action": {
- "properties": {
- "mode": "sync",
- "version": "LATEST",
- "is-start-flow": false
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "resource-assignment-ra-component",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "capabilities": {
- "dg-node": {}
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
- "inputs": {
- "params": []
- }
- }
- }
- }
- },
- "type": "dg-resource-assignment"
- },
- "activate-action": {
- "properties": {
- "mode": "sync",
- "version": "LATEST",
- "is-start-flow": false
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "activate-netconf-component",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "capabilities": {
- "dg-node": {}
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ActivateNetconf": {
- "inputs": {
- "params": []
- }
- }
- }
- }
- },
- "type": "dg-activate-netconf"
- },
- "base-config-template": {
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://base-config-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "rs-db-source",
- "property": {
- "required": true,
- "type": "string"
- },
- "input-param": false,
- "dictionary-name": "sample-db-source",
- "dictionary-source": "processor-db",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "mdsal-source",
- "property": {
- "description": "",
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "dt-v4-aggregate"
- }
- },
- "input-param": false,
- "dictionary-name": "sample-mdsal-source",
- "dictionary-source": "config-data",
- "dependencies": [
- "service-instance-id"
- ],
- "version": 0
- },
- {
- "name": "hostname",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "hostname",
- "dictionary-source": "input",
- "version": 0,
- "input-param": false
- },
- {
- "name": "service",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "service",
- "dictionary-source": "input",
- "version": 0,
- "input-param": false
- },
- {
- "name": "service-instance-id",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "service-instance-id",
- "dictionary-source": "input",
- "version": 0,
- "input-param": false
- }
- ]
- }
- }
- },
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "type": "artifact-config-template"
- },
- "licence-template": {
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://licence-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "licenses",
- "property": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "dt-license-key"
- }
- },
- "input-param": false,
- "dictionary-name": "sample-licenses",
- "dictionary-source": "config-data",
- "dependencies": [
- "service-instance-id"
- ],
- "version": 0
- },
- {
- "name": "service-instance-id",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "service-instance-id",
- "dictionary-source": "input",
- "version": 0,
- "input-param": false
- }
- ]
- }
- }
- },
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "type": "artifact-config-template"
- }
- }
- },
- "node_types": {
- },
- "data_types": {
- }
-}
+{ + "metadata": { + "template_author": "Brinda Santh", + "template_name": "enhance-template", + "template_version": "1.0.0", + "template_tags": "brinda, VPE", + "service-type": "Sample Service", + "release": "1806", + "vnf-type": "VPE" + }, + "topology_template": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "service-instance-id": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "node_templates": { + "vpe-netconf-device": { + "capabilities": { + "netconf": { + "properties": { + "login-key": "sdnc", + "login-account": "sndc-local", + "source": "local", + "target-ip-address": { + "get_attribute": [ + "SELF", + "lo0-local-ipv4-address" + ] + }, + "port-number": 22, + "connection-time-out": 30 + } + } + }, + "type": "vnf-netconf-device" + }, + "activate-netconf-component": { + "capabilities": { + "component-node": {} + }, + "requirements": { + "netconf-connection": { + "capability": "netconf", + "node": "vpe-netconf-device", + "relationship": "tosca.relationships.ConnectsTo" + } + }, + "interfaces": { + "NetconfExecutorComponent": { + "operations": { + "process": { + "inputs": { + "action-name": { + "get_input": "action-name" + }, + "template-name": { + "get_input": "template_name" + }, + "template-version": { + "get_input": "template_version" + }, + "resource-type": "vnf-type", + "request-id": { + "get_input": "request-id" + }, + "resource-id": { + "get_input": "hostname" + }, + "execution-script": "execution-script" + }, + "outputs": { + "response-data": { + "get_attribute": [ + "SELF", + "netconf-executor-baseconfig.response-data" + ] + }, + "status": { + "get_attribute": [ + "SELF", + "netconf-executor-baseconfig.status" + ] + } + }, + "implementation": { + "primary": "file://netconf_adaptor/DefaultBaseLicenceConfig.py" + } + } + } + } + }, + "type": "component-netconf-executor" + }, + "resource-assignment-ra-component": { + "capabilities": { + "component-node": {} + }, + "interfaces": { + "ResourceAssignmentComponent": { + "operations": { + "process": { + "inputs": { + "template-names": [ + "base-config-template", + "licence-template" + ], + "action-name": { + "get_input": "action-name" + }, + "template-name": { + "get_input": "template_name" + }, + "template-version": { + "get_input": "template-version" + }, + "resource-type": "vnf-type", + "request-id": { + "get_input": "request-id" + }, + "resource-id": { + "get_input": "hostname" + } + }, + "outputs": { + "resource-assignment-params": "success", + "status": "status" + } + } + } + } + }, + "type": "component-resource-assignment" + }, + "resource-assignment-action": { + "properties": { + "mode": "sync", + "version": "LATEST", + "is-start-flow": false + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "resource-assignment-ra-component", + "relationship": "tosca.relationships.DependsOn" + } + }, + "capabilities": { + "dg-node": {} + }, + "interfaces": { + "CONFIG": { + "operations": { + "ResourceAssignment": { + "inputs": { + "params": [] + } + } + } + } + }, + "type": "dg-resource-assignment" + }, + "activate-action": { + "properties": { + "mode": "sync", + "version": "LATEST", + "is-start-flow": false + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "activate-netconf-component", + "relationship": "tosca.relationships.DependsOn" + } + }, + "capabilities": { + "dg-node": {} + }, + "interfaces": { + "CONFIG": { + "operations": { + "ActivateNetconf": { + "inputs": { + "params": [] + } + } + } + } + }, + "type": "dg-activate-netconf" + }, + "base-config-template": { + "capabilities": { + "content": { + "properties": { + "content": "db://base-config-template" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "rs-db-source", + "property": { + "required": true, + "type": "string" + }, + "input-param": false, + "dictionary-name": "sample-db-source", + "dictionary-source": "processor-db", + "dependencies": [ + "hostname" + ], + "version": 0 + }, + { + "name": "mdsal-source", + "property": { + "description": "", + "required": true, + "type": "list", + "entry_schema": { + "type": "dt-v4-aggregate" + } + }, + "input-param": false, + "dictionary-name": "sample-mdsal-source", + "dictionary-source": "sdnc", + "dependencies": [ + "service-instance-id" + ], + "version": 0 + }, + { + "name": "hostname", + "property": { + "required": true, + "type": "string" + }, + "dictionary-name": "hostname", + "dictionary-source": "input", + "version": 0, + "input-param": false + }, + { + "name": "service", + "property": { + "required": true, + "type": "string" + }, + "dictionary-name": "service", + "dictionary-source": "input", + "version": 0, + "input-param": false + }, + { + "name": "service-instance-id", + "property": { + "required": true, + "type": "string" + }, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "version": 0, + "input-param": false + } + ] + } + } + }, + "properties": { + "action-names": [ + "resource-assignment-action" + ] + }, + "type": "artifact-config-template" + }, + "licence-template": { + "capabilities": { + "content": { + "properties": { + "content": "db://licence-template" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "licenses", + "property": { + "required": true, + "type": "list", + "entry_schema": { + "type": "dt-license-key" + } + }, + "input-param": false, + "dictionary-name": "sample-licenses", + "dictionary-source": "sdnc", + "dependencies": [ + "service-instance-id" + ], + "version": 0 + }, + { + "name": "service-instance-id", + "property": { + "required": true, + "type": "string" + }, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "version": 0, + "input-param": false + } + ] + } + } + }, + "properties": { + "action-names": [ + "resource-assignment-action" + ] + }, + "type": "artifact-config-template" + } + } + }, + "node_types": { + }, + "data_types": { + } +} diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhanced-template.json index b0a6e0979..d71293259 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhanced-template.json @@ -242,7 +242,7 @@ }, "input-param" : false, "dictionary-name" : "sample-mdsal-source", - "dictionary-source" : "config-data", + "dictionary-source" : "sdnc", "dependencies" : [ "service-instance-id" ], "version" : 0 }, { @@ -304,7 +304,7 @@ }, "input-param" : false, "dictionary-name" : "sample-licenses", - "dictionary-source" : "config-data", + "dictionary-source" : "sdnc", "dependencies" : [ "service-instance-id" ], "version" : 0 }, { diff --git a/ms/controllerblueprints/modules/service/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/logback-test.xml index feb4514d6..feb4514d6 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/logback-test.xml +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/logback-test.xml diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-property.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/model_type/data_type/datatype-property.json index d3ecffd17..d3ecffd17 100644 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-property.json +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/model_type/data_type/datatype-property.json diff --git a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/automap.json index c6dd7948b..820c59804 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/automap.json @@ -1,14 +1,14 @@ -[
- {
- "name": "sample-input-source"
- },
- {
- "name": "sample-default-source"
- },
- {
- "name": "sample-db-source"
- },
- {
- "name": "sample-mdsal-source"
- }
+[ + { + "name": "sample-input-source" + }, + { + "name": "sample-default-source" + }, + { + "name": "sample-db-source" + }, + { + "name": "sample-mdsal-source" + } ]
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/default_definition.json index 334fb24e8..d2fa29918 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/default_definition.json @@ -1,17 +1,17 @@ -{
- "name": "ipaddress",
- "property": {
- "description": "name of the ",
- "type": "list",
- "entry_schema": {
- "type": "dt-v4-aggregate"
- }
- },
- "updated-by": "Brinda Santh (bs2796)",
- "tags": "ipaddress",
- "sources": {
- "input": {
- "type": "source-input"
- }
- }
+{ + "name": "ipaddress", + "property": { + "description": "name of the ", + "type": "list", + "entry_schema": { + "type": "dt-v4-aggregate" + } + }, + "updated-by": "Brinda Santh (bs2796)", + "tags": "ipaddress", + "sources": { + "input": { + "type": "source-input" + } + } }
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml index a892f205f..8afecab3c 100644 --- a/ms/blueprintsprocessor/modules/inbounds/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml @@ -85,5 +85,11 @@ <artifactId>reactor-test</artifactId> <scope>test</scope> </dependency> + + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml index 53c1e975b..cf8c61ac7 100644 --- a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml @@ -36,22 +36,5 @@ <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> <artifactId>blueprint-core</artifactId> </dependency> - <!--dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>db-resources</artifactId> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>blueprint-validation</artifactId> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>blueprint-scripts</artifactId> - </dependency--> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml index cfa2d6fea..2c241cc4f 100755 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml @@ -55,11 +55,6 @@ <groupId>io.grpc</groupId> <artifactId>grpc-testing</artifactId> </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>test</scope> - </dependency> <!-- For Message libraries --> <dependency> diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt index 81f3ec309..0116680cf 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt @@ -24,23 +24,21 @@ import kotlinx.coroutines.runBlocking import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.currentTimestamp import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader import org.onap.ccsdk.cds.controllerblueprints.common.api.Status -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration -import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir +import org.onap.ccsdk.cds.controllerblueprints.core.* +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService -import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile -import org.onap.ccsdk.cds.controllerblueprints.core.reCreateDirs -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput +import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils +import org.onap.ccsdk.cds.controllerblueprints.management.api.* import org.slf4j.LoggerFactory import org.springframework.security.access.prepost.PreAuthorize import org.springframework.stereotype.Service import java.io.File import java.util.* +// TODO("move to management-api or designer-api module") @Service -open class BluePrintManagementGRPCHandler(private val bluePrintPathConfiguration: BluePrintPathConfiguration, +open class BluePrintManagementGRPCHandler(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration, private val blueprintsProcessorCatalogService: BluePrintCatalogService) : BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase() { @@ -53,19 +51,48 @@ open class BluePrintManagementGRPCHandler(private val bluePrintPathConfiguration log.info("request(${request.commonHeader.requestId})") val uploadId = UUID.randomUUID().toString() + val blueprintArchive = normalizedPathName(bluePrintLoadConfiguration.blueprintArchivePath, uploadId) + val blueprintWorking = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, uploadId) try { - val cbaFile = normalizedFile(bluePrintPathConfiguration.blueprintArchivePath, uploadId, "cba-zip") + val cbaFile = normalizedFile(blueprintArchive, "cba.zip") saveToDisk(request, cbaFile) - val blueprintId = blueprintsProcessorCatalogService.saveToDatabase(uploadId, cbaFile) - responseObserver.onNext(successStatus("Successfully uploaded CBA($blueprintId)...", request.commonHeader)) + val uploadAction = request.actionIdentifiers?.actionName.emptyTONull() + ?: UploadAction.DRAFT.toString() + + when (uploadAction) { + UploadAction.DRAFT.toString() -> { + val blueprintId = blueprintsProcessorCatalogService.saveToDatabase(uploadId, cbaFile, false) + responseObserver.onNext(successStatus("Successfully uploaded CBA($blueprintId)...", + request.commonHeader)) + } + UploadAction.PUBLISH.toString() -> { + val blueprintId = blueprintsProcessorCatalogService.saveToDatabase(uploadId, cbaFile, true) + responseObserver.onNext(successStatus("Successfully uploaded CBA($blueprintId)...", + request.commonHeader)) + } + UploadAction.VALIDATE.toString() -> { + //TODO("Not Implemented") + responseObserver.onError(failStatus("Not Implemented", + BluePrintProcessorException("Not Implemented"))) + } + UploadAction.ENRICH.toString() -> { + //TODO("Not Implemented") + responseObserver.onError(failStatus("Not Implemented", + BluePrintProcessorException("Not Implemented"))) + } + } responseObserver.onCompleted() } catch (e: Exception) { responseObserver.onError(failStatus("request(${request.commonHeader.requestId}): Failed to upload CBA", e)) } finally { - deleteDir(bluePrintPathConfiguration.blueprintArchivePath, uploadId) - deleteDir(bluePrintPathConfiguration.blueprintWorkingPath, uploadId) + // Clean blueprint script cache + val cacheKey = BluePrintFileUtils + .compileCacheKey(normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, uploadId)) + BluePrintCompileCache.cleanClassLoader(cacheKey) + deleteNBDir(blueprintArchive) + deleteNBDir(blueprintWorking) } } } diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt new file mode 100644 index 000000000..b339903c5 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt @@ -0,0 +1,108 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api + +import kotlinx.coroutines.channels.consumeEach +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BluePrintMessageLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BlueprintMessageConsumerService +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsType +import org.onap.ccsdk.cds.controllerblueprints.core.logger +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty +import org.springframework.boot.context.event.ApplicationReadyEvent +import org.springframework.context.event.EventListener +import org.springframework.stereotype.Service +import javax.annotation.PreDestroy + +@ConditionalOnProperty(name = ["blueprintsprocessor.messageconsumer.self-service-api.kafkaEnable"], + havingValue = "true") +@Service +open class BluePrintProcessingKafkaConsumer( + private val bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService, + private val executionServiceHandler: ExecutionServiceHandler) { + + val log = logger(BluePrintProcessingKafkaConsumer::class) + + private lateinit var blueprintMessageConsumerService: BlueprintMessageConsumerService + + companion object { + const val CONSUMER_SELECTOR = "self-service-api" + const val PRODUCER_SELECTOR = "self-service-api" + } + + @EventListener(ApplicationReadyEvent::class) + fun setupMessageListener() = runBlocking { + try { + log.info("Setting up message consumer($CONSUMER_SELECTOR) and " + + "message producer($PRODUCER_SELECTOR)...") + + /** Get the Message Consumer Service **/ + blueprintMessageConsumerService = try { + bluePrintMessageLibPropertyService + .blueprintMessageConsumerService(CONSUMER_SELECTOR) + } catch (e: Exception) { + throw BluePrintProcessorException("failed to create consumer service ${e.message}") + } + + /** Get the Message Producer Service **/ + val blueprintMessageProducerService = try { + bluePrintMessageLibPropertyService + .blueprintMessageProducerService(PRODUCER_SELECTOR) + } catch (e: Exception) { + throw BluePrintProcessorException("failed to create producer service ${e.message}") + } + + launch { + /** Subscribe to the consumer topics */ + val additionalConfig: MutableMap<String, Any> = hashMapOf() + val channel = blueprintMessageConsumerService.subscribe(additionalConfig) + channel.consumeEach { message -> + launch { + try { + log.trace("Consumed Message : $message") + val executionServiceInput = message.jsonAsType<ExecutionServiceInput>() + val executionServiceOutput = executionServiceHandler.doProcess(executionServiceInput) + //TODO("In future, Message publisher configuration vary with respect to request") + /** Send the response message */ + blueprintMessageProducerService.sendMessage(executionServiceOutput) + } catch (e: Exception) { + log.error("failed in processing the consumed message : $message", e) + } + } + } + } + } catch (e: Exception) { + log.error("failed to start message consumer($CONSUMER_SELECTOR) and " + + "message producer($PRODUCER_SELECTOR) ", e) + } + } + + @PreDestroy + fun shutdownMessageListener() = runBlocking { + try { + log.info("Shutting down message consumer($CONSUMER_SELECTOR) and " + + "message producer($PRODUCER_SELECTOR)...") + blueprintMessageConsumerService.shutDown() + } catch (e: Exception) { + log.error("failed to shutdown message listener($CONSUMER_SELECTOR)", e) + } + } + +}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt index a81d35eac..2f8878034 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt @@ -26,7 +26,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.* import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.toProto import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType import org.onap.ccsdk.cds.controllerblueprints.core.* -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService @@ -42,17 +42,18 @@ import java.util.* import java.util.stream.Collectors @Service -class ExecutionServiceHandler(private val bluePrintPathConfiguration: BluePrintPathConfiguration, +class ExecutionServiceHandler(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration, private val blueprintsProcessorCatalogService: BluePrintCatalogService, private val bluePrintWorkflowExecutionService : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>) { private val log = LoggerFactory.getLogger(ExecutionServiceHandler::class.toString()) + //TODO("Remove from self service api and move to designer api module") suspend fun upload(filePart: FilePart): String { val saveId = UUID.randomUUID().toString() - val blueprintArchive = normalizedPathName(bluePrintPathConfiguration.blueprintArchivePath, saveId) - val blueprintWorking = normalizedPathName(bluePrintPathConfiguration.blueprintWorkingPath, saveId) + val blueprintArchive = normalizedPathName(bluePrintLoadConfiguration.blueprintArchivePath, saveId) + val blueprintWorking = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, saveId) try { val compressedFile = normalizedFile(blueprintArchive, "cba.zip") @@ -67,13 +68,14 @@ class ExecutionServiceHandler(private val bluePrintPathConfiguration: BluePrintP } finally { // Clean blueprint script cache val cacheKey = BluePrintFileUtils - .compileCacheKey(normalizedPathName(bluePrintPathConfiguration.blueprintWorkingPath,saveId)) + .compileCacheKey(normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath,saveId)) BluePrintCompileCache.cleanClassLoader(cacheKey) deleteNBDir(blueprintArchive) deleteNBDir(blueprintWorking) } } + //TODO("Remove from self service api and move to designer api module") suspend fun remove(name: String, version: String) { blueprintsProcessorCatalogService.deleteFromDatabase(name, version) } diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingConfig.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingConfig.kt deleted file mode 100644 index 17e157d15..000000000 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingConfig.kt +++ /dev/null @@ -1,58 +0,0 @@ -package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api - -import com.fasterxml.jackson.databind.DeserializationFeature -import com.fasterxml.jackson.databind.ObjectMapper -import org.apache.kafka.clients.CommonClientConfigs -import org.apache.kafka.clients.consumer.ConsumerConfig -import org.apache.kafka.common.serialization.StringDeserializer -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.springframework.beans.factory.annotation.Value -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory -import org.springframework.kafka.core.ConsumerFactory -import org.springframework.kafka.core.DefaultKafkaConsumerFactory -import org.springframework.kafka.support.serializer.ErrorHandlingDeserializer2 -import org.springframework.kafka.support.serializer.JsonDeserializer - -@Configuration -open class MessagingConfig { - - @Value("\${blueprintsprocessor.messageclient.self-service-api.groupId}") - lateinit var groupId: String - - @Value("\${blueprintsprocessor.messageclient.self-service-api.bootstrapServers}") - lateinit var bootstrapServers: String - - open fun consumerFactory(): ConsumerFactory<String, ExecutionServiceInput>? { - val configProperties = hashMapOf<String, Any>() - configProperties[CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG] = bootstrapServers - configProperties[ConsumerConfig.GROUP_ID_CONFIG] = groupId - configProperties[ConsumerConfig.AUTO_OFFSET_RESET_CONFIG] = "latest" - configProperties[ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG] = StringDeserializer::class.java - configProperties[ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG] = ErrorHandlingDeserializer2::class.java - configProperties[ErrorHandlingDeserializer2.VALUE_DESERIALIZER_CLASS] = JsonDeserializer::class.java.name - - val deserializer = JsonDeserializer<ExecutionServiceInput>() - deserializer.setRemoveTypeHeaders(true) - deserializer.addTrustedPackages("*") - - val jsonDeserializer = JsonDeserializer(ExecutionServiceInput::class.java, - ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)) - - return DefaultKafkaConsumerFactory(configProperties, StringDeserializer(), - ErrorHandlingDeserializer2<ExecutionServiceInput>(jsonDeserializer)) - } - - /** - * Creation of a Kafka MessageListener Container - * - * @return KafkaListener instance. - */ - @Bean - open fun kafkaListenerContainerFactory(): ConcurrentKafkaListenerContainerFactory<String, ExecutionServiceInput> { - val factory = ConcurrentKafkaListenerContainerFactory<String, ExecutionServiceInput>() - factory.consumerFactory = consumerFactory() - return factory - } -}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingController.kt deleted file mode 100644 index 54cc0c129..000000000 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingController.kt +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright © 2019 Bell Canada - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api - -import kotlinx.coroutines.async -import kotlinx.coroutines.runBlocking -import org.apache.commons.lang3.builder.ToStringBuilder -import org.apache.kafka.clients.consumer.ConsumerRecord -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BluePrintMessageLibPropertyService -import org.slf4j.LoggerFactory -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty -import org.springframework.kafka.annotation.KafkaListener -import org.springframework.stereotype.Service - -@ConditionalOnProperty(name = ["blueprintsprocessor.messageclient.self-service-api.kafkaEnable"], havingValue = "true") -@Service -open class MessagingController(private val propertyService: BluePrintMessageLibPropertyService, - private val executionServiceHandler: ExecutionServiceHandler) { - - private val log = LoggerFactory.getLogger(MessagingController::class.java)!! - - companion object { - // TODO PREFIX should be retrieved from model or from request. - const val PREFIX = "self-service-api" - const val EXECUTION_STATUS = 200 - } - - @KafkaListener(topics = ["\${blueprintsprocessor.messageclient.self-service-api.consumerTopic}"]) - open fun receive(record: ConsumerRecord<String, ExecutionServiceInput>) { - - runBlocking { - log.info("Successfully received a message: {}", ToStringBuilder.reflectionToString(record.value())) - - // Process the message. - async { - processMessage(record.value()) - }.await() - } - } - - private suspend fun processMessage(executionServiceInput: ExecutionServiceInput) { - - val executionServiceOutput = executionServiceHandler.doProcess(executionServiceInput) - - if (executionServiceOutput.status.code == EXECUTION_STATUS) { - val bluePrintMessageClientService = propertyService - .blueprintMessageClientService(PREFIX) - - val payload = executionServiceOutput.payload - - log.info("The payload to publish is {}", payload) - - bluePrintMessageClientService.sendMessage(payload) - } - else { - log.error("Fail to process the given event due to {}", executionServiceOutput.status.errorMessage) - } - } -} diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt index e084c60cf..9629aa4b5 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt @@ -23,19 +23,14 @@ import io.grpc.testing.GrpcServerRule import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.messaginglib.MessagingControllerTest -import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.messaginglib.ProducerConfiguration +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.deleteDir import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput -import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk +import org.onap.ccsdk.cds.controllerblueprints.management.api.* import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.FilterType import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.TestPropertySource import org.springframework.test.context.junit4.SpringRunner @@ -47,9 +42,7 @@ import kotlin.test.assertTrue @RunWith(SpringRunner::class) @EnableAutoConfiguration @DirtiesContext -@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"], - excludeFilters = [ComponentScan.Filter(value = [MessagingConfig::class, MessagingController::class, ProducerConfiguration::class, - MessagingControllerTest.ConsumerConfiguration::class, MessagingControllerTest::class], type = FilterType.ASSIGNABLE_TYPE)]) +@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"]) @TestPropertySource(locations = ["classpath:application-test.properties"]) class BluePrintManagementGRPCHandlerTest { @@ -75,7 +68,7 @@ class BluePrintManagementGRPCHandlerTest { fun `test upload blueprint`() { val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel) val id = "123_upload" - val req = createUploadInputRequest(id) + val req = createUploadInputRequest(id, UploadAction.PUBLISH.toString()) val output = blockingStub.uploadBlueprint(req) assertEquals(200, output.status.code) @@ -87,7 +80,7 @@ class BluePrintManagementGRPCHandlerTest { fun `test delete blueprint`() { val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel) val id = "123_delete" - val req = createUploadInputRequest(id) + val req = createUploadInputRequest(id, UploadAction.DRAFT.toString()) var output = blockingStub.uploadBlueprint(req) assertEquals(200, output.status.code) @@ -99,7 +92,7 @@ class BluePrintManagementGRPCHandlerTest { assertEquals(200, output.status.code) } - private fun createUploadInputRequest(id: String): BluePrintUploadInput { + 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}") @@ -110,11 +103,18 @@ class BluePrintManagementGRPCHandlerTest { .setRequestId(id) .setSubRequestId("1234-56").build() + val actionIdentifier = ActionIdentifiers.newBuilder() + .setActionName(action) + .setBlueprintName("sample") + .setBlueprintVersion("1.0.0") + .build() + val fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(file.inputStream().readBytes())) .build() return BluePrintUploadInput.newBuilder() .setCommonHeader(commonHeader) + .setActionIdentifiers(actionIdentifier) .setFileChunk(fileChunk) .build() } diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt index ce5acd400..8bedc9628 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt @@ -1,6 +1,7 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. * Modifications Copyright © 2019 Bell Canada. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +36,6 @@ import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.FilterType import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.TestPropertySource import org.springframework.test.context.junit4.SpringRunner @@ -44,8 +44,8 @@ import kotlin.test.BeforeTest @RunWith(SpringRunner::class) @DirtiesContext @EnableAutoConfiguration -@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"], - excludeFilters =arrayOf(ComponentScan.Filter(value = [(MessagingController::class)], type = FilterType.ASSIGNABLE_TYPE))) +@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", + "org.onap.ccsdk.cds.controllerblueprints"]) @TestPropertySource(locations = ["classpath:application-test.properties"]) class BluePrintProcessingGRPCHandlerTest { private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandlerTest::class.java) diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt new file mode 100644 index 000000000..7d43f533f --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt @@ -0,0 +1,66 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api + +import io.mockk.coEvery +import io.mockk.mockk +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking +import org.junit.runner.RunWith +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.message.BluePrintMessageLibConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BluePrintMessageLibPropertyService +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.TestPropertySource +import org.springframework.test.context.junit4.SpringRunner +import kotlin.test.Test +import kotlin.test.assertNotNull + +@RunWith(SpringRunner::class) +@ContextConfiguration(classes = [BluePrintMessageLibConfiguration::class, + BlueprintPropertyConfiguration::class, BluePrintProperties::class]) +@TestPropertySource(locations = ["classpath:application-test.properties"]) +class BluePrintProcessingKafkaConsumerTest { + + @Autowired + lateinit var bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService + + @Test + fun testExecutionInputMessageConsumer() { + runBlocking { + assertNotNull(bluePrintMessageLibPropertyService, + "failed to initialise bluePrintMessageLibPropertyService") + + val executionServiceHandle = mockk<ExecutionServiceHandler>() + + coEvery { executionServiceHandle.doProcess(any()) } returns mockk() + + val bluePrintProcessingKafkaConsumer = BluePrintProcessingKafkaConsumer(bluePrintMessageLibPropertyService, + executionServiceHandle) + + launch { + bluePrintProcessingKafkaConsumer.setupMessageListener() + } + delay(100) + bluePrintProcessingKafkaConsumer.shutdownMessageListener() + } + } + +}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt new file mode 100644 index 000000000..fc6c4890c --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt @@ -0,0 +1,100 @@ +/* + * Copyright © 2019 Bell Canada + * Modifications Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api + +import kotlinx.coroutines.reactive.awaitSingle +import kotlinx.coroutines.runBlocking +import org.junit.After +import org.junit.Before +import org.junit.runner.RunWith +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir +import org.slf4j.LoggerFactory +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.autoconfigure.EnableAutoConfiguration +import org.springframework.boot.autoconfigure.security.SecurityProperties +import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest +import org.springframework.context.annotation.ComponentScan +import org.springframework.core.io.ByteArrayResource +import org.springframework.http.client.MultipartBodyBuilder +import org.springframework.test.annotation.DirtiesContext +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.TestPropertySource +import org.springframework.test.context.junit4.SpringRunner +import org.springframework.test.web.reactive.server.WebTestClient +import org.springframework.test.web.reactive.server.returnResult +import org.springframework.web.reactive.function.BodyInserters +import java.io.File +import java.nio.file.Files +import java.nio.file.Paths +import kotlin.test.Test + +@RunWith(SpringRunner::class) +@EnableAutoConfiguration +@ContextConfiguration(classes = [ExecutionServiceControllerTest::class, SecurityProperties::class]) +@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"]) +@TestPropertySource(locations = ["classpath:application-test.properties"]) +@DirtiesContext +@WebFluxTest +class ExecutionServiceControllerTest { + + private val log = LoggerFactory.getLogger(ExecutionServiceControllerTest::class.java)!! + + @Autowired + lateinit var webTestClient: WebTestClient + + var event: ExecutionServiceInput? = null + + @Before + fun setup() { + deleteDir("target", "blueprints") + } + + @After + fun clean() { + deleteDir("target", "blueprints") + } + + @Test + fun uploadBluePrint() { + runBlocking { + val body = MultipartBodyBuilder().apply { + part("file", object : ByteArrayResource(Files.readAllBytes(loadCbaArchive().toPath())) { + override fun getFilename(): String { + return "test-cba.zip" + } + }) + }.build() + + webTestClient + .post() + .uri("/api/v1/execution-service/upload") + .body(BodyInserters.fromMultipartData(body)) + .exchange() + .expectStatus().isOk + .returnResult<String>() + .responseBody + .awaitSingle() + } + } + + private fun loadCbaArchive(): File { + return Paths.get("./src/test/resources/cba-for-kafka-integration_enriched.zip").toFile() + } +} + + diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt index 65b41262b..a480b115b 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt @@ -30,7 +30,6 @@ 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.context.annotation.FilterType import org.springframework.core.io.ByteArrayResource import org.springframework.http.client.MultipartBodyBuilder import org.springframework.test.context.ContextConfiguration @@ -49,14 +48,15 @@ import kotlin.test.assertTrue @RunWith(SpringRunner::class) @WebFluxTest -@ContextConfiguration(classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class, BluePrintCatalogService::class, SecurityProperties::class]) -@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"], - excludeFilters =arrayOf(ComponentScan.Filter(value = [(MessagingController::class)], type = FilterType.ASSIGNABLE_TYPE))) +@ContextConfiguration(classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class, + BluePrintCatalogService::class, SecurityProperties::class]) +@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", + "org.onap.ccsdk.cds.controllerblueprints"]) @TestPropertySource(locations = ["classpath:application-test.properties"]) class ExecutionServiceHandlerTest { @Autowired - lateinit var blueprintCatalog: BluePrintCatalogService + lateinit var blueprintsProcessorCatalogService: BluePrintCatalogService @Autowired lateinit var webTestClient: WebTestClient @@ -98,7 +98,7 @@ class ExecutionServiceHandlerTest { @Test fun `test rest process`() { runBlocking { - blueprintCatalog.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile()) + blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile()) val executionServiceInput = JacksonUtils .readValueFromClassPathFile("execution-input/default-input.json", @@ -116,7 +116,7 @@ class ExecutionServiceHandlerTest { @Test fun `rest resource process should return status code 500 in case of server-side exception`() { runBlocking { - blueprintCatalog.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile()) + blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile()) val executionServiceInput = JacksonUtils .readValueFromClassPathFile("execution-input/faulty-input.json", diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/MessagingControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/MessagingControllerTest.kt deleted file mode 100644 index facbec585..000000000 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/MessagingControllerTest.kt +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright © 2019 Bell Canada - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.messaginglib - -import com.fasterxml.jackson.databind.node.ObjectNode -import kotlinx.coroutines.reactive.awaitSingle -import kotlinx.coroutines.runBlocking -import org.apache.commons.lang.builder.ToStringBuilder -import org.apache.kafka.clients.CommonClientConfigs -import org.apache.kafka.clients.consumer.ConsumerConfig -import org.apache.kafka.common.serialization.StringDeserializer -import org.junit.After -import org.junit.Before -import org.junit.Ignore -import org.junit.Test -import org.junit.runner.RunWith -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ActionIdentifiers -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonHeader -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData -import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.MessagingController -import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.slf4j.LoggerFactory -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.beans.factory.annotation.Value -import org.springframework.boot.autoconfigure.EnableAutoConfiguration -import org.springframework.boot.autoconfigure.security.SecurityProperties -import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration -import org.springframework.core.io.ByteArrayResource -import org.springframework.http.client.MultipartBodyBuilder -import org.springframework.kafka.annotation.EnableKafka -import org.springframework.kafka.annotation.KafkaListener -import org.springframework.kafka.annotation.PartitionOffset -import org.springframework.kafka.annotation.TopicPartition -import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory -import org.springframework.kafka.core.ConsumerFactory -import org.springframework.kafka.core.DefaultKafkaConsumerFactory -import org.springframework.kafka.core.KafkaTemplate -import org.springframework.kafka.support.serializer.JsonDeserializer -import org.springframework.kafka.test.context.EmbeddedKafka -import org.springframework.test.annotation.DirtiesContext -import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.TestPropertySource -import org.springframework.test.context.junit4.SpringRunner -import org.springframework.test.web.reactive.server.WebTestClient -import org.springframework.test.web.reactive.server.returnResult -import org.springframework.web.reactive.function.BodyInserters -import java.io.File -import java.nio.file.Files -import java.nio.file.Paths -import kotlin.test.assertNotNull -//FIXME("testReceive method is failing in server build, It is not stable, may be timing issue.") -@Ignore -@RunWith(SpringRunner::class) -@EnableAutoConfiguration -@ContextConfiguration(classes = [MessagingControllerTest::class, SecurityProperties::class]) -@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"]) -@TestPropertySource(locations = ["classpath:application-test.properties"]) -@DirtiesContext -@EmbeddedKafka(ports = [9092]) -@WebFluxTest -class MessagingControllerTest { - - private val log = LoggerFactory.getLogger(MessagingControllerTest::class.java)!! - - @Autowired - lateinit var controller: MessagingController - - @Value("\${blueprintsprocessor.messageclient.self-service-api.consumerTopic}") - lateinit var topicUsedForConsumer: String - - @Autowired - lateinit var kt: KafkaTemplate<String, ExecutionServiceInput> - - @Autowired - lateinit var webTestClient: WebTestClient - - var event: ExecutionServiceInput? = null - - @Before - fun setup() { - deleteDir("target", "blueprints") - uploadBluePrint() - } - - @After - fun clean() { - deleteDir("target", "blueprints") - } - - @Test - fun testReceive() { - val samplePayload = "{\n" + - " \"resource-assignment-request\": {\n" + - " \"artifact-name\": [\"hostname\"],\n" + - " \"store-result\": true,\n" + - " \"resource-assignment-properties\" : {\n" + - " \"hostname\": \"demo123\"\n" + - " }\n" + - " }\n" + - " }" - - kt.defaultTopic = topicUsedForConsumer - - val input = ExecutionServiceInput().apply { - commonHeader = CommonHeader().apply { - originatorId = "1" - requestId = "1234" - subRequestId = "1234-1234" - } - - actionIdentifiers = ActionIdentifiers().apply { - blueprintName = "golden" - blueprintVersion = "1.0.0" - actionName = "resource-assignment" - mode = "sync" - } - - stepData = StepData().apply { - name = "resource-assignment" - } - - payload = JacksonUtils.jsonNode(samplePayload) as ObjectNode - } - - kt.sendDefault(input) - log.info("test-sender sent message='{}'", ToStringBuilder.reflectionToString(input)) - - Thread.sleep(1000) - - assertNotNull(event) - } - - @KafkaListener(topicPartitions = [TopicPartition(topic = "\${blueprintsprocessor.messageclient.self-service-api.topic}", partitionOffsets = [PartitionOffset(partition = "0", initialOffset = "0")])]) - fun receivedEventFromBluePrintProducer(receivedEvent: ExecutionServiceInput) { - event = receivedEvent - } - - private fun uploadBluePrint() { - runBlocking { - val body = MultipartBodyBuilder().apply { - part("file", object : ByteArrayResource(Files.readAllBytes(loadCbaArchive().toPath())) { - override fun getFilename(): String { - return "test-cba.zip" - } - }) - }.build() - - webTestClient - .post() - .uri("/api/v1/execution-service/upload") - .body(BodyInserters.fromMultipartData(body)) - .exchange() - .expectStatus().isOk - .returnResult<String>() - .responseBody - .awaitSingle() - } - } - - private fun loadCbaArchive():File { - return Paths.get("./src/test/resources/cba-for-kafka-integration_enriched.zip").toFile() - } - - @Configuration - @EnableKafka - open class ConsumerConfiguration { - - @Value("\${blueprintsprocessor.messageclient.self-service-api.bootstrapServers}") - lateinit var bootstrapServers: String - - @Value("\${blueprintsprocessor.messageclient.self-service-api.groupId}") - lateinit var groupId:String - - @Bean - open fun consumerFactory2(): ConsumerFactory<String, ExecutionServiceInput>? { - val configProperties = hashMapOf<String, Any>() - configProperties[CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG] = bootstrapServers - configProperties[ConsumerConfig.GROUP_ID_CONFIG] = groupId - configProperties[ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG] = StringDeserializer::class.java.name - configProperties[ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG] = JsonDeserializer::class.java.name - configProperties[ConsumerConfig.AUTO_OFFSET_RESET_CONFIG] = "earliest" - configProperties[ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG] = 1000 - - return DefaultKafkaConsumerFactory(configProperties, StringDeserializer(), - JsonDeserializer(ExecutionServiceInput::class.java)) - } - - @Bean - open fun listenerFactory(): ConcurrentKafkaListenerContainerFactory<String, ExecutionServiceInput> { - val factory = ConcurrentKafkaListenerContainerFactory<String, ExecutionServiceInput>() - factory.consumerFactory = consumerFactory2() - return factory - } - } -} - - diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/ProducerConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/ProducerConfiguration.kt deleted file mode 100644 index dc1f38a63..000000000 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/ProducerConfiguration.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright © 2019 Bell Canada - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.messaginglib - -import org.apache.kafka.clients.producer.ProducerConfig -import org.apache.kafka.common.serialization.StringSerializer -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.springframework.beans.factory.annotation.Value -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.kafka.annotation.EnableKafka -import org.springframework.kafka.core.DefaultKafkaProducerFactory -import org.springframework.kafka.core.KafkaTemplate -import org.springframework.kafka.core.ProducerFactory -import org.springframework.kafka.support.serializer.JsonSerializer - -@Configuration -open class ProducerConfiguration { - - @Value("\${blueprintsprocessor.messageclient.self-service-api.bootstrapServers}") - lateinit var bootstrapServers: String - - open fun kpf(): ProducerFactory<String, ExecutionServiceInput> { - val configs = HashMap<String, Any>() - configs[ProducerConfig.BOOTSTRAP_SERVERS_CONFIG] = bootstrapServers - configs[ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG] = StringSerializer::class.java - configs[ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG] = JsonSerializer::class.java - return DefaultKafkaProducerFactory(configs) - } - - @Bean - open fun kt(): KafkaTemplate<String, ExecutionServiceInput> { - return KafkaTemplate<String, ExecutionServiceInput>(kpf()) - } -}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties index ab3bac88f..d18b70010 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties @@ -33,10 +33,15 @@ blueprints.processor.functions.python.executor.executionPath=./../../../../compo blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints # Kafka-message-lib Configuration -blueprintsprocessor.messageclient.self-service-api.kafkaEnable=true -blueprintsprocessor.messageclient.self-service-api.topic=producer.t -blueprintsprocessor.messageclient.self-service-api.type=kafka-basic-auth -blueprintsprocessor.messageclient.self-service-api.bootstrapServers=127.0.0.1:9092 -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.messageconsumer.self-service-api.kafkaEnable=false +blueprintsprocessor.messageconsumer.self-service-api.type=kafka-basic-auth +blueprintsprocessor.messageconsumer.self-service-api.bootstrapServers=127.0.0.1:9092 +blueprintsprocessor.messageconsumer.self-service-api.topic=receiver.t +blueprintsprocessor.messageconsumer.self-service-api.groupId=receiver-id +blueprintsprocessor.messageconsumer.self-service-api.clientId=default-client-id +blueprintsprocessor.messageconsumer.self-service-api.pollMillSec=10 + +blueprintsprocessor.messageproducer.self-service-api.type=kafka-basic-auth +blueprintsprocessor.messageproducer.self-service-api.bootstrapServers=127.0.0.1:9092 +blueprintsprocessor.messageproducer.self-service-api.clientId=default-client-id +blueprintsprocessor.messageproducer.self-service-api.topic=producer.t diff --git a/ms/controllerblueprints/application/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback-test.xml index 2252939e7..dd81657a4 100644 --- a/ms/controllerblueprints/application/src/test/resources/logback-test.xml +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback-test.xml @@ -26,7 +26,7 @@ <logger name="org.springframework" level="warn"/> <logger name="org.hibernate" level="info"/> - <logger name="org.onap.ccsdk.cds.controllerblueprints" level="info"/> + <logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/> <root level="warn"> <appender-ref ref="STDOUT"/> diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml deleted file mode 100644 index 0c8d93bf0..000000000 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml +++ /dev/null @@ -1,35 +0,0 @@ -<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.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 8d3b18059..e79c497be 100755 --- a/ms/blueprintsprocessor/parent/pom.xml +++ b/ms/blueprintsprocessor/parent/pom.xml @@ -460,24 +460,9 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>blueprint-scripts</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>db-resources</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> <artifactId>blueprint-validation</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>service</artifactId> - <version>${project.version}</version> - </dependency> <!-- Database --> <dependency> diff --git a/ms/command-executor/pom.xml b/ms/command-executor/pom.xml index 5a73fa0af..e99c4ecb2 100755 --- a/ms/command-executor/pom.xml +++ b/ms/command-executor/pom.xml @@ -14,7 +14,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.cds</groupId> @@ -34,7 +35,7 @@ <docker.verbose>true</docker.verbose> <ccsdk.project.version>${project.version}</ccsdk.project.version> <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp> - <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> + <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> </properties> <build> diff --git a/ms/command-executor/src/main/python/command_executor_handler.py b/ms/command-executor/src/main/python/command_executor_handler.py index 972dad627..abea4d411 100644 --- a/ms/command-executor/src/main/python/command_executor_handler.py +++ b/ms/command-executor/src/main/python/command_executor_handler.py @@ -35,6 +35,7 @@ class CommandExecutorHandler(): self.request = request self.logger = logging.getLogger(self.__class__.__name__) self.blueprint_id = utils.get_blueprint_id(request) + # FIXME parameterize path self.venv_home = '/opt/app/onap/blueprints/deploy/' + self.blueprint_id self.installed = self.venv_home + '/.installed' @@ -60,7 +61,6 @@ class CommandExecutorHandler(): results.append(f.read()) f.close() - # deactivate_venv(blueprint_id) return True def execute_command(self, request, results): @@ -73,6 +73,7 @@ class CommandExecutorHandler(): if "ansible-playbook" in request.command: cmd = cmd + "; " + request.command + " -e 'ansible_python_interpreter=" + self.venv_home + "/bin/python'" else: + # we append the properties as last agr to the script cmd = cmd + "; " + request.command + " " + re.escape(MessageToJson(request.properties)) try: @@ -170,8 +171,8 @@ class CommandExecutorHandler(): path = "%s/bin/activate_this.py" % self.venv_home try: - exec (open(path).read(), {'__file__': path}) - exec (fixpathenvvar) + exec(open(path).read(), {'__file__': path}) + exec(fixpathenvvar) self.logger.info("Running with PATH : {}".format(os.environ['PATH'])) return True except Exception as err: diff --git a/ms/command-executor/src/main/python/server.py b/ms/command-executor/src/main/python/server.py index 453d751b2..0ed3d3266 100644 --- a/ms/command-executor/src/main/python/server.py +++ b/ms/command-executor/src/main/python/server.py @@ -1,5 +1,4 @@ - -#!/usr/bin/python +# !/usr/bin/python # # Copyright (C) 2019 Bell Canada. @@ -43,7 +42,7 @@ def serve(): 'Access denied!') server = grpc.server( - futures.ThreadPoolExecutor(max_workers=10), + futures.ProcessPoolExecutor(), interceptors=(header_validator,)) CommandExecutor_pb2_grpc.add_CommandExecutorServiceServicer_to_server( diff --git a/ms/command-executor/src/main/python/utils.py b/ms/command-executor/src/main/python/utils.py index dc5d0089f..4314b287d 100644 --- a/ms/command-executor/src/main/python/utils.py +++ b/ms/command-executor/src/main/python/utils.py @@ -17,6 +17,7 @@ from google.protobuf.timestamp_pb2 import Timestamp import proto.CommandExecutor_pb2 as CommandExecutor_pb2 + def get_blueprint_id(request): blueprint_name = request.identifiers.blueprintName blueprint_version = request.identifiers.blueprintVersion diff --git a/ms/controllerblueprints/application/pom.xml b/ms/controllerblueprints/application/pom.xml deleted file mode 100644 index 566ed38d3..000000000 --- a/ms/controllerblueprints/application/pom.xml +++ /dev/null @@ -1,266 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright © 2017-2018 AT&T Intellectual Property. - ~ - ~ Modifications Copyright © 2018 IBM. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>parent</artifactId> - <version>0.6.1-SNAPSHOT</version> - <relativePath>../parent</relativePath> - </parent> - <artifactId>application</artifactId> - <name>Controller Blueprints Application</name> - <properties> - <swagger.directory>${basedir}/target/src/main/resources/swagger-ui</swagger.directory> - <java.version>1.8</java.version> - <name.space>org.onap.ccsdk.cds</name.space> <!-- <name.space>${namespace}</name.space> --> - <serviceArtifactName>controllerblueprints</serviceArtifactName> - <!-- Sonar --> - <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> - <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> - <sonar.surefire.reportsPath>${basedir}/target/surefire-reports</sonar.surefire.reportsPath> - <sonar.failsafe.reportsPath>${basedir}/target/failsafe-reports</sonar.failsafe.reportsPath> - <jacoco.path>${basedir}/target/jacoco_report</jacoco.path> - <jacoco.itPath>${basedir}/target/jacoco_itReport</jacoco.itPath> - <sonar.jacoco.reportPath>${basedir}/target/jacoco-ut.exec</sonar.jacoco.reportPath> - <sonar.jacoco.itReportPath>${basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath> - <sonar.language>java</sonar.language> - <ilib.version>2.0.7</ilib.version> - </properties> - - <dependencies> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>service</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-security</artifactId> - <exclusions> - <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - <exclusions> - <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito2</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-test-junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.projectreactor</groupId> - <artifactId>reactor-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - <build> - <resources> - <resource> - <!--config and resource files --> - <directory>${basedir}/etc</directory> - <targetPath>${basedir}/target/etc</targetPath> - <filtering>true</filtering> - <includes> - <include>**/*</include> - </includes> - </resource> - <resource> - <!--config and resource files --> - <directory>${basedir}/src/main/resources</directory> - <targetPath>${basedir}/target/src/main/resources</targetPath> - <filtering>true</filtering> - <includes> - <include>**/*</include> - </includes> - </resource> - <resource> - <directory>src/main/resources</directory> - <includes> - <include>**/*</include> - </includes> - <filtering>true</filtering> - </resource> - </resources> - <plugins> - <plugin> - <artifactId>maven-resources-plugin</artifactId> - <version>2.6</version> - <executions> - <execution> - <id>copy-dockerfile</id> - <goals> - <goal>copy-resources</goal> - </goals><!-- here the phase you need --> - <phase>validate</phase> - <configuration> - <outputDirectory>${basedir}/target/docker-stage</outputDirectory> - <resources> - <resource> - <directory>src/main/docker</directory> - <includes> - <include>*</include> - </includes> - <filtering>true</filtering> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>0.7.5.201505241946</version> - <executions> - <!-- Prepares the property pointing to the JaCoCo runtime agent which - is passed as VM argument when Maven the Surefire plugin is executed. --> - <execution> - <id>pre-unit-test</id> - <goals> - <goal>prepare-agent</goal> - </goals> - <configuration> - <!-- Sets the path to the file which contains the execution data. --> - <destFile>${sonar.jacoco.reportPath}</destFile> - <propertyName>surefireArgLine</propertyName> - </configuration> - </execution> - <!-- Ensures that the code coverage report for unit tests is created - after unit tests have been run. --> - <execution> - <id>post-unit-test</id> - <phase>test</phase> - <goals> - <goal>report</goal> - </goals> - <configuration> - <!-- Sets the path to the file which contains the execution data. --> - <dataFile>${sonar.jacoco.reportPath}</dataFile> - <!-- Sets the output directory for the code coverage report. --> - <outputDirectory>${jacoco.path}</outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <id>ant-test</id> - <phase>package</phase> - <configuration> - <tasks> - <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.1</version> - <configuration> - <!-- <skip>${skip.compile}</skip>--> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>com.github.kongchen</groupId> - <artifactId>swagger-maven-plugin</artifactId> - <version>3.1.7</version> - <configuration> - <apiSources> - <apiSource> - <springmvc>true</springmvc> - <locations>org.onap.ccsdk.cds.controllerblueprints.service.rs - </locations> - <schemes> - <scheme>http</scheme> - <scheme>https</scheme> - </schemes> - <basePath>/api/v1</basePath> - <info> - <title>Controller Blueprints</title> - <version>${project.version}</version> - <description> - Controller blueprints API for VNF Self Service. - </description> - <termsOfService> - Terms of service - </termsOfService> - <contact> - <email>brindasanth@gmail.com</email> - <name>Brinda Santh</name> - <url>http://onap.com</url> - </contact> - <license> - <url>http://www.apache.org/licenses/LICENSE-2.0.html</url> - <name>Apache 2.0</name> - </license> - </info> - <swaggerDirectory>${swagger.directory}</swaggerDirectory> - </apiSource> - </apiSources> - </configuration> - <executions> - <execution> - <phase>compile</phase> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - - -</project> diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/ApplicationConstants.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/ApplicationConstants.java deleted file mode 100644 index 9a9fafffc..000000000 --- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/ApplicationConstants.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints; - -/** - * ApplicationConstants.java Purpose: Provide ControllerBlueprintsApplication Constant Information - * - * @author Brinda Santh - * @version 1.0 - */ -@SuppressWarnings("unused") -public final class ApplicationConstants { - -} diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/ControllerBlueprintsApplication.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/ControllerBlueprintsApplication.java deleted file mode 100644 index df979c6b3..000000000 --- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/ControllerBlueprintsApplication.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.web.reactive.config.EnableWebFlux; - -/** - * @author Brinda Santh - */ -@SpringBootApplication -@EnableWebFlux -@ComponentScan(basePackages = {"org.onap.ccsdk.cds.controllerblueprints"}) -@EnableAutoConfiguration -public class ControllerBlueprintsApplication { - private static Logger log = LoggerFactory.getLogger(ControllerBlueprintsApplication.class); - - public static void main(String[] args) { - log.info("****** Starting Controlled Blueprints Application ******"); - SpringApplication.run(ControllerBlueprintsApplication.class, args); - } - -}
\ No newline at end of file diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/DatabaseConfig.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/DatabaseConfig.java deleted file mode 100644 index 8ec4bd4a3..000000000 --- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/DatabaseConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints; - -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.jpa.repository.config.EnableJpaAuditing; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import javax.sql.DataSource; - -/** - * DatabaseConfig.java Purpose: Provide Configuration Generator DatabaseConfig Information - * - * @author Brinda Santh - * @version 1.0 - */ -@Configuration -@EntityScan("org.onap.ccsdk.cds.controllerblueprints.service.domain") -@EnableTransactionManagement -@EnableJpaRepositories("org.onap.ccsdk.cds.controllerblueprints.service.repository") -@EnableJpaAuditing -public class DatabaseConfig { - /** - * This is a entityManagerFactory method - * - * @param dataSource - * @return LocalContainerEntityManagerFactoryBean - */ - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) { - HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - vendorAdapter.setGenerateDdl(true); - vendorAdapter.setShowSql(false); - LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); - factory.setJpaVendorAdapter(vendorAdapter); - factory.setPackagesToScan("org.onap.ccsdk.cds.controllerblueprints.service.domain"); - factory.setDataSource(dataSource); - return factory; - } - -} diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/WebConfig.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/WebConfig.java deleted file mode 100644 index e4799bc84..000000000 --- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/WebConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints; - -import org.springframework.context.annotation.Configuration; -import org.springframework.web.reactive.config.CorsRegistry; -import org.springframework.web.reactive.config.ResourceHandlerRegistry; -import org.springframework.web.reactive.config.WebFluxConfigurationSupport; - -/** - * WebConfig - * - * @author Brinda Santh 8/13/2018 - */ -@Configuration -@SuppressWarnings("unused") -public class WebConfig extends WebFluxConfigurationSupport { - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("swagger-ui.html") - .addResourceLocations("classpath:/META-INF/resources/"); - - registry.addResourceHandler("/webjars/**") - .addResourceLocations("classpath:/META-INF/resources/webjars/"); - - } - - @Override - public void addCorsMappings(CorsRegistry corsRegistry) { - corsRegistry.addMapping("/**") - .allowedOrigins("*") - .allowedMethods("*") - .allowedHeaders("DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range") - .maxAge(3600); - } -} diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java deleted file mode 100644 index d992dd945..000000000 --- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/security/ApplicationSecurityConfigurerAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.security; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; -import org.springframework.security.config.web.server.ServerHttpSecurity; -import org.springframework.security.core.userdetails.MapReactiveUserDetailsService; -import org.springframework.security.core.userdetails.User; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.web.server.SecurityWebFilterChain; - -@SuppressWarnings("unused") -@EnableWebFluxSecurity -public class ApplicationSecurityConfigurerAdapter { - - @Value("${basic-auth.user-name}") - private String userName; - - @Value("${basic-auth.hashed-pwd}") - private String userHashedPassword; - - private static Logger log = LoggerFactory.getLogger(ApplicationSecurityConfigurerAdapter.class); - - @Bean - public SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) throws Exception { - - http.csrf().disable(); - http.authorizeExchange() - .pathMatchers("/webjars/**", "/actuator/**").permitAll() - .anyExchange().authenticated() - .and().httpBasic(); - - return http.build(); - } - - @Bean - public MapReactiveUserDetailsService userDetailsService() { - User.UserBuilder userBuilder = User.builder(); - UserDetails defaultUser = userBuilder - .username(userName) - .password(userHashedPassword).roles("USER").build(); - return new MapReactiveUserDetailsService(defaultUser); - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/application/src/main/resources/application-dev.properties b/ms/controllerblueprints/application/src/main/resources/application-dev.properties deleted file mode 100755 index 1ee8e3f54..000000000 --- a/ms/controllerblueprints/application/src/main/resources/application-dev.properties +++ /dev/null @@ -1,70 +0,0 @@ -# -# Copyright © 2017-2018 AT&T Intellectual Property. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -appName=ControllerBluePrints -ms_name=org.onap.ccsdk.cds.controllerblueprints -appVersion=1.0.0 - -# Basic Authentication -basic-auth.user-name=ccsdkapps -basic-auth.hashed-pwd={bcrypt}$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y - -#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex - -logging.level.org.springframework.web=INFO -logging.level.org.hibernate.SQL=warn -logging.level.org.hibernate.type.descriptor.sql=debug - -#To Remove Null in JSON API Response -spring.jackson.default-property-inclusion=non_null - -#Swagger Configuration -swagger.contact.name=Brinda Santh Muthuramalingam -swagger.contact.url=www.onap.com -swagger.contact.email=brindasanth@onap.com - -spring.jpa.properties.hibernate.show_sql=true -spring.jpa.properties.hibernate.use_sql_comments=true -spring.jpa.properties.hibernate.format_sql=true - -# spring.datasource.url, spring.datasource.username,spring.datasource.password may be overridden by ENV variables -spring.datasource.url=jdbc:mysql://localhost:3306/sdnctl -spring.datasource.username=sdnctl -spring.datasource.password=sdnctl -spring.datasource.driver-class-name=org.mariadb.jdbc.Driver -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=none -spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect -# Load Resource Source Mappings -resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability -# Controller Blueprints Core Configuration -controllerblueprints.blueprintDeployPath=blueprints/deploy -controllerblueprints.blueprintArchivePath=blueprints/archive -controllerblueprints.blueprintWorkingPath=blueprints/work -# Controller Blueprint Load Configurations -controllerblueprints.loadInitialData=true -controllerblueprints.loadBluePrint=false -controllerblueprints.loadBluePrintPaths=./../../../components/model-catalog/blueprint-model/test-blueprint -controllerblueprints.loadModelType=true -controllerblueprints.loadModeTypePaths=./../../../components/model-catalog/definition-type/starter-type -controllerblueprints.loadResourceDictionary=true -controllerblueprints.loadResourceDictionaryPaths=./../../../components/model-catalog/resource-dictionary/starter-dictionary - -# CBA file extension -controllerblueprints.loadCbaExtension=zip - -# Web server config -server.port=8082 diff --git a/ms/controllerblueprints/application/src/main/resources/application.properties b/ms/controllerblueprints/application/src/main/resources/application.properties deleted file mode 100755 index 0ccec68bb..000000000 --- a/ms/controllerblueprints/application/src/main/resources/application.properties +++ /dev/null @@ -1,75 +0,0 @@ -# -# Copyright © 2017-2018 AT&T Intellectual Property. -# Modifications Copyright © 2018 IBM. -# Modifications Copyright © 2019 Bell Canada. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -appName=ControllerBluePrints -ms_name=org.onap.ccsdk.cds.controllerblueprints -appVersion=1.0.0 - -# Basic Authentication -basic-auth.user-name=ccsdkapps -basic-auth.hashed-pwd={bcrypt}$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y - -#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex - -logging.level.org.springframework.web=INFO -logging.level.org.hibernate.SQL=warn -logging.level.org.hibernate.type.descriptor.sql=debug - -#To Remove Null in JSON API Response -spring.jackson.default-property-inclusion=non_null - -#Swagger Configuration -swagger.contact.name=CCSDK team -swagger.contact.url=www.onap.org -swagger.contact.email=onap-discuss@lists.onap.org - -spring.jpa.properties.hibernate.show_sql=true -spring.jpa.properties.hibernate.use_sql_comments=true -spring.jpa.properties.hibernate.format_sql=true - -# spring.datasource.url, spring.datasource.username,spring.datasource.password may be overridden by ENV variables -spring.datasource.url=jdbc:mysql://db:3306/sdnctl -spring.datasource.username=sdnctl -spring.datasource.password=sdnctl -spring.datasource.driver-class-name=org.mariadb.jdbc.Driver -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=none -spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect - -# Load Resource Source Mappings -resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability - -# Controller Blueprints Core Configuration -controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy -controllerblueprints.blueprintArchivePath=/etc/blueprints/archive -controllerblueprints.blueprintWorkingPath=/etc/blueprints/work -# Controller Blueprint Load Configurations -# blueprints.load.initial-data may be overridden by ENV variables -controllerblueprints.loadInitialData=true -controllerblueprints.loadBluePrint=true -controllerblueprints.loadBluePrintPaths=/opt/app/onap//model-catalog/blueprint-model/service-blueprint -controllerblueprints.loadModelType=true -controllerblueprints.loadModeTypePaths=/opt/app/onap//model-catalog/definition-type/starter-type -controllerblueprints.loadResourceDictionary=true -controllerblueprints.loadResourceDictionaryPaths=/opt/app/onap//model-catalog/resource-dictionary/starter-dictionary - -# CBA file extension -controllerblueprints.loadCbaExtension=zip - -# Web server config -server.port=8080 diff --git a/ms/controllerblueprints/application/src/main/resources/logback.xml b/ms/controllerblueprints/application/src/main/resources/logback.xml deleted file mode 100644 index 2af5a92cc..000000000 --- a/ms/controllerblueprints/application/src/main/resources/logback.xml +++ /dev/null @@ -1,44 +0,0 @@ -<!-- - ~ Copyright © 2017-2018 AT&T Intellectual Property. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<configuration> - - <property name="localPattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{100} - %msg%n" /> - - <property name="defaultPattern" value="%date{ISO8601,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}| %msg%n" /> - - <property name="debugLoggerPattern" value="%date{ISO8601,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}|[%caller{3}]| %msg%n" /> - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <!-- encoders are assigned the type - ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> - <encoder> - <pattern>${defaultPattern}</pattern> - </encoder> - </appender> - - - <logger name="org.springframework" level="info"/> - <logger name="org.springframework.web" level="info"/> - <logger name="org.springframework.security.web.authentication" level="warn"/> - <logger name="org.hibernate" level="error"/> - <logger name="org.onap.ccsdk.cds" level="info"/> - - <root level="warn"> - <appender-ref ref="STDOUT"/> - </root> - -</configuration> diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java deleted file mode 100644 index 0b9df88b8..000000000 --- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.cds.controllerblueprints;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.client.support.BasicAuthorizationInterceptor;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class ControllerBlueprintsApplicationTest {
- @Autowired
- private TestRestTemplate restTemplate;
-
- @Before
- public void setUp(){
- BasicAuthorizationInterceptor bai = new BasicAuthorizationInterceptor("ccsdkapps", "ccsdkapps");
- this.restTemplate.getRestTemplate().getInterceptors().add(bai);
- }
-
- @Test
- public void testConfigModel() {
- HttpHeaders headers = new HttpHeaders();
- headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
-// ResponseEntity<BlueprintModel> entity = this.restTemplate
-// .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),BlueprintModel.class);
-// assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
-// Assert.assertNotNull("failed to get response Config model",entity.getBody());
- }
-
- @Test
- public void testConfigModelFailure() {
- HttpHeaders headers = new HttpHeaders();
- headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
-// ResponseEntity<BlueprintModel> entity = this.restTemplate
-// .exchange("/api/v1/config-model-not-found/1", HttpMethod.GET, new HttpEntity<>(headers),BlueprintModel.class);
-// assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
-// Assert.assertNotNull("failed to get response Config model",entity.getBody());
- }
-}
diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java deleted file mode 100644 index 9688b26b1..000000000 --- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.cds.controllerblueprints;
-
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-
-/**
- * VersionSplitTest
- *
- * @author Brinda Santh
- */
-public class VersionSplitTest {
- private static Logger log = LoggerFactory.getLogger(VersionSplitTest.class); -
- @Test
- public void testVersionSplit() {
- String version = "1.03.04";
- String[] tokens = StringUtils.split(version, '.');
- Assert.assertNotNull("failed to tokenize", tokens);
- Assert.assertEquals("failed to three token ", 3, tokens.length);
- }
-
- @Test
- public void encodeTest() {
- String name = "ccsdkapps";
- BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
- String encodedValue = bCryptPasswordEncoder.encode(name);
- Assert.assertTrue("Failed to match", bCryptPasswordEncoder.matches(name, encodedValue));
- }
-}
\ No newline at end of file diff --git a/ms/controllerblueprints/application/src/test/resources/application.properties b/ms/controllerblueprints/application/src/test/resources/application.properties deleted file mode 100755 index 0ccd1cf92..000000000 --- a/ms/controllerblueprints/application/src/test/resources/application.properties +++ /dev/null @@ -1,58 +0,0 @@ -#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-# Modifications Copyright © 2018 IBM.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-spring.main.banner-mode=off
-
-appName=ControllerBluePrints
-ms_name=org.onap.ccsdk.cds.controllerblueprints
-appVersion=1.0.0
-
-# Basic Authentication
-basic-auth.user-name=ccsdkapps
-basic-auth.hashed-pwd={bcrypt}$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y
-
-#To Remove Null in JSON API Response
-spring.jackson.default-property-inclusion=non_null
-
-#Swagger Configuration
-swagger.contact.name=Brinda Santh Muthuramalingam
-swagger.contact.url=www.onap.com
-swagger.contact.email=brindasanth@onap.com
-
-# Load Resource Source Mappings
-resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability
-
-# Controller Blueprints Core Configuration
-controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
-controllerblueprints.blueprintArchivePath=./target/blueprints/archive
-controllerblueprints.blueprintEnrichmentPath=./target/blueprints/enrichment
-# Controller Blueprint Load Configurations
-controllerblueprints.loadInitialData=false
-controllerblueprints.loadBluePrint=false
-controllerblueprints.loadBluePrintPaths=./../../../../components/model-catalog/blueprint-model/test-blueprint
-controllerblueprints.loadModelType=false
-controllerblueprints.loadModeTypePaths=./../../../../components/model-catalog/definition-type/starter-type
-controllerblueprints.loadResourceDictionary=false
-controllerblueprints.loadResourceDictionaryPaths=./../../../../components/model-catalog/resource-dictionary/starter-dictionary
-
-# CBA file extension
-controllerblueprints.loadCbaExtension=zip
-
-# CBA examples for tests cases
-controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint
-
-# Web server config
-server.port=8080
diff --git a/ms/controllerblueprints/distribution/pom.xml b/ms/controllerblueprints/distribution/pom.xml deleted file mode 100755 index f0473aab2..000000000 --- a/ms/controllerblueprints/distribution/pom.xml +++ /dev/null @@ -1,184 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright © 2017-2018 AT&T Intellectual Property. - ~ Modifications Copyright © 2019 Bell Canada. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>parent</artifactId> - <version>0.6.1-SNAPSHOT</version> - <relativePath>../parent</relativePath> - </parent> - <artifactId>distribution</artifactId> - <packaging>pom</packaging> - <name>Controller Blueprints Distribution</name> - <properties> - <assembly.id>maven</assembly.id> - <name.space>org.onap.ccsdk.cds</name.space> <!-- <name.space>${namespace}</name.space> --> - <serviceArtifactName>controllerblueprints</serviceArtifactName> - <image.name>onap/ccsdk-controllerblueprints</image.name> - <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy> - <docker.push.phase>deploy</docker.push.phase> - <docker.verbose>true</docker.verbose> - <ccsdk.project.version>${project.version}</ccsdk.project.version> - <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp> - </properties> - - <dependencies> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>application</artifactId> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <artifactId>maven-resources-plugin</artifactId> - <version>2.6</version> - <executions> - <execution> - <id>copy-dockerfile</id> - <goals> - <goal>copy-resources</goal> - </goals><!-- here the phase you need --> - <phase>validate</phase> - <configuration> - <outputDirectory>${basedir}/target/docker-stage</outputDirectory> - <resources> - <resource> - <directory>src/main/docker</directory> - <includes> - <include>*</include> - </includes> - <filtering>true</filtering> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <id>ant-test</id> - <phase>package</phase> - <configuration> - <tasks> - <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <!--build the final artifact for docker deployment --> - <artifactId>maven-assembly-plugin</artifactId> - <version>3.1.0</version> - <configuration> - <!-- <skipAssembly>${skip.assembly}</skipAssembly>--> - <outputDirectory>${basedir}/target/docker-stage</outputDirectory> - <descriptors> - <descriptor>src/main/docker/distribution.xml</descriptor> - </descriptors> - <tarLongFileMode>posix</tarLongFileMode> - </configuration> - <executions> - <execution> - <id>${assembly.id}</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.groovy.maven</groupId> - <artifactId>gmaven-plugin</artifactId> - <version>1.0</version> - <executions> - <execution> - <phase>validate</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <source>${basedir}/../../../TagVersion.groovy</source> - </configuration> - </execution> - </executions> - </plugin> - - </plugins> - </build> - - <profiles> - <profile> - <id>docker</id> - <build> - <plugins> - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> - <version>0.26.1</version> - <inherited>false</inherited> - <configuration> - <images> - <image> - <name>${image.name}</name> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir> - <tags> - <tag>${project.docker.latestminortag.version}</tag> - <tag>${project.docker.latestfulltag.version}</tag> - <tag>${project.docker.latesttagtimestamp.version}</tag> - </tags> - </build> - </image> - </images> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <id>generate-images</id> - <phase>package</phase> - <goals> - <goal>build</goal> - </goals> - </execution> - <execution> - <id>push-images</id> - <phase>${docker.push.phase}</phase> - <goals> - <goal>build</goal> - <goal>push</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - </profiles> -</project> diff --git a/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml b/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml deleted file mode 100755 index 450a35415..000000000 --- a/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml +++ /dev/null @@ -1,30 +0,0 @@ -version: '3.3'
-
-services:
- db:
- image: mariadb:latest
- container_name: ccsdk-mariadb
- ports:
- - "3306:3306"
- volumes:
- - ~/vm_mysql:/var/lib/mysql
- restart: always
- environment:
- MYSQL_ROOT_PASSWORD: sdnctl
- MYSQL_DATABASE: sdnctl
- MYSQL_USER: sdnctl
- MYSQL_PASSWORD: sdnctl
- controller-blueprints:
- depends_on:
- - db
- image: onap/ccsdk-controllerblueprints:latest
- container_name: cb-rest
- ports:
- - "8080:8080"
- restart: always
- environment:
- APPLICATIONNAME: ControllerBluePrints
- BUNDLEVERSION: 1.0.0
- APP_CONFIG_HOME: /opt/app/onap/config
- STICKYSELECTORKEY:
- ENVCONTEXT: dev
\ No newline at end of file diff --git a/ms/controllerblueprints/distribution/src/main/docker/Dockerfile b/ms/controllerblueprints/distribution/src/main/docker/Dockerfile deleted file mode 100755 index d3e10b76d..000000000 --- a/ms/controllerblueprints/distribution/src/main/docker/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM anapsix/alpine-java:8_jdk - -ENV HTTP_PROXY ${HTTP_PROXY} -ENV HTTPS_PROXY ${HTTPS_PROXY} - -# add entrypoint -COPY run.source /etc/run.source -COPY startService.sh /startService.sh -RUN chmod 777 /startService.sh && dos2unix /startService.sh - -# add application -COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz -RUN tar -xzf /source.tar.gz -C /tmp \ - && cp -rf /tmp/@project.build.finalName@/opt / \ - && rm -rf /source.tar.gz \ - && rm -rf /tmp/@project.build.finalName@ - -ENTRYPOINT /startService.sh
\ No newline at end of file diff --git a/ms/controllerblueprints/distribution/src/main/docker/distribution.xml b/ms/controllerblueprints/distribution/src/main/docker/distribution.xml deleted file mode 100755 index 74dc4400c..000000000 --- a/ms/controllerblueprints/distribution/src/main/docker/distribution.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright © 2017-2018 AT&T Intellectual Property. - ~ Modifications Copyright © 2019 Bell Canada. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> - <!-- create a tar.gz file containing the projects dependencies --> - <id>${assembly.id}</id> - <formats> - <format>tar.gz</format> - </formats> - <dependencySets> - <dependencySet> - <outputDirectory>/opt/app/onap/lib</outputDirectory> - </dependencySet> - </dependencySets> - <fileSets> - <fileSet> - <directory>${project.basedir}/../application/src/main/resources</directory> - <includes> - <include>application.properties</include> - <include>logback.xml</include> - </includes> - <outputDirectory>/opt/app/onap/config</outputDirectory> - <useDefaultExcludes>true</useDefaultExcludes> - </fileSet> - <fileSet> - <directory>${project.basedir}/../../../components/model-catalog</directory> - <outputDirectory>/opt/app/onap/model-catalog</outputDirectory> - <useDefaultExcludes>true</useDefaultExcludes> - <excludes> - <exclude>${project.basedir}/../../../components/model-catalog/proto-definition</exclude> - </excludes> - </fileSet> - </fileSets> -</assembly> diff --git a/ms/controllerblueprints/distribution/src/main/docker/run.source b/ms/controllerblueprints/distribution/src/main/docker/run.source deleted file mode 100755 index cc2c72983..000000000 --- a/ms/controllerblueprints/distribution/src/main/docker/run.source +++ /dev/null @@ -1,13 +0,0 @@ -java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sources:${APP_CONFIG_HOME}:${APP_HOME}" \ --DappName=${APPLICATIONNAME} -DappVersion=${BUNDLEVERSION} \ --DrouteOffer=${ROUTEOFFER} \ --DVERSION_ROUTEOFFER_ENVCONTEXT=${BUNDLEVERSION}/${STICKYSELECTORKEY}/${ENVCONTEXT} \ --DSecurityFilePath=/etc \ --DREST_NAME_NORMALIZER_PATTERN_FILE=/etc/PatternInputs.txt \ --Dms_name=org.onap.ccsdk.cds.controllerblueprints \ --Dlogging.config=${APP_CONFIG_HOME}/logback.xml \ --Djava.security.egd=file:/dev/./urandom \ --DAPPNAME=${APP_NAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \ --Dspring.config.location=${APP_CONFIG_HOME}/ \ --Dblueprints.load.initial-data=${INIT_DATA_LOAD} \ -org.onap.ccsdk.cds.controllerblueprints.ControllerBlueprintsApplication diff --git a/ms/controllerblueprints/distribution/src/main/docker/startService.sh b/ms/controllerblueprints/distribution/src/main/docker/startService.sh deleted file mode 100755 index 7077c2246..000000000 --- a/ms/controllerblueprints/distribution/src/main/docker/startService.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -nodeName=ControllerBlueprints_1.0.0_$(cat /proc/self/cgroup | grep docker | sed s/\\//\\n/g | tail -1) - -echo "APP Config HOME : ${APP_CONFIG_HOME}" -export APP_HOME=/opt/app/onap - -source /etc/run.source diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-bpmn-camunda.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-bpmn-camunda.json deleted file mode 100644 index cae06c18f..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-bpmn-camunda.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "description": " Camunda BPM File", - "version": "1.0.0", - "file_ext": [ - "bpmn" - ], - "derived_from": "tosca.artifacts.Implementation" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-directed-graph.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-directed-graph.json deleted file mode 100644 index 10bf7d2c4..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-directed-graph.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "description": "Directed Graph File", - "version": "1.0.0", - "file_ext": [ - "json", - "xml" - ], - "derived_from": "tosca.artifacts.Implementation" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-mapping-resource.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-mapping-resource.json deleted file mode 100644 index f50562890..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-mapping-resource.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "description": " Velocity and jinja Templates Resource Mapping File used along with Configuration template", - "version": "1.0.0", - "file_ext": [ - "json" - ], - "derived_from": "tosca.artifacts.Implementation" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-script-python.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-script-python.json deleted file mode 100644 index 22af3b0a9..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-script-python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "description": " Kotlin Script Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "py" - ], - "derived_from": "tosca.artifacts.Implementation" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-template-jinja.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-template-jinja.json deleted file mode 100644 index e32da5ef0..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-template-jinja.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "description": "Jinja Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "jinja" - ], - "derived_from": "tosca.artifacts.Implementation" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-template-velocity.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-template-velocity.json deleted file mode 100644 index 20f94c946..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/artifact-template-velocity.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "description": " Velocity Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "vtl" - ], - "derived_from": "tosca.artifacts.Implementation" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/tosca.artifacts.Implementation.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/tosca.artifacts.Implementation.json deleted file mode 100644 index d75f33760..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/artifact_type/tosca.artifacts.Implementation.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "description": "TOSCA base type for implementation artifacts", - "version": "1.0.0", - "derived_from": "tosca.artifacts.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-resource-assignment.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-resource-assignment.json deleted file mode 100644 index 8fa595a15..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/datatype-resource-assignment.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "version": "1.0.0", - "description": "This is Resource Assignment Data Type", - "properties": { - "property": { - "required": true, - "type": "datatype-property" - }, - "input-param": { - "required": true, - "type": "boolean" - }, - "dictionary-name": { - "required": false, - "type": "string" - }, - "dictionary-source": { - "required": false, - "type": "string" - }, - "dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - }, - "status": { - "required": false, - "type": "string" - }, - "message": { - "required": false, - "type": "string" - }, - "updated-date": { - "required": false, - "type": "string" - }, - "updated-by": { - "required": false, - "type": "string" - } - }, - "derived_from": "tosca.datatypes.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-license-key.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-license-key.json deleted file mode 100644 index 27e25fe17..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-license-key.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1.0.0", - "description": "This is dt-plicense-key Data Type", - "properties": { - "license-key": { - "required": true, - "type": "string" - } - }, - "derived_from": "tosca.datatypes.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-v4-aggregate.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-v4-aggregate.json deleted file mode 100644 index 4f7be2dba..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/dt-v4-aggregate.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "version": "1.0.0", - "description": "This is dt-v4-aggregate Data Type", - "properties": { - "ipv4-address": { - "required": true, - "type": "string" - }, - "ipv4-plen": { - "required": false, - "type": "integer" - } - }, - "derived_from": "tosca.datatypes.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/tosca.datatypes.Credential.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/tosca.datatypes.Credential.json deleted file mode 100644 index 68d91652f..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/data_type/tosca.datatypes.Credential.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "1.0.0", - "description": "Credential", - "properties": { - "protocol": { - "required": false, - "type": "string" - }, - "token_type": { - "required": true, - "type": "string", - "default" : "password" - }, - "token": { - "required": false, - "type": "string" - }, - "keys": { - "required": false, - "type": "list", - "entry_schema": { - "type": "string" - } - }, - "user": { - "required": false, - "type": "string" - } - }, - "derived_from": "tosca.datatypes.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/artifact-config-template.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/artifact-config-template.json deleted file mode 100644 index 142066121..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/artifact-config-template.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "description": "This is Configuration Velocity and Jinja Template", - "version": "1.0.0", - "properties": { - "action-names": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "capabilities": { - "content": { - "type": "tosca.capabilities.Content", - "properties": { - "content": { - "required": true, - "type": "string" - } - } - }, - "mapping": { - "type": "tosca.capabilities.Mapping", - "properties": { - "mapping": { - "required": false, - "type": "list", - "entry_schema": { - "type": "datatype-resource-assignment" - } - } - } - } - }, - "derived_from": "tosca.nodes.Artifact" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-config-generator.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-config-generator.json deleted file mode 100644 index 3d90986a0..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-config-generator.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "description": "This is Generate Configuration Component API", - "version": "1.0.0", - "capabilities": { - "component-node": { - "type": "tosca.capabilities.Node" - } - }, - "interfaces": { - "org-onap-ccsdk-config-generator-service-ConfigGeneratorNode": { - "operations": { - "process": { - "inputs": { - "template-data": { - "description": "Conditional : JSON string which is used to mash with template. Either template-data or ( resource-id and resource-type ) should be present", - "required": false, - "type": "string" - }, - "template-content": { - "description": "Conditional : Dynamic Template used to generate Configuration.", - "required": false, - "type": "string" - }, - "resource-type": { - "description": "Conditional : resource-type used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present", - "required": false, - "type": "string" - }, - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - }, - "resource-id": { - "description": "Conditional : Id used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present", - "required": false, - "type": "string" - }, - "action-name": { - "description": "Conditional : Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "template-name": { - "description": "Conditional : Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.", - "required": true, - "type": "string" - } - }, - "outputs": { - "generated-config": { - "description": "Generated Configuration for the Template adn Resource Data", - "required": true, - "type": "string" - }, - "mask-info": { - "description": "If template contains mask encription keys, then this mask-info field will be generated, This JSON Content alligns to the bean org.onap.ccsdk.cds.controllerblueprints.core.data.custom.MaskInfo ", - "required": false, - "type": "string" - }, - "status": { - "description": "Status of the Component Execution ( success or failure )", - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Component" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-netconf-executor.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-netconf-executor.json deleted file mode 100644 index 22f5c9b3c..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-netconf-executor.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "description": "This is Netconf Transaction Configuration Component API", - "version": "1.0.0", - "capabilities": { - "component-node": { - "type": "tosca.capabilities.Node" - } - }, - "requirements": { - "netconf-connection": { - "capability": "netconf", - "node": "vnf-netconf-device", - "relationship": "tosca.relationships.ConnectsTo" - } - }, - "interfaces": { - "org-onap-ccsdk-netconf-adaptor-service-NetconfExecutorNode": { - "operations": { - "process": { - "inputs": { - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - }, - "service-template-name": { - "description": "Service Template Name", - "required": true, - "type": "string" - }, - "service-template-version": { - "description": "Service Template Version", - "required": true, - "type": "string" - }, - "action-name": { - "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "resource-type": { - "description": "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "resource-id": { - "description": "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "reservation-id": { - "description": "Reservation Id used to send to NPM", - "required": false, - "type": "string" - }, - "execution-script": { - "description": "Python Script to Execute for this Component action, It should refer any one of Prython Artifact Definition for this Node Template.", - "required": true, - "type": "string" - } - }, - "outputs": { - "response-data": { - "description": "Execution Response Data in JSON format.", - "required": false, - "type": "string" - }, - "status": { - "description": "Status of the Component Execution ( success or failure )", - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Component" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-resource-assignment.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-resource-assignment.json deleted file mode 100644 index e009f8583..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/component-resource-assignment.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "capabilities": { - "component-node": { - "type": "tosca.capabilities.Node" - } - }, - "interfaces": { - "ResourceAssignmentComponent": { - "operations": { - "process": { - "inputs": { - "service-template-name": { - "description": "Service Template Name.", - "required": true, - "type": "string" - }, - "service-template-version": { - "description": "Service Template Version.", - "required": true, - "type": "string" - }, - "resource-type": { - "description": "Request type.", - "required": true, - "type": "string" - }, - "template-names": { - "description": "Name of the artifact Node Templates, to get the template Content.", - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - }, - "request-id": { - "description": "Request Id, Unique Id for the request.", - "required": true, - "type": "string" - }, - "resource-id": { - "description": "Resource Id.", - "required": true, - "type": "string" - }, - "action-name": { - "description": "Action Name of the process", - "required": true, - "type": "string" - } - }, - "outputs": { - "resource-assignment-params": { - "required": true, - "type": "string" - }, - "status": { - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Component" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-activate-netconf.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-activate-netconf.json deleted file mode 100644 index c17a36c1b..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-activate-netconf.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "description": "This is Download Netconf Directed Graph", - "version": "1.0.0", - "properties": { - "mode": { - "required": false, - "type": "string", - "default": "sync" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - }, - "is-start-flow": { - "required": false, - "type": "boolean", - "default": false - } - }, - "capabilities": { - "dg-node": { - "type": "tosca.capabilities.Node" - } - }, - "requirements": { - "component-dependency": { - "capability": "component-node", - "node": "component-netconf-executor", - "relationship": "tosca.relationships.DependsOn" - } - }, - "interfaces": { - "CONFIG": { - "operations": { - "ActivateNetconf": { - "inputs": { - "params": { - "required": false, - "type": "list", - "entry_schema": { - "type": "datatype-property" - } - } - } - } - } - } - }, - - "derived_from": "tosca.nodes.Workflow" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-config-generator.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-config-generator.json deleted file mode 100644 index 4d5343c3a..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-config-generator.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "description": "This is Activate DG for Config Generator Directed Graph", - "version": "1.0.0", - "properties": { - "mode": { - "required": false, - "type": "string", - "default": "sync" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - }, - "is-start-flow": { - "required": false, - "type": "boolean", - "default": false - } - }, - "capabilities": { - "dg-node": { - "type": "tosca.capabilities.Node" - } - }, - "requirements": { - "component-dependency": { - "capability": "component-node", - "node": "component-config-generator", - "relationship": "tosca.relationships.DependsOn" - } - }, - "interfaces": { - "CONFIG": { - "operations": { - "GenerateConfiguration": { - "inputs": { - "params": { - "required": false, - "type": "list", - "entry_schema": { - "type": "datatype-property" - } - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Workflow" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assign-activate.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assign-activate.json deleted file mode 100644 index f44486416..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assign-activate.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "description": "This is Resource Assign and Activate Netconf Directed Graph", - "version": "1.0.0", - "properties": { - "mode": { - "required": false, - "type": "string", - "default": "sync" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - }, - "is-start-flow": { - "required": false, - "type": "boolean", - "default": false - } - }, - "capabilities": { - "dg-node": { - "type": "tosca.capabilities.Node" - } - }, - "requirements": { - "ra-component": { - "capability": "component-node", - "node": "component-resource-assignment", - "relationship": "tosca.relationships.DependsOn" - }, - "netconf-component": { - "capability": "component-node", - "node": "component-netconf-executor", - "relationship": "tosca.relationships.DependsOn" - } - }, - "interfaces": { - "CONFIG": { - "operations": { - "ResourceAssignAndActivate": { - "inputs": { - "params": { - "required": false, - "type": "list", - "entry_schema": { - "type": "datatype-property" - } - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Workflow" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assignment.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assignment.json deleted file mode 100644 index d13668aaf..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/dg-resource-assignment.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "description": "This is Resource Assignment Directed Graph", - "version": "1.0.0", - "properties": { - "mode": { - "required": false, - "type": "string", - "default": "sync" - }, - "version": { - "required": false, - "type": "string", - "default": "LATEST" - }, - "is-start-flow": { - "required": false, - "type": "boolean", - "default": false - } - }, - "capabilities": { - "dg-node": { - "type": "tosca.capabilities.Node" - } - }, - "requirements": { - "component-dependency": { - "capability": "component-node", - "node": "component-resource-assignment", - "relationship": "tosca.relationships.DependsOn" - } - }, - "interfaces": { - "CONFIG": { - "operations": { - "ResourceAssignment": { - "inputs": { - "params": { - "required": false, - "type": "list", - "entry_schema": { - "type": "datatype-property" - } - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Workflow" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Artifact.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Artifact.json deleted file mode 100644 index 4db3f73c8..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Artifact.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "description": "This is Deprecated Artifact Node Type.", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Component.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Component.json deleted file mode 100644 index d559216af..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Component.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "description": "This is default Component Node", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.DG.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.DG.json deleted file mode 100644 index eb8cac0ae..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.DG.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "description": "This is Directed Graph Node Type", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Vnf.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Vnf.json deleted file mode 100644 index c2f5b8687..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.Vnf.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "description": "This is VNF Node Type", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.component.Python.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.component.Python.json deleted file mode 100644 index 908e5682e..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/tosca.nodes.component.Python.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "description": "This is Python Component", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/vnf-netconf-device.json b/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/vnf-netconf-device.json deleted file mode 100644 index b226a0cf8..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/load/model_type/node_type/vnf-netconf-device.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "description": "This is VNF Device with Netconf Capability", - "version": "1.0.0", - "capabilities": { - "netconf": { - "type": "tosca.capability.Netconf", - "properties": { - "login-key": { - "required": true, - "type": "string", - "default": "sdnc" - }, - "login-account": { - "required": true, - "type": "string", - "default": "sdnc-tacacs" - }, - "source": { - "required": true, - "type": "string", - "default": "npm" - }, - "target-ip-address": { - "required": true, - "type": "string" - }, - "port-number": { - "required": true, - "type": "integer", - "default": 830 - }, - "connection-time-out": { - "required": false, - "type": "integer", - "default": 30 - } - } - } - }, - "derived_from": "tosca.nodes.Vnf" - -} diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt index 08bc6c3fd..b74b7e4cf 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt @@ -54,6 +54,10 @@ fun String.asJsonPrimitive(): TextNode { return TextNode(this) } +inline fun <reified T : Any> String.jsonAsType(): T { + return JacksonUtils.readValue<T>(this.trim()) +} + // If you know the string is json content, then use the function directly fun String.jsonAsJsonType(): JsonNode { return JacksonUtils.jsonNode(this.trim()) diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt index 8674c4d40..9b25a5ac9 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt @@ -1,5 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +18,11 @@ package org.onap.ccsdk.cds.controllerblueprints.core.config -open class BluePrintPathConfiguration { +open class BluePrintLoadConfiguration { lateinit var blueprintDeployPath: String lateinit var blueprintArchivePath: String lateinit var blueprintWorkingPath: String -} - -open class BluePrintLoadConfiguration : BluePrintPathConfiguration() { var loadInitialData: Boolean = false var loadBluePrint: Boolean = false var loadBluePrintPaths: String? = null diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt index a06fb99ff..78997fe52 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt @@ -25,7 +25,7 @@ import com.hubspot.jinjava.interpret.JinjavaInterpreter import com.hubspot.jinjava.loader.ResourceLocator import com.hubspot.jinjava.loader.ResourceNotFoundException import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintJsonNodeFactory import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName import org.onap.ccsdk.cds.controllerblueprints.core.removeNullNode @@ -39,7 +39,7 @@ object BluePrintJinjaTemplateService { /** * To enable inheritance within CBA, we need Jinja runtime to know where to load the templates. */ - class BlueprintRelatedTemplateLocator(private val bluePrintPathConfiguration: BluePrintPathConfiguration, + class BlueprintRelatedTemplateLocator(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration, private val artifactName: String, private val artifactVersion: String) : ResourceLocator { @@ -47,7 +47,7 @@ object BluePrintJinjaTemplateService { override fun getString(fullName: String, encoding: Charset, interpreter: JinjavaInterpreter): String { try { val deployFile = - normalizedPathName(bluePrintPathConfiguration.blueprintDeployPath, + normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath, artifactName, artifactVersion, fullName) @@ -62,14 +62,14 @@ object BluePrintJinjaTemplateService { fun generateContent(template: String, json: String, ignoreJsonNull: Boolean, additionalContext: MutableMap<String, Any>, - bluePrintPathConfiguration: BluePrintPathConfiguration, artifactName: String, + bluePrintLoadConfiguration: BluePrintLoadConfiguration, artifactName: String, artifactVersion: String): String { return generateContent(template, json, ignoreJsonNull, additionalContext, - BlueprintRelatedTemplateLocator(bluePrintPathConfiguration, artifactName, artifactVersion)) + BlueprintRelatedTemplateLocator(bluePrintLoadConfiguration, artifactName, artifactVersion)) } fun generateContent(template: String, json: String, ignoreJsonNull: Boolean, diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt index af97d6691..2c928e288 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt @@ -17,13 +17,12 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTemplateService -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.springframework.stereotype.Service @Service -class BluePrintTemplateService(private val bluePrintPathConfiguration: BluePrintPathConfiguration) : +class BluePrintTemplateService(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration) : BlueprintTemplateService { override suspend fun generateContent(bluePrintRuntimeService: BluePrintRuntimeService<*>, @@ -41,7 +40,7 @@ class BluePrintTemplateService(private val bluePrintPathConfiguration: BluePrint jsonData, ignoreJsonNull, additionalContext, - bluePrintPathConfiguration, + bluePrintLoadConfiguration, bluePrintRuntimeService.bluePrintContext().name(), bluePrintRuntimeService.bluePrintContext().version()) } diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt index ac4fc6aea..47b4f2179 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt @@ -28,7 +28,7 @@ import kotlin.test.assertNotNull */ class BluePrintRepoFileServiceTest { - private val basePath = "load/model_type" + private val basePath = "./../../../../components/model-catalog/definition-type/starter-type" private val bluePrintRepoFileService = BluePrintRepoFileService(basePath) @Test @@ -39,7 +39,7 @@ class BluePrintRepoFileServiceTest { @Test fun testGetNodeType() { - val nodeType = bluePrintRepoFileService.getNodeType("component-resource-assignment") + val nodeType = bluePrintRepoFileService.getNodeType("component-resource-resolution") assertNotNull(nodeType, "Failed to get NodeType from repo") } diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json index e8394a085..b7340f336 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json @@ -92,7 +92,7 @@ } } }, - "config-data": { + "sdnc": { "type": "object", "properties": { "path": { @@ -226,7 +226,7 @@ } } }, - "config-data": { + "sdnc": { "type": "object", "properties": { "names": { diff --git a/ms/controllerblueprints/modules/db-resources/pom.xml b/ms/controllerblueprints/modules/db-resources/pom.xml deleted file mode 100644 index 58d395ee0..000000000 --- a/ms/controllerblueprints/modules/db-resources/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright © 2017-2018 AT&T Intellectual Property. - ~ - ~ Modifications Copyright © 2018 IBM. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>modules</artifactId> - <version>0.6.1-SNAPSHOT</version> - </parent> - <artifactId>db-resources</artifactId> - <name>Controller Blueprints DB Resources</name> - - <properties> - </properties> - - <dependencies> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>blueprint-core</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - <exclusions> - <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> -</project> diff --git a/ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt b/ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt deleted file mode 100644 index 9c08301de..000000000 --- a/ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright © 2019 Bell Canada - * Modifications Copyright © 2019 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.db.resources - -// TODO -class BlueprintCatalogServiceImplTest
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml index 0b3d05192..4bc962f04 100644 --- a/ms/controllerblueprints/modules/pom.xml +++ b/ms/controllerblueprints/modules/pom.xml @@ -30,9 +30,7 @@ <modules> <module>blueprint-core</module> <module>resource-dict</module> - <module>db-resources</module> <module>blueprint-validation</module> - <module>service</module> </modules> <dependencies> diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json deleted file mode 100644 index 95a9801dc..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "description": "This is Custom Java Component Resource Source Node Type", - "version": "1.0.0", - "properties": { - "type": { - "required": false, - "type": "string", - "default" : "DYNAMIC", - "constraints": [ - { - "validValues": [ - "DYNAMIC" - ] - } - ] - }, - "class-name": { - "required": true, - "type": "string", - "description" : "Fully Qualified Class Name ( <Package Name> + . + <Class Name> )" - }, - "key-dependencies": { - "required": false, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json deleted file mode 100644 index 13e234e1b..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "This is Default Resource Source Node Type", - "version": "1.0.0", - "properties": { - "key": { - "required": false, - "type": "string" - }, - "key-dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json deleted file mode 100644 index 126ea30bd..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "This is Input Resource Source Node Type", - "version": "1.0.0", - "properties": { - "key": { - "required": false, - "type": "string" - }, - "key-dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-processor-db.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-processor-db.json deleted file mode 100644 index 661a9503b..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-processor-db.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "description": "This is Database Resource Source Node Type", - "version": "1.0.0", - "properties": { - "type": { - "required": true, - "type": "string", - "constraints": [ - { - "valid_values": [ - "SQL", - "PLSQL" - ] - } - ] - }, - "query": { - "required": true, - "type": "string" - }, - "input-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "output-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "key-dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json deleted file mode 100644 index f8dd8b6fc..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "description": "This is Rest Resource Source Node Type", - "version": "1.0.0", - "properties": { - "type": { - "required": false, - "type": "string", - "default": "JSON", - "constraints": [ - { - "valid_values": [ - "JSON" - ] - } - ] - }, - "url-path": { - "required": true, - "type": "string" - }, - "path": { - "required": true, - "type": "string" - }, - "expression-type": { - "required": false, - "type": "string", - "default": "JSON_PATH", - "constraints": [ - { - "valid_values": [ - "JSON_PATH", - "JSON_POINTER" - ] - } - ] - }, - "input-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "output-key-mapping": { - "required": false, - "type": "map", - "entry_schema": { - "type": "string" - } - }, - "key-dependencies": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "derived_from": "tosca.nodes.ResourceSource" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json deleted file mode 100644 index 2ef553e24..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "description": "TOSCA base type for Resource Sources", - "version": "1.0.0", - "derived_from": "tosca.nodes.Root" -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/address.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/address.json deleted file mode 100644 index e999938cf..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/address.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "address", - "tags" : "address", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "address", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "address" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic-cloud-region.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic-cloud-region.json deleted file mode 100644 index 2528fc7fc..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic-cloud-region.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "aic-cloud-region", - "tags" : "aic-cloud-region", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "aic-cloud-region", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "aic-cloud-region" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic_clli.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic_clli.json deleted file mode 100644 index 9e5a6d52a..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/aic_clli.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "aic_clli", - "tags" : "aic_clli", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "aic_clli", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "aic_clli" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/availability_zone_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/availability_zone_0.json deleted file mode 100644 index fc88ced6a..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/availability_zone_0.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "availability_zone_0", - "tags" : "availability_zone_0", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "availability_zone_0", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "availability_zone_0" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json deleted file mode 100644 index 42059ad8e..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com", - "name": "default-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "sources": { - "default": { - "type": "source-default", - "properties": { - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json deleted file mode 100644 index e876c537a..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "input-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "tags": null, - "sources": { - "input": { - "type": "source-input", - "properties": { - "key": "action-name" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json deleted file mode 100644 index 1600dfa01..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "tags": "oam-local-ipv4-address", - "name": "mdsal-source", - "property" :{ - "description": "based on service-instance-id,network-role,v4-ip-type and vm-type get the ipv4-gateway-prefix from the SDN-GC mdsal", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "sources": { - "config-data": { - "type": "source-rest", - "properties": { - "type": "JSON", - "url-path": "config/L3VNF-API:services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$vm-type/vm-networks/$network-role/v4-assigned-ip-list/$v4-ip-type", - "path": "/v4-assigned-ip-list/0/v4-ip-prefix", - "input-key-mapping": { - "service-instance-id": "service-instance-id", - "network-role": "network-role", - "v4-ip-type": "v4-ip-type", - "vm-type": "vm-type" - }, - "output-key-mapping": { - "oam-local-ipv4-address": "v4-ip-prefix" - }, - "key-dependencies": [ - "service-instance-id", - "network-role", - "v4-ip-type", - "vm-type" - ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/name_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/name_0.json deleted file mode 100644 index 6be5bc182..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/name_0.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "name_0", - "tags" : "name_0", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "name_0", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "name_0" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json deleted file mode 100644 index 51c45961b..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "nf-role", - "tags" : "nf-role", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vnf/nf-role", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.VF_MODEL.nf_role as vf_model_role from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnfmodelcustomizationuuid", - "input-key-mapping" : { - "vnfmodelcustomizationuuid" : "vnf-model-customization-uuid" - }, - "output-key-mapping" : { - "nf-role" : "vf_model_role" - }, - "key-dependencies" : [ "vnf-model-customization-uuid" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json deleted file mode 100644 index f2450becb..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "nfc-naming-code", - "tags" : "nfc-naming-code", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "nfc-naming-code", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid", - "input-key-mapping" : { - "vfccustomizationuuid" : "vfccustomizationuuid" - }, - "output-key-mapping" : { - "nfc-naming-code" : "nfc_naming_code" - }, - "key-dependencies" : [ "vfccustomizationuuid" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json deleted file mode 100644 index 15648adc2..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "onap_private_net_cidr", - "tags" : "onap_private_net_cidr", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "onap_private_net_cidr", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = private", - "output-key-mapping" : { - "onap_private_net_cidr" : "prefix" - } - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_id.json deleted file mode 100644 index 75cc69638..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_id.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "onap_private_net_id", - "tags" : "onap_private_net_id", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "onap_private_net_id", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "onap_private_net_id" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json deleted file mode 100644 index 38e4ae1c6..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "private-prefix-id", - "tags" : "private-prefix-id", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "private-prefix-id", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = private", - "output-key-mapping" : { - "private-prefix-id" : "prefix_id" - } - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/processor-db-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/processor-db-source.json deleted file mode 100644 index c946165bf..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/processor-db-source.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "processor-db-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "updated-by": "brindasanth@onap.com", - "tags": "bundle-id, brindasanth@onap.com", - "sources": { - "processor-db": { - "type": "source-db", - "properties": { - "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", - "input-key-mapping": { - "profile_name": "profile_name" - }, - "output-key-mapping": { - "db-country": "country", - "db-state": "state" - } - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json deleted file mode 100644 index 1ddad0920..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "protected-prefix-id", - "tags" : "protected-prefix-id", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "protected-prefix-id", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = protected", - "output-key-mapping" : { - "protected-prefix-id" : "prefix_id" - } - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json deleted file mode 100644 index badc9484d..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "protected_private_net_cidr", - "tags" : "protected_private_net_cidr", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "protected_private_net_cidr", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = protected", - "output-key-mapping" : { - "protected_private_net_cidr" : "prefix" - } - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/public_net_id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/public_net_id.json deleted file mode 100644 index 17ad96bdb..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/public_net_id.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "public_net_id", - "tags" : "public_net_id", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "public_net_id", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "public_net_id" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/service-instance-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/service-instance-id.json deleted file mode 100644 index db089f0d8..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/service-instance-id.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "service-instance-id", - "tags" : "service-instance-id, tosca.datatypes.Root, data_type", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "To be provided", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "service-instance-id" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json deleted file mode 100644 index 2e135679a..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "unprotected-prefix-id", - "tags" : "unprotected-prefix-id", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "unprotected-prefix-id", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = unprotected", - "output-key-mapping" : { - "unprotected-prefix-id" : "prefix_id" - } - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json deleted file mode 100644 index acb379b52..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name" : "unprotected_private_net_cidr", - "tags" : "unprotected_private_net_cidr", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "unprotected_private_net_cidr", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = unprotected", - "output-key-mapping" : { - "unprotected_private_net_cidr" : "prefix" - } - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-id.json deleted file mode 100644 index 5203bb30e..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-id.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vf-module-id", - "tags" : "vf-module-id", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vf-module-id", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vf-module-id" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json deleted file mode 100644 index 95b78aff6..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vf-module-label", - "tags" : "vf-module-label", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vf-module-label", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid", - "input-key-mapping" : { - "customizationid" : "vf-module-model-customization-uuid" - }, - "output-key-mapping" : { - "vf-module-label" : "vf_module_label" - }, - "key-dependencies" : [ "vf-module-model-customization-uuid" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json deleted file mode 100644 index dd4791879..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-model-customization-uuid.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vf-module-model-customization-uuid", - "tags" : "vf-module-model-customization-uuid", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vf-module-model-customization-uuid", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vf-module-model-customization-uuid" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json deleted file mode 100644 index 6aa6db114..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vf-module-type", - "tags" : "vf-module-type", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vf-module-type", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid", - "input-key-mapping" : { - "customizationid" : "vf-module-model-customization-uuid" - }, - "output-key-mapping" : { - "vf-module-type" : "vf_module_type" - }, - "key-dependencies" : [ "vf-module-model-customization-uuid" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json deleted file mode 100644 index df00ba2db..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vf-naming-policy", - "tags" : "vf-naming-policy", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vf-naming-policy", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid", - "input-key-mapping" : { - "vnf_model_customization_uuid" : "vnf-model-customization-uuid" - }, - "output-key-mapping" : { - "vf-naming-policy" : "vf_naming_policy" - }, - "key-dependencies" : [ "vnf-model-customization-uuid" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json deleted file mode 100644 index 1bf36ef39..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vf-nf-code", - "tags" : "vf-nf-code", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vf-nf-code", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.VF_MODEL.nf_code as vf_nf_code from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:customizationid", - "input-key-mapping" : { - "customizationid" : "vnf-model-customization-uuid" - }, - "output-key-mapping" : { - "vf-nf-code" : "vf_nf_code" - }, - "key-dependencies" : [ "vnf-model-customization-uuid" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf_module_name.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf_module_name.json deleted file mode 100644 index 3d958919a..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf_module_name.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vf_module_name", - "tags" : "vf_module_name", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vf_module_name", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vf_module_name" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json deleted file mode 100644 index bf14f74b7..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vfccustomizationuuid", - "tags" : "vfccustomizationuuid, tosca.datatypes.Root, data_type", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vfccustomizationuuid", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select sdnctl.VF_MODULE_TO_VFC_MAPPING.vfc_customization_uuid as vnf_customid from sdnctl.VF_MODULE_TO_VFC_MAPPING where vm_count = 1 and sdnctl.VF_MODULE_TO_VFC_MAPPING.vf_module_customization_uuid=:vfmodulecustomizationuuid", - "input-key-mapping" : { - "vfmodulecustomizationuuid" : "vf-module-model-customization-uuid" - }, - "output-key-mapping" : { - "vfccustomizationuuid" : "vnf_customid" - }, - "key-dependencies" : [ "vf-module-model-customization-uuid" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json deleted file mode 100644 index f1d85fedc..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name" : "vfw_private_ip_0", - "tags" : "vfw_private_ip_0", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vfw_private_ip_0", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vfw_private_ip_0" - } - }, - "config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vfw_private_ip_0", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id", - "vf-module-id" : "vf-module-id" - }, - "output-key-mapping" : { - "vfw_private_ip_0" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json deleted file mode 100644 index de2d81b4b..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name" : "vfw_private_ip_1", - "tags" : "vfw_private_ip_1", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vfw_private_ip_1", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vfw_private_ip_1" - } - }, - "config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vfw_private_ip_1", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id", - "vf-module-id" : "vf-module-id" - }, - "output-key-mapping" : { - "vfw_private_ip_1" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_2.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_2.json deleted file mode 100644 index 9e5106470..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_2.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vfw_private_ip_2", - "tags" : "vfw_private_ip_2", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vfw_private_ip_2", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vfw_private_ip_2" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json deleted file mode 100644 index d67ab1a25..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vm-type", - "tags" : "vm-type", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vm-type", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select vfc_model.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid", - "input-key-mapping" : { - "vfccustomizationuuid" : "vfccustomizationuuid" - }, - "output-key-mapping" : { - "vm-type" : "vm_type" - }, - "key-dependencies" : [ "vfccustomizationuuid" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-id.json deleted file mode 100644 index 5ea0fbcfd..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-id.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vnf-id", - "tags" : "vnf-id", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vnf-id", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vnf-id" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json deleted file mode 100644 index d36fe740a..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-model-customization-uuid.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vnf-model-customization-uuid", - "tags" : "vnf-model-customization-uuid", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vnf-model-customization-uuid", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vnf-model-customization-uuid" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json deleted file mode 100644 index 991c45fd9..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name" : "vnf-name", - "tags" : "vnf-name, tosca.datatypes.Root, data_type", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vnf-name", - "type" : "string" - }, - "sources" : { - "config-data": { - "type": "source-rest", - "properties": { - "type": "JSON", - "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-name/vnf-data/vnf-topology/vnf-parameters-data/param/vnf-name", - "path": "/param/0/value", - "input-key-mapping": { - "service-instance-id": "service-instance-id", - "vnf-name": "vnf-name" - }, - "output-key-mapping": { - "vnf-name": "value" - }, - "key-dependencies": [ - "service-instance-id", - "vnf-name" - ] - } - }, - "aai-data": { - "type": "source-rest", - "properties": { - "type": "JSON", - "verb": "GET", - "url-path": "/aai/v14/network/generic-vnfs/generic-vnf/$vnf-id", - "path": "", - "input-key-mapping": { - "vnf-id": "vnf-id" - }, - "output-key-mapping": { - "vnf-name": "vnf-name" - }, - "key-dependencies": [ - "vnf-id" - ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json deleted file mode 100644 index ae7413e0c..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name" : "vnf_name", - "tags" : "vnf_name", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vnf_name", - "type" : "string" - }, - "sources" : { - "config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id" - }, - "output-key-mapping" : { - "vnf_name" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json deleted file mode 100644 index 022face08..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vnfc-model-invariant-uuid", - "tags" : "vnfc-model-invariant-uuid", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vnfc-model-invariant-uuid for vFW template", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select vfc_model.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid", - "input-key-mapping" : { - "vfccustomizationuuid" : "vfccustomizationuuid" - }, - "output-key-mapping" : { - "vnfc-model-invariant-uuid" : "vfc_invariant_uuid" - }, - "key-dependencies" : [ "vfccustomizationuuid" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json deleted file mode 100644 index 02c487cc9..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name" : "vnfc-model-version", - "tags" : "vnfc-model-version", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vnfc-model-version for vFW template", - "type" : "string" - }, - "sources" : { - "processor-db" : { - "type" : "source-db", - "properties" : { - "type" : "SQL", - "query" : "select vfc_model.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid", - "input-key-mapping" : { - "vfccustomizationuuid" : "vfccustomizationuuid" - }, - "output-key-mapping" : { - "vnfc-model-version" : "vnfc_model_version" - }, - "key-dependencies" : [ "vfccustomizationuuid" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json deleted file mode 100644 index bb8b7da2e..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name" : "vpg_private_ip_0", - "tags" : "vpg_private_ip_0", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vpg_private_ip_0", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vpg_private_ip_0" - } - }, - "config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vpg_private_ip_0", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id", - "vf-module-id" : "vf-module-id" - }, - "output-key-mapping" : { - "vpg_private_ip_0" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_1.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_1.json deleted file mode 100644 index 23c42e0c7..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vpg_private_ip_1", - "tags" : "vpg_private_ip_1", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vpg_private_ip_1", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vpg_private_ip_1" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json deleted file mode 100644 index 4dd09557a..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name" : "vsn_private_ip_0", - "tags" : "vsn_private_ip_0", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vsn_private_ip_0", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vsn_private_ip_0" - } - }, - "config-data" : { - "type" : "source-rest", - "properties" : { - "type" : "JSON", - "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/$vf-module-id/vf-module-data/vf-module-topology/vf-module-parameters/param/vsn_private_ip_0", - "path" : "/param/0/value", - "expression-type" : "JSON_POINTER", - "input-key-mapping" : { - "service-instance-id" : "service-instance-id", - "vnf-id" : "vnf-id", - "vf-module-id" : "vf-module-id" - }, - "output-key-mapping" : { - "vsn_private_ip_0" : "value" - }, - "key-dependencies" : [ "service-instance-id", "vnf-id", "vf-module-id" ] - } - } - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_1.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_1.json deleted file mode 100644 index 88750b25e..000000000 --- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name" : "vsn_private_ip_1", - "tags" : "vsn_private_ip_1", - "updated-by" : "Singal, Kapil <ks220y@att.com>", - "property" : { - "description" : "vsn_private_ip_1", - "type" : "string" - }, - "sources" : { - "input" : { - "type" : "source-input", - "properties" : { - "key" : "vsn_private_ip_1" - } - } - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java index 26a3a2871..fd38db0bf 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java +++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; public class ResourceDefinitionTest { private Logger log = LoggerFactory.getLogger(ResourceDefinitionTest.class); - private String basePath = "load/resource_dictionary"; + private String basePath = "./../../../../components/model-catalog/resource-dictionary/starter-dictionary"; @Test public void testDictionaryDefinitionInputSource(){ @@ -46,7 +46,7 @@ public class ResourceDefinitionTest { @Test public void testDictionaryDefinitionDBSource(){ - String fileName = basePath + "/processor-db-source.json"; + String fileName = basePath + "/db-source.json"; ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for processor-db type", resourceDefinition); } diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java index cb7ff88a3..eae944ad9 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java +++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java @@ -28,7 +28,7 @@ public class ResourceSourceMappingFactoryTest { ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("processor-db", "source-db"); ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input"); ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default"); - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("config-data", "source-rest"); + ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("sdnc", "source-rest"); ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("aai-data", "source-rest"); String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("processor-db"); diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt index fa82f839b..639ed05d3 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt +++ b/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt @@ -25,7 +25,7 @@ object ResourceDictionaryTestUtils { ResourceSourceMappingFactory.registerSourceMapping("processor-db", "source-db") ResourceSourceMappingFactory.registerSourceMapping("input", "source-input") ResourceSourceMappingFactory.registerSourceMapping("default", "source-default") - ResourceSourceMappingFactory.registerSourceMapping("config-data", "source-rest") + ResourceSourceMappingFactory.registerSourceMapping("sdnc", "source-rest") ResourceSourceMappingFactory.registerSourceMapping("aai-data", "source-rest") } } diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json index fb2637e1f..f58c7a705 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json +++ b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json @@ -29,7 +29,7 @@ "required": true }, "dictionary-name": "bundle-id", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "vnf-id" ] @@ -42,7 +42,7 @@ "required": true }, "dictionary-name": "bundle-ip", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "vnf-id" ] @@ -54,7 +54,7 @@ "type": "string" }, "dictionary-name": "bundle-mac", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "vnf-id", "bundle-id" @@ -67,7 +67,7 @@ "type": "string" }, "dictionary-name": "managed-ip", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "loopback-ip" ] @@ -90,7 +90,7 @@ "type": "string" }, "dictionary-name": "managed-ip1", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "loopback-ip" ] diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json index 9bef60d2d..13a4c9f3e 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json +++ b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json @@ -29,7 +29,7 @@ "required": true }, "dictionary-name": "bundle-id", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "vnf-id" ] @@ -42,7 +42,7 @@ "required": true }, "dictionary-name": "bundle-ip", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "vnf-id" ] @@ -54,7 +54,7 @@ "type": "string" }, "dictionary-name": "bundle-mac", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "vnf-id", "bundle-id" @@ -67,7 +67,7 @@ "type": "string" }, "dictionary-name": "bundle-mac", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "loopback-ip" ] @@ -90,7 +90,7 @@ "type": "string" }, "dictionary-name": "managed-ip1", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "loopback-ip" ] diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json index 8a212abe4..79925bfac 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json +++ b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json @@ -29,7 +29,7 @@ "required": true }, "dictionary-name": "bundle-id", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "vnf-id" ] @@ -42,7 +42,7 @@ "required": true }, "dictionary-name": "bundle-ip", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "vnf-id" ] @@ -54,7 +54,7 @@ "type": "string" }, "dictionary-name": "bundle-mac", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "vnf-id", "bundle-id" @@ -67,7 +67,7 @@ "type": "string" }, "dictionary-name": "managed-ip", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "loopback-ip" ] @@ -90,7 +90,7 @@ "type": "string" }, "dictionary-name": "managed-ip1", - "dictionary-source": "config-data", + "dictionary-source": "sdnc", "dependencies": [ "loopback-ip" ] diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml deleted file mode 100644 index d06669eb6..000000000 --- a/ms/controllerblueprints/modules/service/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright © 2017-2018 AT&T Intellectual Property. - ~ - ~ Modifications Copyright © 2018 IBM. - ~ - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>modules</artifactId> - <version>0.6.1-SNAPSHOT</version> - </parent> - <artifactId>service</artifactId> - <name>Controller Blueprints Service</name> - - <properties> - </properties> - - <dependencies> - <dependency> - <groupId>org.jetbrains.kotlinx</groupId> - <artifactId>kotlinx-coroutines-reactor</artifactId> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>db-resources</artifactId> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>blueprint-validation</artifactId> - </dependency> - <dependency> - <groupId>org.apache.velocity</groupId> - <artifactId>velocity</artifactId> - </dependency> - <dependency> - <groupId>com.hubspot.jinjava</groupId> - <artifactId>jinjava</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-webflux</artifactId> - <exclusions> - <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - <exclusions> - <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.mariadb.jdbc</groupId> - <artifactId>mariadb-java-client</artifactId> - </dependency> - </dependencies> -</project> diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/ApplicationRegistrationService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/ApplicationRegistrationService.java deleted file mode 100644 index 51484ff6c..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/ApplicationRegistrationService.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service; - -import org.apache.commons.collections.CollectionUtils; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.List; - -@Component -@SuppressWarnings("unused") -public class ApplicationRegistrationService { - private static Logger log = LoggerFactory.getLogger(ApplicationRegistrationService.class); - - @Value("#{'${resourceSourceMappings}'.split(',')}") - private List<String> resourceSourceMappings; - - @PostConstruct - public void register() { - registerDictionarySources(); - } - - public void registerDictionarySources() { - log.info("Registering Dictionary Sources : {}", resourceSourceMappings); - if (CollectionUtils.isNotEmpty(resourceSourceMappings)) { - resourceSourceMappings.forEach(resourceSourceMapping -> { - String[] mappingKeyValue = resourceSourceMapping.split("="); - if (mappingKeyValue != null && mappingKeyValue.length == 2) { - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping(mappingKeyValue[0].trim(), mappingKeyValue[1].trim()); - } else { - log.warn("failed to get resource source mapping {}", resourceSourceMapping); - } - }); - } - } -} diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/ErrorMessage.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/ErrorMessage.java deleted file mode 100644 index 155a162b6..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/ErrorMessage.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.common; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; - -import java.io.Serializable; -import java.util.Date; - -@JsonInclude(Include.NON_NULL) -@JsonTypeName("errorMessage") -@JsonTypeInfo(include= JsonTypeInfo.As.WRAPPER_OBJECT, use=JsonTypeInfo.Id.NAME) -public class ErrorMessage implements Serializable { - private String message; - private Integer code; - private String debugMessage; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - private Date timestamp = new Date(); - - public ErrorMessage(String message, Integer code, String debugMessage){ - this.message = message; - this.code = code; - this.debugMessage = debugMessage; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - public String getDebugMessage() { - return debugMessage; - } - - public void setDebugMessage(String developerMessage) { - this.debugMessage = developerMessage; - } - - public Date getTimestamp() { - return timestamp; - } - - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java deleted file mode 100644 index 38216a616..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.common; - -import io.swagger.models.*; -import io.swagger.models.parameters.BodyParameter; -import io.swagger.models.parameters.Parameter; -import io.swagger.models.properties.*; -import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang3.BooleanUtils; -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants; -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes; -import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition; -import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate; - -import java.util.*; - -/** - * SwaggerGenerator.java Purpose: Provide Service to generate service template input schema definition and Sample Json - * generation. - * - * @author Brinda Santh - * @version 1.0 - */ -@Deprecated -public class SwaggerGenerator { - - private ServiceTemplate serviceTemplate; - public static final String INPUTS="inputs"; - - /** - * This is a SwaggerGenerator constructor - */ - public SwaggerGenerator(ServiceTemplate serviceTemplate) { - this.serviceTemplate = serviceTemplate; - } - - /** - * This is a generateSwagger - * - * @return String - */ - public String generateSwagger() { - - Swagger swagger = new Swagger().info(getInfo()); - - swagger.setPaths(getPaths()); - swagger.setDefinitions(getDefinition()); - - - return swagger.toString(); - } - - private Info getInfo() { - Info info = new Info(); - Contact contact = new Contact(); - contact.setName(serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_AUTHOR)); - info.setContact(contact); - info.setTitle(serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_NAME)); - info.setDescription(serviceTemplate.getDescription()); - info.setVersion(serviceTemplate.getMetadata().get(BluePrintConstants.METADATA_TEMPLATE_VERSION)); - return info; - } - - private Map<String, Path> getPaths() { - Map<String, Path> paths = new HashMap<>(); - Path path = new Path(); - Operation post = new Operation(); - post.setOperationId("configure"); - post.setConsumes(Arrays.asList("application/json", "application/xml")); - post.setProduces(Arrays.asList("application/json", "application/xml")); - List<Parameter> parameters = new ArrayList<>(); - Parameter in = new BodyParameter().schema(new RefModel("#/definitions/inputs")); - in.setRequired(true); - in.setName(INPUTS); - parameters.add(in); - post.setParameters(parameters); - - Map<String, Response> responses = new HashMap<>(); - Response response = new Response().description("Success"); - responses.put("200", response); - - Response failureResponse = new Response().description("Failure"); - responses.put("400", failureResponse); - post.setResponses(responses); - - path.setPost(post); - paths.put("/operations/config-selfservice-api:configure", path); - return paths; - } - - private Map<String, Model> getDefinition() { - Map<String, Model> models = new HashMap<>(); - - ModelImpl inputmodel = new ModelImpl(); - inputmodel.setTitle(INPUTS); - serviceTemplate.getTopologyTemplate().getInputs().forEach((propertyName, property) -> { - Property defProperty = getPropery(propertyName, property); - inputmodel.property(propertyName, defProperty); - }); - models.put(INPUTS, inputmodel); - - if (MapUtils.isNotEmpty(serviceTemplate.getDataTypes())) { - serviceTemplate.getDataTypes().forEach((name, dataType) -> { - ModelImpl model = new ModelImpl(); - model.setDescription(dataType.getDescription()); - if (dataType != null && MapUtils.isNotEmpty(dataType.getProperties())) { - - dataType.getProperties().forEach((propertyName, property) -> { - Property defProperty = getPropery(propertyName, property); - model.addProperty(propertyName, defProperty); - }); - } - models.put(name, model); - }); - } - return models; - - } - - private Property getPropery(String name, PropertyDefinition propertyDefinition) { - Property defProperty = null; - - if (BluePrintTypes.validPrimitiveTypes().contains(propertyDefinition.getType())) { - if (BluePrintConstants.DATA_TYPE_BOOLEAN.equals(propertyDefinition.getType())) { - defProperty = new BooleanProperty(); - } else if (BluePrintConstants.DATA_TYPE_INTEGER.equals(propertyDefinition.getType())) { - StringProperty stringProperty = new StringProperty(); - stringProperty.setType("integer"); - defProperty = stringProperty; - } else if (BluePrintConstants.DATA_TYPE_FLOAT.equals(propertyDefinition.getType())) { - StringProperty stringProperty = new StringProperty(); - stringProperty.setFormat("float"); - defProperty = stringProperty; - } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP.equals(propertyDefinition.getType())) { - DateTimeProperty dateTimeProperty = new DateTimeProperty(); - dateTimeProperty.setFormat("date-time"); - defProperty = dateTimeProperty; - } else { - defProperty = new StringProperty(); - } - } else if (BluePrintTypes.validCollectionTypes().contains(propertyDefinition.getType())) { - Optional<Property> innerType = Optional.empty(); - if (propertyDefinition.getEntrySchema() != null) { - String entrySchema = propertyDefinition.getEntrySchema().getType(); - if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema)) { - innerType = Optional.of(new RefProperty("#/definitions/" + entrySchema)); - } - } - ArrayProperty arrayProperty = new ArrayProperty(); - arrayProperty.setItems(innerType.orElseGet(StringProperty::new)); - defProperty = arrayProperty; - } else { - defProperty = new RefProperty("#/definitions/" + propertyDefinition.getType()); - } - defProperty.setName(name); - if (propertyDefinition.getDefaultValue() != null) { - defProperty.setDefault(String.valueOf(propertyDefinition.getDefaultValue())); - } - - defProperty.setRequired(BooleanUtils.isTrue(propertyDefinition.getRequired())); - defProperty.setDescription(propertyDefinition.getDescription()); - return defProperty; - } - - -} diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/BlueprintModel.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/BlueprintModel.java deleted file mode 100755 index 916e94b4e..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/BlueprintModel.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2019 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.domain; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModelProperty; -import org.hibernate.annotations.Proxy; -import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * BlueprintModel.java Purpose: Provide Configuration Generator BlueprintModel Entity - * - * @author Brinda Santh - * @version 1.0 - */ - -@EntityListeners({AuditingEntityListener.class}) -@Entity -@Table(name = "CONFIG_MODEL", uniqueConstraints=@UniqueConstraint(columnNames={"artifact_name","artifact_version"})) -@Proxy(lazy=false) -public class BlueprintModel implements Serializable { - private static final long serialVersionUID = 1L; - @Id - @Column(name = "config_model_id") - private String id; - - @Column(name = "service_uuid") - private String serviceUUID; - - @Column(name = "distribution_id") - private String distributionId; - - @Column(name = "service_name") - private String serviceName; - - @Column(name = "service_description") - private String serviceDescription; - - @Column(name = "resource_uuid") - private String resourceUUID; - - @Column(name = "resource_instance_name") - private String resourceInstanceName; - - @Column(name = "resource_name") - private String resourceName; - - @Column(name = "resource_version") - private String resourceVersion; - - @Column(name = "resource_type") - private String resourceType; - - @Column(name = "artifact_uuid") - private String artifactUUId; - - @Column(name = "artifact_type") - private String artifactType; - - @Column(name = "artifact_version", nullable = false) - @ApiModelProperty(required=true) - private String artifactVersion; - - @Lob - @Column(name = "artifact_description") - private String artifactDescription; - - @Column(name = "internal_version") - private Integer internalVersion; - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - @LastModifiedDate - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "creation_date") - private Date createdDate = new Date(); - - @Column(name = "artifact_name", nullable = false) - @ApiModelProperty(required=true) - private String artifactName; - - @Column(name = "published", nullable = false) - @ApiModelProperty(required=true) - private String published; - - @Column(name = "updated_by", nullable = false) - @ApiModelProperty(required=true) - private String updatedBy; - - @Lob - @Column(name = "tags", nullable = false) - @ApiModelProperty(required=true) - private String tags; - - @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = CascadeType.ALL) - private org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelContent blueprintModelContent; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getServiceUUID() { - return serviceUUID; - } - - public void setServiceUUID(String serviceUUID) { - this.serviceUUID = serviceUUID; - } - - public String getDistributionId() { - return distributionId; - } - - public void setDistributionId(String distributionId) { - this.distributionId = distributionId; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public String getServiceDescription() { - return serviceDescription; - } - - public void setServiceDescription(String serviceDescription) { - this.serviceDescription = serviceDescription; - } - - public String getResourceUUID() { - return resourceUUID; - } - - public void setResourceUUID(String resourceUUID) { - this.resourceUUID = resourceUUID; - } - - public String getResourceInstanceName() { - return resourceInstanceName; - } - - public void setResourceInstanceName(String resourceInstanceName) { - this.resourceInstanceName = resourceInstanceName; - } - - public String getResourceName() { - return resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public String getArtifactUUId() { - return artifactUUId; - } - - public void setArtifactUUId(String artifactUUId) { - this.artifactUUId = artifactUUId; - } - - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(String artifactType) { - this.artifactType = artifactType; - } - - public String getArtifactVersion() { - return artifactVersion; - } - - public void setArtifactVersion(String artifactVersion) { - this.artifactVersion = artifactVersion; - } - - public String getArtifactDescription() { - return artifactDescription; - } - - public void setArtifactDescription(String artifactDescription) { - this.artifactDescription = artifactDescription; - } - - public Integer getInternalVersion() { - return internalVersion; - } - - public void setInternalVersion(Integer internalVersion) { - this.internalVersion = internalVersion; - } - - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getArtifactName() { - return artifactName; - } - - public void setArtifactName(String artifactName) { - this.artifactName = artifactName; - } - - public String getPublished() { - return published; - } - - public void setPublished(String published) { - this.published = published; - } - - public String getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; - } - - public String getTags() { - return tags; - } - - public void setTags(String tags) { - this.tags = tags; - } - - public org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelContent getBlueprintModelContent() { - return blueprintModelContent; - } - - public void setBlueprintModelContent( - org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelContent blueprintModelContent) { - this.blueprintModelContent = blueprintModelContent; - } -} diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/BlueprintModelContent.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/BlueprintModelContent.java deleted file mode 100644 index 20a1fdcdf..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/BlueprintModelContent.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2019 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.domain; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModelProperty; -import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; -import java.util.Objects; - -/** - * DataDictionary.java Purpose: Provide Configuration Generator DataDictionary Entity - * - * @author Brinda Santh - * @version 1.0 - */ -@EntityListeners({AuditingEntityListener.class}) -@Entity -@Table(name = "CONFIG_MODEL_CONTENT") -public class BlueprintModelContent implements Serializable { - - private static final long serialVersionUID = 1L; - - @Id - @Column(name = "config_model_content_id") - private String id; - - @Column(name = "name", nullable = false) - @ApiModelProperty(required=true) - private String name; - - @Column(name = "content_type", nullable = false) - @ApiModelProperty(required=true) - private String contentType; - - @OneToOne - @JoinColumn(name = "config_model_id") - private BlueprintModel blueprintModel; - - @Lob - @Column(name = "description") - private String description; - - @Lob - @Column(name = "content", nullable = false) - @ApiModelProperty(required=true) - private byte[] content; - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - @LastModifiedDate - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "updated_date") - private Date creationDate = new Date(); - - @Override - public String toString() { - return "[" + "id = " + id + - ", name = " + name + - ", contentType = " + contentType + - "]"; - } - - @Override - public boolean equals(Object o) { - - if (o == this) { - return true; - } - if (!(o instanceof BlueprintModelContent)) { - return false; - } - BlueprintModelContent blueprintModelContent = (BlueprintModelContent) o; - return Objects.equals(id, blueprintModelContent.id) && Objects.equals(name, blueprintModelContent.name) - && Objects.equals(contentType, blueprintModelContent.contentType); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, contentType); - } - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public String getContentType() { - return contentType; - } - - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - - public BlueprintModel getBlueprintModel() { - return blueprintModel; - } - - - public void setBlueprintModel(BlueprintModel blueprintModel) { - this.blueprintModel = blueprintModel; - } - - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public byte[] getContent() { - return content; - } - - - public void setContent(byte[] content) { - this.content = content; - } - - - public Date getCreationDate() { - return creationDate; - } - - - public void setCreationDate(Date creationDate) { - this.creationDate = creationDate; - } - -} diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/BlueprintModelSearch.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/BlueprintModelSearch.java deleted file mode 100644 index 5c351bc63..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/BlueprintModelSearch.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2019 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.domain; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import org.springframework.data.annotation.LastModifiedDate; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -@Entity -@Table(name = "CONFIG_MODEL") -@JsonTypeName("blueprintModel") -@JsonTypeInfo(include= JsonTypeInfo.As.WRAPPER_OBJECT, use=JsonTypeInfo.Id.NAME) -public class BlueprintModelSearch implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @Column(name = "config_model_id") - private String id; - - @Column(name = "artifact_uuid") - private String artifactUUId; - - @Column(name = "artifact_type") - private String artifactType; - - @Column(name = "artifact_version", nullable = false) - private String artifactVersion; - - @Lob - @Column(name = "artifact_description") - private String artifactDescription; - - @Column(name = "internal_version") - private Integer internalVersion; - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - @LastModifiedDate - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "creation_date") - private Date createdDate = new Date(); - - @Column(name = "artifact_name", nullable = false) - private String artifactName; - - @Column(name = "published", nullable = false) - private String published; - - @Column(name = "updated_by", nullable = false) - private String updatedBy; - - @Lob - @Column(name = "tags", nullable = false) - private String tags; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getArtifactUUId() { - return artifactUUId; - } - - public void setArtifactUUId(String artifactUUId) { - this.artifactUUId = artifactUUId; - } - - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(String artifactType) { - this.artifactType = artifactType; - } - - public String getArtifactVersion() { - return artifactVersion; - } - - public void setArtifactVersion(String artifactVersion) { - this.artifactVersion = artifactVersion; - } - - public String getArtifactDescription() { - return artifactDescription; - } - - public void setArtifactDescription(String artifactDescription) { - this.artifactDescription = artifactDescription; - } - - public Integer getInternalVersion() { - return internalVersion; - } - - public void setInternalVersion(Integer internalVersion) { - this.internalVersion = internalVersion; - } - - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getArtifactName() { - return artifactName; - } - - public void setArtifactName(String artifactName) { - this.artifactName = artifactName; - } - - public String getPublished() { - return published; - } - - public void setPublished(String published) { - this.published = published; - } - - public String getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; - } - - public String getTags() { - return tags; - } - - public void setTags(String tags) { - this.tags = tags; - } - - public static long getSerialversionuid() { - return serialVersionUID; - } -} diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ModelType.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ModelType.java deleted file mode 100644 index 31b792407..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ModelType.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.domain; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.JsonNode; -import io.swagger.annotations.ApiModelProperty; -import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - - -/** - * AsdcReference.java Purpose: Provide Configuration Generator AsdcReference Entity - * - * @author Brinda Santh - * @version 1.0 - */ -@EntityListeners({AuditingEntityListener.class}) -@Entity -@Table(name = "MODEL_TYPE") -public class ModelType implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @Column(name = "model_name", nullable = false) - @ApiModelProperty(required=true) - private String modelName; - - @Column(name = "derived_from", nullable = false) - @ApiModelProperty(required=true) - private String derivedFrom; - - @Column(name = "definition_type", nullable = false) - @ApiModelProperty(required=true) - private String definitionType; - - @Lob - @Convert(converter = JpaJsonNodeConverter.class) - @Column(name = "definition", nullable = false) - @ApiModelProperty(required=true) - private JsonNode definition; - - @Lob - @Column(name = "description", nullable = false) - @ApiModelProperty(required=true) - private String description; - - @Column(name = "version", nullable = false) - @ApiModelProperty(required=true) - private String version; - - @Lob - @Column(name = "tags", nullable = false) - @ApiModelProperty(required=true) - private String tags; - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - @LastModifiedDate - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "creation_date") - private Date creationDate; - - @Column(name = "updated_by", nullable = false) - @ApiModelProperty(required=true) - private String updatedBy; - - @Override - public String toString() { - return "[" + "modelName = " + modelName + - ", derivedFrom = " + derivedFrom + - ", definitionType = " + definitionType + - ", description = " + description + - ", creationDate = " + creationDate + - ", version = " + version + - ", updatedBy = " + updatedBy + - ", tags = " + tags + - "]"; - } - - public String getModelName() { - return modelName; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } - - public String getDerivedFrom() { - return derivedFrom; - } - - public void setDerivedFrom(String derivedFrom) { - this.derivedFrom = derivedFrom; - } - - public String getDefinitionType() { - return definitionType; - } - - public void setDefinitionType(String definitionType) { - this.definitionType = definitionType; - } - - public JsonNode getDefinition() { - return definition; - } - - public void setDefinition(JsonNode definition) { - this.definition = definition; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getTags() { - return tags; - } - - public void setTags(String tags) { - this.tags = tags; - } - - public Date getCreationDate() { - return creationDate; - } - - public void setCreationDate(Date creationDate) { - this.creationDate = creationDate; - } - - public String getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; - } - - -} diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ResourceDictionary.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ResourceDictionary.java deleted file mode 100644 index 2a6ab459b..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ResourceDictionary.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.domain; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModelProperty; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition; -import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * DataDictionary.java Purpose: Provide Configuration Generator DataDictionary Entity - * - * @author Brinda Santh - * @version 1.0 - */ -@EntityListeners({AuditingEntityListener.class}) -@Entity -@Table(name = "RESOURCE_DICTIONARY") -public class ResourceDictionary implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @Column(name = "name", nullable = false) - @ApiModelProperty(required=true) - private String name; - - @Column(name = "data_type", nullable = false) - @ApiModelProperty(required=true) - private String dataType; - - @Column(name = "entry_schema") - private String entrySchema; - - @Lob - @Convert(converter = JpaResourceDefinitionConverter.class) - @Column(name = "definition", nullable = false) - @ApiModelProperty(required=true) - private ResourceDefinition definition; - - @Lob - @Column(name = "description", nullable = false) - @ApiModelProperty(required=true) - private String description; - - @Lob - @Column(name = "tags", nullable = false) - @ApiModelProperty(required=true) - private String tags; - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - @LastModifiedDate - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "creation_date") - private Date creationDate; - - @Column(name = "updated_by", nullable = false) - @ApiModelProperty(required=true) - private String updatedBy; - - @Override - public String toString() { - return "[" + ", name = " + name + - ", dataType = " + dataType + - ", entrySchema = " + entrySchema + - ", definition =" + definition + - ", description = " + description + - ", updatedBy = " + updatedBy + - ", tags = " + tags + - ", creationDate = " + creationDate + - "]"; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDataType() { - return dataType; - } - - public void setDataType(String dataType) { - this.dataType = dataType; - } - - public String getEntrySchema() { - return entrySchema; - } - - public void setEntrySchema(String entrySchema) { - this.entrySchema = entrySchema; - } - - public ResourceDefinition getDefinition() { - return definition; - } - - public void setDefinition(ResourceDefinition definition) { - this.definition = definition; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getTags() { - return tags; - } - - public void setTags(String tags) { - this.tags = tags; - } - - public Date getCreationDate() { - return creationDate; - } - - public void setCreationDate(Date creationDate) { - this.creationDate = creationDate; - } - - public String getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; - } - - - -} diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/model/AutoMapResponse.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/model/AutoMapResponse.java deleted file mode 100644 index 0fa337762..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/model/AutoMapResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.model; - -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment; -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary; - -import java.util.List; - -/** - * ArtifactRequest.java Purpose: Provide Configuration Generator ArtifactRequest Model - * - * @author Brinda Santh - * @version 1.0 - */ -public class AutoMapResponse { - - private List<ResourceAssignment> resourceAssignments; - private List<ResourceDictionary> dataDictionaries; - - public List<ResourceAssignment> getResourceAssignments() { - return resourceAssignments; - } - - public void setResourceAssignments(List<ResourceAssignment> resourceAssignments) { - this.resourceAssignments = resourceAssignments; - } - - public List<ResourceDictionary> getDataDictionaries() { - return dataDictionaries; - } - - public void setDataDictionaries(List<ResourceDictionary> dataDictionaries) { - this.dataDictionaries = dataDictionaries; - } - - - -} diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt deleted file mode 100644 index 790c61ebc..000000000 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service - -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.context.properties.bind.Bindable -import org.springframework.boot.context.properties.bind.Binder -import org.springframework.boot.context.properties.source.ConfigurationPropertySources -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.core.env.Environment -import org.springframework.stereotype.Service - -@Configuration -open class ControllerBluePrintCoreConfiguration(private val bluePrintProperties: ControllerBlueprintProperties) { - - companion object { - const val PREFIX_BLUEPRINT_LOAD_CONFIGURATION = "controllerblueprints" - } - - @Bean - open fun bluePrintLoadConfiguration(): BluePrintLoadConfiguration { - return bluePrintProperties - .propertyBeanType(PREFIX_BLUEPRINT_LOAD_CONFIGURATION, BluePrintLoadConfiguration::class.java) - } -} - -@Configuration -open class ControllerBlueprintPropertyConfiguration { - @Autowired - lateinit var environment: Environment - - @Bean - open fun controllerBluePrintPropertyBinder(): Binder { - val configurationPropertySource = ConfigurationPropertySources.get(environment) - return Binder(configurationPropertySource) - } -} - -@Service -open class ControllerBlueprintProperties(private var bluePrintPropertyBinder: Binder) { - fun <T> propertyBeanType(prefix: String, type: Class<T>): T { - return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get() - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt deleted file mode 100644 index 1a45d7f5c..000000000 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2019 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.cds.controllerblueprints.service.repository - -import org.onap.ccsdk.cds.controllerblueprints.db.resources.repository.ModelContentRepository -import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModel -import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelContent - -interface ControllerBlueprintModelContentRepository : ModelContentRepository<BlueprintModel, BlueprintModelContent> diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt deleted file mode 100644 index 6e5792564..000000000 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2019 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.cds.controllerblueprints.service.repository - -import org.onap.ccsdk.cds.controllerblueprints.db.resources.repository.ModelRepository -import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModel - -interface ControllerBlueprintModelRepository : ModelRepository<BlueprintModel> diff --git a/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json b/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json deleted file mode 100644 index c482b9b30..000000000 --- a/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json +++ /dev/null @@ -1,862 +0,0 @@ -{
- "version": "1.0.0",
- "metadata": {
- "template_author": "xxxx@onap.com",
- "template_name": "default_netconf",
- "template_version": "1.0.0",
- "service-type": "XXXXXXXXXXX",
- "vnf-type": "XXXXXXXXX"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "template-name": {
- "required": true,
- "type": "string"
- },
- "template-version": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "resource-type": {
- "required": true,
- "type": "string"
- }
- },
- "node_templates": {
- "base-config-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": ""
- }
- },
- "mapping": {
- "properties": {
- "mapping": []
- }
- }
- }
- },
- "licence-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "activate-netconf-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": ""
- }
- },
- "mapping": {
- "properties": {
- "mapping": []
- }
- }
- }
- },
- "runningconfig-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "activate-netconf-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "<get-config><source><running/></source></get-config>"
- }
- },
- "mapping": {
- "properties": {
- "mapping": []
- }
- }
- }
- },
- "resource-assignment-action": {
- "type": "dg-resource-assignment",
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
-
- }
- }
- }
- },
- "capabilities": {
- "dg-node": {
-
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "get-resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- }
- },
- "activate-netconf-action": {
- "type": "dg-activate-netconf",
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ActivateNetconf": {
-
- }
- }
- }
- },
- "capabilities": {
- "dg-node": {
-
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "transaction-netconf-baseconfig",
- "relationship": "tosca.relationships.DependsOn"
- }
- }
- },
- "resource-assignment": {
- "type": "component-resource-assignment",
- "interfaces": {
- "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "resource-type": "vnf-type",
- "template-names": [
- "base-config-template",
- "licence-template"
- ],
- "request-id": { "get_input" : "request-id" },
- "resource-id": { "get_input" : "vnf-id" }
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- },
- "edit-netconf-config": {
- "type": "component-netconf-edit",
- "interfaces": {
- "org-openecomp-sdnc-netconf-adaptor-service-SimpleNetconfEditConfigNode": {
- "operations": {
- "process": {
- "inputs": {
- "rpc-message": false,
- "wait": 0,
- "unlock": false,
- "config-target": "RUNNING",
- "commit": true,
- "edit-default-operation": "repalce",
- "lock": false,
- "post-restart-wait": false,
- "pre-restart-wait": false
- },
- "outputs": {
- "rpc-response-message": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- },
- "transaction-netconf-baseconfig": {
- "type": "component-transaction-netconf",
- "interfaces": {
- "org-openecomp-sdnc-netconf-adaptor-service-NetconfTransactionNode": {
- "operations": {
- "process": {
- "inputs": {
- "rollback": false,
- "transaction-templates": [
- "runningconfig-template"
- ],
- "assignment-action-name": "resource-assignment-action",
- "transaction-components": [
- "get-netconf-config"
- ],
- "resource-type": "vnf-type",
- "initialise-sftp": false,
- "request-id": {"get_input" : "request-id"},
- "initialise-ssh": false,
- "resource-id": { "get_input" : "vnf-id" },
- "action-name": {"get_input" : "action-name"}
- },
- "outputs": {
- "rpc-response-message": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- },
- "requirements": {
- "netconf-connection": {
- "capability": "netconf",
- "node": "vdbe-netconf-device",
- "relationship": "tosca.relationships.ConnectsTo"
- }
- }
- },
- "get-netconf-config": {
- "type": "component-netconf-get",
- "interfaces": {
- "org-openecomp-sdnc-netconf-adaptor-service-SimpleNetconfGetConfigNode": {
- "operations": {
- "process": {
- "inputs": {
- "rpc-message": true,
- "wait": 1,
- "message-time-out": 10
- },
- "outputs": {
- "rpc-response-message": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- }
- }
- },
- "node_types": {
- "vnf-netconf-device": {
- "description": "This is VNF Device with Netconf and SSH Capability",
- "version": "1.0.0",
- "capabilities": {
- "netconf": {
- "type": "tosca.capabilities.Netconf",
- "properties": {
- "password": {
- "required": false,
- "type": "string"
- },
- "user-id": {
- "required": true,
- "type": "string"
- },
- "host-ip-address": {
- "required": true,
- "type": "string"
- },
- "port-number": {
- "required": true,
- "type": "integer",
- "default": 830
- },
- "message-time-out": {
- "required": false,
- "type": "integer",
- "default": 3000
- },
- "connection-time-out": {
- "required": false,
- "type": "integer",
- "default": 30
- }
- }
- },
- "ssh": {
- "type": "tosca.capabilities.Ssh",
- "properties": {
- "password": {
- "required": false,
- "type": "string"
- },
- "user-id": {
- "required": true,
- "type": "string"
- },
- "host-ip-address": {
- "required": true,
- "type": "string"
- },
- "port-number": {
- "required": true,
- "type": "integer",
- "default": 22
- },
- "message-time-out": {
- "required": false,
- "type": "integer",
- "default": 180
- },
- "connection-time-out": {
- "required": false,
- "type": "integer",
- "default": 30
- }
- }
- },
- "sftp": {
- "type": "tosca.capabilities.Sftp",
- "properties": {
- "password": {
- "required": false,
- "type": "string"
- },
- "user-id": {
- "required": true,
- "type": "string"
- },
- "host-ip-address": {
- "required": true,
- "type": "string"
- },
- "port-number": {
- "required": true,
- "type": "integer",
- "default": 22
- },
- "message-time-out": {
- "required": false,
- "type": "integer",
- "default": 180
- },
- "connection-time-out": {
- "required": false,
- "type": "integer",
- "default": 30
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Vnf"
- },
- "dg-resource-assignment": {
- "description": "This is Resource Assignment Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": false
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Workflow"
- },
- "dg-activate-netconf": {
- "description": "This is Download Netconf Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": false
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-transaction-netconf",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ActivateNetconf": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Workflow"
- },
- "artifact-config-template": {
- "description": "This is Configuration Velocity Template",
- "version": "1.0.0",
- "properties": {
- "action-names": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "capabilities": {
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "content": {
- "required": true,
- "type": "string"
- }
- }
- },
- "mapping": {
- "type": "tosca.capabilities.Mapping",
- "properties": {
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Artifact"
- },
- "component-resource-assignment": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "handler-name": {
- "description": "Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
- "required": true,
- "type": "string"
- },
- "resource-type": {
- "required": false,
- "type": "string"
- },
- "template-names": {
- "description": "Name of the Artifact Node Templates, to get the template Content.",
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- },
- "resource-id": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
- },
- "action-name": {
- "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- }
- },
- "outputs": {
- "resource-assignment-params": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "component-netconf-get": {
- "description": "This is Netconf Get Running Configuration Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-openecomp-sdnc-netconf-adaptor-service-SimpleNetconfGetConfigNode": {
- "operations": {
- "process": {
- "inputs": {
- "rpc-message": {
- "description": "It should be true, If the message is Neconf RPC message, It should be false If it is plain Config message.",
- "required": false,
- "type": "boolean",
- "default": false
- },
- "wait": {
- "required": false,
- "type": "integer",
- "default": 0
- },
- "message-time-out": {
- "required": false,
- "type": "integer",
- "default": 30
- }
- },
- "outputs": {
- "config-message": {
- "type": "string"
- },
- "status": {
- "description": "Status of the Component Execution ( success or failure )",
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "component-netconf-edit": {
- "description": "This is Netconf Edit Configuration Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-openecomp-sdnc-netconf-adaptor-service-SimpleNetconfEditConfigNode": {
- "operations": {
- "process": {
- "inputs": {
- "rpc-message": {
- "description": "If the message is Neconf RPC message,It should be true or false.",
- "required": false,
- "type": "boolean",
- "default": false
- },
- "wait": {
- "description": "Delay time in sec before performing edit-config action.",
- "required": false,
- "type": "integer",
- "default": 0
- },
- "unlock": {
- "description": "If unLock command has to send before Edit Configuration.",
- "required": false,
- "type": "boolean",
- "default": false
- },
- "config-target": {
- "required": false,
- "type": "string"
- },
- "commit": {
- "description": "Issue commit command to the device after performing edit-config action.",
- "required": false,
- "type": "boolean",
- "default": false
- },
- "edit-default-operation": {
- "required": false,
- "type": "string"
- },
- "lock": {
- "description": "Issue lock command to the device before performing edit-config action.",
- "required": false,
- "type": "boolean",
- "default": false
- },
- "post-restart-wait": {
- "description": "If Restart command should be issued before the Edit Operation, Provide the time to wait after restart. 0 meanno restart required or wait time in sec ex : 3000 for 5 ",
- "required": false,
- "type": "integer",
- "default": 0
- },
- "pre-restart-wait": {
- "description": "If Restart command should be issued after the Edit Operation, Provide the time to wait after restart. 0 meanno restart required or wait time in sec ex : 3000 for 5 ",
- "required": false,
- "type": "integer",
- "default": 0
- },
- "message-time-out": {
- "required": false,
- "type": "integer",
- "default": 30
- }
- },
- "outputs": {
- "rpc-response-message": {
- "type": "string"
- },
- "status": {
- "description": "Status of the Component Execution ( success or failure )",
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "component-transaction-netconf": {
- "description": "This is Netconf Transaction Configuration Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "requirements": {
- "netconf-connection": {
- "capability": "netconf",
- "node": "vnf-netconf-device",
- "relationship": "tosca.relationships.ConnectsTo"
- }
- },
- "interfaces": {
- "org-openecomp-sdnc-netconf-adaptor-service-NetconfTransactionNode": {
- "operations": {
- "process": {
- "inputs": {
- "rollback": {
- "required": false,
- "type": "boolean"
- },
- "transaction-templates": {
- "description": "Templates used by the Transaction Components during processing",
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "assignment-action-name": {
- "description": "Assignment Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": true,
- "type": "string"
- },
- "transaction-components": {
- "description": "Components used to used for the atomic transaction, Default Handlers are org.openecomp.sdnc.netconf.adaptor.service.SimpleNetconfEditConfigNode and org.openecomp.sdnc.netconf.adaptor.service.SimpleNetconfGetConfigNode",
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "resource-type": {
- "description": "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "initialise-sftp": {
- "required": false,
- "type": "boolean"
- },
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- },
- "initialise-ssh": {
- "required": false,
- "type": "boolean"
- },
- "resource-id": {
- "description": "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "action-name": {
- "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- }
- },
- "outputs": {
- "rpc-response-message": {
- "type": "string"
- },
- "status": {
- "description": "Status of the Component Execution ( success or failure )",
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- }
- },
- "data_types": {
- "datatype-resource-assignment": {
- "version": "1.0.0",
- "description": "This is Resource Assignment Data Type",
- "properties": {
- "property": {
- "required": true,
- "type": "datatype-property"
- },
- "input-param": {
- "required": true,
- "type": "boolean"
- },
- "dictionary-name": {
- "required": false,
- "type": "string"
- },
- "dictionary-source": {
- "required": false,
- "type": "string"
- },
- "dependencies": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.datatypes.Root"
- },
- "datatype-property": {
- "version": "1.0.0",
- "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
- "properties": {
- "type": {
- "required": true,
- "type": "string"
- },
- "description": {
- "required": false,
- "type": "string"
- },
- "required": {
- "required": false,
- "type": "boolean"
- },
- "default": {
- "required": false,
- "type": "string"
- },
- "entry_schema": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
- }
- }
-}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/data.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/data.sql deleted file mode 100644 index e69de29bb..000000000 --- a/ms/controllerblueprints/modules/service/src/main/resources/sql/data.sql +++ /dev/null diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql deleted file mode 100644 index ad5fdd054..000000000 --- a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql +++ /dev/null @@ -1,83 +0,0 @@ --- drop table sdnctl.MODEL_TYPE;
--- drop table sdnctl.RESOURCE_DICTIONARY;
--- drop table sdnctl.CONFIG_MODEL_CONTENT;
--- drop table sdnctl.CONFIG_MODEL;
-
--- -----------------------------------------------------
--- table CONFIG_MODEL
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_MODEL (
- config_model_id VARCHAR(100) NOT NULL,
- service_uuid VARCHAR(50) NULL DEFAULT NULL,
- distribution_id VARCHAR(50) NULL DEFAULT NULL,
- service_name VARCHAR(255) NULL DEFAULT NULL,
- service_description VARCHAR(255) NULL DEFAULT NULL,
- resource_uuid VARCHAR(255) NULL DEFAULT NULL,
- resource_instance_name VARCHAR(255) NULL DEFAULT NULL,
- resource_name varchar(255) null default null,
- resource_version varchar(50) null default null,
- resource_type varchar(50) null default null,
- artifact_uuid varchar(50) null default null,
- artifact_type varchar(50) not null,
- artifact_version varchar(25) not null,
- artifact_description longtext null default null,
- internal_version int(11) null default null,
- creation_date datetime not null default current_timestamp,
- artifact_name varchar(100) not null,
- published varchar(1) not null,
- updated_by varchar(100) not null,
- tags longtext null default null,
- primary key PK_CONFIG_MODEL (config_model_id),
- UNIQUE KEY UK_CONFIG_MODEL (artifact_name , artifact_version)
-) ENGINE=InnoDB;
-
-
--- -----------------------------------------------------
--- table CONFIG_MODEL_CONTENT
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_MODEL_CONTENT (
- config_model_content_id VARCHAR(100) NOT NULL,
- config_model_id INT NOT NULL,
- name VARCHAR(100) NOT NULL,
- content_type VARCHAR(50) NOT NULL,
- description LONGTEXT NULL DEFAULT NULL,
- updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- content LONGTEXT NULL DEFAULT NULL,
- PRIMARY KEY PK_CONFIG_MODEL_CONTENT (config_model_content_id),
- UNIQUE KEY UK_CONFIG_MODEL_CONTENT (config_model_id, name, content_type),
- FOREIGN KEY FK_CONFIG_MODEL_CONTENT (config_model_id) REFERENCES sdnctl.CONFIG_MODEL(config_model_id) ON DELETE CASCADE
-) ENGINE=InnoDB;
-
--- -----------------------------------------------------
--- table MODEL_TYPE
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.MODEL_TYPE (
- model_name VARCHAR(100) NOT NULL,
- derived_from VARCHAR(100) NOT NULL,
- definition_type VARCHAR(100) NOT NULL,
- definition LONGTEXT NOT NULL,
- version VARCHAR(10) NOT NULL,
- description LONGTEXT NOT NULL,
- tags LONGTEXT NULL DEFAULT NULL,
- creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(100) NOT NULL,
- PRIMARY KEY PK_MODEL_TYPE (model_name),
- INDEX IX_MODEL_TYPE (model_name)
-) ENGINE=InnoDB;
-
-
--- -----------------------------------------------------
--- table RESOURCE_DICTIONARY
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.RESOURCE_DICTIONARY (
- name VARCHAR(100) NOT NULL,
- data_type VARCHAR(100) NOT NULL,
- entry_schema VARCHAR(100) NULL DEFAULT NULL,
- definition LONGTEXT NOT NULL,
- description LONGTEXT NOT NULL,
- tags LONGTEXT NOT NULL,
- creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(100) NOT NULL,
- primary key PK_RESOURCE_DICTIONARY (name),
- INDEX IX_RESOURCE_DICTIONARY (name)
-) ENGINE=InnoDB;
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql deleted file mode 100644 index 015b03b31..000000000 --- a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql +++ /dev/null @@ -1,78 +0,0 @@ --- -----------------------------------------------------
--- table CONFIG_MODEL
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL (
- config_model_id VARCHAR(100) NOT NULL,
- service_uuid VARCHAR(50) NULL DEFAULT NULL,
- distribution_id VARCHAR(50) NULL DEFAULT NULL,
- service_name VARCHAR(255) NULL DEFAULT NULL,
- service_description VARCHAR(255) NULL DEFAULT NULL,
- resource_uuid VARCHAR(255) NULL DEFAULT NULL,
- resource_instance_name VARCHAR(255) NULL DEFAULT NULL,
- resource_name varchar(255) null default null,
- resource_version varchar(50) null default null,
- resource_type varchar(50) null default null,
- artifact_uuid varchar(50) null default null,
- artifact_type varchar(50) not null,
- artifact_version varchar(25) not null,
- artifact_description longtext null default null,
- internal_version int(11) null default null,
- creation_date datetime not null default current_timestamp,
- artifact_name varchar(100) not null,
- published varchar(1) not null,
- updated_by varchar(100) not null,
- tags longtext null default null,
- primary key PK_CONFIG_MODEL (config_model_id),
- UNIQUE KEY UK_CONFIG_MODEL (artifact_name , artifact_version)
-) ENGINE=InnoDB;
-
-
--- -----------------------------------------------------
--- table CONFIG_MODEL_CONTENT
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS configurator.CONFIG_MODEL_CONTENT (
- config_model_content_id VARCHAR(100) NOT NULL,
- config_model_id INT NOT NULL,
- name VARCHAR(100) NOT NULL,
- content_type VARCHAR(50) NOT NULL,
- description LONGTEXT NULL DEFAULT NULL,
- updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- content LONGTEXT NULL DEFAULT NULL,
- PRIMARY KEY PK_CONFIG_MODEL_CONTENT (config_model_content_id),
- UNIQUE KEY UK_CONFIG_MODEL_CONTENT (config_model_id, name, content_type),
- FOREIGN KEY FK_CONFIG_MODEL_CONTENT (config_model_id) REFERENCES configurator.CONFIG_MODEL(config_model_id) ON DELETE CASCADE
-) ENGINE=InnoDB;
-
--- -----------------------------------------------------
--- table MODEL_TYPE
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS configurator.MODEL_TYPE (
- model_name VARCHAR(100) NOT NULL,
- derived_from VARCHAR(100) NOT NULL,
- definition_type VARCHAR(100) NOT NULL,
- definition LONGTEXT NOT NULL,
- version VARCHAR(10) NOT NULL,
- description LONGTEXT NOT NULL,
- tags LONGTEXT NULL DEFAULT NULL,
- creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(100) NOT NULL,
- PRIMARY KEY PK_MODEL_TYPE (model_name),
- INDEX IX_MODEL_TYPE (model_name)
-) ENGINE=InnoDB;
-
-
--- -----------------------------------------------------
--- table RESOURCE_DICTIONARY
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS configurator.RESOURCE_DICTIONARY (
- name VARCHAR(100) NOT NULL,
- data_type VARCHAR(100) NOT NULL,
- entry_schema VARCHAR(100) NULL DEFAULT NULL,
- definition LONGTEXT NOT NULL,
- description LONGTEXT NOT NULL,
- tags LONGTEXT NOT NULL,
- creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(100) NOT NULL,
- primary key PK_RESOURCE_DICTIONARY (name),
- INDEX IX_RESOURCE_DICTIONARY (name)
-) ENGINE=InnoDB;
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/cds/controllerblueprints/DatabaseConfig.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/cds/controllerblueprints/DatabaseConfig.java deleted file mode 100644 index 658d3072f..000000000 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/cds/controllerblueprints/DatabaseConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints; - -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.jpa.repository.config.EnableJpaAuditing; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import javax.sql.DataSource; - -/** - * DatabaseConfig.java Purpose: Provide Configuration Generator DatabaseConfig Information - * - * @author Brinda Santh - * @version 1.0 - */ -@Configuration -@EntityScan("org.onap.ccsdk.cds.controllerblueprints.service.domain") -@EnableTransactionManagement -@EnableJpaRepositories("org.onap.ccsdk.cds.controllerblueprints.service.repository") -@EnableJpaAuditing -public class DatabaseConfig { - /** - * This is a entityManagerFactory method - * - * @param dataSource - * @return LocalContainerEntityManagerFactoryBean - */ - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) { - HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - vendorAdapter.setGenerateDdl(true); - vendorAdapter.setShowSql(false); - LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); - factory.setJpaVendorAdapter(vendorAdapter); - factory.setPackagesToScan("org.onap.ccsdk.cds.controllerblueprints.service.domain"); - factory.setDataSource(dataSource); - return factory; - } - -} diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/cds/controllerblueprints/TestApplication.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/cds/controllerblueprints/TestApplication.java deleted file mode 100644 index d5ea7bc5d..000000000 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/cds/controllerblueprints/TestApplication.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; - - -@SpringBootApplication -@ComponentScan(basePackages = {"org.onap.ccsdk.cds.controllerblueprints"}) -@EnableAutoConfiguration -public class TestApplication { - - public static void main(String[] args) { - SpringApplication.run(TestApplication.class, args); - } - -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/cds/controllerblueprints/service/repository/ModelTypeReactRepositoryTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/cds/controllerblueprints/service/repository/ModelTypeReactRepositoryTest.java deleted file mode 100644 index 26b162494..000000000 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/cds/controllerblueprints/service/repository/ModelTypeReactRepositoryTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.repository; - -import org.junit.Assert; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.onap.ccsdk.cds.controllerblueprints.TestApplication; -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants; -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils; -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.annotation.Commit; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.Arrays; -import java.util.List; - -/** - * ModelTypeReactRepositoryTest. - * - * @author Brinda Santh - */ - -@RunWith(SpringRunner.class) -@DataJpaTest -@ContextConfiguration(classes = {TestApplication.class}) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class ModelTypeReactRepositoryTest { - - @Autowired - private ModelTypeReactRepository modelTypeReactRepository; - - String modelName = "test-datatype"; - - @Test - @Commit - public void test01Save() { - String content = JacksonUtils.Companion.getClassPathFileContent("model_type/data_type/datatype-property.json"); - ModelType modelType = new ModelType(); - modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE); - modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT); - modelType.setDescription("Definition for Sample Datatype "); - modelType.setDefinition(JacksonUtils.Companion.jsonNode(content)); - modelType.setModelName(modelName); - modelType.setVersion("1.0.0"); - modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," - + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE); - modelType.setUpdatedBy("xxxxxx@xxx.com"); - - ModelType dbModelType = modelTypeReactRepository.save(modelType).block(); - Assert.assertNotNull("Failed to get Saved ModelType", dbModelType); - } - - @Test - public void test02Finds() { - ModelType dbFindByModelName = modelTypeReactRepository.findByModelName(modelName).block(); - Assert.assertNotNull("Failed to findByModelName ", dbFindByModelName); - - List<ModelType> dbFindByDefinitionType = - modelTypeReactRepository.findByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE).collectList().block(); - Assert.assertNotNull("Failed to findByDefinitionType ", dbFindByDefinitionType); - Assert.assertTrue("Failed to findByDefinitionType count", dbFindByDefinitionType.size() > 0); - - List<ModelType> dbFindByDerivedFrom = - modelTypeReactRepository.findByDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT).collectList().block(); - Assert.assertNotNull("Failed to find findByDerivedFrom", dbFindByDerivedFrom); - Assert.assertTrue("Failed to find findByDerivedFrom by count", dbFindByDerivedFrom.size() > 0); - - List<ModelType> dbFindByModelNameIn = - modelTypeReactRepository.findByModelNameIn(Arrays.asList(modelName)).collectList().block(); - Assert.assertNotNull("Failed to findByModelNameIn ", dbFindByModelNameIn); - Assert.assertTrue("Failed to findByModelNameIn by count", dbFindByModelNameIn.size() > 0); - - List<ModelType> dbFindByDefinitionTypeIn = - modelTypeReactRepository.findByDefinitionTypeIn(Arrays.asList(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)).collectList().block(); - Assert.assertNotNull("Failed to findByDefinitionTypeIn", dbFindByDefinitionTypeIn); - Assert.assertTrue("Failed to findByDefinitionTypeIn by count", dbFindByDefinitionTypeIn.size() > 0); - - List<ModelType> dbFindByDerivedFromIn = - modelTypeReactRepository.findByDerivedFromIn(Arrays.asList(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)).collectList().block(); - Assert.assertNotNull("Failed to find findByDerivedFromIn", dbFindByDerivedFromIn); - Assert.assertTrue("Failed to find findByDerivedFromIn by count", dbFindByDerivedFromIn.size() > 0); - } - - @Test - @Commit - public void test03Delete() { - modelTypeReactRepository.deleteByModelName(modelName).block(); - } - -} diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties deleted file mode 100755 index 5ddc8a60f..000000000 --- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright © 2017-2018 AT&T Intellectual Property. -# Modifications Copyright © 2018 IBM. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -spring.main.banner-mode=off -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false -logging.level.org.springframework.web=INFO -logging.level.org.hibernate.SQL=warn -logging.level.org.hibernate.type.descriptor.sql=debug -# Load Resource Source Mappings -resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability -# Controller Blueprints Core Configuration -controllerblueprints.blueprintDeployPath=./target/blueprints/deploy -controllerblueprints.blueprintArchivePath=./target/blueprints/archive -controllerblueprints.blueprintWorkingPath=./target/blueprints/work -# Controller Blueprint Load Configurations -controllerblueprints.loadInitialData=false -controllerblueprints.loadBluePrint=false -controllerblueprints.loadBluePrintPaths=./../../../../components/model-catalog/blueprint-model/test-blueprint -controllerblueprints.loadModelType=false -controllerblueprints.loadModeTypePaths=./../../../../components/model-catalog/definition-type/starter-type -controllerblueprints.loadResourceDictionary=false -controllerblueprints.loadResourceDictionaryPaths=./../../../../components/model-catalog/resource-dictionary/starter-dictionary - -# CBA file extension -controllerblueprints.loadCbaExtension=zip - -# CBA examples for tests cases -controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint diff --git a/ms/controllerblueprints/modules/service/src/test/resources/model_type/data_type/datatype-property.json b/ms/controllerblueprints/modules/service/src/test/resources/model_type/data_type/datatype-property.json deleted file mode 100644 index 5584b10ea..000000000 --- a/ms/controllerblueprints/modules/service/src/test/resources/model_type/data_type/datatype-property.json +++ /dev/null @@ -1,27 +0,0 @@ -{
- "version": "1.0.0",
- "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
- "properties": {
- "type": {
- "required": true,
- "type": "string"
- },
- "description": {
- "required": false,
- "type": "string"
- },
- "required": {
- "required": false,
- "type": "boolean"
- },
- "default": {
- "required": false,
- "type": "string"
- },
- "entry_schema": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
-}
\ No newline at end of file diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml index 0026fe49c..3021c4032 100644 --- a/ms/controllerblueprints/parent/pom.xml +++ b/ms/controllerblueprints/parent/pom.xml @@ -222,24 +222,9 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>db-resources</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> <artifactId>blueprint-validation</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>service</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>application</artifactId> - <version>${project.version}</version> - </dependency> <!-- Testing Dependencies --> <dependency> diff --git a/ms/controllerblueprints/pom.xml b/ms/controllerblueprints/pom.xml index 17d97f6ec..909dfa4fe 100644 --- a/ms/controllerblueprints/pom.xml +++ b/ms/controllerblueprints/pom.xml @@ -40,7 +40,5 @@ <modules> <module>parent</module> <module>modules</module> - <module>application</module> - <module>distribution</module> </modules> </project> |