aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scripts')
-rw-r--r--src/main/scripts/VESrestfulCollector.sh169
-rw-r--r--src/main/scripts/VESrestfulCollector_Status.sh41
-rw-r--r--src/main/scripts/build.sh23
-rw-r--r--src/main/scripts/docker-entry.sh32
-rw-r--r--src/main/scripts/reconfigure.sh32
-rw-r--r--src/main/scripts/run-dcae-controller-ves-collector-daemon.sh39
-rw-r--r--src/main/scripts/run-dcae-controller-ves-collector-interactive.sh39
7 files changed, 375 insertions, 0 deletions
diff --git a/src/main/scripts/VESrestfulCollector.sh b/src/main/scripts/VESrestfulCollector.sh
new file mode 100644
index 00000000..2f71bf76
--- /dev/null
+++ b/src/main/scripts/VESrestfulCollector.sh
@@ -0,0 +1,169 @@
+#!/bin/sh
+
+###
+# ============LICENSE_START=======================================================
+# PROJECT
+# ================================================================================
+# Copyright (C) 2017 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=========================================================
+###
+
+# redirect stdout/stderr to a file
+#exec &> /opt/app/VESCollector/logs/console.txt
+
+usage() {
+ echo "VESrestfulCollector.sh <start/stop>"
+}
+
+
+collector_start() {
+ echo `date +"%Y%m%d.%H%M%S%3N"` - collector_start | tee -a /opt/app/VESCollector/logs/console.txt
+ collectorPid=`pgrep -f org.onap.dcae.commonFunction`
+
+ if [ ! -z "$collectorPid" ]; then
+ echo "WARNING: VES Restful Collector already running as PID $collectorPid" | tee -a /opt/app/VESCollector/logs/console.txt
+ echo "Startup Aborted!!!" | tee -a /opt/app/VESCollector/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 /opt/app/VESCollector/
+ nohup $JAVA -cp "etc${PATHSEP}lib/*" $JAVA_OPTS -Dhttps.protocols=TLSv1.1,TLSv1.2 $MAINCLASS $* &
+ if [ $? -ne 0 ]; then
+ echo "VES Restful Collector has been started!!!" | tee -a /opt/app/VESCollector/logs/console.txt
+ fi
+
+
+}
+
+collector_stop() {
+ echo `date +"%Y%m%d.%H%M%S%3N"` - collector_stop
+ collectorPid=`pgrep -f org.onap.dcae.commonFunction`
+ if [ ! -z "$collectorPid" ]; then
+ echo "Stopping PID $collectorPid"
+
+ kill -9 $collectorPid
+ sleep 5
+ if [ ! "$(pgrep -f org.onap.dcae.commonFunction)" ]; then
+ echo "VES Restful Collector has been stopped!!!"
+ else
+ echo "VES Restful Collector is being stopped!!!"
+ fi
+ else
+ echo "WARNING: No VES Collector instance is currently running";
+ exit 1
+ fi
+
+
+}
+
+collector_configupdate() {
+
+ echo `date +"%Y%m%d.%H%M%S%3N"` - collector_configupdate
+ if [ -z "$CONSUL_HOST" ] || [ -z "$CONFIG_BINDING_SERVICE" ] || [ -z "$HOSTNAME" ]; then
+ echo "INFO: USING STANDARD CONTROLLER CONFIGURATION"
+ else
+
+ echo "INFO: DYNAMIC CONFIG INTERFACE SUPPORTED"
+ # move into base directory
+
+ #BASEDIR=`dirname $0`
+ #cd $BASEDIR/..
+ cd /opt/app/VESCollector
+
+ CONFIG_FETCH=org.onap.dcae.controller.FetchDynamicConfig
+ $JAVA -cp "etc${PATHSEP}lib/*" $CONFIG_FETCH $*
+ if [ $? -ne 0 ]; then
+ echo "ERROR: Failed to fetch dynamic configuration from consul into container /opt/app/KV-Configuration.json"
+ else
+ echo "INFO: Dynamic config fetched and written successfully into container /opt/app/KV-Configuration.json"
+ fi
+
+
+ if [ -f /opt/app/KV-Configuration.json ]; then
+
+ CONFIG_UPDATER=org.onap.dcae.controller.LoadDynamicConfig
+ $JAVA -cp "etc${PATHSEP}lib/*" $CONFIG_UPDATER $*
+ if [ $? -ne 0 ]; then
+ echo "ERROR: Failed to update dynamic configuration into Application"
+ else
+ echo "INFO: Dynamic config updated successfully into VESCollector configuration!"
+ fi
+ else
+ echo "ERROR: Configuration file /opt/app/KV-Configuration.json missing"
+ fi
+
+ fi
+}
+
+
+## Check usage
+if [ $# -ne 1 ]; then
+ usage
+ exit
+fi
+
+
+## Pre-setting
+
+# use JAVA_HOME if provided
+if [ -z "$JAVA_HOME" ]; then
+ echo "ERROR: JAVA_HOME not setup"
+ echo "Startup Aborted!!"
+ exit 1
+ #JAVA=java
+else
+ JAVA=$JAVA_HOME/bin/java
+fi
+
+
+MAINCLASS=org.onap.dcae.commonFunction.CommonStartup
+
+# determine a path separator that works for this platform
+PATHSEP=":"
+case "$(uname -s)" in
+
+ Darwin)
+ ;;
+
+ Linux)
+ ;;
+
+ CYGWIN*|MINGW32*|MSYS*)
+ PATHSEP=";"
+ ;;
+
+ *)
+ ;;
+esac
+
+
+
+
+case $1 in
+ "start")
+ collector_configupdate | tee -a /opt/app/VESCollector/logs/console.txt
+ collector_start
+ ;;
+ "stop")
+ collector_stop | tee -a /opt/app/VESCollector/logs/console.txt
+ ;;
+ *)
+ usage
+ ;;
+esac
+
diff --git a/src/main/scripts/VESrestfulCollector_Status.sh b/src/main/scripts/VESrestfulCollector_Status.sh
new file mode 100644
index 00000000..47be7a14
--- /dev/null
+++ b/src/main/scripts/VESrestfulCollector_Status.sh
@@ -0,0 +1,41 @@
+###
+# ============LICENSE_START=======================================================
+# PROJECT
+# ================================================================================
+# Copyright (C) 2017 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=========================================================
+###
+
+#!/bin/sh
+
+#secPid=`pgrep -f com.att.dcae.commonFunction.CommonStartup` --> master
+secPid=`pgrep -f org.onap.dcae.commonFunction.CommonStartup`
+
+
+if [ "${secPid}" ]
+then
+ #errorcnt = `grep -c "CambriaSimplerBatchPublisher - Send failed" ../logs/collector.log`
+ errorcnt=`tail -1000 ../logs/collector.log | grep -c "CambriaSimplerBatchPublisher - Send failed"`
+
+ if [ $errorcnt -gt 10 ]
+ then
+ echo "VESCollecter_Is_HavingError to publish"
+ else
+ echo "VESCollecter_Is_Running as PID $secPid"
+ fi
+else
+ echo "VESCollecter_Is_Not_Running"
+fi
+exit
diff --git a/src/main/scripts/build.sh b/src/main/scripts/build.sh
new file mode 100644
index 00000000..cc91edbb
--- /dev/null
+++ b/src/main/scripts/build.sh
@@ -0,0 +1,23 @@
+
+###
+# ============LICENSE_START=======================================================
+# PROJECT
+# ================================================================================
+# Copyright (C) 2017 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=========================================================
+###
+
+#docker build --force-rm --file Dockerfile -t dcae-controller-ves-collector:latest
+sudo docker build -t dcae-controller-ves-collector:1.1.3 .
diff --git a/src/main/scripts/docker-entry.sh b/src/main/scripts/docker-entry.sh
new file mode 100644
index 00000000..e8766d6f
--- /dev/null
+++ b/src/main/scripts/docker-entry.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+###
+# ============LICENSE_START=======================================================
+# PROJECT
+# ================================================================================
+# Copyright (C) 2017 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=========================================================
+###
+
+
+if [ -z "$CONSUL_HOST" ] || [ -z "$CONFIG_BINDING_SERVICE" ] || [ -z "$HOSTNAME" ]; then
+ echo "INFO: USING STANDARD CONTROLLER"
+ /opt/app/manager/start-manager.sh
+else
+ echo "INFO: USING DCAEGEN2 CONTROLLER"
+ /opt/app/VESCollector/bin/VESrestfulCollector.sh stop
+ /opt/app/VESCollector/bin/VESrestfulCollector.sh start &
+fi
+#while true; do sleep 1000; done
diff --git a/src/main/scripts/reconfigure.sh b/src/main/scripts/reconfigure.sh
new file mode 100644
index 00000000..e8766d6f
--- /dev/null
+++ b/src/main/scripts/reconfigure.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+###
+# ============LICENSE_START=======================================================
+# PROJECT
+# ================================================================================
+# Copyright (C) 2017 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=========================================================
+###
+
+
+if [ -z "$CONSUL_HOST" ] || [ -z "$CONFIG_BINDING_SERVICE" ] || [ -z "$HOSTNAME" ]; then
+ echo "INFO: USING STANDARD CONTROLLER"
+ /opt/app/manager/start-manager.sh
+else
+ echo "INFO: USING DCAEGEN2 CONTROLLER"
+ /opt/app/VESCollector/bin/VESrestfulCollector.sh stop
+ /opt/app/VESCollector/bin/VESrestfulCollector.sh start &
+fi
+#while true; do sleep 1000; done
diff --git a/src/main/scripts/run-dcae-controller-ves-collector-daemon.sh b/src/main/scripts/run-dcae-controller-ves-collector-daemon.sh
new file mode 100644
index 00000000..544bf3f6
--- /dev/null
+++ b/src/main/scripts/run-dcae-controller-ves-collector-daemon.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# PROJECT
+# ================================================================================
+# Copyright (C) 2017 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=========================================================
+###
+
+
+IMAGE="dcae-controller-ves-collector"
+VER="latest"
+HOST=$(hostname)
+NAME="ves-collector-$HOST"
+HOST=$(hostname -f)
+
+HOST_VM_LOGDIR="/var/log/${HOST}-docker"
+
+CMD="/bin/bash"
+# remove the imate, interactive terminal, map exposed port
+set -x
+#docker run -d -p 8080:8080/tcp -p 8443:8443/tcp -P --name ${NAME} ${IMAGE}:${VER}
+#docker run -td --name ${NAME} ${IMAGE}:${VER} ${CMD}
+#docker run -td --name ${NAME} ${IMAGE}:${VER}
+docker run -td -p 8080:8080/tcp -p 8443:8443/tcp -P --name ${NAME} ${IMAGE}:${VER} ${CMD}
+
diff --git a/src/main/scripts/run-dcae-controller-ves-collector-interactive.sh b/src/main/scripts/run-dcae-controller-ves-collector-interactive.sh
new file mode 100644
index 00000000..e5759b10
--- /dev/null
+++ b/src/main/scripts/run-dcae-controller-ves-collector-interactive.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# PROJECT
+# ================================================================================
+# Copyright (C) 2017 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=========================================================
+###
+
+
+IMAGE="dcae-controller-ves-collector"
+VER="latest"
+HOST=$(hostname)
+NAME="ves-collector-$HOST"
+HOST=$(hostname -f)
+CMD="/bin/bash"
+
+HOST_VM_LOGDIR="/var/log/${HOST}-docker-${IMAGE}"
+
+# remove the imate, interactive terminal, map exposed port
+set -x
+docker run --rm -it -v ${HOST_VM_LOGDIR}/manager_ves-collector:/opt/app/manager/logs \
+ -v ${HOST_VM_LOGDIR}/VEScollector:/opt/app/VEScollector/logs \
+ -v /etc/dcae:/etc/dcae \
+ --name ${NAME} ${IMAGE}:${VER} \
+ ${CMD}