diff options
7 files changed, 400 insertions, 2 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java index 9828d11186..c05557a317 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java @@ -78,8 +78,24 @@ public class ApplicationControllerAction { appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType); break; case Snapshot: + if (vmIdList.isEmpty()) { + logger.warn("vmIdList is Empty in AppCClient"); + break; + } String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds"); + if (vmIds == null) { + logger.warn("vmIds null in AppCClient"); + break; + } + if (vserverIdList.isEmpty()) { + logger.warn("vserverIdList is empty in AppCClient"); + break; + } String vserverIds = JsonUtils.getJsonValue(vserverIdList, "vserverIds"); + if (vserverIds == null) { + logger.warn("vserverIds null in AppCClient"); + break; + } String vmId = ""; String vserverId = ""; ObjectMapper mapper = new ObjectMapper(); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java index 32db3a7bf6..48c6995715 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java @@ -481,4 +481,100 @@ public class ApplicationControllerActionTest extends BaseTest { assertEquals(expectedErrorCode, appCAction.getErrorCode()); } + @Test + public void runAppCCommand_Snapshot_vmIdList_Empty_Test() + throws ApplicationControllerOrchestratorException, JsonProcessingException { + Action action = Action.Snapshot; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("identityUrl", "testIdentityUrl"); + String controllerType = "testControllerType"; + + Status status = new Status(); + Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", "identityUrl"); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType); + + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType); + } + + @Test + public void runAppCCommand_Snapshot_vmId_null_Test() + throws ApplicationControllerOrchestratorException, JsonProcessingException { + Action action = Action.Snapshot; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("identityUrl", "testIdentityUrl"); + + JSONObject vmIdListJson = new JSONObject(); + payloadInfo.put("vmIdList", vmIdListJson.toString()); + String controllerType = "testControllerType"; + + Status status = new Status(); + Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", payloadInfo.get("identityUrl")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType); + + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType); + } + + @Test + public void runAppCCommand_Snapshot_vserverIdList_Empty_Test() + throws ApplicationControllerOrchestratorException, JsonProcessingException { + Action action = Action.Snapshot; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("identityUrl", "testIdentityUrl"); + ArrayList<String> vmIdList = new ArrayList<String>(); + String vmId = "testlink:testVmId"; + vmIdList.add(vmId); + JSONObject vmIdListJson = new JSONObject(); + vmIdListJson.put("vmIds", vmIdList); + payloadInfo.put("vmIdList", vmIdListJson.toString()); + String controllerType = "testControllerType"; + + Status status = new Status(); + Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType); + + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType); + } + + @Test + public void runAppCCommand_Snapshot_vserverId_null_Test() + throws ApplicationControllerOrchestratorException, JsonProcessingException { + Action action = Action.Snapshot; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("identityUrl", "testIdentityUrl"); + ArrayList<String> vmIdList = new ArrayList<String>(); + String vmId = "testlink:testVmId1"; + vmIdList.add(vmId); + JSONObject vmIdListJson = new JSONObject(); + vmIdListJson.put("vmIds", vmIdList); + payloadInfo.put("vmIdList", vmIdListJson.toString()); + JSONObject vserverIdListJson = new JSONObject(); + payloadInfo.put("vserverIdList", vserverIdListJson.toString()); + String controllerType = "testControllerType"; + + Status status = new Status(); + Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType); + + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index 638ecefa49..a436f7b5c2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -99,6 +99,7 @@ public class ExecuteActivity implements JavaDelegate { variables.put(G_REQUEST_ID, requestId); variables.put("retryCount", 1); variables.put("aLaCarte", true); + variables.put("suppressRollback", true); execution.getVariables().forEach((key, value) -> { if (value instanceof Serializable) { diff --git a/docs/developer_info/developer_information.rst b/docs/developer_info/developer_information.rst index ac1a15b8b9..10ea8360b9 100644 --- a/docs/developer_info/developer_information.rst +++ b/docs/developer_info/developer_information.rst @@ -8,14 +8,15 @@ SO Developer Information .. toctree:: :maxdepth: 1 - Camunda_Modeler.rst + Building_SO.rst Working_with_SO_Docker.rst Camunda_Cockpit_Community_Edition.rst Camunda_Cockpit_Enterprise_Edition.rst - Camunda_Modeler + Camunda_Modeler.rst BPMN_Project_Structure.rst BPMN_Main_Process_Flows.rst BPMN_Subprocess_Process_Flows.rst BPMN_Project_Deployment_Strategy.rst + instantiate/index.rst FAQs.rst diff --git a/docs/developer_info/instantiate/index.rst b/docs/developer_info/instantiate/index.rst new file mode 100644 index 0000000000..21177b59ad --- /dev/null +++ b/docs/developer_info/instantiate/index.rst @@ -0,0 +1,31 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 +.. International License. http://creativecommons.org/licenses/by/4.0 +.. Copyright 2017 AT&T Intellectual Property. All rights reserved. + + +Instantiate +=========== +The following guides are provided to describe tasks that a user of +ONAP may need to perform when instantiating a service. + +Instantiation includes the following topics: + +.. toctree:: + :maxdepth: 2 + + Pre-instantiation operations <./pre_instantiation/index.rst> + + Instantiation operation(s) <./instantiation/index.rst> + + +**e2eServiceInstance** method is a hard-coded approach with dedicated/specific +service BPMN workflow. That means it is linked to ONAP source code +and lifecycle. + +**A La Carte** method requires the Operations actor to build and send +a lot of operations. To build those requests, Operator actor needs to +define/collect by himself all VNF parameters/values. + +**Macro** method required the Operations actor to build and send only one +request and, thanks to CDS Blueprint templates, ONAP will collect and assign +all required parameters/values by itself. diff --git a/docs/developer_info/instantiate/instantiation/index.rst b/docs/developer_info/instantiate/instantiation/index.rst new file mode 100644 index 0000000000..455bdf070e --- /dev/null +++ b/docs/developer_info/instantiate/instantiation/index.rst @@ -0,0 +1,28 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 +.. International License. http://creativecommons.org/licenses/by/4.0 +.. Copyright 2019 ONAP Contributors. All rights reserved. + +.. _doc_guide_user_ser_inst: + + +Service Instantiation methods +============================= + + +Declare PNF instances: + +.. toctree:: + :maxdepth: 2 + + Declare PNF instances <./pnf_instance/index.rst> + +Instantiate a Service: + +.. toctree:: + :maxdepth: 2 + + using ONAP VID Portal with "A La Carte" method <./vid/index.rst> + using ONAP UUI Portal with "e2eServiceInstance" method <./uui/index.rst> + using ONAP NBI REST API (TM Forum) <./nbi/index.rst> + using ONAP SO REST API with "A La Carte" method <./so1/index.rst> + using ONAP SO REST API with "Macro" mode method <./so2/index.rst> diff --git a/docs/developer_info/instantiate/pre_instantiation/index.rst b/docs/developer_info/instantiate/pre_instantiation/index.rst new file mode 100644 index 0000000000..ca9af13d7d --- /dev/null +++ b/docs/developer_info/instantiate/pre_instantiation/index.rst @@ -0,0 +1,225 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 +.. International License. http://creativecommons.org/licenses/by/4.0 +.. Copyright 2019 ONAP Contributors. All rights reserved. + +.. _doc_guide_user_pre_ser-inst: + + +Pre Service instantiation Operations +==================================== + +Several operations need to be performed after Service model distribution, +but before instantiating a service. + +Those operations are only available via REST API requests. + +Various tools can be used to send REST API requests. + +Here after are examples using "curl" command line tool that you can use in +a Unix Terminal. + + +Declare owningEntity, lineOfBusiness, Platform and Project +---------------------------------------------------------- + +At one point during Service Instantiation, the user need to select values for +those 4 parameters + +* Owning Entity +* Line Of Business +* Platform +* Project + + +Those parameters and values must be pre-declared in ONAP VID component +using REST API + +Those informations will be available to all service instantiation +(you only need to declare them once in ONAP) + + +Example for "Owning Entity" named "Test" + +:: + + curl -X POST \ + http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/owningEntity \ + -H 'Accept-Encoding: gzip, deflate' \ + -H 'Content-Type: application/json' \ + -H 'cache-control: no-cache' \ + -d '{ + "options": ["Test"] + }' + +Example for "platform" named "Test_Platform" + +:: + + curl -X POST \ + http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/platform \ + -H 'Content-Type: application/json' \ + -H 'cache-control: no-cache' \ + -d '{ + "options": [""Test_Platform"] + }' + +Example for "line of business" named "Test_LOB" + +:: + + curl -X POST \ + http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/lineOfBusiness \ + -H 'Content-Type: application/json' \ + -H 'cache-control: no-cache' \ + -d '{ + "options": ["Test_LOB"] + }' + +Example for "project" named "Test_project" + +:: + + curl -X POST \ + http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/project \ + -H 'Content-Type: application/json' \ + -H 'cache-control: no-cache' \ + -d '{ + "options": ["Test_project"] + }' + + + + +Declare a customer +------------------ + +Each time you have a new customer, you will need to perform those operations + +This operation is using ONAP AAI REST API + +Any service instance need to be linked to a customer + +in the query path, you put the customer_name + +in the query body you put the customer name again + +Here after an example to declare a customer named "my_customer_name" + + +:: + + curl -X PUT \ + https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name \ + -H 'Accept: application/json' \ + -H 'Authorization: Basic QUFJOkFBSQ==' \ + -H 'Content-Type: application/json' \ + -H 'X-FromAppId: AAI' \ + -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \ + -H 'cache-control: no-cache' \ + -d '{ + "global-customer-id": "my_customer_name", + "subscriber-name": "my_customer_name", + "subscriber-type": "INFRA" + }' -k + + +check customers in ONAP AAI (you should see if everything ok in the response) + +:: + + curl -X GET \ + https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers \ + -H 'Accept: application/json' \ + -H 'Authorization: Basic QUFJOkFBSQ==' \ + -H 'Content-Type: application/json' \ + -H 'X-FromAppId: AAI' \ + -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \ + -H 'cache-control: no-cache' -k + + +Associate Service Model to Customer +----------------------------------- + + +This operation is using ONAP AAI REST API + +in the query path, you put the customer_name and the service model name + +in the query body you put the service model UUID + +:: + + curl -X PUT \ + https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions/service-subscription/my_service_model_name \ + -H 'Accept: application/json' \ + -H 'Authorization: Basic QUFJOkFBSQ==' \ + -H 'Content-Type: application/json' \ + -H 'Postman-Token: d4bc4991-a518-4d75-8a87-674ba44bf13a' \ + -H 'X-FromAppId: AAI' \ + -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \ + -H 'cache-control: no-cache' \ + -d '{ + "service-id": "11265d8c-2cc2-40e5-95d8-57cad81c18da" + }' -k + + + + +Associate Cloud Site to Customer +-------------------------------- + +in the query path, you put the customer_name and the service model name + +in the query body you put the cloud owner name, the cloud site name, +the tenant id and the tenant name + + +:: + + curl -X PUT \ + https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions/service-subscription/my_service_model_name/relationship-list/relationship \ + -H 'Accept: application/json' \ + -H 'Authorization: Basic QUFJOkFBSQ==' \ + -H 'Content-Type: application/json' \ + -H 'Postman-Token: 11ea9a9e-0dc8-4d20-8a78-c75cd6928916' \ + -H 'X-FromAppId: AAI' \ + -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \ + -H 'cache-control: no-cache' \ + -d '{ + "related-to": "tenant", + "related-link": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/my_cloud_owner_name/my_cloud_site_name/tenants/tenant/234a9a2dc4b643be9812915b214cdbbb", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "my_cloud_owner_name" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "my_cloud_site_name" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "234a9a2dc4b643be9812915b214cdbbb" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "my_tenant_name" + } + ] + }' -k + + +check (you should see if everything ok in the response) + +:: + + curl -X GET \ + 'https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions?depth=all' \ + -H 'Accept: application/json' \ + -H 'Authorization: Basic QUFJOkFBSQ==' \ + -H 'Content-Type: application/json' \ + -H 'X-FromAppId: AAI' \ + -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \ + -H 'cache-control: no-cache' -k |