From ba1a94e889321db1f73aa04344744e27af3857a2 Mon Sep 17 00:00:00 2001
From: MJB <mjb@it-innovation.soton.ac.uk>
Date: Wed, 14 Feb 2018 12:45:30 +0000
Subject: [PATCH] refactored the install scripts so that they don't have the
 service name, simplies the orchestration in vagrant, openstack and later for
 the orchestator

---
 Vagrantfile                                   |  7 ++---
 infra/full/rspec.yml                          |  2 --
 infra/streaming-sim/rspec.yml                 |  2 --
 infra/streaming/rspec.yml                     |  2 --
 .../{install-clmc-agent.sh => install.sh}     |  0
 .../{install-clmc-service.sh => install.sh}   |  4 +++
 scripts/clmc-service/start-clmc-service.sh    | 31 -------------------
 .../apache/{install-apache.sh => install.sh}  |  0
 ...e_template.conf => telegraf_template.conf} |  0
 .../ffmpeg/{install-ffmpeg.sh => install.sh}  |  0
 ...g_template.conf => telegraf_template.conf} |  0
 .../{install-ipendpoint.sh => install.sh}     |  0
 ...t_template.conf => telegraf_template.conf} |  0
 .../jmeter/{install-jmeter.sh => install.sh}  |  0
 .../mongo/{install-mongo.sh => install.sh}    |  0
 ...o_template.conf => telegraf_template.conf} |  0
 .../nginx/{install-nginx.sh => install.sh}    |  0
 ...x_template.conf => telegraf_template.conf} |  0
 .../vlc/{install-vlc.sh => install.sh}        |  0
 ...c_template.conf => telegraf_template.conf} |  0
 test/streaming-sim/VerifySimResults.py        |  2 +-
 21 files changed, 8 insertions(+), 42 deletions(-)
 rename scripts/clmc-agent/{install-clmc-agent.sh => install.sh} (100%)
 mode change 100755 => 100644
 rename scripts/clmc-service/{install-clmc-service.sh => install.sh} (95%)
 mode change 100755 => 100644
 delete mode 100755 scripts/clmc-service/start-clmc-service.sh
 rename test/services/apache/{install-apache.sh => install.sh} (100%)
 mode change 100755 => 100644
 rename test/services/apache/{telegraf_apache_template.conf => telegraf_template.conf} (100%)
 rename test/services/ffmpeg/{install-ffmpeg.sh => install.sh} (100%)
 mode change 100755 => 100644
 rename test/services/ffmpeg/{telegraf_ffmpeg_template.conf => telegraf_template.conf} (100%)
 rename test/services/ipendpoint/{install-ipendpoint.sh => install.sh} (100%)
 mode change 100755 => 100644
 rename test/services/ipendpoint/{telegraf_ipendpoint_template.conf => telegraf_template.conf} (100%)
 rename test/services/jmeter/{install-jmeter.sh => install.sh} (100%)
 rename test/services/mongo/{install-mongo.sh => install.sh} (100%)
 mode change 100755 => 100644
 rename test/services/mongo/{telegraf_mongo_template.conf => telegraf_template.conf} (100%)
 rename test/services/nginx/{install-nginx.sh => install.sh} (100%)
 mode change 100755 => 100644
 rename test/services/nginx/{telegraf_nginx_template.conf => telegraf_template.conf} (100%)
 rename test/services/vlc/{install-vlc.sh => install.sh} (100%)
 rename test/services/vlc/{telegraf_vlc_template.conf => telegraf_template.conf} (100%)

diff --git a/Vagrantfile b/Vagrantfile
index a76275d..d6485c9 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -87,13 +87,12 @@ Vagrant.configure("2") do |config|
       puts "Instance name #{instance_name}:"
       case instance_name
         when 'clmc-service'
-          instance_config.vm.provision :shell, :path => "scripts/clmc-service/#{host["install_script"]}"
-          instance_config.vm.provision :shell, :path => "scripts/clmc-service/#{host["start_script"]}" 
+          instance_config.vm.provision :shell, :path => "scripts/clmc-service/install.sh"
         else
           # specific service install
-          instance_config.vm.provision :shell, :path => "test/services/#{host["service_name"]}/install-#{host["service_name"]}.sh"     
+          instance_config.vm.provision :shell, :path => "test/services/#{host["service_name"]}/install.sh"     
           # CLMC agent install
