Merge "Fix typo DESACTIVATE to DEACTIVATE"
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>
Wed, 19 May 2021 20:51:13 +0000 (20:51 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 19 May 2021 20:51:13 +0000 (20:51 +0000)
14 files changed:
docs/developer_info/BBUnderstanding.rst
docs/developer_info/ETSI_NFVO_Network_Service_LCM_Setup_Guide.rst [new file with mode: 0644]
docs/developer_info/ETSI_VNF_LCM_Setup_Guide.rst [new file with mode: 0644]
docs/developer_info/SO_Admin_Cockpit_User_Guide.rst [new file with mode: 0644]
docs/images/abort.png [new file with mode: 0644]
docs/images/handling_error.png [new file with mode: 0644]
docs/images/rainy_day_handler_macro_table.png [new file with mode: 0644]
docs/images/retry.png [new file with mode: 0644]
docs/images/retry2.png [new file with mode: 0644]
docs/images/retry3.png [new file with mode: 0644]
docs/images/retry_Bdd.png [new file with mode: 0644]
docs/images/retry_Bdd2.png [new file with mode: 0644]
docs/images/rollback.png [new file with mode: 0644]
docs/images/rollback_Bdd.png [new file with mode: 0644]

index 6e96e5d..a4984d3 100644 (file)
-.. This work is licensed under a Creative Commons Attribution 4.0 International License.\r
-.. http://creativecommons.org/licenses/by/4.0\r
-.. Copyright 2018 Huawei Technologies Co., Ltd.\r
-\r
-Building Block Understanding\r
-============================\r
-\r
-UNDERSTANDING BUILDING BLOCKS USING MACRO FLOW\r
-----------------------------------------------\r
-\r
-\r
-\r
-There are basically 2 flows - macro , a la carte.\r
-\r
-In a la carte we manually will initiate each step for a process.\r
-\r
-In macro , the whole flow happens at a single click - like if we want to create a service, the flow will itself look whether there are vnfs, pnfs or networks in the service and it will be created and activated in the flow also.\r
-\r
-Thus these independent tasks like if vnf is present, then assign create and activate vnf are all taken up as individual building blocks and are only called on need basis.\r
-\r
-\r
-Each and every request will reach to the api handler first.\r
-\r
-API HANDLER( ServiceInstances.java )\r
-------------------------------------\r
-\r
-\r
-\r
-# 1. Rest call reaching SO Api handler with the input json - According to the below path it is mapped to the createServiceInstance function in ServiceInstances file.\r
-\r
-curl -v -H "Content-Type: application/json" -X POST --data @serviceinstance.json -u mso_admin:password1$ http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances.\r
-\r
-# 2. Herein a unique requestid is generated corresponding to every request, and is checked whether that particular requestid exists in request db (Happens in createServiceInstance in ServiceInstances).\r
-\r
- a. http://request-db-adapter:8083/infraActiveRequests/requestid (GET), which will return a 404 if not exists.\r
-\r
- b. CreateInstance is set to the action variable. Here the request scope is set to service from the inputjson - modelType.\r
-\r
-# 3. Running local validations on input json.\r
-\r
-# 4. create InfraActiveRequests, to store request details in request db adapter and as a payload to bpmn.\r
-\r
- a. A new InfraActiveRequests object is created. And all the necessary information from the input is set to it.\r
-\r
- b. Retrieving productFamilyName from the input json to put into requests db. http://aai/servicedesigncreation/services/service/{productfamilyid} (GET), which will return a 404 if not exists in aai. If service exists, then that service's serviceDescritiption is set as productfamilyName.\r
-\r
- c. http://aai/cloudinfrastructure/cloudregions/cloudregion/cloudowner/{lcpCloudRegionId}/tenants/tenant/{tenantId} (GET), checks for whether the particular cloud configuration exists in aai, if not exists returns 404.  If we are able to get, then the tenant's name derived from aai is set as tenantName.\r
-\r
- d. serviceInstanceNamee is derived from requestInfo.instanceName and is set.\r
-\r
- e. Request json is also set as RequestBody of InfraActiveRequests.\r
-\r
-# 5. Checks fro whether duplicate name exists.\r
-\r
- a. version v[integer] is converted to the particular integer and stored.\r
-\r
- b. Checks whether instance name already exists in with a POST request in http://request-db-adapter:8083/infraActiveRequests/checkInstanceNameDuplicate, with the data { instanceIdmap = null, instanceName = {instanceName} , instanceservice = service } . It checks for the current progress and if in progress it throws the particular status.\r
-\r
-# 6. Gets the orchestration url from the recipe table.\r
-\r
- a. Checks whether the service already exists in catalogdb http://catalog-db-adapter:8082/service/{modelNameVersionId} (GET).\r
-\r
- b. Checks the service recipe table with the modelNameVersionId and the action to be performed http://catalog-db-adapter:8082/serviceRecipe/search/findFirstByServiceModelUUIDAndAction?serviceModelUUID={modelNameVersionId}&action=createInstance . Returns a 404 if no recipe exists with the corresponding id.\r
-\r
- c. As recipe corresponding to this doesn't exist, we try to get with a default value. This flow comes under generic resource flow so the default value is GR-API-DEFAULT. First we get service with this value http://catalog-db-adapter:8082/service/search/findFirstByModelNameOrderByModelVersionDesc?modelName=GR-API-DEFAULT (GET). It returns a service with modelUUID as d88da85c-d9e8-4f73-b837-3a72a431622b, and further can be used to get the recipe.\r
\r
- d. http://catalog-db-adapter:8082/serviceRecipe/search/findFirstByServiceModelUUIDAndAction?serviceModelUUID=d88da85c-d9e8-4f73-b837-3a72a431622b&action=createInstance (GET), gives a recipe which has a parameter "orchestrationUri" as "/mso/async/services/WorkflowActionBB". \r
-\r
-# 7. Updates the infraActiveRequests with the current request.\r
- a. http://request-db-adapter:8083/infraActiveRequests/ (POST) with the data formed. And a 201 created response is received.\r
-\r
-# 8. Call the bpmn with a post call on orchestrationUri. The data to bpmn is prepared having parameters like \r
- a. bpmnRequest - formed from input request.\r
-\r
- b. vfModuleId, pnfCorrelationId, networkId, configurationId, vfModuleType, serviceInstanceId , serviceType are updated if present in the input json or else set to empty string.\r
-\r
- c. apiVersion , requestId, aLaCarte = false (def), recipeTimeout = 180(def), requestAction= createInstance are all updated accordingly.\r
-\r
- d. requestUri - v7/serviceInstances ,which is formed from the request url.\r
-\r
-\r
-# 9. A sync response is obtained on reaching bpmn like {"requestReferences":{"requestId":"c45702f7-3f08-4081-bc98-2f9f18b81607","instanceId":"cadca18f-9bff-44be-8910-ad29d342e91f","requestSelfLink":"http://159.138.57.166:30277/orchestrationRequests/v7/c45702f7-3f08-4081-bc98-2f9f18b81607"}}.\r
-\r
-\r
-\r
-\r
-\r
-\r
-BPMN\r
------\r
-\r
-\r
-Hits WorkflowActionBB.bpmn\r
---------------------------\r
-\r
-.. image:: ../images/workflow.png\r
-\r
-\r
-# 1. RetrieveBBExecutionList - implemented in selectExecutionList in WorkflowAction.java\r
-\r
-a. resourcetype, resourceid are formed from matching the requestUri to a regex pattern matcher [pattern=[vV]\d+.*?(?:(?:/(?<type>vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups)(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?(?:/resume)?)] .\r
-\r
-b. Checks whether there is a service subscription with service instance name as {instanceName} correspoding to the customer in aai https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances?depth=2&resultIndex=0&resultSize=1&service-instance-name={instanceName}. Returns 404 not found, if it doesnt exists then the id of that particular instance is taken and given as both the resourceid and serviceinstance id. If not present then a random value is generated, and is assigned same to both.\r
-\r
-c. Checks whether there is a service of the particular serviceInstanceId exists in aai. https://aai.onap:8443/aai/v19/nodes/service-instances/service-instance/{serviceInstanceId} , returns not found if it doesnt exist. If service with corresponding instance name already exists , then flowsToExecute is got by quering the requestdbadapter with the earlier request id.  If not present, then only orchestrationflows are got, and later from that the flowsToExecute are found out.\r
-\r
-d. Get the particular service from catalogdb . http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}  (GET). Be sure that the service with this particular modelNameVersionId exists in catalogdb, because based on the services (like whether pnf, or vnf, or networkcollection) present in that particular service, which all bbs to execute are decided.\r
-\r
-e. This being a service, "service" is added to the resource list. And is checked upon for other resources like vnf and   network, eg:\r
-\r
- http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}/vnfCustomizations (GET)\r
- http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}/collectionResourceCustomizations (GET)\r
- http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}/networkCustomizations (GET)\r
- And depending on the reources in the service, the resources found is updated like\r
- Found :Service - 1    Vnf - 0    Pnf - 0    VfModule - 0    VolumeGroup - 0    Network - 0    VirtualLink - 0    NetworkCollection - 0    Configuration - 0    InstanceGroup - 0 \r
-\r
-f. Then the orchestration flows are get from the orchestration_flow_table depending on the cloudowner and request scope: http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/search/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType action=createInstance&requestScope=Service&isALaCarte=false&cloudOwner={CloudOwner}&serviceType=%2A (GET) Here if present, then the orchestration flows are returned or else with default cloud owner, we try again\r
-\r
-http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/search/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType?action=createInstance&requestScope=Service&isALaCarte=false&cloudOwner=DEFAULT&serviceType=%2A (GET)\r
-Here in northBoundRequest is returned which has the parameter orchestrationFlowList, that contains the link that will return the orchestration flows.\r
-\r
-"orchestrationFlowList" : { "href" : "http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/101/orchestrationFlowList"} \r
-\r
-Now we do a get on the orchestration flow link to get the set of orchestartion flows required\r
-http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/101/orchestrationFlowList.\r
-Here a set of 20 orchestration flows are returned under the action of Service-Macro-Create, each with a sequence no assigned sequentially in the given order\r
-AssignServiceInstanceBB, \r
-\r
-CreateNetworkCollectionBB,\r
-\r
-AssignNetworkBB,\r
-\r
-AssignVnfBB, \r
-\r
-AssignVolumeGroupBB,\r
-\r
-AssignVfModuleBB,\r
-\r
-ConfigAssignVnfBB,\r
-\r
-AssignPnfBB, \r
-\r
-WaitForPnfReadyBB,\r
-\r
-ActivatePnfBB,\r
-\r
-CreateNetworkBB,\r
-\r
-ActivateNetworkBB,\r
-\r
-CreateVolumeGroupBB, \r
-\r
-ActivateVolumeGroupBB, \r
-\r
-CreateVfModuleBB,\r
-\r
-ActivateVfModuleBB, \r
-\r
-ConfigDeployVnfBB,\r
-\r
-ActivateVnfBB, \r
-\r
-ActivateNetworkCollectionBB,\r
-\r
-ActivateServiceInstanceBB.\r
-\r
-\r
-.. image:: ../images/flowchart.png\r
-\r
-\r
-g. Flows to execute is determined by iterating through all the orchestartion flows and matching it with the found resources. It is merely a contains matching. In this particular as service was the only resource : List of BuildingBlocks to execute:AssignServiceInstanceBB, ActivateServiceInstanceBB.\r
-\r
-h. processing data is added to the requestdbadapter. Here the data is post to the requestdb as two different building blocks http://so-request-db-adapter.onap:8083/requestProcessingData.\r
-\r
-i. The already stored request details in request db is ammended like "lastModifiedBy" : "CamundaBPMN" , and status to in_progress with a put request.\r
-\r
-\r
-# 2. sendSyncAck -  This was used to give an acknowledgement , with status code as 200, and requestId and resourceId is sent as content.\r
-\r
-\r
-# 3. Prevalidate the workflow\r
-\r
-\r
-# 4. SelectBB - implemented in selectBBin WorkflowActionBBTasks\r
-This is used to select the building block from the flows to execute depending on the sequence order.\r
-\r
- a. Depending on the current sequence , the building block is selected from the flows to execute.\r
\r
- b. Execution variable, that is passed between the different building blocks as the payload is ammended as:\r
-\r
-  execution.setVariable("buildingBlock", buildingblockselected).\r
-\r
- c. current sequence is incremented by 1, and updated in execution variable.\r
-\r
- d. Depending on whether currentSequence is greater than flowsToExecute.size(), COMPLETED variable is either set to true or false.\r
-\r
-\r
-# 5. updateFlowStatistics - implemented in updateFlowStatistics in WorkflowActionBBTasks\r
-a. Depending on the current sequence no, the completed bb and next bb is got from the flows to execute. And these are mentioned in a statusMessage.\r
-b. Percentage progress is got from the total no of bbs\r
-c. These are ammended to the already present request in the request db\r
-\r
-# 6. Execute BB - calls the ExecuteBuildingBlock.bpmn\r
-\r
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r
-\r
-Hits ExecuteBuildingBlock.bpmn\r
-------------------------------\r
-\r
-.. image:: ../images/ExecuteBuildingBlock.png\r
-\r
-# 1. BBInputSetup - implemented in execute in BBInputSetup\r
-Here a generalbuildingblock is formed from executingbuildingblock after certain updations and validations.\r
-\r
- a. lookupKeyMap is formed from the input , and a map is formed with serviceInstanceId, networkID, vnfID, pnfID, vfmoduleID, volumegroupID, configurationID, instancegroupID as the keys.\r
-\r
- b. Depending on whether a la carte or macro , different flows are called. getGBBMacro is called in here.\r
-\r
- c. In getGBBMacro , a valid customer is got with service subscription.(getCustomerAndServiceSubscription)\r
-\r
-  First a customer is got by get request on https://aai.onap:8443/aai/v19/business/customers/customer/{globalSubscriberId}\r
-\r
-  After that ServiceSubscription is got by doing a get request\r
-  https://aai.onap:8443/aai/v19/business/customers/customer/{globalSubscriberId}/service-subscriptions/service-subscription/service\r
-\r
-  If, the above request doesnt give any , then ServiceSubscription is fetched by first creating uri keys\r
-  https://aai.onap:8443/aai/v19/nodes/service-instances/service-instance/{resourceId}?format=pathed.\r
-  Then ServiceSubscription is got from the globalSubscriberId and the uri keys\r
-\r
-'Note': a valid customer and a corresponding ServiceSubscription must be present in the aai, for setting up the customer to gbuildingblock\r
-\r
- d. project and owningEntity is updated from the input\r
-\r
- e. service is got from the catalog db either by ModelVersionId or by ModelVersion and ModelInvariantId.\r
-\r
- f. ServiceInstance is created from the above parameters, and this ServiceInstance is used in the preparation of general building block.\r
-\r
- g. Depending on whether the current executing block name contains either of the network, or configuration, or network collection. A new instance of the corresponding type is created and is updated to the general building block (Happens in getGBBMacroNoUserParamsCreate)\r
-\r
- h. This general building block is set to the gBuildingBlockExecution and gBBInput parameter of execution.\r
-\r
-\r
-# 2. StatusPolicy - implemented in validateOrchestrationStatus in OrchestrationStatusValidator. Input being gBuildingBlockExecution\r
- a. orchestrationStatus is obtained after checking the resource type. We had updated the orchestrationStatus in the above step when a new service instance was created.\r
- b. OrchestrationStatusStateTransitionDirective is got by doing a get call to the catlog db with the url as findOneByResourceTypeAndOrchestrationStatusAndTargetAction\r
-http://so-catalog-db-adapter.onap:8082/orchestrationStatusStateTransitionDirective/search/findOneByResourceTypeAndOrchestrationStatusAndTargetAction?resourceType=SERVICE&orchestrationStatus=PRECREATED&targetAction=ASSIGN\r
- c. orchestrationStatusValidationResult parameter is set to execution variable from the OrchestrationStatusStateTransitionDirective.getFlowDirective() "flowDirective" : "CONTINUE"\r
-\r
-# 3. Prevalidate the gBuildingBlockExecution\r
-\r
-# 4. BB To Execute: Depending on which building block is to be executed, that particular bpmn is called .In this case, AssignServiceInstanceBB is called\r
-\r
--------------------------------------------------------------------------------------------------------------------------\r
-\r
-Hits AssignServiceInstanceBB.bpmn\r
----------------------------------\r
-\r
-.. image:: ../images/AssignServiceInstanceBB.png\r
-\r
-# 1. AAI create service subscription - implemented in createServiceSubscription of createAAITasks\r
-This method is used for creating and subscribing the service in A&AI\r
-\r
- a. Customer is got from the general building block that was updated above\r
-\r
- b. Here a serviceSubscriptionURI is formed by taking in the globalSubscriberId and the serviceType\r
-\r
- c. If a service subscription for the particular customer doesnt exist in AAI, then a new subscription is created by taking in the serviceSubscriptionURI\r
-\r
-GET performed on uri:https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service?\r
-{"results":[{"service-subscription":1}]}\r
-\r
-# 2. AAI create service instance - implemented in createServiceInstance of createAAITasks\r
-This method is used for creating the service instance in A&AI\r
-\r
- a. Customer is got from the general building block that was updated above\r
-\r
- b. A serviceInstanceURI is formed by taking in the globalSubscriberId, the serviceType and the service instance id\r
-\r
- c. If the service instance in the particular path doesnt exist in AAI , then a new service instance is created by using the serviceInstanceURI\r
-\r
-GET to:https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84?\r
-response: {"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84","Node Not Found:No Node of type service-instance found at: business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84","ERR.5.4.6114"]}}}\r
-\r
-Sending HTTP PUT to:https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84 \r
-with req body : {"service-instance-id":"2b955def-e536-40ee-84cb-3f06e3cc6d84","service-instance-name":"DEMO_123456","model-invariant-id":"944862ae-bb65-4429-8330-a6c9170d6672","model-version-id":"d88da85c-d9e8-4f73-b837-3a72a431622b","orchestration-status":"Inventoried"}\r
-\r
-# 3. AAI create project - implemented in createProject of createAAITasks\r
-This method is used for creation of the project A&AI. Here too it checks whether a project with a  {projectName} exist in AAI . If not it creates one, and connects it to the service instance identified by the serviceInstanceId\r
-Sending HTTP PUT to:https://aai.onap:8443/aai/v19/business/projects/project/name%20of%20proj/relationship-list/relationship\r
-with req body: {"related-link":"/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84"}\r
-\r
-# 4. AAI create owning entity -  implemented in createOwningEntity of createAAITasks\r
-\r
- a. OwningEntityId and OwningEntityName is extracted from the OwningEntity given in the input json\r
-\r
- b. If both of them are null, then an exception is raised.\r
-\r
- c. If only OwningEntityId is null, then whether the OwningEntityName is present in AAI is checked. If present then OwningEntityId is set by quering the OwningEntity from AAI. And then connect it to the service instance. If not present in the aai then a random id is generated and assigned to  OwningEntityId. Then Owning entity is first created and then connected to the service instance\r
-\r
- d. Depending on whether the owning entity is already present or not, either createOwningEntityandConnectServiceInstance is called, or connectOwningEntityandServiceInstanceis called.\r
-\r
-Sending HTTP PUT to:https://aai.onap:8443/aai/v19/business/owning-entities/owning-entity/owningEntityIdof%20owningEntity/relationship-list/relationship\r
-req body: {"related-link":"/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84"}\r
-\r
-# 5. SDNC Create Assign Request - implemented in assignServiceInstance of SDNCAssignTasks\r
-\r
- a. Here first the requestContext, serviceInstance, customer are obtained from the general building block\r
-\r
- b. Then a payload for the assignServiceInstance of the sdnc is formed by passing in the above parameters to the assignServiceInstance in sdncSIResources.\r
-\r
- c. A new sdnc request is formed with the above thing as payload\r
-\r
- d. This sdnc request is assigned to the SDNCRequest parameter of the execution variable\r
-\r
-.. code-block:: bash\r
-\r
- {"input":{\r
-  "request-information" : {\r
-    "request-action" : "CreateServiceInstance",\r
-    "source" : "MSO",\r
-    "request-id" : "139636cd-4b69-4c3a-9e67-fed2c283baee"\r
-\r
-  },\r
-  "sdnc-request-header" : {\r
-\r
-    "svc-request-id" : "9bfe8cb0-bb8b-4dca-949d-2f2b51011b54",\r
-    "svc-action" : "assign"\r
-\r
-  },\r
-  "service-information" : {\r
-\r
-    "onap-model-information" : {\r
-      "model-name" : "GR-API-DEFAULT",\r
-      "model-version" : "1.0",\r
-      "model-uuid" : "d88da85c-d9e8-4f73-b837-3a72a431622b",\r
-      "model-invariant-uuid" : "944862ae-bb65-4429-8330-a6c9170d6672"\r
-\r
-    },\r
-    "subscription-service-type" : "service",\r
-    "service-id" : "2b955def-e536-40ee-84cb-3f06e3cc6d84",\r
-    "global-customer-id" : {global_customerid},\r
-    "service-instance-id" : "2b955def-e536-40ee-84cb-3f06e3cc6d84"\r
-\r
-  },\r
-  "service-request-input" : {\r
-\r
-    "service-input-parameters" : {\r
-      "param" : [ {\r
-        "name" : "some name",\r
-        "value" : "some value"\r
-\r
-      } ]\r
-\r
-    },\r
-    "service-instance-name" : {instance_name}\r
-  }\r
- }}\r
-\r
-# 6. It calls another bpmn file - SDNCHandler.bpmn\r
-\r
- a. Setup callback variables -  Here mainly the correlator variable and the sdnc timeout variable is set\r
-\r
- b. callSDNC -  Here post call to sdnc client is done with the above prepared payload. And then isSDNCCompleted is set to the execution variable\r
-\r
-Both the above tasks are implemented in SDNCRequestTasks.\r
-http://sdnc-oam.onap:8282/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation/\r
-\r
-# 7. AAI Update (svc instance)- implemented in th updateOrchestrationStatusAssignedService in AAIUpdateTasks\r
- BPMN access method to update the status of Service to Assigned in AAI.\r
- Here serviceInstance is obtained , then its orchestration status is changed to assigned  and is updated in the AAI\r
-\r
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r
-\r
-Reaches back to ExecuteBuildingBlock.bpmn\r
-\r
-# 5. Post validate the generic building block\r
-\r
-# 6. Set Handling Code To Success - implemented in setHandlingStatusSuccess in ExecuteBuildingBlockRainyDay\r
-handling code is set to success for the execution variable\r
-\r
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r
-\r
-Reaches back to WorkflowActionBB.bpmn\r
-\r
-# 7. postProcessingExecuteBB \r
-If the building block excuted is ActivateVfModuleBB, then a postProcessingExecuteBBActivateVfModule needs to be executed\r
-\r
-Then again it is looped back to selectBB through a checkRetryStatus block.\r
-This block comes into play only if the handlingCode is retry, and the retry count is lesser than the maximum allowed no of retries, then the current sequence is again reduced by 1 , so that the same block is executed again.Request in the requestdb is updated with a setRetryStatusMessage, keeping an eye on the no of retries executed.\r
-\r
-\r
-And in this particular example ActivateServiceInstanceBB.bpmn is called next in the sequence.\r
-Here updateOrchestrationStatusActiveService is called, which is BPMN access method to update status of Service to Active in AAI. Here orchestrationStatus is set to active for the particular service instance and is updated in the AAI .\r
-\r
-# 8. updateRequestStatusToComplete is called if the "complete" flag is true\r
- a. Here first the request is got from the requestDbclient http://request-db-adapter:8083/infraActiveRequests/requestid \r
-\r
- b. Then a status message is formed as "Macro-" + resourceName + "-" + action + " request was executed correctly."\r
-\r
-   This status message is updated in the request as well as is set to finalStatusMessage of the execution variable\r
-\r
- c. Other request parameters are updated\r
-\r
-  request.setEndTime(endTime);\r
-\r
-  request.setFlowStatus("Successfully completed all Building Blocks");\r
-\r
-  request.setProgress(Long.valueOf(100));\r
-\r
-  request.setRequestStatus("COMPLETE");\r
-\r
-  request.setLastModifiedBy("CamundaBPMN");\r
-\r
- d. This new request parameters are updated by a put request to the requestDbclient\r
-\r
-\r
-\r
-\r
-Flow ends\r
-----------\r
-\r
-If there are other resources present along with the service : Eg :- Volumegroup.( These BBs wil be specifically called ) \r
-\r
-1) AssignVolumeGroupBB :\r
\r
- a. genericvnfid and volumegroupid is obtained from the execution block.\r
- b. volumegroup orchestrationstatus is set to assigned\r
- c. a volume group of the above details is created in aai\r
- d. connect volumegroup to this genericvnf\r
- e. cloud configuration is got, and then the volumegroup is linked to tenant\r
-\r
-\r
-\r
-2) createVolumeGroupBB :\r
-\r
- a. get the vf details according to Vf module id from sdnc.\r
- b. vfmodulequeriedfromsdnc is set to the executionvariable.\r
- c. createVolumeGroupRequest is formed with getCloudRegion, serviceinstance, genericVnf, volumegroup, sdncVfModuleQueryResponse.\r
- d. calls vnfadapter, which in turn calls openstackadaptertask.\r
- e. update heattask in the volumegroup and which is ammended in the aai.\r
- f. orchestrationstatus for the volume group is set to created.\r
-\r
-\r
-3) ActivateVolumeGroupBB :\r
-\r
- orchestrationstatus for the volume group is ammended to active.\r
-\r
+.. This work is licensed under a Creative Commons Attribution 4.0 License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2018 Huawei Technologies Co., Ltd.
+
+Building Block Understanding
+============================
+
+UNDERSTANDING BUILDING BLOCKS USING MACRO FLOW
+----------------------------------------------
+There are basically 2 flows - macro , a la carte.
+
+**In a la carte:**
+
+    We manually will initiate each step for a process.
+
+**In macro:**
+
+  The whole flow happens at a single click like if we want to create a service.
+  The flow will itself look whether there are vnfs, pnfs or networks in the
+  service and it will be created and activated in the flow also.Thus these
+  independent tasks like if vnf is present, then assign create and activate vnf
+  are all taken up as individual building blocks and are only called on need
+  basis.
+  Each and every request will reach to the api handler first.
+
+API HANDLER( ServiceInstances.java )
+------------------------------------
+
+
+
+# 1. Rest call reaching SO Api handler with the input json
+
+    According to the below path it is mapped to the createServiceInstance
+    function in ServiceInstances file.
+
+    .. code-block:: bash
+
+        curl -v -H "Content-Type: application/json" -X POST --data @serviceinstance.json -u mso_admin:password1$ http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances.
+
+# 2. Herein a unique requestid is generated corresponding to every request, and
+is checked whether that particular requestid exists in request db (Happens in
+createServiceInstance in ServiceInstances).
+
+    a. **http://request-db-adapter:8083/infraActiveRequests/requestid** (GET), which will return a 404 if not exists.
+
+    b. CreateInstance is set to the action variable. Here the request scope is
+       set to service from the inputjson - modelType.
+
+
+# 3. Running local validations on input json.
+
+# 4. create InfraActiveRequests, to store request details in request db adapter
+and as a payload to bpmn.
+
+    a) A new InfraActiveRequests object is created. And all the necessary
+       information from the input is set to it.
+
+    b) Retrieving productFamilyName from the input json to put into requests db. **http://aai/servicedesigncreation/services/service/{productfamilyid}** (GET), which will return a 404 if not exists in aai. If service exists, then that service's serviceDescritiption is set as productfamilyName.
+
+    c) **http://aai/cloudinfrastructure/cloudregions/cloudregion/cloudowner/{lcpCloudRegionId}/tenants/tenant/{tenantId}** (GET), checks for whether the particular cloud configuration exists in aai, if not exists returns 404.  If we are able to get, then the tenant's name derived from aai is set as tenantName.
+
+    d) serviceInstanceName is derived from requestInfo.instanceName and is set.
+
+    e) Request json is also set as RequestBody of InfraActiveRequests.
+
+# 5. Checks fro whether duplicate name exists.
+
+    a. version v[integer] is converted to the particular integer and stored.
+
+    b. Checks whether instance name already exists in with a POST request in **http://request-db-adapter:8083/infraActiveRequests/checkInstanceNameDuplicate**, with the data { instanceIdmap = null, instanceName = {instanceName} , instanceservice = service } . It checks for the current progress and if in progress it throws the particular status.
+
+# 6. Gets the orchestration url from the recipe table.
+
+    a. Checks whether the service already exists in catalogdb **http://catalog-db-adapter:8082/service/{modelNameVersionId}** (GET).
+
+    b. Checks the service recipe table with the modelNameVersionId and the action to be performed **http://catalog-db-adapter:8082/serviceRecipe/search/findFirstByServiceModelUUIDAndAction?serviceModelUUID={modelNameVersionId}&action=createInstance** . Returns a 404 if no recipe exists with the corresponding id.
+
+    c. As recipe corresponding to this doesn't exist, we try to get with a default value. This flow comes under generic resource flow so the default value is GR-API-DEFAULT. First we get service with this value **http://catalog-db-adapter:8082/service/search/findFirstByModelNameOrderByModelVersionDesc?modelName=GR-API-DEFAULT** (GET). It returns a service with modelUUID as d88da85c-d9e8-4f73-b837-3a72a431622b, and further can be used to get the recipe.
+
+    d. **http://catalog-db-adapter:8082/serviceRecipe/search/findFirstByServiceModelUUIDAndAction?serviceModelUUID=d88da85c-d9e8-4f73-b837-3a72a431622b&action=createInstance** (GET), gives a recipe which has a parameter "orchestrationUri" as "/mso/async/services/WorkflowActionBB".
+
+# 7. Updates the infraActiveRequests with the current request.
+
+    a) **http://request-db-adapter:8083/infraActiveRequests/** (POST) with the data formed. And a 201 created response is received.
+
+# 8. Call the bpmn with a post call on orchestrationUri. The data to bpmn is
+prepared having parameters like
+
+    a) bpmnRequest - formed from input request.
+
+    b) vfModuleId, pnfCorrelationId, networkId, configurationId, vfModuleType,
+       serviceInstanceId , serviceType are updated if present in the input json
+       or else set to empty string.
+
+    c) apiVersion , requestId, aLaCarte = false (def), recipeTimeout = 180(def)
+       ,requestAction= createInstance are all updated accordingly.
+
+    d) requestUri - v7/serviceInstances ,which is formed from the request url.
+
+# 9. A sync response is obtained on reaching bpmn like
+
+     {"requestReferences":{"requestId":"c45702f7-3f08-4081-bc98-2f9f18b81607","instanceId":"cadca18f-9bff-44be-8910-ad29d342e91f","requestSelfLink":**"http://159.138.57.166:30277/orchestrationRequests/v7/c45702f7-3f08-4081-bc98-2f9f18b81607"**}}.
+
+
+# 10. Calls the WorkflowActionBB.bpmn
+
+BPMN
+----
+
+Hits WorkflowActionBB.bpmn
+--------------------------
+
+.. image:: ../images/workflow.png
+
+
+# 10.1. RetrieveBBExecutionList - implemented in selectExecutionList in
+WorkflowAction.java
+
+    a. resourcetype, resourceid are formed from matching the requestUri to a
+       regex pattern matcher
+
+     .. code-block:: bash
+
+        [pattern=[vV]\d+.*?(?:(?:/(?<type>vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups)(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?(?:/resume)?)] .
+
+    b. Checks whether there is a service subscription with service instance name as {instanceName} correspoding to the customer in aai
+
+        .. code-block:: bash
+
+            https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances?depth=2&resultIndex=0&resultSize=1&service-instance-name={instanceName}.
+
+        Returns 404 not found, if it doesnt exists then the id of that particular instance is taken and given as both the resourceid and serviceinstance id. If not present then a random value is generated, and is assigned same to both.
+
+    c. Checks whether there is a service of the particular serviceInstanceId exists in aai. **https://aai.onap:8443/aai/v19/nodes/service-instances/service-instance/{serviceInstanceId}** , returns not found if it doesnt exist. If service with corresponding instance name already exists , then flowsToExecute is got by quering the requestdbadapter with the earlier request id.  If not present, then only orchestrationflows are got, and later from that the flowsToExecute are found out.
+
+    d. Get the particular service from catalogdb . **http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}**  (GET). Be sure that the service with this particular modelNameVersionId exists in catalogdb, because based on the services (like whether pnf, or vnf, or networkcollection) present in that particular service, which all bbs to execute are decided.
+
+    e. This being a service, "service" is added to the resource list. And is checked upon for other resources like vnf and   network, eg:
+
+        **http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}/vnfCustomizations** (GET)
+
+        **http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}/collectionResourceCustomizations** (GET)
+
+        **http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}/networkCustomizations** (GET)
+
+        And depending on the resources in the service, the resources found is updated like
+
+        Found :Service - 1    Vnf - 0    Pnf - 0    VfModule - 0    VolumeGroup - 0    Network - 0    VirtualLink - 0    NetworkCollection - 0    Configuration - 0    InstanceGroup - 0
+
+    f. Then the orchestration flows are get from the orchestration_flow_table depending on the cloudowner and request scope:
+
+        **http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/search/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType?action=createInstance&requestScope=Service&isALaCarte=false&cloudOwner={CloudOwner}&serviceType=%2A** (GET)
+
+        Here if present, then the orchestration flows are returned or else with default cloud owner, we try again
+
+        **http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/search/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType?action=createInstance&requestScope=Service&isALaCarte=false&cloudOwner=DEFAULT&serviceType=%2A** (GET)
+
+        Here in northBoundRequest is returned which has the parameter orchestrationFlowList, that contains the link that will return the orchestration flows.
+
+        "orchestrationFlowList" : { "href" : "**http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/101/orchestrationFlowList**"}
+
+        Now we do a get on the orchestration flow link to get the set of orchestration flows required
+
+        **http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/101/orchestrationFlowList**.
+
+        Here a set of 20 orchestration flows are returned under the action of Service-Macro-Create, each with a sequence no assigned sequentially in the given order
+
+        * AssignServiceInstanceBB,
+        * CreateNetworkCollectionBB,
+        * AssignNetworkBB,
+        * AssignVnfBB,
+        * AssignVolumeGroupBB,
+        * AssignVfModuleBB,
+        * ConfigAssignVnfBB,
+        * AssignPnfBB,
+        * WaitForPnfReadyBB,
+        * ActivatePnfBB,
+        * CreateNetworkBB,
+        * ActivateNetworkBB,
+        * CreateVolumeGroupBB,
+        * ActivateVolumeGroupBB,
+        * CreateVfModuleBB,
+        * ActivateVfModuleBB,
+        * ConfigDeployVnfBB,
+        * ActivateVnfBB,
+        * ActivateNetworkCollectionBB,
+        * ActivateServiceInstanceBB.
+
+
+        .. image:: ../images/flowchart.png
+
+
+    g. Flows to execute is determined by iterating through all the orchestartion flows and matching it with the found resources. It is merely a contains matching. In this particular as service was the only resource : List of BuildingBlocks to execute:AssignServiceInstanceBB, ActivateServiceInstanceBB.
+
+    h. processing data is added to the requestdbadapter. Here the data is post to the requestdb as two different building blocks **http://so-request-db-adapter.onap:8083/requestProcessingData**.
+
+    i. The already stored request details in request db is ammended like "lastModifiedBy" : "CamundaBPMN" , and status to in_progress with a put request.
+
+
+# 10.2. sendSyncAck -  This was used to give an acknowledgement , with status
+code as 200, and requestId and resourceId is sent as content.
+
+
+# 10.3. Prevalidate the workflow
+
+
+# 10.4. SelectBB - implemented in selectBBin WorkflowActionBBTasks
+
+    This is used to select the building block from the flows to execute
+    depending on the sequence order.
+
+     a. Depending on the current sequence , the building block is selected from
+        the flows to execute.
+
+     b. Execution variable, that is passed between the different building
+        blocks as the payload is amended as:
+        execution.setVariable("buildingBlock", buildingblockselected).
+
+     c. current sequence is incremented by 1, and updated in execution
+        variable.
+
+     d. Depending on whether currentSequence is greater than
+        flowsToExecute.size(), COMPLETED variable is either set to true
+        or false.
+
+# 10.5. updateFlowStatistics - implemented in updateFlowStatistics in
+WorkflowActionBBTasks
+
+    a. Depending on the current sequence no, the completed bb and next bb is
+       got from the flows to execute. And these are mentioned in a
+       statusMessage.
+
+    b. Percentage progress is got from the total no of bbs
+
+    c. These are ammended to the already present request in the request db
+
+
+# 10.6. Execute BB - calls the ExecuteBuildingBlock.bpmn
+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+Hits ExecuteBuildingBlock.bpmn
+------------------------------
+
+.. image:: ../images/ExecuteBuildingBlock.png
+
+# 10.6.1. BBInputSetup - implemented in execute in BBInputSetup
+
+    Here a generalbuildingblock is formed from executingbuildingblock after
+    certain updations and validations.
+
+     a. lookupKeyMap is formed from the input , and a map is formed with
+        serviceInstanceId, networkID, vnfID, pnfID, vfmoduleID, volumegroupID,
+        configurationID, instancegroupID as the keys.
+
+     b. Depending on whether a la carte or macro , different flows are called.
+        getGBBMacro is called in here.
+
+     c. In getGBBMacro , a valid customer is got with service subscription.
+        (getCustomerAndServiceSubscription)
+
+        First a customer is got by get request on **https://aai.onap:8443/aai/v19/business/customers/customer/{globalSubscriberId}**
+
+        After that ServiceSubscription is got by doing a get request
+
+        **https://aai.onap:8443/aai/v19/business/customers/customer/{globalSubscriberId}/service-subscriptions/service-subscription/service**
+
+        If, the above request doesnt give any , then ServiceSubscription is
+        fetched by first creating uri keys
+
+        **https://aai.onap:8443/aai/v19/nodes/service-instances/service-instance/{resourceId}?format=pathed**.
+
+        Then ServiceSubscription is got from the globalSubscriberId and the
+        uri keys
+
+        .. note:: a valid customer and a corresponding ServiceSubscription must
+            be present in the aai, for setting up the customer to gbuildingblock
+
+     d. project and owningEntity is updated from the input
+
+     e. service is got from the catalog db either by ModelVersionId or by ModelVersion and ModelInvariantId.
+
+     f. ServiceInstance is created from the above parameters, and this ServiceInstance is used in the preparation of general building block.
+
+     g. Depending on whether the current executing block name contains either of the network, or configuration, or network collection. A new instance of the corresponding type is created and is updated to the general building block (Happens in getGBBMacroNoUserParamsCreate)
+
+     h. This general building block is set to the gBuildingBlockExecution and gBBInput parameter of execution.
+
+
+# 10.6.2. StatusPolicy - implemented in validateOrchestrationStatus in
+OrchestrationStatusValidator. Input being gBuildingBlockExecution
+
+     a. orchestrationStatus is obtained after checking the resource type. We
+        had updated the orchestrationStatus in the above step when a new
+        service instance was created.
+
+     b. OrchestrationStatusStateTransitionDirective is got by doing a get call
+        to the catlog db with the url as
+        findOneByResourceTypeAndOrchestrationStatusAndTargetAction
+
+        **http://so-catalog-db-adapter.onap:8082/orchestrationStatusStateTransitionDirective/search/findOneByResourceTypeAndOrchestrationStatusAndTargetAction?resourceType=SERVICE&orchestrationStatus=PRECREATED&targetAction=ASSIGN**
+
+    c. orchestrationStatusValidationResult parameter is set to
+       executionvariable from the
+       OrchestrationStatusStateTransitionDirective.getFlowDirective()
+       "flowDirective" : "CONTINUE"
+
+# 10.6.3. Prevalidate the gBuildingBlockExecution
+
+# 10.6.4. BB To Execute: Depending on which building block is to be executed,
+that particular bpmn is called .In this case, AssignServiceInstanceBB is called
+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+.. topic:: Hits AssignServiceInstanceBB.bpmn
+
+    .. image:: ../images/AssignServiceInstanceBB.png
+
+# 10.6.4.1. AAI create service subscription - implemented in
+createServiceSubscription of createAAITasks
+
+    This method is used for creating and subscribing the service in A&AI
+
+     a. Customer is got from the general building block that was updated above
+
+     b. Here a serviceSubscriptionURI is formed by taking in the
+        globalSubscriberId and the serviceType
+
+     c. If a service subscription for the particular customer doesnt exist in
+        AAI, then a new subscription is created by taking in the
+        serviceSubscriptionURI
+
+    GET performed on uri:**https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service?
+    {"results":[{"service-subscription":1}]}**
+
+# 10.6.4.2. AAI create service instance - implemented in createServiceInstance
+of createAAITasks
+
+    This method is used for creating the service instance in A&AI
+
+     a. Customer is got from the general building block that was updated above
+
+     b. A serviceInstanceURI is formed by taking in the globalSubscriberId, the
+        serviceType and the service instance id
+
+     c. If the service instance in the particular path doesnt exist in AAI ,
+        then a new service instance is created by using the serviceInstanceURI
+
+     .. code-block:: bash
+
+            GET to:https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84?
+
+            response: {"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84","Node Not Found:No Node of type service-instance found at: business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84","ERR.5.4.6114"]}}}
+
+            Sending HTTP PUT to:https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84
+
+            with req body : {"service-instance-id":"2b955def-e536-40ee-84cb-3f06e3cc6d84","service-instance-name":"DEMO_123456","model-invariant-id":"944862ae-bb65-4429-8330-a6c9170d6672","model-version-id":"d88da85c-d9e8-4f73-b837-3a72a431622b","orchestration-status":"Inventoried"}
+
+# 10.6.4.3. AAI create project - implemented in createProject of createAAITasks
+
+    This method is used for creation of the project A&AI.
+    Here too it checks whether a project with a  {projectName} exist in AAI .
+    If not it creates one, and connects it to the service instance identified
+    by the serviceInstanceId
+
+    .. code-block:: bash
+
+        Sending HTTP PUT to:https://aai.onap:8443/aai/v19/business/projects/project/name%20of%20proj/relationship-list/relationship
+
+        with req body: {"related-link":"/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84"}
+
+
+# 10.6.4.4. AAI create owning entity -  implemented in createOwningEntity of
+createAAITasks
+
+     a. OwningEntityId and OwningEntityName is extracted from the OwningEntity
+        given in the input json
+
+     b. If both of them are null, then an exception is raised.
+
+     c. If only OwningEntityId is null, then whether the OwningEntityName is
+        present in AAI is checked. If present then OwningEntityId is set by
+        quering the OwningEntity from AAI. And then connect it to the service
+        instance. If not present in the aai then a random id is generated and
+        assigned to  OwningEntityId. Then Owning entity is first created and
+        then connected to the service instance
+
+     d. Depending on whether the owning entity is already present or not,
+        either createOwningEntityandConnectServiceInstance is called, or
+        connectOwningEntityandServiceInstanceis called.
+
+        .. code-block:: bash
+
+            Sending HTTP PUT to:https://aai.onap:8443/aai/v19/business/owning-entities/owning-entity/owningEntityIdof%20owningEntity/relationship-list/relationship
+
+            req body: {"related-link":"/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84"}
+
+
+# 10.6.4.5. SDNC Create Assign Request - implemented in assignServiceInstance
+of SDNCAssignTasks
+
+     a. Here first the requestContext, serviceInstance, customer are obtained
+        from the general building block
+
+     b. Then a payload for the assignServiceInstance of the sdnc is formed by
+        passing in the above parameters to the assignServiceInstance in
+        sdncSIResources.
+
+     c. A new sdnc request is formed with the above thing as payload
+
+     d. This sdnc request is assigned to the SDNCRequest parameter of the
+        execution variable
+
+        .. code-block:: bash
+
+         {"input":{
+          "request-information" : {
+            "request-action" : "CreateServiceInstance",
+            "source" : "MSO",
+            "request-id" : "139636cd-4b69-4c3a-9e67-fed2c283baee"
+
+          },
+          "sdnc-request-header" : {
+
+            "svc-request-id" : "9bfe8cb0-bb8b-4dca-949d-2f2b51011b54",
+            "svc-action" : "assign"
+
+          },
+          "service-information" : {
+
+            "onap-model-information" : {
+              "model-name" : "GR-API-DEFAULT",
+              "model-version" : "1.0",
+              "model-uuid" : "d88da85c-d9e8-4f73-b837-3a72a431622b",
+              "model-invariant-uuid" : "944862ae-bb65-4429-8330-a6c9170d6672"
+
+            },
+            "subscription-service-type" : "service",
+            "service-id" : "2b955def-e536-40ee-84cb-3f06e3cc6d84",
+            "global-customer-id" : {global_customerid},
+            "service-instance-id" : "2b955def-e536-40ee-84cb-3f06e3cc6d84"
+
+          },
+          "service-request-input" : {
+
+            "service-input-parameters" : {
+              "param" : [ {
+                "name" : "some name",
+                "value" : "some value"
+
+              } ]
+
+            },
+            "service-instance-name" : {instance_name}
+          }
+         }}
+
+# 10.6.4.6. It calls another bpmn file - SDNCHandler.bpmn
+
+     a. Setup callback variables -  Here mainly the correlator variable and the
+        sdnc timeout variable is set
+
+     b. callSDNC -  Here post call to sdnc client is done with the above
+        prepared payload. And then isSDNCCompleted is set to the execution
+        variable
+
+        Both the above tasks are implemented in SDNCRequestTasks.
+
+        **http://sdnc-oam.onap:8282/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation/**
+
+# 10.6.4.7. AAI Update (svc instance)- implemented in the
+updateOrchestrationStatusAssignedService in AAIUpdateTasks
+
+     BPMN access method to update the status of Service to Assigned in AAI.
+     Here serviceInstance is obtained , then its orchestration status is
+     changed to assigned  and is updated in the AAI
+
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+    Reaches back to ExecuteBuildingBlock.bpmn
+
+# 10.6.5. Post validate the generic building block
+
+# 10.6.6. Set Handling Code To Success - implemented in
+setHandlingStatusSuccess in ExecuteBuildingBlockRainyDay handling code is set
+to success for the execution variable
+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+    Reaches back to WorkflowActionBB.bpmn
+
+# 10.7. postProcessingExecuteBB
+
+    If the building block excuted is ActivateVfModuleBB, then a
+    postProcessingExecuteBBActivateVfModule needs to be executed
+
+    Then again it is looped back to selectBB through a checkRetryStatus block.
+
+    This block comes into play only if the handlingCode is retry, and the retry
+    count is lesser than the maximum allowed no of retries, then the current
+    sequence is again reduced by 1 , so that the same block is executed again.
+    Request in the requestdb is updated with a setRetryStatusMessage,
+    keeping an eye on the no of retries executed.
+
+
+    And in this particular example ActivateServiceInstanceBB.
+    bpmn is called next in the sequence.
+
+    Here updateOrchestrationStatusActiveService is called, which is BPMN access
+    method to update status of Service to Active in AAI.
+    Here orchestrationStatus is set to active for the particular
+    service instance and is updated in the AAI .
+
+# 10.8. updateRequestStatusToComplete is called if the "complete" flag is true
+
+     a. Here first the request is got from the requestDbclient **http://request-db-adapter:8083/infraActiveRequests/requestid**
+
+     b. Then a status message is formed as "Macro-" + resourceName + "-"
+        + action + " request was executed correctly."
+
+       This status message is updated in the request as well as is set to
+       finalStatusMessage of the execution variable
+
+     c. Other request parameters are updated
+
+          request.setEndTime(endTime);
+
+          request.setFlowStatus("Successfully completed all Building Blocks");
+
+          request.setProgress(Long.valueOf(100));
+
+          request.setRequestStatus("COMPLETE");
+
+          request.setLastModifiedBy("CamundaBPMN");
+
+     d. This new request parameters are updated by a put request to the
+        requestDbclient
+
+
+
+
+Flow ends
+----------
+
+If there are other resources present along with the service : Eg
+:- Volumegroup.( These BBs wil be specifically called )
+
+1) AssignVolumeGroupBB :
+
+     a. genericvnfid and volumegroupid is obtained from the execution block.
+     b. volumegroup orchestrationstatus is set to assigned
+     c. a volume group of the above details is created in aai
+     d. connect volumegroup to this genericvnf
+     e. cloud configuration is got,
+        and then the volumegroup is linked to tenant
+
+2) createVolumeGroupBB :
+
+     a. get the vf details according to Vf module id from sdnc.
+     b. vfmodulequeriedfromsdnc is set to the executionvariable.
+     c. createVolumeGroupRequest is formed with getCloudRegion,
+        serviceinstance, genericVnf, volumegroup, sdncVfModuleQueryResponse.
+     d. calls vnfadapter, which in turn calls openstackadaptertask.
+     e. update heattask in the volumegroup and which is ammended in the aai.
+     f. orchestrationstatus for the volume group is set to created.
+
+3) ActivateVolumeGroupBB :
+
+     orchestrationstatus for the volume group is ammended to active.
+
+Rollback, Retry and abort
+------------------------------------
+
+When exception is thrown then **Error handling**  event subprocess in BPMN
+**ExecuteBuildingBlock** is invoked.
+
+    .. image:: ../images/handling_error.png
+
+    **QueryRainyDayTable task** main responsibility is to determine with
+    **rainy_day_handler_macro** table the right policy to apply in order to
+    recover from error.
+
+    For each BB a policy is defined in **rainy_day_handler_macro** table
+    (retry, rollback, abort ...)
+
+    **HandlingCode** parameter is populated with  BB **policy** value.
+
+
+
+# 1. In case of retry handling code
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Policy in **rainy_day_handler_macro** table for current BB failure is **Retry**
+
+.. image:: ../images/retry_Bdd2.png
+
+Once Error handling subprocess has set handlingCode to **retry** value,
+the main process retries to execute previous failing BB (green arrow).
+
+.. image:: ../images/retry.png
+
+If a new failure occurred a **new retry** is performed
+(green arrow in Error handling subprocess)
+
+.. image:: ../images/retry3.png
+
+
+Until **max retry count** is reached, this time **secondary policy**
+will be queried.
+
+.. image:: ../images/retry2.png
+
+**HandlingCode** is now set with  **secondary policy** value from
+rainy_day_handler_macro table (rollback, abort...)
+
+.. image:: ../images/retry_Bdd.png
+
+
+# 2. In case of rollback handling code
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Policy in **rainy_day_handler_macro** table for current BB failure is set to
+**Rollback** (or RollbackToXXX)
+
+
+    .. image:: ../images/rollback_Bdd.png
+
+In case of Rollback the main process follows green arrows
+
+    .. image:: ../images/rollback.png
+
+    1) **HandlingCode** set previously in Error handling subprocess to Rollback
+       (or RollbackToXXX) drives to **RollBack Execution Path** in main process
+
+    2) **RollBack Execution Path** task has responsibility to prepare rollback
+       flow sequence.
+
+        BB FlowName are changed in the following way:
+
+        * AssignXXX => UnassignXXX
+        * CreateXXX => DeleteXXX
+        * ActivateXXX => DeactivateXXX
+        * AddXXX => DeleteXXX
+        * VNFSetXXX => VNFUnsetXXX
+        * VNFLockXXX => VNFUnLockXXX
+        * VNFStopXXX => VNFStartXXX
+        * VNFQuiesceXXX => VNFResumeXXX
+
+    3) and 4.   **Loop** on step **3** and step **4**,  BB are executed one after one in order to **rollback** previous flow execution.
+
+    5) RollBack completed.
+
+
+# 3. In case of Abort handling code
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Policy in **rainy_day_handler_macro** table for current BB failure is **Abort**
+
+.. image:: ../images/abort.png
+
+
+
+Suppress Rollback
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Request can disable rollback with **suppressRollback** parameter
+
+if **suppressRollback** is set to false value, **QueryRainyDayTable task**
+will directly return abort without querying policy in table
+**rainy_day_handler_macro**
+
+
+.. code-block:: bash
+
+    curl --location --request POST 'http://master2:30277/onap/so/infra/serviceInstantiation/v7/serviceInstances' \
+    --header 'Accept: application/json' \
+    --header 'Content-Type: application/json' \
+    --header 'Authorization: Basic abcdef' \
+    --header 'X-ONAP-PartnerName: NBI' \
+    --data-raw '{
+        "requestDetails": {
+            "subscriberInfo": {
+                "globalSubscriberId": "ones"
+            },
+            "requestInfo": {
+                "suppressRollback": false,
+                "productFamilyId": "Useless_But_Mandatory",
diff --git a/docs/developer_info/ETSI_NFVO_Network_Service_LCM_Setup_Guide.rst b/docs/developer_info/ETSI_NFVO_Network_Service_LCM_Setup_Guide.rst
new file mode 100644 (file)
index 0000000..db96d5a
--- /dev/null
@@ -0,0 +1,263 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2021 Ericsson Software Technologies
+
+ETSI NFVO Network Service LCM Setup & Functionality
+===================================================
+This guide will go through the setup required and the use of the ETSI NFVO NS LCM Functionality: Create, Instantiate, Terminate and Delete a Network Service
+
+Ensure you have a healthy ONAP Deployment running. The following components will be required/used as part of this guide:
+
+- SO
+- SDC
+- AAI
+- DMAAP
+- Modeling
+- UUI
+
+Add Entries to ESR System Info List and ESR VNFM Lists
+------------------------------------------------------
+This first section of the guide will involve adding values to AAI under the following 3 paths:
+
+- /aai/v15/cloud-infrastructure/cloud-regions/cloud-region/<cloud-owner>/<cloud-region-id>/esr-system-info-list/esr-system-info/<yourVnfmId>
+- /aai/v15/external-system/esr-vnfm-list/esr-vnfm/<yourVnfmId>
+- /aai/v15/external-system/esr-vnfm-list/esr-vnfm/<yourVnfmId>/esr-system-info-list/esr-system-info/
+
+For the purposes of this guide, the VNFM Simulator will be used as the VNFM throughout. You will need to edit the below CURLs in order to match your specific VNFM's requirements, if using one other than the VNFM Simulator.
+
+
+**Step 1:**
+
+Exec into any pod within your ONAP deployment that is connected to the primary ONAP network. This will give you access to using the internal service hostnames.
+
+**Step 2:**
+
+Send the following CURL to add the AAI Cloud Infrastructure ESR System Info List Entry. Ensuring you alter the values to match your deployment's AAI Data:
+
+*AAI Cloud Infrastructure ESR System Info List Entry*
+
+.. code-block:: bash
+
+    curl -X PUT -H 'Accept: application/json' -H 'Authorization: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==' -H 'Content-Type: application/json' -H 'X-FromAppId:12' -H 'X-TransactionId: 12' https://aai.onap:8443/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/regionOne/esr-system-info-list/esr-system-info/vnfmSimulator -d '{"name": "vnfmSimulatorName", "system-type": "simulator", "vimId": "myCloud", "vendor": "EST", "version": "V1.0", "certificateUrl": "", "url": "http://so-vnfm-simulator.onap:9093/vnflcm/v1/", "user-name": "vnfm", "password": "password1$"}' -k
+
+**Step 3:**
+
+Next you will need to send the following 2 CURLs in order to add entries into the AAI External System ESR VNFM List:
+
+*AAI External System ESR VNFM List*
+
+.. code-block:: bash
+
+    curl -X PUT -H 'Accept: application/json' -H 'Authorization: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==' -H 'Content-Type: application/json' -H 'X-FromAppId:12' -H 'X-TransactionId: 12' https://aai.onap:8443/aai/v15/external-system/esr-vnfm-list/esr-vnfm/vnfmSimulator -d '{"vnfmId": "vnfmSimulator", "name": "vnfmSimulatorName", "type": "simulator", "vendor": "est"}'
+
+*AAI External System ESR VNFM System Info List*
+
+.. code-block:: bash
+
+    curl -X PUT -H 'Accept: application/json' -H 'Authorization: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==' -H 'Content-Type: application/json' -H 'X-FromAppId:12' -H 'X-TransactionId: 12' https://aai.onap:8443/aai/v15/external-system/esr-vnfm-list/esr-vnfm/vnfmSimulator/esr-system-info-list/esr-system-info/vnfmSimulatorId -d '{"esr-system-info-id": "vnfmSimulatorId", "type": "simulator", "user-name": "vnfm", "password": "password1$", "system-type": "simulator", "service-url": "http://so-vnfm-simulator.onap:9093/vnflcm/v1"}'
+
+**Step 4:**
+
+Take note of the "system-type" and "type" values you have added with these CURLs. This will be used at a later stage when creating your VF in SDC.
+
+
+Onboard a VNF package along with a Network Service CSAR into SDC
+----------------------------------------------------------------
+A video demonstration of this process "Onboarding ETSI Based NS" can be found here: SO NFVO NS Onboarding and LCM Demonstrations
+It is recommended that you view this video before/alongside this section of the guide.
+
+**Step 1:**
+
+Login to the ONAP Portal. (Link: https://portal.api.simpledemo.onap.org:30225/ONAPPORTAL/login.htm (where "portal.api.simpledemo.onap.org" is set as the IP of your VM/host of your Portal component.)
+
+Login: cs0008
+Password: demo123456!
+
+**Step 2:**
+
+Select the SDC App. It is possible that your browser will block the scripts run by the Portal, you will need to enable them if it does.
+
+**Step 3:**
+
+Follow the onboarding guide below:
+
+Onboarding your VNF:
+
+1: Click the “ONBOARD” tab near the top of the window.
+
+2: Create a “VLM” if you have not created a "VLM" before.
+
+- From the “ONBOARD” page, click create VLM.
+- Enter name and description, then select create.
+- Click on the plus button beside Entitlement Pool.
+- Add Name and Manufacturing Reference Number, then click save.
+- Click on the plus button beside License Key Groups.
+- Add Name and select type, then click save.
+- Click on the plus button beside Feature Groups.
+- In the general tab, add name, Description and Part Number. Move to the Entitlements Pools tab, select the entitlement pool you just created and click the rightward arrow. Move to the License Key Group tab, select the license key group you just created and click the rightward arrow. Once these three things are done, click save.
+- Click on the plus button beside License Agreement.
+- Add Name and select License Term. Next move to the Feature Groups tab, select the Feature Group you just created and click the rightward arrow. Lastly click save.
+- On the overview page, select submit in the top right corner of the screen.
+- Enter a commit comment and click Commit & Submit.
+
+3: Create a Virtual Service Product (VSP)
+
+- Click the “ONBOARD” tab near the top of the window.
+- Click “CREATE NEW VSP” and fill in the required information. Make sure to select “Network Package” for the “ONBOARDING PROCEDURE” section. Then click “CREATE”.
+- Click where it shows “! Missing” underneath “License Agreement”. Simply select a “Licensing Version” and “License Agreement/Feature Group” from the drop downs.
+- Click the “Overview” tab on the left hand side. Then press “Select File” in the “SOFTWARE PRODUCT ATTACHMENTS” section and select your prepared VNF Package. If you are onboarding a supported zip, then click “PROCEED TO VALIDATION” once you can see your added files. You can safely ignore any warnings that come up at this step, but not any errors. (Note: The package validation does not support CSARs currently, they will still work however, providing they meet SDC requirements.)
+- Now click “Submit”.
+
+4: Then click “ONBOARD” in the top left. Hover your mouse over the small grey triangle that is just to the right of the “ONBOARD” tab and select “HOME”.
+
+5: Hover over the “IMPORT” square and select “Import VSP”. Find your VSP, click the drop-down arrow beside it and then press the “Import VSP” icon at the far right of the line that drops down.
+
+6: You will now be brought to the draft page of your VF. Follow the instructions below in order to certify it.
+
+- First, give your VF a name you will remember, as we will be using this in the following section, then click "Create" in the top-right hand corner.
+- You will need to edit the properties of the VF in order to add a property value, that will be required at a later point.
+- Go to the “Properties Assignment” tab on the left-hand side, then select your VF on the right-hand side.
+- Now go to the "Inputs" tab within the "Properties Assignment”.
+- Find the "nf_type" input and enter a value matching the value you entered for "system-type" and "type" in the previous ESR Entries section.
+- Click "Save" in the top-right of the "Properties Assignment” tab and then you can Certify your VF, by clicking "Certify" in the top-right of the VF Page.
+
+**Creating/Configuring your SDC Service**
+
+1: In the “HOME” tab of the SDC ONAP Portal, hover over the “ADD” square and select “ADD SERVICE”. Fill in the required fields, select the "Category" "Network Service" and press “Create” in the top right-hand corner.
+
+2: You will be brought to the draft page of your Service. Go to the “Composition” tab on the left-hand side and drag/drop the VF, that you just created, into this service (you can search for the VF by name in the top left).
+
+3: Now you will need to add the Network Service CSAR package to this service. You can do this by clicking in the blank whitespace of the composition, then on the right hand side of the page select the 2nd tab in order to add a deployment artifact. Click "ADD ARTIFACT" here, give an "Artifact Label" of "ns", any description value and ensure you choose a "Type" of "OTHER". Then click "DONE".
+
+4: Finally you can click "Certify" in the top right hand corner, followed by "Distribute". Your Service will now distributed across ONAP.
+
+Onboarding your Network Service to ETSI Catalog through UUI
+-----------------------------------------------------------
+This next small section (Onboarding your NS through UUI) can also been seen in the "Onboarding ETSI Based NS" video mentioned earlier.
+
+**Step 1:**
+
+Go to the following link, in order to access the UUI Portal: https://msb.api.simpledemo.onap.org:30283/iui/usecaseui/#/home (where "msb.api.simpledemo.onap.org" is set as the IP of your VM/host of your UUI component.)
+
+**Step 2:**
+
+Click "Package Management", you will be brought to the "NS" tab, you should see your Service name in the list. Simply click the "Operation button" on the right hand side of your Service in order to onboard it into the ETSI Catalog.
+
+**Step 3:**
+
+Wait for the confirmation that your Network Service has been Onboarded Successfully.
+
+
+
+Triggering the ETSI NFVO NS LCM Functionality
+---------------------------------------------
+
+The next section of this guide will go through the actual triggering of the ETSI NFVO NS LCM Functionalities in the following order: Create, Instantiate, Terminate and then Delete.
+
+This section of this guide can be seen in video format at the following link: https://wiki.onap.org/display/DW/SO+NFVO+NS+Onboarding+and+LCM+Demonstrations
+
+It is recommended that you view the "ETSI Based NS Orchestration Demo" video before/alongside this section of the guide.
+
+**Create NS**
+
+**Step 1:**
+
+First you will need to retrieve the NSD ID from the ETSI Catalog Database in order to populate the Create Network Service CURL. The ETSI Catalog Database will be found within the Modeling DB container.
+
+Log into the ETSI Catalog Database and retrieve the data from the "catalog_nspackage" table. The value under the column "NSPACKAGEID" will be the NSD ID required as part of the Create Network Service CURL.
+
+**Step 2:**
+
+Exec into any pod within your ONAP deployment that is connected to the primary ONAP network. This will give you access to using the internal service hostnames.
+
+**Step 3:**
+
+Send the following Create Network Service CURL Command, ensuring your deployment's Global Customer ID (from AAI) and your NSDID (from ETSI Catalog Database) replace the values within the <>:
+
+*Create NS Curl*
+
+.. code-block:: bash
+
+    curl -k -X POST -H "accept:application/json" -H "Content-Type:application/json" -H "HTTP_GLOBALCUSTOMERID: <GLOBALCUSTOMERID>" -d '{"nsdId": "<NSDID>", "nsName": "demo", "nsDescription": "demo"}' -v http://so-etsi-nfvo-ns-lcm.onap:9095/so/so-etsi-nfvo-ns-lcm/v1/api/nslcm/v1/ns_instances -H "Authorization: Basic c28tZXRzaS1uZnZvLW5zLWxjbTpEdXJnMSREYWxhWG95ZA=="
+
+You should receive a synchronous response back with a 201 Create HTTP Response. This response will contain the NS Instance ID of the NS Instance we just created, take note of this as it will be needed in the following steps.
+
+After this step has been completed you should log into the Marie-Db-Galera-0 Pod on your ONAP deployment, then connect to the "NFVO" database. Retrieving all data from the "ns_inst" table will show that your initial NS has been created.
+
+**Instantiate NS**
+
+**Step 1:**
+
+Next you will need to create a JSON file on the pod, which you are exec'ed into, named "Payload.json" in the following example.
+
+*Payload.json*
+
+.. code-block:: json
+
+    {
+        "nsFlavourId": "default",
+            "locationConstraints": [{
+            "vnfProfileId": "b1bb0ce7-2222-4fa7-95ed-4840d70a1177"
+        }],
+        "additionalParamsForVnf": [{
+            "vnfProfileId": "b1bb0ce7-2222-4fa7-95ed-4840d70a1177",
+            "vnfInstanceName": "vgwVnf1",
+            "vnfInstanceDescription": "test",
+            "additionalParams": {
+                "vim_id": "<cloud-owner>_<cloud-region-id>_<tenant_id>"
+            }
+        }]
+    }
+
+
+In the above Payload.json, you must ensure that the "vnfProfileId" matches the VNF Descriptor ID found in the VNF CSAR which you onboarded as part of the VNF Onboarding section of this guide. The "vnfInstanceName" must match your VNF's name, and finally the "vim_id" must be replaced with your AAI Data values for your deployment's Cloud-Owner, Cloud-Region-Id and Tenant-Id respectively.
+
+**Step 2:**
+
+Next you will need to send the following CURL command in order to trigger the instantiation of the Network Service. Ensure that you add the NS Instance ID received in the Create NS response to the URL Path (replacing <NS_INSTANCE_ID>), and match the Global Customer ID as before:
+
+*Instantiate NS Curl*
+
+.. code-block:: bash
+
+    curl -k -X POST -H "Authorization: Basic c28tZXRzaS1uZnZvLW5zLWxjbTpEdXJnMSREYWxhWG95ZA==" -H "accept: application/json" -H "Content-Type:application/json" -H "HTTP_GLOBALCUSTOMERID: ADemoCustomerInXcloud" -d @Payload.json -v http://so-etsi-nfvo-ns-lcm.onap:9095/so/so-etsi-nfvo-ns-lcm/v1/api/nslcm/v1/ns_instances/<NS_INSTANCE_ID>/instantiate
+
+This will trigger the Asynchronous Instantiate NS Functionality. You will receive a response confirming that the process has begun with a 202 Accepted HTTP Response Header. You can view the debug.log files on the following pods in order to view the progress:
+
+- SO-ETSI-NFVO-NS-LCM
+- SO-ETSI-SOL003-ADAPTER
+- SO-VNFM-SIMULATOR (If making use of the VNFM-Simulator, alternatively the logs of the VNFM you are using)
+
+Once the full instantiation has been completed, reconnect to the "NFVO" database, within the Marie-Db-Galera-0 pod on your ONAP deployment. Retrieving all data from the "ns_inst" table again, you should see that the "STATUS" field for your NS has changed to "INSTANTIATED".
+
+**Terminate NS**
+
+**Step 1:**
+
+Send the following CURL command in order to trigger the Termination of the Network Service. Ensure that you add the NS Instance ID received in the Create NS response to the URL Path (replacing <NS_INSTANCE_ID>):
+
+*Terminate NS Curl*
+
+.. code-block:: bash
+
+    curl -k -X POST -H "Authorization: Basic c28tZXRzaS1uZnZvLW5zLWxjbTpEdXJnMSREYWxhWG95ZA==" -H "accept: application/json" -H "Content-Type: application/json" -v http://so-etsi-nfvo-ns-lcm.onap:9095/so/so-etsi-nfvo-ns-lcm/v1/api/nslcm/v1/ns_instances/<NS_INSTANCE_ID>/terminate
+
+Similar to the Instantiate functionality, this is an asynchronous call, so you will receive a response confirming that the process has begun with a 202 Accepted HTTP Response Header. As above, view the specified debug.log files in order to view the progress.
+
+Once the full termination has been completed, reconnect to the "NFVO" database, within the Marie-Db-Galera-0 pod on your ONAP deployment. Retrieving all data from the "ns_inst" table again, you should see that the "STATUS" field for your NS has changed back to "NOT_INSTANTIATED".
+
+**Delete NS**
+
+**Step 1:**
+
+Finally send the following CURL command in order to trigger the Deletion of the Network Service. Ensure that you add the NS Instance ID received in the Create NS response to the URL Path (replacing <NS_INSTANCE_ID>):
+
+*Delete NS Curl*
+
+.. code-block:: bash
+
+    curl -k -X DELETE -H "Authorization: Basic c28tZXRzaS1uZnZvLW5zLWxjbTpEdXJnMSREYWxhWG95ZA==" -H "accept: application/json" -H "Content-Type: application/json" -v http://so-etsi-nfvo-ns-lcm.onap:9095/so/so-etsi-nfvo-ns-lcm/v1/api/nslcm/v1/ns_instances/<NS_INSTANCE_ID>
+
+Similar to the Create functionality, this is a synchronous call and as such you will receive a 204 No Content Http Response to your CURL command.
+
+Once the full deletion has been completed, reconnect to the "NFVO" database, within the Marie-Db-Galera-0 pod on your ONAP deployment. Retrieving all data from the "ns_inst" table again, you should no longer be able to see the NS Instance in the NS_INST table.
diff --git a/docs/developer_info/ETSI_VNF_LCM_Setup_Guide.rst b/docs/developer_info/ETSI_VNF_LCM_Setup_Guide.rst
new file mode 100644 (file)
index 0000000..2a74ed0
--- /dev/null
@@ -0,0 +1,595 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2021 Ericsson Software Technologies
+
+SO ETSI VNF LCM Setup & Functionality
+=================================================
+
+Introduction
+------------
+
+This guide will describe the steps required to execute the ETSI “Instantiate VNF” and “Terminate VNF” workflows using ONAP. The initial requirements you need for this guide are as follows:
+
+- A stable ONAP Deployment
+- ESR component enabled in ONAP installation.
+- SO-ETSI-SOL003-Adapter component enabled ONAP in installation.
+- A VNFM that is aligned to the Sol003 Interface (https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/003/02.03.01_60/gs_NFV-SOL003v020301p.pdf)
+- A Sol004 Aligned VNF package (https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/004/02.03.01_60/gs_nfv-sol004v020301p.pdf)
+
+
+Initial Configurations
+----------------------
+
+The following configurations need to be completed in order to execute the ETSI workflows and instantiate through the SO-ETSI-SOL003-Adapter.
+
+**Log into the MariaDB Database**
+
+Find your Mariadb pod:
+
+.. code-block:: bash
+
+    kubectl -n onap get pods | grep maria
+
+Exec into a Mariadb-Galera pod (replace <PODNAME> with the Mariadb pod name):
+
+.. code-block:: bash
+
+    kubectl -n onap -it exec <PODNAME> bash
+
+Log into the SQL database and connect to the "catalogdb" database. Follow the next steps in order to configure your ONAP's Mariadb database.
+
+**Enable the ETSI “Instantiate/Create” & “Terminate/Delete” building blocks.**
+
+Firstly, you will need to add the ETSI Create & Delete building blocks, this is done by inserting them into the “building_block_detail” table in the Mariadb’s “catalogdb” database.
+
+**Insert the ETSI Create Building Block:**
+
+.. code-block:: bash
+
+    insert into building_block_detail(building_block_name, resource_type, target_action) values (“EtsiVnfInstantiateBB”, “VNF”, “ACTIVATE”);
+
+**Insert ETSI Delete Building Block:**
+
+.. code-block:: bash
+
+    insert into building_block_detail(building_block_name, resource_type, target_action) values (“EtsiVnfDeleteBB”, “VNF”, “DEACTIVATE”);
+
+**View the “building_block_detail” table:**
+
+.. code-block:: bash
+
+    select * from building_block_detail;
+
+You should now have the entries in your “building_block_detail” table.
+
+
+
+Update the orchestration_flow_reference table
+---------------------------------------------
+
+Note: Standard VNF instantiation is unlikely to work once this step has been completed.
+
+The next step is to set which building blocks are triggered on a VNF instantiate request. We will also be setting the correct sequence for these building blocks.
+
+**View the VNF Create/Delete sequences from the “orchestration_flow_reference” table:**
+
+.. code-block:: bash
+
+    select * from orchestration_flow_reference where COMPOSITE_ACTION="VNF-Create";
+    select * from orchestration_flow_reference where COMPOSITE_ACTION="VNF-Delete";
+
+**Remove/Update current entries for “VNF-Create” & “VNF-Delete”:**
+
+Retrieve “ID” from “northbound_request_ref_lookup” table. Take note of the “ID” value for “VNF-Create” and “VNF-Delete”:
+
+.. code-block:: bash
+
+    select * from northbound_request_ref_lookup where REQUEST_SCOPE='Vnf' and IS_ALACARTE is true;
+
+Remove current VNF-Insert and insert ETSI VNF-Create, replace <ID> with the corresponding value retrieved from the “northbound_request_ref_lookup” table:
+
+.. code-block:: bash
+
+    delete from orchestration_flow_reference where COMPOSITE_ACTION = "VNF-Create";
+    insert into orchestration_flow_reference (COMPOSITE_ACTION,SEQ_NO,FLOW_NAME,FLOW_VERSION,NB_REQ_REF_LOOKUP_ID ) values ("VNF-Create",1,"AssignVnfBB",1,<ID>);
+    insert into orchestration_flow_reference (COMPOSITE_ACTION,SEQ_NO,FLOW_NAME,FLOW_VERSION,NB_REQ_REF_LOOKUP_ID ) values ("VNF-Create",2,"EtsiVnfInstantiateBB",1,<ID>);
+    insert into orchestration_flow_reference (COMPOSITE_ACTION,SEQ_NO,FLOW_NAME,FLOW_VERSION,NB_REQ_REF_LOOKUP_ID ) values ("VNF-Create",3,"ActivateVnfBB",1,<ID>);
+
+Remove current VNF-Delete and insert ETSI VNF-Delete, replace <ID> with the corresponding value retrieved from the “northbound_request_ref_lookup” table:
+
+.. code-block:: bash
+
+    delete from orchestration_flow_reference where COMPOSITE_ACTION = "VNF-Delete";
+    insert into orchestration_flow_reference (COMPOSITE_ACTION,SEQ_NO,FLOW_NAME,FLOW_VERSION,NB_REQ_REF_LOOKUP_ID ) values ("VNF-Delete",1,"EtsiVnfDeleteBB",1,<ID>);
+    insert into orchestration_flow_reference (COMPOSITE_ACTION,SEQ_NO,FLOW_NAME,FLOW_VERSION,NB_REQ_REF_LOOKUP_ID ) values ("VNF-Delete",2,"UnassignVnfBB",1,<ID>);
+
+
+You have now enabled the ETSI building blocks and configured the sequence of building blocks to execute.
+
+**Update the “orchestration_status_state_transition_directive” table**
+
+The last step that needs to take in the MariaDB, is to update the state transition table, in order to allow our ETSI Create building blocks to correctly change the operation status of a VNF. If the operation status is not allowed to change correctly, then our ETSI building block will be skipped and will not be executed.
+
+View the current “orchestration_status_state_transition_directive” setup.
+
+.. code-block:: bash
+
+    select * from orchestration_status_state_transition_directive where RESOURCE_TYPE='VNF' and ORCHESTRATION_STATUS='Created';
+
+Update the row that decides when a “VNF” with an orchestration status of “CREATED” has a target action of “ACTIVATE” to “CONTINUE” instead of “FAIL” using the following command:
+
+.. code-block:: bash
+
+    update orchestration_status_state_transition_directive set FLOW_DIRECTIVE='CONTINUE' where RESOURCE_TYPE='VNF' and ORCHESTRATION_STATUS='CREATED' and TARGET_ACTION='ACTIVATE' and FLOW_DIRECTIVE='FAIL';
+
+The transition directive is now set up correctly, allowing all of your ETSI building blocks to be executed correctly.
+
+
+Adding your VNFM to ONAP ESR
+----------------------------
+
+Now you will need to send a curl command to A&AI, in order to add the VNFM to ESR/A&AI.
+
+Please ensure you have ESR added to your ONAP installation before attempting this step. Next, you will need to populate the ESR VNFM List with information relating to the VNFM that you want to instantiate your VNFs through.
+
+**Adding your VNFM to ONAP ESR using CURL:**
+
+In order to use the curl command method, you will need to log into an ONAP pod, that is within your ONAP network. (This prevents us needing to go and get the AAI service IP and external port.)
+
+You can log into one of your pods with the following command (this example will use the BPMN-INFRA pod):
+
+.. code-block:: bash
+
+    kubectl -n onap get pods | grep bpmn
+
+Then take the full pod name and put it into this command instead of <PODNAME>:
+
+.. code-block:: bash
+
+    kubectl -n onap exec -it <PODNAME> sh
+
+Once Exec'ed into the pod you can run the following command which creates a VNFM, in ESR, with ID “ExampleVnfm”. (Edit this curl command to your needs before using it)
+
+.. code-block:: bash
+
+    curl -X PUT -H 'Accept: application/json' -H 'Authorization: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==' -H 'Content-Type: application/json' -H 'X-FromAppId:12' -H 'X-TransactionId: 12' https://aai.onap:8443/aai/v15/external-system/esr-vnfm-list/esr-vnfm/ExampleVnfm -d '{"vnfmId": "ExampleVnfm", "name": "ExampleVnfmName", "type": "ExampleVnfmType", "vendor": "est"}'
+
+One important thing to note in this curl command is the type: "ExampleVnfmType". This will be used in a later step for specifying which VNFM you want to instantiate through, take note of this.
+
+Once you have entered the previous information you need to add the “service-url” to your “esr-system-info” section of this VNFM you just added. Please note, that the “service-url” in the following curl command was designed to work with the “so-vnfm-simulator”, you will need to change this to match your specific VNFM’s “service-url”.
+
+You will need to put this data into the "external-system" and "cloud-infrastructure" API paths listed below. This is done with the following curl commands:
+
+**AAI Cloud-Infrastructure**
+
+.. code-block:: bash
+
+    curl -X PUT -H 'Accept: application/json' -H 'Authorization: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==' -H 'Content-Type: application/json' -H 'X-FromAppId:12' -H 'X-TransactionId: 12' https://aai.onap:8443/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/<CLOUD_OWNER>/<CLOUD_REGION_ID>/esr-system-info-list/esr-system-info/ExampleVnfm -d '{"name": "ExampleVnfm", "system-type": "ExampleVnfmType", "vimId": "myCloud", "vendor": "EST", "version": "V1.0", "certificateUrl": "", "url": "http://so-vnfm-simulator.onap:9095/vnflcm/v1/", "user-name": "testUser", "password": ""}'
+
+Please note you will need to replace <CLOUD_OWNER> and <CLOUD_REGION_ID> with their respective values in your ONAP deployment.
+
+**AAI External-System**
+
+.. code-block:: bash
+
+    curl -X PUT -H 'Accept: application/json' -H 'Authorization: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==' -H 'Content-Type: application/json' -H 'X-FromAppId:12' -H 'X-TransactionId: 12' https://aai.onap:8443/aai/v15/external-system/esr-vnfm-list/esr-vnfm/ExampleVnfm/esr-system-info-list/esr-system-info/ExampleEsrSystemInfo -d '{"esr-system-info-id": "ExampleEsrSystemInfo", "type": "ExampleVnfmType", "user-name": "user", "password": "password", "system-type": "VNFM", "service-url": "http://so-vnfm-simulator.onap:9095/vnflcm/v1"}'
+
+You have now entered your VNFM into the ESR/AAI components.
+
+Here are the equivalent GET commands for checking what is currently in your ESR/AAI list (change the IDs to match the IDs you used earlier):
+
+.. code-block:: bash
+
+    curl -H 'Accept: application/json' -H 'Authorization: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==' -H 'Content-Type: application/json' -H 'X-FromAppId:12' -H 'X-TransactionId: 12' https://aai.onap:8443/aai/v15/external-system/esr-vnfm-list/
+
+.. code-block:: bash
+
+    curl -H 'Accept: application/json' -H 'Authorization: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==' -H 'Content-Type: application/json' -H 'X-FromAppId:12' -H 'X-TransactionId: 12' https://aai.onap:8443/aai/v15/external-system/esr-vnfm-list/esr-vnfm/ExampleVnfmId/esr-system-info-list/esr-system-info
+
+
+Upload VNF Image to VNFM
+------------------------
+
+Currently, there is no implementation of the package management interface in the SO-ETSI-SOL003-Adapter, this means that the VNF image needs to be onboarded to your VNFM before instantiation. The VNF image will then be selected by using the VNF descriptor, found in one of the artifacts within the SDC onboarding package, mentioned later in this guide ("descriptor.yaml").
+
+This is an important step, which unfortunately can be drastically different depending on the specific vendor's VNFM.
+
+
+Onboarding a Virtual Software Product (VSP) with an ETSI HEAT Template.
+-----------------------------------------------------------------------
+
+Onboard a VNF package along with a Network Service CSAR into SDC.
+A video demonstration of this process "Onboarding ETSI Based NS" can be found under SO NFVO NS Onboarding and LCM Demonstrations
+It is recommended that you view this video before/alongside this section of the guide.
+
+**Step 1:**
+
+Login to the ONAP Portal. (Link: https://portal.api.simpledemo.onap.org:30225/ONAPPORTAL/login.htm (where "portal.api.simpledemo.onap.org" is set as the IP of your VM/host of your Portal component.)
+
+Login: cs0008
+Password: demo123456!
+
+**Step 2:**
+
+Select the SDC App. It is possible that your browser will block the scripts run by the Portal, you will need to enable them if it does.
+
+**Step 3:**
+
+Onboarding your VNF:
+1: Click the “ONBOARD” tab near the top of the window.
+2: Create a “VLM” if you have not created a "VLM" before.
+
+- From the “ONBOARD” page, click create VLM.
+- Enter name and description, then select create.
+- Click on the plus button beside Entitlement Pool.
+- Add Name and Manufacturing Reference Number, then click save.
+- Click on the plus button beside License Key Groups.
+- Add Name and select type, then click save.
+- Click on the plus button beside Feature Groups.
+- In the general tab, add name, Description and Part Number. Move to the Entitlements Pools tab, select the entitlement pool you just created and click the rightward arrow. Move to the License Key Group tab, select the license key group you just created and click the rightward arrow. Once these three things are done, click save.
+- Click on the plus button beside License Agreement.
+- Add Name and select License Term. Next move to the Feature Groups tab, select the Feature Group you just created and click the rightward arrow. Lastly click save.
+- On the overview page, select submit in the top right corner of the screen.
+- Enter a commit comment and click Commit & Submit.
+
+3: Create a Virtual Service Product (VSP)
+
+- Click the “ONBOARD” tab near the top of the window.
+- Click “CREATE NEW VSP” and fill in the required information. Make sure to select “Network Package” for the “ONBOARDING PROCEDURE” section. Then click “CREATE”.
+- Click where it shows “! Missing” underneath “License Agreement”. Simply select a “Licensing Version” and “License Agreement/Feature Group” from the drop downs.
+- Click the “Overview” tab on the left hand side. Then press “Select File” in the “SOFTWARE PRODUCT ATTACHMENTS” section and select your prepared VNF Package. If you are onboarding a supported zip, then click “PROCEED TO VALIDATION” once you can see your added files. You can safely ignore any warnings that come up at this step, but not any errors. (Note: The package validation does not support CSARs currently, they will still work however, providing they meet SDC requirements.)
+- Now click “Submit”.
+
+4: Then click “ONBOARD” in the top left. Hover your mouse over the small grey triangle that is just to the right of the “ONBOARD” tab and select “HOME”.
+
+5: Hover over the “IMPORT” square and select “Import VSP”. Find your VSP, click the drop-down arrow beside it and then press the “Import VSP” icon at the far right of the line that drops down.
+
+6: You will now be brought to the draft page of your VF. You can now Certify your VF, by clicking "Certify" in the top-right of the VF Page.
+
+Creating/Configuring your SDC Service:
+--------------------------------------
+
+**Step 1:**
+
+In the “HOME” tab of the SDC ONAP Portal, hover over the “ADD” square and select “ADD SERVICE”. Fill in the required fields, select the "Category" "Network Service" and press “Create” in the top right-hand corner.
+
+**Step 2:**
+
+You will be brought to the draft page of your Service. Go to the “Composition” tab on the left-hand side and drag/drop the VF, that you just created, into this service (you can search for the VF by name in the top left).
+
+**Step 3:**
+
+Now you will need to add the Network Service CSAR package to this service. You can do this by clicking in the blank whitespace of the composition, then on the right hand side of the page select the 2nd tab in order to add a deployment artifact. Click "ADD ARTIFACT" here, give an "Artifact Label" of "ns", any description value and ensure you choose a "Type" of "OTHER". Then click "DONE".
+
+**Step 4:**
+
+Finally you can click "Certify" in the top right hand corner, followed by "Distribute". Your Service will now distributed across ONAP.
+
+Preloading SDNC (Optional)
+--------------------------
+
+This next step is optional, and is only required if a user needs to add "addiional-params" or "virtual-link" information. You will need to preload SDNC with the required attributes for your VNF. You will need to access the SDNC OpenDaylight RestConf API Documentation in order to add these attributes.
+
+You will then be required to sign in once you access this site, the credentials are as follows, but may change in the future:
+
+Username:     admin
+
+Password:      Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+
+Next click on VNF-API.
+
+Then use the following endpoint to post the preload JSON, found below.
+
+Endpoint: restconf/operations/VNF-API:vnf-topology-operation
+
+The following section of code is an example of the JSON that needs to be uploaded to the SDNC OpenDaylight RestConf API Documentation site.
+
+Please note that you will need to set the attributes "generic-vnf-name" and "vnf-name" to the exact name that you will use when instantiating the VNF through VID. The attributes "generic-vnf-type" and "vnf-type" need to have the exact same name as the VSP that you imported to SDC, to create the VF.
+
+**Preload for SDNC:**
+
+.. code-block:: json
+
+    {
+        "input": {
+            "request-information": {
+                "notification-url": "openecomp.org",
+                "order-number": "1",
+                "order-version": "1",
+                "request-action": "PreloadVNFRequest",
+                "request-id": "robot21"
+            },
+            "sdnc-request-header": {
+                "svc-action": "reserve",
+                "svc-notification-url": "http://openecomp.org:8080/adapters/rest/SDNCNotify",
+                "svc-request-id": "robot21"
+            },
+            "vnf-topology-information": {
+                "vnf-assignments": {
+                    "availability-zones": [],
+                    "vnf-networks": [],
+                    "vnf-vms": []
+                },
+                "vnf-parameters": [{
+                    "vnf-parameter-name": "additionalParams",
+                    "vnf-parameter-value": "{\"key_1\": \"value_1\"}"
+                }, {
+                    "vnf-parameter-name": "extVirtualLinks",
+                    "vnf-parameter-value": "{}"
+                }],
+                "vnf-topology-identifier": {
+                    "generic-vnf-name": "VnfInstantiateName",
+                    "generic-vnf-type": "VspPackageName",
+                    "service-type": "vCPE",
+                    "vnf-name": "VnfInstantiateName",
+                    "vnf-type": "VspPackageName"
+                }
+            }
+        }
+    }
+
+
+The datatype of "additionalParams" and "extVirtualLinks" can be found in the Sol003 Specifications.
+
+The data must be JSON and contain only escaped strings. Here are examples of both:
+
+**Example of additionalParameters parameter:**
+
+.. code-block:: bash
+
+    {\"enableRollback\": \"false\"}
+
+
+**Example of extVirtualLinks Parameter:**
+
+.. code-block:: bash
+
+    [{\"id\":\"3b94d0be-6e37-4a01-920f-512e96803fc9\",\"tenant\":{\"cloudOwner\":\"CloudOwner\",\"regionName\":\"RegionOne\",\"tenantId\":\"f3d66580-7eff-4da5-8d27-91f984ad0c0b\"},\"resourceId\":\"e6e1a04d-c599-4b09-bc16-688834d0ac50\",\"extCps\":[{\"cpdId\":\"a83f86e0-7e9b-4514-9198-2d9eba91bd8e\",\"cpConfig\":[{\"cpInstanceId\":\"f966673d-fb96-41d4-8e5c-659f1c8c6bcc\",\"linkPortId\":null,\"cpProtocolData\":null}]}],\"extLinkPorts\":null}]
+
+
+Using VID to send Instantiate Request
+-------------------------------------
+
+In order to access the VID (Virtual Infrastructure Deployment) component through the portal, you will need to login with the id “demo”. Once logged in to VID, first ensure that the GR-API is set. First we will need to instantiate the service, once this is done we can then instantiate the VNF. This will be when the ETSI Workflows are run.
+
+**Deploy SDC Service**
+
+You will need to select “Deploy an SDC Service” on the left-hand side of the GUI. You should see your distributed service in the list of services shown here. (Note: if you cannot see your services here then you will need to go back to SDC, to check the status of the distribution.)
+
+- Press "Deploy" on the left-hand side of the service you have distributed.
+- Fill out the required fields and press "Confirm".
+- Wait for the Service to be instantiated.
+- Press "Close" at bottom of pop-up window.
+
+Now you should be brought to the "View/Edit Service Instance" page, focused on the service you just instantiated.
+
+**Instantiate VNF:**
+
+- Press "Add node instance" and select your VNF.
+- Fill out the required fields and press "Confirm".
+- Leave this VID page open, as this step can take quite some time, depending on a number of factors.
+- Monitor the VNF instantiation through your VNFM GUI and back through the SO-ETSI-SOL003-Adapter logs and finally the BPMN logs.
+- Upon success, your VNF should be instantiated correctly.
+
+
+**Delete VNF:**
+
+- Travel back to the service instance that you instantiated your VNF through.
+- Simply select the red X on the right-hand side of the VNF instance.
+- The VNF should begin terminating now, it may take quite some time, depending on a number of factors.
+- Monitor the VNFM GUI and other logs until success.
+
+
+Monitoring Logs (BPMN, SO-ETSI-SOL003-ADAPTER and VNFM)
+-------------------------------------------------------
+
+There are 3 stages of logs to monitor throughout the process of instantiating your service, and sending your request through the SO-ETSI-SOL003-Adapter, to your VNFM.
+
+The initial service instantiation request will be recorded in the BPMN-INFRA pod’s logs. Logging into this pod will enable you to view them through the "debug.log" file.
+
+The VNF instantiation request will appear first in the BPMN-INFRA pod’s logs, then once the ETSI Building Block is being executed you will see entries going through the SO-ETSI-SOL003-Adapter pod’s logs. Followed finally by the VNFM itself receiving a request from the SO-ETSI-SOL003-Adapter. This should all be recorded throughout the “debug.logs” on each of the mentioned pods.
+
+The other areas to monitor would be your VNFM’s GUI (if applicable), your Openstack Tenant’s logs as well as it’s server list and the SO-Admin-Cockpit tool (in order to see the BPMN flow’s progress).
+
+Example Zip VNF Package
+-----------------------
+
+Please follow the structure laid out below for creating your onboarding package.
+
+**Structure:**
+
+5 files (2 .yaml, 1 .meta, 1 .json, 1 .env)
+
+- base.yaml
+- descriptor.yaml
+- base.env
+- MANIFEST.json
+- TOSCA.meta
+- Compressed in a Zip folder.
+- No directories. (Flat structure)
+
+**Files:**
+
+base.yaml - This file will be a very simple HEAT template, as it is just required in order to be able to instantiate the Service once its distributed.
+
+descriptor.yaml - This file will contain the VNFD (Virtual Network Function Descriptor). It must be structured to match what the SO-ETSI-SOL003-Adapter searches for.
+
+base.env - This file simply contains some environment variables for the base.yaml.
+
+MANIFEST.json - This file lists all of the other files contained within it's package.
+
+TOSCA.meta - This important file contains the path of the VNFD, which will be used by the SO-ETSI-SOL003-Adapter.
+
+
+Please find example versions of the files below:
+
+**base.yaml**
+
+.. code-block:: bash
+
+    heat_template_version: 2013-05-23
+    description: Simple template to deploy a single compute instance
+
+    parameters:
+      simple_name_0:
+        type: string
+        label: Key Name
+        description: Name of key-pair to be used for compute instance
+      simple_key:
+        type: string
+        label: Key Name
+        description: Name of key-pair to be used for compute instance
+      simple_image_name:
+        type: string
+        label: Image ID
+        description: Image to be used for compute instance
+      simple_flavor_name:
+        type: string
+        label: Instance Type
+        description: Type of instance (flavor) to be used
+      vnf_id:
+        type: string
+        label: VNF ID
+        description: The VNF ID is provided by ONAP
+      vf_module_id:
+        type: string
+        label: vFirewall module ID
+        description: The vFirewall Module ID is provided by ONAP
+      simple_netid:
+        type: string
+        label: Netid
+        description: netid
+      public_net_id:
+        type: string
+        label: Netid
+        description: public NetId
+      ves_ip:
+        type: string
+        label: Netid
+        description: public ves_ip
+      node_ip:
+        type: string
+        label: Netid
+        description: public ves_ip
+
+    resources:
+
+      simple_0_private_port:
+        type: OS::Neutron::Port
+        properties:
+          network: { get_param: simple_netid }
+          fixed_ips:
+          - ip_address: { get_param: node_ip }
+
+      simple_0:
+        type: OS::Nova::Server
+        properties:
+          availability_zone: nova
+          key_name: { get_param: simple_key }
+          image: { get_param: simple_image_name }
+          flavor: { get_param: simple_flavor_name }
+          name: { get_param: simple_name_0 }
+          metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
+          networks:
+          - port: { get_resource: simple_0_private_port }
+          user_data_format: RAW
+          user_data:
+            str_replace:
+              params:
+                __ves_ip__: { get_param: ves_ip }
+                __vnfId__: { get_param: vnf_id }
+
+              template: |
+                #!/bin/bash
+
+                echo "the value we got for vndID was : __vnfId__" >> /tmp/vnfid.log
+
+    outputs:
+      oam_management_v4_address:
+        description: The IP address of the oam_management_v4_address
+        value: { get_param: node_ip  }
+
+
+**descriptor.yaml**
+
+.. code-block:: bash
+
+    tosca_definitions_version: tosca_simple_yaml_1_1
+
+    imports:
+        - etsi_nfv_sol001_vnfd_0_10_0_type.yaml
+
+    node_types:
+        Wiki.Demo.VnfmImageId:
+            derived_from: tosca.nodes.nfv.VNF
+            properties:
+                descriptor_id:
+                    type: string
+                    constraints: [ valid_values: [ VnfmImageId ] ]
+                    default: VnfmImageId
+
+
+The "descriptor.yaml" is the most important file within the package, as it provides the ID/Name of the VNF package for the VNFM to use when instantiating. It must follow the structure above, or the SO-ETSI-SOL003-Adapter will not be able to locate the VNFD. 
+
+Don't forget to replace "VnfmImageId" with the ID of your VNF package.
+
+**base.env**
+
+.. code-block:: bash
+
+    parameters:
+      simple_image_name: UBUNTU16
+      simple_flavor_name: m1.small
+      simple_name_0: SIMPLEUBU
+      simple_key: demo-key
+      vnf_id: VESMED
+      vf_module_id: vfModuleId
+      simple_netid:  onap_vip
+      public_net_id: nova_floating
+      ves_ip: 172.55.10.10
+      node_ip: 172.55.10.10
+
+
+**MANIFEST.json**
+
+.. code-block:: json
+
+    {
+        "name": "MMEPackage",
+        "description": "Test",
+        "version": "0.0",
+        "data": [{
+            "isBase": true,
+            "file": "base.yaml",
+            "type": "HEAT",
+            "data": [{
+                "file": "base.env",
+                "type": "HEAT_ENV"
+            }]
+        },
+        {
+            "file": "descriptor.yaml",
+            "type": "OTHER"
+        },
+        {
+            "file": "TOSCA.meta",
+            "type": "OTHER"
+        }]
+    }
+
+
+**TOSCA.meta**
+
+.. code-block:: bash
+
+    TOSCA-Meta-File-Version: 1.0
+    CSAR-Version: 1.1
+    Created-by: Demo
+    Entry-Definitions: Artifacts/Deployment/OTHER/descriptor.yaml
+
+
+The MANIFEST.json and TOSCA.meta are extremely important, if either are incorrectly formatted it will either fail to onboard or fail to distribute when you get to that step.
+
+Ensure that the file names all match and your indentation/quotes are all correct, as it will save you a lot of time.
+
+
diff --git a/docs/developer_info/SO_Admin_Cockpit_User_Guide.rst b/docs/developer_info/SO_Admin_Cockpit_User_Guide.rst
new file mode 100644 (file)
index 0000000..2144bf8
--- /dev/null
@@ -0,0 +1,139 @@
+
+SO Admin Cockpit User Guide
+===========================
+
+Introduction
+------------
+
+The SO-Admin-Cockpit component allows a user to have a detailed monitoring view of the Camunda BPMN workflows that have run, or are running, in SO. It provides a frontend UI that allows users to easily go through a workflow’s different calls and drill up/down through the call activities within the workflow. It also provides a search page for filtering specific results. It allows you to filter by start/end time/date, instance id, request id, service name or by the status of a workflow. The component is extremely useful for debugging and testing workflows of any kind, as it delivers an understandable and simple UI which is much easier to follow than large, cumbersome debug log files. Additionally the UI provides a statistics page, based on your current search parameters, that provides the percentages of complete, failed, in progress, pending and unlocked workflows.
+
+(Previous to the Honolulu release of ONAP SO-Admin-Cockpit was named SO-Monitoring, an additional change in the controller is required to change the Host name to SO-Admin-Cockpit, as it remains as SO-Monitoring currently)
+
+Using SO-Admin-Cockpit
+----------------------
+
+In order to make use of SO-Admin-Cockpit currently, you will need to onboard the application in the ONAP portal or access the SO-Admin-Cockpit UI directly. This can be done using the host name “so-admin-cockpit", and the port number, which by default is “30224”. First you need to make sure you can access the ONAP portal, this is done by adding the following to your "hosts" file:
+
+.. code-block:: bash
+
+ <onapVmIp> portal.api.simpledemo.onap.org
+
+Replacing <onapVmIp> with the IP of your device hosting your Portal pod within ONAP. Add this to a blank line in your hosts file, usually found in “C:\Windows\System32\drivers\etc” on Windows. Ensure you open the host file as an administrator in order to edit it.
+
+Alternatively you can access SO-Admin-Cockpit directly by simply adding the following line to your "hosts" file:
+
+.. code-block:: bash
+
+ <soAdminCockpitVmIp> so-monitoring
+
+Where <soAdminCockpitVmIp> is replaced with the IP of the device hosting your SO-Admin-Cockpit pod.
+Then accessing the following link through your browser:
+
+.. code-block:: bash
+
+ https://so-monitoring:30224/
+
+Steps to add SO-Admin-Cockpit to the Portal
+-------------------------------------------
+
+In Pre-Casablanca releases you will need to expose the so-monitoring service using a Loadbalancer in order to access it, this is simple until there is a NodePort assigned to SO-Monitoring. Use this command to expose the service:
+
+.. code-block:: bash
+
+ kubectl expose services so-monitoring --type=LoadBalancer --port 9091 --target-port=9091 --name=so-monitoring-external -n onap
+
+Log into your ONAP Portal as the super user
+
+- Login: demo
+- Password: demo123456!
+
+Click “Application Onboarding”, then “Add App” in the top right.
+Fill out the required Application Details (Name, URL, REST API URL, Username, Password) as shown here:
+
+-        Application Name: SO-Admin-Cockpit
+-        URL: https://so-monitoring:30224
+-        Rest API URL: https://so-monitoring:30224
+-        Username: demo
+-        Password: <PASSWORD>
+-        Namespace: SO-Admin-Cockpit
+
+Please note, the <PASSWORD> can be retrieved by logging into the SO-Admin-Cockpit pod and retrieving the environment variables using the following command:
+
+.. code-block:: bash
+
+ env | grep SO_COCKPIT
+
+Now simply go to the “Application Catalog” tab on the left of the page, then tick your Monitoring app to enable it. (Whatever you set Application Name as should show up here.) Click the “Home” tab and you should be able to access the Admin Cockpit now.
+
+Searching/Viewing BPMN Workflows
+--------------------------------
+
+In order to find the workflow that you are attempting to monitor you will need at least one of the following values of the service instance: Service Instance ID, Request ID, Service Name or the time/date range in which the workflow started/ended. You can use the filter drop-down boxes to the left of the parameter boxes, i.e. “EQUAL”, “NOT EQUAL” and “LIKE”. Also, you can filter by the status of a workflow, with the status drop-down box, to further filter your results. Simply enter any of these pieces of information into the search page, ensure the start and end date range includes when the workflow would have run and press the search button. Once your results list has been returned you can click on a result to see the workflow in the graphical BPMN viewer.
+
+From here you can inspect the different calls and variables throughout the workflow, by using the "Activity Instances" and "Variable Instances" tabs. Clicking on one of the sub process call, within the diagram, to open them in the graphical BPMN viewer (The boxes with a + at the bottom of them are call activities to sub processes. This is how you drill down through a workflow, you can also safely traverse back “up” through the flows with your browser’s back button. The cyan highlighting shows the flow of the path taken by the workflow, and this will go down through each of the sub processes as well.
+
+In the BPMN viewer, manipulation of the returned illustrated flow is possible by using the following methods. On the left side of the viewer window there are three symbols for Zooming in/out and fitting the flow to the full window. Along with these controls, the user can left-click and drag to move the flow within the canvas to the user desired position.
+
+SO-Monitoring Service Statistics
+--------------------------------
+
+You can see a summary of the status of all of the workflows from one of your search results by clicking on the "Service Statistics" tab, found just above your list of results. Here you can find a percentile breakdown of each workflow's, in the list of results you received, statuses.
+
+Troubleshooting SO-Admin-Cockpit
+--------------------------------
+
+The log files for SO-Admin-Cockpit can be found within the SO-Admin-Cockpit pod. They will be located in the “/app/logs/so-admin-cockpit" directory. You will find a debug, error, metric and audit log file here. They each contain differing information, except the debug log file which will contain all of the logging information. Alternatively you can get the logs from the SO-Admin-Cockpit pod itself when using Kubernetes. Using the following command:
+
+.. code-block:: bash
+
+ kubectl -n <namespace> logs <soAdminCockpitPodName>
+
+Replacing <namespace> with your environments namespace and <soAdminCockpitPodName> with the full name of your SO-Admin-Cockpit pod. This command will give you some detailed information from the execution of the pod.
+
+CORS (Cross-Origin Resource Sharing) Error
+----------
+
+Pre-Dublin SO-Monitoring Components may experience CORS issues.
+
+To check for this error open up the console of the browser you are using. In Mozilla Firefox do this by pressing CTRL + SHIFT + C and then selecting the console. In Google Chrome this is done by CTRL + SHIFT + I and then selecting the console. If an exception relating to CORS is displayed, then this issue must be addressed.
+
+This can be dealt with in two ways. Either using an extension or by disabling CORS in the browser.
+
+- If using Firefox then the CORS Everywhere extension should be used. While if using Chrome the Allow-Control-Allow-Origin should be used.
+- To disable the CORS in Chrome, follow this thread (https://stackoverflow.com/questions/3102819/disable-same-origin-policy-in-chrome).
+
+Internal Service Error occurred for operation : GET please check backend  service log. status code: 500
+-------------------------------------------------------------------------------------------------------
+
+This can be checked by following the below steps:
+
+- Open the developers mode in your browser
+- Click on Console
+- Check to see if an error occurs similar to the following:
+
+.. code-block:: bash
+
+ Error : No serializer found for class org.onap.so.bpmn.core.RollbackData and no properties discovered to create BeanSerializer
+
+This issue could be associated with any one of the objects being used in the BPMN flows, when it's declared as a java object but attempted to be serialized without marking/declaring it as serializable. So the issue must be fixed at the Object level, by ensuring any objects used by the particular BPMN Flow are made serializable.
+
+SO Admin Cockpit App creates a Blank Tab
+----------------------------------------
+
+If when selecting SO Admin Cockpit from the portal a blank tab labeled “SO Admin Cockpit" is returned, then the issue may relate the URL you are using in portal by default.
+
+A fix for this issue is to change “https” to “http” and change the port from “30224” to “30215”, within the browser URL.
+
+For example, using this URL:
+
+.. code-block:: bash
+
+ http://portal.api.simpledemo.onap.org:30215/ONAPPORTAL/applicationsHome
+
+Instead of the default URL:
+
+.. code-block:: bash
+
+ https://portal.api.simpledemo.onap.org:30225/ONAPPORTAL/applicationsHome
+
+
diff --git a/docs/images/abort.png b/docs/images/abort.png
new file mode 100644 (file)
index 0000000..dcbb51d
Binary files /dev/null and b/docs/images/abort.png differ
diff --git a/docs/images/handling_error.png b/docs/images/handling_error.png
new file mode 100644 (file)
index 0000000..58708ab
Binary files /dev/null and b/docs/images/handling_error.png differ
diff --git a/docs/images/rainy_day_handler_macro_table.png b/docs/images/rainy_day_handler_macro_table.png
new file mode 100644 (file)
index 0000000..1f127f9
Binary files /dev/null and b/docs/images/rainy_day_handler_macro_table.png differ
diff --git a/docs/images/retry.png b/docs/images/retry.png
new file mode 100644 (file)
index 0000000..9bd6083
Binary files /dev/null and b/docs/images/retry.png differ
diff --git a/docs/images/retry2.png b/docs/images/retry2.png
new file mode 100644 (file)
index 0000000..1635f45
Binary files /dev/null and b/docs/images/retry2.png differ
diff --git a/docs/images/retry3.png b/docs/images/retry3.png
new file mode 100644 (file)
index 0000000..7fbb913
Binary files /dev/null and b/docs/images/retry3.png differ
diff --git a/docs/images/retry_Bdd.png b/docs/images/retry_Bdd.png
new file mode 100644 (file)
index 0000000..ee52e76
Binary files /dev/null and b/docs/images/retry_Bdd.png differ
diff --git a/docs/images/retry_Bdd2.png b/docs/images/retry_Bdd2.png
new file mode 100644 (file)
index 0000000..33ee2cb
Binary files /dev/null and b/docs/images/retry_Bdd2.png differ
diff --git a/docs/images/rollback.png b/docs/images/rollback.png
new file mode 100644 (file)
index 0000000..82cb934
Binary files /dev/null and b/docs/images/rollback.png differ
diff --git a/docs/images/rollback_Bdd.png b/docs/images/rollback_Bdd.png
new file mode 100644 (file)
index 0000000..a8fd8fe
Binary files /dev/null and b/docs/images/rollback_Bdd.png differ