blob: 64edd1329dbbfb0769ad7e43790aa38bbc9125f5 [file] [log] [blame]
JvD_Ericssond1825032024-06-07 13:53:56 +01001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. SPDX-License-Identifier: CC-BY-4.0
3.. Copyright (C) 2024 Nordix Foundation. All rights Reserved
4.. Copyright (C) 2024 OpenInfra Foundation Europe. All Rights Reserved
5
6Geographical enrichment guide
7#############################
8
9Geographical Enrichment Guide Overview
10======================================
11
12In this guide, we explore how to use the Geographical Location
13Enrichment API to enrich Topology & Inventory with geographical data.
14
15Geographical enrichment
16=======================
17
18Geographical enrichment is the adding, modifying, and removing of
19geographical entities that supports geographical information.
20Geographical entities are associated to topology data. The following
21geographical entities support geographical enrichment:
22
23- Sector
24- AntennaModule
25- Site
26
27For information on the entity types and their supported relationships,
28see the :doc:`Data Models </data-models-guide>`.
29
30The format of the geographical enrichment message is CloudEvents.
31Topology & Inventory uses `CloudEvents
32Kafka® <https://cloudevents.github.io/sdk-java/kafka.html>`__ version
332.5.x. The link provides a sample CloudEvents implementation in Java®.
34CloudEvents SDKs also supports other languages. See
35`CloudEvents <https://cloudevents.io/>`__.
36
37The data element consists of the actual topology and inventory data.
38It contains all the geographical entities and their associated
39relationships in application/json format, and each entity and
40relationships are represented in application/yang-data+json format.
41
42CloudEvents attributes are validated against the :doc:`Data Models
43</data-models-guide>`. If there
44is an unknown attribute in the CloudEvents, Topology & Inventory does
45not drop the whole event but parses and persists only valid attributes,
46and unknown parts are logged and ignored. If an empty or bad payload is
47sent, the data is not persisted.
48
49The value of non-mandatory fields can be deleted by sending a merge
50request to set it to null. Null means that the value is not set.
51
52Example of enrich Topology & Inventory with geographical data
53-------------------------------------------------------------
54
55This example creates a new topology Site entity and a relationship
56between the Site and an AntennaModule. Using the
57:ref:`create schema <Ingestion Create>`
58the data producer can create entities that support geographical
59enrichment. Attributes with null means not set.
60
61.. code:: json
62
63 {
64 "ce_specversion": "1.0",
65 "ce_id": "a30e63c9-d29e-46ff-b99a-b63ed83fd233",
66 "ce_source": "dmi-plugin:nm-1",
67 "ce_type": "topology-inventory-ingestion-create",
68 "ce_time": "2023-06-12T09:05:00Z",
69 "content-type": "application/json",
70 "ce_dataschema": "topology-inventory-ingestion:events:create:1.0.0",
71 "data": {
72 "entities": [
73 {
74 "o-ran-smo-teiv-equipment:Site": [
75 {
76 "id": "urn:o-ran:smo:teiv:sha512:Site=1F137533843657E9E9DBE60DBD86B045A057DB6D04B6A07AC153",
77 "attributes": {
78 "name": "Dublin",
79 "location": {
80 "geo-location": {
81 "latitude": 41.73297,
82 "longitude": -73.007696
83 }
84 }
85 }
86 }
87 ]
88 },
89 {
90 "o-ran-smo-teiv-equipment:AntennaModule": [
91 {
92 "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=1FEBF137533843657E9E9DBE60DBD86B045A057DB6D04B6A07AC15323F1906228E93CFA4A1DB37D50252B3AFE6AEC9860E2CEA4A77BB3A25C9EA45DEDA87E765",
93 "attributes": {
94 "geo-location": {
95 "latitude": 41.73297,
96 "longitude": -73.007696
97 }
98 }
99 }
100 ]
101 }
102 ],
103 "relationships": [
104 {
105 "o-ran-smo-teiv-equipment:ANTENNAMODULE_INSTALLED_AT_SITE": [
106 {
107 "id": "urn:o-ran:smo:teiv:sha512:ANTENNAMODULE_INSTALLED_AT_SITE=TlJDZWxsRFU6U3ViTmV0d29yaz1FdXJvcGUsU3ViTmV0d29yaz1JcmVs=",
108 "aSide": "urn:o-ran:smo:teiv:sha512:AntennaModule=1FEBF137533843657E9E9DBE60DBD86B045A057DB6D04B6A07AC15323F1906228E93CFA4A1DB37D50252B3AFE6AEC9860E2CEA4A77BB3A25C9EA45DEDA87E765",
109 "bSide": "urn:o-ran:smo:teiv:sha512:Site=1F137533843657E9E9DBE60DBD86B045A057DB6D04B6A07AC153"
110 }
111 ]
112 }
113 ]
114 }
115 }
116
117Example of modify enriched Topology & Inventory with geographical data
118----------------------------------------------------------------------
119
120This example updates an existing Site entity. Using the
121:ref:`merge schema <Ingestion Merge>`
122the data producer can update entities that support geographical
123enrichment.
124
125.. code:: json
126
127
128 {
129 "ce_specversion": "1.0",
130 "ce_id": "a30e63c9-d29e-46ff-b99a-b63ed83fd234",
131 "ce_source": "dmi-plugin:nm-1",
132 "ce_type": "topology-inventory-ingestion-merge",
133 "ce_time": "2023-06-12T09:05:00Z",
134 "content-type": "application/json",
135 "ce_dataschema": "topology-inventory-ingestion:events:merge:1.0.0",
136 "data": {
137 "entities": [
138 {
139 "o-ran-smo-teiv-equipment:Site": [
140 {
141 "id": "urn:o-ran:smo:teiv:sha512:Site=1F137533843657E9E9DBE60DBD86B045A057DB6D04B6A07AC153",
142 "attributes": {
143 "name": "Dublin",
144 "location": {
145 "geo-location": {
146 "latitude": 52.73297,
147 "longitude": -84.007696
148 }
149 }
150 }
151 }
152 ]
153 },
154 {
155 "o-ran-smo-teiv-equipment:AntennaModule": [
156 {
157 "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=1FEBF137533843657E9E9DBE60DBD86B045A057DB6D04B6A07AC15323F1906228E93CFA4A1DB37D50252B3AFE6AEC9860E2CEA4A77BB3A25C9EA45DEDA87E765",
158 "attributes": {
159 "geo-location": {
160 "latitude": 52.73297,
161 "longitude": -84.007696
162 }
163 }
164 }
165 ]
166 }
167 ],
168 "relationships": [
169 {
170 "o-ran-smo-teiv-equipment:ANTENNAMODULE_INSTALLED_AT_SITE": [
171 {
172 "id": "urn:o-ran:smo:teiv:sha512:ANTENNAMODULE_INSTALLED_AT_SITE=TlJDZWxsRFU6U3ViTmV0d29yaz1FdXJvcGUsU3ViTmV0d29yaz1JcmVs=",
173 "aSide": "urn:o-ran:smo:teiv:sha512:AntennaModule=1FEBF137533843657E9E9DBE60DBD86B045A057DB6D04B6A07AC15323F1906228E93CFA4A1DB37D50252B3AFE6AEC9860E2CEA4A77BB3A25C9EA45DEDA87E765",
174 "bSide": "urn:o-ran:smo:teiv:sha512:Site=1F137533843657E9E9DBE60DBD86B045A057DB6D04B6A07AC153"
175 }
176 ]
177 }
178 ]
179 }
180 }
181
182Example of delete enriched data from Topology & Inventory
183---------------------------------------------------------
184
185This example deletes a topology Site entity and its relationship to an
186AntennaModule entity. Using the
187:ref:`delete schema <Ingestion Delete>`
188the data producer can delete entities that support geographical
189enrichment.
190
191.. code:: json
192
193 {
194 "ce_specversion": "1.0",
195 "ce_id": "a30e63c9-d29e-46ff-b99a-b63ed83fd235",
196 "ce_source": "dmi-plugin:nm-1",
197 "ce_type": "topology-inventory-ingestion-delete",
198 "ce_time": "2023-06-12T09:05:00Z",
199 "content-type": "application/json",
200 "ce_dataschema": "topology-inventory-ingestion:events:delete:1.0.0",
201 "data": {
202 "entities" : [
203 {
204 "o-ran-smo-teiv-equipment:Site": [
205 {
206 "id": "urn:o-ran:smo:teiv:sha512:Site=1F137533843657E9E9DBE60DBD86B045A057DB6D04B6A07AC153"
207 }
208 ]
209 }
210 ],
211 "relationships": [
212 {
213 "o-ran-smo-teiv-equipment:ANTENNAMODULE_INSTALLED_AT_SITE": [
214 {
215 "id" : "urn:o-ran:smo:teiv:sha512:ANTENNAMODULE_INSTALLED_AT_SITE=TlJDZWxsRFU6U3ViTmV0d29yaz1FdXJvcGUsU3ViTmV0d29yaz1JcmVs="
216 }
217 ]
218 }
219 ]
220 }
221 }
222
223How to create and produce an event
224==================================
225
226To create and produce an event, you can use the `CloudEventBuilder.v1
227and
228KafkaProducer <https://cloudevents.github.io/sdk-java/kafka.html>`__.
229The link provides a sample CloudEvents implementation in Java.
230CloudEvents SDKs also supports other languages. See
231`CloudEvents <https://cloudevents.io/>`__.
232
233Troubleshooting
234===============
235
236If CloudEvents were sent but no data was persisted, check validation
237failures and logs. Update the CloudEvent based on the logs and send it again.