From 9a4661e152260c6daedf9dcbc1a65363d8f03d9b Mon Sep 17 00:00:00 2001 From: sebdet Date: Fri, 11 Oct 2019 18:23:57 +0200 Subject: Align on release 4.1.3 Align the charts on the 4.1.3 clamp containers + fix the dcae parameters to https4 + remove old db files Issue-ID: CLAMP-513 Change-Id: I0429d1888f78d1a0f5ed7543cf0f9bb9cd77e652 Signed-off-by: sebdet --- kubernetes/clamp/charts/clamp-backend/values.yaml | 5 +- .../clamp/charts/clamp-dash-kibana/values.yaml | 2 +- .../clamp/charts/clamp-dash-logstash/values.yaml | 2 +- .../bootstrap-database.sh | 28 ++ .../bulkload/clds-create-db-objects.sql | 240 --------- .../bulkload/clds-stored-procedures.sql | 549 --------------------- .../bulkload/create-db.sql | 11 + .../bulkload/create-tables.sql | 15 +- .../drop/clds-drop-db-objects.sql | 54 -- .../load-sql-files-tests-automation.sh | 33 -- 10 files changed, 45 insertions(+), 894 deletions(-) create mode 100755 kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bootstrap-database.sh delete mode 100644 kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-create-db-objects.sql delete mode 100644 kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-stored-procedures.sql create mode 100644 kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-db.sql delete mode 100644 kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/drop/clds-drop-db-objects.sql delete mode 100755 kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh (limited to 'kubernetes/clamp/charts') diff --git a/kubernetes/clamp/charts/clamp-backend/values.yaml b/kubernetes/clamp/charts/clamp-backend/values.yaml index a72d0c5857..498149412a 100644 --- a/kubernetes/clamp/charts/clamp-backend/values.yaml +++ b/kubernetes/clamp/charts/clamp-backend/values.yaml @@ -27,7 +27,7 @@ flavor: small # application image repository: nexus3.onap.org:10001 -image: onap/clamp-backend:4.1.2 +image: onap/clamp-backend:4.1.3 pullPolicy: Always # flag to enable debugging - application support required @@ -45,13 +45,14 @@ config: springApplicationJson: > { "spring.datasource.cldsdb.url": "jdbc:mariadb:sequential://clampdb.{{ include "common.namespace" . }}:3306/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3", + "spring.profiles.active": "clamp-default,clamp-default-user,clamp-sdc-controller-new", "clamp.config.sdc.catalog.url": "http://sdc-be.{{ include "common.namespace" . }}:8080/sdc/v1/catalog/", "clamp.config.sdc.hostUrl": "http://sdc-be.{{ include "common.namespace" . }}:8080/", "clamp.config.sdc.serviceUrl": "http://sdc-be.{{ include "common.namespace" . }}:8080/sdc/v1/catalog/services", "clamp.config.sdc.serviceUsername": "clamp", "clamp.config.sdc.servicePassword": "b7acccda32b98c5bb7acccda32b98c5b05D511BD6D93626E90D18E9D24D9B78CD34C7EE8012F0A189A28763E82271E50A5D4EC10C7D93E06E0A2D27CAE66B981", "clamp.config.files.sdcController": "file:/opt/clamp/sdc-controllers-config.json", - "clamp.config.dcae.inventory.url": "https://inventory.{{ include "common.namespace" . }}:8080", + "clamp.config.dcae.inventory.url": "https4://inventory.{{ include "common.namespace" . }}:8080", "clamp.config.dcae.dispatcher.url": "https4://deployment-handler.{{ include "common.namespace" . }}:8443", "clamp.config.dcae.deployment.url": "https4://deployment-handler.{{ include "common.namespace" . }}:8443", "clamp.config.dcae.deployment.userName": "none", diff --git a/kubernetes/clamp/charts/clamp-dash-kibana/values.yaml b/kubernetes/clamp/charts/clamp-dash-kibana/values.yaml index 94e14b5b65..88587160e9 100644 --- a/kubernetes/clamp/charts/clamp-dash-kibana/values.yaml +++ b/kubernetes/clamp/charts/clamp-dash-kibana/values.yaml @@ -34,7 +34,7 @@ busyboxImage: library/busybox:latest # application image repository: nexus3.onap.org:10001 -image: onap/clamp-dashboard-kibana:4.1.2 +image: onap/clamp-dashboard-kibana:4.1.3 pullPolicy: Always # flag to enable debugging - application support required diff --git a/kubernetes/clamp/charts/clamp-dash-logstash/values.yaml b/kubernetes/clamp/charts/clamp-dash-logstash/values.yaml index 689977db05..20bf974157 100644 --- a/kubernetes/clamp/charts/clamp-dash-logstash/values.yaml +++ b/kubernetes/clamp/charts/clamp-dash-logstash/values.yaml @@ -30,7 +30,7 @@ flavor: small # application image repository: nexus3.onap.org:10001 -image: onap/clamp-dashboard-logstash:4.1.2 +image: onap/clamp-dashboard-logstash:4.1.3 pullPolicy: Always # flag to enable debugging - application support required diff --git a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bootstrap-database.sh b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bootstrap-database.sh new file mode 100755 index 0000000000..224a813db9 --- /dev/null +++ b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bootstrap-database.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +### +# ============LICENSE_START======================================================= +# ONAP CLAMP +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END============================================ +# =================================================================== +# +### + +mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < /docker-entrypoint-initdb.d/bulkload/create-db.sql +## New model creation +mysql -uroot -p$MYSQL_ROOT_PASSWORD -f cldsdb4 < /docker-entrypoint-initdb.d/bulkload/create-tables.sql diff --git a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-create-db-objects.sql b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-create-db-objects.sql deleted file mode 100644 index a6beca2b09..0000000000 --- a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-create-db-objects.sql +++ /dev/null @@ -1,240 +0,0 @@ -/* Copyright © 2017-2019 AT&T, Amdocs, 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. -*/ - -# -# Create CLDS database objects (tables, etc.) -# -# -CREATE DATABASE `cldsdb4`; -USE `cldsdb4`; -DROP USER 'clds'; -CREATE USER 'clds'; -GRANT ALL on cldsdb4.* to 'clds' identified by 'sidnnd83K' with GRANT OPTION; -GRANT SELECT on mysql.proc TO 'clds'; -FLUSH PRIVILEGES; - - -CREATE TABLE template ( - template_id VARCHAR(36) NOT NULL, - template_name VARCHAR(80) NOT NULL, - template_bpmn_id VARCHAR(36) NULL, - template_image_id VARCHAR(36) NULL, - template_doc_id VARCHAR(36) NULL, - PRIMARY KEY (template_id), - UNIQUE (template_name) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE template_bpmn ( - template_bpmn_id VARCHAR(36) NOT NULL, - template_id VARCHAR(36) NOT NULL, - template_bpmn_text MEDIUMTEXT NOT NULL, - user_id VARCHAR(80), - timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (template_bpmn_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE template_image ( - template_image_id VARCHAR(36) NOT NULL, - template_id VARCHAR(36) NOT NULL, - template_image_text MEDIUMTEXT NULL, - user_id VARCHAR(80), - timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (template_image_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE template_doc ( - template_doc_id VARCHAR(36) NOT NULL, - template_id VARCHAR(36) NOT NULL, - template_doc_text MEDIUMTEXT NULL, - user_id VARCHAR(80), - timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (template_doc_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE model ( - model_id VARCHAR(36) NOT NULL, - model_name VARCHAR(80) NOT NULL, - template_id VARCHAR(36) NULL, - model_prop_id VARCHAR(36) NULL, - model_blueprint_id VARCHAR(36) NULL, - event_id VARCHAR(36) NULL, - control_name_prefix VARCHAR(80) NULL, - control_name_uuid VARCHAR(36) NOT NULL, - service_type_id VARCHAR(80) NULL, - deployment_id VARCHAR(80) NULL, - deployment_status_url VARCHAR(300) NULL, - PRIMARY KEY (model_id), - UNIQUE (model_name), - UNIQUE (control_name_uuid), - UNIQUE (service_type_id), - UNIQUE (deployment_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE model_properties ( - model_prop_id VARCHAR(36) NOT NULL, - model_id VARCHAR(36) NOT NULL, - model_prop_text MEDIUMTEXT NULL, - user_id VARCHAR(80), - timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (model_prop_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE model_blueprint ( - model_blueprint_id VARCHAR(36) NOT NULL, - model_id VARCHAR(36) NOT NULL, - model_blueprint_text MEDIUMTEXT NULL, - user_id VARCHAR(80), - timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (model_blueprint_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE model_instance ( - model_instance_id VARCHAR(36) NOT NULL, - model_id VARCHAR(36) NOT NULL, - vm_name VARCHAR(250) NOT NULL, - location VARCHAR(250) NULL, - timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (model_instance_id), - UNIQUE (model_id, vm_name) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE event ( - event_id VARCHAR(36) NOT NULL, - model_id VARCHAR(36) NULL, - action_cd VARCHAR(80) NOT NULL, - action_state_cd VARCHAR(80) NULL, - prev_event_id VARCHAR(36) NULL, - process_instance_id VARCHAR(80) NULL, - user_id VARCHAR(80) NULL, - timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (event_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE IF NOT EXISTS tosca_model ( - tosca_model_id VARCHAR(36) NOT NULL, - tosca_model_name VARCHAR(80) NOT NULL, - policy_type VARCHAR(80) NULL, - user_id VARCHAR(80), - timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (tosca_model_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE IF NOT EXISTS tosca_model_revision ( - tosca_model_revision_id VARCHAR(36) NOT NULL, - tosca_model_id VARCHAR(36) NOT NULL, - version DOUBLE NOT NULL DEFAULT 1, - tosca_model_yaml MEDIUMTEXT NULL, - tosca_model_json MEDIUMTEXT NULL, - user_id VARCHAR(80), - createdTimestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - lastUpdatedTimestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (tosca_model_revision_id), - CONSTRAINT tosca_model_revision_ukey UNIQUE KEY (tosca_model_id, version), - CONSTRAINT tosca_model_revision_fkey01 FOREIGN KEY (tosca_model_id) REFERENCES tosca_model (tosca_model_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE IF NOT EXISTS dictionary ( - dictionary_id VARCHAR(36) NOT NULL, - dictionary_name VARCHAR(80) NOT NULL, - created_by VARCHAR(80), - modified_by VARCHAR(80), - timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (dictionary_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -CREATE TABLE IF NOT EXISTS dictionary_elements ( - dict_element_id VARCHAR(36) NOT NULL, - dictionary_id VARCHAR(36) NOT NULL, - dict_element_name VARCHAR(250) NOT NULL, - dict_element_short_name VARCHAR(80) NOT NULL, - dict_element_description VARCHAR(250), - dict_element_type VARCHAR(80) NOT NULL, - created_by VARCHAR(80), - modified_by VARCHAR(80), - timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (dict_element_id), - CONSTRAINT dictionary_elements_ukey UNIQUE KEY (dict_element_name, dict_element_short_name), - CONSTRAINT dictionary_elements_ukey_fkey01 FOREIGN KEY (dictionary_id) REFERENCES dictionary (dictionary_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -ALTER TABLE template - ADD CONSTRAINT template_bpmn_id_fkey01 - FOREIGN KEY (template_bpmn_id) - REFERENCES template_bpmn (template_bpmn_id); - -ALTER TABLE template - ADD CONSTRAINT template_image_id_fkey01 - FOREIGN KEY (template_image_id) - REFERENCES template_image (template_image_id); - -ALTER TABLE template - ADD CONSTRAINT template_doc_id_fkey01 - FOREIGN KEY (template_doc_id) - REFERENCES template_doc (template_doc_id); - -ALTER TABLE template_bpmn - ADD CONSTRAINT template_id_fkey02 - FOREIGN KEY (template_id) - REFERENCES template (template_id); - -ALTER TABLE template_image - ADD CONSTRAINT template_id_fkey03 - FOREIGN KEY (template_id) - REFERENCES template (template_id); - -ALTER TABLE template_doc - ADD CONSTRAINT template_id_fkey04 - FOREIGN KEY (template_id) - REFERENCES template (template_id); - -ALTER TABLE model - ADD CONSTRAINT template_id_fkey01 - FOREIGN KEY (template_id) - REFERENCES template (template_id); - -ALTER TABLE model - ADD CONSTRAINT model_prop_id_fkey01 - FOREIGN KEY (model_prop_id) - REFERENCES model_properties (model_prop_id); - -ALTER TABLE model - ADD CONSTRAINT model_blueprint_id_fkey01 - FOREIGN KEY (model_blueprint_id) - REFERENCES model_blueprint (model_blueprint_id); - -ALTER TABLE model - ADD CONSTRAINT event_id_fkey01 - FOREIGN KEY (event_id) - REFERENCES event (event_id); - -ALTER TABLE model_properties - ADD CONSTRAINT model_id_fkey01 - FOREIGN KEY (model_id) - REFERENCES model (model_id); - -ALTER TABLE model_blueprint - ADD CONSTRAINT model_id_fkey02 - FOREIGN KEY (model_id) - REFERENCES model (model_id); - -ALTER TABLE model_instance - ADD CONSTRAINT model_id_fkey04 - FOREIGN KEY (model_id) - REFERENCES model (model_id); - -ALTER TABLE event - ADD CONSTRAINT model_id_fkey03 - FOREIGN KEY (model_id) - REFERENCES model (model_id); diff --git a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-stored-procedures.sql b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-stored-procedures.sql deleted file mode 100644 index a590fed04e..0000000000 --- a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-stored-procedures.sql +++ /dev/null @@ -1,549 +0,0 @@ -/* Copyright © 2017 AT&T, Amdocs, 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. -*/ - -# -# CLDS stored procedures -# - -USE cldsdb4; - -DROP PROCEDURE IF EXISTS upd_event; -DROP PROCEDURE IF EXISTS ins_event; -DROP PROCEDURE IF EXISTS del_all_model_instances; -DROP PROCEDURE IF EXISTS del_model_instance; -DROP PROCEDURE IF EXISTS ins_model_instance; -DROP PROCEDURE IF EXISTS set_model; -DROP PROCEDURE IF EXISTS get_model; -DROP PROCEDURE IF EXISTS get_model_template; -DROP PROCEDURE IF EXISTS set_template; -DROP PROCEDURE IF EXISTS get_template; -DROP PROCEDURE IF EXISTS del_model; -DROP PROCEDURE IF EXISTS set_new_tosca_model_version; -DROP PROCEDURE IF EXISTS set_tosca_model; -DROP PROCEDURE IF EXISTS set_dictionary; -DROP PROCEDURE IF EXISTS set_dictionary_elements; -DELIMITER // -CREATE PROCEDURE get_template - (IN v_template_name VARCHAR(80), - OUT v_template_id VARCHAR(36), - OUT v_template_bpmn_id VARCHAR(36), - OUT v_template_bpmn_user_id VARCHAR(80), - OUT v_template_bpmn_text MEDIUMTEXT, - OUT v_template_image_id VARCHAR(36), - OUT v_template_image_user_id VARCHAR(80), - OUT v_template_image_text MEDIUMTEXT, - OUT v_template_doc_id VARCHAR(36), - OUT v_template_doc_user_id VARCHAR(80), - OUT v_template_doc_text MEDIUMTEXT) -BEGIN - SELECT t.template_id, - tb.template_bpmn_id, - tb.user_id, - tb.template_bpmn_text, - ti.template_image_id, - ti.user_id, - ti.template_image_text, - td.template_doc_id, - td.user_id, - td.template_doc_text - INTO v_template_id, - v_template_bpmn_id, - v_template_bpmn_user_id, - v_template_bpmn_text, - v_template_image_id, - v_template_image_user_id, - v_template_image_text, - v_template_doc_id, - v_template_doc_user_id, - v_template_doc_text - FROM template t, - template_bpmn tb, - template_image ti, - template_doc td - WHERE t.template_bpmn_id = tb.template_bpmn_id - AND t.template_image_id = ti.template_image_id - AND t.template_doc_id = td.template_doc_id - AND t.template_name = v_template_name; -END; -CREATE PROCEDURE set_template - (IN v_template_name VARCHAR(80), - IN v_user_id VARCHAR(80), - IN v_template_bpmn_text MEDIUMTEXT, - IN v_template_image_text MEDIUMTEXT, - IN v_template_doc_text MEDIUMTEXT, - OUT v_template_id VARCHAR(36), - OUT v_template_bpmn_id VARCHAR(36), - OUT v_template_bpmn_user_id VARCHAR(80), - OUT v_template_image_id VARCHAR(36), - OUT v_template_image_user_id VARCHAR(80), - OUT v_template_doc_id VARCHAR(36), - OUT v_template_doc_user_id VARCHAR(80)) -BEGIN - DECLARE v_old_template_bpmn_text MEDIUMTEXT; - DECLARE v_old_template_image_text MEDIUMTEXT; - DECLARE v_old_template_doc_text MEDIUMTEXT; - SET v_template_id = NULL; - CALL get_template( - v_template_name, - v_template_id, - v_template_bpmn_id, - v_template_bpmn_user_id, - v_old_template_bpmn_text, - v_template_image_id, - v_template_image_user_id, - v_old_template_image_text, - v_template_doc_id, - v_template_doc_user_id, - v_old_template_doc_text); - IF v_template_id IS NULL THEN - BEGIN - SET v_template_id = UUID(); - INSERT INTO template - (template_id, template_name) - VALUES (v_template_id, v_template_name); - END; - END IF; - IF v_template_bpmn_id IS NULL OR v_template_bpmn_text <> v_old_template_bpmn_text THEN - SET v_template_bpmn_id = UUID(); - INSERT INTO template_bpmn - (template_bpmn_id, template_id, template_bpmn_text, user_id) - VALUES (v_template_bpmn_id, v_template_id, v_template_bpmn_text, v_user_id); - SET v_template_bpmn_user_id = v_user_id; - END IF; - IF v_template_image_id IS NULL OR v_template_image_text <> v_old_template_image_text THEN - SET v_template_image_id = UUID(); - INSERT INTO template_image - (template_image_id, template_id, template_image_text, user_id) - VALUES (v_template_image_id, v_template_id, v_template_image_text, v_user_id); - SET v_template_image_user_id = v_user_id; - END IF; - IF v_template_doc_id IS NULL OR v_template_doc_text <> v_old_template_doc_text THEN - SET v_template_doc_id = UUID(); - INSERT INTO template_doc - (template_doc_id, template_id, template_doc_text, user_id) - VALUES (v_template_doc_id, v_template_id, v_template_doc_text, v_user_id); - SET v_template_doc_user_id = v_user_id; - END IF; - UPDATE template - SET template_bpmn_id = v_template_bpmn_id, - template_image_id = v_template_image_id, - template_doc_id = v_template_doc_id - WHERE template_id = v_template_id; -END; -CREATE PROCEDURE get_model - (IN v_model_name VARCHAR(80), - OUT v_control_name_prefix VARCHAR(80), - INOUT v_control_name_uuid VARCHAR(36), - OUT v_model_id VARCHAR(36), - OUT v_service_type_id VARCHAR(80), - OUT v_deployment_id VARCHAR(80), - OUT v_deployment_status_url VARCHAR(300), - OUT v_template_name VARCHAR(80), - OUT v_template_id VARCHAR(36), - OUT v_model_prop_id VARCHAR(36), - OUT v_model_prop_user_id VARCHAR(80), - OUT v_model_prop_text MEDIUMTEXT, - OUT v_model_blueprint_id VARCHAR(36), - OUT v_model_blueprint_user_id VARCHAR(80), - OUT v_model_blueprint_text MEDIUMTEXT, - OUT v_event_id VARCHAR(36), - OUT v_action_cd VARCHAR(80), - OUT v_action_state_cd VARCHAR(80), - OUT v_event_process_instance_id VARCHAR(80), - OUT v_event_user_id VARCHAR(80)) -BEGIN - SELECT m.control_name_prefix, - m.control_name_uuid, - m.model_id, - m.service_type_id, - m.deployment_id, - m.deployment_status_url, - t.template_name, - m.template_id, - mp.model_prop_id, - mp.user_id, - mp.model_prop_text, - mb.model_blueprint_id, - mb.user_id, - mb.model_blueprint_text, - e.event_id, - e.action_cd, - e.action_state_cd, - e.process_instance_id, - e.user_id - INTO v_control_name_prefix, - v_control_name_uuid, - v_model_id, - v_service_type_id, - v_deployment_id, - v_deployment_status_url, - v_template_name, - v_template_id, - v_model_prop_id, - v_model_prop_user_id, - v_model_prop_text, - v_model_blueprint_id, - v_model_blueprint_user_id, - v_model_blueprint_text, - v_event_id, - v_action_cd, - v_action_state_cd, - v_event_process_instance_id, - v_event_user_id - FROM model m, - template t, - model_properties mp, - model_blueprint mb, - event e - WHERE m.template_id = t.template_id - AND m.model_prop_id = mp.model_prop_id - AND m.model_blueprint_id = mb.model_blueprint_id - AND m.event_id = e.event_id - AND (m.model_name = v_model_name - OR m.control_name_uuid = v_control_name_uuid); - SELECT model_instance_id, - vm_name, - location, - timestamp - FROM model_instance - WHERE model_id = v_model_id - ORDER BY 2; -END; -CREATE PROCEDURE get_model_template - (IN v_model_name VARCHAR(80), - OUT v_control_name_prefix VARCHAR(80), - INOUT v_control_name_uuid VARCHAR(36), - OUT v_model_id VARCHAR(36), - OUT v_service_type_id VARCHAR(80), - OUT v_deployment_id VARCHAR(80), - OUT v_deployment_status_url VARCHAR(300), - OUT v_template_name VARCHAR(80), - OUT v_template_id VARCHAR(36), - OUT v_model_prop_id VARCHAR(36), - OUT v_model_prop_user_id VARCHAR(80), - OUT v_model_prop_text MEDIUMTEXT, - OUT v_model_blueprint_id VARCHAR(36), - OUT v_model_blueprint_user_id VARCHAR(80), - OUT v_model_blueprint_text MEDIUMTEXT, - OUT v_template_bpmn_id VARCHAR(36), - OUT v_template_bpmn_user_id VARCHAR(80), - OUT v_template_bpmn_text MEDIUMTEXT, - OUT v_template_image_id VARCHAR(36), - OUT v_template_image_user_id VARCHAR(80), - OUT v_template_image_text MEDIUMTEXT, - OUT v_template_doc_id VARCHAR(36), - OUT v_template_doc_user_id VARCHAR(80), - OUT v_template_doc_text MEDIUMTEXT, - OUT v_event_id VARCHAR(36), - OUT v_action_cd VARCHAR(80), - OUT v_action_state_cd VARCHAR(80), - OUT v_event_process_instance_id VARCHAR(80), - OUT v_event_user_id VARCHAR(80)) -BEGIN - CALL get_model( - v_model_name, - v_control_name_prefix, - v_control_name_uuid, - v_model_id, - v_service_type_id, - v_deployment_id, - v_deployment_status_url, - v_template_name, - v_template_id, - v_model_prop_id, - v_model_prop_user_id, - v_model_prop_text, - v_model_blueprint_id, - v_model_blueprint_user_id, - v_model_blueprint_text, - v_event_id, - v_action_cd, - v_action_state_cd, - v_event_process_instance_id, - v_event_user_id); - CALL get_template( - v_template_name, - v_template_id, - v_template_bpmn_id, - v_template_bpmn_user_id, - v_template_bpmn_text, - v_template_image_id, - v_template_image_user_id, - v_template_image_text, - v_template_doc_id, - v_template_doc_user_id, - v_template_doc_text); - END; -CREATE PROCEDURE set_model - (IN v_model_name VARCHAR(80), - IN v_template_id VARCHAR(36), - IN v_user_id VARCHAR(80), - IN v_model_prop_text MEDIUMTEXT, - IN v_model_blueprint_text MEDIUMTEXT, - IN v_service_type_id VARCHAR(80), - IN v_deployment_id VARCHAR(80), - IN v_deployment_status_url VARCHAR(300), - INOUT v_control_name_prefix VARCHAR(80), - INOUT v_control_name_uuid VARCHAR(36), - OUT v_model_id VARCHAR(36), - OUT v_model_prop_id VARCHAR(36), - OUT v_model_prop_user_id VARCHAR(80), - OUT v_model_blueprint_id VARCHAR(36), - OUT v_model_blueprint_user_id VARCHAR(80), - OUT v_event_id VARCHAR(36), - OUT v_action_cd VARCHAR(80), - OUT v_action_state_cd VARCHAR(80), - OUT v_event_process_instance_id VARCHAR(80), - OUT v_event_user_id VARCHAR(80)) -BEGIN - DECLARE v_old_template_name VARCHAR(80); - DECLARE v_old_template_id VARCHAR(36); - DECLARE v_old_control_name_prefix VARCHAR(80); - DECLARE v_old_control_name_uuid VARCHAR(36); - DECLARE v_old_model_prop_text MEDIUMTEXT; - DECLARE v_old_model_blueprint_text MEDIUMTEXT; - DECLARE v_old_service_type_id VARCHAR(80); - DECLARE v_old_deployment_id VARCHAR(80); - DECLARE v_old_deployment_status_url VARCHAR(300); - SET v_model_id = NULL; - CALL get_model( - v_model_name, - v_old_control_name_prefix, - v_old_control_name_uuid, - v_model_id, - v_old_service_type_id, - v_old_deployment_id, - v_old_deployment_status_url, - v_old_template_name, - v_old_template_id, - v_model_prop_id, - v_model_prop_user_id, - v_old_model_prop_text, - v_model_blueprint_id, - v_model_blueprint_user_id, - v_old_model_blueprint_text, - v_event_id, - v_action_cd, - v_action_state_cd, - v_event_process_instance_id, - v_event_user_id); - IF v_model_id IS NULL THEN - BEGIN - # UUID can be provided initially but cannot be updated - # if not provided (this is expected) then it will be set here - IF v_control_name_uuid IS NULL THEN - SET v_control_name_uuid = UUID(); - END IF; - SET v_model_id = v_control_name_uuid; - INSERT INTO model - (model_id, model_name, template_id, control_name_prefix, control_name_uuid, service_type_id, deployment_id, deployment_status_url) - VALUES (v_model_id, v_model_name, v_template_id, v_control_name_prefix, v_control_name_uuid, v_service_type_id, v_deployment_id,v_deployment_status_url); - # since just created model, insert CREATED event as initial default event - SET v_action_cd = 'CREATE'; - SET v_action_state_cd = 'COMPLETED'; - SET v_event_user_id = v_user_id; - SET v_event_id = UUID(); - INSERT INTO event - (event_id, model_id, action_cd, action_state_cd, user_id) - VALUES (v_event_id, v_model_id, v_action_cd, v_action_state_cd, v_event_user_id); - UPDATE model - SET event_id = v_event_id - WHERE model_id = v_model_id; - END; - ELSE - BEGIN - # use old control_name_prefix if null value is provided - IF v_control_name_prefix IS NULL THEN - SET v_control_name_prefix = v_old_control_name_prefix; - END IF; - # UUID can not be updated after initial insert - SET v_control_name_uuid = v_old_control_name_uuid; - END; - END IF; - IF v_model_prop_id IS NULL OR v_model_prop_text <> v_old_model_prop_text THEN - SET v_model_prop_id = UUID(); - INSERT INTO model_properties - (model_prop_id, model_id, model_prop_text, user_id) - VALUES (v_model_prop_id, v_model_id, v_model_prop_text, v_user_id); - SET v_model_prop_user_id = v_user_id; - END IF; - IF v_model_blueprint_id IS NULL OR v_model_blueprint_text <> v_old_model_blueprint_text THEN - SET v_model_blueprint_id = UUID(); - INSERT INTO model_blueprint - (model_blueprint_id, model_id, model_blueprint_text, user_id) - VALUES (v_model_blueprint_id, v_model_id, v_model_blueprint_text, v_user_id); - SET v_model_blueprint_user_id = v_user_id; - END IF; - UPDATE model - SET control_name_prefix = v_control_name_prefix, - model_prop_id = v_model_prop_id, - model_blueprint_id = v_model_blueprint_id, - service_type_id = v_service_type_id, - deployment_id = v_deployment_id, - deployment_status_url = v_deployment_status_url - WHERE model_id = v_model_id; -END; -CREATE PROCEDURE ins_model_instance - (IN v_control_name_uuid VARCHAR(36), - IN v_vm_name VARCHAR(250), - IN v_location VARCHAR(250), - OUT v_model_id VARCHAR(36), - OUT v_model_instance_id VARCHAR(36)) -BEGIN - SELECT m.model_id - INTO v_model_id - FROM model m - WHERE m.control_name_uuid = v_control_name_uuid; - SET v_model_instance_id = UUID(); - INSERT INTO model_instance - (model_instance_id, model_id, vm_name, location) - VALUES (v_model_instance_id, v_model_id, v_vm_name, v_location); -END; -CREATE PROCEDURE del_model_instance - (IN v_control_name_uuid VARCHAR(36), - IN v_vm_name VARCHAR(250), - OUT v_model_id VARCHAR(36), - OUT v_model_instance_id VARCHAR(36)) -BEGIN - SELECT m.model_id, i.model_instance_id - INTO v_model_id, - v_model_instance_id - FROM model m, - model_instance i - WHERE m.model_id = i.model_id - AND m.control_name_uuid = v_control_name_uuid - AND i.vm_name = v_vm_name; - DELETE FROM model_instance - WHERE model_instance_id = v_model_instance_id; -END; -CREATE PROCEDURE del_all_model_instances - (IN v_control_name_uuid VARCHAR(36), - OUT v_model_id VARCHAR(36)) -BEGIN - SELECT m.model_id - INTO v_model_id - FROM model m - WHERE m.control_name_uuid = v_control_name_uuid; - DELETE FROM model_instance - WHERE model_id = v_model_id; -END; -CREATE PROCEDURE ins_event - (IN v_model_name VARCHAR(80), - IN v_control_name_prefix VARCHAR(80), - IN v_control_name_uuid VARCHAR(36), - IN v_user_id VARCHAR(80), - IN v_action_cd VARCHAR(80), - IN v_action_state_cd VARCHAR(80), - IN v_process_instance_id VARCHAR(80), - OUT v_model_id VARCHAR(36), - OUT v_event_id VARCHAR(36)) -BEGIN - DECLARE v_prev_event_id VARCHAR(36); - SELECT m.model_id, - m.event_id - INTO v_model_id, - v_prev_event_id - FROM model m - WHERE m.model_name = v_model_name - OR m.control_name_uuid = v_control_name_uuid; - SET v_event_id = UUID(); - INSERT INTO event - (event_id, model_id, action_cd, action_state_cd, prev_event_id, process_instance_id, user_id) - VALUES (v_event_id, v_model_id, v_action_cd, v_action_state_cd, v_prev_event_id, v_process_instance_id, v_user_id); - UPDATE model - SET event_id = v_event_id - WHERE model_id = v_model_id; -END; -CREATE PROCEDURE upd_event - (IN v_event_id VARCHAR(36), - IN v_process_instance_id VARCHAR(80)) -BEGIN - UPDATE event - SET process_instance_id = v_process_instance_id - WHERE event_id = v_event_id; -END; -CREATE PROCEDURE del_model -(IN v_model_name VARCHAR(80)) -BEGIN - DECLARE v_model_id VARCHAR(36); - SELECT model_id INTO v_model_id from model where model_name = v_model_name; - UPDATE model set event_id = null, model_blueprint_id = null, model_prop_id = null where model_id = v_model_id; - DELETE from event where model_id = v_model_id; - DELETE from model_blueprint where model_id = v_model_id; - DELETE from model_properties where model_id = v_model_id; - DELETE from model where model_id = v_model_id; -END; - -CREATE PROCEDURE set_new_tosca_model_version - (IN v_tosca_model_id VARCHAR(36), - IN v_version DOUBLE, - IN v_tosca_model_yaml MEDIUMTEXT, - IN v_tosca_model_json MEDIUMTEXT, - IN v_user_id VARCHAR(80), - OUT v_revision_id VARCHAR(36)) -BEGIN - SET v_revision_id = UUID(); - INSERT INTO tosca_model_revision - (tosca_model_revision_id, tosca_model_id, version, tosca_model_yaml, tosca_model_json, user_id) - VALUES (v_revision_id, v_tosca_model_id, v_version, v_tosca_model_yaml, v_tosca_model_json, v_user_id); -END; - -CREATE PROCEDURE set_tosca_model - (IN v_tosca_model_name VARCHAR(80), - IN v_policy_type VARCHAR(80), - IN v_user_id VARCHAR(80), - IN v_tosca_model_yaml MEDIUMTEXT, - IN v_tosca_model_json MEDIUMTEXT, - IN v_version DOUBLE, - OUT v_tosca_model_id VARCHAR(36), - OUT v_revision_id VARCHAR(36)) -BEGIN - SET v_tosca_model_id = UUID(); - INSERT INTO tosca_model - (tosca_model_id, tosca_model_name, policy_type, user_id) - VALUES (v_tosca_model_id, v_tosca_model_name, v_policy_type, v_user_id); - SET v_revision_id = UUID(); - INSERT INTO tosca_model_revision - (tosca_model_revision_id, tosca_model_id, version, tosca_model_yaml, tosca_model_json, user_id) - VALUES (v_revision_id, v_tosca_model_id, v_version, v_tosca_model_yaml, v_tosca_model_json, v_user_id); -END; - -CREATE PROCEDURE set_dictionary - (IN v_dictionary_name VARCHAR(80), - IN v_user_id VARCHAR(80), - OUT v_dictionary_id VARCHAR(36)) -BEGIN - SET v_dictionary_id = UUID(); - INSERT INTO dictionary - (dictionary_id, dictionary_name, created_by, modified_by) - VALUES (v_dictionary_id, v_dictionary_name, v_user_id, v_user_id); -END; - -CREATE PROCEDURE set_dictionary_elements - (IN v_dictionary_id VARCHAR(36), - IN v_dict_element_name VARCHAR(250), - IN v_dict_element_short_name VARCHAR(80), - IN v_dict_element_description VARCHAR(250), - IN v_dict_element_type VARCHAR(80), - IN v_user_id VARCHAR(80), - OUT v_dict_element_id VARCHAR(36)) -BEGIN - SET v_dict_element_id = UUID(); - INSERT INTO dictionary_elements - (dict_element_id, dictionary_id, dict_element_name, dict_element_short_name, dict_element_description, dict_element_type, created_by, modified_by) - VALUES (v_dict_element_id, v_dictionary_id, v_dict_element_name, v_dict_element_short_name, v_dict_element_description, v_dict_element_type, v_user_id, v_user_id); -END; -// -DELIMITER ; diff --git a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-db.sql b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-db.sql new file mode 100644 index 0000000000..ea4d97c1b5 --- /dev/null +++ b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-db.sql @@ -0,0 +1,11 @@ +# +# Create CLDS database objects (tables, etc.) +# +# +CREATE DATABASE `cldsdb4`; +USE `cldsdb4`; +DROP USER 'clds'; +CREATE USER 'clds'; +GRANT ALL on cldsdb4.* to 'clds' identified by 'sidnnd83K' with GRANT OPTION; +FLUSH PRIVILEGES; + diff --git a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-tables.sql b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-tables.sql index 9b12b1804c..0e15d4d3a2 100644 --- a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-tables.sql +++ b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/create-tables.sql @@ -1,17 +1,4 @@ -/* Copyright © 2019 AT&T -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + create table hibernate_sequence ( next_val bigint ) engine=InnoDB; diff --git a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/drop/clds-drop-db-objects.sql b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/drop/clds-drop-db-objects.sql deleted file mode 100644 index 0412373d01..0000000000 --- a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/drop/clds-drop-db-objects.sql +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright © 2017 AT&T, Amdocs, 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. -*/ - -# -# Drop CLDS database objects (tables, etc.) -# - - -ALTER TABLE template - DROP FOREIGN KEY template_image_id_fkey01; -ALTER TABLE template - DROP FOREIGN KEY template_bpmn_id_fkey01; -ALTER TABLE template - DROP FOREIGN KEY template_doc_id_fkey01; - -ALTER TABLE model - DROP FOREIGN KEY template_id_fkey01; -ALTER TABLE model - DROP FOREIGN KEY model_prop_id_fkey01; -ALTER TABLE model - DROP FOREIGN KEY model_blueprint_id_fkey01; -ALTER TABLE model - DROP FOREIGN KEY event_id_fkey01; - -DROP TABLE clds_service_cache; - -DROP TABLE model_instance; -DROP TABLE model_blueprint; -DROP TABLE model_properties; -DROP TABLE event; -DROP TABLE model; - -DROP TABLE template_doc; -DROP TABLE template_image; -DROP TABLE template_bpmn; -DROP TABLE template; - -DROP TABLE dictionary_elements; -DROP TABLE dictionary; -DROP TABLE tosca_model_revision; -DROP TABLE tosca_model; - diff --git a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh deleted file mode 100755 index 0755826cde..0000000000 --- a/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -### -# ============LICENSE_START======================================================= -# ONAP CLAMP -# ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights -# reserved. -# Modifications Copyright © 2018 Amdocs,Bell Canada -# Modifications Copyright © 2019 AT&T -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END============================================ -# =================================================================== -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -### - -cd /docker-entrypoint-initdb.d/bulkload -### Keep previous DB for now (SOON DEPRECATED) -mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < clds-create-db-objects.sql -mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < clds-stored-procedures.sql -## New model creation -mysql -uroot -p$MYSQL_ROOT_PASSWORD -f cldsdb4 < create-tables.sql -- cgit 1.2.3-korg