9f9699a052bb8efda425e06cd814eae951935e41
[ccsdk/cds.git] / docs / modelingconcepts / data-dictionary.rst
1 .. This work is a derivative of https://wiki.onap.org/display/DW/Modeling+Concepts#Concepts-1386016968
2 .. This work is licensed under a Creative Commons Attribution 4.0
3 .. International License. http://creativecommons.org/licenses/by/4.0
4 .. Copyright (C) 2020 Deutsche Telekom AG.
5
6 .. _data_dictionary:
7
8 Data Dictionary
9 ---------------
10
11 A data dictionary **models the how** a specific **resource** can be **resolved**.
12
13 A resource is a **variable/parameter** in the context of the service.
14 It can be anything, but it should not be confused with SDC or Openstack resources.
15
16 A data dictionary can have **multiple sources** to handle resolution in different ways.
17
18 The main goal of data dictionary is to define **re-usable** entity that could be shared.
19
20 **Creation** of data dictionaries is a **standalone** activity, separated from the blueprint design.
21
22 As part of modelling a data dictionary entry, the following generic information should be provided:
23
24 .. list-table::
25    :widths: 25 50 25
26    :header-rows: 1
27
28    * - Property
29      - Description
30      - Scope
31    * - updated-by
32      - The creator
33      - Mandatory
34    * - tags
35      - Information related
36      - Mandatory
37    * - sources
38      - List of resource source instance (see :ref:`resource source`)
39      - Mandatory
40    * - property
41      - Defines type and description, as nested JSON
42      - Mandatory
43    * - name
44      - Data dictionary name
45      - Mandatory
46
47 **Bellow are properties that all the resource source can have**
48
49 The modeling does allow for **data translation** between external capability
50 and CDS for both input and output key mapping.
51
52 .. list-table::
53    :widths: 25 50 25
54    :header-rows: 1
55
56    * - Property
57      - Description
58      - Scope
59    * - input-key-mapping
60      - map of resources required to perform the request/query. The left hand-side is what is used within
61        the query/request, the right hand side refer to a data dictionary instance.
62      - Optional
63    * - output-key-mapping
64      - name of the resource to be resolved mapped to the value resolved by the request/query.
65      - Optional
66    * - key-dependencies
67      - | list of data dictionary instances to be resolved prior the resolution of this specific resource.
68        | during run time execution the key dependencies are recursively sorted and resolved
69          in batch processing using the `acyclic graph algorithm
70          <https://en.wikipedia.org/wiki/Directed_acyclic_graph>`_
71      - Optional
72
73 **Example:**
74
75 ``vf-module-model-customization-uuid`` and ``vf-module-label`` are two data dictionaries.
76 A SQL table, VF_MODULE_MODEL, exist to correlate them.
77
78 Here is how input-key-mapping, output-key-mapping and key-dependencies can be used:
79
80 .. list-table::
81    :widths: 100
82    :header-rows: 1
83
84    * - vf-module-label data dictionary
85    * - .. code-block:: json
86
87             {
88               "name" : "vf-module-label",
89               "tags" : "vf-module-label",
90               "updated-by" : "adetalhouet",
91               "property" : {
92                 "description" : "vf-module-label",
93                 "type" : "string"
94               },
95               "sources" : {
96                 "primary-db" : {
97                   "type" : "source-primary-db",
98                   "properties" : {
99                     "type" : "SQL",
100                     "query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid",
101                     "input-key-mapping" : {
102                       "customizationid" : "vf-module-model-customization-uuid"
103                     },
104                     "output-key-mapping" : {
105                       "vf-module-label" : "vf_module_label"
106                     },
107                     "key-dependencies" : [ "vf-module-model-customization-uuid" ]
108                   }
109                 }
110               }
111             }