From 0acd15c5231c03ffed3743f4028214e3c71c11a3 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 16 Feb 2021 17:10:36 -0500 Subject: Redesign GRA database tables to support parallel updates Added new classes to support new tables for networks, vnfs, and vf-modules to allow parallel updates to different parts of the same service instance. Also, changed database initialization to use liquibase to create database tables. Change-Id: I53be2d7dc6a2bcdcc29300b95ba0c906e90d3238 Issue-ID: SDNC-1481 Signed-off-by: Dan Timoney --- .../src/main/resources/application.properties | 3 +- .../db/changelog/db.changelog-master.yaml | 546 +++++++++++++++++++++ .../src/main/resources/dblib.properties | 8 +- .../src/main/resources/log4j2.properties | 9 +- .../src/main/resources/startGra.sh | 1 + 5 files changed, 558 insertions(+), 9 deletions(-) create mode 100644 ms/generic-resource-api/src/main/resources/db/changelog/db.changelog-master.yaml (limited to 'ms/generic-resource-api/src/main/resources') diff --git a/ms/generic-resource-api/src/main/resources/application.properties b/ms/generic-resource-api/src/main/resources/application.properties index ac6ae39..2be250b 100644 --- a/ms/generic-resource-api/src/main/resources/application.properties +++ b/ms/generic-resource-api/src/main/resources/application.properties @@ -16,8 +16,7 @@ spring.datasource.platform=mysql spring.datasource.testWhileIdle=true spring.datasource.validationQuery=SELECT 1 spring.jpa.show-sql=true -spring.jpa.generate-ddl=true -spring.jpa.hibernate.ddl-auto=update +spring.jpa.properties.hibernate.default_schema=${MYSQL_DATABASE} spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl # spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl diff --git a/ms/generic-resource-api/src/main/resources/db/changelog/db.changelog-master.yaml b/ms/generic-resource-api/src/main/resources/db/changelog/db.changelog-master.yaml new file mode 100644 index 0000000..6a47117 --- /dev/null +++ b/ms/generic-resource-api/src/main/resources/db/changelog/db.changelog-master.yaml @@ -0,0 +1,546 @@ +databaseChangeLog: +- changeSet: + id: 20210211-1 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES + changes: + - createTable: + tableName: CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES + columns: + - column: + name: allottedResourceId + type: varchar(255) + constraints: + nullable: false + primaryKey: true + - column: + name: allottedResourceStatusAction + type: varchar(255) + - column: + name: allottedResourceStatusFinalIndicator + type: varchar(255) + - column: + name: allottedResourceStatusRequestStatus + type: varchar(255) + - column: + name: allottedResourceStatusResponseCode + type: varchar(255) + - column: + name: allottedResourceStatusResponseMessage + type: varchar(255) + - column: + name: allottedResourceStatusResponseTimestamp + type: varchar(255) + - column: + name: allottedResourceStatusRpcAction + type: varchar(255) + - column: + name: allottedResourceStatusRpcName + type: varchar(255) + - column: + name: arData + type: clob +- changeSet: + id: 20210211-2 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS + changes: + - createTable: + tableName: CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS + columns: + - column: + name: configurationId + type: varchar(255) + constraints: + nullable: false + primaryKey: true + - column: + name: pmcData + type: clob + - column: + name: portMirrorConfigurationStatusAction + type: varchar(255) + - column: + name: portMirrorConfigurationStatusFinalIndicator + type: varchar(255) + - column: + name: portMirrorConfigurationStatusRequestStatus + type: varchar(255) + - column: + name: portMirrorConfigurationStatusResponseCode + type: varchar(255) + - column: + name: portMirrorConfigurationStatusResponseMessage + type: varchar(255) + - column: + name: portMirrorConfigurationStatusResponseTimestamp + type: varchar(255) + - column: + name: portMirrorConfigurationStatusRpcAction + type: varchar(255) + - column: + name: portMirrorConfigurationStatusRpcName + type: varchar(255) +- changeSet: + id: 20210211-3 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: CONFIG_GRA_SERVICES + changes: + - createTable: + tableName: CONFIG_GRA_SERVICES + columns: + - column: + name: svcInstanceId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + name: serviceStatusAction + type: varchar(255) + - column: + name: serviceStatusFinalIndicator + type: varchar(255) + - column: + name: serviceStatusRequestStatus + type: varchar(255) + - column: + name: serviceStatusResponseCode + type: varchar(255) + - column: + name: serviceStatusResponseMessage + type: varchar(255) + - column: + name: serviceStatusResponseTimestamp + type: varchar(255) + - column: + name: serviceStatusRpcAction + type: varchar(255) + - column: + name: serviceStatusRpcName + type: varchar(255) + - column: + name: svcData + type: clob +- changeSet: + id: 20210211-4 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: CONFIG_PRELOAD_DATA + changes: + - createTable: + tableName: CONFIG_PRELOAD_DATA + columns: + - column: + name: preloadId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + name: preloadType + type: varchar(25) + constraints: + nullable: false + primaryKey: true + - column: + name: preloadData + type: clob +- changeSet: + id: 20210211-5 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: NODE_TYPES + changes: + - createTable: + tableName: NODE_TYPES + columns: + - column: + constraints: + nullable: false + primaryKey: true + name: nodetype + type: varchar(80) +- changeSet: + id: 20210211-6 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: OPERATIONAL_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES + changes: + - createTable: + tableName: OPERATIONAL_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES + columns: + - column: + name: allottedResourceId + type: varchar(255) + constraints: + nullable: false + primaryKey: true + - column: + name: allottedResourceStatusAction + type: varchar(255) + - column: + name: allottedResourceStatusFinalIndicator + type: varchar(255) + - column: + name: allottedResourceStatusRequestStatus + type: varchar(255) + - column: + name: allottedResourceStatusResponseCode + type: varchar(255) + - column: + name: allottedResourceStatusResponseMessage + type: varchar(255) + - column: + name: allottedResourceStatusResponseTimestamp + type: varchar(255) + - column: + name: allottedResourceStatusRpcAction + type: varchar(255) + - column: + name: allottedResourceStatusRpcName + type: varchar(255) + - column: + name: arData + type: clob +- changeSet: + id: 20210211-7 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS + changes: + - createTable: + tableName: OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS + columns: + - column: + name: configurationId + type: varchar(255) + constraints: + nullable: false + primaryKey: true + - column: + name: pmcData + type: clob + - column: + name: portMirrorConfigurationStatusAction + type: varchar(255) + - column: + name: portMirrorConfigurationStatusFinalIndicator + type: varchar(255) + - column: + name: portMirrorConfigurationStatusRequestStatus + type: varchar(255) + - column: + name: portMirrorConfigurationStatusResponseCode + type: varchar(255) + - column: + name: portMirrorConfigurationStatusResponseMessage + type: varchar(255) + - column: + name: portMirrorConfigurationStatusResponseTimestamp + type: varchar(255) + - column: + name: portMirrorConfigurationStatusRpcAction + type: varchar(255) + - column: + name: portMirrorConfigurationStatusRpcName + type: varchar(255) +- changeSet: + id: 20210211-8 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: OPERATIONAL_GRA_SERVICES + changes: + - createTable: + tableName: OPERATIONAL_GRA_SERVICES + columns: + - column: + name: svcInstanceId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + name: serviceStatusAction + type: varchar(255) + - column: + name: serviceStatusFinalIndicator + type: varchar(255) + - column: + name: serviceStatusRequestStatus + type: varchar(255) + - column: + name: serviceStatusResponseCode + type: varchar(255) + - column: + name: serviceStatusResponseMessage + type: varchar(255) + - column: + name: serviceStatusResponseTimestamp + type: varchar(255) + - column: + name: serviceStatusRpcAction + type: varchar(255) + - column: + name: serviceStatusRpcName + type: varchar(255) + - column: + name: svcData + type: clob +- changeSet: + id: 20210211-9 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: OPERATIONAL_PRELOAD_DATA + changes: + - createTable: + tableName: OPERATIONAL_PRELOAD_DATA + columns: + - column: + name: preloadId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + constraints: + nullable: false + primaryKey: true + name: preloadType + type: varchar(25) + - column: + name: preloadData + type: clob +- changeSet: + id: 20210211-10 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: SVC_LOGIC + changes: + - createTable: + tableName: SVC_LOGIC + columns: + - column: + name: module + type: varchar(80) + constraints: + nullable: false + primaryKey: true + - column: + name: rpc + type: varchar(80) + constraints: + nullable: false + primaryKey: true + - column: + name: version + type: varchar(40) + constraints: + nullable: false + primaryKey: true + - column: + name: mode + type: varchar(5) + constraints: + nullable: false + primaryKey: true + - column: + name: active + type: varchar(1) + constraints: + nullable: false + - column: + name: graph + type: blob + - column: + name: modified_timestamp + type: timestamp + constraints: + nullable: false + defaultValueComputed: CURRENT_TIMESTAMP + - column: + name: md5sum + type: varchar(128) +- changeSet: + id: 20210211-11 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: TEST_RESULT_CONFIG + changes: + - createTable: + tableName: TEST_RESULT_CONFIG + columns: + - column: + name: id + type: bigint + constraints: + nullable: false + primaryKey: true + - column: + name: results + type: varchar(255) + - column: + name: testIdentifier + type: varchar(255) +- changeSet: + id: 20210211-12 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: TEST_RESULT_OPERATIONAL + changes: + - createTable: + tableName: TEST_RESULT_OPERATIONAL + columns: + - column: + name: id + type: bigint + constraints: + nullable: false + primaryKey: true + - column: + name: results + type: varchar(255) + - column: + name: testIdentifier + type: varchar(255) +- changeSet: + id: 20210211-13 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: hibernate_sequence + changes: + - createTable: + tableName: hibernate_sequence + columns: + - column: + name: next_val + type: bigint +- changeSet: + id: 20210216-1 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: CONFIG_GRA_NETWORKS + changes: + - createTable: + tableName: CONFIG_GRA_NETWORKS + columns: + - column: + name: svcInstanceId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + name: networkId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + name: networkData + type: clob +- changeSet: + id: 20210216-2 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: CONFIG_GRA_VNFS + changes: + - createTable: + tableName: CONFIG_GRA_VNFS + columns: + - column: + name: svcInstanceId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + name: vnfId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + name: vnfData + type: clob +- changeSet: + id: 20210216-3 + author: dtimoney@att.com + preConditions: + - onFail: MARK_RAN + - not: + - tableExists: + tableName: CONFIG_GRA_VF_MODULES + changes: + - createTable: + tableName: CONFIG_GRA_VF_MODULES + columns: + - column: + name: svcInstanceId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + name: vnfId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + name: vfModuleId + type: varchar(100) + constraints: + nullable: false + primaryKey: true + - column: + name: vfModuleData + type: clob diff --git a/ms/generic-resource-api/src/main/resources/dblib.properties b/ms/generic-resource-api/src/main/resources/dblib.properties index d5e5286..568a9c4 100644 --- a/ms/generic-resource-api/src/main/resources/dblib.properties +++ b/ms/generic-resource-api/src/main/resources/dblib.properties @@ -23,11 +23,11 @@ org.onap.ccsdk.sli.dbtype=jdbc org.onap.ccsdk.sli.jdbc.hosts=dbhost -org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://dbhost:3306/gradb +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://dbhost:3306/${MYSQL_DATABASE} org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver -org.onap.ccsdk.sli.jdbc.database=gradb -org.onap.ccsdk.sli.jdbc.user=gra -org.onap.ccsdk.sli.jdbc.password=test123 +org.onap.ccsdk.sli.jdbc.database=${MYSQL_DATABASE} +org.onap.ccsdk.sli.jdbc.user=${MYSQL_USER} +org.onap.ccsdk.sli.jdbc.password=${MYSQL_PASSWORD} org.onap.ccsdk.sli.jdbc.connection.name=dbhost org.onap.ccsdk.sli.jdbc.connection.timeout=50 org.onap.ccsdk.sli.jdbc.request.timeout=100 diff --git a/ms/generic-resource-api/src/main/resources/log4j2.properties b/ms/generic-resource-api/src/main/resources/log4j2.properties index 40d18d1..9bc78a3 100644 --- a/ms/generic-resource-api/src/main/resources/log4j2.properties +++ b/ms/generic-resource-api/src/main/resources/log4j2.properties @@ -18,7 +18,8 @@ # ============LICENSE_END========================================================= # -property.logDir = ${sys:LOG_PATH:-./target} +property.logDir = ${env:LOG_PATH:-./target} +property.logLevel = ${env:LOG_LEVEL:-INFO} property.pattern = %d{ISO8601} | %-5p | %-16t | %-32c{1} | %X{currentGraph} - %X{nodeId} | %m%n @@ -27,13 +28,13 @@ property.ServiceName = INTERNAL property.ErrorCode = 900 property.ErrorDesc = UnknownError -rootLogger.level = INFO +rootLogger.level = ${logLevel} rootLogger.appenderRef.AppFile.ref = AppFile rootLogger.appenderRef.Console.ref = Console rootLogger.appenderRef.DebugFile.ref = DebugFile rootLogger.appenderRef.ErrorFile.ref = ErrorFile rootLogger.appenderRef.Console.filter.threshold.type = ThresholdFilter -rootLogger.appenderRef.Console.filter.threshold.level = DEBUG +rootLogger.appenderRef.Console.filter.threshold.level = ${logLevel} appender.console.type = Console appender.console.name = Console @@ -69,6 +70,8 @@ appender.debug.policies.size.size = 10MB appender.debug.strategy.type = DefaultRolloverStrategy appender.debug.strategy.max = 200 appender.debug.strategy.fileIndex = min +appender.error.filter.threshold.type = ThresholdFilter +appender.error.filter.threshold.level = DEBUG appender.error.type = RollingRandomAccessFile appender.error.name = ErrorFile diff --git a/ms/generic-resource-api/src/main/resources/startGra.sh b/ms/generic-resource-api/src/main/resources/startGra.sh index c35d63f..4507c43 100644 --- a/ms/generic-resource-api/src/main/resources/startGra.sh +++ b/ms/generic-resource-api/src/main/resources/startGra.sh @@ -31,6 +31,7 @@ export TRUSTSTORE=${TRUSTSTORE:-truststoreONAPall.jks} export JAVA_SECURITY_DIR=${JAVA_SECURITY_DIR:-/etc/ssl/certs/java} export CACERT_PASSWORD=${CACERT_PASSWORD:-${TRUSTSTORE_PASSWORD}} export MYSQL_DB_HOST=${MYSQL_DB_HOST:-dbhost} +export SVCLOGIC_PROPERTIES=${SVCLOGIC_PROPERTIES:-${SDNC_CONFIG_DIR}/svclogic.properties} # # Wait for database -- cgit 1.2.3-korg