1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
4 StndDefined Events Collection Mechanism
5 =======================================
10 The target of that development was to allow collection of events defined by standards organizations using VES Collector,
11 and providing them for consumption by analytics applications running on top of DCAE platform. The following features
12 have been implemented:
14 - 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
18 StndDefined properties
19 ----------------------
21 There are 5 additional properties related to stndDefined validation in collector.properties file.
23 +----------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
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 +----------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
45 Format of the schema mapping file is a JSON file with list of mappings, as shown in the example below.
51 "publicURL": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml",
52 "localURL": "3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml"
55 "publicURL": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/heartbeatNtf.yaml",
56 "localURL": "3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/heartbeatNtf.yaml"
59 "publicURL": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/PerDataFileReportMnS.yaml",
60 "localURL": "3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/PerDataFileReportMnS.yaml"
63 "publicURL": "https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/provMnS.yaml",
64 "localURL": "3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/provMnS.yaml"
68 External schema config maps
69 ---------------------------
71 The mapping and schema files content can be changed by editing a proper config map.
74 +----------------------------------------------+-----------------------------------------------------------------------------------------------------+
75 | Config map name | Description |
76 +==============================================+=====================================================================================================+
77 | dcae-external-repo-configmap-schema-map | Defines a content of the /opt/app/VESCollector/etc/externalRepo/schema-map.json file. |
78 +----------------------------------------------+-----------------------------------------------------------------------------------------------------+
79 | dcae-external-repo-configmap-sa88-rel16 | Defines a content of schemas stored in the /opt/app/VESCollector/etc/externalRepo folder. |
80 +----------------------------------------------+-----------------------------------------------------------------------------------------------------+
82 Config maps are defined in the `OOM <https://gerrit.onap.org/r/gitweb?p=oom.git;a=tree;f=kubernetes/dcaegen2-services/resources/external>`_ repository
83 and are installed with dcaegen2-services module.
85 Properties configuration via Cloudify
86 -------------------------------------
88 Collector.properties content may be overridden when deploying VES Collector via Cloudify. To keep VES settings
89 consistent listed above properties has been updated in the VES Collector Cloudify blueprint (in blueprints/k8s-ves.yaml
90 file under dcaegen2/platform/blueprints project) and in componentspec file (in dpo/spec/vescollector-componentspec.json
91 file in VES project) which may be used for generation of VES Collector Cloudify blueprints in some scenarios.
93 The following table shows new stndDefined related properties added to VES Collector Cloudify blueprint. These properties
94 represent fields from collector.properties file, but also contain configuration of DMaaP topic URLs used for stndDefined
95 events routing. It has been specified in the table which of these properties may be configured via inputs during
98 **NOTE**: Keep in mind that some properties may use relative path. It is relative to default VES Collector context which
99 is: */opt/app/VESCollector/*. Final path of etc. *collector.externalSchema.schemasLocation* will be:
100 */opt/app/VESCollector/etc/externalRepo/*. Setting absolute path to these properties is also acceptable and won't
103 +----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
104 | Property name | Input? | Type | Default value |
105 +==============================================+========+=========+===============================================================================================================+
106 | collector.externalSchema.checkflag | Yes | Integer | 1 |
107 +----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
108 | collector.externalSchema.mappingFileLocation | Yes | String | ./etc/externalRepo/schema-map.json |
109 +----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
110 | collector.externalSchema.schemasLocation | Yes | String | ./etc/externalRepo/ |
111 +----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
112 | event.externalSchema.schemaRefPath | No | String | $.event.stndDefinedFields.schemaReference |
113 +----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
114 | event.externalSchema.stndDefinedDataPath | No | String | $.event.stndDefinedFields.data |
115 +----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
116 | ves_3gpp_fault_supervision_publish_url | Yes | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_FAULTSUPERVISION_OUTPUT |
117 +----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
118 | ves_3gpp_provisioning_publish_url | Yes | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_PROVISIONING_OUTPUT |
119 +----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
120 | ves_3gpp_hearbeat_publish_url | Yes | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_HEARTBEAT_OUTPUT |
121 +----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
122 | ves_3gpp_performance_assurance_publish_url | Yes | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_PERFORMANCEASSURANCE_OUTPUT |
123 +----------------------------------------------+--------+---------+---------------------------------------------------------------------------------------------------------------+
125 Config maps with app properties via Helm
126 ----------------------------------------
128 When deploying VES collector via deacgen2-services Helm chart, application properties can be changed by editing the corresponding config map.
131 +------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
132 | Config map name | Description |
133 +======================================================+=====================================================================================================+
134 | dcae-ves-collector-application-config-configmap | Defines a content of the /app-config/application_config.yaml file. |
135 +------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
136 | dcae-ves-collector-filebeat-configmap | Defines a content of the /usr/share/filebeat/filebeat.yml file. |
137 +------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
140 Properties configuration via Helm chart overrides
141 -------------------------------------------------
143 Collector.properties content may be overridden when deploying VES Collector via Helm chart. In case of deploying VES using Helm chart,
144 a config map "dcae-ves-collector-application-config-configmap" with the application_config.yaml file is created. The application_config.yaml
145 contains properties, that override values from Collector.properties. In order to change any value, it is sufficient to edit the application_config.yaml
146 in the config map. The VES application frequently reads the configMap content and applies configuration changes.
148 The content of "dcae-ves-collector-application-config-configmap" is defined in the values.yaml of the dcae-ves-collector chart
149 and is installed with dcaegen2-services module.
151 The following table shows stndDefined related properties added to VES Collector Helm chart. These properties
152 represent fields from collector.properties file, but also contain configuration of DMaaP topic URLs used for stndDefined
155 **NOTE**: Keep in mind that some properties may use relative path. It is relative to default VES Collector context which
156 is: */opt/app/VESCollector/*. Final path of etc. *collector.externalSchema.schemasLocation* will be:
157 */opt/app/VESCollector/etc/externalRepo/*. Setting absolute path to these properties is also acceptable and won't
160 +-----------------------------------------------------------------------------+---------+---------------------------------------------------------------------------------------------------------------+
161 | Property name | Type | Default value |
162 +=============================================================================+=========+===============================================================================================================+
163 | collector.externalSchema.checkflag | Integer | 1 |
164 +-----------------------------------------------------------------------------+---------+---------------------------------------------------------------------------------------------------------------+
165 | collector.externalSchema.mappingFileLocation | String | ./etc/externalRepo/schema-map.json |
166 +-----------------------------------------------------------------------------+---------+---------------------------------------------------------------------------------------------------------------+
167 | collector.externalSchema.schemasLocation | String | ./etc/externalRepo/ |
168 +-----------------------------------------------------------------------------+---------+---------------------------------------------------------------------------------------------------------------+
169 | event.externalSchema.schemaRefPath | String | $.event.stndDefinedFields.schemaReference |
170 +-----------------------------------------------------------------------------+---------+---------------------------------------------------------------------------------------------------------------+
171 | event.externalSchema.stndDefinedDataPath | String | $.event.stndDefinedFields.data |
172 +-----------------------------------------------------------------------------+---------+---------------------------------------------------------------------------------------------------------------+
173 | streams_publishes.ves-3gpp-fault-supervision.dmaap_info.topic_url | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_FAULTSUPERVISION_OUTPUT |
174 +-----------------------------------------------------------------------------+---------+---------------------------------------------------------------------------------------------------------------+
175 | streams_publishes.ves-3gpp-provisioning.dmaap_info.topic_url | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_PROVISIONING_OUTPUT |
176 +-----------------------------------------------------------------------------+---------+---------------------------------------------------------------------------------------------------------------+
177 | streams_publishes.ves-3gpp-heartbeat.dmaap_info.topic_url | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_HEARTBEAT_OUTPUT |
178 +-----------------------------------------------------------------------------+---------+---------------------------------------------------------------------------------------------------------------+
179 | streams_publishes.ves-3gpp-performance-assurance.dmaap_info.topic_url | String | http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.SEC_3GPP_PERFORMANCEASSURANCE_OUTPUT |
180 +-----------------------------------------------------------------------------+---------+---------------------------------------------------------------------------------------------------------------+
185 This mechanism can be used to validate any JSON content incoming as JsonNode using OpenAPI standardized schemas.
186 During validation externally located schemas are mapped to local schema files.
188 Validated JSON must have one field that will refer to an external schema, which will be mapped to local file and then
189 validation of any chosen part of JSON is executed using local schema.
191 StndDefined validation is integrated with the event collecting functionality available under the endpoint
192 */eventListener/v7*. Process of event collecting includes steps in the following order:
194 1. General event validation (1st stage validation)
195 2. Event transformation
196 3. **StndDefined event validation** (2nd stage validation)
197 4. Event routing to DMaaP
199 Mapping file is cached on stndDefined validator creation, so it's not read every time validation is performed.
200 Schemas' content couldn't be cached due to an external library restrictions (OpenAPI4j).
202 The value of the 'stndDefinedNamespace' field in any incoming stndDefined JSON event is used to match the topic from
203 property *collector.dmaap.streamid*.
205 Requirements for stndDefined validation
206 ---------------------------------------
208 To run stndDefined validation, both *collector.schema.checkflag* and *collector.externalSchema.checkflag* must be set to 1.
210 Despite the flag set, the validation will not start when:
212 - Domain of the incoming event is not 'stndDefined'.
213 - General event validation (1st stage) failed.
214 - Field of event referenced under the property *event.externalSchema.schemaRefPath* (by default */event/stndDefinedFields/schemaReference*):
215 - Has an empty value.
216 - Does not exist in the incoming event.
221 Positive scenario, which returns 202 Accepted HTTP code after successful stndDefined validation:
223 - *collector.schema.checkflag* and *collector.externalSchema.checkflag* is set to 1
224 - Mapping file has valid format
225 - Schema file mapped from referenced in the event is valid
226 - The incoming event is valid against schema
228 Below are scenarios when, the stndDefined validation will end with failure and return 400 Bad Request HTTP code:
230 - One of stndDefined data fields has wrong type or value
231 - StndDefined data has an empty body or is missing required field
232 - Field of event referenced under the property event.externalSchema.schemaRefPath has publicURL which is not mapped in the schemas mappings
233 - Field defining public schema in event (by default */event/stndDefinedFields/schemaReference*) after "#" has non existing reference in schema file
235 Schema repository description
236 -----------------------------
238 Schemas and mapping file location might be configured to any local directory through properties in collector.properties
239 as described in 'StndDefined properties' section.
241 By default schemas repository is located under */opt/app/VESCollector/etc/externalSchema* directory, as well as schemas mapping file called
242 *schema-map.json*. Every organisation which adds or mounts external schemas should store them in folder named by
243 organisation name. Further folders structure may be whatever as long as schemas are correctly referenced in the mapping
246 Sample directory tree of */opt/app/VESCollector/etc* directory:
250 /opt/app/VESCollector/etc
262 ├── heartbeatNtf.yaml
263 ├── PerDataFileReportMnS.yaml
266 Routing of stndDefined domain events
267 ------------------------------------
269 All events, except those with 'stndDefined' domain, are routed to DMaaP topics based on domain value. Events with
270 'stndDefined' domain are sent to proper topic basing on field 'stndDefinedNamespace'.
272 This is the only difference from standard event routing, specific for 'stndDefined' domain. As in every other event
273 routing value is being mapped for specific DMaaP stream. Stream ID to DMaaP channels mappings are located in
274 */opt/app/VESCollector/etc/collector.properties* file under property *collector.dmaap.streamid*. Channels descriptions are in
275 */opt/app/VESCollector/etc/DmaapConfig.json*, where destination DMaaP topics are selected.
277 With stndDefined domain managment 4 new mappings were added. Their routing has been described in the table below:
279 +---------------------------+--------------------------------+------------------------------------------------------+
280 | Stream ID | Channel | DMaaP Stream |
281 +===========================+================================+======================================================+
282 | 3GPP-FaultSupervision | ves-3gpp-fault-supervision | unauthenticated.SEC_3GPP_FAULTSUPERVISION_OUTPUT |
283 +---------------------------+--------------------------------+------------------------------------------------------+
284 | 3GPP-Heartbeat | ves-3gpp-heartbeat | unauthenticated.SEC_3GPP_HEARTBEAT_OUTPUT |
285 +---------------------------+--------------------------------+------------------------------------------------------+
286 | 3GPP-Provisioning | ves-3gpp-provisioning | unauthenticated.SEC_3GPP_PROVISIONING_OUTPUT |
287 +---------------------------+--------------------------------+------------------------------------------------------+
288 | 3GPP-PerformanceAssurance | ves-3gpp-performance-assurance | unauthenticated.SEC_3GPP_PERFORMANCEASSURANCE_OUTPUT |
289 +---------------------------+--------------------------------+------------------------------------------------------+
292 Error scenarios behaviour
293 -------------------------
295 There are few error scenarios described in 'Validation scenarios' section. This section will describe user point of view
296 of VES Collector behaviour when they happen. Messages returned as HTTP response contain data described below for each
299 1. StndDefined fields validation related errors
301 1.1. Schema file referred under the path from property *event.externalSchema.schemaRefPath* (by default */event/stndDefinedFields/schemaReference*) not present in the schema repository.
303 +---------------------+------------------------------------------------------------------+
304 | Property Name | Property Description |
305 +=====================+==================================================================+
306 | MessageId | SVC2004 |
307 +---------------------+------------------------------------------------------------------+
308 | Text | "Invalid input value for %1 %2: %3" |
309 +---------------------+------------------------------------------------------------------+
310 | Variables | %1 – “attribute” |
311 | | %2 – "event.stndDefinedFields.schemaReference" |
312 | | %3 – "Referred external schema not present in schema repository" |
313 +---------------------+------------------------------------------------------------------+
314 | HTTP status code(s) | 400 Bad request |
315 +---------------------+------------------------------------------------------------------+
317 1.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.
319 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------+
320 | Property Name | Property Description |
321 +=====================+===================================================================================================================================+
322 | MessageId | SVC2000 |
323 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------+
324 | Text | The following service error occurred: %1. Error code is %2 |
325 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------+
326 | Variables | %1 - "event.stndDefinedFields.schemaReference value does not correspond to any external event schema file in externalSchema repo" |
328 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------+
329 | HTTP status code(s) | 400 Bad request |
330 +---------------------+-----------------------------------------------------------------------------------------------------------------------------------+
332 1.3. StndDefined validation executed, but event contents do not validate with referenced schema.
334 +---------------------+---------------------------------------------------------------------------------------------+
335 | Property Name | Property Description |
336 +=====================+=============================================================================================+
337 | MessageId | SVC2000 |
338 +---------------------+---------------------------------------------------------------------------------------------+
339 | Text | The following service error occurred: %1. Error code is %2 |
340 +---------------------+---------------------------------------------------------------------------------------------+
341 | Variables | %1 - "event.stndDefinedFields.data invalid against event.stndDefinedFields.schemaReference" |
343 +---------------------+---------------------------------------------------------------------------------------------+
344 | HTTP status code(s) | 400 Bad request |
345 +---------------------+---------------------------------------------------------------------------------------------+
347 2. Problems with routing of stndDefined domain.
349 2.1. StndDefinedNamespace field not received in the incoming event.
351 +---------------------+-----------------------------------------------------+
352 | Property Name | Property Description |
353 +=====================+=====================================================+
354 | MessageId | SVC2006 |
355 +---------------------+-----------------------------------------------------+
356 | Text | Mandatory input %1 %2 is missing from request |
357 +---------------------+-----------------------------------------------------+
358 | Variables | %1 – “attribute” |
359 | | %2 – "event.commonEventHeader.stndDefinedNamespace" |
360 +---------------------+-----------------------------------------------------+
361 | HTTP status code(s) | 400 Bad Request |
362 +---------------------+-----------------------------------------------------+
364 2.2. StndDefinedNamespace field present, but value is empty.
366 +---------------------+-----------------------------------------------------+
367 | Property Name | Property Description |
368 +=====================+=====================================================+
369 | MessageId | SVC2006 |
370 +---------------------+-----------------------------------------------------+
371 | Text | Mandatory input %1 %2 is empty in request |
372 +---------------------+-----------------------------------------------------+
373 | Variables | %1 – “attribute” |
374 | | %2 – "event.commonEventHeader.stndDefinedNamespace" |
375 +---------------------+-----------------------------------------------------+
376 | HTTP status code(s) | 400 Bad Request |
377 +---------------------+-----------------------------------------------------+
379 2.3. StndDefinedNamespace field present, but value doesn't match any stream ID mapping.
381 +---------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
382 | Property Name | Property Description |
383 +=====================+===========================================================================================================================================+
384 | MessageId | SVC2004 |
385 +---------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
386 | Text | "Invalid input value for %1 %2: %3" |
387 +---------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
388 | Variables | %1 – “attribute” |
389 | | %2 – "event.commonEventHeader.stndDefinedNamespace" |
390 | | %3 – "stndDefinedNamespace received not present in VES Collector routing configuration. Unable to route event to appropriate DMaaP topic" |
391 +---------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
392 | HTTP status code(s) | 400 Bad request |
393 +---------------------+-------------------------------------------------------------------------------------------------------------------------------------------+