JvD_Ericsson | d182503 | 2024-06-07 13:53:56 +0100 | [diff] [blame] | 1 | .. 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 | |
| 6 | Geographical enrichment guide |
| 7 | ############################# |
| 8 | |
| 9 | Geographical Enrichment Guide Overview |
| 10 | ====================================== |
| 11 | |
| 12 | In this guide, we explore how to use the Geographical Location |
| 13 | Enrichment API to enrich Topology & Inventory with geographical data. |
| 14 | |
| 15 | Geographical enrichment |
| 16 | ======================= |
| 17 | |
| 18 | Geographical enrichment is the adding, modifying, and removing of |
| 19 | geographical entities that supports geographical information. |
| 20 | Geographical entities are associated to topology data. The following |
| 21 | geographical entities support geographical enrichment: |
| 22 | |
| 23 | - Sector |
| 24 | - AntennaModule |
| 25 | - Site |
| 26 | |
| 27 | For information on the entity types and their supported relationships, |
| 28 | see the :doc:`Data Models </data-models-guide>`. |
| 29 | |
| 30 | The format of the geographical enrichment message is CloudEvents. |
| 31 | Topology & Inventory uses `CloudEvents |
| 32 | Kafka® <https://cloudevents.github.io/sdk-java/kafka.html>`__ version |
| 33 | 2.5.x. The link provides a sample CloudEvents implementation in Java®. |
| 34 | CloudEvents SDKs also supports other languages. See |
| 35 | `CloudEvents <https://cloudevents.io/>`__. |
| 36 | |
| 37 | The “data” element consists of the actual topology and inventory data. |
| 38 | It contains all the geographical entities and their associated |
| 39 | relationships in application/json format, and each entity and |
| 40 | relationships are represented in application/yang-data+json format. |
| 41 | |
| 42 | CloudEvents attributes are validated against the :doc:`Data Models |
| 43 | </data-models-guide>`. If there |
| 44 | is an unknown attribute in the CloudEvents, Topology & Inventory does |
| 45 | not drop the whole event but parses and persists only valid attributes, |
| 46 | and unknown parts are logged and ignored. If an empty or bad payload is |
| 47 | sent, the data is not persisted. |
| 48 | |
| 49 | The value of non-mandatory fields can be deleted by sending a merge |
| 50 | request to set it to null. Null means that the value is not set. |
| 51 | |
| 52 | Example of enrich Topology & Inventory with geographical data |
| 53 | ------------------------------------------------------------- |
| 54 | |
| 55 | This example creates a new topology Site entity and a relationship |
| 56 | between the Site and an AntennaModule. Using the |
| 57 | :ref:`create schema <Ingestion Create>` |
| 58 | the data producer can create entities that support geographical |
| 59 | enrichment. 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 | |
| 117 | Example of modify enriched Topology & Inventory with geographical data |
| 118 | ---------------------------------------------------------------------- |
| 119 | |
| 120 | This example updates an existing Site entity. Using the |
| 121 | :ref:`merge schema <Ingestion Merge>` |
| 122 | the data producer can update entities that support geographical |
| 123 | enrichment. |
| 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 | |
| 182 | Example of delete enriched data from Topology & Inventory |
| 183 | --------------------------------------------------------- |
| 184 | |
| 185 | This example deletes a topology Site entity and its relationship to an |
| 186 | AntennaModule entity. Using the |
| 187 | :ref:`delete schema <Ingestion Delete>` |
| 188 | the data producer can delete entities that support geographical |
| 189 | enrichment. |
| 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 | |
| 223 | How to create and produce an event |
| 224 | ================================== |
| 225 | |
| 226 | To create and produce an event, you can use the `CloudEventBuilder.v1 |
| 227 | and |
| 228 | KafkaProducer <https://cloudevents.github.io/sdk-java/kafka.html>`__. |
| 229 | The link provides a sample CloudEvents implementation in Java. |
| 230 | CloudEvents SDKs also supports other languages. See |
| 231 | `CloudEvents <https://cloudevents.io/>`__. |
| 232 | |
| 233 | Troubleshooting |
| 234 | =============== |
| 235 | |
| 236 | If CloudEvents were sent but no data was persisted, check validation |
| 237 | failures and logs. Update the CloudEvent based on the logs and send it again. |