summaryrefslogtreecommitdiffstats
path: root/tests/blueprints/tosca-vnfd-hello-ves
diff options
context:
space:
mode:
authorBryan Sullivan <bryan.sullivan@att.com>2016-10-15 08:39:52 -0700
committerBryan Sullivan <bryan.sullivan@att.com>2016-10-15 08:41:36 -0700
commita939d3cda9fef3a935dc6176ab88241619eb344c (patch)
tree4a872c3d62d39582bc794a3bd2a5ce7ac65ab467 /tests/blueprints/tosca-vnfd-hello-ves
parent85f08452151ec648e180b4500c0da589999b99df (diff)
Fix agent startup, add monitor.py and favicon
JIRA: VES-1 Report intended traffic measurement at agent Change-Id: I587150f80eebfdd4b1efaafc48b78db30dd33468 Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
Diffstat (limited to 'tests/blueprints/tosca-vnfd-hello-ves')
-rw-r--r--tests/blueprints/tosca-vnfd-hello-ves/evel_demo.c3
-rw-r--r--tests/blueprints/tosca-vnfd-hello-ves/favicon.icobin0 -> 1150 bytes
-rw-r--r--tests/blueprints/tosca-vnfd-hello-ves/logo.pngbin0 -> 4212 bytes
-rw-r--r--tests/blueprints/tosca-vnfd-hello-ves/monitor.py33
-rwxr-xr-xtests/blueprints/tosca-vnfd-hello-ves/start.sh12
5 files changed, 45 insertions, 3 deletions
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/evel_demo.c b/tests/blueprints/tosca-vnfd-hello-ves/evel_demo.c
index 50f45ec..39cd528 100644
--- a/tests/blueprints/tosca-vnfd-hello-ves/evel_demo.c
+++ b/tests/blueprints/tosca-vnfd-hello-ves/evel_demo.c
@@ -211,7 +211,7 @@ void measure_traffic() {
time (&rawtime);
timeinfo = localtime (&rawtime);
strftime(period,7,"%H:%M:",timeinfo);
- strftime(secs,2,"%S",timeinfo);
+ strftime(secs,3,"%S",timeinfo);
sec = atoi(secs);
if (sec == 0) sec = 59;
sprintf(secs, "%02d", sec);
@@ -228,6 +228,7 @@ void measure_traffic() {
if (fgets(count, 10, fp) != NULL) {
request_rate = atoi(count);
+ printf("Reporting request rate for second: %s as %d\n", period, request_rate);
measurement = evel_new_measurement(concurrent_sessions,
configured_entities, mean_request_latency, measurement_interval,
memory_configured, memory_used, request_rate);
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/favicon.ico b/tests/blueprints/tosca-vnfd-hello-ves/favicon.ico
new file mode 100644
index 0000000..cd95189
--- /dev/null
+++ b/tests/blueprints/tosca-vnfd-hello-ves/favicon.ico
Binary files differ
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/logo.png b/tests/blueprints/tosca-vnfd-hello-ves/logo.png
new file mode 100644
index 0000000..a4bf310
--- /dev/null
+++ b/tests/blueprints/tosca-vnfd-hello-ves/logo.png
Binary files differ
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/monitor.py b/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
new file mode 100644
index 0000000..9f3b7ff
--- /dev/null
+++ b/tests/blueprints/tosca-vnfd-hello-ves/monitor.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+#
+# Copyright 2016 AT&T Intellectual Property, Inc
+#
+# 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.
+#
+# What this is: Monitor and closed-loop policy agent as part of the OPNFV VES
+# vHello_VES demo.
+#
+# Status: this is a work in progress, under test.
+
+with open('/home/ubuntu/ves.log') as f:
+ while True:
+ line = f.readline()
+ if line:
+# print line,
+ if "requestRate" in line:
+# print line,
+ rate = line[27:-2]
+ print 'request rate: {0}'.format(rate)
+#....5....1....5....2....5....3....5
+# "requestRate": 2264,
+
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/start.sh b/tests/blueprints/tosca-vnfd-hello-ves/start.sh
index b8f6e14..1aa01e8 100755
--- a/tests/blueprints/tosca-vnfd-hello-ves/start.sh
+++ b/tests/blueprints/tosca-vnfd-hello-ves/start.sh
@@ -36,7 +36,13 @@ setup_agent () {
cd /home/ubuntu
git clone https://github.com/att/evel-library.git
- echo "$0: Build agent demo"
+ echo "$0: Clone VES repo"
+ git clone https://gerrit.opnfv.org/gerrit/ves
+
+ echo "$0: Use vHello_VES blueprint version of agent_demo.c"
+ cp ves/tests/blueprints/tosca-vnfd-hello-ves/evel_demo.c evel-library/code/evel_demo/evel_demo.c
+
+ echo "$0: Update parameters and build agent demo"
sed -i -- "/api_secure,/{n;s/.*/ \"$username\",/}" evel-library/code/evel_demo/evel_demo.c
sed -i -- "/\"hello\",/{n;s/.*/ \"$password\",/}" evel-library/code/evel_demo/evel_demo.c
@@ -45,7 +51,7 @@ setup_agent () {
make
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ubuntu/evel-library/libs/x86_64
- nohup ..output/x86_64/evel_demo --id $agent_id --fqdn $collector_ip --port 30000 --username $username --password $password &
+ nohup ../output/x86_64/evel_demo --id $agent_id --fqdn $collector_ip --port 30000 --username $username --password $password &
# echo "$0: Start agent demo, repeat every minute"
# crontab -l > /tmp/cron
@@ -80,6 +86,8 @@ Hello World!<br>
</body></html>
EOM
+cp ~/ves/tests/blueprints/tosca-vnfd-hello-ves/favicon.ico ~/www/html/favicon.ico
+
echo "$0: Install docker"
# Per https://docs.docker.com/engine/installation/linux/ubuntulinux/
# Per https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04