Issue-ID: DOC-500
[doc.git] / docs / guides / onap-user / instantiate / pre_instantiation / index.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2 .. International License. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2019 ONAP Contributors.  All rights reserved.
4
5 .. _doc_guide_user_pre_ser-inst:
6
7
8 Pre Service instantiation Operations
9 ====================================
10
11 Several operations need to be performed after Service model distribution,
12 but before instantiating a service.
13
14 Those operations are only available via REST API requests.
15
16 Various tools can be used to send REST API requests.
17
18 Here after are examples using "curl" command line tool that you can use in
19 a Unix Terminal.
20
21
22 Declare owningEntity, lineOfBusiness, Platform and Project
23 ----------------------------------------------------------
24
25 At one point during Service Instantiation, the user need to select values for
26 those 4 parameters
27
28 * Owning Entity
29 * Line Of Business
30 * Platform
31 * Project
32
33
34 Those parameters and values must be pre-declared in ONAP VID component
35 using REST API
36
37 Those informations will be available to all service instantiation
38 (you only need to declare them once in ONAP)
39
40
41 Example for "Owning Entity" named "Test"
42
43 ::
44
45   curl -X POST \
46     http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/owningEntity \
47     -H 'Accept-Encoding: gzip, deflate' \
48     -H 'Content-Type: application/json' \
49     -H 'cache-control: no-cache' \
50     -d '{
51       "options": ["Test"]
52   }'
53
54 Example for "platform" named "Test_Platform"
55
56 ::
57
58   curl -X POST \
59     http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/platform \
60     -H 'Content-Type: application/json' \
61     -H 'cache-control: no-cache' \
62     -d '{
63       "options": [""Test_Platform"]
64   }'
65
66 Example for "line of business" named "Test_LOB"
67
68 ::
69
70   curl -X POST \
71   http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/lineOfBusiness \
72   -H 'Content-Type: application/json' \
73   -H 'cache-control: no-cache' \
74   -d '{
75     "options": ["Test_LOB"]
76   }'
77
78 Example for "project" named "Test_project"
79
80 ::
81
82   curl -X POST \
83     http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/project \
84     -H 'Content-Type: application/json' \
85     -H 'cache-control: no-cache' \
86     -d '{
87       "options": ["Test_project"]
88   }'
89
90
91
92
93 Declare a customer
94 ------------------
95
96 Each time you have a new customer, you will need to perform those operations
97
98 This operation is using ONAP AAI REST API
99
100 Any service instance need to be linked to a customer
101
102 in the query path, you put the customer_name
103
104 in the query body you put the customer name again
105
106 Here after an example to declare a customer named "my_customer_name"
107
108
109 ::
110
111   curl -X PUT \
112     https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name \
113     -H 'Accept: application/json' \
114     -H 'Authorization: Basic QUFJOkFBSQ==' \
115     -H 'Content-Type: application/json' \
116     -H 'X-FromAppId: AAI' \
117     -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
118     -H 'cache-control: no-cache' \
119     -d '{
120       "global-customer-id": "my_customer_name",
121       "subscriber-name": "my_customer_name",
122       "subscriber-type": "INFRA"
123   }' -k
124
125
126 check customers in ONAP AAI (you should see if everything ok in the response)
127
128 ::
129
130   curl -X GET \
131     https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers \
132     -H 'Accept: application/json' \
133     -H 'Authorization: Basic QUFJOkFBSQ==' \
134     -H 'Content-Type: application/json' \
135     -H 'X-FromAppId: AAI' \
136     -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
137     -H 'cache-control: no-cache' -k
138
139
140 Associate Service Model to Customer
141 -----------------------------------
142
143
144 This operation is using ONAP AAI REST API
145
146 in the query path, you put the customer_name and the service model name
147
148 in the query body you put the service model UUID
149
150 ::
151
152   curl -X PUT \
153     https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions/service-subscription/my_service_model_name \
154     -H 'Accept: application/json' \
155     -H 'Authorization: Basic QUFJOkFBSQ==' \
156     -H 'Content-Type: application/json' \
157     -H 'Postman-Token: d4bc4991-a518-4d75-8a87-674ba44bf13a' \
158     -H 'X-FromAppId: AAI' \
159     -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
160     -H 'cache-control: no-cache' \
161     -d '{
162       "service-id": "11265d8c-2cc2-40e5-95d8-57cad81c18da"
163   }' -k
164
165
166
167
168 Associate Cloud Site to Customer
169 --------------------------------
170
171 in the query path, you put the customer_name and the service model name
172
173 in the query body you put the cloud owner name, the cloud site name,
174 the tenant id and the tenant name
175
176
177 ::
178
179   curl -X PUT \
180     https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions/service-subscription/my_service_model_name/relationship-list/relationship \
181     -H 'Accept: application/json' \
182     -H 'Authorization: Basic QUFJOkFBSQ==' \
183     -H 'Content-Type: application/json' \
184     -H 'Postman-Token: 11ea9a9e-0dc8-4d20-8a78-c75cd6928916' \
185     -H 'X-FromAppId: AAI' \
186     -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
187     -H 'cache-control: no-cache' \
188     -d '{
189       "related-to": "tenant",
190       "related-link": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/my_cloud_owner_name/my_cloud_site_name/tenants/tenant/234a9a2dc4b643be9812915b214cdbbb",
191       "relationship-data": [
192           {
193               "relationship-key": "cloud-region.cloud-owner",
194               "relationship-value": "my_cloud_owner_name"
195           },
196           {
197               "relationship-key": "cloud-region.cloud-region-id",
198               "relationship-value": "my_cloud_site_name"
199           },
200           {
201               "relationship-key": "tenant.tenant-id",
202               "relationship-value": "234a9a2dc4b643be9812915b214cdbbb"
203           }
204       ],
205       "related-to-property": [
206           {
207               "property-key": "tenant.tenant-name",
208               "property-value": "my_tenant_name"
209           }
210       ]
211   }' -k
212
213
214 check (you should see if everything ok in the response)
215
216 ::
217
218   curl -X GET \
219     'https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions?depth=all' \
220     -H 'Accept: application/json' \
221     -H 'Authorization: Basic QUFJOkFBSQ==' \
222     -H 'Content-Type: application/json' \
223     -H 'X-FromAppId: AAI' \
224     -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
225     -H 'cache-control: no-cache' -k