summaryrefslogtreecommitdiffstats
path: root/tests/onap-demo/blueprints/tosca-vnfd-onap-demo
diff options
context:
space:
mode:
Diffstat (limited to 'tests/onap-demo/blueprints/tosca-vnfd-onap-demo')
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/Dashboard.json2354
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/blueprint.yaml64
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/evel_demo.c800
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/infsetup.py70
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/monitor.py168
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/start.sh171
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vFW/Makefile44
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vFW/vpp_measurement_reporter.c357
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vLB/Makefile41
-rw-r--r--tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vLB/vDNS_vpp_measurement_reporter.c376
10 files changed, 3537 insertions, 908 deletions
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/Dashboard.json b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/Dashboard.json
new file mode 100644
index 0000000..00b9d6b
--- /dev/null
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/Dashboard.json
@@ -0,0 +1,2354 @@
+{
+"dashboard": {
+ "id": null,
+ "title": "VES Demo",
+ "originalTitle": "VES Demo",
+ "tags": [],
+ "style": "dark",
+ "timezone": "browser",
+ "editable": true,
+ "hideControls": false,
+ "sharedCrosshair": false,
+ "rows": [
+ {
+ "collapse": false,
+ "editable": true,
+ "height": "250px",
+ "panels": [
+ {
+ "aliasColors": {},
+ "bars": false,
+ "datasource": "VESEvents",
+ "fill": 1,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null,
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 3,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": false,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 12,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "CpuUser",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "cpu",
+ "policy": "default",
+ "query": "SELECT mean(\"cpuuser\") FROM \"cpu\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "cpuuser"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ },
+ {
+ "alias": "CpuSystem",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "cpu",
+ "policy": "default",
+ "query": "SELECT mean(\"cpusystem\") FROM \"cpu\" WHERE $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "cpusystem"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": []
+ },
+ {
+ "alias": "CpuIdle",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "cpu",
+ "policy": "default",
+ "query": "SELECT mean(\"cpuidle\") FROM \"cpu\" WHERE $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "C",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "cpuidle"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": []
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "VES computehost CPU Usage",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Percent",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "datasource": "VESEvents",
+ "fill": 1,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null,
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 5,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": false,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 12,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "CpuUser",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "cpu",
+ "policy": "default",
+ "query": "SELECT mean(\"cpuuser\") FROM \"cpu\" WHERE \"system\" = 'firewall' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "cpuuser"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "firewall"
+ }
+ ]
+ },
+ {
+ "alias": "CpuSystem",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "cpu",
+ "policy": "default",
+ "query": "SELECT mean(\"cpusystem\") FROM \"cpu\" WHERE \"system\" = 'firewall' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "cpusystem"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "firewall"
+ }
+ ]
+ },
+ {
+ "alias": "CpuIdle",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "cpu",
+ "policy": "default",
+ "query": "SELECT mean(\"cpuidle\") FROM \"cpu\" WHERE \"system\" = 'firewall' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "C",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "cpuidle"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "firewall"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "VES vFW CPU Usage",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Percent",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "datasource": "VESEvents",
+ "fill": 1,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null,
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 6,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": false,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 12,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "CpuUser",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "cpu",
+ "policy": "default",
+ "query": "SELECT mean(\"cpuuser\") FROM \"cpu\" WHERE \"system\" = 'loadbalancer' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "cpuuser"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "loadbalancer"
+ }
+ ]
+ },
+ {
+ "alias": "CpuSystem",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "cpu",
+ "policy": "default",
+ "query": "SELECT mean(\"cpusystem\") FROM \"cpu\" WHERE \"system\" = 'loadbalancer' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "cpusystem"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "loadbalancer"
+ }
+ ]
+ },
+ {
+ "alias": "CpuIdle",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "cpu",
+ "policy": "default",
+ "query": "SELECT mean(\"cpuidle\") FROM \"cpu\" WHERE \"system\" = 'loadbalancer' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "C",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "cpuidle"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "loadbalancer"
+ }
+ ]
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "VES vLB CPU Usage",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Percent",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ }
+ ],
+ "repeat": null,
+ "repeatIteration": null,
+ "repeatRowId": null,
+ "showTitle": false,
+ "title": "Dashboard Row",
+ "titleSize": "h6"
+ },
+ {
+ "collapse": false,
+ "editable": true,
+ "height": 250,
+ "panels": [
+ {
+ "alert": {
+ "conditions": [
+ {
+ "evaluator": {
+ "params": [
+ 15000000
+ ],
+ "type": "gt"
+ },
+ "operator": {
+ "type": "and"
+ },
+ "query": {
+ "params": [
+ "A",
+ "1s",
+ "now"
+ ]
+ },
+ "reducer": {
+ "params": [],
+ "type": "avg"
+ },
+ "type": "query"
+ }
+ ],
+ "executionErrorState": "alerting",
+ "frequency": "1s",
+ "handler": 1,
+ "message": "Transmitted Traffic Exceeded limits\nClosed Loop Action:Apply Firewall Rules",
+ "name": "VES webserver_1 Network Usage alert",
+ "noDataState": "no_data",
+ "notifications": []
+ },
+ "aliasColors": {},
+ "bars": false,
+ "datasource": "VESEvents",
+ "fill": 1,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null,
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 2,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": false,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 12,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "Rx-tap07d69530-f4",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT derivative(mean(\"rxoctetsacc\"), 10s) FROM \"vnic\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "rxoctetsacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ },
+ {
+ "params": [
+ "10s"
+ ],
+ "type": "derivative"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ },
+ {
+ "alias": "Tx-tap07d69530-f4",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT derivative(mean(\"txoctets\"), 10s) FROM \"vnic\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "txoctets"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ },
+ {
+ "params": [
+ "10s"
+ ],
+ "type": "derivative"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ },
+ {
+ "alias": "Rx-tap6e8ff422-16",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": false,
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT derivative(mean(\"rxoctetsacc\"), 10s) FROM \"vnic\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "C",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "rxoctetsacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ },
+ {
+ "params": [
+ "10s"
+ ],
+ "type": "derivative"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ },
+ {
+ "alias": "Tx-tap6e8ff422-16",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": false,
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT derivative(mean(\"txoctets\"), 10s) FROM \"vnic\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "D",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "txoctets"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ },
+ {
+ "params": [
+ "10s"
+ ],
+ "type": "derivative"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ },
+ {
+ "alias": "Rx-tapff224e80-4e",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": false,
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT derivative(mean(\"rxoctetsacc\"), 10s) FROM \"vnic\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "E",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "rxoctetsacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ },
+ {
+ "params": [
+ "10s"
+ ],
+ "type": "derivative"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ },
+ {
+ "alias": "Tx-tapff224e80-4e",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "query": "SELECT derivative(mean(\"txoctets\"), 10s) FROM \"vnic\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "F",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "txoctets"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ },
+ {
+ "params": [
+ "10s"
+ ],
+ "type": "derivative"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ },
+ {
+ "alias": "Rx-tapaea4af02-61",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "query": "SELECT derivative(mean(\"rxoctetsacc\"), 10s) FROM \"vnic\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time($interval) fill(null)",
+ "refId": "G",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "rxoctetsacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ },
+ {
+ "params": [
+ "10s"
+ ],
+ "type": "derivative"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ },
+ {
+ "alias": "Tx-tapaea4af02-61",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "query": "SELECT derivative(mean(\"txoctets\"), 10s) FROM \"vnic\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time($interval) fill(null)",
+ "refId": "H",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "txoctets"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ },
+ {
+ "params": [
+ "10s"
+ ],
+ "type": "derivative"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ },
+ {
+ "alias": "Rx-tapa44215ed-f5",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "query": "SELECT derivative(mean(\"rxoctetsacc\"), 10s) FROM \"vnic\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time($interval) fill(null)",
+ "refId": "I",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "rxoctetsacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ },
+ {
+ "params": [
+ "10s"
+ ],
+ "type": "derivative"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ },
+ {
+ "alias": "Tx-tapa44215ed-f5",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "query": "SELECT derivative(mean(\"txoctets\"), 10s) FROM \"vnic\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time($interval) fill(null)",
+ "refId": "J",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "txoctets"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ },
+ {
+ "params": [
+ "10s"
+ ],
+ "type": "derivative"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "computehost"
+ }
+ ]
+ }
+ ],
+ "thresholds": [
+ {
+ "colorMode": "critical",
+ "fill": true,
+ "line": true,
+ "op": "gt",
+ "value": 15000000
+ }
+ ],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "VES compputehost Network Usage",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Octets/Packets",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ },
+ {
+ "alert": {
+ "conditions": [
+ {
+ "evaluator": {
+ "params": [
+ 15000000
+ ],
+ "type": "gt"
+ },
+ "operator": {
+ "type": "and"
+ },
+ "query": {
+ "params": [
+ "A",
+ "1s",
+ "now"
+ ]
+ },
+ "reducer": {
+ "params": [],
+ "type": "avg"
+ },
+ "type": "query"
+ }
+ ],
+ "executionErrorState": "alerting",
+ "frequency": "1s",
+ "handler": 1,
+ "message": "Transmitted Traffic Exceeded limits\nClosed Loop Action:Apply Firewall Rules",
+ "name": "VES webserver_1 Network Usage alert",
+ "noDataState": "no_data",
+ "notifications": []
+ },
+ "aliasColors": {},
+ "bars": false,
+ "datasource": "VESEvents",
+ "fill": 1,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null,
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 7,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": false,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 12,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "TxOctetsAcc",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT mean(\"txoctets\") FROM \"vnic\" WHERE \"system\" = 'firewall' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "txoctets"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "firewall"
+ }
+ ]
+ },
+ {
+ "alias": "RxOctetsAcc",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT mean(\"rxoctetsacc\") FROM \"vnic\" WHERE \"system\" = 'firewall' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "rxoctetsacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "firewall"
+ }
+ ]
+ },
+ {
+ "alias": "TxPacketsAcc",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": true,
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT mean(\"txpacketacc\") FROM \"vnic\" WHERE \"system\" = 'firewall' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "C",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "txpacketacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "firewall"
+ }
+ ]
+ },
+ {
+ "alias": "RxPacketsAcc",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": true,
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT mean(\"rxpacketsacc\") FROM \"vnic\" WHERE \"system\" = 'firewall' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "D",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "rxpacketsacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "firewall"
+ }
+ ]
+ },
+ {
+ "alias": "HttpTraffic",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": true,
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT mean(\"httptxrx\") FROM \"vnic\" WHERE \"system\" = 'firewall' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "E",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "httptxrx"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "firewall"
+ }
+ ]
+ }
+ ],
+ "thresholds": [
+ {
+ "colorMode": "critical",
+ "fill": true,
+ "line": true,
+ "op": "gt",
+ "value": 15000000
+ }
+ ],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "VES vFW Network Usage",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Octets/Packets",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ },
+ {
+ "alert": {
+ "conditions": [
+ {
+ "evaluator": {
+ "params": [
+ 15000000
+ ],
+ "type": "gt"
+ },
+ "operator": {
+ "type": "and"
+ },
+ "query": {
+ "params": [
+ "A",
+ "1s",
+ "now"
+ ]
+ },
+ "reducer": {
+ "params": [],
+ "type": "avg"
+ },
+ "type": "query"
+ }
+ ],
+ "executionErrorState": "alerting",
+ "frequency": "1s",
+ "handler": 1,
+ "message": "Transmitted Traffic Exceeded limits\nClosed Loop Action:Apply Firewall Rules",
+ "name": "VES webserver_1 Network Usage alert",
+ "noDataState": "no_data",
+ "notifications": []
+ },
+ "aliasColors": {},
+ "bars": false,
+ "datasource": "VESEvents",
+ "fill": 1,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null,
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 8,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": false,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 12,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "TxOctetsAcc",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT mean(\"txoctets\") FROM \"vnic\" WHERE \"system\" = 'loadbalancer' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "txoctets"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "loadbalancer"
+ }
+ ]
+ },
+ {
+ "alias": "RxOctetsAcc",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT mean(\"rxoctetsacc\") FROM \"vnic\" WHERE \"system\" = 'loadbalancer' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "rxoctetsacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "loadbalancer"
+ }
+ ]
+ },
+ {
+ "alias": "TxPacketsAcc",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": true,
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT mean(\"txpacketacc\") FROM \"vnic\" WHERE \"system\" = 'loadbalancer' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "C",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "txpacketacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "loadbalancer"
+ }
+ ]
+ },
+ {
+ "alias": "RxPacketsAcc",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": true,
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT mean(\"rxpacketsacc\") FROM \"vnic\" WHERE \"system\" = 'loadbalancer' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "D",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "rxpacketsacc"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "loadbalancer"
+ }
+ ]
+ },
+ {
+ "alias": "HttpTraffic",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": true,
+ "measurement": "vnic",
+ "policy": "default",
+ "query": "SELECT mean(\"httptxrx\") FROM \"vnic\" WHERE \"system\" = 'firewall' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "E",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "httptxrx"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "loadbalancer"
+ }
+ ]
+ }
+ ],
+ "thresholds": [
+ {
+ "colorMode": "critical",
+ "fill": true,
+ "line": true,
+ "op": "gt",
+ "value": 15000000
+ }
+ ],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "VES vLB Network Usage",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Octets/Packets",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ }
+ ],
+ "repeat": null,
+ "repeatIteration": null,
+ "repeatRowId": null,
+ "showTitle": false,
+ "title": "Dashboard Row",
+ "titleSize": "h6"
+ },
+ {
+ "collapse": false,
+ "editable": true,
+ "height": 250,
+ "panels": [
+ {
+ "aliasColors": {},
+ "bars": false,
+ "datasource": "VESEvents",
+ "fill": 1,
+ "grid": {
+ "leftLogBase": 1,
+ "leftMax": null,
+ "leftMin": null,
+ "rightLogBase": 1,
+ "rightMax": null,
+ "rightMin": null,
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 4,
+ "interval": "30s",
+ "legend": {
+ "alignAsTable": false,
+ "avg": true,
+ "current": true,
+ "max": true,
+ "min": true,
+ "rightSide": false,
+ "show": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "null",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 12,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "webserver_1",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "http",
+ "policy": "default",
+ "query": "SELECT mean(\"httptxrx\") FROM \"http\" WHERE \"system\" = 'webserver_1' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "httptxrx"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "webserver_1"
+ }
+ ]
+ },
+ {
+ "alias": "webserver_2",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "http",
+ "policy": "default",
+ "query": "SELECT mean(\"httptxrx\") FROM \"http\" WHERE \"system\" = 'webserver_2' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "httptxrx"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "webserver_2"
+ }
+ ]
+ },
+ {
+ "alias": "TxPacketsAcc",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": true,
+ "measurement": "http",
+ "policy": "default",
+ "query": "SELECT mean(\"httptxrx\") FROM \"http\" WHERE \"system\" = 'loadbalancer' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "C",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "httptxrx"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "loadbalancer"
+ }
+ ]
+ },
+ {
+ "alias": "RxPacketsAcc",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": true,
+ "measurement": "http",
+ "policy": "default",
+ "query": "SELECT mean(\"httptxrx\") FROM \"http\" WHERE \"system\" = 'firewall' AND $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "D",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "httptxrx"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "system",
+ "operator": "=",
+ "value": "firewall"
+ }
+ ]
+ },
+ {
+ "alias": "HttpTraffic",
+ "dsType": "influxdb",
+ "groupBy": [
+ {
+ "params": [
+ "1m"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "hide": true,
+ "measurement": "webbserver_2",
+ "policy": "default",
+ "query": "SELECT mean(\"httptxrx\") FROM \"webbserver_2\" WHERE $timeFilter GROUP BY time(1m) fill(null)",
+ "refId": "E",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "httptxrx"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": []
+ }
+ ],
+ "thresholds": [],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "VES Web Server Traffic",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "x-axis": true,
+ "xaxis": {
+ "mode": "time",
+ "name": null,
+ "show": true,
+ "values": []
+ },
+ "y-axis": true,
+ "y_formats": [
+ "short",
+ "short"
+ ],
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Octets/Packets",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "label": null,
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ }
+ ],
+ "repeat": null,
+ "repeatIteration": null,
+ "repeatRowId": null,
+ "showTitle": false,
+ "title": "Dashboard Row",
+ "titleSize": "h6"
+ }
+ ],
+ "time": {
+ "from": "now-30m",
+ "to": "now"
+ },
+ "timepicker": {
+ "now": true,
+ "refresh_intervals": [
+ "10s",
+ "20s",
+ "30s",
+ "1m"
+ ],
+ "time_options": [
+ "5m",
+ "15m",
+ "1h",
+ "6h",
+ "12h",
+ "24h",
+ "2d",
+ "7d",
+ "30d"
+ ]
+ },
+ "templating": {
+ "list": []
+ },
+ "annotations": {
+ "list": []
+ },
+ "refresh": "10s",
+ "schemaVersion": 8,
+ "version": 7,
+ "links": []
+}
+}
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/blueprint.yaml b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/blueprint.yaml
index 6d9abf9..5c69191 100644
--- a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/blueprint.yaml
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/blueprint.yaml
@@ -66,8 +66,8 @@ topology_template:
sudo apt-get update
sudo apt-get install -y docker-engine
sudo docker pull nginx
- sudo docker build -t vhello .
- sudo docker run --name vHello -d -p 80:80 vhello
+ sudo docker build -t onap-demo-img .
+ sudo docker run --name onap-demo -d -p 80:80 onap-demo-img
config: |
param0: key1
param1: key2
@@ -152,8 +152,8 @@ topology_template:
sudo apt-get update
sudo apt-get install -y docker-engine
sudo docker pull nginx
- sudo docker build -t vhello .
- sudo docker run --name vHello -d -p 80:80 vhello
+ sudo docker build -t onap-demo-img .
+ sudo docker run --name onap-demo -d -p 80:80 onap-demo-img
config: |
param0: key1
param1: key2
@@ -244,6 +244,7 @@ topology_template:
image: models-xenial-server
flavor: onap.demo
availability_zone: nova
+ config_drive: true
user_data_format: RAW
user_data: |
#!/bin/bash
@@ -254,6 +255,20 @@ topology_template:
cat << EOM >/home/ubuntu/.ssh/authorized_keys
<pubkey>
EOM
+ sudo mount /dev/sr0 /mnt/
+ cat << EOF >/tmp/setup.sh
+ echo "1" | sudo tee /proc/sys/net/ipv4/ip_forward
+ sudo sysctl net.ipv4.ip_forward=1
+ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -m state \\
+ --state NEW -m statistic --mode nth --every 1 --packet 0 \\
+ -j DNAT --to-destination <vdu3_ip>:80
+ sudo iptables -t nat -A POSTROUTING -j MASQUERADE
+ EOF
+ bash /tmp/setup.sh
+ config: |
+ param0: key1
+ param1: key2
+
config: |
param0: key1
param1: key2
@@ -279,6 +294,47 @@ topology_template:
- virtualBinding:
node: VDU4
+ VDU5:
+ type: tosca.nodes.nfv.VDU.Tacker
+ properties:
+ image: models-xenial-server
+ flavor: onap.demo
+ availability_zone: nova
+ user_data_format: RAW
+ user_data: |
+ #!/bin/bash
+ set -x
+ mkdir /home/ubuntu
+ chown -R ubuntu /home/ubuntu
+ mkdir /home/ubuntu/.ssh
+ cat << EOM >/home/ubuntu/.ssh/authorized_keys
+ <pubkey>
+ EOM
+ config: |
+ param0: key1
+ param1: key2
+
+ CP43:
+ type: tosca.nodes.nfv.CP.Tacker
+ properties:
+ management: true
+ anti_spoofing_protection: false
+ requirements:
+ - virtualLink:
+ node: VL1
+ - virtualBinding:
+ node: VDU5
+
+ CP44:
+ type: tosca.nodes.nfv.CP.Tacker
+ properties:
+ anti_spoofing_protection: false
+ requirements:
+ - virtualLink:
+ node: VL2
+ - virtualBinding:
+ node: VDU5
+
VL1:
type: tosca.nodes.nfv.VL
properties:
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/evel_demo.c b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/evel_demo.c
index fc244d8..a3774fa 100644
--- a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/evel_demo.c
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/evel_demo.c
@@ -1,21 +1,21 @@
/**************************************************************************//**
* @file
- * Agent for the OPNFV VNF Event Stream (VES) vHello_VES test
+ * Agent for the OPNFV VNF Event Stream (VES) ves_onap_demo test
*
* 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.
- *
+ *
*****************************************************************************/
#include <stdio.h>
@@ -127,16 +127,6 @@ typedef enum {
/*****************************************************************************/
/* Local prototypes. */
/*****************************************************************************/
-static void demo_heartbeat(void);
-static void demo_fault(void);
-static void demo_measurement(const int interval);
-static void demo_mobile_flow(void);
-static void demo_service(void);
-static void demo_service_event(const SERVICE_EVENT service_event);
-static void demo_signaling(void);
-static void demo_state_change(void);
-static void demo_syslog(void);
-static void demo_other(void);
/**************************************************************************//**
* Global flags related the applicaton.
@@ -147,20 +137,27 @@ char *app_prevstate = "Stopped";
/**************************************************************************//**
* Report app state change fault.
*
- * Reports the change in app state.
+ * Reports the change in app state.
*
* param[in] char *change The type of change ("Started", "Stopped")
*****************************************************************************/
-void report_app_statechange(char *change)
+void report_app_statechange(char *change)
{
printf("report_app_statechange(%s)\n", change);
EVENT_FAULT * fault = NULL;
EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
+ int status = EVEL_VF_STATUS_ACTIVE;
+
+ if (change == "Stopped") {
+ status = EVEL_VF_STATUS_IDLE;
+ }
fault = evel_new_fault("App state change",
change,
EVEL_PRIORITY_HIGH,
- EVEL_SEVERITY_MAJOR);
+ EVEL_SEVERITY_MAJOR,
+ EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION,
+ status);
if (fault != NULL) {
evel_fault_type_set(fault, "App state change");
@@ -178,7 +175,7 @@ void report_app_statechange(char *change)
/**************************************************************************//**
* Check status of the app container.
*
- * Checks and reports any change in app state.
+ * Checks and reports any change in app state.
*
* param[in] none
*****************************************************************************/
@@ -188,7 +185,7 @@ void check_app_container_state() {
int status;
char state[100];
- fp = popen("sudo docker inspect vHello | grep Status | sed -- 's/,//g' | sed -- 's/\"//g' | sed -- 's/ Status: //g'", "r");
+ fp = popen("sudo docker inspect onap-demo | grep Status | sed -- 's/,//g' | sed -- 's/\"//g' | sed -- 's/ Status: //g'", "r");
if (fp == NULL) {
EVEL_ERROR("popen failed to execute command");
}
@@ -275,7 +272,7 @@ void measure_traffic() {
strncat(period, secs, 21);
// ....x....1....x....2.
// 15/Oct/2016:17:51:19
- strcpy(cmd, "sudo docker logs vHello | grep -c ");
+ strcpy(cmd, "sudo docker logs onap-demo | grep -c ");
strncat(cmd, period, 100);
fp = popen(cmd, "r");
@@ -501,7 +498,7 @@ int main(int argc, char ** argv)
api_username,
api_password,
EVEL_SOURCE_VIRTUAL_MACHINE,
- "EVEL demo client",
+ "webserver",
verbose_mode))
{
fprintf(stderr, "Failed to initialize the EVEL library!!!");
@@ -666,18 +663,6 @@ int main(int argc, char ** argv)
check_app_container_state();
measure_traffic();
-// demo_heartbeat();
-// demo_fault();
-// demo_measurement((measurement_interval ==
-// EVEL_MEASUREMENT_INTERVAL_UKNOWN) ?
-// DEFAULT_SLEEP_SECONDS : measurement_interval);
-// demo_mobile_flow();
-// demo_service();
-// demo_signaling();
-// demo_state_change();
-// demo_syslog();
-// demo_other();
-
/*************************************************************************/
/* MAIN RETRY LOOP. Check and implement the measurement interval. */
/*************************************************************************/
@@ -767,750 +752,3 @@ void *signal_watcher(void *void_sig_set)
return(NULL);
}
-/**************************************************************************//**
- * Create and send a heartbeat event.
- *****************************************************************************/
-void demo_heartbeat(void)
-{
- EVENT_HEADER * heartbeat = NULL;
- EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
-
- /***************************************************************************/
- /* Heartbeat */
- /***************************************************************************/
- heartbeat = evel_new_heartbeat();
- if (heartbeat != NULL)
- {
- evel_rc = evel_post_event(heartbeat);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Heartbeat failed");
- }
- printf(" Processed Heartbeat\n");
-}
-
-/**************************************************************************//**
- * Create and send three fault events.
- *****************************************************************************/
-void demo_fault(void)
-{
- EVENT_FAULT * fault = NULL;
- EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
-
- /***************************************************************************/
- /* Fault */
- /***************************************************************************/
- fault = evel_new_fault("An alarm condition",
- "Things are broken",
- EVEL_PRIORITY_NORMAL,
- EVEL_SEVERITY_MAJOR);
- if (fault != NULL)
- {
- evel_rc = evel_post_event((EVENT_HEADER *)fault);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Fault failed");
- }
- printf(" Processed empty Fault\n");
-
- fault = evel_new_fault("Another alarm condition",
- "It broke badly",
- EVEL_PRIORITY_NORMAL,
- EVEL_SEVERITY_MAJOR);
- if (fault != NULL)
- {
- evel_fault_type_set(fault, "Bad things happening");
- evel_fault_interface_set(fault, "An Interface Card");
- evel_rc = evel_post_event((EVENT_HEADER *)fault);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Fault failed");
- }
- printf(" Processed partial Fault\n");
-
- fault = evel_new_fault("My alarm condition",
- "It broke very badly",
- EVEL_PRIORITY_NORMAL,
- EVEL_SEVERITY_MAJOR);
- if (fault != NULL)
- {
- evel_fault_type_set(fault, "Bad things happen...");
- evel_fault_interface_set(fault, "My Interface Card");
- evel_fault_addl_info_add(fault, "name1", "value1");
- evel_fault_addl_info_add(fault, "name2", "value2");
- evel_rc = evel_post_event((EVENT_HEADER *)fault);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Fault failed");
- }
- printf(" Processed full Fault\n");
-}
-
-/**************************************************************************//**
- * Create and send a measurement event.
- *****************************************************************************/
-void demo_measurement(const int interval)
-{
- EVENT_MEASUREMENT * measurement = NULL;
- MEASUREMENT_LATENCY_BUCKET * bucket = NULL;
- MEASUREMENT_VNIC_USE * vnic_use = NULL;
- EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
-
- /***************************************************************************/
- /* Measurement */
- /***************************************************************************/
- measurement = evel_new_measurement(interval);
- if (measurement != NULL)
- {
- evel_measurement_type_set(measurement, "Perf management...");
- evel_measurement_conc_sess_set(measurement, 1);
- evel_measurement_cfg_ents_set(measurement, 2);
- evel_measurement_mean_req_lat_set(measurement, 4.4);
- evel_measurement_mem_cfg_set(measurement, 6.6);
- evel_measurement_mem_used_set(measurement, 3.3);
- evel_measurement_request_rate_set(measurement, 6);
- evel_measurement_agg_cpu_use_set(measurement, 8.8);
- evel_measurement_cpu_use_add(measurement, "cpu1", 11.11);
- evel_measurement_cpu_use_add(measurement, "cpu2", 22.22);
- evel_measurement_fsys_use_add(measurement,"00-11-22",100.11, 100.22, 33,
- 200.11, 200.22, 44);
- evel_measurement_fsys_use_add(measurement,"33-44-55",300.11, 300.22, 55,
- 400.11, 400.22, 66);
-
- bucket = evel_new_meas_latency_bucket(20);
- evel_meas_latency_bucket_low_end_set(bucket, 0.0);
- evel_meas_latency_bucket_high_end_set(bucket, 10.0);
- evel_meas_latency_bucket_add(measurement, bucket);
-
- bucket = evel_new_meas_latency_bucket(30);
- evel_meas_latency_bucket_low_end_set(bucket, 10.0);
- evel_meas_latency_bucket_high_end_set(bucket, 20.0);
- evel_meas_latency_bucket_add(measurement, bucket);
-
- vnic_use = evel_new_measurement_vnic_use("eth0", 100, 200, 3, 4);
- evel_vnic_use_bcast_pkt_in_set(vnic_use, 1);
- evel_vnic_use_bcast_pkt_out_set(vnic_use, 2);
- evel_vnic_use_mcast_pkt_in_set(vnic_use, 5);
- evel_vnic_use_mcast_pkt_out_set(vnic_use, 6);
- evel_vnic_use_ucast_pkt_in_set(vnic_use, 7);
- evel_vnic_use_ucast_pkt_out_set(vnic_use, 8);
- evel_meas_vnic_use_add(measurement, vnic_use);
-
- vnic_use = evel_new_measurement_vnic_use("eth1", 110, 240, 13, 14);
- evel_vnic_use_bcast_pkt_in_set(vnic_use, 11);
- evel_vnic_use_bcast_pkt_out_set(vnic_use, 12);
- evel_vnic_use_mcast_pkt_in_set(vnic_use, 15);
- evel_vnic_use_mcast_pkt_out_set(vnic_use, 16);
- evel_vnic_use_ucast_pkt_in_set(vnic_use, 17);
- evel_vnic_use_ucast_pkt_out_set(vnic_use, 18);
- evel_meas_vnic_use_add(measurement, vnic_use);
-
- evel_measurement_errors_set(measurement, 1, 0, 2, 1);
-
- evel_measurement_feature_use_add(measurement, "FeatureA", 123);
- evel_measurement_feature_use_add(measurement, "FeatureB", 567);
-
- evel_measurement_codec_use_add(measurement, "G711a", 91);
- evel_measurement_codec_use_add(measurement, "G729ab", 92);
-
- evel_measurement_media_port_use_set(measurement, 1234);
-
- evel_measurement_vnfc_scaling_metric_set(measurement, 1234.5678);
-
- evel_measurement_custom_measurement_add(measurement,
- "Group1", "Name1", "Value1");
- evel_measurement_custom_measurement_add(measurement,
- "Group2", "Name1", "Value1");
- evel_measurement_custom_measurement_add(measurement,
- "Group2", "Name2", "Value2");
-
- /*************************************************************************/
- /* Work out the time, to use as end of measurement period. */
- /*************************************************************************/
- struct timeval tv_now;
- gettimeofday(&tv_now, NULL);
- unsigned long long epoch_now = tv_now.tv_usec + 1000000 * tv_now.tv_sec;
- evel_start_epoch_set(&measurement->header, epoch_start);
- evel_last_epoch_set(&measurement->header, epoch_now);
- epoch_start = epoch_now;
- evel_reporting_entity_name_set(&measurement->header, "measurer");
- evel_reporting_entity_id_set(&measurement->header, "measurer_id");
-
- evel_rc = evel_post_event((EVENT_HEADER *)measurement);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post Measurement failed %d (%s)",
- evel_rc,
- evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Measurement failed");
- }
- printf(" Processed Measurement\n");
-}
-
-/**************************************************************************//**
- * Create and send three mobile flow events.
- *****************************************************************************/
-void demo_mobile_flow(void)
-{
- MOBILE_GTP_PER_FLOW_METRICS * metrics = NULL;
- EVENT_MOBILE_FLOW * mobile_flow = NULL;
- EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
-
- /***************************************************************************/
- /* Mobile Flow */
- /***************************************************************************/
- metrics = evel_new_mobile_gtp_flow_metrics(12.3,
- 3.12,
- 100,
- 2100,
- 500,
- 1470409421,
- 987,
- 1470409431,
- 11,
- (time_t)1470409431,
- "Working",
- 87,
- 3,
- 17,
- 123654,
- 4561,
- 0,
- 12,
- 10,
- 1,
- 3,
- 7,
- 899,
- 901,
- 302,
- 6,
- 2,
- 0,
- 110,
- 225);
- if (metrics != NULL)
- {
- mobile_flow = evel_new_mobile_flow("Outbound",
- metrics,
- "TCP",
- "IPv4",
- "2.3.4.1",
- 2341,
- "4.2.3.1",
- 4321);
- if (mobile_flow != NULL)
- {
- evel_rc = evel_post_event((EVENT_HEADER *)mobile_flow);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post Mobile Flow failed %d (%s)",
- evel_rc,
- evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Mobile Flow failed");
- }
- printf(" Processed empty Mobile Flow\n");
- }
- else
- {
- EVEL_ERROR("New GTP Per Flow Metrics failed - skipping Mobile Flow");
- printf(" Skipped empty Mobile Flow\n");
- }
-
- metrics = evel_new_mobile_gtp_flow_metrics(132.0001,
- 31.2,
- 101,
- 2101,
- 501,
- 1470409422,
- 988,
- 1470409432,
- 12,
- (time_t)1470409432,
- "Inactive",
- 88,
- 4,
- 18,
- 123655,
- 4562,
- 1,
- 13,
- 11,
- 2,
- 4,
- 8,
- 900,
- 902,
- 303,
- 7,
- 3,
- 1,
- 111,
- 226);
- if (metrics != NULL)
- {
- mobile_flow = evel_new_mobile_flow("Inbound",
- metrics,
- "UDP",
- "IPv6",
- "2.3.4.2",
- 2342,
- "4.2.3.2",
- 4322);
- if (mobile_flow != NULL)
- {
- evel_mobile_flow_app_type_set(mobile_flow, "Demo application");
- evel_mobile_flow_app_prot_type_set(mobile_flow, "GSM");
- evel_mobile_flow_app_prot_ver_set(mobile_flow, "1");
- evel_mobile_flow_cid_set(mobile_flow, "65535");
- evel_mobile_flow_con_type_set(mobile_flow, "S1-U");
- evel_mobile_flow_ecgi_set(mobile_flow, "e65535");
- evel_mobile_flow_gtp_prot_type_set(mobile_flow, "GTP-U");
- evel_mobile_flow_gtp_prot_ver_set(mobile_flow, "1");
- evel_mobile_flow_http_header_set(mobile_flow,
- "http://www.something.com");
- evel_mobile_flow_imei_set(mobile_flow, "209917614823");
- evel_mobile_flow_imsi_set(mobile_flow, "355251/05/850925/8");
- evel_mobile_flow_lac_set(mobile_flow, "1");
- evel_mobile_flow_mcc_set(mobile_flow, "410");
- evel_mobile_flow_mnc_set(mobile_flow, "04");
- evel_mobile_flow_msisdn_set(mobile_flow, "6017123456789");
- evel_mobile_flow_other_func_role_set(mobile_flow, "MME");
- evel_mobile_flow_rac_set(mobile_flow, "514");
- evel_mobile_flow_radio_acc_tech_set(mobile_flow, "LTE");
- evel_mobile_flow_sac_set(mobile_flow, "1");
- evel_mobile_flow_samp_alg_set(mobile_flow, 1);
- evel_mobile_flow_tac_set(mobile_flow, "2099");
- evel_mobile_flow_tunnel_id_set(mobile_flow, "Tunnel 1");
- evel_mobile_flow_vlan_id_set(mobile_flow, "15");
-
- evel_rc = evel_post_event((EVENT_HEADER *)mobile_flow);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post Mobile Flow failed %d (%s)",
- evel_rc,
- evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Mobile Flow failed");
- }
- printf(" Processed partial Mobile Flow\n");
- }
- else
- {
- EVEL_ERROR("New GTP Per Flow Metrics failed - skipping Mobile Flow");
- printf(" Skipped partial Mobile Flow\n");
- }
-
- metrics = evel_new_mobile_gtp_flow_metrics(12.32,
- 3.122,
- 1002,
- 21002,
- 5002,
- 1470409423,
- 9872,
- 1470409433,
- 112,
- (time_t)1470409433,
- "Failed",
- 872,
- 32,
- 172,
- 1236542,
- 45612,
- 2,
- 122,
- 102,
- 12,
- 32,
- 72,
- 8992,
- 9012,
- 3022,
- 62,
- 22,
- 2,
- 1102,
- 2252);
- if (metrics != NULL)
- {
- evel_mobile_gtp_metrics_dur_con_fail_set(metrics, 12);
- evel_mobile_gtp_metrics_dur_tun_fail_set(metrics, 13);
- evel_mobile_gtp_metrics_act_by_set(metrics, "Remote");
- evel_mobile_gtp_metrics_act_time_set(metrics, (time_t)1470409423);
- evel_mobile_gtp_metrics_deact_by_set(metrics, "Remote");
- evel_mobile_gtp_metrics_con_status_set(metrics, "Connected");
- evel_mobile_gtp_metrics_tun_status_set(metrics, "Not tunneling");
- evel_mobile_gtp_metrics_iptos_set(metrics, 1, 13);
- evel_mobile_gtp_metrics_iptos_set(metrics, 17, 1);
- evel_mobile_gtp_metrics_iptos_set(metrics, 4, 99);
- evel_mobile_gtp_metrics_large_pkt_rtt_set(metrics, 80);
- evel_mobile_gtp_metrics_large_pkt_thresh_set(metrics, 600.0);
- evel_mobile_gtp_metrics_max_rcv_bit_rate_set(metrics, 1357924680);
- evel_mobile_gtp_metrics_max_trx_bit_rate_set(metrics, 235711);
- evel_mobile_gtp_metrics_num_echo_fail_set(metrics, 1);
- evel_mobile_gtp_metrics_num_tun_fail_set(metrics, 4);
- evel_mobile_gtp_metrics_num_http_errors_set(metrics, 2);
- evel_mobile_gtp_metrics_tcp_flag_count_add(metrics, EVEL_TCP_CWR, 10);
- evel_mobile_gtp_metrics_tcp_flag_count_add(metrics, EVEL_TCP_URG, 121);
- evel_mobile_gtp_metrics_qci_cos_count_add(
- metrics, EVEL_QCI_COS_UMTS_CONVERSATIONAL, 11);
- evel_mobile_gtp_metrics_qci_cos_count_add(
- metrics, EVEL_QCI_COS_LTE_65, 122);
-
- mobile_flow = evel_new_mobile_flow("Outbound",
- metrics,
- "RTP",
- "IPv8",
- "2.3.4.3",
- 2343,
- "4.2.3.3",
- 4323);
- if (mobile_flow != NULL)
- {
- evel_mobile_flow_app_type_set(mobile_flow, "Demo application 2");
- evel_mobile_flow_app_prot_type_set(mobile_flow, "GSM");
- evel_mobile_flow_app_prot_ver_set(mobile_flow, "2");
- evel_mobile_flow_cid_set(mobile_flow, "1");
- evel_mobile_flow_con_type_set(mobile_flow, "S1-U");
- evel_mobile_flow_ecgi_set(mobile_flow, "e1");
- evel_mobile_flow_gtp_prot_type_set(mobile_flow, "GTP-U");
- evel_mobile_flow_gtp_prot_ver_set(mobile_flow, "1");
- evel_mobile_flow_http_header_set(mobile_flow, "http://www.google.com");
- evel_mobile_flow_imei_set(mobile_flow, "209917614823");
- evel_mobile_flow_imsi_set(mobile_flow, "355251/05/850925/8");
- evel_mobile_flow_lac_set(mobile_flow, "1");
- evel_mobile_flow_mcc_set(mobile_flow, "410");
- evel_mobile_flow_mnc_set(mobile_flow, "04");
- evel_mobile_flow_msisdn_set(mobile_flow, "6017123456789");
- evel_mobile_flow_other_func_role_set(mobile_flow, "MMF");
- evel_mobile_flow_rac_set(mobile_flow, "514");
- evel_mobile_flow_radio_acc_tech_set(mobile_flow, "3G");
- evel_mobile_flow_sac_set(mobile_flow, "1");
- evel_mobile_flow_samp_alg_set(mobile_flow, 2);
- evel_mobile_flow_tac_set(mobile_flow, "2099");
- evel_mobile_flow_tunnel_id_set(mobile_flow, "Tunnel 2");
- evel_mobile_flow_vlan_id_set(mobile_flow, "4096");
-
- evel_rc = evel_post_event((EVENT_HEADER *)mobile_flow);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post Mobile Flow failed %d (%s)",
- evel_rc,
- evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Mobile Flow failed");
- }
- printf(" Processed full Mobile Flow\n");
- }
- else
- {
- EVEL_ERROR("New GTP Per Flow Metrics failed - skipping Mobile Flow");
- printf(" Skipped full Mobile Flow\n");
- }
-}
-
-/**************************************************************************//**
- * Create and send a Service event.
- *****************************************************************************/
-void demo_service()
-{
- demo_service_event(SERVICE_CODEC);
- demo_service_event(SERVICE_TRANSCODING);
- demo_service_event(SERVICE_RTCP);
- demo_service_event(SERVICE_EOC_VQM);
- demo_service_event(SERVICE_MARKER);
-}
-
-void demo_service_event(const SERVICE_EVENT service_event)
-{
- EVENT_SERVICE * event = NULL;
- EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
-
- event = evel_new_service("vendor_x_id", "vendor_x_event_id");
- if (event != NULL)
- {
- evel_service_type_set(event, "Service Event");
- evel_service_product_id_set(event, "vendor_x_product_id");
- evel_service_subsystem_id_set(event, "vendor_x_subsystem_id");
- evel_service_friendly_name_set(event, "vendor_x_frieldly_name");
- evel_service_correlator_set(event, "vendor_x_correlator");
- evel_service_addl_field_add(event, "Name1", "Value1");
- evel_service_addl_field_add(event, "Name2", "Value2");
-
- switch (service_event)
- {
- case SERVICE_CODEC:
- evel_service_codec_set(event, "PCMA");
- break;
- case SERVICE_TRANSCODING:
- evel_service_callee_codec_set(event, "PCMA");
- evel_service_caller_codec_set(event, "G729A");
- break;
- case SERVICE_RTCP:
- evel_service_rtcp_data_set(event, "some_rtcp_data");
- break;
- case SERVICE_EOC_VQM:
- evel_service_adjacency_name_set(event, "vendor_x_adjacency");
- evel_service_endpoint_desc_set(event, EVEL_SERVICE_ENDPOINT_CALLER);
- evel_service_endpoint_jitter_set(event, 66);
- evel_service_endpoint_rtp_oct_disc_set(event, 100);
- evel_service_endpoint_rtp_oct_recv_set(event, 200);
- evel_service_endpoint_rtp_oct_sent_set(event, 300);
- evel_service_endpoint_rtp_pkt_disc_set(event, 400);
- evel_service_endpoint_rtp_pkt_recv_set(event, 500);
- evel_service_endpoint_rtp_pkt_sent_set(event, 600);
- evel_service_local_jitter_set(event, 99);
- evel_service_local_rtp_oct_disc_set(event, 150);
- evel_service_local_rtp_oct_recv_set(event, 250);
- evel_service_local_rtp_oct_sent_set(event, 350);
- evel_service_local_rtp_pkt_disc_set(event, 450);
- evel_service_local_rtp_pkt_recv_set(event, 550);
- evel_service_local_rtp_pkt_sent_set(event, 650);
- evel_service_mos_cqe_set(event, 12.255);
- evel_service_packets_lost_set(event, 157);
- evel_service_packet_loss_percent_set(event, 0.232);
- evel_service_r_factor_set(event, 11);
- evel_service_round_trip_delay_set(event, 15);
- break;
- case SERVICE_MARKER:
- evel_service_phone_number_set(event, "0888888888");
- break;
- }
-
- evel_rc = evel_post_event((EVENT_HEADER *) event);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Service failed");
- }
- printf(" Processed Service Events\n");
-}
-
-/**************************************************************************//**
- * Create and send a Signaling event.
- *****************************************************************************/
-void demo_signaling(void)
-{
- EVENT_SIGNALING * event = NULL;
- EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
-
- event = evel_new_signaling("vendor_x_id", "vendor_x_event_id");
- if (event != NULL)
- {
- evel_signaling_type_set(event, "Signaling");
- evel_signaling_product_id_set(event, "vendor_x_product_id");
- evel_signaling_subsystem_id_set(event, "vendor_x_subsystem_id");
- evel_signaling_friendly_name_set(event, "vendor_x_frieldly_name");
- evel_signaling_correlator_set(event, "vendor_x_correlator");
- evel_signaling_local_ip_address_set(event, "1.0.3.1");
- evel_signaling_local_port_set(event, "1031");
- evel_signaling_remote_ip_address_set(event, "5.3.3.0");
- evel_signaling_remote_port_set(event, "5330");
- evel_signaling_compressed_sip_set(event, "compressed_sip");
- evel_signaling_summary_sip_set(event, "summary_sip");
- evel_rc = evel_post_event((EVENT_HEADER *) event);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Signaling failed");
- }
- printf(" Processed Signaling\n");
-}
-
-/**************************************************************************//**
- * Create and send a state change event.
- *****************************************************************************/
-void demo_state_change(void)
-{
- EVENT_STATE_CHANGE * state_change = NULL;
- EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
-
- /***************************************************************************/
- /* State Change */
- /***************************************************************************/
- state_change = evel_new_state_change(EVEL_ENTITY_STATE_IN_SERVICE,
- EVEL_ENTITY_STATE_OUT_OF_SERVICE,
- "Interface");
- if (state_change != NULL)
- {
- evel_state_change_type_set(state_change, "State Change");
- evel_state_change_addl_field_add(state_change, "Name1", "Value1");
- evel_state_change_addl_field_add(state_change, "Name2", "Value2");
- evel_rc = evel_post_event((EVENT_HEADER *)state_change);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New State Change failed");
- }
- printf(" Processed State Change\n");
-}
-
-/**************************************************************************//**
- * Create and send two syslog events.
- *****************************************************************************/
-void demo_syslog(void)
-{
- EVENT_SYSLOG * syslog = NULL;
- EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
-
- /***************************************************************************/
- /* Syslog */
- /***************************************************************************/
- syslog = evel_new_syslog(EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION,
- "EVEL library message",
- "EVEL");
- if (syslog != NULL)
- {
- evel_rc = evel_post_event((EVENT_HEADER *)syslog);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Syslog failed");
- }
- printf(" Processed empty Syslog\n");
-
- syslog = evel_new_syslog(EVEL_SOURCE_VIRTUAL_MACHINE,
- "EVEL library message",
- "EVEL");
- if (syslog != NULL)
- {
- evel_syslog_event_source_host_set(syslog, "Virtual host");
- evel_syslog_facility_set(syslog, EVEL_SYSLOG_FACILITY_LOCAL0);
- evel_syslog_proc_set(syslog, "vnf_process");
- evel_syslog_proc_id_set(syslog, 1423);
- evel_syslog_version_set(syslog, 1);
- evel_syslog_addl_field_add(syslog, "Name1", "Value1");
- evel_syslog_addl_field_add(syslog, "Name2", "Value2");
- evel_syslog_addl_field_add(syslog, "Name3", "Value3");
- evel_syslog_addl_field_add(syslog, "Name4", "Value4");
- evel_rc = evel_post_event((EVENT_HEADER *)syslog);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Syslog failed");
- }
- printf(" Processed full Syslog\n");
-}
-
-/**************************************************************************//**
- * Create and send two other events.
- *****************************************************************************/
-void demo_other(void)
-{
- EVENT_OTHER * other = NULL;
- EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
-
- /***************************************************************************/
- /* Other */
- /***************************************************************************/
- other = evel_new_other();
- if (other != NULL)
- {
- evel_rc = evel_post_event((EVENT_HEADER *)other);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Other failed");
- }
- printf(" Processed empty Other\n");
-
- other = evel_new_other();
- if (other != NULL)
- {
- evel_other_field_add(other,
- "Other field 1",
- "Other value 1");
- evel_rc = evel_post_event((EVENT_HEADER *)other);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Other failed");
- }
- printf(" Processed small Other\n");
-
- other = evel_new_other();
- if (other != NULL)
- {
- evel_other_field_add(other,
- "Other field A",
- "Other value A");
- evel_other_field_add(other,
- "Other field B",
- "Other value B");
- evel_other_field_add(other,
- "Other field C",
- "Other value C");
- evel_rc = evel_post_event((EVENT_HEADER *)other);
- if (evel_rc != EVEL_SUCCESS)
- {
- EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
- }
- }
- else
- {
- EVEL_ERROR("New Other failed");
- }
- printf(" Processed large Other\n");
-}
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/infsetup.py b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/infsetup.py
new file mode 100644
index 0000000..fb8cbdc
--- /dev/null
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/infsetup.py
@@ -0,0 +1,70 @@
+#!/usr/bin/python3
+import argparse
+import json
+
+from influxdb import InfluxDBClient
+
+
+def main(host='localhost', port=8086):
+ user = 'root'
+ password = 'root'
+ dbname = 'veseventsdb'
+ dbuser = 'root'
+ dbuser_password = 'my_secret_password'
+ query = 'select value from cpu_load_short;'
+ json_body = [
+ {
+ "measurement": "cpu_load_short",
+ "tags": {
+ "host": "server01",
+ "region": "us-west"
+ },
+ "time": "2009-11-10T23:00:00Z",
+ "fields": {
+ "Float_value": 0.64,
+ "Int_value": 3,
+ "String_value": "Text",
+ "Bool_value": True
+ }
+ }
+ ]
+
+ client = InfluxDBClient(host, port, user, password, dbname)
+
+ print("Create database: " + dbname)
+ client.create_database(dbname)
+
+ print("Create a retention policy")
+ client.create_retention_policy('awesome_policy', '6h', 3, default=True)
+
+# print("Switch user: " + dbuser)
+# client.switch_user(dbuser, dbuser_password)
+#
+# print("Write points: {0}".format(json_body))
+# client.write_points(json_body)
+#
+# print("Queying data: " + query)
+# result = client.query(query)
+#
+# print("Result: {0}".format(result))
+#
+# print("Switch user: " + user)
+# client.switch_user(user, password)
+#
+# print("Drop database: " + dbname)
+# client.drop_database(dbname)
+#
+
+def parse_args():
+ parser = argparse.ArgumentParser(
+ description='example code to play with InfluxDB')
+ parser.add_argument('--host', type=str, required=False, default='localhost',
+ help='hostname of InfluxDB http API')
+ parser.add_argument('--port', type=int, required=False, default=8086,
+ help='port of InfluxDB http API')
+ return parser.parse_args()
+
+
+if __name__ == '__main__':
+ args = parse_args()
+ main(host=args.host, port=args.port)
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 9b16af3..8784ca4 100644
--- a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/monitor.py
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/monitor.py
@@ -14,8 +14,8 @@
# 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.
+# What this is: Monitor and closed-loop policy agent as part of the OPNFV VES
+# ves_onap_demo.
#
# Status: this is a work in progress, under test.
@@ -34,9 +34,10 @@ import string
import json
import jsonschema
from functools import partial
+import requests
monitor_mode = "f"
-vdu_id = ['','','','']
+vdu_id = ['','','','','','']
summary_e = ['***** Summary of key stats *****','','','']
summary_c = ['Collectd agents:']
status = ['','Started','Started','Started']
@@ -49,27 +50,6 @@ class JSONObject:
def __init__(self, d):
self.__dict__ = d
-_hello_resp = '''\
-<html>
- <head>
- <title>Hello {name}</title>
- </head>
- <body>
- <h1>Hello {name}!</h1>
- </body>
-</html>'''
-
-_localtime_resp = '''\
-<?xml version="1.0"?>
-<time>
- <year>{t.tm_year}</year>
- <month>{t.tm_mon}</month>
- <day>{t.tm_mday}</day>
- <hour>{t.tm_hour}</hour>
- <minute>{t.tm_min}</minute>
- <second>{t.tm_sec}</second>
-</time>'''
-
__all__ = []
__version__ = 0.1
__date__ = '2015-12-04'
@@ -197,7 +177,7 @@ def listener(environ, start_response, schema):
#--------------------------------------------------------------------------
if (credentials == (vel_username + ':' + vel_password)):
logger.debug('Authenticated OK')
- print('Authenticated OK')
+# print('Authenticated OK')
#----------------------------------------------------------------------
# Respond to the caller. If we have a pending commandList from the
@@ -222,8 +202,9 @@ def listener(environ, start_response, schema):
start_response('202 Accepted', [])
yield ''
else:
- logger.warn('Failed to authenticate OK')
- print('Failed to authenticate agent credentials: ', credentials)
+ logger.warn('Failed to authenticate OK; creds: ' + credentials)
+ print('Failed to authenticate agent credentials: ', credentials,
+ 'against expected ', vel_username, ':', vel_password)
#----------------------------------------------------------------------
# Respond to the caller.
@@ -239,9 +220,90 @@ def listener(environ, start_response, schema):
}
yield json.dumps(req_error)
+ save_event(body)
process_event(body)
#--------------------------------------------------------------------------
+# Send event to influxdb
+#--------------------------------------------------------------------------
+def save_event(body):
+ jobj = json.loads(body)
+ e = json.loads(body, object_hook=JSONObject)
+
+ domain = jobj['event']['commonEventHeader']['domain']
+ timestamp = jobj['event']['commonEventHeader']['lastEpochMicrosec']
+ agent = jobj['event']['commonEventHeader']['reportingEntityName'].upper( )
+ if "VIRT" in agent:
+ agent = "computehost"
+ if "VDU1" in agent:
+ agent = "webserver_1"
+ if "VDU2" in agent:
+ agent = "webserver_2"
+ if "VDU3" in agent:
+ agent = "loadbalancer"
+ if "VDU4" in agent:
+ agent = "firewall"
+
+ 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'})
+ if r.status_code != 204:
+ print('*** Failed to add cpu event to influxdb ***')
+
+ if 'measurementsForVfScalingFields' in jobj['event']:
+ print('Found measurementsForVfScalingFields')
+ if 'cpuUsageArray' in jobj['event']['measurementsForVfScalingFields']:
+ if 'additionalFields' in jobj['event']['measurementsForVfScalingFields']:
+ for f in e.event.measurementsForVfScalingFields.additionalFields:
+ if f.name == "cpu-aggregation-cpu-average-user-percent-value":
+ aggregateCpuUsageUser = f.value
+ if f.name == "cpu-aggregation-cpu-average-system-percent-value":
+ aggregateCpuUsageSystem = f.value
+ if f.name == "cpu-aggregation-cpu-average-idle-percent-value":
+ aggregateCpuIdle = f.value
+ else:
+ a = e.event.measurementsForVfScalingFields.cpuUsageArray[0]
+ aggregateCpuUsageUser = a.cpuUsageUser
+ aggregateCpuUsageSystem = a.cpuUsageSystem
+ aggregateCpuIdle = a.cpuIdle
+
+ 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'})
+ if r.status_code != 204:
+ print('*** Failed to add cpu event to influxdb ***')
+
+ if 'vNicPerformanceArray' in jobj['event']['measurementsForVfScalingFields']:
+ print('Found vNicPerformanceArray')
+ vnicn = 1
+ 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'})
+ if r.status_code != 204:
+ print('*** Failed to add vnic event to influxdb ***')
+ vnicn = vnicn + 1
+
+ if 'vNicUsageArray' in jobj['event']['measurementsForVfScalingFields']:
+ print('Found vNicUsageArray')
+ 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'})
+ if r.status_code != 204:
+ print('*** Failed to add vnic event to influxdb ***')
+
+ if 'requestRate' in jobj['event']['measurementsForVfScalingFields']:
+ 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'})
+ if r.status_code != 204:
+ print('*** Failed to add http event to influxdb ***')
+
+#--------------------------------------------------------------------------
# Event processing
#--------------------------------------------------------------------------
def process_event(body):
@@ -256,42 +318,44 @@ def process_event(body):
epoch = e.event.commonEventHeader.lastEpochMicrosec
sourceId = e.event.commonEventHeader.sourceId
- report_time = time.strftime('%Y-%m-%d %H:%M:%S',
+ report_time = time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(int(epoch)/1000000))
- host = e.event.commonEventHeader.reportingEntityName
+ host = e.event.commonEventHeader.sourceName
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
-
+ if 'VDU4' in host or 'vdu4' in host: vdu = 4
+
domain = e.event.commonEventHeader.domain
if domain == 'measurementsForVfScaling':
- if vdu >= 1:
+ if vdu <= 2:
requestRate = e.event.measurementsForVfScalingFields.requestRate
summary_e[vdu] = host + ": state=" + status[vdu] + ", tps=" + str(requestRate)
- else:
- aggregateCpuUsage = e.event.measurementsForVfScalingFields.aggregateCpuUsage
- vNicUsageArray = e.event.measurementsForVfScalingFields.vNicUsageArray
- s = ""
- for i in range(1,len(vdu_id)):
- if sourceId.upper() in vdu_id[i].upper():
- s = "(VDU"+ str(i) + ") "
- if s:
- s += host + ": cpu=" + str(aggregateCpuUsage)
- found = False
- for i in range(1,len(summary_c)):
- if host in summary_c[i]:
- summary_c[i] = s
- found = True
- break
- if not found:
- summary_c.extend([s])
+# else:
+# for f in e.event.measurementsForVfScalingFields.additionalFields:
+# if f.name == "cpu-aggregation-cpu-average-idle-percent-value":
+# aggregateCpuUsage = 100 - float(f.value)
+# break
+# s = ""
+# for i in range(1,len(vdu_id)):
+# if sourceName.upper() in vdu_id[i].upper():
+# s = " (VDU"+ str(i) + ") "
+# s = host + ": cpu=" + aggregateCpuUsage
+# found = False
+# for c in summary_c:
+# if host in c:
+# c = s
+# found = True
+# break
+# if not found:
+# summary_c.append(s)
for s in summary_e:
print '{0}'.format(s)
- for s in summary_c:
- print '{0}'.format(s)
+# for s in summary_c:
+# print '{0}'.format(s)
if domain == 'fault' and vdu >= 1:
alarmCondition = e.event.faultFields.alarmCondition
@@ -448,7 +512,7 @@ USAGE
help='Display version information')
parser.add_argument('-a', '--api-version',
dest='api_version',
- default='3',
+ default='5',
help='set API version')
parser.add_argument('-c', '--config',
dest='config',
@@ -518,7 +582,7 @@ USAGE
#----------------------------------------------------------------------
global logger
print('Logfile: {0}'.format(log_file))
- logger = logging.getLogger('collector')
+ logger = logging.getLogger('monitor')
if verbose > 0:
print('Verbose mode on')
logger.setLevel(logging.DEBUG)
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/start.sh b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/start.sh
index 0f27dd3..ad5bf11 100644
--- a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/start.sh
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/start.sh
@@ -21,7 +21,8 @@
# How to use:
# Intended to be invoked from ves_onap_demo.sh
# $ bash start.sh type params
-# type: type of VNF component [monitor|collectd]
+# type: type of VNF component [webserver|vfw|vlb|monitor|collectd]
+# webserver|vfw|vlb| params: ID CollectorIP username password
# collector params: ID CollectorIP username password
# monitor params: VDU1_ID VDU1_ID VDU1_ID username password
# ID: VM ID
@@ -51,8 +52,11 @@ setup_collectd () {
cd ~
echo "$0: Install VES collectd plugin"
- git clone https://git.opnfv.org/barometer
- sudo sed -i -- "s/v1/v3/" barometer/3rd_party/collectd-ves-plugin/ves_plugin/ves_plugin.py
+ # this is a clone of barometer patch https://gerrit.opnfv.org/gerrit/#/c/35489
+ git clone https://gerrit.opnfv.org/gerrit/barometer
+ cd barometer
+ git pull https://gerrit.opnfv.org/gerrit/barometer refs/changes/89/35489/2
+ cd ..
sudo sed -i -- "s/FQDNLookup true/FQDNLookup false/" $conf
sudo sed -i -- "s/#LoadPlugin cpu/LoadPlugin cpu/" $conf
@@ -60,47 +64,8 @@ setup_collectd () {
sudo sed -i -- "s/#LoadPlugin interface/LoadPlugin interface/" $conf
sudo sed -i -- "s/#LoadPlugin memory/LoadPlugin memory/" $conf
- if [[ "$guest" == true ]]; then
- cat <<EOF | sudo tee -a $conf
-<LoadPlugin python>
- Globals true
-</LoadPlugin>
-<Plugin python>
- ModulePath "/home/$USER/barometer/3rd_party/collectd-ves-plugin/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"
- GuestRunning true
-</Module>
-</Plugin>
-<Plugin cpu>
- ReportByCpu false
- ValuesPercentage true
-</Plugin>
-LoadPlugin aggregation
-<Plugin aggregation>
- <Aggregation>
- Plugin "cpu"
- Type "percent"
- GroupBy "Host"
- GroupBy "TypeInstance"
- SetPlugin "cpu-aggregation"
- CalculateAverage true
- </Aggregation>
-</Plugin>
-LoadPlugin uuid
-EOF
- else
- cat <<EOF | sudo tee -a $conf
+
+ cat <<EOF | sudo tee -a $conf
<LoadPlugin python>
Globals true
</LoadPlugin>
@@ -118,14 +83,13 @@ EOF
Username "hello"
Password "world"
FunctionalRole "Collectd VES Agent"
- GuestRunning false
</Module>
</Plugin>
LoadPlugin virt
<Plugin virt>
Connection "qemu:///system"
RefreshInterval 60
- HostnameFormat uuid
+ HostnameFormat name uuid
</Plugin>
<Plugin cpu>
ReportByCpu false
@@ -144,12 +108,12 @@ LoadPlugin aggregation
</Plugin>
LoadPlugin uuid
EOF
- fi
sudo service collectd restart
}
-setup_agent () {
+vnfc_common() {
echo "$0: Install prerequisites"
+ sudo apt-get update
sudo apt-get install -y gcc
# NOTE: force is required as some packages can't be authenticated...
sudo apt-get install -y --force-yes libcurl4-openssl-dev
@@ -157,25 +121,68 @@ setup_agent () {
echo "$0: Clone agent library"
cd /home/ubuntu
+ rm -rf evel-library
git clone https://github.com/att/evel-library.git
- echo "$0: Clone VES repo"
- git clone https://gerrit.opnfv.org/gerrit/ves
+ echo "$0: Update EVEL_API version (workaround until the library is updated)"
+ sed -i -- "s/#define EVEL_API_MAJOR_VERSION 3/#define EVEL_API_MAJOR_VERSION 5/" evel-library/code/evel_library/evel.h
+ sed -i -- "s/#define EVEL_API_MINOR_VERSION 0/#define EVEL_API_MINOR_VERSION 0/" evel-library/code/evel_library/evel.h
+}
- echo "$0: Use ves_onap_demo blueprint version of agent_demo.c"
- cp ves/tests/blueprints/tosca-vnfd-onap-demo/evel_demo.c evel-library/code/evel_demo/evel_demo.c
+setup_vFW () {
+ vnfc_common
- echo "$0: Build evel_demo agent"
- cd evel-library/bldjobs
+ echo "$0: Build evel_library agent"
+ cd ~/evel-library/bldjobs
make
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ubuntu/evel-library/libs/x86_64
- echo "$0: Start evel_demo agent"
+ echo "$0: Build agent"
+ cd ~/tosca-vnfd-onap-demo/vFW
+ make
+
+ echo "$0: Start agent"
+ vnic=$(route | grep '^default' | grep -o '[^ ]*$')
id=$(cut -d ',' -f 3 /mnt/openstack/latest/meta_data.json | cut -d '"' -f 4)
- nohup ../output/x86_64/evel_demo --id $id --fqdn $collector_ip --port 30000 --username $username --password $password -x > /dev/null 2>&1 &
+ echo "$0: Starting vpp_measurement_reporter $id $collector_ip 30000 $username $password $vnic vLB"
+ nohup ~/tosca-vnfd-onap-demo/vFW/vpp_measurement_reporter $id $collector_ip 30000 $username $password $vnic vFW -x > /dev/null 2>&1 &
+}
+
+setup_vLB () {
+ vnfc_common
- echo "$0: Start collectd agent running in the VM"
- setup_collectd true
+ echo "$0: Build evel_library agent"
+ cd ~/evel-library/bldjobs
+ make
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ubuntu/evel-library/libs/x86_64
+
+ # TODO: Currently using a single agent for both vFW and vLB as it's all common
+ # except for DNS-related aspects not yet implemented.
+ echo "$0: Build agent"
+ cd ~/tosca-vnfd-onap-demo/vFW
+ make
+
+ echo "$0: Start agent"
+ vnic=$(route | grep '^default' | grep -o '[^ ]*$')
+ id=$(cut -d ',' -f 3 /mnt/openstack/latest/meta_data.json | cut -d '"' -f 4)
+ echo "$0: Starting vpp_measurement_reporter $id $collector_ip 30000 $username $password $vnic vLB"
+ nohup ~/tosca-vnfd-onap-demo/vFW/vpp_measurement_reporter $id $collector_ip 30000 $username $password $vnic vLB -x > /dev/null 2>&1 &
+}
+
+setup_webserver () {
+ vnfc_common
+
+ echo "$0: Use ves_onap_demo blueprint version of agent_demo.c"
+ cp ~/tosca-vnfd-onap-demo/evel_demo.c ~/evel-library/code/evel_demo/evel_demo.c
+
+ echo "$0: Build agent"
+ cd ~/evel-library/bldjobs
+ make
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ubuntu/evel-library/libs/x86_64
+
+ echo "$0: Start agent"
+ id=$(cut -d ',' -f 3 /mnt/openstack/latest/meta_data.json | cut -d '"' -f 4)
+ nohup ../output/x86_64/evel_demo --id $id --fqdn $collector_ip --port 30000 --username $username --password $password -x > ~/evel_demo.log 2>&1 &
}
setup_monitor () {
@@ -189,20 +196,42 @@ setup_monitor () {
echo "$0: setup VES Monitor config"
sudo mkdir /var/log/att
sudo chown ubuntu /var/log/att
- touch /var/log/att/collector.log
+ touch /var/log/att/monitor.log
sudo chown ubuntu /home/ubuntu/
cd /home/ubuntu/
git clone https://github.com/att/evel-test-collector.git
- sed -i -- "s/vel_username = /vel_username = $username/" evel-test-collector/config/collector.conf
- sed -i -- "s/vel_password = /vel_password = $password/" evel-test-collector/config/collector.conf
- sed -i -- "s~vel_path = vendor_event_listener/~vel_path = ~" evel-test-collector/config/collector.conf
- sed -i -- "s/vel_topic_name = example_vnf/vel_topic_name = /" evel-test-collector/config/collector.conf
+ sed -i -- "s/vel_username =/vel_username = $username/g" evel-test-collector/config/collector.conf
+ sed -i -- "s/vel_password =/vel_password = $password/g" evel-test-collector/config/collector.conf
+ sed -i -- "s~vel_path = vendor_event_listener/~vel_path = ~g" evel-test-collector/config/collector.conf
+ sed -i -- "s/vel_topic_name = example_vnf/vel_topic_name = /g" evel-test-collector/config/collector.conf
+ sed -i -- "/vel_topic_name = /a vdu4_id = $vdu4_id" evel-test-collector/config/collector.conf
sed -i -- "/vel_topic_name = /a vdu3_id = $vdu3_id" evel-test-collector/config/collector.conf
sed -i -- "/vel_topic_name = /a vdu2_id = $vdu2_id" evel-test-collector/config/collector.conf
sed -i -- "/vel_topic_name = /a vdu1_id = $vdu1_id" evel-test-collector/config/collector.conf
- cp monitor.py evel-test-collector/code/collector/monitor.py
- nohup python evel-test-collector/code/collector/monitor.py --config evel-test-collector/config/collector.conf --section default > /home/ubuntu/monitor.log
+ echo "$0: install influxdb and python influxdb library"
+ sudo apt-get install -y influxdb
+ sudo service influxdb start
+ sudo apt-get install -y python-influxdb
+
+ echo "$0: install grafana"
+ sudo apt-get install -y grafana
+ sudo service grafana-server start
+ sudo update-rc.d grafana-server defaults
+
+ echo "$0: Setup InfluxDB datatabase"
+ python tosca-vnfd-onap-demo/infsetup.py
+
+ echo "$0: Add datasource to grafana"
+ curl http://admin:admin@localhost:3000/api/datasources
+ curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"name":"VESEvents","type":"influxdb","access":"direct","url":"http://localhost:8086","password":"root","user":"root","database":"veseventsdb","basicAuth":false,"basicAuthUser":"","basicAuthPassword":"","withCredentials":false,"isDefault":false,"jsonData":null}' \
+ http://admin:admin@localhost:3000/api/datasources
+
+ echo "$0: Import Dashboard.json into grafana"
+ curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d @tosca-vnfd-onap-demo/Dashboard.json http://admin:admin@localhost:3000/api/dashboards/db
+
+ cp tosca-vnfd-onap-demo/monitor.py evel-test-collector/code/collector/monitor.py
+ nohup python evel-test-collector/code/collector/monitor.py --config evel-test-collector/config/collector.conf --section default > ~/monitor.log 2>&1 &
}
type=$1
@@ -211,13 +240,13 @@ if [[ "$type" == "monitor" ]]; then
vdu1_id=$2
vdu2_id=$3
vdu3_id=$4
- username=$5
- password=$6
+ vdu4_id=$5
+ username=$6
+ password=$7
else
- vm_id=$2
- collector_ip=$3
- username=$4
- password=$5
+ collector_ip=$2
+ username=$3
+ password=$4
fi
setup_$type $1
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vFW/Makefile b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vFW/Makefile
new file mode 100644
index 0000000..ebe8050
--- /dev/null
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vFW/Makefile
@@ -0,0 +1,44 @@
+#############################################################################
+#
+# Copyright © 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.
+#
+#############################################################################
+
+CC=gcc
+ARCH=$(shell getconf LONG_BIT)
+CODE_ROOT=/home/ubuntu/evel-library
+LIBS_DIR=$(CODE_ROOT)/libs/x86_$(ARCH)
+INCLUDE_DIR=$(CODE_ROOT)/code/evel_library
+
+#******************************************************************************
+# Standard compiler flags. *
+#******************************************************************************
+CPPFLAGS=
+CFLAGS=-Wall -g -fPIC
+
+all: vpp_measurement_reporter
+
+clean:
+ rm -f vpp_measurement_reporter
+
+vpp_measurement_reporter: vpp_measurement_reporter.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o vpp_measurement_reporter \
+ -L $(LIBS_DIR) \
+ -I $(INCLUDE_DIR) \
+ vpp_measurement_reporter.c \
+ -lpthread \
+ -level \
+ -lcurl
+
+
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vFW/vpp_measurement_reporter.c b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vFW/vpp_measurement_reporter.c
new file mode 100644
index 0000000..f41b50a
--- /dev/null
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vFW/vpp_measurement_reporter.c
@@ -0,0 +1,357 @@
+
+/*************************************************************************//**
+ *
+ * Copyright © 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.
+ *
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include "evel.h"
+
+#define BUFSIZE 128
+#define READ_INTERVAL 10
+
+typedef struct dummy_vpp_metrics_struct {
+ int bytes_in;
+ int bytes_out;
+ int packets_in;
+ int packets_out;
+} vpp_metrics_struct;
+
+void read_vpp_metrics(vpp_metrics_struct *, char *);
+
+unsigned long long epoch_start = 0;
+
+#ifdef DOCKER
+int measure_traffic()
+{
+
+ EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
+ FILE *fp;
+ int status;
+ char count[10];
+ time_t rawtime;
+ struct tm * timeinfo;
+ char period [21];
+ char cmd [100];
+ int concurrent_sessions = 0;
+ int configured_entities = 0;
+ double mean_request_latency = 0;
+ double measurement_interval = 1;
+ double memory_configured = 0;
+ double memory_used = 0;
+ int request_rate=0;
+ char secs [3];
+ int sec;
+ double loadavg;
+
+ printf("Checking app traffic\n");
+ time (&rawtime);
+ timeinfo = localtime (&rawtime);
+ strftime(period,21,"%d/%b/%Y:%H:%M:",timeinfo);
+ strftime(secs,3,"%S",timeinfo);
+ sec = atoi(secs);
+ if (sec == 0) sec = 59;
+ sprintf(secs, "%02d", sec);
+ strncat(period, secs, 21);
+ // ....x....1....x....2.
+ // 15/Oct/2016:17:51:19
+ strcpy(cmd, "sudo docker logs vHello | grep -c ");
+ strncat(cmd, period, 100);
+
+ fp = popen(cmd, "r");
+ if (fp == NULL) {
+ EVEL_ERROR("popen failed to execute command");
+ }
+
+ if (fgets(count, 10, fp) != NULL) {
+ request_rate = atoi(count);
+ printf("Reporting request rate for second: %s as %d\n", period, request_rate);
+
+ }
+ else {
+ EVEL_ERROR("New Measurement failed");
+ }
+ printf("Processed measurement\n");
+
+ status = pclose(fp);
+ if (status == -1) {
+ EVEL_ERROR("pclose returned an error");
+ }
+ return request_rate;
+}
+
+#endif
+
+
+
+/**************************************************************************//**
+ * tap live cpu stats
+ *****************************************************************************/
+void evel_get_cpu_stats(EVENT_MEASUREMENT * measurement)
+{
+ FILE *fp;
+ char path[1024];
+ double usage=0.0;
+ double idle;
+ double intrpt;
+ double nice;
+ double softirq;
+ double steal;
+ double sys;
+ double user;
+ double wait;
+ MEASUREMENT_CPU_USE *cpu_use = NULL;
+
+ /* Open the command for reading. */
+ //fp = popen("/bin/ls /etc/", "r");
+ fp = popen("/usr/bin/top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 ", "r");
+ if (fp == NULL) {
+ printf("Failed to run command\n" );
+ exit(1);
+ }
+
+ /* Read the output a line at a time - output it. */
+ while (fgets(path, sizeof(path)-1, fp) != NULL) {
+ printf("%s", path+10);
+ sscanf(path+10," %lf us, %lf sy, %lf ni, %lf id, %lf wa, %lf hi, %lf si, %lf st",
+ &user,&sys,&nice,&idle,&wait,&intrpt,&softirq,&steal);
+ }
+
+ /* close */
+ pclose(fp);
+
+ cpu_use = evel_measurement_new_cpu_use_add(measurement, "cpu1", usage);
+ if( cpu_use != NULL ){
+ evel_measurement_cpu_use_idle_set(cpu_use,idle);
+ //evel_measurement_cpu_use_interrupt_set(cpu_use,intrpt);
+ //evel_measurement_cpu_use_nice_set(cpu_use,nice);
+ //evel_measurement_cpu_use_softirq_set(cpu_use,softirq);
+ //evel_measurement_cpu_use_steal_set(cpu_use,steal);
+ evel_measurement_cpu_use_system_set(cpu_use,sys);
+ evel_measurement_cpu_use_usageuser_set(cpu_use,user);
+ //evel_measurement_cpu_use_wait_set(cpu_use,wait);
+ //evel_measurement_cpu_use_add(measurement, "cpu2", usage,idle,intrpt,nice,softirq,steal,sys,user,wait);
+ }
+}
+
+int main(int argc, char** argv)
+{
+ EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
+ EVENT_MEASUREMENT* vpp_m = NULL;
+ EVENT_HEADER* vpp_m_header = NULL;
+ int bytes_in_this_round;
+ int bytes_out_this_round;
+ int packets_in_this_round;
+ int packets_out_this_round;
+ vpp_metrics_struct* last_vpp_metrics = malloc(sizeof(vpp_metrics_struct));
+ vpp_metrics_struct* curr_vpp_metrics = malloc(sizeof(vpp_metrics_struct));
+ struct timeval time_val;
+ //time_t start_epoch;
+ //time_t last_epoch;
+ char hostname[BUFSIZE];
+ char* api_vmid = argv[1];
+ char* api_fqdn = argv[2];
+ int api_port = atoi(argv[3]);
+ char* api_username = argv[4];
+ char* api_password = argv[5];
+ char* vnic = argv[6];
+ char* api_role = argv[7];
+ MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL;
+ //struct timeval tv_start;
+
+ printf("\nVector Packet Processing (VPP) measurement collection\n");
+ fflush(stdout);
+
+ fprintf(stderr, "%i parameters: %s %s %i %s %s %s %s\n", argc, api_vmid, api_fqdn, api_port, api_username, api_password, vnic, api_role);
+
+ /**************************************************************************/
+ /* Initialize */
+ /**************************************************************************/
+ if(evel_initialize(api_fqdn, /* fqdn */
+ api_port, /* port */
+ NULL, /* optional path */
+ NULL, /* optional topic */
+ 0, /* HTTPS? */
+ api_username, /* Username */
+ api_password, /* Password */
+ EVEL_SOURCE_VIRTUAL_MACHINE, /* Source type */
+ api_role, /* Role */
+ 1)) /* Verbosity */
+ {
+ fprintf(stderr, "\nFailed to initialize the EVEL library!!!\n");
+ exit(-1);
+ }
+ else
+ {
+ printf("\nInitialization completed\n");
+ }
+
+ gethostname(hostname, BUFSIZE);
+ memset(last_vpp_metrics, 0, sizeof(vpp_metrics_struct));
+ read_vpp_metrics(last_vpp_metrics, vnic);
+ gettimeofday(&time_val, NULL);
+ epoch_start = time_val.tv_sec * 1000000 + time_val.tv_usec;
+ sleep(READ_INTERVAL);
+
+ /***************************************************************************/
+ /* Collect metrics from the VNIC */
+ /***************************************************************************/
+ while(1) {
+ memset(curr_vpp_metrics, 0, sizeof(vpp_metrics_struct));
+ read_vpp_metrics(curr_vpp_metrics, vnic);
+
+ if(curr_vpp_metrics->bytes_in - last_vpp_metrics->bytes_in > 0) {
+ bytes_in_this_round = curr_vpp_metrics->bytes_in - last_vpp_metrics->bytes_in;
+ }
+ else {
+ bytes_in_this_round = 0;
+ }
+ if(curr_vpp_metrics->bytes_out - last_vpp_metrics->bytes_out > 0) {
+ bytes_out_this_round = curr_vpp_metrics->bytes_out - last_vpp_metrics->bytes_out;
+ }
+ else {
+ bytes_out_this_round = 0;
+ }
+ if(curr_vpp_metrics->packets_in - last_vpp_metrics->packets_in > 0) {
+ packets_in_this_round = curr_vpp_metrics->packets_in - last_vpp_metrics->packets_in;
+ }
+ else {
+ packets_in_this_round = 0;
+ }
+ if(curr_vpp_metrics->packets_out - last_vpp_metrics->packets_out > 0) {
+ packets_out_this_round = curr_vpp_metrics->packets_out - last_vpp_metrics->packets_out;
+ }
+ else {
+ packets_out_this_round = 0;
+ }
+
+ vpp_m = evel_new_measurement(READ_INTERVAL);
+ vnic_performance = (MEASUREMENT_VNIC_PERFORMANCE *)evel_measurement_new_vnic_performance(vnic, "true");
+ evel_meas_vnic_performance_add(vpp_m, vnic_performance);
+
+ if(vpp_m != NULL) {
+ printf("New measurement report created...\n");
+
+ evel_measurement_type_set(vpp_m, "HTTP request rate");
+ evel_measurement_request_rate_set(vpp_m, rand()%10000);
+
+ evel_vnic_performance_rx_total_pkt_acc_set(vnic_performance, packets_in_this_round);
+ evel_vnic_performance_tx_total_pkt_acc_set(vnic_performance, packets_out_this_round);
+
+ evel_vnic_performance_rx_octets_acc_set(vnic_performance, bytes_in_this_round);
+ evel_vnic_performance_tx_octets_acc_set(vnic_performance, bytes_out_this_round);
+ evel_get_cpu_stats(vpp_m);
+
+ /***************************************************************************/
+ /* Set parameters in the MEASUREMENT header packet */
+ /***************************************************************************/
+ struct timeval tv_now;
+ gettimeofday(&tv_now, NULL);
+ unsigned long long epoch_now = tv_now.tv_usec + 1000000 * tv_now.tv_sec;
+
+ //last_epoch = start_epoch + READ_INTERVAL * 1000000;
+ vpp_m_header = (EVENT_HEADER *)vpp_m;
+ //vpp_m_header->start_epoch_microsec = start_epoch;
+ //vpp_m_header->last_epoch_microsec = last_epoch;
+ evel_start_epoch_set(&vpp_m->header, epoch_start);
+ evel_last_epoch_set(&vpp_m->header, epoch_now);
+ epoch_start = epoch_now;
+
+ evel_reporting_entity_id_set(&vpp_m->header, api_vmid);
+ evel_reporting_entity_name_set(&vpp_m->header, hostname);
+ evel_rc = evel_post_event(vpp_m_header);
+
+ if(evel_rc == EVEL_SUCCESS) {
+ printf("Measurement report correctly sent to the collector!\n");
+ }
+ else {
+ printf("Post failed %d (%s)\n", evel_rc, evel_error_string());
+ }
+ }
+ else {
+ printf("New measurement report failed (%s)\n", evel_error_string());
+ }
+
+ last_vpp_metrics->bytes_in = curr_vpp_metrics->bytes_in;
+ last_vpp_metrics->bytes_out = curr_vpp_metrics->bytes_out;
+ last_vpp_metrics->packets_in = curr_vpp_metrics->packets_in;
+ last_vpp_metrics->packets_out = curr_vpp_metrics->packets_out;
+ //gettimeofday(&time_val, NULL);
+ //start_epoch = time_val.tv_sec * 1000000 + time_val.tv_usec;
+
+ sleep(READ_INTERVAL);
+ }
+
+ /***************************************************************************/
+ /* Terminate */
+ /***************************************************************************/
+ sleep(1);
+ free(last_vpp_metrics);
+ free(curr_vpp_metrics);
+ evel_terminate();
+ printf("Terminated\n");
+
+ return 0;
+}
+
+void read_vpp_metrics(vpp_metrics_struct *vpp_metrics, char *vnic) {
+ // Define an array of char that contains the parameters of the unix 'cut' command
+ char* params[] = {"-f3", "-f11", "-f4", "-f12"};
+ // Define the unix command to execute in order to read metrics from the vNIC
+ char* cmd_prefix = "sudo cat /proc/net/dev | grep \"";
+ char* cmd_mid = "\" | tr -s \' \' | cut -d\' \' ";
+ char cmd[BUFSIZE];
+ // Define other variables
+ char buf[BUFSIZE]; /* buffer used to store VPP metrics */
+ int temp[] = {0, 0, 0, 0}; /* temp array that contains VPP values */
+ FILE *fp; /* file descriptor to pipe cmd to shell */
+ int i;
+
+ for(i = 0; i < 4; i++) {
+ // Clear buffers
+ memset(buf, 0, BUFSIZE);
+ memset(cmd, 0, BUFSIZE);
+ // Build shell command to read metrics from the vNIC
+ strcat(cmd, cmd_prefix);
+ strcat(cmd, vnic);
+ strcat(cmd, cmd_mid);
+ strcat(cmd, params[i]);
+
+ // Open a pipe and read VPP values
+ if ((fp = popen(cmd, "r")) == NULL) {
+ printf("Error opening pipe!\n");
+ return;
+ }
+
+ while (fgets(buf, BUFSIZE, fp) != NULL);
+ temp[i] = atoi(buf);
+
+ if(pclose(fp)) {
+ printf("Command not found or exited with error status\n");
+ return;
+ }
+ }
+
+ // Store metrics read from the vNIC in the struct passed from the main function
+ vpp_metrics->bytes_in = temp[0];
+ vpp_metrics->bytes_out = temp[1];
+ vpp_metrics->packets_in = temp[2];
+ vpp_metrics->packets_out = temp[3];
+}
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vLB/Makefile b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vLB/Makefile
new file mode 100644
index 0000000..8ecbffd
--- /dev/null
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vLB/Makefile
@@ -0,0 +1,41 @@
+
+#############################################################################
+#
+# Copyright © 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.
+#
+#############################################################################
+
+CC=gcc
+ARCH=$(shell getconf LONG_BIT)
+#CODE_ROOT=$(CURDIR)/../../..
+CODE_ROOT=../VES/evel/evel-library
+LIBS_DIR=$(CODE_ROOT)/libs/x86_$(ARCH)
+INCLUDE_DIR=$(CODE_ROOT)/code/evel_library
+
+#******************************************************************************
+# Standard compiler flags. *
+#******************************************************************************
+CPPFLAGS=
+CFLAGS=-Wall -g -fPIC
+
+all: vpp_measurement_reporter
+
+clean:
+ rm -f vpp_measurement_reporter
+
+vpp_measurement_reporter: vpp_measurement_reporter.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o vpp_measurement_reporter \
+ -L $(LIBS_DIR) \
+ -I $(INCLUDE_DIR) \
+ vpp_measurement_reporter.c -lm -lpthread -level -lcurl
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vLB/vDNS_vpp_measurement_reporter.c b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vLB/vDNS_vpp_measurement_reporter.c
new file mode 100644
index 0000000..ca6a7cd
--- /dev/null
+++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/vLB/vDNS_vpp_measurement_reporter.c
@@ -0,0 +1,376 @@
+
+/*************************************************************************//**
+ *
+ * Copyright © 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.
+ *
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/time.h>
+#include <math.h>
+
+#include "evel.h"
+
+#define BUFSIZE 128
+#define READ_INTERVAL 10
+
+typedef struct dummy_vpp_metrics_struct {
+ int bytes_in;
+ int bytes_out;
+ int packets_in;
+ int packets_out;
+} vpp_metrics_struct;
+
+void read_vpp_metrics(vpp_metrics_struct *, char *);
+
+unsigned long long epoch_start = 0;
+
+
+#ifdef DOCKER
+int measure_traffic()
+{
+
+ EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
+ FILE *fp;
+ int status;
+ char count[10];
+ time_t rawtime;
+ struct tm * timeinfo;
+ char period [21];
+ char cmd [100];
+ int concurrent_sessions = 0;
+ int configured_entities = 0;
+ double mean_request_latency = 0;
+ double measurement_interval = 1;
+ double memory_configured = 0;
+ double memory_used = 0;
+ int request_rate=0;
+ char secs [3];
+ int sec;
+ double loadavg;
+
+ printf("Checking app traffic\n");
+ time (&rawtime);
+ timeinfo = localtime (&rawtime);
+ strftime(period,21,"%d/%b/%Y:%H:%M:",timeinfo);
+ strftime(secs,3,"%S",timeinfo);
+ sec = atoi(secs);
+ if (sec == 0) sec = 59;
+ sprintf(secs, "%02d", sec);
+ strncat(period, secs, 21);
+ // ....x....1....x....2.
+ // 15/Oct/2016:17:51:19
+ strcpy(cmd, "sudo docker logs vHello | grep -c ");
+ strncat(cmd, period, 100);
+
+ fp = popen(cmd, "r");
+ if (fp == NULL) {
+ EVEL_ERROR("popen failed to execute command");
+ }
+
+ if (fgets(count, 10, fp) != NULL) {
+ request_rate = atoi(count);
+ printf("Reporting request rate for second: %s as %d\n", period, request_rate);
+
+ }
+ else {
+ EVEL_ERROR("New Measurement failed");
+ }
+ printf("Processed measurement\n");
+
+ status = pclose(fp);
+ if (status == -1) {
+ EVEL_ERROR("pclose returned an error");
+ }
+ return request_rate;
+}
+
+#endif
+
+
+
+/**************************************************************************//**
+ * tap live cpu stats
+ *****************************************************************************/
+void evel_get_cpu_stats(EVENT_MEASUREMENT * measurement)
+{
+ FILE *fp;
+ char path[1024];
+ double usage=0.0;
+ double idle;
+ double intrpt;
+ double nice;
+ double softirq;
+ double steal;
+ double sys;
+ double user;
+ double wait;
+ MEASUREMENT_CPU_USE *cpu_use = NULL;
+
+ /* Open the command for reading. */
+ //fp = popen("/bin/ls /etc/", "r");
+ fp = popen("/usr/bin/top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 ", "r");
+ if (fp == NULL) {
+ printf("Failed to run command\n" );
+ exit(1);
+ }
+
+ /* Read the output a line at a time - output it. */
+ while (fgets(path, sizeof(path)-1, fp) != NULL) {
+ printf("%s", path+10);
+ sscanf(path+10," %lf us, %lf sy, %lf ni, %lf id, %lf wa, %lf hi, %lf si, %lf st",
+ &user,&sys,&nice,&idle,&wait,&intrpt,&softirq,&steal);
+ }
+
+ /* close */
+ pclose(fp);
+
+ cpu_use = evel_measurement_new_cpu_use_add(measurement, "cpu1", usage);
+ if( cpu_use != NULL ){
+ evel_measurement_cpu_use_idle_set(cpu_use,idle);
+ //evel_measurement_cpu_use_interrupt_set(cpu_use,intrpt);
+ //evel_measurement_cpu_use_nice_set(cpu_use,nice);
+ //evel_measurement_cpu_use_softirq_set(cpu_use,softirq);
+ //evel_measurement_cpu_use_steal_set(cpu_use,steal);
+ evel_measurement_cpu_use_system_set(cpu_use,sys);
+ evel_measurement_cpu_use_usageuser_set(cpu_use,user);
+ //evel_measurement_cpu_use_wait_set(cpu_use,wait);
+ //evel_measurement_cpu_use_add(measurement, "cpu2", usage,idle,intrpt,nice,softirq,steal,sys,user,wait);
+ }
+}
+
+int main(int argc, char** argv)
+{
+ EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
+ EVENT_MEASUREMENT* vpp_m = NULL;
+ EVENT_HEADER* vpp_m_header = NULL;
+ int bytes_in_this_round;
+ int bytes_out_this_round;
+ int packets_in_this_round;
+ int packets_out_this_round;
+ vpp_metrics_struct* last_vpp_metrics = malloc(sizeof(vpp_metrics_struct));
+ vpp_metrics_struct* curr_vpp_metrics = malloc(sizeof(vpp_metrics_struct));
+ struct timeval time_val;
+ //time_t start_epoch;
+ //time_t last_epoch;
+ char hostname[BUFSIZE];
+ char* api_vmid = argv[1];
+ char* api_fqdn = argv[2];
+ int api_port = atoi(argv[3]);
+ char* api_username = argv[4];
+ char* api_password = argv[5];
+ char* vnic = argv[6];
+ MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL;
+ //struct timeval tv_start;
+
+ printf("\nVector Packet Processing (VPP) measurement collection\n");
+ fflush(stdout);
+
+ if (argc != 4)
+ {
+ fprintf(stderr, "Usage: %s <vmid> <fqdn>|<IP address> <port> <interface> <username> <password> <vnic>\n", argv[0]);
+ exit(-1);
+ }
+ srand(time(NULL));
+
+ /**************************************************************************/
+ /* Initialize */
+ /**************************************************************************/
+ if(evel_initialize(api_fqdn, /* fqdn */
+ api_port, /* port */
+ NULL, /* optional path */
+ NULL, /* optional topic */
+ 0, /* HTTPS? */
+ api_username, /* Username */
+ api_password, /* Password */
+ EVEL_SOURCE_VIRTUAL_MACHINE, /* Source type */
+ "vFirewall", /* Role */
+ 1)) /* Verbosity */
+ {
+ fprintf(stderr, "\nFailed to initialize the EVEL library!!!\n");
+ exit(-1);
+ }
+ else
+ {
+ printf("\nInitialization completed\n");
+ }
+
+ gethostname(hostname, BUFSIZE);
+ memset(last_vpp_metrics, 0, sizeof(vpp_metrics_struct));
+ read_vpp_metrics(last_vpp_metrics, vnic);
+ gettimeofday(&time_val, NULL);
+ epoch_start = time_val.tv_sec * 1000000 + time_val.tv_usec;
+ sleep(READ_INTERVAL);
+
+ /***************************************************************************/
+ /* Collect metrics from the VNIC */
+ /***************************************************************************/
+ while(1) {
+ // Read the number of vDNSs currently active
+ int active_dns = 0;
+ FILE* fd = fopen("active_dns.txt", "r");
+ while(!feof(fd)) {
+ if(fscanf(fd, "%d", &active_dns) != 1) /* Avoid infinite loops if the file doesn't contain exactly one number */
+ break;
+ }
+
+ if(fclose(fd)) {
+ printf("Error when closing file\n");
+ return 1;
+ }
+
+ memset(curr_vpp_metrics, 0, sizeof(vpp_metrics_struct));
+ read_vpp_metrics(curr_vpp_metrics, vnic);
+
+ if(active_dns > 0 && (curr_vpp_metrics->bytes_in - last_vpp_metrics->bytes_in > 0)) {
+ bytes_in_this_round = (int) round((curr_vpp_metrics->bytes_in - last_vpp_metrics->bytes_in) / active_dns);
+ }
+ else {
+ bytes_in_this_round = 0;
+ }
+ if(active_dns > 0 && (curr_vpp_metrics->bytes_out - last_vpp_metrics->bytes_out > 0)) {
+ bytes_out_this_round = (int) round((curr_vpp_metrics->bytes_out - last_vpp_metrics->bytes_out) / active_dns);
+ }
+ else {
+ bytes_out_this_round = 0;
+ }
+ if(active_dns > 0 && (curr_vpp_metrics->packets_in - last_vpp_metrics->packets_in > 0)) {
+ packets_in_this_round = (int) round((curr_vpp_metrics->packets_in - last_vpp_metrics->packets_in) / active_dns);
+ }
+ else {
+ packets_in_this_round = 0;
+ }
+ if(active_dns > 0 && (curr_vpp_metrics->packets_out - last_vpp_metrics->packets_out > 0)) {
+ packets_out_this_round = (int) round((curr_vpp_metrics->packets_out - last_vpp_metrics->packets_out) / active_dns);
+ }
+ else {
+ packets_out_this_round = 0;
+ }
+
+ vpp_m = evel_new_measurement(READ_INTERVAL);
+ vnic_performance = (MEASUREMENT_VNIC_PERFORMANCE *)evel_measurement_new_vnic_performance(vnic, "true");
+ evel_meas_vnic_performance_add(vpp_m, vnic_performance);
+
+ if(vpp_m != NULL) {
+ printf("New measurement report created...\n");
+
+ evel_measurement_type_set(vpp_m, "HTTP request rate");
+ evel_measurement_request_rate_set(vpp_m, rand()%10000);
+
+ evel_vnic_performance_rx_total_pkt_acc_set(vnic_performance, packets_in_this_round);
+ evel_vnic_performance_tx_total_pkt_acc_set(vnic_performance, packets_out_this_round);
+
+ evel_vnic_performance_rx_octets_acc_set(vnic_performance, bytes_in_this_round);
+ evel_vnic_performance_tx_octets_acc_set(vnic_performance, bytes_out_this_round);
+
+ /***************************************************************************/
+ /* Set parameters in the MEASUREMENT header packet */
+ /***************************************************************************/
+ struct timeval tv_now;
+ gettimeofday(&tv_now, NULL);
+ unsigned long long epoch_now = tv_now.tv_usec + 1000000 * tv_now.tv_sec;
+
+ //last_epoch = start_epoch + READ_INTERVAL * 1000000;
+ vpp_m_header = (EVENT_HEADER *)vpp_m;
+ //vpp_m_header->start_epoch_microsec = start_epoch;
+ //vpp_m_header->last_epoch_microsec = last_epoch;
+ evel_start_epoch_set(&vpp_m->header, epoch_start);
+ evel_last_epoch_set(&vpp_m->header, epoch_now);
+ epoch_start = epoch_now;
+
+ evel_reporting_entity_id_set(&vpp_m->header, api_vmid);
+ evel_reporting_entity_name_set(&vpp_m->header, hostname);
+ evel_rc = evel_post_event(vpp_m_header);
+
+ if(evel_rc == EVEL_SUCCESS) {
+ printf("Measurement report correctly sent to the collector!\n");
+ }
+ else {
+ printf("Post failed %d (%s)\n", evel_rc, evel_error_string());
+ }
+ }
+ else {
+ printf("New measurement report failed (%s)\n", evel_error_string());
+ }
+
+ last_vpp_metrics->bytes_in = curr_vpp_metrics->bytes_in;
+ last_vpp_metrics->bytes_out = curr_vpp_metrics->bytes_out;
+ last_vpp_metrics->packets_in = curr_vpp_metrics->packets_in;
+ last_vpp_metrics->packets_out = curr_vpp_metrics->packets_out;
+ //gettimeofday(&time_val, NULL);
+ //start_epoch = time_val.tv_sec * 1000000 + time_val.tv_usec;
+
+ sleep(READ_INTERVAL);
+ }
+
+ /***************************************************************************/
+ /* Terminate */
+ /***************************************************************************/
+ sleep(1);
+ evel_free_measurement(vpp_m);
+ free(last_vpp_metrics);
+ free(curr_vpp_metrics);
+ evel_terminate();
+ printf("Terminated\n");
+
+ return 0;
+}
+
+void read_vpp_metrics(vpp_metrics_struct *vpp_metrics, char *vnic) {
+ // Define an array of char that contains the parameters of the unix 'cut' command
+ char* params[] = {"-f3", "-f11", "-f4", "-f12"};
+ // Define the unix command to execute in order to read metrics from the vNIC
+ char* cmd_prefix = "sudo cat /proc/net/dev | grep \"";
+ char* cmd_mid = "\" | tr -s \' \' | cut -d\' \' ";
+ char cmd[BUFSIZE];
+ // Define other variables
+ char buf[BUFSIZE]; /* buffer used to store VPP metrics */
+ int temp[] = {0, 0, 0, 0}; /* temp array that contains VPP values */
+ FILE *fp; /* file descriptor to pipe cmd to shell */
+ int i;
+
+ for(i = 0; i < 4; i++) {
+ // Clear buffers
+ memset(buf, 0, BUFSIZE);
+ memset(cmd, 0, BUFSIZE);
+ // Build shell command to read metrics from the vNIC
+ strcat(cmd, cmd_prefix);
+ strcat(cmd, vnic);
+ strcat(cmd, cmd_mid);
+ strcat(cmd, params[i]);
+
+ // Open a pipe and read VPP values
+ if ((fp = popen(cmd, "r")) == NULL) {
+ printf("Error opening pipe!\n");
+ return;
+ }
+
+ while (fgets(buf, BUFSIZE, fp) != NULL);
+ temp[i] = atoi(buf);
+
+ if(pclose(fp)) {
+ printf("Command not found or exited with error status\n");
+ return;
+ }
+ }
+
+ // Store metrics read from the vNIC in the struct passed from the main function
+ vpp_metrics->bytes_in = temp[0];
+ vpp_metrics->bytes_out = temp[1];
+ vpp_metrics->packets_in = temp[2];
+ vpp_metrics->packets_out = temp[3];
+}