summaryrefslogtreecommitdiffstats
path: root/tests/blueprints/tosca-vnfd-hello-ves
diff options
context:
space:
mode:
Diffstat (limited to 'tests/blueprints/tosca-vnfd-hello-ves')
-rw-r--r--tests/blueprints/tosca-vnfd-hello-ves/monitor.py41
-rwxr-xr-xtests/blueprints/tosca-vnfd-hello-ves/start.sh82
2 files changed, 66 insertions, 57 deletions
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/monitor.py b/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
index 5cc9a09..a9e1b65 100644
--- a/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
+++ b/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
@@ -37,9 +37,8 @@ import select
report_time = ''
requestRate = ''
monitor_mode = "f"
-summary = ['***** Summary of key stats *****','','','']
-status = ['','unknown','unknown','unknown']
-vdu = 0
+summary = ['***** Summary of key stats *****','','','','']
+status = ['','unknown','unknown','unknown','unknown']
base_url = ''
template_404 = b'''POST {0}'''
columns = 0
@@ -53,10 +52,6 @@ class NoLoggingWSGIRequestHandler(WSGIRequestHandler):
def log_message(self, format, *args):
pass
-def print_there(x, y, text):
- sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (x, y, text))
- sys.stdout.flush()
-
base_url = ''
template_404 = b'''POST {0}'''
@@ -96,6 +91,7 @@ class PathDispatcher:
def process_event(e):
global status
global summary
+ vdu = 0
epoch = e.event.commonEventHeader.lastEpochMicrosec
@@ -106,29 +102,26 @@ def process_event(e):
if 'VDU1' in host or 'vdu1' in host: vdu = 1
if 'VDU2' in host or 'vdu2' in host: vdu = 2
if 'VDU3' in host or 'vdu3' in host: vdu = 3
-
+
domain = e.event.commonEventHeader.domain
- if e.event.commonEventHeader.functionalRole == 'vHello_VES agent':
- if domain == 'measurementsForVfScaling':
+ if domain == 'measurementsForVfScaling':
+ if vdu >= 1:
aggregateCpuUsage = e.event.measurementsForVfScaling.aggregateCpuUsage
requestRate = e.event.measurementsForVfScaling.requestRate
- summary[vdu] = "VDU" + str(vdu) + " state=" + status[vdu] + ", tps=" + str(requestRate) + ", cpu=" + str(aggregateCpuUsage)
- if monitor_mode == "c": print '{0} *** VDU{1} state={2}, tps={3}'.format(
- report_time, vdu, status[vdu], str(requestRate))
+ summary[vdu] = host + ": state=" + status[vdu] + ", tps=" + str(requestRate) + ", cpu=" + str(aggregateCpuUsage)
+ else:
+ aggregateCpuUsage = e.event.measurementsForVfScalingFields.aggregateCpuUsage
+ summary[4] = host + ": cpu=" + str(aggregateCpuUsage)
+
+ for s in summary:
+ print '{0}'.format(s)
- if domain == 'fault':
- alarmCondition = e.event.faultFields.alarmCondition
- specificProblem = e.event.faultFields.specificProblem
+ if domain == 'fault':
+ alarmCondition = e.event.faultFields.alarmCondition
+ specificProblem = e.event.faultFields.specificProblem
# status[vdu] = e.event.faultFields.vfStatus
- status[vdu] = e.event.faultFields.specificProblem
- if monitor_mode == "c": print '{0} *** VDU{1} state: {2}'.format(
- report_time, vdu, status[vdu])
-
-# print_there only works if SSH'd to the VM manually - need to investigate
-# print_there(1,columns-56,summary)
- for s in summary:
- print '{0}'.format(s)
+ status[vdu] = e.event.faultFields.specificProblem
#--------------------------------------------------------------------------
# Main monitoring and logging procedure
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/start.sh b/tests/blueprints/tosca-vnfd-hello-ves/start.sh
index 23f6080..4f53a6a 100755
--- a/tests/blueprints/tosca-vnfd-hello-ves/start.sh
+++ b/tests/blueprints/tosca-vnfd-hello-ves/start.sh
@@ -21,16 +21,64 @@
# How to use:
# Intended to be invoked from vHello_VES.sh
# $ bash start.sh type params
-# type: type of VNF component [webserver|lb|monitor]
+# type: type of VNF component [webserver|lb|monitor|collectd]
# webserver params: ID CollectorIP username password
# lb params: ID CollectorIP username password app1_ip app2_ip
# collector params: ID CollectorIP username password
+# collector params: ID CollectorIP username password
# ID: VM ID
# CollectorIP: IP address of the collector
# username: Username for Collector RESTful API authentication
# password: Password for Collector RESTful API authentication
# app1_ip app2_ip: address of the web servers
+setup_collectd () {
+ echo "$0: Install prerequisites"
+ sudo apt-get update
+ echo "$0: Install collectd plugin"
+ cd ~
+ git clone https://github.com/maryamtahhan/OpenStackBarcelonaDemo.git
+
+ sudo apt-get install -y collectd
+ sudo sed -i -- "s/FQDNLookup true/FQDNLookup false/" /etc/collectd/collectd.conf
+ sudo sed -i -- "s/#LoadPlugin cpu/LoadPlugin cpu/" /etc/collectd/collectd.conf
+ sudo sed -i -- "s/#LoadPlugin disk/LoadPlugin disk/" /etc/collectd/collectd.conf
+ sudo sed -i -- "s/#LoadPlugin interface/LoadPlugin interface/" /etc/collectd/collectd.conf
+ sudo sed -i -- "s/#LoadPlugin memory/LoadPlugin memory/" /etc/collectd/collectd.conf
+ cat <<EOF | sudo tee -a /etc/collectd/collectd.conf
+<LoadPlugin python>
+ Globals true
+</LoadPlugin>
+<Plugin python>
+ ModulePath "/home/ubuntu/OpenStackBarcelonaDemo/ves_plugin/"
+ LogTraces true
+ Interactive false
+ Import "ves_plugin"
+<Module ves_plugin>
+ Domain "$collector_ip"
+ Port 30000
+ Path ""
+ Topic ""
+ UseHttps false
+ Username "hello"
+ Password "world"
+ FunctionalRole "Collectd VES Agent"
+</Module>
+</Plugin>
+LoadPlugin virt
+<Plugin virt>
+ Connection "qemu:///system"
+ RefreshInterval 60
+ HostnameFormat uuid
+</Plugin>
+<Plugin cpu>
+ ReportByCpu false
+ ValuesPercentage true
+</Plugin>
+EOF
+ sudo service collectd restart
+}
+
setup_agent () {
echo "$0: Install prerequisites"
sudo apt-get install -y gcc
@@ -59,38 +107,6 @@ setup_agent () {
echo "$0: Start evel_demo agent"
nohup ../output/x86_64/evel_demo --id $vm_id --fqdn $collector_ip --port 30000 --username $username --password $password > /dev/null 2>&1 &
-
- echo "$0: Install collectd plugin"
- cd ~
- git clone https://github.com/maryamtahhan/OpenStackBarcelonaDemo.git
- cd OpenStackBarcelonaDemo/ves_plugin
- host=$(hostname)
- sed -i -- "s/23380d70-2c71-4e35-99e2-f43f97e4ec65/$vm_id/g" ves_plugin.py
- sed -i -- "s/cscf0001vm001abc001/$host/g" ves_plugin.py
- sed -i -- "s/cscf0001vm001oam001/$host/g" ves_plugin.py
- sed -i -- "s/SGW/$type/" ves_plugin.py
- sed -i -- "s/reporting_entity_id = \"\"/reporting_entity_id = \"$vm_id\"/g" ves_plugin.py
- sed -i -- "s/reporting_entity_name = \"cscf0001vm001oam001\"/reporting_entity_name = \"$host\"/g" ves_plugin.py
- sed -i -- "s/self.__username = ''/self.__username = 'hello'/g" ves_plugin.py
- sed -i -- "s/self.__password = ''/self.__password = 'world'/g" ves_plugin.py
- sed -i -- "s/self.__domain = '127.0.0.1'/self.__domain = '$collector_ip'/g" ves_plugin.py
- sed -i -- "s/measurementForVfScaling/measurementsForVfScaling/g" ves_plugin.py
-
- sudo apt-get install -y collectd
- sudo sed -i -- "s/FQDNLookup true/FQDNLookup false/" /etc/collectd/collectd.conf
- cat <<EOF | sudo tee -a /etc/collectd/collectd.conf
-<LoadPlugin python>
- Globals true
-</LoadPlugin>
-
-<Plugin python>
- ModulePath "/home/ubuntu/OpenStackBarcelonaDemo/ves_plugin/"
- LogTraces true
- Interactive false
- Import "ves_plugin"
-</Plugin>
-EOF
- sudo service collectd restart
}
setup_webserver () {