Fix docs issues
[so.git] / docs / developer_info / BPMN-INFRA_Workflow_Understanding.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2017 Huawei Technologies Co., Ltd.
4
5 CODE FLOWS OF BPMN-INFRA
6 ========================
7
8 API Handler is a SO Component. Every Rest API will first reach to the API Handler. Curl command which is mentioned below will directly hit to the E2EServiceInstances.java file of the API Handler component.
9
10 API HANDLER ( E2EServiceInstances.java )
11 ----------------------------------------
12
13 curl -v -H "Content-Type: application/json" -X POST --data @request_body_file_name.json -u mso_admin:password1$ http://localhost:8080/onap/so/infra/e2eServiceInstances/v3
14
15 .. code-block:: bash
16
17  Request Body:
18
19      {
20     "service":{
21        "name":"SliceService",
22        "description":"SliceService",
23        "serviceInvariantUuid":"dfcd7471-16c7-444e-8268-d4c50d90593a",
24        "serviceUuid":"dfcd7471-16c7-444e-8268-d4c50d90593a",
25        "globalSubscriberId":"test_custormer",
26        "serviceType":"embb",
27        "parameters":{
28            "locationConstraints":[
29            ],
30            "resources":[
31                {
32                    "resourceIndex":"1",
33                    "resourceName":"allottedResource",
34                    "resourceInvariantUuid":"eeefcd86-7b5b-41ae-9516-08acc5d59d92",
35                    "resourceUuid":"265da937-76c7-4152-98e3-5f0d0a844b7f",
36                    "resourceCustomizationUuid":"a4eda1d9-1af4-424b-997f-12c57b74c67a",
37                    "parameters":{
38                        "locationConstraints":[
39                        ],
40                        "resources":[
41                        ],
42                        "requestInputs":{
43                    }
44                    }
45                }
46            ],
47            "requestInputs":{
48                            "sST": "embb",
49                "sNSSAI": "1-10101",
50                "uEMobilityLevel": "stationary",
51                "areaTrafficCapDL": 123,
52                "maxNumberofUEs": 1000,
53                "expDataRateUL": 2000,
54                "plmnIdList": "39-00|39-01",
55                "areaTrafficCapUL": 456,
56                "latency": 300,
57                "expDataRateDL": 400,
58                "coverageAreaTAList": 101001,
59                "activityFactor": 99,
60                "resourceSharingLevel": "shared",
61               "nstar0_allottedresource0_providing_service_uuid": "4e8d930b-7483-4b9b-8c82-4708638ade4a",
62               "nstar0_allottedresource0_providing_service_invariant_uuid": "1899e5c1-df4e-43a8-a889-48c157dad7bc"
63            }
64        }
65     }
66
67 .. code-block:: bash
68
69  Response body:
70  
71     {
72     "service": { 
73         "serviceId": "ebe2d37f-f65b-43d8-8906-f81811ed8f22",
74         "operationId": "ed9b4c84-17db-4874-8896-25324a0401fe"
75       }
76     }
77
78
79 Code flows:
80 -----------
81 1. It reaches to the E2EServiceInstances.java file of API-Handeler infra project and Input json is mapped to the createE2EServiceInstance method
82
83 2. A unique request id is generated corresponding to every request and checked if request Id already exists in requestdb 
84    InfraActiveReqest table
85
86  a. http://request-db-adapter:8083/infraActiveRequests/requestID (GET), which will return a 404 if not exists
87  b. createInstance is set to the action variable
88
89 3. Running local validations on input json.
90
91 4. Gets the orchestration url from the recipe table
92
93  a. Checks whether the service already exists in catalogdb http://catalog-db-adapter:8082/service/{modelNameVersionId} 
94  (GET)
95
96  b. Checks the service recipe table with the modelNameVersionId and the action to be perfomed http://catalog-db- 
97  adapter:8082/serviceRecipe/search/findFirstByServiceModelUUIDAndAction?serviceModelUUID= 
98  {modelNameVersionId}&action=createInstance . Returns a 404 if no recipe exists with the corresponding id.
99  
100  c. As recipe corresponding to this doesnt exist, we try to get with a default value. This flow comes under default flow 
101  so the defaultvalue is UUI_DEFAULT. First we get service with this value
102  http://catalog-db-adapter:8082/service/search/findFirstByModelNameOrderByModelVersionDesc?modelName=UUI_DEFAULT (GET) . 
103  It returns a service with modelUUID as dfcd7471-16c7-444e-8268-d4c50d90593a, and further can be used to get the recipe 
104  .
105  
106  d. http://so-catalog-db-adapter.onap:8082/serviceRecipe/search/findFirstByServiceModelUUIDAndAction? 
107  serviceModelUUID=dfcd7471-16c7-444e-8268-d4c50d90593a&action=createInstance gives a recipe which has a parameter 
108  "orchestrationUri" as "/mso/async/services/CreateCustomE2EServiceInstance" 
109
110
111
112 BPMN-INFRA
113 ----------
114
115 Hits CreateCustomE2EServiceInstances
116
117 Address: http://bpmn-infra:8081/mso/async/services/CreateCustomE2EServiceInstance
118
119 Payload will be reaching to bpmn in the form of:
120
121 .. code-block:: bash
122
123     {
124     "variables": {
125       "bpmnRequest": {
126          "value": {
127             "requestDetails": {
128                "modelInfo": {
129                   "modelInvariantId": "699dd37d-c82f-4bd5-adec-856900fc2796",
130                   "modelType": "service",
131                   "modelNameVersionId": "0692e0c9-8913-41ca-893a-58626f4afff2",
132                   "modelName": "voLTE",
133                   "modelVersion": "1.0",
134                   "modelVersionId": "0692e0c9-8913-41ca-893a-58626f4afff2",
135                   "modelUuid": "0692e0c9-8913-41ca-893a-58626f4afff2",
136                   "modelInvariantUuid": "699dd37d-c82f-4bd5-adec-856900fc2796"
137                },
138                "requestInfo": {
139                   "source": "UUI",
140                   "instanceName": "SliceService",
141                   "suppressRollback": true
142                },
143                "subscriberInfo": {
144                   "globalSubscriberId": "test_custormer"
145                },
146                "requestParameters": {
147                   "subscriptionServiceType": "MOG",
148                   "userParams": [
149                      {
150                         "ServiceInstanceName": "SliceService",
151                         "UUIRequest": {
152                            "service": {
153                               "name": "SliceService",
154                               "description": "SliceService",
155                               "serviceInvariantUuid": "699dd37d-c82f-4bd5-adec-856900fc2796",
156                               "serviceUuid": "0692e0c9-8913-41ca-893a-58626f4afff2",
157                               "globalSubscriberId": "test_custormer",
158                               "serviceType": "embb",
159                               "parameters": {
160                                  "locationConstraints": [],
161                                  "resources": [
162                                     {
163                                        "resourceIndex": "1",
164                                        "resourceName": "allottedResource",
165                                        "resourceInvariantUuid": "eeefcd86-7b5b-41ae-9516-08acc5d59d92",
166                                        "resourceUuid": "265da937-76c7-4152-98e3-5f0d0a844b7f",
167                                        "resourceCustomizationUuid": "a4eda1d9-1af4-424b-997f-12c57b74c67a",
168                                        "parameters": {
169                                           "locationConstraints": [],
170                                           "resources": [],
171                                           "requestInputs": {}
172                                        }
173                                     }
174                                  ],
175                                  "requestInputs": {
176                                     "sST": "embb",
177                                     "sNSSAI": "1-10101",
178                                     "uEMobilityLevel": "stationary",
179                                     "areaTrafficCapDL": 123,
180                                     "maxNumberofUEs": 1000,
181                                     "expDataRateUL": 2000,
182                                     "plmnIdList": "39-00|39-01",
183                                     "areaTrafficCapUL": 456,
184                                     "latency": 300,
185                                     "expDataRateDL": 400,
186                                     "coverageAreaTAList": 101001,
187                                     "activityFactor": 99,
188                                     "resourceSharingLevel": "shared",
189                                     "nstar0_allottedresource0_providing_service_uuid": "4e8d930b-7483-4b9b-8c82-4708638ade4a",
190                                     "nstar0_allottedresource0_providing_service_invariant_uuid": "1899e5c1-df4e-43a8-a889-48c157dad7bc"
191                                  }
192                               }
193                            }
194                         }
195                      }
196                   ],
197                   "aLaCarte": true,
198                   "usePreload": true
199                }
200             },
201             "serviceInstanceId": null,
202             "vnfInstanceId": null,
203             "pnfName": null,
204             "networkInstanceId": null,
205             "volumeGroupInstanceId": null,
206             "vfModuleInstanceId": null,
207             "configurationId": null,
208             "instanceGroupId": null
209          },
210          "type": "String"
211       },
212       "requestId": {
213          "value": "6fa42cd2-4f49-4e2c-92fb-fae133277e9e",
214          "type": "String"
215       },
216       "mso-request-id": {
217          "value": "6fa42cd2-4f49-4e2c-92fb-fae133277e9e",
218          "type": "String"
219       },
220       "isBaseVfModule": {
221          "value": false,
222          "type": "Boolean"
223       },
224       "recipeTimeout": {
225          "value": 180,
226          "type": "Integer"
227       },
228       "requestAction": {
229          "value": "createInstance",
230          "type": "String"
231       },
232       "serviceInstanceId": {
233          "value": "",
234          "type": "String"
235       },
236       "pnfCorrelationId": {
237          "value": "",
238          "type": "String"
239       },
240       "vnfId": {
241          "value": "",
242          "type": "String"
243       },
244       "vfModuleId": {
245          "value": "",
246          "type": "String"
247       },
248       "volumeGroupId": {
249          "value": "",
250          "type": "String"
251       },
252       "networkId": {
253          "value": "",
254          "type": "String"
255       },
256       "configurationId": {
257          "value": "",
258          "type": "String"
259       },
260       "serviceType": {
261          "value": "embb",
262          "type": "String"
263       },
264       "vnfType": {
265          "value": "",
266          "type": "String"
267       },
268       "vfModuleType": {
269          "value": "",
270          "type": "String"
271       },
272       "networkType": {
273          "value": "",
274          "type": "String"
275       },
276       "recipeParams": {
277          "value": null,
278          "type": "String"
279       },
280       "host": {
281          "value": null,
282          "type": "String"
283       },
284       "operationType": {
285          "value": "",
286          "type": "String"
287       },
288       "apiVersion": {
289          "value": "v3",
290          "type": "String"
291       },
292       "aLaCarte": {
293          "value": false,
294          "type": "Boolean"
295       },
296       "requestUri": {
297          "value": "",
298          "type": "String"
299       },
300       "instanceGroupId": {
301          "value": "",
302          "type": "String"
303       },
304       "generateIdsOnly": {
305          "value": false,
306          "type": "Boolean"
307       }
308      }
309     }
310
311 Based on the serviceUuid which is mentioned in the request body it will call the the CreateCommunicationService.bpmn file and This CreateCommunicationService.bpmn is taken as a example to this workflow Understanding which then call the subprocess of this flow and so on.
312
313 .. image:: ../images/CreateCommunicationService.png
314
315 1. CreateCommunicationService -> preProcessRequest()
316
317  a. Get Input Request will be logged as shown above
318  b. Get Request ID
319  c. Here ServiceInstanceId is null so serviceInstanceId is generated randomly.
320  d. Input productFamilyId is null
321  e. Now it will get the user input parameter from the request json.
322
323
324 2. CreateCommunicationService--> prepareInitOperationStatus
325
326  a. Generate a new operation based on serviceInstanceId and operationId
327  b. call to prepareUpdateOperationStatus() method
328
329 3. RequestDBUtil--> prepareUpdateOperationStatus()
330
331  a. This method will be called to update the operation status in the requestDB
332  b. Exit prepareUpdateOperationStatus()
333  c. Exit prepareInitOperationStatus()
334
335 4. Based on the bpmn structure DecomposeService class is called 
336
337  a. This class takes input as 
338
339   - msoRequestId
340   - isDebugLogEnabled
341   - serviceInstanceId
342   - serviceModelInfo
343   - requestParameters
344  
345  b. Sent GET request to catalogdb to fetch the data based on serviceModelInvariantId and modelVersion
346     http://so-catalog-db-adapter.onap:8082/ecomp/mso/catalog/v2/{serviceModelUuid}
347  
348  c. Response from catalogdb will be looking like:
349
350 .. code-block:: bash
351
352     {
353     "serviceResources": {
354       "modelInfo": {
355          "modelName": "CST",
356          "modelUuid": "bfc2775b-64ad-41e5-95fe-d3bc57df6c73",
357          "modelInvariantUuid": "d4df55ca-c985-46c9-8088-f952181f553e",
358          "modelVersion": "1.0"
359       },
360       "serviceType": "embb",
361       "serviceRole": "",
362       "environmentContext": "General_Revenue-Bearing",
363       "resourceOrder": "ServiceProfile Service Proxy",
364       "workloadContext": "Production",
365       "serviceVnfs": [],
366       "serviceNetworks": [],
367       "serviceInfo": {
368          "id": 11,
369          "serviceInput": [
370             {
371                "default": true,
372                "name": "skip_post_instantiation_configuration",
373                "type": "boolean",
374                "required": false
375             },
376             {
377                "default": "",
378                "name": "useInterval",
379                "type": "string",
380                "required": false
381             },
382             {
383                "default": "SO-REF-DATA",
384                "name": "controller_actor",
385                "type": "string",
386                "required": false
387             },
388             {
389                "default": "",
390                "name": "maxNumberofUEs",
391                "type": "integer",
392                "required": false
393             },
394             {
395                "default": "",
396                "name": "latency",
397                "type": "integer",
398                "required": false
399             },
400             {
401                "default": "",
402                "name": "cds_model_version",
403                "type": "string",
404                "required": false
405             },
406             {
407                "default": "",
408                "name": "uEMobilityLevel",
409                "type": "string",
410                "required": false
411             },
412             {
413                "default": "",
414                "name": "cds_model_name",
415                "type": "string",
416                "required": false
417             },
418             {
419                "default": "",
420                "name": "expDataRateUL",
421                "type": "integer",
422                "required": false
423             },
424             {
425                "default": "",
426                "name": "expDataRateDL",
427                "type": "integer",
428                "required": false
429             },
430             {
431                "default": "",
432                "name": "coverageAreaList",
433                "type": "string",
434                "required": false
435             },
436             {
437                "default": "",
438                "name": "resourceSharingLevel",
439                "type": "string",
440                "required": false
441             }
442          ],
443          "serviceProperties": [
444             {
445                "default": true,
446                "name": "skip_post_instantiation_configuration",
447                "type": "boolean",
448                "constraints": [
449                   {
450                      "valid_values": [
451                         true,
452                         false
453                      ]
454                   }
455                ]
456             },
457             {
458                "default": "SO-REF-DATA",
459                "name": "controller_actor",
460                "type": "string",
461                "constraints": [
462                   {
463                      "valid_values": [
464                         "SO-REF-DATA",
465                         "CDS",
466                         "SDNC",
467                         "APPC"
468                      ]
469                   }
470                ]
471             },
472             {
473                "name": "maxNumberofUEs",
474                "type": "integer",
475                "required": false
476             },
477             {
478                "name": "latency",
479                "type": "integer",
480                "required": false
481             },
482             {
483                "name": "expDataRateUL",
484                "type": "integer",
485                "required": false
486             },
487             {
488                "name": "sNSSAI",
489                "type": "string",
490                "required": false
491             },
492             {
493                "name": "useInterval",
494                "type": "string",
495                "required": false
496             },
497             {
498                "default": "39-00",
499                "name": "plmnIdList",
500                "type": "string",
501                "required": false
502             },
503             {
504                "name": "cds_model_version",
505                "type": "string"
506             },
507             {
508                "name": "uEMobilityLevel",
509                "type": "string",
510                "required": false
511             },
512             {
513                "name": "cds_model_name",
514                "type": "string"
515             },
516             {
517                "name": "expDataRateDL",
518                "type": "integer",
519                "required": false
520             },
521             {
522                "name": "coverageAreaList",
523                "type": "string",
524                "required": false
525             },
526             {
527                "name": "resourceSharingLevel",
528                "type": "string",
529                "required": false
530             }
531          ],
532          "serviceArtifact": []
533       },
534       "serviceProxy": [
535          {
536             "modelInfo": {
537                "modelName": "ServiceProfile Service Proxy",
538                "modelUuid": "ed00301c-51ec-46a4-b766-e3af50c210d2",
539                "modelInvariantUuid": "071d426c-3f9b-44a9-9757-422043d80fc1",
540                "modelVersion": "1.0",
541                "modelCustomizationUuid": "81c5a468-37d3-4d8d-95f5-e72b0933d3d4",
542                "modelInstanceName": "serviceprofile_proxy 0"
543             },
544             "toscaNodeType": "org.openecomp.nodes.serviceprofile_proxy",
545             "description": "A Proxy for Service ServiceProfile",
546             "sourceModelUuid": "94553b32-e075-4cb0-b309-dd318ebbf670"
547          }
548       ],
549       "serviceAllottedResources": []
550      }
551     }
552
553 5. CreateCommunicationService--> prepareDoComposeE2E()
554
555  a. To decompose the service based on serviceModelUuid
556
557 6. CreateCommunicationService--> parseCSParamsFromReq()
558
559  a. To parse the CreateCommunication parameter Request from the Request json
560
561 7. Now sending PUT request to AAI based on globalSubscriberId and serviceType
562
563  a. https://aai.onap:8443/aai/v19/business/customers/customer/{globalSubscriberId}/service-subscriptions/service- 
564     subscription/{seviceType}/service-instances/service-instance/{serviceInstanceId}
565
566  b. Customer can be got by GET request with  
567     https://aai.onap:8443/aai/v19/business/customers/customer/{globalSubscriberId}
568
569  c. Service-Subscription can be got by GET request with 
570     https://aai.onap:8443/aai/v19/business/customers/customer/{globalSubscriberId}/service-subscriptions/service- 
571     subscription/{seviceType}
572  
573  d. Request body for PUT request to the AAI from bpmn:
574
575     {
576        "service-instance-name": "SliceService",
577        "service-role": "communication-service",
578        "environment-context": "01-70CAA6B",
579        "created-at": "2020-06-23 05:02:56",
580        "model-invariant-id": "d4df55ca-c985-46c9-8088-f952181f553e",
581        "model-version-id": "bfc2775b-64ad-41e5-95fe-d3bc57df6c73",
582        "orchestration-status": "processing",
583        "input-parameters": "{   \"service\":{       \"name\":\"SliceService\",       \"description\":\"SliceService\",       \"serviceInvariantUuid\":\"d4df55ca-c985-46c9-8088-f952181f553e\",       \"serviceUuid\":\"bfc2775b-64ad-41e5-95fe-d3bc57df6c73\",       \"globalSubscriberId\":\"5GCustomer\",       \"serviceType\":\"5G\",       \"parameters\":{           \"locationConstraints\":[           ],           \"resources\":[               {                   \"resourceIndex\":\"1\",                   \"resourceName\":\"allottedResource\",                   \"resourceInvariantUuid\":\"eeefcd86-7b5b-41ae-9516-08acc5d59d92\",                   \"resourceUuid\":\"265da937-76c7-4152-98e3-5f0d0a844b7f\",                   \"resourceCustomizationUuid\":\"a4eda1d9-1af4-424b-997f-12c57b74c67a\",                   \"parameters\":{                       \"locationConstraints\":[                       ],                       \"resources\":[                       ],                       \"requestInputs\":{                       }                   }               }           ],           \"requestInputs\":{\t\t\t   \"sST\": \"embb\",               \"sNSSAI\": \"1-10101\",               \"uEMobilityLevel\": \"stationary\",               \"areaTrafficCapDL\": 123,               \"maxNumberofUEs\": 1000,               \"expDataRateUL\": 2000,               \"plmnIdList\": \"39-00|39-01\",               \"areaTrafficCapUL\": 456,               \"latency\": 300,               \"expDataRateDL\": 400,               \"coverageAreaTAList\": 101001,               \"activityFactor\": 99,               \"resourceSharingLevel\": \"shared\",              \"nstar0_allottedresource0_providing_service_uuid\": \"4e8d930b-7483-4b9b-8c82-4708638ade4a\",              \"nstar0_allottedresource0_providing_service_invariant_uuid\": \"1899e5c1-df4e-43a8-a889-48c157dad7bc\"           }       }   }}"
584     
585     }
586
587 Response: Response is returned with an empty entity
588
589
590  e. Sending PUT request to the AAI for communication service profile  
591
592 https://aai.onap:8443/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/8a95e3ac-32cd-4ffb-b9e3-5366b393a7a2/communication-service-profiles/communication-service-profile/202a5e9a-d1d7-4afd-922f-3e7a709c780c
593
594 payload:
595
596     {"profile-id":"202a5e9a-d1d7-4afd-922f-3e7a709c780c","max-number-of-UEs":1000,"latency":300,"exp-data-rate-UL":2000,"exp-data-rate-DL":400,"ue-mobility-level":"stationary","resource-sharing-level":"shared"}
597
598 Response: Response is returned with an empty entity
599
600 8. CreateCommunicationService--> sendSyncResponse()
601
602  a. Send a response to the API-Handler
603
604  b. Response Body:
605
606 .. code-block:: json
607
608     {
609       "service": {
610           "serviceId":"8a95e3ac-32cd-4ffb-b9e3-5366b393a7a2",
611           "operationId":"a970a804-7ac5-4de9-b6db-17352afbc6fa"
612       }
613     }
614
615 9. CreateCommunicationService--> generateE2EServiceProfile()
616
617  a. It gets the E2E service templete Id and change communication profile to E2E service profile
618  b. Basically it generates the E2E service profile
619
620 10. CreateCommunicationService--> preRequestSend2NSMF()
621
622  a. It sets the payload to send to the other bpmn file 
623
624 11. Here based on the CreateCommunicationService bpmn structure required bpmn file will be called and corresponding to
625  
626     this bpmn, groovy file will be called. For example, Here CreateSliceService.groovy is being called.
627
628 12. CreateCommunicationService--> processNSMFResponse()
629
630  a. It processes the NSMF response code which was returned from other groovy file
631
632 13. CreateCommunicationService--> createCSAndSSRelationship()
633
634  a. It will create relationship between communication service and e2e service
635
636 14. CreateCommunicationService--> createRelationShipInAAI()
637
638  a. Sending a PUT request to make a relationship between two services 
639     https://aai.onap:8443/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service- 
640     subscription/5G/service-instances/service-instance/8a95e3ac-32cd-4ffb-b9e3-5366b393a7a2/relationship- 
641     list/relationship
642
643 b. Request body:
644     
645     {
646     "related-link":"aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service- 
647     subscription/5G/service-instances/service-instance/2e6c2d7f-85c0-4b1f-b7fd-5f2364c27ea7"
648     }
649
650 15. CreateCommunicationService--> prepareUpdateOperationStatus()
651
652  a. prepare update operation status after create relationship in aai
653
654 16. RequestDBUtil--> prepareUpdateOperationStatus()
655
656  a. update operation status in requestDB
657
658  b. DB Adapter Endpoint is: http://so-request-db-adapter.onap:8083/services/RequestsDbAdapter