diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java')
7 files changed, 394 insertions, 117 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java deleted file mode 100644 index 73047cf961..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.baseclient; - -import java.util.ArrayList; -import java.util.List; -import org.onap.so.logging.jaxrs.filter.SpringClientFilter; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.http.client.BufferingClientHttpRequestFactory; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.web.client.RestClientException; -import org.springframework.web.client.RestTemplate; - -// TODO move to common location -public class BaseClient<I, O> { - - private HttpHeaders httpHeader; - private String targetUrl; - - public HttpHeaders getHttpHeader() { - return httpHeader; - } - - public HttpHeaders setDefaultHttpHeaders(String auth) { - httpHeader = new HttpHeaders(); - httpHeader.set("Authorization", auth); - httpHeader.setContentType(MediaType.APPLICATION_JSON); - List<MediaType> acceptMediaTypes = new ArrayList<MediaType>(); - acceptMediaTypes.add(MediaType.APPLICATION_JSON); - acceptMediaTypes.add(MediaType.TEXT_PLAIN); - httpHeader.setAccept(acceptMediaTypes); - return httpHeader; - } - - public void setHttpHeader(HttpHeaders httpHeader) { - this.httpHeader = httpHeader; - } - - public String getTargetUrl() { - return targetUrl; - } - - public void setTargetUrl(String targetUrl) { - this.targetUrl = targetUrl; - } - - public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { - return run(data, HttpMethod.GET, typeRef, uriVariables); - } - - public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { - return run(data, HttpMethod.POST, typeRef, uriVariables); - } - - public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) - throws RestClientException { - HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader()); - RestTemplate restTemplate = new RestTemplate(); - restTemplate - .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); - restTemplate.getInterceptors().add(new SpringClientFilter()); - ResponseEntity<O> responseEntity = - restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables); - return responseEntity.getBody(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java new file mode 100644 index 0000000000..b50ecdad8b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java @@ -0,0 +1,160 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.common.resource; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import org.onap.so.bpmn.core.domain.GroupResource; +import org.onap.so.bpmn.core.domain.Resource; +import org.onap.so.bpmn.core.domain.ResourceType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class InstanceResourceList { + + private static List<Map<String, List<GroupResource>>> convertUUIReqTOStd(final String uuiRequest, + List<Resource> seqResourceList) { + + List<Map<String, List<GroupResource>>> normalizedList = new ArrayList<>(); + + Gson gson = new Gson(); + JsonObject servJsonObject = gson.fromJson(uuiRequest, JsonObject.class); + + JsonObject reqInputJsonObj = servJsonObject.getAsJsonObject("service").getAsJsonObject("parameters") + .getAsJsonObject("requestInputs"); + + // iterate all node in requestInputs + Iterator<Map.Entry<String, JsonElement>> iterator = reqInputJsonObj.entrySet().iterator(); + + while (iterator.hasNext()) { // iterate all <vf>_list + Map.Entry<String, JsonElement> entry = iterator.next(); + + // truncate "_list" from key and keep only the <VF_NAME> + String key = entry.getKey().substring(0, entry.getKey().indexOf("_list")); + + // all the element represent VF will contain "<VF_NAME>_list". + if (key.contains("_list")) { + // this will return list of vf of same type + // e.g. vf_list [{vf1}, {vf2}] + Iterator<JsonElement> vfsIterator = entry.getValue().getAsJsonArray().iterator(); + + while (vfsIterator.hasNext()) { // iterate all [] inside vf_list + JsonObject vfObject = vfsIterator.next().getAsJsonObject(); + List<GroupResource> tmpGrpsHolder = new ArrayList<>(); + + // iterate vfObject to get groups(vfc) + // currently each vfc represented by one group. + Iterator<Map.Entry<String, JsonElement>> vfIterator = vfObject.entrySet().iterator(); + while (vfIterator.hasNext()) { // iterate all property inside a VF + Map.Entry<String, JsonElement> vfEntry = vfIterator.next(); + + // property name for vfc input will always carry "<VFC_NAME>_list" + if (vfEntry.getKey().contains("_list")) { + // truncate "_list" from key and keep only the <VFC_NAME> + String vfcName = vfEntry.getKey().substring(0, vfEntry.getKey().indexOf("_list")); + GroupResource grpRes = getGroupResource(vfcName, seqResourceList); + // A <vfc>_list can contain more than one vfc of same type + Iterator<JsonElement> vfcsIterator = vfEntry.getValue().getAsJsonArray().iterator(); + + while (vfcsIterator.hasNext()) { // iterate all the vfcs inside <vfc>_list + tmpGrpsHolder.add(grpRes); + } + } + } + List<GroupResource> seqGrpResourceList = seqGrpResource(tmpGrpsHolder, seqResourceList); + HashMap<String, List<GroupResource>> entryNormList = new HashMap<>(); + entryNormList.put(key, seqGrpResourceList); + normalizedList.add(entryNormList); + } + } + } + + return normalizedList; + } + + private static List<GroupResource> seqGrpResource(List<GroupResource> grpResources, List<Resource> resourceList) { + List<GroupResource> seqGrpResList = new ArrayList<>(); + for (Resource r : resourceList) { + if (r.getResourceType() != ResourceType.GROUP) { + continue; + } + for (GroupResource g : grpResources) { + if (r.getModelInfo().getModelName().equalsIgnoreCase(g.getModelInfo().getModelName())) { + seqGrpResList.add(g); + } + } + } + return seqGrpResList; + } + + private static GroupResource getGroupResource(String vfcName, List<Resource> seqRessourceList) { + for (Resource r : seqRessourceList) { + if (r.getResourceType() == ResourceType.GROUP) { + // Currently only once vnfc is added to group + return ((GroupResource) r).getVnfcs().get(0).getModelInfo().getModelName().contains(vfcName) + ? (GroupResource) r + : null; + } + } + return null; + } + + private static List<Resource> convertToInstanceResourceList(List<Map<String, List<GroupResource>>> normalizedReq, + List<Resource> seqResourceList) { + List<Resource> flatResourceList = new ArrayList<>(); + for (Resource r : seqResourceList) { + if (r.getResourceType() == ResourceType.VNF) { + for (Map<String, List<GroupResource>> entry : normalizedReq) { + if (r.getModelInfo().getModelName().equalsIgnoreCase(entry.keySet().iterator().next())) { + flatResourceList.add(r); + flatResourceList.addAll(entry.get(entry.keySet().iterator().next())); + } + } + } + } + return flatResourceList; + } + + public static List<Resource> getInstanceResourceList(final List<Resource> seqResourceList, + final String uuiRequest) { + + // this will convert UUI request to normalized form + List<Map<String, List<GroupResource>>> normalizedReq = convertUUIReqTOStd(uuiRequest, seqResourceList); + + // now UUI json req is normalized to + // [ + // { VFB1 : [GrpA1, GrA2, GrB1]}, + // { VFB2 : [GrpA1, GrB1]}, + // { VFA1 : [GrpC1]} + // ] + // now sequence according to VF order (Group is already sequenced). + // After sequence it will look like : + // [ + // { VFA1 : [GrpA1, GrA2, GrB1]}, + // { VFA2 : [GrpA1, GrB1]}, + // { VFB1 : [GrpC1]} + // ] + return convertToInstanceResourceList(normalizedReq, seqResourceList); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java new file mode 100644 index 0000000000..a3c75dbd41 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java @@ -0,0 +1,5 @@ +package org.onap.so.bpmn.common.resource; + +public enum ResourceLevel { + FIRST, SECOND +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index 0dbf2c2a75..58f775ce0b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -9,9 +9,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. @@ -22,6 +22,9 @@ package org.onap.so.bpmn.common.resource; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; import java.io.IOException; import java.lang.reflect.Type; import java.util.ArrayList; @@ -31,6 +34,7 @@ import java.util.List; import java.util.Map; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; +import org.apache.commons.lang.StringUtils; import org.camunda.bpm.engine.runtime.Execution; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.json.JsonUtils; @@ -82,20 +86,20 @@ public class ResourceRequestBuilder { * "requestInputs":{K,V} } <br> * * @param execution Execution context - * + * * @param serviceUuid The service template uuid - * + * * @param resourceCustomizationUuid The resource customization uuid - * + * * @param serviceParameters the service parameters passed from the API - * + * * @return the resource instantiate parameters - * + * * @since ONAP Beijing Release */ @SuppressWarnings("unchecked") public static String buildResourceRequestParameters(Execution execution, String serviceUuid, - String resourceCustomizationUuid, String serviceParameters) { + String resourceCustomizationUuid, String serviceParameters, Map<String, Object> currentVFData) { List<String> resourceList = jsonUtil.StringArrayToList(execution, (String) JsonUtils.getJsonValue(serviceParameters, "resources")); // Get the right location str for resource. default is an empty array. @@ -126,7 +130,7 @@ public class ResourceRequestBuilder { } Map<String, Object> resourceInputsFromServiceDeclaredLevel = - buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput); + buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput, currentVFData); resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel); String resourceInputsStr = getJsonString(resourceInputsFromUuiMap); String result = "{\n" + "\"locationConstraints\":" + locationConstraints + ",\n" + "\"requestInputs\":" @@ -136,7 +140,7 @@ public class ResourceRequestBuilder { @SuppressWarnings("unchecked") public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid, - Map<String, Object> serviceInputs) { + Map<String, Object> serviceInputs, Map<String, Object> currentVFData) { try { Map<String, Object> serviceInstnace = getServiceInstnace(serviceUuid); // find match of customization uuid in vnf @@ -144,24 +148,27 @@ public class ResourceRequestBuilder { (Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources"); List<Map<String, Object>> serviceVnfCust = (List<Map<String, Object>>) serviceResources.get("serviceVnfs"); - String resourceInputStr = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid); + Map<String, String> resourceInputData = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid); // find match in network resource - if (resourceInputStr == null) { + if (resourceInputData.size() == 0) { List<Map<String, Object>> serviceNetworkCust = (List<Map<String, Object>>) serviceResources.get("serviceNetworks"); - resourceInputStr = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid); + resourceInputData = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid); // find match in AR resource - if (resourceInputStr == null) { + if (resourceInputData == null) { List<Map<String, Object>> serviceArCust = (List<Map<String, Object>>) serviceResources.get("serviceAllottedResources"); - resourceInputStr = getResourceInputStr(serviceArCust, resourceCustomizationUuid); + resourceInputData = getResourceInputStr(serviceArCust, resourceCustomizationUuid); } } + String resourceInputStr = resourceInputData.get("resourceInput"); + ResourceLevel resourceLevel = ResourceLevel.valueOf(resourceInputData.get("nodeType")); + if (resourceInputStr != null && !resourceInputStr.isEmpty()) { - return getResourceInput(resourceInputStr, serviceInputs); + return getResourceInput(resourceInputStr, serviceInputs, resourceLevel, currentVFData); } } catch (Exception e) { @@ -170,47 +177,220 @@ public class ResourceRequestBuilder { return new HashMap(); } - private static String getResourceInputStr(List<Map<String, Object>> resources, String resCustomizationUuid) { + private static Map<String, String> getResourceInputStr(List<Map<String, Object>> resources, + String resCustomizationUuid) { + Map<String, String> resourceInputMap = new HashMap<>(2); for (Map<String, Object> resource : resources) { Map<String, String> modelInfo = (Map<String, String>) resource.get("modelInfo"); if (modelInfo.get("modelCustomizationUuid").equalsIgnoreCase(resCustomizationUuid)) { - return (String) resource.get("resourceInput"); + resourceInputMap.put("resourceInput", (String) resource.get("resourceInput")); + String nodeType = ResourceLevel.FIRST.toString(); + if (((String) resource.get("toscaNodeType")).contains(".vf.")) { + nodeType = ResourceLevel.FIRST.toString(); + } else if (((String) resource.get("toscaNodeType")).contains(".vfc.")) { + nodeType = ResourceLevel.SECOND.toString(); + } + resourceInputMap.put("nodeType", nodeType); + return resourceInputMap; } } return null; } // this method combines resource input with service input - private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs) { + private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs, + ResourceLevel resourceLevel, Map<String, Object> currentVFData) { Gson gson = new Gson(); Type type = new TypeToken<Map<String, String>>() {}.getType(); Map<String, Object> resourceInput = gson.fromJson(resourceInputStr, type); + JsonParser parser = new JsonParser(); + + Map<String, Object> uuiServiceInput = serviceInputs; + + int firstLevelIndex = 0; + int secondLevelIndex = 0; + String firstLevelKey = null; + String secondLevelKey = null; + boolean levelKeyNameUpdated = false; + int indexToPick = 0; + + if (null != currentVFData) { + firstLevelIndex = getIntValue(currentVFData.get("currentFirstLevelIndex"), 0); + secondLevelIndex = getIntValue(currentVFData.get("currentSecondLevelIndex"), 0); + final String lastFirstLevelKey = firstLevelKey = (String) currentVFData.get("currentFirstLevelKey"); + final String lastSecondLevelKey = secondLevelKey = (String) currentVFData.get("currentSecondLevelKey"); + + if (null != currentVFData.get("lastNodeTypeProcessed")) { + ResourceLevel lastResourceLevel = + ResourceLevel.valueOf(currentVFData.get("lastNodeTypeProcessed").toString()); + switch (resourceLevel) { + case FIRST: + // if it is next request for same group then increment first level index + switch (lastResourceLevel) { + case FIRST: + boolean isSameLevelRequest = resourceInput.values().stream().anyMatch(item -> { + JsonElement tree = parser.parse(((String) item).split("\\|")[0]); + return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString() + .equalsIgnoreCase(lastFirstLevelKey); + }); + if (isSameLevelRequest) { + firstLevelIndex++; + } + break; + case SECOND: + firstLevelIndex = 0; + secondLevelKey = null; + break; + + } + indexToPick = firstLevelIndex; + break; + case SECOND: + // if it is next request for same group then increment second level index + switch (lastResourceLevel) { + case FIRST: + secondLevelIndex = 0; + break; + case SECOND: + boolean isSameLevelRequest = resourceInput.values().stream().anyMatch(item -> { + JsonElement tree = parser.parse(((String) item).split("\\|")[0]); + return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString() + .equalsIgnoreCase(lastSecondLevelKey); + }); + if (isSameLevelRequest) { + secondLevelIndex++; + } + break; + } + // get actual parent object to search for second level objects + if (null != lastFirstLevelKey) { + Object currentObject = serviceInputs.get(lastFirstLevelKey); + if ((null != currentObject) && (currentObject instanceof List)) { + List currentFirstLevelList = (List) currentObject; + if (currentFirstLevelList.size() > firstLevelIndex) { + uuiServiceInput = (Map<String, Object>) currentFirstLevelList.get(firstLevelIndex); + } + + } + } + indexToPick = secondLevelIndex; + break; + + } + } + + + } // replace value if key is available in service input for (String key : resourceInput.keySet()) { String value = (String) resourceInput.get(key); if (value.contains("|")) { + + // check which level + // node it type of getinput String[] split = value.split("\\|"); String tmpKey = split[0]; - if (serviceInputs.containsKey(tmpKey)) { - value = (String) serviceInputs.get(tmpKey); + + JsonElement jsonTree = parser.parse(tmpKey); + + // check if it is a list type + if (jsonTree.isJsonArray()) { + JsonArray jsonArray = jsonTree.getAsJsonArray(); + boolean matchFound = false; + if (jsonArray.size() == 3) { + String keyName = jsonArray.get(0).getAsString(); + String keyType = jsonArray.get(2).getAsString(); + if (!levelKeyNameUpdated) { + switch (resourceLevel) { + case FIRST: + firstLevelKey = keyName; + break; + case SECOND: + secondLevelKey = keyName; + break; + } + levelKeyNameUpdated = true; + } + + if (uuiServiceInput.containsKey(keyName)) { + Object vfcLevelObject = uuiServiceInput.get(keyName); + // it will be always list + if (vfcLevelObject instanceof List) { + List vfcObject = (List) vfcLevelObject; + if (vfcObject.size() > indexToPick) { + Map<String, Object> vfMap = (Map<String, Object>) vfcObject.get(indexToPick); + if (vfMap.containsKey(keyType)) { + if (vfMap.get(keyType) instanceof String) { + value = (String) vfMap.get(keyType); + } else { + value = getJsonString(vfMap.get(keyType)); + } + matchFound = true; + } + } + } + } + } + + if (!matchFound) { + if (split.length == 1) { // means value is empty e.g. "a":"key1|" + value = ""; + } else { + value = split[1]; + } + } + } else { - if (split.length == 1) { // means value is empty e.g. "a":"key1|" - value = ""; + + // if not a list type + if (uuiServiceInput.containsKey(tmpKey)) { + value = (String) uuiServiceInput.get(tmpKey); } else { - value = split[1]; + if (split.length == 1) { // means value is empty e.g. "a":"key1|" + value = ""; + } else { + value = split[1]; + } } } + } resourceInput.put(key, value); } + // store current processed details into map + if (null != currentVFData) { + currentVFData.put("currentFirstLevelKey", firstLevelKey); + currentVFData.put("currentFirstLevelIndex", firstLevelIndex); + currentVFData.put("currentSecondLevelKey", secondLevelKey); + currentVFData.put("currentSecondLevelIndex", secondLevelIndex); + currentVFData.put("lastNodeTypeProcessed", resourceLevel.toString()); + } + return resourceInput; } + private static int getIntValue(Object inputObj, int defaultValue) { + if (null != inputObj) { + if (inputObj instanceof Integer) { + return ((Integer) inputObj).intValue(); + } + if (StringUtils.isNotEmpty(inputObj.toString())) { + try { + int val = Integer.parseInt(inputObj.toString()); + return val; + } catch (NumberFormatException e) { + logger.warn("Unable to parse to int", e.getMessage()); + } + } + } + return defaultValue; + } + public static Map<String, Object> getServiceInstnace(String uuid) throws Exception { String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint"); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java index 6c3a0c43ed..b9f5a6af8e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java @@ -78,6 +78,8 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc private ModelInfoServiceInstance modelInfoServiceInstance; @JsonProperty("instance-groups") private List<InstanceGroup> instanceGroups = new ArrayList<>(); + @JsonProperty("service-proxies") + private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>(); public List<GenericVnf> getVnfs() { return vnfs; @@ -211,6 +213,10 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc this.instanceGroups = instanceGroups; } + public List<ServiceProxy> getServiceProxies() { + return serviceProxies; + } + @Override public boolean equals(final Object other) { if (!(other instanceof ServiceInstance)) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java index db5c11a954..4c91ad38a0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.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. @@ -34,7 +34,6 @@ public class SolutionCandidates implements Serializable { private List<Candidate> requiredCandidates = new ArrayList<Candidate>(); @JsonProperty("excludedCandidates") private List<Candidate> excludedCandidates = new ArrayList<Candidate>(); - // TODO figure out best way to do this @JsonProperty("existingCandidates") private List<Candidate> existingCandidates = new ArrayList<Candidate>(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/UnexpectedDataException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/UnexpectedDataException.java new file mode 100644 index 0000000000..84cf491355 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/UnexpectedDataException.java @@ -0,0 +1,17 @@ +package org.onap.so.client.exception; + + +public class UnexpectedDataException extends Exception { + + public UnexpectedDataException() {} + + public UnexpectedDataException(String message, String system) { + super("Unexpected data found in " + system + ". " + message); + } + + public UnexpectedDataException(String message) { + super("Unexpected data found. " + message); + } + + +} |