diff options
12 files changed, 424 insertions, 24 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index a9af3683f5..e95e9a3a83 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -11,9 +11,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -370,8 +370,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); notifyPort.deleteNetworkNotification(messageId, false, exCat, eMsg, null); } catch (Exception e1) { - logger.error("{} {} Error sending createNetwork notification {} ", - MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(), e1); + logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, + ErrorCode.DataError.getValue(), e1.getMessage(), e1); } return; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index c934291246..4c115271f0 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -90,6 +90,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private static final String NETWORK_FQDN = "network_fqdn"; private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork"; private static final String NEUTRON_MODE = "NEUTRON"; + private static final String CLOUD_OWNER = "CloudOwner"; private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class); @@ -310,7 +311,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { StackInfo heatStack = null; long queryNetworkStarttime = System.currentTimeMillis(); try { - heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName); + heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName); } catch (MsoException me) { me.addContext(CREATE_NETWORK_CONTEXT); logger.error("{} {} Create Network (heat): query network {} in {}/{}: ", @@ -424,7 +425,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { try { if (backout == null) backout = true; - heatStack = heat.createStack(cloudSiteId, "CloudOwner", tenantId, networkName, null, template, + heatStack = heat.createStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName, null, template, stackParams, true, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue()); } catch (MsoException me) { me.addContext(CREATE_NETWORK_CONTEXT); @@ -607,7 +608,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { StackInfo heatStack = null; long queryStackStarttime = System.currentTimeMillis(); try { - heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName); + heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName); } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, @@ -727,7 +728,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Ignore MsoStackNotFound exception because we already checked. long updateStackStarttime = System.currentTimeMillis(); try { - heatStack = heatWithUpdate.updateStack(cloudSiteId, "CloudOwner", tenantId, networkId, template, + heatStack = heatWithUpdate.updateStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId, template, stackParams, true, heatTemplate.getTimeoutMinutes()); } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); @@ -919,7 +920,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { StackInfo heatStack = null; long queryStackStarttime = System.currentTimeMillis(); try { - heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkNameOrId); + heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkNameOrId); } catch (MsoException me) { me.addContext("QueryNetwork"); logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, @@ -1072,9 +1073,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // was deleted. // So query first to report back if stack WAS deleted or just NOTOFUND StackInfo heatStack = null; - heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkId); + heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId); if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) { - heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true); + heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true); networkDeleted.value = true; } else { networkDeleted.value = false; @@ -1157,7 +1158,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { try { // The deleteStack function in MsoHeatUtils returns success if the stack // was not found. So don't bother to query first. - heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true); + heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true); } catch (MsoException me) { me.addContext("RollbackNetwork"); logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ", diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java index df2c3a2973..4eb5d5637f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java @@ -90,6 +90,7 @@ public class NetworkAdapterRest { private static final String TESTING_KEYWORD = "___TESTING___"; private String exceptionMsg = "Exception:"; private static final String SHARED = "shared"; + private static final String EXTERNAL = "external"; @Autowired private MsoNetworkAdapterImpl adapter; @@ -207,8 +208,8 @@ public class NetworkAdapterRest { shared = ctn.getShared(); } } - if (params.containsKey("external")) { - external = params.get("external"); + if (params.containsKey(EXTERNAL)) { + external = params.get(EXTERNAL); } else { if (ctn.getExternal() != null) { external = ctn.getExternal(); @@ -228,8 +229,8 @@ public class NetworkAdapterRest { } if (params.containsKey(SHARED)) shared = params.get(SHARED); - if (params.containsKey("external")) - external = params.get("external"); + if (params.containsKey(EXTERNAL)) + external = params.get(EXTERNAL); adapter.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), req.getModelCustomizationUuid(), req.getNetworkName(), req.getProviderVlanNetwork().getPhysicalNetworkName(), @@ -603,8 +604,8 @@ public class NetworkAdapterRest { shared = ctn.getShared(); } } - if (params.containsKey("external")) { - external = params.get("external"); + if (params.containsKey(EXTERNAL)) { + external = params.get(EXTERNAL); } else { if (ctn.getExternal() != null) { external = ctn.getExternal(); @@ -624,8 +625,8 @@ public class NetworkAdapterRest { if (params.containsKey(SHARED)) { shared = params.get(SHARED); } - if (params.containsKey("external")) { - external = params.get("external"); + if (params.containsKey(EXTERNAL)) { + external = params.get(EXTERNAL); } adapter.updateNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(), diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index 96e5db7ce7..f09fa34cb9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -854,7 +854,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Include aliases. String alias = htp.getParamAlias(); - if (alias != null && !alias.equals("") && !params.containsKey(alias)) { + if (alias != null && !"".equals(alias) && !params.containsKey(alias)) { params.put(alias, htp); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index d5fe285274..41bcc8c481 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -323,7 +323,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String type = templateParam.getParamType(); logger.debug("Parameter: {} is of type ", templateParam.getParamName(), type); - if (type.equalsIgnoreCase("number")) { + if ("number".equalsIgnoreCase(type)) { try { return Integer.valueOf(inputValue.toString()); } catch (Exception e) { 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 |