-          instance_config.vm.provision :shell, :path => "scripts/clmc-agent/install-clmc-agent.sh", :args => "/vagrant/test/services/#{host["service_name"]}/telegraf_#{host["service_name"]}_template.conf #{host["location"]} #{host["sfc_id"]} #{host["sfc_id_instance"]} #{host["sf_id"]} #{host["sf_id_instance"]} #{host["ipendpoint_id"]} #{host["influxdb_url"]} #{host["database_name"]}"
+          instance_config.vm.provision :shell, :path => "scripts/clmc-agent/install.sh", :args => "/vagrant/test/services/#{host["service_name"]}/telegraf_template.conf #{host["location"]} #{host["sfc_id"]} #{host["sfc_id_instance"]} #{host["sf_id"]} #{host["sf_id_instance"]} #{host["ipendpoint_id"]} #{host["influxdb_url"]} #{host["database_name"]}"
       end
 
       
diff --git a/infra/full/rspec.yml b/infra/full/rspec.yml
index 99153af..06acf9a 100644
--- a/infra/full/rspec.yml
+++ b/infra/full/rspec.yml
@@ -11,8 +11,6 @@ hosts:
       - guest: 9092
         host: 9092
     ip_address: "192.168.50.10"
-    install_script: "install-clmc-service.sh"
-    start_script: "start-clmc-service.sh"
   - name: apache1
     cpus: 1
     memory: 2048
diff --git a/infra/streaming-sim/rspec.yml b/infra/streaming-sim/rspec.yml
index 11850d0..cd62eeb 100644
--- a/infra/streaming-sim/rspec.yml
+++ b/infra/streaming-sim/rspec.yml
@@ -11,8 +11,6 @@ hosts:
       - guest: 9092
         host: 9092
     ip_address: "192.168.50.10"
-    install_script: "install-clmc-service.sh"
-    start_script: "start-clmc-service.sh"
   - name: ipendpoint1
     cpus: 1
     memory: 2048
diff --git a/infra/streaming/rspec.yml b/infra/streaming/rspec.yml
index b83a5ba..b2b15e4 100644
--- a/infra/streaming/rspec.yml
+++ b/infra/streaming/rspec.yml
@@ -11,8 +11,6 @@ hosts:
       - guest: 9092
         host: 9092
     ip_address: "192.168.50.10"
-    install_script: "install-clmc-service.sh"
-    start_script: "start-clmc-service.sh"
   - name: apache1
     cpus: 1
     memory: 2048
diff --git a/scripts/clmc-agent/install-clmc-agent.sh b/scripts/clmc-agent/install.sh
old mode 100755
new mode 100644
similarity index 100%
rename from scripts/clmc-agent/install-clmc-agent.sh
rename to scripts/clmc-agent/install.sh
diff --git a/scripts/clmc-service/install-clmc-service.sh b/scripts/clmc-service/install.sh
old mode 100755
new mode 100644
similarity index 95%
rename from scripts/clmc-service/install-clmc-service.sh
rename to scripts/clmc-service/install.sh
index 42e247a..7850c75
--- a/scripts/clmc-service/install-clmc-service.sh
+++ b/scripts/clmc-service/install.sh
@@ -39,3 +39,7 @@ dpkg -i kapacitor_1.3.1_amd64.deb
 # install Chronograf
 wget https://dl.influxdata.com/chronograf/releases/chronograf_1.3.3.0_amd64.deb
 dpkg -i chronograf_1.3.3.0_amd64.deb
