diff options
author | BT2983 <BT2983@att.com> | 2018-07-23 13:11:35 -0600 |
---|---|---|
committer | BT2983 <BT2983@att.com> | 2018-07-23 13:11:35 -0600 |
commit | 5a398289dee4b666528aa77f4e38f9c68d35b254 (patch) | |
tree | 6e6f7215778424beacdd3637ddffa289fc35c39f /ms/neng/src/main/resources/db/changelog | |
parent | 84b6500a6c3a95b927df2fa90cdf8453ed2a028b (diff) |
Adding naming micro-service code - scripts.
Docker and DB scripts.
Change-Id: I2e9e153f6c72e5f5d6ee86cc9dfc275ec77b4642
Issue-ID: CCSDK-342
Signed-off-by: BT2983 <BT2983@att.com>
Diffstat (limited to 'ms/neng/src/main/resources/db/changelog')
12 files changed, 206 insertions, 0 deletions
diff --git a/ms/neng/src/main/resources/db/changelog/db.changelog-master.xml b/ms/neng/src/main/resources/db/changelog/db.changelog-master.xml new file mode 100644 index 00000000..9d735e64 --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/db.changelog-master.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +/*- + * ============LICENSE_START======================================================= + * ONAP : CCSDK.apps + * ================================================================================ + * Copyright (C) 2018 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========================================================= + */ + +<databaseChangeLog + xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 + http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd"> + + <include file="db/changelog/scripts/rel_18_10/create_base_tables.sql" /> + <include file="db/changelog/scripts/rel_18_10/01_initial_ref_data_v1.sql" /> + <include file="db/changelog/scripts/rel_18_10/02_create_indexes_ddl.sql" /> + <include file="db/changelog/scripts/rel_18_10/03_ref_data_upd_dml.sql" /> + <include file="db/changelog/scripts/rel_18_10/04_ref_data_extrn_int.sql" /> + <include file="db/changelog/scripts/rel_18_10/05_ref_data_upd_dml.sql" /> + <include file="db/changelog/scripts/rel_18_10/06_ref_data_upd_dml.sql" /> + <include file="db/changelog/scripts/rel_18_10/07_ref_data_extrn_int_update_dml.sql" /> + <include file="db/changelog/scripts/rel_18_10/08_ref_data_extrn_int_update_dml.sql" /> + <include file="db/changelog/scripts/rel_18_10/09_table_upd_ddl.sql" /> + <include file="db/changelog/scripts/rel_18_10/10_ref_data_upd_dml.sql" /> +</databaseChangeLog> + diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/01_initial_ref_data_v1.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/01_initial_ref_data_v1.sql new file mode 100644 index 00000000..44d86f0a --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/01_initial_ref_data_v1.sql @@ -0,0 +1,18 @@ +--liquibase formatted sql +--changeset ref_data_load_p1:18_10_ref_data_load_p1.sql + +--comment: 07/23/2018 Intial Data Load - LOAD PARAMETERS + +--set @@autocommit:=0; + +--delete all records +delete from SERVICE_PARAMETER; + +INSERT INTO SERVICE_PARAMETER(NAME, VALUE, CREATED_BY) VALUES ('initial_increment','10,40,50,100','Initial'); +INSERT INTO SERVICE_PARAMETER(NAME, VALUE, CREATED_BY) VALUES ('recipe_separator','|":",','Initial'); + +delete from IDENTIFIER_MAP; + +INSERT INTO IDENTIFIER_MAP(POLICY_FN_NAME, JS_FN_NAME, CREATED_BY) VALUES ('substr','substring', 'Initial'); + +commit; diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/02_create_indexes_ddl.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/02_create_indexes_ddl.sql new file mode 100644 index 00000000..65562424 --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/02_create_indexes_ddl.sql @@ -0,0 +1,8 @@ +--liquibase formatted sql +--changeset index_creation:18_10.create_indexes_01.sql + +-- Add indexes on GENERATED_NAME + +create index gen_name_ext_id_idx on GENERATED_NAME(EXTERNAL_ID); +create index gen_name_name_idx on GENERATED_NAME(NAME); +create index gen_name_pre_suf_idx on GENERATED_NAME(PREFIX, SUFFIX); diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/03_ref_data_upd_dml.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/03_ref_data_upd_dml.sql new file mode 100644 index 00000000..2c33bb09 --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/03_ref_data_upd_dml.sql @@ -0,0 +1,8 @@ +--liquibase formatted sql +--changeset ref_data_update:18_10.ref_data_update.sql + +INSERT INTO SERVICE_PARAMETER(NAME, VALUE, CREATED_BY) VALUES ('max_gen_attempt','50','Initial'); + +delete from IDENTIFIER_MAP; + +INSERT INTO IDENTIFIER_MAP(POLICY_FN_NAME, JS_FN_NAME, CREATED_BY) VALUES ('sub_str','substr', 'Initial'); diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/04_ref_data_extrn_int.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/04_ref_data_extrn_int.sql new file mode 100644 index 00000000..bc72a2e8 --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/04_ref_data_extrn_int.sql @@ -0,0 +1,24 @@ +--liquibase formatted sql +--changeset ref_data_update:18_10.ref_data_update.sql + +-- clean up any data +delete from external_interface; + +--insert the data + +insert into external_interface(SYSTEM,PARAM,URL_SUFFIX,CREATED_TIME,CREATED_BY,LAST_UPDATED_TIME,LAST_UPDATED_BY) +values('aai','vnf-name','nodes/generic-vnfs?vnf-name=',sysdate(),'nengsys',sysdate(),'nengsys'); + +insert into external_interface(SYSTEM,PARAM,URL_SUFFIX,CREATED_TIME,CREATED_BY,LAST_UPDATED_TIME,LAST_UPDATED_BY) +values('aai','vnfc-name','nodes/vnfcs?vnfc-name=',sysdate(),'nengsys',sysdate(),'nengsys'); + +insert into external_interface(SYSTEM,PARAM,URL_SUFFIX,CREATED_TIME,CREATED_BY,LAST_UPDATED_TIME,LAST_UPDATED_BY) +values('aai','vserver-name','nodes/vservers?vserver-name=',sysdate(),'nengsys',sysdate(),'nengsys'); + +insert into external_interface(SYSTEM,PARAM,URL_SUFFIX,CREATED_TIME,CREATED_BY,LAST_UPDATED_TIME,LAST_UPDATED_BY) +values('aai','vf-module-name','nodes/vf-modules?vf-module-name=',sysdate(),'nengsys',sysdate(),'nengsys'); + +insert into external_interface(SYSTEM,PARAM,URL_SUFFIX,CREATED_TIME,CREATED_BY,LAST_UPDATED_TIME,LAST_UPDATED_BY) +values('aai','service-instance-id','nodes/service-instances?service-instance-id=',sysdate(),'nengsys',sysdate(),'nengsys'); + +commit; diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/05_ref_data_upd_dml.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/05_ref_data_upd_dml.sql new file mode 100644 index 00000000..34bd6dc3 --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/05_ref_data_upd_dml.sql @@ -0,0 +1,5 @@ +--liquibase formatted sql +--changeset ref_data_update:18_10.ref_data_update.sql + +INSERT INTO IDENTIFIER_MAP(POLICY_FN_NAME, JS_FN_NAME, CREATED_BY) VALUES ('substr','substr', 'Initial'); +INSERT INTO SERVICE_PARAMETER(NAME, VALUE, CREATED_BY) VALUES ('use_db_policy','Y','Initial'); diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/06_ref_data_upd_dml.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/06_ref_data_upd_dml.sql new file mode 100644 index 00000000..da4e1ba3 --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/06_ref_data_upd_dml.sql @@ -0,0 +1,9 @@ +--liquibase formatted sql +--changeset ref_data_update_more:18_10.ref_data_update_more.sql + +-- update policy functions to java implementations + +UPDATE IDENTIFIER_MAP SET JS_FN_NAME = 'substring' WHERE POLICY_FN_NAME='sub_str'; +UPDATE IDENTIFIER_MAP SET JS_FN_NAME = 'substring' WHERE POLICY_FN_NAME='substr'; +INSERT INTO IDENTIFIER_MAP(POLICY_FN_NAME, JS_FN_NAME, CREATED_BY) VALUES ('to_lower_case','toLowerCase', 'Initial'); +INSERT INTO IDENTIFIER_MAP(POLICY_FN_NAME, JS_FN_NAME, CREATED_BY) VALUES ('to_upper_case','toUpperCase', 'Initial'); diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/07_ref_data_extrn_int_update_dml.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/07_ref_data_extrn_int_update_dml.sql new file mode 100644 index 00000000..749076c9 --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/07_ref_data_extrn_int_update_dml.sql @@ -0,0 +1,21 @@ +--liquibase formatted sql +--changeset ref_data_update_extin:18_10.ref_data_update.sql + +-- clean up any data +delete from external_interface where PARAM in ('VNF', 'VNFC', 'VM', 'VFMODULE'); + +--insert the data + +insert into external_interface(SYSTEM,PARAM,URL_SUFFIX,CREATED_TIME,CREATED_BY,LAST_UPDATED_TIME,LAST_UPDATED_BY) +values('aai','VNF','nodes/generic-vnfs?vnf-name=',sysdate(),'nengsys',sysdate(),'nengsys'); + +insert into external_interface(SYSTEM,PARAM,URL_SUFFIX,CREATED_TIME,CREATED_BY,LAST_UPDATED_TIME,LAST_UPDATED_BY) +values('aai','VNFC','nodes/vnfcs?vnfc-name=',sysdate(),'nengsys',sysdate(),'nengsys'); + +insert into external_interface(SYSTEM,PARAM,URL_SUFFIX,CREATED_TIME,CREATED_BY,LAST_UPDATED_TIME,LAST_UPDATED_BY) +values('aai','VM','nodes/vservers?vserver-name=',sysdate(),'nengsys',sysdate(),'nengsys'); + +insert into external_interface(SYSTEM,PARAM,URL_SUFFIX,CREATED_TIME,CREATED_BY,LAST_UPDATED_TIME,LAST_UPDATED_BY) +values('aai','VFMODULE','nodes/vf-modules?vf-module-name=',sysdate(),'nengsys',sysdate(),'nengsys'); + +commit; diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/08_ref_data_extrn_int_update_dml.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/08_ref_data_extrn_int_update_dml.sql new file mode 100644 index 00000000..36935c29 --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/08_ref_data_extrn_int_update_dml.sql @@ -0,0 +1,12 @@ +--liquibase formatted sql +--changeset ref_data_update_extin:18_10.ref_data_update.sql + +-- clean up any data +delete from external_interface where PARAM in ('VF-MODULE'); + +--insert the data + +insert into external_interface(SYSTEM,PARAM,URL_SUFFIX,CREATED_TIME,CREATED_BY,LAST_UPDATED_TIME,LAST_UPDATED_BY) +values('aai','VF-MODULE','nodes/vf-modules?vf-module-name=',sysdate(),'nengsys',sysdate(),'nengsys'); + +commit; diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/09_table_upd_ddl.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/09_table_upd_ddl.sql new file mode 100644 index 00000000..eccd921f --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/09_table_upd_ddl.sql @@ -0,0 +1,4 @@ +--liquibase formatted sql +--changeset generate_name_ddl_update:18_10.table_update.sql + +alter table generated_name MODIFY COLUMN created_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL;; diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/10_ref_data_upd_dml.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/10_ref_data_upd_dml.sql new file mode 100644 index 00000000..b589a986 --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/10_ref_data_upd_dml.sql @@ -0,0 +1,5 @@ +--liquibase formatted sql +--changeset service_param_update_sql:18_10.ref_update.sql + +DELETE FROM SERVICE_PARAMETER where NAME='use_db_policy'; +INSERT INTO SERVICE_PARAMETER(NAME, VALUE, CREATED_BY) VALUES ('use_db_policy','N','Initial'); diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/create_base_tables.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/create_base_tables.sql new file mode 100644 index 00000000..f79dd3fc --- /dev/null +++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/create_base_tables.sql @@ -0,0 +1,52 @@ +--liquibase formatted sql +--changeset template_table:18_10.create_tables_p1.sql + +CREATE TABLE GENERATED_NAME (GENERATED_NAME_ID INTEGER PRIMARY KEY AUTO_INCREMENT, +EXTERNAL_ID VARCHAR(500) NOT NULL COMMENT 'Key sent by SDNC', +SEQUNCE_NUMBER INTEGER COMMENT 'Sequence number used for this name', +SEQUENCE_NUMBER_ENC VARCHAR(100) COMMENT 'Alpha numeric equivalent of sequence_number column', +ELEMENT_TYPE VARCHAR(100) COMMENT 'The type of network element vnf-name, vm-name etc', +NAME VARCHAR(500) COMMENT 'Generated name', +PREFIX VARCHAR(100) COMMENT 'The prefix for the name. (The part of the name before the sequence number.)', +SUFFIX VARCHAR(100) COMMENT 'The suffix for the name. (The part of the name after the sequence number.)', +IS_RELEASED CHAR(1) COMMENT 'Indicating if the entry is released/unassigned', +CREATED_TIME DATETIME DEFAULT CURRENT_TIMESTAMP, +CREATED_BY VARCHAR(50), +LAST_UPDATED_TIME DATETIME, +LAST_UPDATED_BY VARCHAR(50)) AUTO_INCREMENT=100; +-- COMMENT 'TABLE TO STORE GENERATED NAMES'; + +CREATE TABLE SERVICE_PARAMETER (SERVICE_PARAMETER_ID INTEGER PRIMARY KEY AUTO_INCREMENT, +NAME VARCHAR(500) COMMENT 'Parameter name' NOT NULL UNIQUE, +VALUE VARCHAR(500) COMMENT 'Parameter value', +CREATED_TIME DATETIME DEFAULT CURRENT_TIMESTAMP, +CREATED_BY VARCHAR(50), +LAST_UPDATED_TIME DATETIME, +LAST_UPDATED_BY VARCHAR(50) +) AUTO_INCREMENT=100; + +CREATE TABLE IDENTIFIER_MAP (IDENTIFIER_MAP_ID INTEGER PRIMARY KEY AUTO_INCREMENT, +POLICY_FN_NAME VARCHAR(500) COMMENT 'Function name in policy manager' NOT NULL UNIQUE, +JS_FN_NAME VARCHAR(500) COMMENT 'Equivalent name in Java or script', +CREATED_TIME DATETIME DEFAULT CURRENT_TIMESTAMP, +CREATED_BY VARCHAR(50), +LAST_UPDATED_TIME DATETIME, +LAST_UPDATED_BY VARCHAR(50) +) AUTO_INCREMENT=100; + + +CREATE TABLE EXTERNAL_INTERFACE (EXTERNAL_INTERFACE_ID INTEGER PRIMARY KEY AUTO_INCREMENT, +SYSTEM VARCHAR(500) COMMENT 'Name of the external system', +PARAM VARCHAR(500) COMMENT 'Parameters controlling the url', +URL_SUFFIX VARCHAR(500) COMMENT 'The suffix of the URL for each value of the parameter', +CREATED_TIME DATETIME DEFAULT CURRENT_TIMESTAMP, +CREATED_BY VARCHAR(50), +LAST_UPDATED_TIME DATETIME, +LAST_UPDATED_BY VARCHAR(50) +) AUTO_INCREMENT=100; + +CREATE TABLE POLICY_MAN_SIM (POLICY_ID INTEGER PRIMARY KEY AUTO_INCREMENT, +POLICY_NAME VARCHAR(500) COMMENT 'Policy name' NOT NULL, +POLICY_RESPONSE VARCHAR(10000) COMMENT 'Policy value', +CREATED_TIME DATETIME DEFAULT CURRENT_TIMESTAMP +) AUTO_INCREMENT=100; |