aboutsummaryrefslogtreecommitdiffstats
path: root/docs/platform/user-guide.rst
blob: 3471275f46bfddd3745352190f3fe897b7781297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
.. This work is licensed under a Creative Commons Attribution 4.0
   International License.
.. http://creativecommons.org/licenses/by/4.0

MSB User-guide
==============


Overview
--------

Micro-Service Bus (MSB) provides a facility to register and
expose ONAP Rest API.

It is particulary usefull to expose some API endpoints
that are not published by default when installing ONAP with OOM installer.

There are two methods to register an API in MSB:

- via MSB Portal/GUI
- via MSB Rest API


Using MSB portal
----------------

MSB Portal/GUI is available on the following URL
(adapt to your ONAP installation)

..

    http://msb.api.discovery.simpledemo.onap.org:30282/iui/microservices/default.html


The following screen should appears

.. figure:: images/home.png
   :align: center


click on the "Service Discover" icon to get the list of
registred API (it will take several seconds to get the next screen)

.. figure:: images/service-list-2.png
   :align: center

Note: majority of Registred API have been declared using MSB API and
they can not be modified/deleted via MSB Portal/GUI.


click on "view" icon in "Control" column to have a more
detailed description of the registred API

.. figure:: images/service-detail.png
   :align: center

click on "Service Register" icon to start the register process for a new API

.. figure:: images/service-register.png
   :align: center

"Service Name" will be the new API name in MSB and will be used
to build the URL that will be exposed.

"Url" is the url of the existing ONAP API that we are registering

"Protocol" must be selected in the list (usualy REST)

"Version" will be part of the exposed URL

"Visual Range" must be selected (usualy inSystem)

click on "Add Host" to provide information about IP address and
port of the API that we are registering.

Tips: from an ONAP platform installed via OOM, to know about the IP/port,
use Kubctl commands

example: to know about IP addresses used by ONAP Policy components

::

    kubectl get svc -n onap | grep policy


Here after an example of Registered API for ONAP SO:


.. figure:: images/service-edit.png
   :align: center



Using MSB API
-------------

Get the list of registred API in MSB


::

    curl -X GET \
    http://msb.api.discovery.simpledemo.onap.org:30280/api/microservices/v1/services \
    -H 'Content-Type: application/json' \
    -H 'cache-control: no-cache'


response (small extract only):

::

        ],
        "metadata": [],
        "labels": [],
        "status": "1",
        "is_manual": false
    },
    {
        "serviceName": "aai-business",
        "version": "v16",
        "url": "/aai/v16/business",
        "protocol": "REST",
        "visualRange": "1",
        "lb_policy": "ip_hash",
        "publish_port": "",
        "namespace": "",
        "network_plane_type": "",
        "host": "",
        "path": "",
        "enable_ssl": true,
        "nodes": [
            {
                "ip": "10.233.69.5",
                "port": "8447",
                "checkType": "",
                "checkUrl": "",
                "tls_skip_verify": true,
                "ha_role": "",
                "nodeId": "_v16_aai-business_10.233.69.5_8447",
                "status": "passing"
            }
        ],
        "metadata": [],
        "labels": [],
        "status": "1",
        "is_manual": false
    },



Register a new API (example for ONAP policy-pap API)

"Service Name" will be the new API name in MSB and will be used
to build the URL that will be exposed.

"Url" is the url of the existing ONAP API that we are registering

"Protocol" must be selected in the list (usualy REST)

"Version" will be part of the exposed URL

"Visual Range" must be selected (usualy inSystem)

"enable_ssl" must be set to "true" is using
https between MSB and API service that we are registering.

"nodes" is a list  of IP addresses and port of the API that we are registering.

Tips: from an ONAP platform installed via OOM, to know about the IP/port,
use Kubctl commands
"enable_ssl" must be set to "true" is using
https between MSB and API service that we are registering.


::

    curl -X POST \
    http://msb.api.discovery.simpledemo.onap.org:30280/api/microservices/v1/services \
    -H 'Content-Type: application/json' \
    -H 'cache-control: no-cache' \
    -d '{
    "serviceName": "policy-api",
    "version": "v1",
    "url": "/policy/api/v1",
    "protocol": "REST",
    "visualRange": "1",
    "enable_ssl": true,
    "nodes": [

        {
        "ip": "10.233.35.125",
        "port": "6969",
        "ttl": 0
        }
    ]
    }
    '

Delete an API from MSB (=unregister an API):

::

    curl -X DELETE \
    http://msb.api.discovery.simpledemo.onap.org:30280/api/microservices/v1/services/policy-pap/version/v1/nodes/10.233.15.213/6969 \
    -H 'Content-Type: application/json' \
    -H 'cache-control: no-cache' \
    -d '{
    "serviceName": "policy-pdp-legacy",
    "version": "v1",
    "url": "/pdp/api",
    "protocol": "REST",
    "visualRange": "1",
    "enable_ssl": true,
    "nodes": [

        {
        "ip": "10.233.77.14",
        "port": "8081",
        "ttl": 0
        }
    ]
    }
    '


Using a registred API
---------------------


Once registered, the API can then be accessible using
the following URL/Port

http://msb.api.discovery.simpledemo.onap.org:30280/api/{{Service Name}}/{{Version}}/{{resource}}

where {{Service Name}} and {{Version}} are mapped to what have been registered

{{resource}} is to be replace by the object that the API is able to manage


some examples:

to get the service model list from SDC via MSB
(this API is pre-registred by default in ONAP):


::

    curl -X GET \
    http://msb.api.discovery.simpledemo.onap.org:30280/api/sdc/v1/catalog/services \
    -H 'Accept: application/json' \
    -H 'Authorization: Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU=' \
    -H 'Content-Type: application/json' \
    -H 'USER_ID: cs0008' \
    -H 'X-FromAppId: ONAP-Test' \
    -H 'X-TransactionId: ONAP-Test' \
    -H 'cache-control: no-cache' \
    -H 'x-ecomp-instanceid: ONAP-Test'



to get the customer list from AAI via MSB
(this API is pre-registred by default in ONAP):


::

    curl -X GET \
    http://msb.api.discovery.simpledemo.onap.org:30280/api/aai-business/v16/customers \
    -H 'Accept: application/json' \
    -H 'Authorization: Basic QUFJOkFBSQ==' \
    -H 'Content-Type: application/json' \
    -H 'X-FromAppId: AAI' \
    -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
    -H 'cache-control: no-cache'


to get the list of policy models from Policy via MSB
(this policy API needs to be registred):

::

    curl -X GET \
    http://msb.api.discovery.simpledemo.onap.org:30280/api/policy-api/v1/policytypes \
    -H 'Authorization: Basic aGVhbHRoY2hlY2s6emIhWHp0RzM0' \
    -H 'X-ONAP-RequestID: 9ac7ce8e-a867-4269-bc52-c8236b7fdad6' \
    -H 'cache-control: no-cache'