+
+systemctl start influxdb
+systemctl start kapacitor
+systemctl start chronograf
diff --git a/scripts/clmc-service/start-clmc-service.sh b/scripts/clmc-service/start-clmc-service.sh
deleted file mode 100755
index f92c6b5..0000000
--- a/scripts/clmc-service/start-clmc-service.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-#/////////////////////////////////////////////////////////////////////////
-#//
-#// (c) University of Southampton IT Innovation Centre, 2018
-#//
-#// Copyright in this software belongs to University of Southampton
-#// IT Innovation Centre of Gamma House, Enterprise Road,
-#// Chilworth Science Park, Southampton, SO16 7NS, UK.
-#//
-#// This software may not be used, sold, licensed, transferred, copied
-#// or reproduced in whole or in part in any manner or form or in or
-#// on any media by any person other than in accordance with the terms
-#// of the Licence Agreement supplied with the software, or otherwise
-#// without the prior written consent of the copyright owners.
-#//
-#// This software is distributed WITHOUT ANY WARRANTY, without even the
-#// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-#// PURPOSE, except where stated in the Licence Agreement supplied with
-#// the software.
-#//
-#//      Created By :            Simon Crowle
-#//      Created Date :          03/11/2018
-#//      Created for Project :   FLAME
-#//
-#/////////////////////////////////////////////////////////////////////////
-
-echo Starting TICK stack services...
-
-systemctl start influxdb
-systemctl start kapacitor
-systemctl start chronograf
\ No newline at end of file
diff --git a/test/services/apache/install-apache.sh b/test/services/apache/install.sh
old mode 100755
new mode 100644
similarity index 100%
rename from test/services/apache/install-apache.sh
rename to test/services/apache/install.sh
diff --git a/test/services/apache/telegraf_apache_template.conf b/test/services/apache/telegraf_template.conf
similarity index 100%
rename from test/services/apache/telegraf_apache_template.conf
rename to test/services/apache/telegraf_template.conf
diff --git a/test/services/ffmpeg/install-ffmpeg.sh b/test/services/ffmpeg/install.sh
old mode 100755
new mode 100644
similarity index 100%
rename from test/services/ffmpeg/install-ffmpeg.sh
rename to test/services/ffmpeg/install.sh
diff --git a/test/services/ffmpeg/telegraf_ffmpeg_template.conf b/test/services/ffmpeg/telegraf_template.conf
similarity index 100%
rename from test/services/ffmpeg/telegraf_ffmpeg_template.conf
rename to test/services/ffmpeg/telegraf_template.conf
diff --git a/test/services/ipendpoint/install-ipendpoint.sh b/test/services/ipendpoint/install.sh
old mode 100755
new mode 100644
similarity index 100%
rename from test/services/ipendpoint/install-ipendpoint.sh
rename to test/services/ipendpoint/install.sh
diff --git a/test/services/ipendpoint/telegraf_ipendpoint_template.conf b/test/services/ipendpoint/telegraf_template.conf
similarity index 100%
rename from test/services/ipendpoint/telegraf_ipendpoint_template.conf
rename to test/services/ipendpoint/telegraf_template.conf
diff --git a/test/services/jmeter/install-jmeter.sh b/test/services/jmeter/install.sh
similarity index 100%
rename from test/services/jmeter/install-jmeter.sh
rename to test/services/jmeter/install.sh
diff --git a/test/services/mongo/install-mongo.sh b/test/services/mongo/install.sh
old mode 100755
new mode 100644
similarity index 100%
rename from test/services/mongo/install-mongo.sh
rename to test/services/mongo/install.sh
diff --git a/test/services/mongo/telegraf_mongo_template.conf b/test/services/mongo/telegraf_template.conf
similarity index 100%
rename from test/services/mongo/telegraf_mongo_template.conf
rename to test/services/mongo/telegraf_template.conf
diff --git a/test/services/nginx/install-nginx.sh b/test/services/nginx/install.sh
old mode 100755
new mode 100644
similarity index 100%
rename from test/services/nginx/install-nginx.sh
rename to test/services/nginx/install.sh
diff --git a/test/services/nginx/telegraf_nginx_template.conf b/test/services/nginx/telegraf_template.conf
similarity index 100%
rename from test/services/nginx/telegraf_nginx_template.conf
rename to test/services/nginx/telegraf_template.conf
diff --git a/test/services/vlc/install-vlc.sh b/test/services/vlc/install.sh
similarity index 100%
rename from test/services/vlc/install-vlc.sh
rename to test/services/vlc/install.sh
diff --git a/test/services/vlc/telegraf_vlc_template.conf b/test/services/vlc/telegraf_template.conf
similarity index 100%
rename from test/services/vlc/telegraf_vlc_template.conf
rename to test/services/vlc/telegraf_template.conf
diff --git a/test/streaming-sim/VerifySimResults.py b/test/streaming-sim/VerifySimResults.py
index e4479c6..2060a23 100644
--- a/test/streaming-sim/VerifySimResults.py
+++ b/test/streaming-sim/VerifySimResults.py
@@ -51,7 +51,7 @@ testFailed = False
 
 for key in list( queryReference ):
     query = queryReference[key]
-    result = sendInfluxQuery( "http://:8086", query )
+    result = sendInfluxQuery( "http://localhost:8086", query )
 
     if checkResult( key, result ) == False:
         testFailed = True
-- 
GitLab