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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
|
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
Offered APIs
=============================================
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
Homing API v1
------------------
*Updated: 28 Feb 2018*
This document describes the Homing API, provided by the Homing and Allocation service (Conductor).
It is a work in progress and subject to frequent revision.
General API Information
-------------------------
Authenticated calls that target a known URI but that use an HTTP method
the implementation does not support return a 405 Method Not Allowed
status. In addition, the HTTP OPTIONS method is supported for each known
URI. In both cases, the Allow response header indicates the supported
HTTP methods. See the API Errors section for more information about the
error response structure.
API versions
------------------
List all Homing API versions
----------------------------
**GET** ``/``\ F
**Normal response codes:** 200
.. code:: json
{
"versions": [
{
"status": "EXPERIMENTAL",
"id": "v1",
"updated": "2016-11-01T00:00:00Z",
"media-types": [
{
"base": "application/json",
"type": "application/vnd.onap.homing-v1+json"
}
],
"links": [
{
"href": "http://has.ip/v1",
"rel": "self"
},
{
"href": "http://has.url/",
"type": "text/html",
"rel": "describedby"
}
]
}
]
}
This operation does not accept a request body.
Plans
-----
Create a plan
-------------
**POST** ``/v1/plans``
- **Normal response codes:** 201
- **Error response codes:** badRequest (400), unauthorized (401),
internalServerError (500)
Request an inventory plan for one or more related service demands.
The request includes or references a declarative **template**,
consisting of:
- **Parameters** that can be referenced like macros
- **Demands** for service made against inventory
- **Locations** that are common to the overall plan
- **Constraints** made against demands, resulting in a set of inventory
candidates
- **Optimizations** to further narrow down the remaining candidates
The response contains an inventory **plan**, consisting of one or more
sets of recommended pairings of demands with an inventory candidate's
attributes and region.
Request Parameters
~~~~~~~~~~~~~~~~~~
+--------------------+-------+------------+-------------------+
| Parameter | Style | Type | Description |
+====================+=======+============+===================+
| ``name`` | plain | xsd:string | A name for the |
| (Optional) | | | new plan. If a |
| | | | name is not |
| | | | provided, it |
| | | | will be |
| | | | auto-generated |
| | | | based on the |
| | | | homing |
| | | | template. This |
| | | | name must be |
| | | | unique within |
| | | | a given |
| | | | Conductor |
| | | | environment. |
| | | | When deleting |
| | | | a plan, its |
| | | | name will not |
| | | | become |
| | | | available for |
| | | | reuse until |
| | | | the deletion |
| | | | completes |
| | | | successfully. |
| | | | Must only |
| | | | contain |
| | | | letters, |
| | | | numbers, |
| | | | hypens, full |
| | | | stops, |
| | | | underscores, |
| | | | and tildes |
| | | | (RFC 3986, |
| | | | Section 2.3). |
| | | | This parameter |
| | | | is immutable. |
+--------------------+-------+------------+-------------------+
| ``id`` | plain | csapi:UUID | The UUID of |
| (Optional) | | | the plan. UUID |
| | | | is assigned by |
| | | | Conductor if |
| | | | no id is |
| | | | provided in |
| | | | the request. |
+--------------------+-------+------------+-------------------+
| ``transaction_id`` | plain | csapi:UUID | The |
| | | | transaction id |
| | | | assigned by |
| | | | MSO. The logs |
| | | | should have |
| | | | this |
| | | | transaction id |
| | | | for tracking |
| | | | purposes. |
+--------------------+-------+------------+-------------------+
| ``files`` | plain | xsd:dict | Supplies the |
| (Optional) | | | contents of |
| | | | files |
| | | | referenced in |
| | | | the template. |
| | | | Conductor |
| | | | templates can |
| | | | explicitly |
| | | | reference |
| | | | files by using |
| | | | the |
| | | | ``get_file`` |
| | | | intrinsic |
| | | | function. The |
| | | | value is a |
| | | | JSON object, |
| | | | where each key |
| | | | is a relative |
| | | | or absolute |
| | | | URI which |
| | | | serves as the |
| | | | name of a |
| | | | file, and the |
| | | | associated |
| | | | value provides |
| | | | the contents |
| | | | of the file. |
| | | | Additionally, |
| | | | some template |
| | | | authors encode |
| | | | their user |
| | | | data in a |
| | | | local file. |
| | | | The Homing |
| | | | client (e.g., |
| | | | a CLI) can |
| | | | examine the |
| | | | template for |
| | | | the |
| | | | ``get_file`` |
| | | | intrinsic |
| | | | function |
| | | | (e.g., |
| | | | ``{get_file: f |
| | | | ile.yaml}``) |
| | | | and add an |
| | | | entry to the |
| | | | ``files`` map |
| | | | with the path |
| | | | to the file as |
| | | | the name and |
| | | | the file |
| | | | contents as |
| | | | the value. Do |
| | | | not use this |
| | | | parameter to |
| | | | provide the |
| | | | content of the |
| | | | template |
| | | | located at the |
| | | | ``template_url`` |
| | | | address. |
| | | | Instead, use |
| | | | the |
| | | | ``template`` |
| | | | parameter to |
| | | | supply the |
| | | | template |
| | | | content as |
| | | | part of the |
| | | | request. |
+--------------------+-------+------------+-------------------+
| ``template_url`` | plain | xsd:string | A URI to |
| (Optional) | | | the location |
| | | | containing the |
| | | | template on |
| | | | which to |
| | | | perform the |
| | | | operation. See |
| | | | the |
| | | | description of |
| | | | the |
| | | | ``template`` |
| | | | parameter for |
| | | | information |
| | | | about the |
| | | | expected |
| | | | template |
| | | | content |
| | | | located at the |
| | | | URI. This |
| | | | parameter is |
| | | | only required |
| | | | when you omit |
| | | | the |
| | | | ``template`` |
| | | | parameter. If |
| | | | you specify |
| | | | both |
| | | | parameters, |
| | | | this parameter |
| | | | is ignored. |
+--------------------+-------+------------+-------------------+
| ``template`` | plain | xsd:string | The template |
| | | or xsd:dict| on which to |
| | | | perform the |
| | | | operation. See |
| | | | the Homing |
| | | | Template |
| | | | Guide |
| | | | for complete |
| | | | information on |
| | | | the format. |
| | | | This parameter |
| | | | is either |
| | | | provided as a |
| | | | ``string`` or |
| | | | ``dict`` in |
| | | | the JSON |
| | | | request body. |
| | | | For ``string`` |
| | | | content it may |
| | | | be a JSON- or |
| | | | YAML-formatted |
| | | | Conductor |
| | | | template. For |
| | | | ``dict`` |
| | | | content it |
| | | | must be a |
| | | | direct JSON |
| | | | representation |
| | | | of the |
| | | | Conductor |
| | | | template. This |
| | | | parameter is |
| | | | required only |
| | | | when you omit |
| | | | the |
| | | | ``template_url`` |
| | | | parameter. If |
| | | | you specify |
| | | | both |
| | | | parameters, |
| | | | this value |
| | | | overrides the |
| | | | ``template_url`` |
| | | | parameter |
| | | | value. |
+--------------------+-------+------------+-------------------+
| ``timeout`` | plain | xsd:number | The timeout |
| (Optional) | | | for plan |
| | | | creation in |
| | | | minutes. |
| | | | Default is 1. |
+--------------------+-------+------------+-------------------+
| ``limit`` | plain | xsd:number | The maximum |
| (Optional) | | | number of |
| | | | recommendations |
| | | | to return. |
| | | | Default is 1. |
+--------------------+-------+------------+-------------------+
**NOTE**: ``files``, ``template_url``, and ``timeout`` are not yet
supported.
Response Parameters
~~~~~~~~~~~~~~~~~~~
+--------------------+----------+------------+--------------------+
| Parameter | Style | Type | Description |
+====================+==========+============+====================+
| ``plan`` | plain | xsd:dict | The ``plan`` |
| | | | object. |
+--------------------+----------+------------+--------------------+
| ``id`` | plain | csapi:UUID | The UUID of |
| | | | the plan. |
+--------------------+----------+------------+--------------------+
| ``transaction_id`` | plain | csapi:UUID | The |
| | | | transaction id |
| | | | assigned by |
| | | | the MSO. |
+--------------------+----------+------------+--------------------+
| ``name`` | plain | xsd:string | The plan name. |
| | | | |
+--------------------+----------+------------+--------------------+
| ``status`` | plain | xsd:string | The plan |
| | | | status. One of |
| | | | ``template``, |
| | | | ``translated``, |
| | | | ``solving``, |
| | | | ``solved``, or |
| | | | ``error``. See |
| | | | **Plan |
| | | | Status** table |
| | | | for |
| | | | descriptions |
| | | | of each value. |
+--------------------+----------+------------+--------------------+
| ``message`` | plain | xsd:string | Additional |
| | | | context, if |
| | | | any, around |
| | | | the message |
| | | | status. If the |
| | | | status is |
| | | | ``error``, |
| | | | this may |
| | | | include a |
| | | | reason and |
| | | | suggested |
| | | | remediation, |
| | | | if available. |
+--------------------+----------+------------+--------------------+
| ``links`` | plain | xsd:list | A list of URLs |
| | | | for the plan. |
| | | | Each URL is a |
| | | | JSON object |
| | | | with an |
| | | | ``href`` key |
| | | | indicating the |
| | | | URL and a |
| | | | ``rel`` key |
| | | | indicating its |
| | | | relationship |
| | | | to the plan in |
| | | | question. |
| | | | There may be |
| | | | multiple links |
| | | | returned. The |
| | | | ``self`` |
| | | | relationship |
| | | | identifies the |
| | | | URL of the |
| | | | plan itself. |
+--------------------+----------+------------+--------------------+
| ``recommendations``| plain | xsd:list | A list of one |
| | | | or more |
| | | | recommendationS. |
| | | | A |
| | | | recommendation |
| | | | pairs each |
| | | | requested |
| | | | demand with an |
| | | | inventory |
| | | | provider, a |
| | | | single |
| | | | candidate, and |
| | | | an opaque |
| | | | dictionary of |
| | | | attributes. |
| | | | Refer to the |
| | | | Demand |
| | | | candidate |
| | | | schema in the |
| | | | Homing |
| | | | Template |
| | | | Guide |
| | | | for further |
| | | | details. (Note |
| | | | that, when |
| | | | ``inventory_type`` |
| | | | is ``cloud`` |
| | | | the |
| | | | candidate's |
| | | | ``candidate_id`` |
| | | | field is |
| | | | redundant and |
| | | | thus omitted.) |
+--------------------+----------+------------+--------------------+
Plan Status
~~~~~~~~~~~
+----------------+-----------------+
| Status | Description |
+================+=================+
| ``template`` | Plan request |
| | and homing |
| | template have |
| | been received. |
| | Awaiting |
| | translation. |
+----------------+-----------------+
| ``translated`` | Homing |
| | template has |
| | been |
| | translated, |
| | and candidates |
| | have been |
| | obtained from |
| | inventory |
| | providers. |
| | Awaiting |
| | solving. |
+----------------+-----------------+
| ``solving`` | Search for a |
| | solution is in |
| | progress. This |
| | may |
| | incorporate |
| | requests to |
| | service |
| | controllers |
| | for additional |
| | information. |
+----------------+-----------------+
| ``solved`` | Search is |
| | complete. A |
| | solution with |
| | one or more |
| | recommendations |
| | was found. |
+----------------+-----------------+
| ``not found`` | Search is |
| | complete. No |
| | recommendations |
| | were found. |
+----------------+-----------------+
| ``error`` | An error was |
| | encountered. |
+----------------+-----------------+
State Diagram
^^^^^^^^^^^^^
.. code:: text
----------------------------------------
| |
| /---> solved ---> reserving ---> done
| / /
template -> translated -> solving ------> not found /
| ^ | \ /
| | conditionally | \---> error <----/
| | (see note) | ^
| \---------------/ |
\---------------------------------------/
**NOTE**: When Conductor's solver service is started in non-concurrent
mode (the default), it will reset any plans found waiting and stuck in
the ``solving`` state back to ``translated``.
.. code:: json
{
"name": "PLAN_NAME",
"template": "CONDUCTOR_TEMPLATE",
"limit": 3
}
.. code:: json
{
"plan": {
"name": "PLAN_NAME",
"id": "ee1c5269-c7f0-492a-8652-f0ceb15ed3bc",
"transaction_id": "6bca5f2b-ee7e-4637-8b58-1b4b36ed10f9",
"status": "solved",
"message", "Plan PLAN_NAME is solved.",
"links": [
{
"href": "http://homing/v1/plans/ee1c5269-c7f0-492a-8652-f0ceb15ed3bc",
"rel": "self"
}
],
"recommendations": [
{
"DEMAND_NAME_1": {
"inventory_provider": "aai",
"service_resource_id": "4feb0545-69e2-424c-b3c4-b270e5f2a15d",
"candidate": {
"candidate_id": "99befee8-e8c0-425b-8f36-fb7a8098d9a9",
"inventory_type": "service",
"location_type": "aic",
"location_id": "dal01",
"host_id" : "vig20002vm001vig001"
},
"attributes": {OPAQUE-DICT}
},
"DEMAND_NAME_2": {
"inventory_provider": "aai",
"service_resource_id": "578eb063-b24a-4654-ba9e-1e5cf7eb9183",
"candidate": {
"inventory_type": "cloud",
"location_type": "aic",
"location_id": "dal02"
},
"attributes": {OPAQUE-DICT}
}
},
{
"DEMAND_NAME_1": {
"inventory_provider": "aai",
"service_resource_id": "4feb0545-69e2-424c-b3c4-b270e5f2a15d",
"candidate": {
"candidate_id": "99befee8-e8c0-425b-8f36-fb7a8098d9a9",
"inventory_type": "service",
"location_type": "aic",
"location_id": "dal03",
"host_id" : "vig20001vm001vig001"
},
"attributes": {OPAQUE-DICT}
},
"DEMAND_NAME_2": {
"inventory_provider": "aai",
"service_resource_id": "578eb063-b24a-4654-ba9e-1e5cf7eb9183",
"candidate": {
"inventory_type": "cloud",
"location_type": "aic",
"location_id": "dal04"
},
"attributes": {OPAQUE-DICT}
}
},
...
]
}
}
Show plan details
-----------------
**GET** ``/v1/plans/{plan_id}``
- **Normal response codes:** 200
- **Error response codes:** unauthorized (401), itemNotFound (404)
Request parameters
~~~~~~~~~~~~~~~~~~
+---------------+---------+--------------+-------------------------+
| Parameter | Style | Type | Description |
+===============+=========+==============+=========================+
| ``plan_id`` | plain | csapi:UUID | The UUID of the plan. |
+---------------+---------+--------------+-------------------------+
Response Parameters
~~~~~~~~~~~~~~~~~~~
See the Response Parameters for **Create a plan**.
Delete a plan
-------------
**DELETE** ``/v1/plans/{plan_id}``
- **Normal response codes:** 204
- **Error response codes:** badRequest (400), unauthorized (401),
itemNotFound (404)
Request parameters
~~~~~~~~~~~~~~~~~~
+---------------+---------+--------------+-------------------------+
| Parameter | Style | Type | Description |
+===============+=========+==============+=========================+
| ``plan_id`` | plain | csapi:UUID | The UUID of the plan. |
+---------------+---------+--------------+-------------------------+
This operation does not accept a request body and does not return a
response body.
API Errors
----------
In the event of an error with a status other than unauthorized (401), a
detailed repsonse body is returned.
Response parameters
~~~~~~~~~~~~~~~~~~~
+-----------------+--------+------------+---------------------------------------------+
| Parameter | Style | Type | Description |
+=================+========+============+=============================================+
| ``title`` | plain | xsd:string | Human-readable name. |
+-----------------+--------+------------+---------------------------------------------+
| ``explanation`` | plain | xsd:string | Detailed explanation with remediation (if |
| | | | any). |
+-----------------+--------+------------+---------------------------------------------+
| ``code`` | plain | xsd:int | HTTP Status Code. |
+-----------------+--------+------------+---------------------------------------------+
| ``error`` | plain | xsd:dict | Error dictionary. Keys include **message**, |
| | | | **traceback**, and **type**. |
+-----------------+--------+------------+---------------------------------------------+
| ``message`` | plain | xsd:string | Internal error message. |
+-----------------+--------+------------+---------------------------------------------+
| ``traceback`` | plain | xsd:string | Python traceback (if available). |
| | | | |
+-----------------+--------+------------+---------------------------------------------+
| ``type`` | plain | xsd:string | HTTP Status class name (from python-webob) |
+-----------------+--------+------------+---------------------------------------------+
Examples
^^^^^^^^
A plan with the name "pl an" is considered a bad request because the
name contains a space.
.. code:: json
{
"title": "Bad Request",
"explanation": "-> name -> pl an did not pass validation against callable: plan_name_type (must contain only uppercase and lowercase letters, decimal digits, hyphens, periods, underscores, and tildes [RFC 3986, Section 2.3])",
"code": 400,
"error": {
"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.",
"type": "HTTPBadRequest"
}
}
The HTTP COPY method was attempted but is not allowed.
.. code:: json
{
"title": "Method Not Allowed",
"explanation": "The COPY method is not allowed.",
"code": 405,
"error": {
"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.",
"type": "HTTPMethodNotAllowed"
}
}
|