summaryrefslogtreecommitdiffstats
path: root/src/main/scripts
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@linuxfoundation.org>2018-08-13 23:42:40 +0000
committerRamaSubbaReddy <rama.subba.reddy.s@huawei.com>2018-10-03 12:08:26 +0530
commit11a3345cf03c2ad820fa40440dbe4c89eb963b26 (patch)
tree24a5be90c240d49d553ec79c267729c9e976e1dc /src/main/scripts
parentf9cbcb5f93fa07852ea06cffe6eac6bc09c53ce1 (diff)
Add RestConf Collector
Issue-ID: DCAEGEN2-612 1. Instantiated to support CCVPN Close Loop Use Case 2. In general, this supports data collection from all PNF or devices that supports RestConf protocol Change-Id: I6311ad618e8d68badc5423a63d7781a19dc62829 Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
Diffstat (limited to 'src/main/scripts')
-rwxr-xr-xsrc/main/scripts/docker_entry.sh6
-rwxr-xr-xsrc/main/scripts/restConfCollector.sh100
2 files changed, 106 insertions, 0 deletions
diff --git a/src/main/scripts/docker_entry.sh b/src/main/scripts/docker_entry.sh
new file mode 100755
index 0000000..78b83f6
--- /dev/null
+++ b/src/main/scripts/docker_entry.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+echo "INFO: USING RESTCONF CONTROLLER"
+
+/opt/app/restconfcollector/bin/restConfCollector.sh stop
+/opt/app/restconfcollector/bin/restConfCollector.sh start \ No newline at end of file
diff --git a/src/main/scripts/restConfCollector.sh b/src/main/scripts/restConfCollector.sh
new file mode 100755
index 0000000..88893c0
--- /dev/null
+++ b/src/main/scripts/restConfCollector.sh
@@ -0,0 +1,100 @@
+#!/bin/sh
+
+usage() {
+ echo "restConfCollector.sh <start/stop>"
+}
+
+BASEDIR=/opt/app/restconfcollector
+rm -rf /opt/app/restconfcollector/logs
+mkdir /opt/app/restconfcollector/logs
+cd /opt/app/restconfcollector/logs
+touch console.txt
+cd -
+
+restConfCollector_start() {
+ echo `date +"%Y%m%d.%H%M%S%3N"` - restConfCollector_start | tee -a ${BASEDIR}/logs/console.txt
+ collectorPid=`pgrep -f org.onap.restconf.common`
+
+ if [ ! -z "$collectorPid" ]; then
+ echo "WARNING: restConf Collector already running as PID $collectorPid" | tee -a ${BASEDIR}/logs/console.txt
+ echo "Startup Aborted!!!" | tee -a ${BASEDIR}/logs/console.txt
+ exit 1
+ fi
+
+
+ # run java. The classpath is the etc dir for config files, and the lib dir
+ # for all the jars.
+
+ cd ${BASEDIR}
+ echo "192.168.17.11 onap-message-router" >> /etc/hosts
+ nohup $JAVA -cp "etc${PATHSEP}lib/*" $JAVA_OPTS -Dhttps.protocols=TLSv1.1,TLSv1.2 $MAINCLASS $* &
+ if [ $? -ne 0 ]; then
+ echo "restConf Collector has been started!!!" | tee -a ${BASEDIR}/logs/console.txt
+ fi
+
+
+}
+
+## Pre-setting
+JAVA_HOME=/usr/bin/java
+
+# use JAVA_HOME if provided
+if [ -z "$JAVA_HOME" ]; then
+ echo "ERROR: JAVA_HOME not setup"
+ echo "Startup Aborted!!"
+ exit 1
+else
+ JAVA=$JAVA_HOME
+fi
+
+MAINCLASS=org.onap.dcae.collectors.restconf.common.RestConfCollector
+
+# determine a path separator that works for this platform
+PATHSEP=":"
+case "$(uname -s)" in
+
+ Darwin)
+ ;;
+
+ Linux)
+ ;;
+
+ CYGWIN*|MINGW32*|MSYS*)
+ PATHSEP=";"
+ ;;
+
+ *)
+ ;;
+esac
+
+restConfCollector_stop() {
+ echo `date +"%Y%m%d.%H%M%S%3N"` - collector_stop
+ collectorPid=`pgrep -f org.onap.dcae.collectors.restconf.common`
+ if [ ! -z "$collectorPid" ]; then
+ echo "Stopping PID $collectorPid"
+
+ kill -9 $collectorPid
+ sleep 5
+ if [ ! "$(pgrep -f org.onap.restconf.common)" ]; then
+ echo "restConf Collector has been stopped!!!"
+ else
+ echo "restConf Collector is being stopped!!!"
+ fi
+ else
+ echo "WARNING: No restConf Collector instance is currently running";
+ exit 1
+ fi
+
+}
+
+case $1 in
+ "start")
+ restConfCollector_start | tee -a ${BASEDIR}/logs/console.txt
+ ;;
+ "stop")
+ restConfCollector_stop | tee -a ${BASEDIR}/logs/console.txt
+ ;;
+ *)
+ usage
+ ;;
+esac