Rene_Robert | fb17797 | 2019-07-09 14:39:47 +0200 | [diff] [blame] | 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_ser_inst: |
| 6 | |
| 7 | |
| 8 | AlaCarte mode Service Instantiation via ONAP SO API |
| 9 | =================================================== |
| 10 | |
| 11 | Using ONAP SO API in "Alacarte" mode, you need to send several requests, |
| 12 | depending on the service model composition. |
| 13 | |
| 14 | For example, if your service model is composed of 2 VNF and a Network, |
| 15 | you will have to build and send : |
| 16 | |
| 17 | * a request to SO to create the "service instance" object |
| 18 | * a request to SO to create the VNF 1 instance object |
| 19 | * a request to SDNC to declare VNF 1 instance parameters and values |
| 20 | (SDNC preload) |
| 21 | * a request to SO to create the Vf-module 1 instance object |
| 22 | * a request to SO to create the VNF 2 instance object |
| 23 | * a request to SDNC to declare VNF 2 instance parameters and values |
| 24 | (SDNC preload) |
| 25 | * a request to SO to create the Vf-module 2 instance object |
| 26 | * a request to SO to create the Network instance object |
| 27 | |
| 28 | |
| 29 | |
| 30 | Example to request a service instance directly to ONAP SO |
| 31 | |
| 32 | |
| 33 | TO BE COMPLETED |
| 34 | |
| 35 | |
| 36 | |
| 37 | In the response, you will obtain the serviceOrderId value. |
| 38 | |
| 39 | Then you have the possibility to check about the SO request |
| 40 | (here after the requestId=e3ad8df6-ea0d-4384-be95-bcb7dd39bbde). |
| 41 | |
| 42 | This will allow you to get the serviceOrder Status (completed, failed...) |
| 43 | |
| 44 | :: |
| 45 | |
| 46 | curl -X GET \ |
| 47 | http://so.api.simpledemo.onap.org:30277/onap/so/infra/orchestrationRequests/v6/e3ad8df6-ea0d-4384-be95-bcb7dd39bbde \ |
| 48 | -H 'Accept: application/json' \ |
| 49 | -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \ |
| 50 | -H 'Content-Type: application/json' \ |
| 51 | -H 'X-FromAppId: AAI' \ |
| 52 | -H 'X-TransactionId: get_aai_subscr' \ |
| 53 | -H 'cache-control: no-cache' |
| 54 | |
| 55 | |
| 56 | To instantiate a VNF, you need to build a complex request. |
| 57 | All necessary parameters are available in the Tosca service template |
| 58 | generated by SDC when you defined your service model. |
| 59 | |
| 60 | :: |
| 61 | |
| 62 | curl -X POST \ |
| 63 | http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/vnfs \ |
| 64 | -H 'Accept: application/json' \ |
| 65 | -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \ |
| 66 | -H 'Content-Type: application/json' \ |
| 67 | -H 'X-FromAppId: AAI' \ |
| 68 | -H 'X-TransactionId: get_aai_subscr' \ |
| 69 | -H 'cache-control: no-cache' \ |
| 70 | -d '{ |
| 71 | "requestDetails": { |
| 72 | "requestInfo": { |
| 73 | "productFamilyId": "0d463b0c-e559-4def-8d7b-df64cfbd3159", |
| 74 | "instanceName": "my_service_vnf_instance_001", |
| 75 | "source": "VID", |
| 76 | "suppressRollback": false, |
| 77 | "requestorId": "test" |
| 78 | }, |
| 79 | "modelInfo": { |
| 80 | "modelType": "vnf", |
| 81 | "modelInvariantId": "4e66bb92-c597-439e-822d-75aaa69b13d4", |
| 82 | "modelVersionId": "3b6ba59c-287c-449e-a1da-2db49984a087", |
| 83 | "modelName": "my_service_VF", |
| 84 | "modelVersion": "1.0", |
| 85 | "modelCustomizationId": "", |
| 86 | "modelCustomizationName": "" |
| 87 | }, |
| 88 | "requestParameters": { |
| 89 | "userParams": [], |
| 90 | "aLaCarte": true, |
| 91 | "testApi": "VNF_API" |
| 92 | }, |
| 93 | "cloudConfiguration": { |
| 94 | "lcpCloudRegionId": "my_cloud_site", |
| 95 | "tenantId": "5906b9b8fd9642df9ba1c9e290063439" |
| 96 | }, |
| 97 | "lineOfBusiness": { |
| 98 | "lineOfBusinessName": "test_LOB" |
| 99 | }, |
| 100 | "platform": { |
| 101 | "platformName": "test_platform" |
| 102 | }, |
| 103 | "relatedInstanceList": [{ |
| 104 | "relatedInstance": { |
| 105 | "instanceId": "95762b50-0244-4723-8fde-35f911db9263", |
| 106 | "modelInfo": { |
| 107 | "modelType": "service", |
| 108 | "modelName": "my-service-model", |
| 109 | "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da", |
| 110 | "modelVersion": "1.0", |
| 111 | "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159" |
| 112 | } |
| 113 | } |
| 114 | }] |
| 115 | } |
| 116 | }' |
| 117 | |
| 118 | To instantiate a VF module, you need to build two complex requests |
| 119 | All necessary parameters are available in the Tosca service template |
| 120 | generated by SDC when you defined your service model. |
| 121 | |
| 122 | 1st request is called a "SDNC-preload" for a VNF object and is used |
| 123 | to store in SDNC some VNF parameters values |
| 124 | that will be used when instantiating |
| 125 | |
| 126 | :: |
| 127 | |
| 128 | curl -X POST \ |
| 129 | http://sdnc.api.simpledemo.onap.org:30202/restconf/operations/VNF-API:preload-vnf-topology-operation \ |
| 130 | -H 'Accept: application/json' \ |
| 131 | -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \ |
| 132 | -H 'Content-Type: application/json' \ |
| 133 | -H 'X-FromAppId: API client' \ |
| 134 | -H 'X-TransactionId: 0a3f6713-ba96-4971-a6f8-c2da85a3176e' \ |
| 135 | -H 'cache-control: no-cache' \ |
| 136 | -d '{ |
| 137 | "input": { |
| 138 | "request-information": { |
| 139 | "notification-url": "onap.org", |
| 140 | "order-number": "1", |
| 141 | "order-version": "1", |
| 142 | "request-action": "PreloadVNFRequest", |
| 143 | "request-id": "test" |
| 144 | }, |
| 145 | "sdnc-request-header": { |
| 146 | "svc-action": "reserve", |
| 147 | "svc-notification-url": "http:\/\/onap.org:8080\/adapters\/rest\/SDNCNotify", |
| 148 | "svc-request-id": "test" |
| 149 | }, |
| 150 | "vnf-topology-information": { |
| 151 | "vnf-assignments": { |
| 152 | "availability-zones": [], |
| 153 | "vnf-networks": [], |
| 154 | "vnf-vms": [] |
| 155 | }, |
| 156 | "vnf-parameters": [], |
| 157 | "vnf-topology-identifier": { |
| 158 | "generic-vnf-name": "my_service_vnf_instance_001", |
| 159 | "generic-vnf-type": "", |
| 160 | "service-type": "95762b50-0244-4723-8fde-35f911db9263", |
| 161 | "vnf-name": "my_service_vfmodule_001", |
| 162 | "vnf-type": "" |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | }' |
| 167 | |
| 168 | The 2nd request id to instantiate the VF module via ONAP SO |
| 169 | (instance name must be identical in both requests) |
| 170 | |
| 171 | :: |
| 172 | |
| 173 | curl -X POST \ |
| 174 | http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/vnfs//vfModules \ |
| 175 | -H 'Accept: application/json' \ |
| 176 | -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \ |
| 177 | -H 'Content-Type: application/json' \ |
| 178 | -H 'X-FromAppId: AAI' \ |
| 179 | -H 'X-TransactionId: get_aai_subscr' \ |
| 180 | -H 'cache-control: no-cache' \ |
| 181 | -d '{ |
| 182 | "requestDetails": { |
| 183 | "requestInfo": { |
| 184 | "instanceName": "my_vfmodule_001", |
| 185 | "source": "VID", |
| 186 | "suppressRollback": false, |
| 187 | "requestorId": "test" |
| 188 | }, |
| 189 | "modelInfo": { |
| 190 | "modelType": "vfModule", |
| 191 | "modelInvariantId": "", |
| 192 | "modelVersionId": "", |
| 193 | "modelName": "", |
| 194 | "modelVersion": "1", |
| 195 | "modelCustomizationId": "", |
| 196 | "modelCustomizationName": "" |
| 197 | }, |
| 198 | "requestParameters": { |
| 199 | "userParams": [], |
| 200 | "testApi": "VNF_API", |
| 201 | "usePreload": true |
| 202 | }, |
| 203 | "cloudConfiguration": { |
| 204 | "lcpCloudRegionId": "my_cloud_site", |
| 205 | "tenantId": "5906b9b8fd9642df9ba1c9e290063439" |
| 206 | }, |
| 207 | "relatedInstanceList": [{ |
| 208 | "relatedInstance": { |
| 209 | "instanceId": "95762b50-0244-4723-8fde-35f911db9263", |
| 210 | "modelInfo": { |
| 211 | "modelType": "service", |
| 212 | "modelName": "my-service-model", |
| 213 | "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da", |
| 214 | "modelVersion": "1.0", |
| 215 | "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159" |
| 216 | } |
| 217 | } |
| 218 | }, |
| 219 | { |
| 220 | "relatedInstance": { |
| 221 | "instanceId": "", |
| 222 | "modelInfo": { |
| 223 | "modelType": "vnf", |
| 224 | "modelName": "my_service_model_VF", |
| 225 | "modelInvariantId": "4e66bb92-c597-439e-822d-75aaa69b13d4", |
| 226 | "modelVersion": "1.0", |
| 227 | "modelVersionId": "3b6ba59c-287c-449e-a1da-2db49984a087", |
| 228 | "modelCustomizationId": "", |
| 229 | "modelCustomizationName": "" |
| 230 | } |
| 231 | } |
| 232 | }] |
| 233 | } |
| 234 | }' |
| 235 | |
| 236 | |
| 237 | |
| 238 | To instantiate a Neutron Network, you need to build two complex request. |
| 239 | All necessary parameters are available in the Tosca service template |
| 240 | generated by SDC when you defined your service model. |
| 241 | |
| 242 | |
| 243 | 1st request is the "SDNC-preload" for a network object: |
| 244 | |
| 245 | :: |
| 246 | |
| 247 | curl -X POST \ |
| 248 | http://sdnc.api.simpledemo.onap.org:30202/restconf/operations/VNF-API:preload-network-topology-operation \ |
| 249 | -H 'Accept: application/json' \ |
| 250 | -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \ |
| 251 | -H 'Content-Type: application/json' \ |
| 252 | -H 'X-FromAppId: API client' \ |
| 253 | -H 'X-TransactionId: 0a3f6713-ba96-4971-a6f8-c2da85a3176e' \ |
| 254 | -H 'cache-control: no-cache' \ |
| 255 | -d '{ |
| 256 | "input": { |
| 257 | "request-information": { |
| 258 | "request-id": "postman001", |
| 259 | "notification-url": "http://so.onap.org", |
| 260 | "order-number": "postman001", |
| 261 | "request-sub-action": "SUPP", |
| 262 | "request-action": "PreloadNetworkRequest", |
| 263 | "source": "postman", |
| 264 | "order-version": "1.0" |
| 265 | }, |
| 266 | "network-topology-information": { |
| 267 | "network-policy": [], |
| 268 | "route-table-reference": [], |
| 269 | "vpn-bindings": [], |
| 270 | "network-topology-identifier": { |
| 271 | "network-role": "integration_test_net", |
| 272 | "network-technology": "neutron", |
| 273 | "service-type": "my-service-2", |
| 274 | "network-name": "my_network_01", |
| 275 | "network-type": "Generic NeutronNet" |
| 276 | }, |
| 277 | "provider-network-information": { |
| 278 | "is-external-network": "false", |
| 279 | "is-provider-network": "false", |
| 280 | "is-shared-network": "false" |
| 281 | }, |
| 282 | "subnets": [ |
| 283 | { |
| 284 | "subnet-name": "my_subnet_01", |
| 285 | "subnet-role": "OAM", |
| 286 | "start-address": "192.168.90.0", |
| 287 | "cidr-mask": "24", |
| 288 | "ip-version": "4", |
| 289 | "dhcp-enabled": "Y", |
| 290 | "dhcp-start-address": "", |
| 291 | "dhcp-end-address": "", |
| 292 | "gateway-address": "192.168.90.1", |
| 293 | "host-routes":[] |
| 294 | } |
| 295 | ] |
| 296 | }, |
| 297 | "sdnc-request-header": { |
| 298 | "svc-action": "reserve", |
| 299 | "svc-notification-url": "http://so.onap.org", |
| 300 | "svc-request-id": "postman001" |
| 301 | } |
| 302 | } |
| 303 | }' |
| 304 | |
| 305 | |
| 306 | 2nd request is to instantiate the network via ONAP SO |
| 307 | (instance name must be identical in both requests) |
| 308 | |
| 309 | |
| 310 | :: |
| 311 | |
| 312 | curl -X POST \ |
| 313 | http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/networks \ |
| 314 | -H 'Accept: application/json' \ |
| 315 | -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \ |
| 316 | -H 'Content-Type: application/json' \ |
| 317 | -H 'X-FromAppId: AAI' \ |
| 318 | -H 'X-TransactionId: get_aai_subscr' \ |
| 319 | -H 'cache-control: no-cache' \ |
| 320 | -d '{ |
| 321 | "requestDetails": { |
| 322 | "requestInfo": { |
| 323 | "instanceName": "my_network_01", |
| 324 | "source": "VID", |
| 325 | "suppressRollback": false, |
| 326 | "requestorId": "demo", |
| 327 | "productFamilyId": "b9ac88f7-0e1b-462d-84ac-74c3c533217c" |
| 328 | }, |
| 329 | "modelInfo": { |
| 330 | "modelType": "network", |
| 331 | "modelInvariantId": "0070b65c-48cb-4985-b4df-7c67ca99cd95", |
| 332 | "modelVersionId": "4f738bed-e804-4765-8d22-07bb4d11f14b", |
| 333 | "modelName": "Generic NeutronNet", |
| 334 | "modelVersion": "1.0", |
| 335 | "modelCustomizationId": "95534a95-dc8d-4ffb-89c7-091e2c49b55d", |
| 336 | "modelCustomizationName": "Generic NeutronNet 0" |
| 337 | }, |
| 338 | "requestParameters": { |
| 339 | "userParams": [], |
| 340 | "aLaCarte": true, |
| 341 | "testApi": "VNF_API" |
| 342 | }, |
| 343 | "cloudConfiguration": { |
| 344 | "lcpCloudRegionId": "my_cloud_site", |
| 345 | "tenantId": "5906b9b8fd9642df9ba1c9e290063439" |
| 346 | }, |
| 347 | "lineOfBusiness": { |
| 348 | "lineOfBusinessName": "Test_LOB" |
| 349 | }, |
| 350 | "platform": { |
| 351 | "platformName": "Test_platform" |
| 352 | }, |
| 353 | "relatedInstanceList": [{ |
| 354 | "relatedInstance": { |
| 355 | "instanceId": "95762b50-0244-4723-8fde-35f911db9263", |
| 356 | "modelInfo": { |
| 357 | "modelType": "service", |
| 358 | "modelName": "my_service_model_name", |
| 359 | "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da", |
| 360 | "modelVersion": "1.0", |
| 361 | "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159" |
| 362 | } |
| 363 | } |
| 364 | }] |
| 365 | } |
| 366 | }' |