summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBryan Sullivan <bryan.sullivan@att.com>2017-11-12 16:55:45 -0800
committerBryan Sullivan <bryan.sullivan@att.com>2017-11-14 11:24:05 -0800
commitc40be26f0586fa931c986e2eea40477c524d381d (patch)
tree4eda45cc40190287c4724c3591c7ff5310522d66 /tests
parent4f938dcc8758311272b98e45eea479d4600b3a6d (diff)
WIP: VES setup for new kafka based design
JIRA: VES-3 Add collector, kafka, agent setup Change-Id: I4164d270e392aa38ebed98259a9fbdf77d7e5a0e Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/infsetup.py19
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/monitor.py15
2 files changed, 29 insertions, 5 deletions
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/infsetup.py b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/infsetup.py
index fb8cbdc..9750ea5 100644
--- a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/infsetup.py
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/infsetup.py
@@ -1,4 +1,23 @@
#!/usr/bin/python3
+#
+# Copyright 2016-2017 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: InfluxDB database setup script for the OPNFV VES ves_onap_demo.
+#
+# Status: this is a work in progress, under test.
+
import argparse
import json
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/monitor.py b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/monitor.py
index 8784ca4..2e1b9de 100644
--- a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/monitor.py
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/monitor.py
@@ -244,11 +244,12 @@ def save_event(body):
if "VDU4" in agent:
agent = "firewall"
+ url = 'http://{}:8086/write?db=veseventsdb'.format(influxdb)
if e.event.commonEventHeader.domain == "heartbeat":
print('Found Heartbeat')
pdata = 'heartbeat,system={} sequence={}'.format(agent,e.event.commonEventHeader.sequence)
print(pdata)
- r = requests.post("http://localhost:8086/write?db=veseventsdb", data=pdata, headers={'Content-Type': 'text/plain'})
+ r = requests.post(url, data=pdata, headers={'Content-Type': 'text/plain'})
if r.status_code != 204:
print('*** Failed to add cpu event to influxdb ***')
@@ -271,7 +272,7 @@ def save_event(body):
pdata = 'cpu,system={},cpuid={} cpuuser={},cpusystem={},cpuidle={}'.format(agent,jobj['event']['measurementsForVfScalingFields']['cpuUsageArray'][0]['cpuIdentifier'], aggregateCpuUsageUser,aggregateCpuUsageSystem,aggregateCpuIdle)
print(pdata)
- r = requests.post("http://localhost:8086/write?db=veseventsdb", data=pdata, headers={'Content-Type': 'text/plain'})
+ r = requests.post(url, data=pdata, headers={'Content-Type': 'text/plain'})
if r.status_code != 204:
print('*** Failed to add cpu event to influxdb ***')
@@ -281,7 +282,7 @@ def save_event(body):
for vnic in e.event.measurementsForVfScalingFields.vNicPerformanceArray:
pdata = 'vnic,system={},vnicn={},vnicid={} txoctets={},rxpacketsacc={},rxoctetsacc={},txpacketacc={}'.format(agent,vnicn,vnic.vNicIdentifier,vnic.transmittedOctetsAccumulated,vnic.receivedTotalPacketsAccumulated,vnic.receivedOctetsAccumulated,vnic.transmittedTotalPacketsAccumulated)
print(pdata)
- r = requests.post("http://localhost:8086/write?db=veseventsdb", data=pdata, headers={'Content-Type': 'text/plain'})
+ r = requests.post(url, data=pdata, headers={'Content-Type': 'text/plain'})
if r.status_code != 204:
print('*** Failed to add vnic event to influxdb ***')
vnicn = vnicn + 1
@@ -291,7 +292,7 @@ def save_event(body):
vnic = e.event.measurementsForVfScalingFields.vNicUsageArray[0]
pdata = 'vnic,system={},vnicid={} txoctets={},rxpacketsacc={},rxoctetsacc={},txpacketacc={}'.format(agent,vnic.vNicIdentifier,vnic.transmittedOctetsAccumulated,vnic.receivedTotalPacketsAccumulated,vnic.receivedOctetsAccumulated,vnic.transmittedTotalPacketsAccumulated)
print(pdata)
- r = requests.post("http://localhost:8086/write?db=veseventsdb", data=pdata, headers={'Content-Type': 'text/plain'})
+ r = requests.post(url, data=pdata, headers={'Content-Type': 'text/plain'})
if r.status_code != 204:
print('*** Failed to add vnic event to influxdb ***')
@@ -299,7 +300,7 @@ def save_event(body):
print('Found requestRate')
pdata = 'http,system={} httptxrx={}'.format(agent,e.event.measurementsForVfScalingFields.requestRate)
print(pdata)
- r = requests.post("http://localhost:8086/write?db=veseventsdb", data=pdata, headers={'Content-Type': 'text/plain'})
+ r = requests.post(url, data=pdata, headers={'Content-Type': 'text/plain'})
if r.status_code != 204:
print('*** Failed to add http event to influxdb ***')
@@ -502,6 +503,10 @@ USAGE
#----------------------------------------------------------------------
parser = ArgumentParser(description=program_license,
formatter_class=ArgumentDefaultsHelpFormatter)
+ parser.add_argument('-i', '--influxdb',
+ dest='influxdb',
+ default='localhost',
+ help='InfluxDB server addresss')
parser.add_argument('-v', '--verbose',
dest='verbose',
action='count',