summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-02-16 17:10:36 -0500
committerDan Timoney <dtimoney@att.com>2021-02-17 09:54:53 -0500
commit0acd15c5231c03ffed3743f4028214e3c71c11a3 (patch)
treebb195497ddb6bbedb69c1c069ada1d2160104d62
parentbd7b33d74173c4372f5184ffb9c734f7148aee3f (diff)
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 <dtimoney@att.com>
-rw-r--r--ms/generic-resource-api/pom.xml59
-rwxr-xr-xms/generic-resource-api/src/main/dc/docker-compose.yaml29
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigNetworks.java64
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigNetworksRepository.java36
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVfModules.java77
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVfModulesRepository.java38
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVnfs.java60
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVnfsRepository.java36
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/NetworksKey.java30
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/VfModulesKey.java34
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/VnfsKey.java30
-rw-r--r--ms/generic-resource-api/src/main/resources/application.properties3
-rw-r--r--ms/generic-resource-api/src/main/resources/db/changelog/db.changelog-master.yaml546
-rw-r--r--ms/generic-resource-api/src/main/resources/dblib.properties8
-rw-r--r--ms/generic-resource-api/src/main/resources/log4j2.properties9
-rw-r--r--ms/generic-resource-api/src/main/resources/startGra.sh1
-rw-r--r--ms/generic-resource-api/src/test/resources/application.properties6
17 files changed, 1014 insertions, 52 deletions
diff --git a/ms/generic-resource-api/pom.xml b/ms/generic-resource-api/pom.xml
index 9bd2a61..fe5e63c 100644
--- a/ms/generic-resource-api/pom.xml
+++ b/ms/generic-resource-api/pom.xml
@@ -39,6 +39,7 @@
<gratest.mysql.user>gra</gratest.mysql.user>
<gratest.mysql.password>test123</gratest.mysql.password>
<docker.autoCreateCustomNetworks>true</docker.autoCreateCustomNetworks>
+ <liquibase.properties>${project.basedir}/src/main/resources/liquibase.properties</liquibase.properties>
</properties>
<dependencies>
@@ -83,7 +84,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
- </dependency>
+ </dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
@@ -159,6 +160,12 @@
<version>${ccsdk.sli.plugins.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.liquibase</groupId>
+ <artifactId>liquibase-core</artifactId>
+ <version>4.3.0</version>
+ </dependency>
+
<!-- this jersey jar is needed for rest api call node to function properly -->
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
@@ -322,15 +329,15 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
- <skipITs>true</skipITs>
+ <skipITs>true</skipITs>
</configuration>
</plugin>
</plugins>
@@ -374,7 +381,7 @@
<id>copy-dockerfile</id>
<goals>
<goal>copy-resources</goal>
- </goals><!-- here the phase you need -->
+ </goals> <!-- here the phase you need -->
<phase>initialize</phase>
<configuration>
<outputDirectory>${basedir}/target/docker-stage</outputDirectory>
@@ -393,7 +400,7 @@
<id>copy-config</id>
<goals>
<goal>copy-resources</goal>
- </goals><!-- here the phase you need -->
+ </goals> <!-- here the phase you need -->
<phase>generate-resources</phase>
<configuration>
<outputDirectory>${basedir}/target/docker-stage/opt/onap/sdnc/config</outputDirectory>
@@ -414,7 +421,7 @@
<id>copy-script</id>
<goals>
<goal>copy-resources</goal>
- </goals><!-- here the phase you need -->
+ </goals> <!-- here the phase you need -->
<phase>generate-resources</phase>
<configuration>
<outputDirectory>${basedir}/target/docker-stage/opt/onap/sdnc/bin</outputDirectory>
@@ -433,7 +440,7 @@
<id>copy-jar</id>
<goals>
<goal>copy-resources</goal>
- </goals><!-- here the phase you need -->
+ </goals> <!-- here the phase you need -->
<phase>package</phase>
<configuration>
<outputDirectory>${basedir}/target/docker-stage/opt/onap/sdnc/lib</outputDirectory>
@@ -454,20 +461,20 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
- <skipITs>false</skipITs>
- <environmentVariables>
- <GRA_PORT>${gra.port}</GRA_PORT>
- </environmentVariables>
+ <skipITs>false</skipITs>
+ <environmentVariables>
+ <GRA_PORT>${gra.port}</GRA_PORT>
+ </environmentVariables>
</configuration>
- </plugin>
+ </plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
@@ -534,10 +541,12 @@
<alias>gra-container</alias>
<run>
<env>
+ <MYSQL_ROOT_PASSWORD>${gratest.mysql.root.password}</MYSQL_ROOT_PASSWORD>
+ <MYSQL_DB_HOST>dbhost</MYSQL_DB_HOST>
<MYSQL_USER>${gratest.mysql.user}</MYSQL_USER>
<MYSQL_PASSWORD>${gratest.mysql.password}</MYSQL_PASSWORD>
<MYSQL_DATABASE>${gratest.mysql.database}</MYSQL_DATABASE>
- <LOG_LEVEL>TRACE</LOG_LEVEL>
+ <LOG_LEVEL>INFO</LOG_LEVEL>
<SDNC_CONFIG_DIR>/opt/onap/sdnc/config</SDNC_CONFIG_DIR>
</env>
<dependsOn>
@@ -553,7 +562,7 @@
</ports>
<wait>
<log>Started GenericResourceMsApp</log>
- <time>120000</time>
+ <time>180000</time>
</wait>
<log>
<enabled>true</enabled>
diff --git a/ms/generic-resource-api/src/main/dc/docker-compose.yaml b/ms/generic-resource-api/src/main/dc/docker-compose.yaml
index fc70f43..37a5807 100755
--- a/ms/generic-resource-api/src/main/dc/docker-compose.yaml
+++ b/ms/generic-resource-api/src/main/dc/docker-compose.yaml
@@ -7,11 +7,11 @@ services:
ports:
- "13306:3306"
environment:
- - MYSQL_ROOT_PASSWORD=itsASecret
+ - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_ROOT_HOST=%
- - MYSQL_USER=gra
- - MYSQL_PASSWORD=test123
- - MYSQL_DATABASE=gradb
+ - MYSQL_USER=${MYSQL_USER}
+ - MYSQL_PASSWORD=${MYSQL_PASSWORD}
+ - MYSQL_DATABASE=${MYSQL_DATABASE}
logging:
driver: "json-file"
options:
@@ -31,18 +31,17 @@ services:
- db:dbhost
environment:
- MYSQL_DB_HOST=dbhost
- - MYSQL_ROOT_PASSWORD=itsASecret
- - MYSQL_USER=gra
- - MYSQL_PASSWORD=test123
- - MYSQL_DATABASE=gradb
- - LOG_LEVEL=TRACE
+ - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
+ - MYSQL_USER=${MYSQL_USER}
+ - MYSQL_PASSWORD=${MYSQL_PASSWORD}
+ - MYSQL_DATABASE=${MYSQL_DATABASE}
+ - SDNC_CONFIG_DIR=/opt/onap/sdnc/config
+ - LOG_LEVEL=INFO
- TRUSTSTORE_PASSWORD=changeit
- CACERT_PASSWORD=changeit
- SDNC_CERT_DIR=/opt/onap/sdnc/config
- JAVA_SECURITY_DIR=/usr/lib/jvm/default-jvm/jre/lib/security
- TRUSTSTORE=truststoreONAPall.jks
- volumes:
- - ../resources:/opt/onap/sdnc/config
logging:
driver: "json-file"
options:
@@ -69,11 +68,11 @@ services:
- db:sdnctldb01
- db:sdnctldb02
environment:
- - MYSQL_ROOT_PASSWORD=itsASecret
+ - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- SDNC_CONFIG_DIR=/opt/onap/ccsdk/data/properties
- - MYSQL_USER=gra
- - MYSQL_PASSWORD=test123
- - MYSQL_DATABASE=gradb
+ - MYSQL_USER=${MYSQL_USER}
+ - MYSQL_PASSWORD=${MYSQL_PASSWORD}
+ - MYSQL_DATABASE=${MYSQL_DATABASE}
logging:
driver: "json-file"
options:
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigNetworks.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigNetworks.java
new file mode 100644
index 0000000..6aa1822
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigNetworks.java
@@ -0,0 +1,64 @@
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.hibernate.validator.constraints.Length;
+
+import javax.persistence.*;
+
+@Entity(name="CONFIG_GRA_NETWORKS")
+@Table(name="CONFIG_GRA_NETWORKS")
+@IdClass(NetworksKey.class)
+public class ConfigNetworks {
+ @Id
+ @Length(max = 100)
+ @Column(length = 100)
+ String svcInstanceId;
+
+ @Id
+ @Length(max = 100)
+ @Column(length = 100)
+ String networkId;
+
+ @Lob
+ String networkData;
+
+
+ public ConfigNetworks() {
+ this.svcInstanceId = "";
+ this.networkId = "";
+ this.networkData = "";
+ }
+
+ public ConfigNetworks(String svcInstanceId, String networkId, String networkData) {
+ this.svcInstanceId = svcInstanceId;
+ this.networkId = networkId;
+ this.networkData = networkData;
+ }
+
+
+
+ public String getSvcInstanceId() {
+ return svcInstanceId;
+ }
+
+ public void setSvcInstanceId(String svcInstanceId) {
+ this.svcInstanceId = svcInstanceId;
+ }
+
+ public String getNetworkId() {
+ return networkId;
+ }
+
+ public void setNetworkId(String networkId) {
+ this.networkId = networkId;
+ }
+
+ public String getNetworkData() {
+ return networkData;
+ }
+
+ public void setNetworkData(String networkData) {
+ this.networkData = networkData;
+ }
+
+
+} \ No newline at end of file
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigNetworksRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigNetworksRepository.java
new file mode 100644
index 0000000..56fc56c
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigNetworksRepository.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SDNC
+ * ================================================================================
+ * Copyright (C) 2020 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=========================================================
+ */
+
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Transactional
+public interface ConfigNetworksRepository extends CrudRepository<ConfigNetworks, Long> {
+
+ List<ConfigNetworks> findBySvcInstanceId(String svcInstanceId);
+ List<ConfigNetworks> findBySvcInstanceIdAndNetworkId(String svcInstanceId, String networkId);
+ long deleteBySvcInstanceId(String svcInstanceId);
+ long deleteBySvcInstanceIdAndNetworkId(String svcInstanceId, String networkId);
+
+}
+
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVfModules.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVfModules.java
new file mode 100644
index 0000000..609bd42
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVfModules.java
@@ -0,0 +1,77 @@
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.hibernate.validator.constraints.Length;
+
+import javax.persistence.*;
+
+@Entity(name="CONFIG_GRA_VF_MODULES")
+@Table(name="CONFIG_GRA_VF_MODULES")
+@IdClass(VfModulesKey.class)
+public class ConfigVfModules {
+ @Id
+ @Length(max = 100)
+ @Column(length = 100)
+ String svcInstanceId;
+
+ @Id
+ @Length(max = 100)
+ @Column(length = 100)
+ String vnfId;
+
+ @Id
+ @Length(max = 100)
+ @Column(length = 100)
+ String vfModuleId;
+
+ @Lob
+ String vfModuleData;
+
+
+ public ConfigVfModules() {
+ this.svcInstanceId = "";
+ this.vnfId = "";
+ this.vfModuleId = "";
+ this.vfModuleData = "";
+ }
+
+ public ConfigVfModules(String svcInstanceId, String vnfId, String vfModuleId, String vfModuleData) {
+ this.svcInstanceId = svcInstanceId;
+ this.vnfId = vnfId;
+ this.vfModuleId = vfModuleId;
+ this.vfModuleData = vfModuleData;
+ }
+
+ public String getSvcInstanceId() {
+ return svcInstanceId;
+ }
+
+ public void setSvcInstanceId(String svcInstanceId) {
+ this.svcInstanceId = svcInstanceId;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public String getVfModuleId() {
+ return vfModuleId;
+ }
+
+ public void setVfModuleId(String vfModuleId) {
+ this.vfModuleId = vfModuleId;
+ }
+
+ public String getVfModuleData() {
+ return vfModuleData;
+ }
+
+ public void setVfModuleData(String vfModuleData) {
+ this.vfModuleData = vfModuleData;
+ }
+
+
+} \ No newline at end of file
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVfModulesRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVfModulesRepository.java
new file mode 100644
index 0000000..8203483
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVfModulesRepository.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SDNC
+ * ================================================================================
+ * Copyright (C) 2020 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=========================================================
+ */
+
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Transactional
+public interface ConfigVfModulesRepository extends CrudRepository<ConfigVfModules, Long> {
+
+ List<ConfigVfModules> findBySvcInstanceId(String svcInstanceId);
+ List<ConfigVfModules> findBySvcInstanceIdAndVnfId(String svcInstanceId, String vnfId);
+ List<ConfigVfModules> findBySvcInstanceIdAndVnfIdAndVfModuleId(String svcInstanceId, String vnfId, String vfModuleId);
+ long deleteBySvcInstanceId(String svcInstanceId);
+ long deleteBySvcInstanceIdAndVnfId(String svcInstanceId, String vnfId);
+ long deleteBySvcInstanceIdAndVnfIdAndVfModuleId(String svcInstanceId, String vnfId, String vfModuleId);
+
+}
+
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVnfs.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVnfs.java
new file mode 100644
index 0000000..b932c1f
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVnfs.java
@@ -0,0 +1,60 @@
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.hibernate.validator.constraints.Length;
+
+import javax.persistence.*;
+
+@Entity(name="CONFIG_GRA_VNFS")
+@Table(name="CONFIG_GRA_VNFS")
+@IdClass(VnfsKey.class)
+public class ConfigVnfs {
+ @Id
+ @Length(max = 100)
+ @Column(length = 100)
+ String svcInstanceId;
+
+ @Id
+ @Length(max = 100)
+ @Column(length = 100)
+ String vnfId;
+
+ @Lob
+ String vnfData;
+
+
+ public ConfigVnfs() {
+ this.svcInstanceId = "";
+ this.vnfId = "";
+ this.vnfData = "";
+ }
+
+ public ConfigVnfs(String svcInstanceId, String vnfId, String vnfData) {
+ this.svcInstanceId = svcInstanceId;
+ this.vnfId = vnfId;
+ this.vnfData = vnfData;
+ }
+
+ public String getSvcInstanceId() {
+ return svcInstanceId;
+ }
+
+ public void setSvcInstanceId(String svcInstanceId) {
+ this.svcInstanceId = svcInstanceId;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public String getVnfData() {
+ return vnfData;
+ }
+
+ public void setVnfData(String vnfData) {
+ this.vnfData = vnfData;
+ }
+} \ No newline at end of file
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVnfsRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVnfsRepository.java
new file mode 100644
index 0000000..3909eb3
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigVnfsRepository.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SDNC
+ * ================================================================================
+ * Copyright (C) 2020 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=========================================================
+ */
+
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Transactional
+public interface ConfigVnfsRepository extends CrudRepository<ConfigVnfs, Long> {
+
+ List<ConfigVnfs> findBySvcInstanceId(String svcInstanceId);
+ List<ConfigVnfs> findBySvcInstanceIdAndVnfId(String svcInstanceId, String vnfId);
+ long deleteBySvcInstanceId(String svcInstanceId);
+ long deleteBySvcInstanceIdAndVnfId(String svcInstanceId, String vnfId);
+
+}
+
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/NetworksKey.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/NetworksKey.java
new file mode 100644
index 0000000..61f7602
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/NetworksKey.java
@@ -0,0 +1,30 @@
+package org.onap.sdnc.apps.ms.gra.data;
+
+import java.io.Serializable;
+
+public class NetworksKey implements Serializable {
+ private String svcInstanceId = "";
+ private String networkId = "";
+
+ public NetworksKey() {
+ this.svcInstanceId = "";
+ this.networkId = "";
+ }
+
+ public NetworksKey(String svcInstanceId, String networkId) {
+ this.svcInstanceId = svcInstanceId;
+ this.networkId = networkId;
+ }
+
+ @Override
+ public int hashCode() {
+ return svcInstanceId.hashCode() + networkId.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return (obj instanceof NetworksKey &&
+ svcInstanceId.equals(((NetworksKey)obj).svcInstanceId) &&
+ networkId.equals(((NetworksKey)obj).networkId));
+ }
+}
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/VfModulesKey.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/VfModulesKey.java
new file mode 100644
index 0000000..bf44cc9
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/VfModulesKey.java
@@ -0,0 +1,34 @@
+package org.onap.sdnc.apps.ms.gra.data;
+
+import java.io.Serializable;
+
+public class VfModulesKey implements Serializable {
+ private String svcInstanceId = "";
+ private String vnfId = "";
+ private String vfModuleId = "";
+
+ public VfModulesKey() {
+ this.svcInstanceId = "";
+ this.vnfId = "";
+ this.vfModuleId = "";
+ }
+
+ public VfModulesKey(String svcInstanceId, String vnfId, String vfModuleId) {
+ this.svcInstanceId = svcInstanceId;
+ this.vnfId = vnfId;
+ this.vfModuleId = vfModuleId;
+ }
+
+ @Override
+ public int hashCode() {
+ return svcInstanceId.hashCode() + vnfId.hashCode()+vfModuleId.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return (obj instanceof VfModulesKey &&
+ svcInstanceId.equals(((VfModulesKey)obj).svcInstanceId) &&
+ vnfId.equals(((VfModulesKey)obj).vnfId) &&
+ vfModuleId.equals(((VfModulesKey)obj).vfModuleId));
+ }
+}
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/VnfsKey.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/VnfsKey.java
new file mode 100644
index 0000000..f19c95e
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/VnfsKey.java
@@ -0,0 +1,30 @@
+package org.onap.sdnc.apps.ms.gra.data;
+
+import java.io.Serializable;
+
+public class VnfsKey implements Serializable {
+ private String svcInstanceId = "";
+ private String vnfId = "";
+
+ public VnfsKey() {
+ this.svcInstanceId = "";
+ this.vnfId = "";
+ }
+
+ public VnfsKey(String svcInstanceId, String vnfId) {
+ this.svcInstanceId = svcInstanceId;
+ this.vnfId = vnfId;
+ }
+
+ @Override
+ public int hashCode() {
+ return svcInstanceId.hashCode() + vnfId.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return (obj instanceof VnfsKey &&
+ svcInstanceId.equals(((VnfsKey)obj).svcInstanceId) &&
+ vnfId.equals(((VnfsKey)obj).vnfId));
+ }
+}
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
diff --git a/ms/generic-resource-api/src/test/resources/application.properties b/ms/generic-resource-api/src/test/resources/application.properties
index a3a99b8..3c8d91e 100644
--- a/ms/generic-resource-api/src/test/resources/application.properties
+++ b/ms/generic-resource-api/src/test/resources/application.properties
@@ -13,10 +13,10 @@ spring.datasource.driver-class-name=org.apache.derby.jdbc.EmbeddedDriver
spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1
spring.datasource.continue-on-error=true
-spring.jpa.show-sql=true
-spring.jpa.hibernate.ddl-auto=update
+spring.jpa.show-sql=false
+spring.jpa.properties.hibernate.default_schema=gra
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.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.database=derby
serviceLogicProperties=src/test/resources/svclogic.properties