diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN')
23 files changed, 187 insertions, 98 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 64567a349e..5525c2642b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -6,7 +6,7 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * @@ -40,11 +40,11 @@ class ExternalAPIUtil { String Prefix="EXTAPI_" - private static final Logger logger = LoggerFactory.getLogger( ExternalAPIUtil.class); + private static final Logger logger = LoggerFactory.getLogger( ExternalAPIUtil.class) - private final HttpClientFactory httpClientFactory; - private final MsoUtils utils; - private final ExceptionUtil exceptionUtil; + private final HttpClientFactory httpClientFactory + private final MsoUtils utils + private final ExceptionUtil exceptionUtil public static final String PostServiceOrderRequestsTemplate = "{\n" + @@ -107,22 +107,22 @@ class ExternalAPIUtil { // } public String setTemplate(String template, Map<String, String> valueMap) { - logger.debug("ExternalAPIUtil setTemplate", true); - StringBuffer result = new StringBuffer(); + logger.debug("ExternalAPIUtil setTemplate", true) + StringBuffer result = new StringBuffer() - String pattern = "<.*>"; - Pattern r = Pattern.compile(pattern); - Matcher m = r.matcher(template); + String pattern = "<.*>" + Pattern r = Pattern.compile(pattern) + Matcher m = r.matcher(template) - logger.debug("ExternalAPIUtil template:" + template, true); + logger.debug("ExternalAPIUtil template:" + template, true) while (m.find()) { - String key = template.substring(m.start() + 1, m.end() - 1); - logger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true); - m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\"")); + String key = template.substring(m.start() + 1, m.end() - 1) + logger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true) + m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\"")) } - m.appendTail(result); - logger.debug("ExternalAPIUtil return:" + result.toString(), true); - return result.toString(); + m.appendTail(result) + logger.debug("ExternalAPIUtil return:" + result.toString(), true) + return result.toString() } /** diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy index e7f46464ee..549267eec1 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Nokia. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy index f013fa8698..db39358ccd 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy @@ -6,7 +6,7 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * @@ -22,9 +22,9 @@ package org.onap.so.bpmn.common.scripts -import org.onap.so.logger.LoggingAnchor; +import org.onap.so.logger.LoggingAnchor import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.ErrorCode import java.text.SimpleDateFormat @@ -39,7 +39,7 @@ import static org.apache.commons.lang3.StringUtils.* // SDNC Adapter Request/Response processing public class SDNCAdapter extends AbstractServiceTaskProcessor { - private static final Logger logger = LoggerFactory.getLogger( SDNCAdapter.class); + private static final Logger logger = LoggerFactory.getLogger( SDNCAdapter.class) def Prefix="SDNCA_" @@ -77,7 +77,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { } catch (IOException ex) { logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Unable to encode username password string", "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) } // TODO Use variables instead of passing xml request - Huh? @@ -238,9 +238,9 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest") logger.debug("sdncAdapterCallbackRequest :" + sdnccallbackreq) if (sdnccallbackreq==null){ - execution.setVariable("callbackResponseReceived",false); + execution.setVariable("callbackResponseReceived",false) }else{ - execution.setVariable("callbackResponseReceived",true); + execution.setVariable("callbackResponseReceived",true) } } @@ -303,10 +303,10 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { } public String generateCurrentTimeInUtc(){ - final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); - sdf.setTimeZone(TimeZone.getTimeZone("UTC")); - final String utcTime = sdf.format(new Date()); - return utcTime; + final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + sdf.setTimeZone(TimeZone.getTimeZone("UTC")) + final String utcTime = sdf.format(new Date()) + return utcTime } public void toggleSuccessIndicator(DelegateExecution execution){ diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index 449f4e3222..c30d807bf3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -6,7 +6,7 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * @@ -53,7 +53,7 @@ import org.onap.so.utils.TargetEntity class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { - private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV1.class); + private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV1.class) ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -88,7 +88,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -109,7 +109,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -124,7 +124,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -141,7 +141,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -157,7 +157,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) } else { try { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) @@ -166,7 +166,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", - "BPMN", ErrorCode.UnknownError.getValue(), ex); + "BPMN", ErrorCode.UnknownError.getValue(), ex) } } @@ -176,7 +176,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout") // in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S" - String timerRegex = "PT[0-9]+[HMS]"; + String timerRegex = "PT[0-9]+[HMS]" if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) { logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"') timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution) @@ -197,7 +197,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -221,7 +221,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest') logger.debug("SDNC Rest Request is: " + sdncAdapterRequest) - URL url = new URL(sdncAdapterUrl); + URL url = new URL(sdncAdapterUrl) HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SDNC_ADAPTER) httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) @@ -245,7 +245,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -259,7 +259,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg, e) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -330,7 +330,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } // Note: the mapping function handles a null or empty responseCode - int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode)); + int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode)) exceptionUtil.buildWorkflowException(execution, mappedResponseCode, "Received " + responseType + " from SDNCAdapter:" + info) } catch (Exception e) { @@ -370,7 +370,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -396,12 +396,12 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } public Logger getLogger() { - return logger; + return logger } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy index 62c7bb5adf..ba5145d19b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy @@ -6,7 +6,7 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * @@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory * any non-final response received from SDNC. */ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { - private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV2.class); + private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV2.class) ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -87,7 +87,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -108,7 +108,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -123,7 +123,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -134,7 +134,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -153,7 +153,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) } else { try { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) @@ -162,7 +162,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", - "BPMN", ErrorCode.UnknownError.getValue(), ex); + "BPMN", ErrorCode.UnknownError.getValue(), ex) } } @@ -172,7 +172,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout") // in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S" - String timerRegex = "PT[0-9]+[HMS]"; + String timerRegex = "PT[0-9]+[HMS]" if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) { logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"') timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution) @@ -193,7 +193,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -297,6 +297,6 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { } public Logger getLogger() { - return logger; + return logger } } 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 index b1173bbf95..3a4df68f02 100644 --- 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 @@ -68,7 +68,7 @@ public class InstanceResourceList { public static List<Resource> getInstanceResourceList(final VnfResource vnfResource, final String uuiRequest) { - List<Resource> sequencedResourceList = new ArrayList<Resource>(); + List<Resource> sequencedResourceList = new ArrayList<>(); Gson gson = new Gson(); JsonObject servJsonObject = gson.fromJson(uuiRequest, JsonObject.class); JsonObject reqInputJsonObj = servJsonObject.getAsJsonObject("service").getAsJsonObject("parameters") @@ -108,11 +108,16 @@ public class InstanceResourceList { sequencedResourceList.add(vnfResource); } + // check if the resource contains vf-module + if (vnfResource != null && vnfResource.getVfModules() != null) { + sequencedResourceList.addAll(vnfResource.getVfModules()); + } + return sequencedResourceList; } private static List<Resource> getGroupResourceInstanceList(VnfResource vnfResource, JsonObject vfObj) { - List<Resource> sequencedResourceList = new ArrayList<Resource>(); + List<Resource> sequencedResourceList = new ArrayList<>(); if (vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder())) { String[] grpSequence = vnfResource.getGroupOrder().split(","); for (String grpType : grpSequence) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java index f56fad3bcf..84b162e1a2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java @@ -31,7 +31,7 @@ public class Metadata implements Serializable { private static final long serialVersionUID = 4981393122007858950L; @JsonProperty("metadatum") - private List<Metadatum> metadatum = new ArrayList<Metadatum>(); + private List<Metadatum> metadatum = new ArrayList<>(); public List<Metadatum> getMetadatum() { return metadatum; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java index a5eb9d86a7..96a6ab7bd2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java @@ -36,8 +36,6 @@ public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute> @Id @JsonProperty("route-id") private String routeId; - @JsonProperty("route-name") - private String routeName; @JsonProperty("network-start-address") private String networkStartAddress; @JsonProperty("cidr-mask") @@ -54,14 +52,6 @@ public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute> this.routeId = routeId; } - public String getRouteName() { - return routeName; - } - - public void setRouteName(String routeName) { - this.routeName = routeName; - } - public String getNetworkStartAddress() { return networkStartAddress; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java index 841546b3b1..ebf722ef74 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java @@ -133,7 +133,7 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> { @JsonProperty("model-info-generic-vnf") private ModelInfoGenericVnf modelInfoGenericVnf; @JsonProperty("instance-groups") - private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>(); + private List<InstanceGroup> instanceGroups = new ArrayList<>(); @JsonProperty("call-homing") private Boolean callHoming; @JsonProperty("nf-function") diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java index 387d191409..db2785902a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java @@ -65,15 +65,15 @@ public class LInterface implements Serializable, ShallowCopy<LInterface> { @JsonProperty("allowed-address-pairs") private String allowedAddressPairs; @JsonProperty("vlans") - private List<Vlan> vlans = new ArrayList<Vlan>(); + private List<Vlan> vlans = new ArrayList<>(); @JsonProperty("sriov-vfs") - private List<SriovVf> sriovVfs = new ArrayList<SriovVf>(); + private List<SriovVf> sriovVfs = new ArrayList<>(); @JsonProperty("l-interfaces") - private List<LInterface> lInterfaces = new ArrayList<LInterface>(); + private List<LInterface> lInterfaces = new ArrayList<>(); @JsonProperty("l3-interface-ipv4-address-list") - private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>(); + private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<>(); @JsonProperty("l3-interface-ipv6-address-list") - private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>(); + private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<>(); public String getInterfaceName() { return interfaceName; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java index d0bf1f588b..f3e28faf44 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java @@ -41,9 +41,9 @@ public class PServer implements Serializable, ShallowCopy<PServer> { @JsonProperty("hostname") private String hostname; @JsonProperty("physical-links") - private List<PhysicalLink> physicalLinks = new ArrayList<PhysicalLink>(); // TODO techincally there is a pInterface - // between (pserver <--> physical-link) - // but dont really need that pojo + private List<PhysicalLink> physicalLinks = new ArrayList<>(); // TODO techincally there is a pInterface + // between (pserver <--> physical-link) + // but dont really need that pojo public String getPserverId() { return pserverId; 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 0803bed574..6cc8aa368c 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 @@ -79,7 +79,7 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc @JsonProperty("instance-groups") private List<InstanceGroup> instanceGroups = new ArrayList<>(); @JsonProperty("service-proxies") - private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>(); + private List<ServiceProxy> serviceProxies = new ArrayList<>(); public void setServiceProxies(List<ServiceProxy> serviceProxies) { this.serviceProxies = serviceProxies; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java index 05199b7f37..b677b1efd0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java @@ -41,7 +41,7 @@ public class ServiceSubscription implements Serializable, ShallowCopy<ServiceSub @JsonProperty("temp-ub-sub-account-id") private String tempUbSubAccountId; @JsonProperty("service-instances") - private List<ServiceInstance> serviceInstances = new ArrayList<ServiceInstance>(); + private List<ServiceInstance> serviceInstances = new ArrayList<>(); public String getServiceType() { return serviceType; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java index 6951a23630..8c0db18d80 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java @@ -62,9 +62,9 @@ public class Vlan implements Serializable, ShallowCopy<Vlan> { @JsonProperty("is-ip-unnumbered") private Boolean isIpUnnumbered; @JsonProperty("l3-interface-ipv4-address-list") - private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>(); + private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<>(); @JsonProperty("l3-interface-ipv6-address-list") - private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>(); + private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<>(); public String getVlanInterface() { return vlanInterface; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java index 4ee8213e59..4e5b3557d8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java @@ -41,10 +41,10 @@ public class VpnBondingLink implements Serializable, ShallowCopy<VpnBondingLink> private String vpnBondingLinkId; @JsonProperty("configurations") - private List<Configuration> configurations = new ArrayList<Configuration>(); + private List<Configuration> configurations = new ArrayList<>(); @JsonProperty("service-proxies") - private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>(); + private List<ServiceProxy> serviceProxies = new ArrayList<>(); public String getVpnBondingLinkId() { return vpnBondingLinkId; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java index c9f7e5e948..93d85daad1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java @@ -34,9 +34,9 @@ public class License implements Serializable { private static final long serialVersionUID = 2345786874755685318L; @JsonProperty("entitlement-pool-uuids") - private List<String> entitlementPoolUuids = new ArrayList<String>(); + private List<String> entitlementPoolUuids = new ArrayList<>(); @JsonProperty("license-key-group-uuids") - private List<String> licenseKeyGroupUuids = new ArrayList<String>(); + private List<String> licenseKeyGroupUuids = new ArrayList<>(); public List<String> getEntitlementPoolUuids() { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 573925ff3f..ea48c78dc0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.Optional; import org.modelmapper.ModelMapper; import org.modelmapper.convention.MatchingStrategies; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AggregateRoute; import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; @@ -131,6 +132,10 @@ public class BBInputSetupMapperLayer { return modelMapper.map(aaiSegmentationAssignment, SegmentationAssignment.class); } + protected AggregateRoute mapAAIAggregateRoute(org.onap.aai.domain.yang.AggregateRoute aaiAggregateRoute) { + return modelMapper.map(aaiAggregateRoute, AggregateRoute.class); + } + protected CtagAssignment mapAAICtagAssignment(org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment) { return modelMapper.map(aaiCtagAssignment, CtagAssignment.class); } @@ -262,10 +267,21 @@ public class BBInputSetupMapperLayer { mapAllSubnetsIntoL3Network(aaiL3Network, network); mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network); mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network); + mapAllAggregateRoutesIntoL3Network(aaiL3Network, network); network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus())); return network; } + protected void mapAllAggregateRoutesIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, + L3Network network) { + if (aaiL3Network.getAggregateRoutes() != null) { + for (org.onap.aai.domain.yang.AggregateRoute aaiAggregateRoute : aaiL3Network.getAggregateRoutes() + .getAggregateRoute()) { + network.getAggregateRoutes().add(mapAAIAggregateRoute(aaiAggregateRoute)); + } + } + } + protected void mapAllSegmentationAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, L3Network network) { if (aaiL3Network.getSegmentationAssignments() != null) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index fd2054c3d0..09a5424d47 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -144,9 +144,20 @@ public class ExecuteBuildingBlockRainyDay { // keep default workStep value } + String serviceRole = ASTERISK; + try { + serviceRole = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) + .getModelInfoServiceInstance().getServiceRole(); + if (serviceRole == null || serviceRole.isEmpty()) { + serviceRole = ASTERISK; + } + } catch (Exception ex) { + // keep default serviceRole value + } + RainyDayHandlerStatus rainyDayHandlerStatus; rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatus(bbName, serviceType, vnfType, - errorCode, workStep, errorMessage); + errorCode, workStep, errorMessage, serviceRole); if (rainyDayHandlerStatus == null) { handlingCode = "Abort"; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java index b2e6ead36b..ad94421e5a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java @@ -48,7 +48,7 @@ public class ConfigAssignPropertiesForPnf { private String pnfCustomizationUuid; @JsonIgnore - private Map<String, Object> userParam = new HashMap<String, Object>(); + private Map<String, Object> userParam = new HashMap<>(); public String getServiceInstanceId() { return serviceInstanceId; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java index 592b349215..acd60a4004 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java @@ -48,7 +48,7 @@ public class ConfigAssignPropertiesForVnf { private String vnfCustomizationUuid; @JsonIgnore - private Map<String, Object> userParam = new HashMap<String, Object>(); + private Map<String, Object> userParam = new HashMap<>(); public String getServiceInstanceId() { return serviceInstanceId; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index 80373eb760..18e08917ed 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -105,7 +105,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setWorkStep(ASTERISK); doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", - "st1", "vnft1", "7000", "*", "errorMessage"); + "st1", "vnft1", "7000", "*", "errorMessage", "*"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); @@ -128,7 +128,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setWorkStep(ASTERISK); doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", - "st1", "vnft1", ASTERISK, ASTERISK, "errorMessage"); + "st1", "vnft1", ASTERISK, ASTERISK, "errorMessage", "*"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); assertEquals(5, delegateExecution.getVariable("maxRetries")); @@ -141,7 +141,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class), isA(String.class), - isA(String.class), isA(String.class), isA(String.class), isA(String.class)); + isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); delegateExecution.setVariable("suppressRollback", false); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); @@ -152,7 +152,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { @Test public void queryRainyDayTableExceptionTest() { doThrow(RuntimeException.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class), - isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); + isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class), + isA(String.class)); delegateExecution.setVariable("aLaCarte", true); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); delegateExecution.setVariable("suppressRollback", false); @@ -178,7 +179,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setSecondaryPolicy("Abort"); doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", - "st1", "vnft1", "7000", "*", "errorMessage"); + "st1", "vnft1", "7000", "*", "errorMessage", "*"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, false); @@ -203,7 +204,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setSecondaryPolicy("Abort"); doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", - "st1", "vnft1", "7000", "*", "errorMessage"); + "st1", "vnft1", "7000", "*", "errorMessage", "*"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); @@ -229,7 +230,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setSecondaryPolicy("Abort"); doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", - "st1", "vnft1", "7000", "*", "errorMessage"); + "st1", "vnft1", "7000", "*", "errorMessage", "*"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); @@ -255,7 +256,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setSecondaryPolicy("Abort"); doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", - "st1", "vnft1", "7000", "*", "errorMessage"); + "st1", "vnft1", "7000", "*", "errorMessage", "*"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); @@ -272,4 +273,52 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { assertEquals("Abort", delegateExecution.getVariable("handlingCode")); } + @Test + public void queryRainyDayTableServiceRoleNotDefined() throws Exception { + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); + serviceInstance.getModelInfoServiceInstance().setServiceRole("sr1"); + vnf.setVnfType("vnft1"); + delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); + delegateExecution.setVariable("WorkflowExceptionCode", "7000"); + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); + rainyDayHandlerStatus.setErrorCode("7000"); + rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); + rainyDayHandlerStatus.setServiceType("st1"); + rainyDayHandlerStatus.setVnfType("vnft1"); + rainyDayHandlerStatus.setPolicy("Rollback"); + rainyDayHandlerStatus.setWorkStep(ASTERISK); + + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", + "st1", "vnft1", "7000", "*", "errorMessage", "sr1"); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); + assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); + } + + @Test + public void queryRainyDayTableServiceRoleNC() throws Exception { + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); + serviceInstance.getModelInfoServiceInstance().setServiceRole("NETWORK-COLLECTION"); + vnf.setVnfType("vnft1"); + delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); + delegateExecution.setVariable("WorkflowExceptionCode", "7000"); + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); + rainyDayHandlerStatus.setErrorCode("7000"); + rainyDayHandlerStatus.setFlowName("ActivateServiceInstanceBB"); + rainyDayHandlerStatus.setServiceType("st1"); + rainyDayHandlerStatus.setVnfType("vnft1"); + rainyDayHandlerStatus.setPolicy("Abort"); + rainyDayHandlerStatus.setWorkStep(ASTERISK); + + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", + "st1", "vnft1", "7000", "*", "errorMessage", "NETWORK-COLLECTION"); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); + assertEquals("Abort", delegateExecution.getVariable("handlingCode")); + } + } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json index 418396f290..9b32a4c446 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json @@ -69,5 +69,15 @@ } ] }, + "aggregateRoutes": { + "aggregateRoute": [ + { + "routeId": "routeId", + "networkStartAddress": "10.80.12.0", + "cidrMask": "23", + "ipVersion": "4" + } + ] + }, "relationshipList": null }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json index ccefe195c9..f65fe17a2e 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json @@ -52,5 +52,13 @@ "segmentation-id": "segmentationId" } ], + "aggregate-routes": [ + { + "route-id": "routeId", + "network-start-address": "10.80.12.0", + "cidr-mask": "23", + "ip-version": "4" + } + ], "model-info-network": null } |