diff options
15 files changed, 741 insertions, 83 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java index 40c76a3c92..f1534ab60f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java @@ -20,7 +20,9 @@ package org.onap.so.bpmn.servicedecomposition.homingobjects; -public enum CandidateType { +public enum CandidateType{ + + SERVICE_INSTANCE_ID("serviceInstanceId"), CLOUD_REGION_ID("cloudRegionId"), VNF_ID("vnfId"), 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..0c247e5cdf 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"); @@ -216,18 +224,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 +249,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 +272,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 +296,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 +307,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 +321,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 +334,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 +352,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 +369,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 +390,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/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/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 |