blob: d2a6854a6c8c60cf98b23f7e9256be25ddff8bd8 [file] [log] [blame]
Michal Banka9a7a9312020-08-24 11:01:56 +02001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
3
4StndDefined Events Collection Mechanism
5=======================================
6
7Description
8-----------
9
Michal Banka968aa6e2020-09-22 08:56:41 +020010The target of that development was to allow collection of events defined by standards organizations using VES Collector,
11and providing them for consumption by analytics applications running on top of DCAE platform. The following features
12have been implemented:
Michal Banka9a7a9312020-08-24 11:01:56 +020013
Michal Banka968aa6e2020-09-22 08:56:41 +020014- Event routing, based on a new CommonHeader field "stndDefinedNamespace"
15- Standards-organization defined events can be included using a dedicated stndDefinedFields.data property
16- Standards-defined events can be validated using openAPI descriptions provided by standards organizations, and indicated in stndDefinedFields.schemaReference
Michal Banka9a7a9312020-08-24 11:01:56 +020017
18StndDefined properties
19----------------------
20
21There are 5 additional properties related to stndDefined validation in collector.properties file.
22
Michal Banka968aa6e2020-09-22 08:56:41 +020023+----------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
24| Name | Description | Example |
25+==============================================+================================================================================+======================================================================================================+
26| collector.externalSchema.checkflag | Flag is responsible for turning on/off stndDefined data validation. | -1 or 1 |
27| | By default this flag is set to 1, which means that the validation is enabled. | |
28| | In case flag is set to -1, validation is disabled. | |
29+----------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
30| collector.externalSchema.mappingFileLocation | This should be a local filesystem path to file with mappings of public URLs | /opt/app/VESCollector/etc/externalRepo/schema-map.json |
31| | to local URLs. | |
32+----------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
33| collector.externalSchema.schemasLocation | Schemas location is a directory context for localURL paths set in mapping file.| /opt/app/VESCollector/etc/externalRepo/ , |
34| | Result path of schema is collector.externalSchema.schemasLocation + localURL. | when first mapping from example mapping file below this table is taken, validator will look for |
35| | This path is not related to mapping file path and may point to any location. | schema under the path: |
36| | | /opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml |
37+----------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
38| event.externalSchema.schemaRefPath | This is an internal path from validated JSON. It should define which field | $.event.stndDefinedFields.schemaReference |
39| | will be taken as public schema reference, which is later mapped. | |
40+----------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
41| event.externalSchema.stndDefinedDataPath | This is internal path from validated JSON. | $.event.stndDefinedFields.data |
42| | It should define which field will be validated. | |
43+----------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
Michal Banka9a7a9312020-08-24 11:01:56 +020044
45Format of the schema mapping file is a JSON file with list of mappings, as shown in the example below.
46
47.. code-block:: json
48
49 [
Michal Banka7f248622020-09-09 16:38:37 +020050 {
51 "publicURL": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/faultMnS.yaml",
52 "localURL": "3gpp/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml"
53 },
54 {
55 "publicURL": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/heartbeatNtf.yaml",
56 "localURL": "3gpp/rep/sa5/data-models/blob/REL-16/OpenAPI/heartbeatNtf.yaml"
57 },
58 {
59 "publicURL": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/PerDataFileReportMnS.yaml",
60 "localURL": "3gpp/rep/sa5/data-models/blob/REL-16/OpenAPI/PerDataFileReportMnS.yaml"
61 },
62 {
63 "publicURL": "https://forge.3gpp.org/rep/sa5/data-models/tree/SA88-Rel16/OpenAPI/provMnS.yaml",
64 "localURL": "3gpp/rep/sa5/data-models/blob/REL-16/OpenAPI/provMnS.yaml"
65 }
Michal Banka9a7a9312020-08-24 11:01:56 +020066 ]
67
Michal Banka968aa6e2020-09-22 08:56:41 +020068Properties configuration via Cloudify
69-------------------------------------
Michal Banka7f248622020-09-09 16:38:37 +020070
Michal Banka968aa6e2020-09-22 08:56:41 +020071Collector.properties content may be overridden when deploying VES Collector via Cloudify. To keep VES settings
72consistent listed above properties has been updated in the VES Collector Cloudify blueprint (in blueprints/k8s-ves.yaml
73file under dcaegen2/platform/blueprints project) and in componentspec file (in dpo/spec/vescollector-componentspec.json
74file in VES project) which may be used for generation of VES Collector Cloudify blueprints in some scenarios.
75
76The following table shows new stndDefined related properties added to VES Collector Cloudify blueprint. These properties
77represent fields from collector.properties file, but also contain configuration of DMaaP topic URLs used for stndDefined
78events routing. It has been specified in the table which of these properties may be configured via inputs during
79blueprint deployment.
80
81**NOTE**: Keep in mind that some properties may use relative path. It is relative to default VES Collector context which
82is: */opt/app/VESCollector/*. Final path of etc. *collector.externalSchema.schemasLocation* will be:
83*/opt/app/VESCollector/etc/externalRepo/*. Setting absolute path to these properties is also acceptable and won't
84generate error.
85
86+----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
87| Property name | Input? | Type | Default value |
88+==============================================+========+=========+===============================================================================================================+
89| collector.externalSchema.checkflag | Yes | Integer | 1 |
90+----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
91| collector.externalSchema.mappingFileLocation | Yes | String | ./etc/externalRepo/schema-map.json |
92+----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
93| collector.externalSchema.schemasLocation | Yes | String | ./etc/externalRepo/ |
94+----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
95| event.externalSchema.schemaRefPath | No | String | $.event.stndDefinedFields.schemaReference |
96+----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
97| event.externalSchema.stndDefinedDataPath | No | String | $.event.stndDefinedFields.data |
98+----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
99| ves_3gpp_fault_supervision_publish_url | Yes | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_FAULTSUPERVISION_OUTPUT |
100+----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
101| ves_3gpp_provisioning_publish_url | Yes | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_PROVISIONING_OUTPUT |
102+----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
103| ves_3gpp_hearbeat_publish_url | Yes | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_HEARTBEAT_OUTPUT |
104+----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
105| ves_3gpp_performance_assurance_publish_url | Yes | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_PERFORMANCEASSURANCE_OUTPUT |
106+----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
107
108Validation overview
109-------------------
110
111This mechanism can be used to validate any JSON content incoming as JsonNode using OpenAPI standardized schemas.
112During validation externally located schemas are mapped to local schema files.
113
114Validated JSON must have one field that will refer to an external schema, which will be mapped to local file and then
115validation of any chosen part of JSON is executed using local schema.
116
117StndDefined validation is integrated with the event collecting functionality available under the endpoint
118*/eventListener/v7*. Process of event collecting includes steps in the following order:
119
1201. General event validation (1st stage validation)
1212. Event transformation
1223. **StndDefined event validation** (2nd stage validation)
1234. Event routing to DMaaP
124
125Mapping file is cached on stndDefined validator creation, so it's not read every time validation is performed.
126Schemas' content couldn't be cached due to an external library restrictions (OpenAPI4j).
127
128The value of the 'stndDefinedNamespace' field in any incoming stndDefined JSON event is used to match the topic from
129property *collector.dmaap.streamid*.
Michal Banka9a7a9312020-08-24 11:01:56 +0200130
131Requirements for stndDefined validation
132---------------------------------------
133
134To run stndDefined validation, both *collector.schema.checkflag* and *collector.externalSchema.checkflag* must be set to 1.
135
136Despite the flag set, the validation will not start when:
137
138- Domain of the incoming event is not 'stndDefined'.
139- General event validation (1st stage) failed.
140- Field of event referenced under the property *event.externalSchema.schemaRefPath* (by default */event/stndDefinedFields/schemaReference*):
141 - Has an empty value.
142 - Does not exist in the incoming event.
143
144Validation scenarios
145--------------------
146
147Positive scenario, which returns 202 Accepted HTTP code after successful stndDefined validation:
148
149- *collector.schema.checkflag* and *collector.externalSchema.checkflag* is set to 1
150- Mapping file has valid format
151- Schema file mapped from referenced in the event is valid
152- The incoming event is valid against schema
153
154Below are scenarios when, the stndDefined validation will end with failure and return 400 Bad Request HTTP code:
155
156- One of stndDefined data fields has wrong type or value
157- StndDefined data has an empty body or is missing required field
158- Field of event referenced under the property event.externalSchema.schemaRefPath has publicURL which is not mapped in the schemas mappings
159- Field defining public schema in event (by default */event/stndDefinedFields/schemaReference*) after "#" has non existing reference in schema file
160
Michal Banka968aa6e2020-09-22 08:56:41 +0200161Schema repository description
162-----------------------------
Michal Banka9a7a9312020-08-24 11:01:56 +0200163
164Schemas and mapping file location might be configured to any local directory through properties in collector.properties
165as described in 'StndDefined properties' section.
166
Michal Banka968aa6e2020-09-22 08:56:41 +0200167By default schemas repository is located under */opt/app/VESCollector/etc/externalSchema* directory, as well as schemas mapping file called
168*schema-map.json*. Every organisation which adds or mounts external schemas should store them in folder named by
169organisation name. Further folders structure may be whatever as long as schemas are correctly referenced in the mapping
170file.
Michal Banka9a7a9312020-08-24 11:01:56 +0200171
Michal Banka968aa6e2020-09-22 08:56:41 +0200172Sample directory tree of */opt/app/VESCollector/etc* directory:
Michal Banka9a7a9312020-08-24 11:01:56 +0200173
174.. code-block:: text
175
Michal Banka968aa6e2020-09-22 08:56:41 +0200176 /opt/app/VESCollector/etc
Michal Banka9a7a9312020-08-24 11:01:56 +0200177 ├── ...
178 └── externalRepo
179 ├── schema-map.json
180 └── 3gpp
181 └── rep
182 └── sa5
183 └── data-models
Michal Banka968aa6e2020-09-22 08:56:41 +0200184 └── tree
185 └── SA88-Rel16
Michal Banka9a7a9312020-08-24 11:01:56 +0200186 └── OpenAPI
187 ├── faultMnS.yaml
188 ├── heartbeatNtf.yaml
189 ├── PerDataFileReportMnS.yaml
190 └── provMnS.yaml
191
192Routing of stndDefined domain events
193------------------------------------
194
Michal Banka968aa6e2020-09-22 08:56:41 +0200195All events, except those with 'stndDefined' domain, are routed to DMaaP topics based on domain value. Events with
Michal Banka9a7a9312020-08-24 11:01:56 +0200196'stndDefined' domain are sent to proper topic basing on field 'stndDefinedNamespace'.
197
198This is the only difference from standard event routing, specific for 'stndDefined' domain. As in every other event
199routing value is being mapped for specific DMaaP stream. Stream ID to DMaaP channels mappings are located in
Michal Banka968aa6e2020-09-22 08:56:41 +0200200*/opt/app/VESCollector/etc/collector.properties* file under property *collector.dmaap.streamid*. Channels descriptions are in
201*/opt/app/VESCollector/etc/DmaapConfig.json*, where destination DMaaP topics are selected.
Michal Banka9a7a9312020-08-24 11:01:56 +0200202
203With stndDefined domain managment 4 new mappings were added. Their routing has been described in the table below:
204
205 +---------------------------+--------------------------------+------------------------------------------------------+
206 | Stream ID | Channel | DMaaP Stream |
207 +===========================+================================+======================================================+
208 | 3GPP-FaultSupervision | ves-3gpp-fault-supervision | unauthenticated.SEC_3GPP_FAULTSUPERVISION_OUTPUT |
209 +---------------------------+--------------------------------+------------------------------------------------------+
210 | 3GPP-Heartbeat | ves-3gpp-heartbeat | unauthenticated.SEC_3GPP_HEARTBEAT_OUTPUT |
211 +---------------------------+--------------------------------+------------------------------------------------------+
212 | 3GPP-Provisioning | ves-3gpp-provisioning | unauthenticated.SEC_3GPP_PROVISIONING_OUTPUT |
213 +---------------------------+--------------------------------+------------------------------------------------------+
214 | 3GPP-PerformanceAssurance | ves-3gpp-performance-assurance | unauthenticated.SEC_3GPP_PERFORMANCEASSURANCE_OUTPUT |
215 +---------------------------+--------------------------------+------------------------------------------------------+
216
217
218Error scenarios behaviour
219-------------------------
220
221There are few error scenarios described in 'Validation scenarios' section. This section will describe user point of view
222of VES Collector behaviour when they happen. Messages returned as HTTP response contain data described below for each
223scenario.
224
2251. StndDefined fields validation related errors
226
2271.1. Schema file referred under the path from property *event.externalSchema.schemaRefPath* (by default */event/stndDefinedFields/schemaReference*) not present in the schema repository.
228
229 +---------------------+------------------------------------------------------------------+
230 | Property Name | Property Description |
231 +=====================+==================================================================+
232 | MessageId | SVC2004 |
233 +---------------------+------------------------------------------------------------------+
234 | Text | "Invalid input value for %1 %2: %3" |
235 +---------------------+------------------------------------------------------------------+
236 | Variables | %1 – “attribute” |
237 | | %2 – "event.stndDefinedFields.schemaReference" |
238 | | %3 – "Referred external schema not present in schema repository" |
239 +---------------------+------------------------------------------------------------------+
240 | HTTP status code(s) | 400 Bad request |
241 +---------------------+------------------------------------------------------------------+
242
2431.2. File referred under the path from property *event.externalSchema.schemaRefPath* (by default */event/stndDefinedFields/schemaReference*) exists, but internal reference (part of URL after #) is incorrect.
244
245 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------+
246 | Property Name | Property Description |
247 +=====================+===================================================================================================================================+
248 | MessageId | SVC2000 |
249 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------+
250 | Text | The following service error occurred: %1. Error code is %2 |
251 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------+
252 | Variables | %1 - "event.stndDefinedFields.schemaReference value does not correspond to any external event schema file in externalSchema repo" |
253 | | %2 - "400" |
254 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------+
255 | HTTP status code(s) | 400 Bad request |
256 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------+
257
2581.3. StndDefined validation executed, but event contents do not validate with referenced schema.
259
260 +---------------------+---------------------------------------------------------------------------------------------+
261 | Property Name | Property Description |
262 +=====================+=============================================================================================+
263 | MessageId | SVC2000 |
264 +---------------------+---------------------------------------------------------------------------------------------+
265 | Text | The following service error occurred: %1. Error code is %2 |
266 +---------------------+---------------------------------------------------------------------------------------------+
267 | Variables | %1 - "event.stndDefinedFields.data invalid against event.stndDefinedFields.schemaReference" |
268 | | %2 - "400" |
269 +---------------------+---------------------------------------------------------------------------------------------+
270 | HTTP status code(s) | 400 Bad request |
271 +---------------------+---------------------------------------------------------------------------------------------+
272
2732. Problems with routing of stndDefined domain.
274
2752.1. StndDefinedNamespace field not received in the incoming event.
276
277 +---------------------+-----------------------------------------------------+
278 | Property Name | Property Description |
279 +=====================+=====================================================+
280 | MessageId | SVC2006 |
281 +---------------------+-----------------------------------------------------+
282 | Text | Mandatory input %1 %2 is missing from request |
283 +---------------------+-----------------------------------------------------+
284 | Variables | %1 – “attribute” |
285 | | %2 – "event.commonEventHeader.stndDefinedNamespace" |
286 +---------------------+-----------------------------------------------------+
287 | HTTP status code(s) | 400 Bad Request |
288 +---------------------+-----------------------------------------------------+
289
2902.2. StndDefinedNamespace field present, but value is empty.
291
292 +---------------------+-----------------------------------------------------+
293 | Property Name | Property Description |
294 +=====================+=====================================================+
295 | MessageId | SVC2006 |
296 +---------------------+-----------------------------------------------------+
297 | Text | Mandatory input %1 %2 is empty in request |
298 +---------------------+-----------------------------------------------------+
299 | Variables | %1 – “attribute” |
300 | | %2 – "event.commonEventHeader.stndDefinedNamespace" |
301 +---------------------+-----------------------------------------------------+
302 | HTTP status code(s) | 400 Bad Request |
303 +---------------------+-----------------------------------------------------+
304
3052.3. StndDefinedNamespace field present, but value doesn't match any stream ID mapping.
306
307 +---------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
308 | Property Name | Property Description |
309 +=====================+===========================================================================================================================================+
310 | MessageId | SVC2004 |
311 +---------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
312 | Text | "Invalid input value for %1 %2: %3" |
313 +---------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
314 | Variables | %1 – “attribute” |
315 | | %2 – "event.commonEventHeader.stndDefinedNamespace" |
316 | | %3 – "stndDefinedNamespace received not present in VES Collector routing configuration. Unable to route event to appropriate DMaaP topic" |
317 +---------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
318 | HTTP status code(s) | 400 Bad request |
319 +---------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
320
321
322