aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimoney, Dan (dt5972) <dt5972@att.com>2018-05-30 10:23:48 -0400
committerTimoney, Dan (dt5972) <dt5972@att.com>2018-05-30 10:45:55 -0400
commitc12079ad6151ef2cc59e482fc65af5dcb9bb8b37 (patch)
tree226f191e2897997fb50bc74d2b6ee5564b1f116c
parent75240874408a9714bdf84b1a4b3bfa641c1699c8 (diff)
Fix ref to SERVICE_MODEL
Network model dump incorrectly refers to SERVICE_MODEL in lower case. Fixed the reference, but also added script to remove the offending foreign key (FK_NETWORK_MODEL) to be consistent with workaround used throughout Beijing testing. For Casablanca, will remove call to that script and test using fixed foreign key. Change-Id: I5ce5d99d6c217c4bd713268a232c902f2d849c62 Issue-ID: SDNC-291 Signed-off-by: Timoney, Dan (dt5972) <dt5972@att.com> Former-commit-id: 1df1b909791232ac15eb682328d27d736443f877
-rw-r--r--installation/sdnc/src/main/resources/network_model.data.dump2
-rw-r--r--installation/sdnc/src/main/scripts/installSdncDb.sh3
-rw-r--r--installation/sdnc/src/main/scripts/rmForeignKey.sh18
3 files changed, 22 insertions, 1 deletions
diff --git a/installation/sdnc/src/main/resources/network_model.data.dump b/installation/sdnc/src/main/resources/network_model.data.dump
index 9d9cb1f6..f0c256fb 100644
--- a/installation/sdnc/src/main/resources/network_model.data.dump
+++ b/installation/sdnc/src/main/resources/network_model.data.dump
@@ -53,7 +53,7 @@ CREATE TABLE `NETWORK_MODEL` (
`version` varchar(255) DEFAULT NULL,
PRIMARY KEY (`customization_uuid`),
KEY `FK_NETWORK_MODEL` (`service_uuid`),
- CONSTRAINT `FK_NETWORK_MODEL` FOREIGN KEY (`service_uuid`) REFERENCES `service_model` (`service_uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION
+ CONSTRAINT `FK_NETWORK_MODEL` FOREIGN KEY (`service_uuid`) REFERENCES `SERVICE_MODEL` (`service_uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
diff --git a/installation/sdnc/src/main/scripts/installSdncDb.sh b/installation/sdnc/src/main/scripts/installSdncDb.sh
index 7f05d723..e726f5f8 100644
--- a/installation/sdnc/src/main/scripts/installSdncDb.sh
+++ b/installation/sdnc/src/main/scripts/installSdncDb.sh
@@ -52,3 +52,6 @@ done
# Create VNIs 100-199
${SDNC_HOME}/bin/addVnis.sh 100 199
+
+# Drop FK_NETWORK_MODEL foreign key as workaround for SDNC-291.
+${SDNC_HOME}/bin/rmForeignKey.sh NETWORK_MODEL FK_NETWORK_MODEL
diff --git a/installation/sdnc/src/main/scripts/rmForeignKey.sh b/installation/sdnc/src/main/scripts/rmForeignKey.sh
new file mode 100644
index 00000000..40914fa2
--- /dev/null
+++ b/installation/sdnc/src/main/scripts/rmForeignKey.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+MYSQL_USER=${MYSQL_USER:-sdnctl}
+MYSQL_PWD=${MYSQL_PWD:-gamma}
+MYSQL_DB=${MYSQL_DB:-sdnctl}
+MYSQL_HOST=${MYSQL_HOST:-dbhost}
+
+
+if [ $# -ne 2 ]
+then
+ echo "Usage: $0 table foreign-key"
+ exit 1
+fi
+
+mysql --user=${MYSQL_USER} --password=${MYSQL_PWD} --host ${MYSQL_HOST} ${MYSQL_DB} <<EOF
+ALTER TABLE $1
+DROP FOREIGN KEY $2;
+EOF