summaryrefslogtreecommitdiffstats
path: root/datacollector/README.md
blob: 61bbae7f765252f23c5d2de5b1ad5a49cde423e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# DataCollector R-APP

DataCollector R-APP is a Java SpringBoot application for consuming PM VES data from DMaaP and store it into DB. Also
DataCollector R-APP provides API to query aggregated metrics from PM VES data and User Equipment info.

## Use of DataCollector R-APP

### Configuration

DataCollector R-APP needs several parameters to be defined before start. All parameters are passed through environment
variables

To customize DB connection you need to create database schema. To do this use `init.sql` script under **src/main/docker/**.
Additionally, you can use `start.sh` after you build DataCollector R-APP (please see **Build DataCollector R-APP** chapter). Those actions will create database schema and run the application.
Also, you will need to set the following environment variables:

- DATABASE_URL
- DATABASE_USERNAME
- DATABASE_PASSWORD

To customize VES connectivity you need to set the following:

- DMAAP_HOST
- DMAAP_POR
- DMAAP_MEASUREMENTS_TOPIC

Example configuration in environment variables in application.yml:

```
server:
  port: 8087
dmaap:
  prtocol: "http"
  host: "localhost"
  port: 8181
  measurements-topics: 
    - "measurements"
database:
  host: mariadb-host
  port: 3306
  name: "ves"
  username: ves
  driver-class-name: "org.mariadb.jdbc.Driver"
logging:
  level:
    org:
      springframework: DEBUG
  logging.file.name: logs/rapp-datacollector.log
  pattern:
    console: "%d %-5level %logger : %msg%n"
    file: "%d %-5level [%thread] %logger : %msg%n"
spring:
  autoconfigure:
    exclude:
      - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
  main:
    allow-bean-definition-overriding: true

```

After startup DataCollector R-APP is ready to read VES Events from DMaaP and stores them in database if they are flowing
into DMaaP. DataCollector R-APP supports legacy VES event as well as Perf3gpp VES event produced by PM Mapper.

VES Event example

```json
{
  "event": {
    "commonEventHeader": {
      "version": "4.0.1",
      "vesEventListenerVersion": "7.0.1",
      "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014",
      "reportingEntityName": "ibcx0001vm002oam001",
      "startEpochMicrosec": 1603293000000000,
      "eventId": "measurement0000259",
      "lastEpochMicrosec": 1603292917149000,
      "priority": "Normal",
      "sequence": 3,
      "sourceName": "ibcx0001vm002ssc001",
      "domain": "measurement",
      "eventName": "Measurement_vIsbcMmc",
      "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234",
      "nfcNamingCode": "ssc",
      "nfNamingCode": "ibcx"
    },
    "measurementFields": {
      "measurementInterval": 5,
      "measurementFieldsVersion": "4.0",
      "additionalMeasurements": [
        {
          "name": "latency",
          "hashMap": {
            "value": "86"
          }
        },
        {
          "name": "throughput",
          "hashMap": {
            "value": "25"
          }
        },
        {
          "name": "identifier",
          "hashMap": {
            "value": "Cell1"
          }
        },
        {
          "name": "trafficModel",
          "hashMap": {
            "mobile_samsung_s10_01": "10"
          }
        }
      ]
    }
  }
}
```

Information about performance is situated in "additionalMeasurements" section, consisting of latency and throughput parameters of performance, identifier of event producer and trafficModel with user equipment information.

PM Mapper Perf3gpp VES event

```json
{
  "event":{
    "commonEventHeader":{
      "domain":"perf3gpp",
      "eventId":"ddd48497-913c-451f-a396-2316a29e5975",
      "sequence":0,
      "eventName":"perf3gpp_PE-Samsung_pmMeasResult",
      "sourceName":"someVnfName",
      "reportingEntityName":"",
      "priority":"Normal",
      "startEpochMicrosec":1626352192000,
      "lastEpochMicrosec":1626352222000,
      "version":"4.0",
      "vesEventListenerVersion":"7.1",
      "timeZoneOffset":"+02:00"
    },
    "perf3gppFields":{
      "perf3gppFieldsVersion":"1.0",
      "measDataCollection":{
        "granularityPeriod":16262192000,
        "measuredEntityUserName":"ORAN PE Sim",
        "measuredEntityDn":"",
        "measuredEntitySoftwareVersion":"",
        "measInfoList":[
          {
            "measInfoId":{
              "sMeasInfoId":""
            },
            "measTypes":{
              "sMeasTypesList":[
                "latency",
                "throughput"
              ]
            },
            "measValuesList":[
              {
                "measObjInstId":"Chn0000",
                "suspectFlag":"false",
                "measResults":[
                  {
                    "p":1,
                    "sValue":"110"
                  },
                  {
                    "p":2,
                    "sValue":"55"
                  }
                ]
              }
            ]
          },
          {
            "measInfoId":{
              "sMeasInfoId":""
            },
            "measTypes":{
              "sMeasTypesList":[
                "latency"
              ]
            },
            "measValuesList":[
              {
                "measObjInstId":"Chn0000",
                "suspectFlag":"false",
                "measResults":[
                  {
                    "p":1,
                    "sValue":"101"
                  }
                ]
              }
            ]
          },
          {
            "measInfoId":{
              "sMeasInfoId":""
            },
            "measTypes":{
              "sMeasTypesList":[
                "latency"
              ]
            },
            "measValuesList":[
              {
                "measObjInstId":"Chn0000",
                "suspectFlag":"false",
                "measResults":[
                  {
                    "p":1,
                    "sValue":"135"
                  }
                ]
              }
            ]
          },
          {
            "measInfoId":{
              "sMeasInfoId":""
            },
            "measTypes":{
              "sMeasTypesList":[
                "latency"
              ]
            },
            "measValuesList":[
              {
                "measObjInstId":"Chn0000",
                "suspectFlag":"false",
                "measResults":[
                  {
                    "p":1,
                    "sValue":"100"
                  }
                ]
              }
            ]
          }
        ]
      }
    }
  }
}
```

In this case information about performance is situated in "measDataCollection" section, consisting of latency and throughput parameters of performance, identifier of event producer and trafficModel with user equipment information.
As PM Mapper is not maintaining the exact time of each event, that times are calculated in following way: (lastEpochMicrosec - startEpochMicrosec)/ number of events.

DataCollector R-APP provides two endpoints to access data of stored VES Events:

1. `{datacollectorhost}/v1/pm/ues`

Returns list of user equipments from VES Events stored into database:

```json
{
  "ues": [
    "mobile_samsung_s10_01"
  ]
}
```

2. `{datacollectorhost}/v1/pm/events/aggregatedmetrics`

To call the endpoint you have to define 3 query parameters:

1.Slot - aggregation period (in seconds) for which an average performance metrics are calculated

2.Count - number of aggregated performance metrics that should be returned by the method, one aggergated performance
metric per each slot. The first performance metrics is average metrics for (startTime, startTime +slot)

3.startTime - ISO 8601 time format as string (e.g., 2020-10-26T06:52:54.01+00:00) for which aggregated performance
metrics are calculated with the pm ves data starting from startTime. "+" and "." signs must be properly encoded in url

Example
URL: `{{datacollectorhost}}/v1/pm/events/aggregatedmetrics?slot=10&count=12&startTime=2021-03-31T15%3A00%3A00.0Z`
This request will return aggregated metrics from two minutes starting from 2021.03.31-15:30:00.0

Aggregated Metrics response example:

```json
{
  "pm": [
    {
      "cellId": "Cell1",
      "performance": [
        {
          "latency": 50,
          "throughput": 80
        },
        {
          "latency": 50,
          "throughput": 80
        },
        {
          "latency": 50,
          "throughput": 80
        }
      ]
    }
  ],
  "itemsLength": 1
}
```

# API

The API is documented by the Swagger tool.

## Swagger

JSON file that can be imported to Swagger GUI can be found in *doc/swagger*. Those files are regenerated in each maven
build, so to generate this file please see **Build DataCollector R-APP** chapter.

# Developer Guide

## Build DataCollector R-APP

Following mvn command (in the current directory) will build DataCollector R-APP:

```bash
mvn clean install
```

## Run DataCollector R-APP

Following command will run DataCollector R-APP:

```bash
java -jar datacollector-0.0.1-SNAPSHOT.jar org.onap.rapp.DataCollectorApplication
```

## Logging

The log file will be created in the /log path. Parameters of logging are in application.yml file.
After DataCollector R-APP starts successfully, log/rapp-datacollector.log should start to contain the logs:

```
.
└──log
    └── rapp-datacollector.log
```