Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 2 | .. http://creativecommons.org/licenses/by/4.0 |
| 3 | .. Copyright (C) 2019 IBM. |
| 4 | |
| 5 | Resource Source |
| 6 | --------------- |
| 7 | |
| 8 | Input: |
| 9 | ====== |
| 10 | Expects the value to be provided as input to the request. |
| 11 | |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 12 | |
Ezhilarasi | eac7ca4 | 2019-07-30 19:01:51 +0530 | [diff] [blame] | 13 | |
| 14 | .. code-block:: json |
| 15 | :linenos: |
| 16 | |
| 17 | source-input |
| 18 | { |
| 19 | "description": "This is Input Resource Source Node Type", |
| 20 | "version": "1.0.0", |
| 21 | "properties": {}, |
| 22 | "derived_from": "tosca.nodes.ResourceSource" |
| 23 | } |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 24 | |
| 25 | |
| 26 | Default: |
| 27 | ======== |
| 28 | Expects the value to be defaulted in the model itself. |
| 29 | |
Ezhilarasi | eac7ca4 | 2019-07-30 19:01:51 +0530 | [diff] [blame] | 30 | .. code-block:: json |
| 31 | :linenos: |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 32 | |
Ezhilarasi | eac7ca4 | 2019-07-30 19:01:51 +0530 | [diff] [blame] | 33 | source-default |
| 34 | { |
| 35 | "description": "This is Default Resource Source Node Type", |
| 36 | "version": "1.0.0", |
| 37 | "properties": {}, |
| 38 | "derived_from": "tosca.nodes.ResourceSource" |
| 39 | } |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 40 | |
| 41 | |
| 42 | sql: |
| 43 | ==== |
| 44 | |
| 45 | Expects the SQL query to be modeled; that SQL query can be parameterized, and the parameters be other resources resolved through other means. If that's the case, this data dictionary definition will have to define key-dependencies along with input-key-mapping. |
| 46 | |
| 47 | CDS is currently deployed along the side of SDNC, hence the primary database connection provided by the framework is to SDNC database. |
| 48 | |
| 49 | |image0| |
| 50 | |
Ezhilarasi | 326a125 | 2019-07-19 19:55:00 +0530 | [diff] [blame] | 51 | .. |image0| image:: media/sqltable.JPG |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 52 | :width: 7.88889in |
| 53 | :height: 4.43750in |
| 54 | |
| 55 | .. toctree:: |
| 56 | :maxdepth: 1 |
| 57 | |
Ezhilarasi | 326a125 | 2019-07-19 19:55:00 +0530 | [diff] [blame] | 58 | sourceprimarydbcode |
Ezhilarasi | 2efa541 | 2019-04-23 20:10:12 +0530 | [diff] [blame] | 59 | |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 60 | Connection to a specific database can be expressed through the endpoint-selector property, which refers to a macro defining the information about the database the connect to. Understand TOSCA Macro in the context of CDS. |
| 61 | |
| 62 | .. toctree:: |
| 63 | :maxdepth: 1 |
| 64 | |
Ezhilarasi | 326a125 | 2019-07-19 19:55:00 +0530 | [diff] [blame] | 65 | dbsystemcode |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 66 | |
| 67 | |
| 68 | REST: |
| 69 | ===== |
| 70 | |
| 71 | Expects the URI along with the VERB and the payload, if needed. |
| 72 | |
| 73 | CDS is currently deployed along the side of SDNC, hence the default rest connection provided by the framework is to SDNC MDSAL. |
| 74 | |
| 75 | |image1| |
| 76 | |
Ezhilarasi | 326a125 | 2019-07-19 19:55:00 +0530 | [diff] [blame] | 77 | .. |image1| image:: media/resttable.JPG |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 78 | :width: 7.88889in |
| 79 | :height: 4.43750in |
| 80 | |
| 81 | .. toctree:: |
| 82 | :maxdepth: 1 |
| 83 | |
Ezhilarasi | ba9ef91 | 2019-04-17 18:24:55 +0530 | [diff] [blame] | 84 | restsourcecode |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 85 | |
| 86 | Connection to a specific REST system can be expressed through the endpoint-selector property, which refers to a macro defining the information about the REST system the connect to. Understand TOSCA Macro in the context of CDS. |
| 87 | |
| 88 | Few ways are available to authenticate to the REST system: |
| 89 | |
| 90 | * token-auth |
| 91 | * basic-auth |
| 92 | * ssl-basic-auth |
| 93 | |
| 94 | For source code of Authentication click below link: |
| 95 | |
| 96 | .. toctree:: |
| 97 | :maxdepth: 1 |
| 98 | |
Ezhilarasi | ba9ef91 | 2019-04-17 18:24:55 +0530 | [diff] [blame] | 99 | restauth |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 100 | |
| 101 | Capability: |
| 102 | =========== |
| 103 | |
| 104 | Expects a script to be provided. |
| 105 | |
| 106 | |image2| |
| 107 | |
Ezhilarasi | 326a125 | 2019-07-19 19:55:00 +0530 | [diff] [blame] | 108 | .. |image2| image:: media/capabilitytable.JPG |
Ezhilarasi | 5e4307f | 2019-04-15 20:19:50 +0530 | [diff] [blame] | 109 | :width: 7.88889in |
| 110 | :height: 4.43750in |
| 111 | |
| 112 | |
| 113 | .. toctree:: |
| 114 | :maxdepth: 1 |
| 115 | |
Ezhilarasi | 326a125 | 2019-07-19 19:55:00 +0530 | [diff] [blame] | 116 | sourcecapabilitycode |
Ezhilarasi | 2efa541 | 2019-04-23 20:10:12 +0530 | [diff] [blame] | 117 | |
| 118 | Complex Type: |
| 119 | ============= |
| 120 | |
| 121 | Value will be resolved through REST., and output will be a complex type. |
| 122 | |
| 123 | Modeling reference: Modeling Concepts#rest |
| 124 | |
| 125 | In this example, we're making a POST request to an IPAM system with no payload. |
| 126 | |
| 127 | Some ingredients are required to perform the query, in this case, $prefixId. Hence It is provided as an input-key-mapping and defined as a key-dependencies. Please refer to the modeling guideline for more in depth understanding. |
| 128 | |
| 129 | As part of this request, the expected response will be as below. |
| 130 | |
| 131 | .. toctree:: |
| 132 | :maxdepth: 1 |
| 133 | |
Ezhilarasi | 326a125 | 2019-07-19 19:55:00 +0530 | [diff] [blame] | 134 | complexResponse |
Ezhilarasi | 2efa541 | 2019-04-23 20:10:12 +0530 | [diff] [blame] | 135 | |
| 136 | What is of interest is the address and id fields. For the process to return these two values, we need to create a custom data-type, as bellow |
| 137 | |
| 138 | .. toctree:: |
| 139 | :maxdepth: 1 |
| 140 | |
Ezhilarasi | 326a125 | 2019-07-19 19:55:00 +0530 | [diff] [blame] | 141 | dt-netbox-ip |
Ezhilarasi | 2efa541 | 2019-04-23 20:10:12 +0530 | [diff] [blame] | 142 | |
| 143 | The type of the data dictionary will be dt-netbox-ip. |
| 144 | |
| 145 | To tell the resolution framework what is of interest in the response, the output-key-mapping section is used. The process will map the output-key-mapping to the defined data-type. |
| 146 | |
| 147 | .. toctree:: |
| 148 | :maxdepth: 1 |
| 149 | |
Ezhilarasi | 326a125 | 2019-07-19 19:55:00 +0530 | [diff] [blame] | 150 | create_netbox_ip_address |