aboutsummaryrefslogtreecommitdiffstats
path: root/docs/AAI REST API Documentation/genericQueries.rst
blob: e2f7e200e826c96812be52eaa4430a938ea75ab4 (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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
.. contents::
   :depth: 3
..
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0

AAI Generic Query Implementation Notes

Overview
========

The Generic Query mechanism allows to search for certain nodes of
“include” node types at a specified “depth” from the from a particular
start node of type “start-node-type” identified by specifying its
“key” values.

The Generic Query is implemented using the GET method with the
following URL that takes 4 query params:

.. code-block::

   /aai/<version>/search/generic-query

   Ex. /aai/v16/search/generic-query

Please look for other AAI documentation for what version to use in
which environment/release.

**key** - multiple values that together specify the params to select a
 unique start node. For example for selecting a customer we would
 specify
 
.. code-block::

    key=customer.global-customer-id:ma9181-203-customerid&key=service-subscription.service-type:example-service-type

**start-node-type** - node type of the start node. For example
 start-node-type=service-instance

**include** - multiple values of the node types that need to be
 returned as part of the query-result. For example

.. code-block::

    include=vce&include=port-group

**depth** – look for include node types within a certain depth from
 the start-node-type

The queries return a search-results object back which includes a list
of result-data which contains the node-type and a link for each
resource that was found.   

Requirements
============

* At depth=0, only the start node is returned, include is not needed

* At any depth > 0 and <= 6, If start-node-type is in the include –
  that should also be returned

* The depth has a max value of 6 – an error will be returned if a
  value higher than 6 is used

* A special node type of “all” can be specified for include when all
  nodes under the start node are to be searched for

* If a start-node cannot be found based on the key a HTTP response
  code of 404 Node not found error is returned

* If no nodes can be found that meet the search criteria a HTTP
  response code of 200 with an empty list is returned

* The search results can be asked to be returned in json or xml based
  on the ACCEPT header. For 1504, the queries are expected to be used
  by MSO and therefore will use an ACCEPT header of application/xml.

Supported Queries
=================
 
Search customer and service-subscription by service instance id 

.. code-block::

   URL:

   /aai/v16/search/generic-query?key=service-instance.service-instance-id:testserviceinstance&start-node-type=service-instance&include=customer&include=service-subscription&include=service-instance&depth=2

Search result:

.. code-block:: xml

 <search-results xmlns="http://com.att.aai.inventory/v16">
   <result-data>
      <resource-type>customer</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/</resource-link>
   </result-data>
   <result-data>
      <resource-type>service-subscription</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/</resource-link>
   </result-data>
   <result-data>
      <resource-type>service-instance</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/</resource-link>
   </result-data>
 </search-results>

Search the VCE and its port groups and cvlan tags given the service instance id.

.. code-block::

   URL: /aai/v16/search/generic-query?key=service-instance.service-instance-id:arnoldave&start-node-type=service-instance&include=vce&include=port-group&include=cvlan-tag&depth=3

Search result:

.. code-block:: xml

 <search-results xmlns="http://org.onap.aai.inventory/v16">
   <result-data>
      <resource-type>cvlan-tag</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/333/</resource-link>
   </result-data>
   <result-data>
      <resource-type>cvlan-tag</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/333/</resource-link>
   </result-data>
   <result-data>
      <resource-type>cvlan-tag</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/111/</resource-link>
   </result-data>
   <result-data>
      <resource-type>port-group</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/</resource-link>
   </result-data>
   <result-data>
      <resource-type>vce</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/</resource-link>
   </result-data>
   <result-data>
      <resource-type>cvlan-tag</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/222/</resource-link>
   </result-data>
   <result-data>
      <resource-type>port-group</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/</resource-link>
   </result-data>
 </search-results>

Customer GET based on tenant id 

.. code-block::

   URL:

   /aai/v16/search/generic-query?key=tenant.tenant-id:examplepizzatenant&start-node-type=tenant&include=tenant&include=customer&include=service-subscription&depth=2

Search Result:

.. code-block:: xml

 <search-results xmlns="http://org.onap.aai.inventory/v16">
   <result-data>
      <resource-type>customer</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/</resource-link>
   </result-data>
   <result-data>
      <resource-type>service-subscription</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/</resource-link>
   </result-data>
   <result-data>
      <resource-type>tenant</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/exampletenant/</resource-link>
   </result-data>
 </search-results>

Search the tenant given a customer and service subscription.  

.. code-block::

   URL:

   /aai/v16/search/generic-query?key=customer.global-customer-id:example-customer&key=service-subscription.service-type:example-service-type&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1

Search Result:

.. code-block::

  <search-results xmlns="http://org.onap.aai.inventory/v16">
   <result-data>
      <resource-type>service-subscription</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/</resource-link>
   </result-data>
   <result-data>
      <resource-type>tenant</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/</resource-link>
   </result-data>
 </search-results>

For a service Instance - get its resource-link given the service-instance-id 

.. code-block::

   URL:

   /aai/v16/search/generic-query?key=service-instance.service-instance-id:exampleservice&start-node-type=service-instance&depth=0

Search Result:

.. code-block:: xml

 <search-results xmlns="http://org.onap.aai.inventory/v6">
   <result-data>
      <resource-type>service-instance</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/</resource-link>
   </result-data>
 </search-results>

Get service-instance and service-subscription from vce

.. code-block:: 

   URL:
   /aai/v16/search/generic-query?key=vce.vnf-id:examplevce&start-node-type=vce&include=service-instance&include=service-subscription&depth=2

Search Result:

.. code-block:: xml

 <search-results xmlns="http://org.onap.aai.inventory/v16">
   <result-data>
      <resource-type>service-instance</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/</resource-link>
   </result-data>
   <result-data>
      <resource-type>service-subscription</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/</resource-link>
   </result-data>
 </search-results>

Get all the nodes for a customer

.. code-block::

   URL:

   /aai/v16/search/generic-query?key=customer.global-customer-id:examplecustomer&start-node-type=customer&include=all&depth=6

Search Result:

.. code-block:: xml

 <search-results xmlns="http://org.onap.aai.inventory/v16">
   <result-data>
      <resource-type>service-capability</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/service-design-and-creation/service-capabilities/service-capability/ptplgamma/ptplbrocade-vce/</resource-link>
   </result-data>
   <result-data>
      <resource-type>vserver</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/vservers/vserver/ccwvm1/</resource-link>
   </result-data>
   <result-data>
      <resource-type>cvlan-tag</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/333/</resource-link>
   </result-data>
   <result-data>
      <resource-type>oam-network</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/oam-networks/oam-network/examplentwk/</resource-link>
   </result-data>
   <result-data>
      <resource-type>cvlan-tag</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/333/</resource-link>
   </result-data>
   <result-data>
      <resource-type>dvs-switch</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/dvs-switches/dvs-switch/dvsswitch-id1/</resource-link>
   </result-data>
   <result-data>
      <resource-type>cvlan-tag</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/111/</resource-link>
   </result-data>
   <result-data>
      <resource-type>customer</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/</resource-link>
   </result-data>
   <result-data>
      <resource-type>service-subscription</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/</resource-link>
   </result-data>
   <result-data>
      <resource-type>port-group</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/</resource-link>
   </result-data>
   <result-data>
      <resource-type>tenant</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/</resource-link>
   </result-data>
   <result-data>
      <resource-type>service-instance</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/</resource-link>
   </result-data>
   <result-data>
      <resource-type>pserver</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/pservers/pserver/ptpnj101snd/</resource-link>
   </result-data>
   <result-data>
      <resource-type>availability-zone</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/availability-zones/availability-zone/ptplaz1/</resource-link>
   </result-data>
   <result-data>
      <resource-type>vce</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/</resource-link>
   </result-data>
   <result-data>
      <resource-type>image</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/images/image/valueOfImageId/</resource-link>
   </result-data>
   <result-data>
      <resource-type>cvlan-tag</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/222/</resource-link>
   </result-data>
   <result-data>
      <resource-type>port-group</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/</resource-link>
   </result-data>
   <result-data>
      <resource-type>ipaddress</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/vservers/vserver/ccwvm1/ipaddresses/ipaddress/10.10.10.5/guid of port or interface/</resource-link>
   </result-data>
   <result-data>
      <resource-type>flavor</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/flavors/flavor/valueOfFlavorId/</resource-link>
   </result-data>
   <result-data>
      <resource-type>ipaddress</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/vservers/vserver/ccwvm1/ipaddresses/ipaddress/10.10.10.4/guid of port or interface/</resource-link>
   </result-data>
   <result-data>
      <resource-type>complex</resource-type>
      <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/complexes/complex/PTPLNJ08742/</resource-link>
   </result-data>
 </search-results>