diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
30 files changed, 1010 insertions, 100 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index 6b89387a82..e83c27c400 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.buildingblock; import static org.apache.commons.lang3.StringUtils.*; import java.time.Duration; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; @@ -57,7 +58,14 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.sniro.SniroClient; import static org.onap.so.client.sniro.SniroValidator.*; +import org.onap.so.client.sniro.beans.Demand; +import org.onap.so.client.sniro.beans.LicenseInfo; +import org.onap.so.client.sniro.beans.ModelInfo; +import org.onap.so.client.sniro.beans.PlacementInfo; +import org.onap.so.client.sniro.beans.RequestInfo; +import org.onap.so.client.sniro.beans.ServiceInfo; import org.onap.so.client.sniro.beans.SniroManagerRequest; +import org.onap.so.client.sniro.beans.SubscriberInfo; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; @@ -122,27 +130,27 @@ public class SniroHomingV2 { timeout = env.getProperty("sniro.manager.timeout", "PT30M"); } - SniroManagerRequest request = new SniroManagerRequest(); //TODO Add additional pojos for each section + SniroManagerRequest request = new SniroManagerRequest(); - JSONObject requestInfo = buildRequestInfo(requestId, timeout); - request.setRequestInformation(requestInfo.toString()); + RequestInfo requestInfo = buildRequestInfo(requestId, timeout); + request.setRequestInformation(requestInfo); - JSONObject serviceInfo = buildServiceInfo(serviceInstance); - request.setServiceInformation(serviceInfo.toString()); + ServiceInfo serviceInfo = buildServiceInfo(serviceInstance); + request.setServiceInformation(serviceInfo); - JSONObject placementInfo = buildPlacementInfo(customer, requestParams); + PlacementInfo placementInfo = buildPlacementInfo(customer, requestParams); - JSONArray placementDemands = buildPlacementDemands(serviceInstance); - placementInfo.put("placementDemands", placementDemands); - request.setPlacementInformation(placementInfo.toString()); + List<Demand> placementDemands = buildPlacementDemands(serviceInstance); + placementInfo.setDemands(placementDemands); + request.setPlacementInformation(placementInfo); - JSONObject licenseInfo = new JSONObject(); + LicenseInfo licenseInfo = new LicenseInfo(); - JSONArray licenseDemands = buildLicenseDemands(serviceInstance); - licenseInfo.put("licenseDemands", licenseDemands); - request.setLicenseInformation(licenseInfo.toString()); + List<Demand> licenseDemands = buildLicenseDemands(serviceInstance); + licenseInfo.setDemands(licenseDemands); + request.setLicenseInformation(licenseInfo); - if(placementDemands.length() > 0 || licenseDemands.length() > 0){ + if(placementDemands.size() > 0 || licenseDemands.size() > 0){ client.postDemands(request); }else{ log.debug(SERVICE_MISSING_DATA + "resources eligible for homing or licensing"); @@ -156,10 +164,13 @@ public class SniroHomingV2 { log.trace("Completed Sniro Homing Call Sniro"); }catch(BpmnError e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); }catch(BadResponseException e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); }catch(Exception e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing sniro request: " + e.getMessage()); } } @@ -203,10 +214,13 @@ public class SniroHomingV2 { log.trace("Completed Sniro Homing Process Solution"); }catch(BpmnError e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); }catch(BadResponseException e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); }catch(Exception e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage()); } } @@ -216,18 +230,21 @@ public class SniroHomingV2 { * * @throws Exception */ - private JSONObject buildRequestInfo(String requestId, String timeout) throws Exception{ + private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{ log.trace("Building request information"); - JSONObject requestInfo = new JSONObject(); + RequestInfo requestInfo = new RequestInfo(); if(requestId != null){ String host = env.getProperty("mso.workflow.message.endpoint"); String callbackUrl = host + "/" + UriUtils.encodePathSegment("SNIROResponse", "UTF-8") + "/" + UriUtils.encodePathSegment(requestId, "UTF-8"); Duration d = Duration.parse(timeout); - long timeoutSeconds = d.getSeconds(); - requestInfo.put("transactionId", requestId).put("requestId", requestId).put("callbackUrl", callbackUrl).put("sourceId", "mso").put("requestType", "create") - .put("timeout", timeoutSeconds); + requestInfo.setTransactionId(requestId); + requestInfo.setRequestId(requestId); + requestInfo.setCallbackUrl(callbackUrl); + requestInfo.setRequestType("create"); + requestInfo.setTimeout(d.getSeconds()); + } else{ throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId"); } @@ -238,19 +255,19 @@ public class SniroHomingV2 { * Builds the request information section for the homing/licensing request * */ - private JSONObject buildServiceInfo(ServiceInstance serviceInstance){ + private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){ log.trace("Building service information"); - JSONObject info = new JSONObject(); + ServiceInfo info = new ServiceInfo(); ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance(); if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){ - info.put("serviceInstanceId", serviceInstance.getServiceInstanceId()); + info.setServiceInstanceId(serviceInstance.getServiceInstanceId()); if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution - info.put("serviceName", modelInfo.getServiceType()); + info.setServiceName(modelInfo.getServiceType()); } if(modelInfo.getServiceRole() != null){ - info.put("serviceRole", modelInfo.getServiceRole()); + info.setServiceRole(modelInfo.getServiceRole()); } - info.put("modelInfo", buildModelInfo(serviceInstance.getModelInfoServiceInstance())); + info.setModelInfo(buildModelInfo(modelInfo)); }else{ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID); } @@ -261,14 +278,18 @@ public class SniroHomingV2 { * Builds initial section of placement info for the homing/licensing request * */ - private JSONObject buildPlacementInfo(Customer customer, RequestParameters requestParams){ - JSONObject placementInfo = new JSONObject(); + private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){ + PlacementInfo placementInfo = new PlacementInfo(); if(customer != null){ log.debug("Adding subscriber to placement information"); - placementInfo.put("subscriberInfo", new JSONObject().put("globalSubscriberId", customer.getGlobalCustomerId()).put("subscriberName", customer.getSubscriberName()).put("subscriberCommonSiteId", customer.getSubscriberCommonSiteId())); + SubscriberInfo subscriber = new SubscriberInfo(); + subscriber.setGlobalSubscriberId(customer.getGlobalCustomerId()); + subscriber.setSubscriberName(customer.getSubscriberName()); + subscriber.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId()); + placementInfo.setSubscriberInfo(subscriber); if(requestParams != null){ log.debug("Adding request parameters to placement information"); - placementInfo.put("requestParameters", new JSONObject(requestParams.toJsonString())); + placementInfo.setRequestParameters(requestParams.toJsonString()); } }else{ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer"); @@ -281,9 +302,9 @@ public class SniroHomingV2 { * Builds the placement demand list for the homing/licensing request * */ - private JSONArray buildPlacementDemands(ServiceInstance serviceInstance){ + private List<Demand> buildPlacementDemands(ServiceInstance serviceInstance){ log.trace("Building placement information demands"); - JSONArray placementDemands = new JSONArray(); + List<Demand> placementDemands = new ArrayList<Demand>(); List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources(); if(!allottedResourceList.isEmpty()){ @@ -292,9 +313,9 @@ public class SniroHomingV2 { if(isBlank(ar.getId())){ ar.setId(UUID.randomUUID().toString()); } - JSONObject demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource()); + Demand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource()); addCandidates(ar, demand); - placementDemands.put(demand); + placementDemands.add(demand); } } List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks(); @@ -306,9 +327,9 @@ public class SniroHomingV2 { if(isBlank(sp.getId())){ sp.setId(UUID.randomUUID().toString()); } - JSONObject demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy()); + Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy()); addCandidates(sp, demand); - placementDemands.put(demand); + placementDemands.add(demand); } } } @@ -319,15 +340,15 @@ public class SniroHomingV2 { * Builds the license demand list for the homing/licensing request * */ - private JSONArray buildLicenseDemands(ServiceInstance serviceInstance){ + private List<Demand> buildLicenseDemands(ServiceInstance serviceInstance){ log.trace("Building license information"); - JSONArray licenseDemands = new JSONArray(); + List<Demand> licenseDemands = new ArrayList<Demand>(); List<GenericVnf> vnfList = serviceInstance.getVnfs(); if(!vnfList.isEmpty()){ log.debug("Adding vnfs to license demands list"); for(GenericVnf vnf : vnfList){ - JSONObject demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf()); - licenseDemands.put(demand); + Demand demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf()); + licenseDemands.add(demand); } } return licenseDemands; @@ -337,13 +358,13 @@ public class SniroHomingV2 { * Builds a single demand object * */ - private JSONObject buildDemand(String id, ModelInfoMetadata metadata){ + private Demand buildDemand(String id, ModelInfoMetadata metadata){ log.debug("Building demand for service or resource: " + id); - JSONObject demand = new JSONObject(); + Demand demand = new Demand(); if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){ - demand.put(SERVICE_RESOURCE_ID, id); - demand.put(RESOURCE_MODULE_NAME, metadata.getModelInstanceName()); - demand.put(RESOURCE_MODEL_INFO, buildModelInfo(metadata)); + demand.setServiceResourceId(id); + demand.setResourceModuleName(metadata.getModelInstanceName()); + demand.setModelInfo(buildModelInfo(metadata)); }else{ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName"); } @@ -354,12 +375,15 @@ public class SniroHomingV2 { * Builds the resource model info section * */ - private JSONObject buildModelInfo(ModelInfoMetadata metadata){ - JSONObject object = new JSONObject(); + private ModelInfo buildModelInfo(ModelInfoMetadata metadata){ + ModelInfo object = new ModelInfo(); String invariantUuid = metadata.getModelInvariantUuid(); String modelUuid = metadata.getModelUuid(); if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){ - object.put(MODEL_INVARIANT_ID, invariantUuid).put(MODEL_VERSION_ID, modelUuid).put(MODEL_NAME, metadata.getModelName()).put(MODEL_VERSION, metadata.getModelVersion()); + object.setModelInvariantId(invariantUuid); + object.setModelVersionId(modelUuid); + object.setModelName(metadata.getModelName()); + object.setModelVersion(metadata.getModelVersion()); }else if(isNotBlank(invariantUuid)){ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_VERSION_ID); }else{ @@ -372,14 +396,34 @@ public class SniroHomingV2 { * Adds required, excluded, and existing candidates to a demand * */ - private void addCandidates(SolutionCandidates candidates, JSONObject demand){ + private void addCandidates(SolutionCandidates candidates, Demand demand){ List<Candidate> required = candidates.getRequiredCandidates(); List<Candidate> excluded = candidates.getExcludedCandidates(); if(!required.isEmpty()){ - demand.put("requiredCandidates", required); + List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>(); + for(Candidate c:required){ + org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); + org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType(); + type.setName(c.getCandidateType().getName()); + can.setCandidateType(type); + can.setCandidates(c.getCandidates()); + can.setCloudOwner(c.getCloudOwner()); + cans.add(can); + } + demand.setRequiredCandidates(cans); } if(!excluded.isEmpty()){ - demand.put("excludedCandidates", excluded); + List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>(); + for(Candidate c:excluded){ + org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); + org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType(); + type.setName(c.getCandidateType().getName()); + can.setCandidateType(type); + can.setCandidates(c.getCandidates()); + can.setCloudOwner(c.getCloudOwner()); + cans.add(can); + } + demand.setExcludedCandidates(cans); } //TODO support existing candidates } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java index 0079b351f2..46ff8495f9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java @@ -29,6 +29,7 @@ import org.modelmapper.PropertyMap; import org.onap.aai.domain.yang.NetworkPolicy; import org.onap.aai.domain.yang.RouteTableReference; import org.onap.aai.domain.yang.RouteTargets; +import org.onap.aai.domain.yang.Subnet; import org.onap.aai.domain.yang.VpnBinding; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -222,4 +223,28 @@ public class AAIQueryTasks { } return mappedRouteTargets; } + + public void querySubnet(BuildingBlockExecution execution) { + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, + execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); + Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships(); + if (!networkRelationships.isPresent()) { + throw (new Exception(ERROR_MSG)); + } + List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET); + + if(!subnetsUriList.isEmpty()) { + for(AAIResourceUri subnetUri : subnetsUriList) { + Optional<Subnet> oSubnet = aaiNetworkResources.getSubnet(subnetUri); + if(oSubnet.isPresent()) { + l3network.getSubnets().add(modelMapper.map(oSubnet.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class)); + } + } + } + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 10ee13ebed..50f2091ae2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -344,6 +344,18 @@ public class WorkflowAction { } return vfModuleResources; } + + protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) { + int count = 0; + for(Resource resource : vfModuleResources){ + if(resource.isBaseVfModule()){ + Collections.swap(vfModuleResources, vfModuleResources.size()-1, count); + break; + } + count++; + } + return vfModuleResources; + } private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) { @@ -969,8 +981,14 @@ public class WorkflowAction { requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey(), false)); } } else if (orchFlow.getFlowName().contains(VFMODULE)) { - List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) + List<Resource> vfModuleResourcesSorted = null; + if(requestAction.equals("createInstance")||requestAction.equals("assignInstance")||requestAction.equals("activateInstance")){ + vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) .collect(Collectors.toList())); + }else{ + vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) + .collect(Collectors.toList())); + } for (int i = 0; i < vfModuleResourcesSorted.size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i), apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false)); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index 4abb0a1b2c..3081ab86d8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -260,6 +260,7 @@ public class NetworkAdapterObjectMapper { map(source.getGatewayAddress(), destination.getGatewayIp()); map(source.getIpVersion(), destination.getIpVersion()); map(source.isDhcpEnabled(), destination.getEnableDHCP()); + map(source.getSubnetSequence(), destination.getSubnetSequence()); } }; modelMapper.addMappings(personMap); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java index f91ad44f2b..6bee5a9b1e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java @@ -1,5 +1,6 @@ package org.onap.so.client.namingservice; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -17,6 +18,7 @@ import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; +import org.springframework.web.client.HttpStatusCodeException; import org.springframework.web.client.RestTemplate; @@ -34,21 +36,31 @@ public class NamingClient{ @Autowired private NamingClientResponseValidator namingClientResponseValidator; - public String postNameGenRequest(NameGenRequest request) throws BadResponseException { + public String postNameGenRequest(NameGenRequest request) throws BadResponseException, IOException { String targetUrl = env.getProperty(ENDPOINT); HttpHeaders headers = setHeaders(env.getProperty(AUTH)); msoLogger.info("Sending postNameGenRequest to url: " + targetUrl); HttpEntity<NameGenRequest> requestEntity = new HttpEntity<>(request, headers); - ResponseEntity<NameGenResponse> response = restTemplate.postForEntity(targetUrl, requestEntity, NameGenResponse.class); + ResponseEntity<NameGenResponse> response; + try{ + response = restTemplate.postForEntity(targetUrl, requestEntity, NameGenResponse.class); + }catch(HttpStatusCodeException e){ + throw new BadResponseException(namingClientResponseValidator.formatError(e)); + } return namingClientResponseValidator.validateNameGenResponse(response); } - public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException { + public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException, IOException { String targetUrl = env.getProperty(ENDPOINT); HttpHeaders headers = setHeaders(env.getProperty(AUTH)); msoLogger.info("Sending deleteNameGenRequest to url: " + targetUrl); HttpEntity<NameGenDeleteRequest> requestEntity = new HttpEntity<>(request, headers); - ResponseEntity<NameGenDeleteResponse> response = restTemplate.exchange(targetUrl, HttpMethod.DELETE, requestEntity, NameGenDeleteResponse.class); + ResponseEntity<NameGenDeleteResponse> response; + try{ + response = restTemplate.exchange(targetUrl, HttpMethod.DELETE, requestEntity, NameGenDeleteResponse.class); + }catch(HttpStatusCodeException e){ + throw new BadResponseException(namingClientResponseValidator.formatError(e)); + } return namingClientResponseValidator.validateNameGenDeleteResponse(response); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java index ab0639574c..e790fa4b72 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java @@ -1,5 +1,6 @@ package org.onap.so.client.namingservice; +import java.io.IOException; import java.util.List; import org.apache.http.HttpStatus; @@ -12,6 +13,9 @@ import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; +import org.springframework.web.client.HttpStatusCodeException; + +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class NamingClientResponseValidator { @@ -99,5 +103,20 @@ public class NamingClientResponseValidator { private boolean isHttpCodeSuccess(int code) { return code >= HttpStatus.SC_OK && code < HttpStatus.SC_MULTIPLE_CHOICES || code == 0; } + + protected String formatError(HttpStatusCodeException e) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + NameGenResponse errorResponse = mapper.readValue(e.getResponseBodyAsString(), NameGenResponse.class); + NameGenResponseError error = errorResponse.getError(); + + String errorMessageString = null; + if (error != null) { + errorMessageString = error.getMessage(); + } + String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); + msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, errorMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, errorMessage); + return errorMessage; + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java index c3f216e288..82bad8db79 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java @@ -13,11 +13,11 @@ public class NamingRequestObjectBuilder{ public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType, String nfNamingCode, String instanceGroupName){ Element element = new Element(); - element.setExternalKey(instanceGroupId); - element.setPolicyInstanceName(policyInstanceName); - element.setNamingType(namingType); - element.setResourceName(instanceGroupName); - element.setNamingIngredientsZeroOrMore(nfNamingCode); + element.put("external-key", instanceGroupId); + element.put("policy-instance-name", policyInstanceName); + element.put("naming-type", namingType); + element.put("resource-name", instanceGroupName); + element.put("nf-naming-code", nfNamingCode); return element; } public Deleteelement deleteElementMapper(String instanceGroupId){ diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java index 16d5e8e1db..d2bf95a28e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -84,6 +84,10 @@ public class AAINetworkResources { public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) { return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class); } + + public Optional<org.onap.aai.domain.yang.Subnet> getSubnet(AAIResourceUri subnetUri) { + return injectionHelper.getAaiClient().get(subnetUri).asBean(org.onap.aai.domain.yang.Subnet.class); + } public Optional<RouteTableReference> getRouteTable(AAIResourceUri rTableUri) { return injectionHelper.getAaiClient().get(rTableUri).asBean(RouteTableReference.class); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java index 8b443a165b..d0bf6da6c9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java @@ -20,6 +20,7 @@ package org.onap.so.client.orchestration; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -44,14 +45,14 @@ public class NamingServiceResources { @Autowired private NamingRequestObjectBuilder namingRequestObjectBuilder; - public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode) throws BadResponseException { + public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode) throws BadResponseException, IOException { Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName, NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName()); List<Element> elements = new ArrayList<Element>(); elements.add(element); return(namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements))); } - public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException { + public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException, IOException { Deleteelement deleteElement = namingRequestObjectBuilder.deleteElementMapper(instanceGroup.getId()); List<Deleteelement> deleteElements = new ArrayList<Deleteelement>(); deleteElements.add(deleteElement); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java new file mode 100644 index 0000000000..6ba2d7d825 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java @@ -0,0 +1,44 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Candidate implements Serializable{ + + private static final long serialVersionUID = -5474502255533410907L; + + @JsonProperty("candidateType") + private CandidateType candidateType; + @JsonProperty("candidates") + private List<String> candidates; + @JsonProperty("cloudOwner") + private String cloudOwner; + + + public CandidateType getCandidateType(){ + return candidateType; + } + + public void setCandidateType(CandidateType candidateType){ + this.candidateType = candidateType; + } + + public List<String> getCandidates(){ + return candidates; + } + + public void setCandidates(List<String> candidates){ + this.candidates = candidates; + } + + public String getCloudOwner(){ + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner){ + this.cloudOwner = cloudOwner; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java new file mode 100644 index 0000000000..8c83f26afa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java @@ -0,0 +1,23 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CandidateType implements Serializable{ + + private static final long serialVersionUID = 2273215496314532173L; + + @JsonProperty("name") + private String name; + + + public String getName(){ + return name; + } + + public void setName(String name){ + this.name = name; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java new file mode 100644 index 0000000000..a82fe6dab8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java @@ -0,0 +1,64 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Demand implements Serializable{ + + private static final long serialVersionUID = 5676094538091859816L; + + @JsonProperty("serviceResourceId") + private String serviceResourceId; + @JsonProperty("resourceModuleName") + private String resourceModuleName; + @JsonProperty("resourceModelInfo") + private ModelInfo modelInfo; + @JsonProperty("requiredCandidates") + private List<Candidate> requiredCandidates; + @JsonProperty("excludedCandidates") + private List<Candidate> excludedCandidates; + + + public List<Candidate> getRequiredCandidates(){ + return requiredCandidates; + } + + public void setRequiredCandidates(List<Candidate> requiredCandidates){ + this.requiredCandidates = requiredCandidates; + } + + public List<Candidate> getExcludedCandidates(){ + return excludedCandidates; + } + + public void setExcludedCandidates(List<Candidate> excludedCandidates){ + this.excludedCandidates = excludedCandidates; + } + + public String getServiceResourceId(){ + return serviceResourceId; + } + + public void setServiceResourceId(String serviceResourceId){ + this.serviceResourceId = serviceResourceId; + } + + public String getResourceModuleName(){ + return resourceModuleName; + } + + public void setResourceModuleName(String resourceModuleName){ + this.resourceModuleName = resourceModuleName; + } + + public ModelInfo getModelInfo(){ + return modelInfo; + } + + public void setModelInfo(ModelInfo modelInfo){ + this.modelInfo = modelInfo; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java new file mode 100644 index 0000000000..2da675bd96 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java @@ -0,0 +1,25 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class LicenseInfo implements Serializable{ + + private static final long serialVersionUID = 6878164369491185856L; + + @JsonProperty("licenseDemands") + private List<Demand> demands = new ArrayList<Demand>(); + + + public List<Demand> getDemands(){ + return demands; + } + + public void setDemands(List<Demand> demands){ + this.demands = demands; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java new file mode 100644 index 0000000000..ad786b7da4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java @@ -0,0 +1,62 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonPropertyOrder({ + "modelName", + "modelVersionId", + "modelVersion", + "modelInvariantId" +}) +@JsonRootName("modelInfo") +public class ModelInfo implements Serializable{ + + private static final long serialVersionUID = 1488642558601651075L; + + @JsonProperty("modelInvariantId") + private String modelInvariantId; + @JsonProperty("modelVersionId") + private String modelVersionId; + @JsonProperty("modelName") + private String modelName; + @JsonProperty("modelVersion") + private String modelVersion; + + + public String getModelInvariantId(){ + return modelInvariantId; + } + + public void setModelInvariantId(String modelInvariantId){ + this.modelInvariantId = modelInvariantId; + } + + public String getModelVersionId(){ + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId){ + this.modelVersionId = modelVersionId; + } + + public String getModelName(){ + return modelName; + } + + public void setModelName(String modelName){ + this.modelName = modelName; + } + + public String getModelVersion(){ + return modelVersion; + } + + public void setModelVersion(String modelVersion){ + this.modelVersion = modelVersion; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java new file mode 100644 index 0000000000..4784fc9fc4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java @@ -0,0 +1,55 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRawValue; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonPropertyOrder({ + "subscriberInfo", + "placementDemands", + "requestParameters" +}) +@JsonRootName("placementInfo") +public class PlacementInfo implements Serializable{ + + private static final long serialVersionUID = -964488472247386556L; + + @JsonProperty("subscriberInfo") + private SubscriberInfo subscriberInfo; + @JsonProperty("placementDemands") + private List<Demand> demands = new ArrayList<Demand>(); + @JsonRawValue + @JsonProperty("requestParameters") + private String requestParameters; + + + public SubscriberInfo getSubscriberInfo(){ + return subscriberInfo; + } + + public void setSubscriberInfo(SubscriberInfo subscriberInfo){ + this.subscriberInfo = subscriberInfo; + } + + public List<Demand> getDemands(){ + return demands; + } + + public void setDemands(List<Demand> demands){ + this.demands = demands; + } + + public String getRequestParameters(){ + return requestParameters; + } + + public void setRequestParameters(String requestParameters){ + this.requestParameters = requestParameters; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java index 0d7e44224e..e92b5d1ca3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java @@ -7,9 +7,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. @@ -36,6 +36,14 @@ public class RequestInfo implements Serializable{ String transactionId; @JsonProperty("requestId") String requestId; + @JsonProperty("callbackUrl") + String callbackUrl; + @JsonProperty("sourceId") + String sourceId = "mso"; + @JsonProperty("requestType") + String requestType; + @JsonProperty("timeout") + long timeout; public String getTransactionId(){ return transactionId; @@ -53,5 +61,37 @@ public class RequestInfo implements Serializable{ this.requestId = requestId; } + public String getCallbackUrl(){ + return callbackUrl; + } + + public void setCallbackUrl(String callbackUrl){ + this.callbackUrl = callbackUrl; + } + + public String getSourceId(){ + return sourceId; + } + + public void setSourceId(String sourceId){ + this.sourceId = sourceId; + } + + public String getRequestType(){ + return requestType; + } + + public void setRequestType(String requestType){ + this.requestType = requestType; + } + + public long getTimeout(){ + return timeout; + } + + public void setTimeout(long timeout){ + this.timeout = timeout; + } + } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java new file mode 100644 index 0000000000..8d4d7b1a85 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java @@ -0,0 +1,62 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonPropertyOrder({ + "modelInfo", + "serviceRole", + "serviceInstanceId", + "serviceName" +}) +@JsonRootName("serviceInfo") +public class ServiceInfo implements Serializable{ + + private static final long serialVersionUID = -6866022419398548585L; + + @JsonProperty("serviceInstanceId") + private String serviceInstanceId; + @JsonProperty("serviceName") + private String serviceName; + @JsonProperty("serviceRole") + private String serviceRole; + @JsonProperty("modelInfo") + private ModelInfo modelInfo; + + + public String getServiceInstanceId(){ + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId){ + this.serviceInstanceId = serviceInstanceId; + } + + public String getServiceName(){ + return serviceName; + } + + public void setServiceName(String serviceName){ + this.serviceName = serviceName; + } + + public String getServiceRole(){ + return serviceRole; + } + + public void setServiceRole(String serviceRole){ + this.serviceRole = serviceRole; + } + + public ModelInfo getModelInfo(){ + return modelInfo; + } + + public void setModelInfo(ModelInfo modelInfo){ + this.modelInfo = modelInfo; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java index 19b752ffd1..3c39456318 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java @@ -7,9 +7,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. @@ -37,42 +37,38 @@ public class SniroManagerRequest implements Serializable{ private static final long serialVersionUID = -1541132882892163132L; private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroManagerRequest.class); - @JsonRawValue @JsonProperty("requestInfo") - private String requestInformation; - @JsonRawValue + private RequestInfo requestInformation; @JsonProperty("serviceInfo") - private String serviceInformation; - @JsonRawValue + private ServiceInfo serviceInformation; @JsonProperty("placementInfo") - private String placementInformation; - @JsonRawValue + private PlacementInfo placementInformation; @JsonProperty("licenseInfo") - private String licenseInformation; + private LicenseInfo licenseInformation; - public String getRequestInformation() { + public RequestInfo getRequestInformation() { return requestInformation; } - public void setRequestInformation(String requestInformation) { + public void setRequestInformation(RequestInfo requestInformation) { this.requestInformation = requestInformation; } - public String getServiceInformation() { + public ServiceInfo getServiceInformation() { return serviceInformation; } - public void setServiceInformation(String serviceInformation) { + public void setServiceInformation(ServiceInfo serviceInformation) { this.serviceInformation = serviceInformation; } - public String getPlacementInformation() { + public PlacementInfo getPlacementInformation() { return placementInformation; } - public void setPlacementInformation(String placementInformation) { + public void setPlacementInformation(PlacementInfo placementInformation) { this.placementInformation = placementInformation; } - public String getLicenseInformation() { + public LicenseInfo getLicenseInformation() { return licenseInformation; } - public void setLicenseInformation(String licenseInformation) { + public void setLicenseInformation(LicenseInfo licenseInformation) { this.licenseInformation = licenseInformation; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java new file mode 100644 index 0000000000..3e68519bf1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java @@ -0,0 +1,46 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRawValue; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("subscriberInfo") +public class SubscriberInfo implements Serializable{ + + private static final long serialVersionUID = -6350949051379748872L; + + @JsonProperty("globalSubscriberId") + private String globalSubscriberId; + @JsonProperty("subscriberName") + private String subscriberName; + @JsonProperty("subscriberCommonSiteId") + private String subscriberCommonSiteId; + + + public String getGlobalSubscriberId(){ + return globalSubscriberId; + } + + public void setGlobalSubscriberId(String globalSubscriberId){ + this.globalSubscriberId = globalSubscriberId; + } + + public String getSubscriberName(){ + return subscriberName; + } + + public void setSubscriberName(String subscriberName){ + this.subscriberName = subscriberName; + } + + public String getSubscriberCommonSiteId(){ + return subscriberCommonSiteId; + } + + public void setSubscriberCommonSiteId(String subscriberCommonSiteId){ + this.subscriberCommonSiteId = subscriberCommonSiteId; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 5699c94137..72f0ce4e6d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -1200,6 +1200,24 @@ public class WorkflowActionTest extends BaseTaskTest { assertEquals("111",result.get(2).getResourceId()); } + @Test + public void sortVfModulesByBaseLastTest(){ + List<Resource> resources = new ArrayList<>(); + Resource resource1 = new Resource(WorkflowType.VFMODULE,"111",false); + resource1.setBaseVfModule(true); + resources.add(resource1); + Resource resource2 = new Resource(WorkflowType.VFMODULE,"222",false); + resource2.setBaseVfModule(false); + resources.add(resource2); + Resource resource3 = new Resource(WorkflowType.VFMODULE,"333",false); + resource3.setBaseVfModule(false); + resources.add(resource3); + List<Resource> result = workflowAction.sortVfModulesByBaseLast(resources); + assertEquals("333",result.get(0).getResourceId()); + assertEquals("222",result.get(1).getResourceId()); + assertEquals("111",result.get(2).getResourceId()); + } + private List<OrchestrationFlow> createFlowList (String... flowNames){ List<OrchestrationFlow> result = new ArrayList<>(); for(String flowName : flowNames){ diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java new file mode 100644 index 0000000000..c1769e3680 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java @@ -0,0 +1,99 @@ +package org.onap.so.client.namingservice; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.http.HttpStatus; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.namingservice.model.Deleteelement; +import org.onap.namingservice.model.Element; +import org.onap.namingservice.model.NameGenDeleteRequest; +import org.onap.namingservice.model.NameGenRequest; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.client.exception.BadResponseException; +import org.springframework.beans.factory.annotation.Autowired; + +import com.fasterxml.jackson.core.JsonProcessingException; + +public class NamingClientTest extends BaseIntegrationTest{ + @Autowired + NamingClient client; + @Autowired + NamingRequestObjectBuilder requestBuilder; + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public void assignNameGenRequest() throws BadResponseException, IOException{ + stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("NamingClient/AssignResponse.json") + .withStatus(HttpStatus.SC_ACCEPTED))); + + NameGenRequest request = assignSetup(); + String response = client.postNameGenRequest(request); + assertTrue(response.equals("$vnf-name")); + } + @Test + public void assignNameGenRequestError() throws BadResponseException, IOException{ + stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("NamingClient/ErrorResponse.json") + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + thrown.expect(BadResponseException.class); + thrown.expectMessage("Error from Naming Service: External Key is required and must be unique"); + NameGenRequest request = assignSetup(); + client.postNameGenRequest(request); + } + @Test + public void unassignNameGenRequest() throws BadResponseException, IOException{ + stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("NamingClient/UnassignResponse.json") + .withStatus(HttpStatus.SC_ACCEPTED))); + + String response = client.deleteNameGenRequest(unassignSetup()); + assertTrue(response.equals("")); + } + @Test + public void unassignNameGenRequestError() throws BadResponseException, IOException{ + stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("NamingClient/ErrorResponse.json") + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + thrown.expect(BadResponseException.class); + thrown.expectMessage("Error from Naming Service: External Key is required and must be unique"); + client.deleteNameGenRequest(unassignSetup()); + } + + public NameGenRequest assignSetup() throws JsonProcessingException{ + NameGenRequest request = new NameGenRequest(); + List<Element> elements = new ArrayList<>(); + Element testElement = new Element(); + testElement = requestBuilder.elementMapper("SomeUniqueValue", "SDNC_Policy.Config_MS_1806SRIOV_VNATJson.4.xml", "VNF", "nfNamingCode", "vnf_name"); + elements.add(testElement); + request = requestBuilder.nameGenRequestMapper(elements); + return request; + } + public NameGenDeleteRequest unassignSetup() throws JsonProcessingException{ + NameGenDeleteRequest request = new NameGenDeleteRequest(); + List<Deleteelement> deleteElements = new ArrayList<>(); + Deleteelement testElement = new Deleteelement(); + testElement = requestBuilder.deleteElementMapper("instanceGroupId"); + deleteElements.add(testElement); + request = requestBuilder.nameGenDeleteRequestMapper(deleteElements); + return request; + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java index 0a2dc1e4fa..27839d665b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java @@ -26,11 +26,11 @@ public class NamingRequestObjectBuilderTest { public void elementMapperTest(){ // Expected element Element expected = new Element(); - expected.setExternalKey(instanceGroupId); - expected.setPolicyInstanceName(policyInstanceName); - expected.setNamingType(namingType); - expected.setResourceName(instanceGroupName); - expected.setNamingIngredientsZeroOrMore(nfNamingCode); + expected.put("external-key", instanceGroupId); + expected.put("policy-instance-name", policyInstanceName); + expected.put("naming-type", namingType); + expected.put("resource-name", instanceGroupName); + expected.put("nf-naming-code", nfNamingCode); // Actual element Element actual = mapper.elementMapper(instanceGroupId, policyInstanceName, namingType, nfNamingCode, instanceGroupName); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java index 6b33440bd7..2efdbde28b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java @@ -340,4 +340,21 @@ public class AAINetworkResourcesTest extends TestDataSetup{ eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())), eq(AAIEdgeLabel.USES)); } + + @Test + public void getSubnetTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + Optional<org.onap.aai.domain.yang.Subnet> oSubnet = Optional.empty(); + AAIResourceUri subnetUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, "ModelInvariantUUID", "serviceModelVersionId"); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + oSubnet = aaiNetworkResources.getSubnet(subnetUri); + verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class)); + + if (oSubnet.isPresent()) { + org.onap.aai.domain.yang.Subnet subnet = oSubnet.get(); + assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.Subnet.class).get(), sameBeanAs(subnet)); + } + } } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json index dc2d99216f..b65203b24d 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json @@ -1,6 +1,56 @@ { - "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, - "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceRole":"testServiceRole1","serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, - "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, - "licenseInfo" : {"licenseDemands":[]} + "requestInfo" : { + "transactionId" : "testRequestId", + "requestId" : "testRequestId", + "callbackUrl" : "http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId", + "sourceId" : "mso", + "requestType" : "create", + "timeout" : 1800 + }, + "serviceInfo" : { + "modelInfo" : { + "modelName" : "testModelName1", + "modelVersionId" : "testModelUUID1", + "modelVersion" : "testModelVersion1", + "modelInvariantId" : "testModelInvariantUUID1" + }, + "serviceRole" : "testServiceRole1", + "serviceInstanceId" : "testServiceInstanceId1", + "serviceName" : "testServiceType1" + }, + "placementInfo" : { + "subscriberInfo" : { + "globalSubscriberId" : "testCustomerId", + "subscriberName" : "testCustomerName" + }, + "placementDemands" : [ { + "serviceResourceId" : "testProxyId1", + "resourceModuleName" : "testProxyInstanceName1", + "resourceModelInfo" : { + "modelName" : "testProxyModelName1", + "modelVersionId" : "testProxyModelUuid1", + "modelVersion" : "testProxyModelVersion1", + "modelInvariantId" : "testProxyModelInvariantUuid1" + } + }, { + "serviceResourceId" : "testProxyId2", + "resourceModuleName" : "testProxyInstanceName2", + "resourceModelInfo" : { + "modelName" : "testProxyModelName2", + "modelVersionId" : "testProxyModelUuid2", + "modelVersion" : "testProxyModelVersion2", + "modelInvariantId" : "testProxyModelInvariantUuid2" + }, + "requiredCandidates" : [ { + "candidateType" : { + "name" : "vnfId" + }, + "candidates" : [ "testVnfId" ] + } ] + } ], + "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false} + }, + "licenseInfo" : { + "licenseDemands" : [ ] + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json index 61f9496f05..ac460c328a 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json @@ -1,6 +1,59 @@ { - "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, - "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceRole":"testServiceRole1","serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, - "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testAllottedModelName1","modelVersionId":"testAllottedModelUuid1","modelVersion":"testAllottedModelVersion1","modelInvariantId":"testAllottedModelInvariantUuid1"},"resourceModuleName":"testAllottedModelInstanceName1","serviceResourceId":"testAllottedResourceId1"},{"resourceModelInfo":{"modelName":"testAllottedModelName2","modelVersionId":"testAllottedModelUuid2","modelVersion":"testAllottedModelVersion2","modelInvariantId":"testAllottedModelInvariantUuid2"},"resourceModuleName":"testAllottedModelInstanceName2","serviceResourceId":"testAllottedResourceId2"},{"resourceModelInfo":{"modelName":"testAllottedModelName3","modelVersionId":"testAllottedModelUuid3","modelVersion":"testAllottedModelVersion3","modelInvariantId":"testAllottedModelInvariantUuid3"},"resourceModuleName":"testAllottedModelInstanceName3","serviceResourceId":"testAllottedResourceId3"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, - "licenseInfo" : {"licenseDemands":[]} + "requestInfo" : { + "transactionId" : "testRequestId", + "requestId" : "testRequestId", + "callbackUrl" : "http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId", + "sourceId" : "mso", + "requestType" : "create", + "timeout" : 1800 + }, + "serviceInfo" : { + "modelInfo" : { + "modelName" : "testModelName1", + "modelVersionId" : "testModelUUID1", + "modelVersion" : "testModelVersion1", + "modelInvariantId" : "testModelInvariantUUID1" + }, + "serviceRole" : "testServiceRole1", + "serviceInstanceId" : "testServiceInstanceId1", + "serviceName" : "testServiceType1" + }, + "placementInfo" : { + "subscriberInfo" : { + "globalSubscriberId" : "testCustomerId", + "subscriberName" : "testCustomerName" + }, + "placementDemands" : [ { + "serviceResourceId" : "testAllottedResourceId1", + "resourceModuleName" : "testAllottedModelInstanceName1", + "resourceModelInfo" : { + "modelName" : "testAllottedModelName1", + "modelVersionId" : "testAllottedModelUuid1", + "modelVersion" : "testAllottedModelVersion1", + "modelInvariantId" : "testAllottedModelInvariantUuid1" + } + }, { + "serviceResourceId" : "testAllottedResourceId2", + "resourceModuleName" : "testAllottedModelInstanceName2", + "resourceModelInfo" : { + "modelName" : "testAllottedModelName2", + "modelVersionId" : "testAllottedModelUuid2", + "modelVersion" : "testAllottedModelVersion2", + "modelInvariantId" : "testAllottedModelInvariantUuid2" + } + }, { + "serviceResourceId" : "testAllottedResourceId3", + "resourceModuleName" : "testAllottedModelInstanceName3", + "resourceModelInfo" : { + "modelName" : "testAllottedModelName3", + "modelVersionId" : "testAllottedModelUuid3", + "modelVersion" : "testAllottedModelVersion3", + "modelInvariantId" : "testAllottedModelInvariantUuid3" + } + } ], + "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false} + }, + "licenseInfo" : { + "licenseDemands" : [ ] + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json index a7da6da7cc..6db2153691 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json @@ -1,6 +1,104 @@ { - "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, - "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceRole":"testServiceRole1","serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, - "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, - "licenseInfo" : {"licenseDemands":[]} + "requestInfo" : { + "transactionId" : "testRequestId", + "requestId" : "testRequestId", + "callbackUrl" : "http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId", + "sourceId" : "mso", + "requestType" : "create", + "timeout" : 1800 + }, + "serviceInfo" : { + "modelInfo" : { + "modelName" : "testModelName1", + "modelVersionId" : "testModelUUID1", + "modelVersion" : "testModelVersion1", + "modelInvariantId" : "testModelInvariantUUID1" + }, + "serviceRole" : "testServiceRole1", + "serviceInstanceId" : "testServiceInstanceId1", + "serviceName" : "testServiceType1" + }, + "placementInfo" : { + "subscriberInfo" : { + "globalSubscriberId" : "testCustomerId", + "subscriberName" : "testCustomerName" + }, + "placementDemands" : [ { + "serviceResourceId" : "testProxyId1", + "resourceModuleName" : "testProxyInstanceName1", + "resourceModelInfo" : { + "modelName" : "testProxyModelName1", + "modelVersionId" : "testProxyModelUuid1", + "modelVersion" : "testProxyModelVersion1", + "modelInvariantId" : "testProxyModelInvariantUuid1" + } + }, { + "serviceResourceId" : "testProxyId2", + "resourceModuleName" : "testProxyInstanceName2", + "resourceModelInfo" : { + "modelName" : "testProxyModelName2", + "modelVersionId" : "testProxyModelUuid2", + "modelVersion" : "testProxyModelVersion2", + "modelInvariantId" : "testProxyModelInvariantUuid2" + }, + "requiredCandidates" : [ { + "candidateType" : { + "name" : "vnfId" + }, + "candidates" : [ "testVnfId" ] + } ] + }, { + "serviceResourceId" : "testProxyId1", + "resourceModuleName" : "testProxyInstanceName1", + "resourceModelInfo" : { + "modelName" : "testProxyModelName1", + "modelVersionId" : "testProxyModelUuid1", + "modelVersion" : "testProxyModelVersion1", + "modelInvariantId" : "testProxyModelInvariantUuid1" + } + }, { + "serviceResourceId" : "testProxyId2", + "resourceModuleName" : "testProxyInstanceName2", + "resourceModelInfo" : { + "modelName" : "testProxyModelName2", + "modelVersionId" : "testProxyModelUuid2", + "modelVersion" : "testProxyModelVersion2", + "modelInvariantId" : "testProxyModelInvariantUuid2" + }, + "requiredCandidates" : [ { + "candidateType" : { + "name" : "vnfId" + }, + "candidates" : [ "testVnfId" ] + } ] + }, { + "serviceResourceId" : "testProxyId1", + "resourceModuleName" : "testProxyInstanceName1", + "resourceModelInfo" : { + "modelName" : "testProxyModelName1", + "modelVersionId" : "testProxyModelUuid1", + "modelVersion" : "testProxyModelVersion1", + "modelInvariantId" : "testProxyModelInvariantUuid1" + } + }, { + "serviceResourceId" : "testProxyId2", + "resourceModuleName" : "testProxyInstanceName2", + "resourceModelInfo" : { + "modelName" : "testProxyModelName2", + "modelVersionId" : "testProxyModelUuid2", + "modelVersion" : "testProxyModelVersion2", + "modelInvariantId" : "testProxyModelInvariantUuid2" + }, + "requiredCandidates" : [ { + "candidateType" : { + "name" : "vnfId" + }, + "candidates" : [ "testVnfId" ] + } ] + } ], + "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false} + }, + "licenseInfo" : { + "licenseDemands" : [ ] + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/AssignResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/AssignResponse.json new file mode 100644 index 0000000000..b065c21339 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/AssignResponse.json @@ -0,0 +1,14 @@ +{ + "elements": [ + { + "external-key": "$vnf-id", + "resource-name": "instance-group-name", + "resource-value": "$vnf-name" + }, + { + "external-key": "$vnf-id", + "resource-name": "vm-name", + "resource-value": "$vm-name" + } + ] +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/ErrorResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/ErrorResponse.json new file mode 100644 index 0000000000..8bac7cd1f9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/ErrorResponse.json @@ -0,0 +1,6 @@ +{ + "error": { + "errorId": "NELGEN-0003", + "message": "External Key is required and must be unique" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/UnassignResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/UnassignResponse.json new file mode 100644 index 0000000000..b065c21339 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/UnassignResponse.json @@ -0,0 +1,14 @@ +{ + "elements": [ + { + "external-key": "$vnf-id", + "resource-name": "instance-group-name", + "resource-value": "$vnf-name" + }, + { + "external-key": "$vnf-id", + "resource-name": "vm-name", + "resource-value": "$vm-name" + } + ] +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml index 3d45caddce..fed2aa69c7 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml +++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml @@ -43,7 +43,7 @@ pnf: mso: naming: endpoint: http://localhost:${wiremock.server.port}/web/service/v1/genNetworkElementName - auth: Basic YnBlbDptc28tZGItMTUwNyE= + auth: Basic YnBlbDptc28tZGItMTUwNyE= adapters: requestDb: auth: Basic YnBlbDptc28tZGItMTUwNyE= |