diff options
Diffstat (limited to 'bpmn')
95 files changed, 1688 insertions, 351 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index c19851d223..865b9ee8a7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -243,7 +243,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { msoLogger.trace('Entered ' + method) try { - def msoCompletionResponse = """ + String msoCompletionResponse = """ <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED</sdncadapterworkflow:out> </sdncadapterworkflow:MsoCompletionResponse> @@ -275,7 +275,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { // msoLogger.trace("Started CompleteMsoProcess PostProcessRequest Method "); try { - def msoCompletionResponse = """ + String msoCompletionResponse = """ <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://ecomp.com/mso/workflow/schema/v1"> <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} completed</sdncadapterworkflow:out> </sdncadapterworkflow:MsoCompletionResponse> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy index 9732693f38..480dcd5e8f 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy @@ -355,7 +355,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { Boolean success = (Boolean) execution.getVariable("FH_success") String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed"; - def falloutHandlerResponse = """ + String falloutHandlerResponse = """ <workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1"> <workflow:out>${MsoUtils.xmlEscape(out)}</workflow:out> </workflow:FalloutHandlerResponse> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy index 32d1ee74bf..bed857dda8 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -144,7 +144,7 @@ class SDNCAdapterUtils { def prefix = execution.getVariable('prefix') def request = taskProcessor.getVariable(execution, prefix+'Request') - def requestInformation = """<request-information> + String requestInformation = """<request-information> <request-id>${MsoUtils.xmlEscape(execution.getVariable("mso-request-id"))}</request-id> <request-action>torepl</request-action> <source>${MsoUtils.xmlEscape(execution.getVariable(prefix+"source"))}</source> @@ -172,7 +172,7 @@ class SDNCAdapterUtils { //Build Service Information // Send serviceName from CANOPI to sdnc for service-type - def serviceInformation = """<service-information> + String serviceInformation = """<service-information> <service-type>${MsoUtils.xmlEscape(execution.getVariable(prefix+"serviceName"))}</service-type> <service-instance-id>${MsoUtils.xmlEscape(svcInstanceId)}</service-instance-id> <subscriber-name>${MsoUtils.xmlEscape(execution.getVariable(prefix+"subscriberName"))}</subscriber-name> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index 5eb72bb2f2..9fd16340b6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -183,7 +183,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { } // Construct payload - personaModelVersionEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'model-version-id') + personaModelVersionEntry = updateGenericVnfNode(origRequest, 'model-version-id') } // Handle ipv4-oam-address @@ -191,7 +191,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { String ipv4OamAddressEntry = "" if (ipv4OamAddress != null) { // Construct payload - ipv4OamAddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'ipv4-oam-address') + ipv4OamAddressEntry = updateGenericVnfNode(origRequest, 'ipv4-oam-address') } // Handle management-v6-address @@ -199,7 +199,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { String managementV6AddressEntry = "" if (managementV6Address != null) { // Construct payload - managementV6AddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'management-v6-address') + managementV6AddressEntry = updateGenericVnfNode(origRequest, 'management-v6-address') } // Handle orchestration-status @@ -207,10 +207,10 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { String orchestrationStatusEntry = "" if (orchestrationStatus != null) { // Construct payload - orchestrationStatusEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'orchestration-status') + orchestrationStatusEntry = updateGenericVnfNode(origRequest, 'orchestration-status') } - def payload = """ + String payload = """ { ${personaModelVersionEntry} ${ipv4OamAddressEntry} ${managementV6AddressEntry} @@ -243,7 +243,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { * @param genericVnf Current Generic VNF retrieved from AAI. * @param element Name of element to be inserted. */ - public String updateGenericVnfNode(String origRequest, Node genericVnfNode, String elementName) { + public String updateGenericVnfNode(String origRequest, String elementName) { if (!utils.nodeExists(origRequest, elementName)) { return "" diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy index 6e09837274..40b0368eaa 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy @@ -116,7 +116,7 @@ class VidUtils { } def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: '' - def xmlReq = """ + String xmlReq = """ <volume-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> <action>${MsoUtils.xmlEscape(action)}</action> @@ -251,7 +251,7 @@ class VidUtils { //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) def sdncVersion = execution.getVariable("sdncVersion") - def xmlReq = """ + String xmlReq = """ <network-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> @@ -393,7 +393,7 @@ class VidUtils { userParamsNode = buildUserParams(userParams) } - def xmlReq = """ + String xmlReq = """ <network-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> @@ -512,7 +512,7 @@ class VidUtils { def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelUuid ?: '' def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: '' - def xmlReq = """ + String xmlReq = """ <vnf-request> <request-info> <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java index d26ae7b92b..a5d871eeef 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java @@ -52,99 +52,23 @@ import org.springframework.stereotype.Component; * */ @Component -public class BuildingBlockValidatorRunner { - - private static Logger logger = LoggerFactory.getLogger(BuildingBlockValidatorRunner.class); - @Autowired - private ApplicationContext context; - - @Autowired - private ExceptionBuilder exceptionBuilder; - - private List<PreBuildingBlockValidator> preBuildingBlockValidators; - private List<PostBuildingBlockValidator> postBuildingBlockValidators; - +public class BuildingBlockValidatorRunner extends FlowValidatorRunner<PreBuildingBlockValidator, PostBuildingBlockValidator> { @PostConstruct protected void init() { - preBuildingBlockValidators = new ArrayList<>( + preFlowValidators = new ArrayList<>( Optional.ofNullable(context.getBeansOfType(PreBuildingBlockValidator.class)).orElse(new HashMap<>()).values()); - postBuildingBlockValidators = new ArrayList<>( + postFlowValidators = new ArrayList<>( Optional.ofNullable(context.getBeansOfType(PostBuildingBlockValidator.class)).orElse(new HashMap<>()).values()); } - public boolean preValidate(String bbName, BuildingBlockExecution execution) { - return validate(preBuildingBlockValidators, bbName, execution); - } - - - public boolean postValidate(String bbName, BuildingBlockExecution execution) { - return validate(postBuildingBlockValidators, bbName, execution); - } - - - protected boolean validate(List<? extends BuildingBlockValidator> validators, String bbName, BuildingBlockExecution execution) { - List<Pair<String, Boolean>> results = runValidations(validators, bbName, execution); - - if (!results.isEmpty()) { - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Failed Validations:\n" + results.stream().map(item -> item.getValue0()).collect(Collectors.joining("\n"))); - } - - return true; - - } - protected List<Pair<String, Boolean>> runValidations(List<? extends BuildingBlockValidator> validators, String bbName, BuildingBlockExecution execution) { - - List<BuildingBlockValidator> filtered = filterValidators(validators, bbName); - - List<Pair<String,Boolean>> results = new ArrayList<>(); - filtered.forEach(item -> results.add(new Pair<>(item.getClass().getName(), item.validate(execution)))); - - return results.stream().filter(item -> item.getValue1().equals(false)).collect(Collectors.toList()); - } - - protected List<BuildingBlockValidator> filterValidators(List<? extends BuildingBlockValidator> validators, String bbName) { - return validators.stream() - .filter(item -> { - return item.forBuildingBlock().contains(bbName); - }) - .sorted(Comparator.comparing(item -> { - Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() { - public int value() { - return 1000; - } - - @Override - public Class<? extends Annotation> annotationType() { - return Priority.class; - } - }); - return p.value(); - })).collect(Collectors.toList()); - } - - protected <T> List<T> buildalidatorList(Reflections reflections, Class<T> clazz) { - List<T> result = new ArrayList<>(); - try { - for (Class<? extends T> klass : reflections.getSubTypesOf(clazz)) { - result.add(klass.newInstance()); - } - } catch (InstantiationException | IllegalAccessException e) { - logger.error("failed to build validator list for " + clazz.getName(), e); - throw new RuntimeException(e); - } - - return result; - } - - protected List<PreBuildingBlockValidator> getPreBuildingBlockValidators() { - return this.preBuildingBlockValidators; + protected List<PreBuildingBlockValidator> getPreFlowValidators() { + return this.preFlowValidators; } - protected List<PostBuildingBlockValidator> getPostBuildingBlockValidators() { - return this.postBuildingBlockValidators; + protected List<PostBuildingBlockValidator> getPostFlowValidators() { + return this.postFlowValidators; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java new file mode 100644 index 0000000000..96322c3c88 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java @@ -0,0 +1,25 @@ +package org.onap.so.bpmn.common.validation; + +import java.util.Optional; +import java.util.Set; + +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public interface FlowValidator { + + /** + * Names of items to be validated + * @return + */ + public Set<String> forItems(); + + /** + * Determines whether or not the workflow should be executed + + * + * @param execution + * @return + */ + public Optional<String> validate(BuildingBlockExecution execution); + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java new file mode 100644 index 0000000000..9e6ea53a47 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java @@ -0,0 +1,160 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.validation; + +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.annotation.Priority; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.javatuples.Pair; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.client.exception.ExceptionBuilder; +import org.reflections.Reflections; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + + +/** + * Controls running all pre and post validation for flows. + * + * To define a validation you must make it a spring bean and implement either {@link org.onap.so.bpmn.common.validation.PreFlowValidator} or + * {@link org.onap.so.bpmn.common.validation.PostFlowValidator} your validation will automatically be + * run by this class. + * + */ +@Component +public abstract class FlowValidatorRunner<S extends FlowValidator, E extends FlowValidator> { + + private static Logger logger = LoggerFactory.getLogger(FlowValidatorRunner.class); + @Autowired + protected ApplicationContext context; + + @Autowired + protected ExceptionBuilder exceptionBuilder; + + protected List<S> preFlowValidators; + protected List<E> postFlowValidators; + + + + /** + * Changed to object because JUEL does not support overloaded methods + * + * @param bbName + * @param execution + * @return + */ + public boolean preValidate(String bbName, Object execution) { + return validateHelper(bbName, preFlowValidators, execution); + } + + /** + * Changed to object because JUEL does not support overloaded methods + * + * @param bbName + * @param execution + * @return + */ + public boolean postValidate(String bbName, Object execution) { + return validateHelper(bbName, postFlowValidators, execution); + } + + protected boolean validateHelper(String bbName, List<? extends FlowValidator> validators, Object obj) { + + if (obj instanceof DelegateExecution) { + return validate(validators, bbName, new DelegateExecutionImpl((DelegateExecution)obj)); + } else if (obj instanceof BuildingBlockExecution) { + return validate(validators, bbName, (BuildingBlockExecution)obj); + } else { + return false; + } + } + + protected boolean validate(List<? extends FlowValidator> validators, String bbName, BuildingBlockExecution execution) { + List<Pair<String, Optional<String>>> results = runValidations(validators, bbName, execution); + + if (!results.isEmpty()) { + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, + "Failed Validations:\n" + results.stream().map(item -> String.format("%s: %s", item.getValue0(), item.getValue1().get())).collect(Collectors.joining("\n"))); + } + + return true; + + } + protected List<Pair<String, Optional<String>>> runValidations(List<? extends FlowValidator> validators, String bbName, BuildingBlockExecution execution) { + + List<FlowValidator> filtered = filterValidators(validators, bbName); + + List<Pair<String,Optional<String>>> results = new ArrayList<>(); + filtered.forEach(item -> results.add(new Pair<>(item.getClass().getName(), item.validate(execution)))); + + return results.stream().filter(item -> item.getValue1().isPresent()).collect(Collectors.toList()); + } + + protected List<FlowValidator> filterValidators(List<? extends FlowValidator> validators, String bbName) { + return validators.stream() + .filter(item -> { + return item.forItems().contains(bbName); + }) + .sorted(Comparator.comparing(item -> { + Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() { + public int value() { + return 1000; + } + + @Override + public Class<? extends Annotation> annotationType() { + return Priority.class; + } + }); + return p.value(); + })).collect(Collectors.toList()); + } + + protected <T> List<T> buildalidatorList(Reflections reflections, Class<T> clazz) { + List<T> result = new ArrayList<>(); + try { + for (Class<? extends T> klass : reflections.getSubTypesOf(clazz)) { + result.add(klass.newInstance()); + } + } catch (InstantiationException | IllegalAccessException e) { + logger.error("failed to build validator list for " + clazz.getName(), e); + throw new RuntimeException(e); + } + + return result; + } + + protected abstract List<S> getPreFlowValidators(); + + protected abstract List<E> getPostFlowValidators(); + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostBuildingBlockValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostBuildingBlockValidator.java index 0b1ef5c6e1..f26a2ee479 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostBuildingBlockValidator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostBuildingBlockValidator.java @@ -21,6 +21,6 @@ package org.onap.so.bpmn.common.validation; -public interface PostBuildingBlockValidator extends BuildingBlockValidator { +public interface PostBuildingBlockValidator extends FlowValidator { } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostWorkflowValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostWorkflowValidator.java new file mode 100644 index 0000000000..9070615a7a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostWorkflowValidator.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.validation; + +public interface PostWorkflowValidator extends FlowValidator { + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreBuildingBlockValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreBuildingBlockValidator.java index 489ac483d0..fda687e072 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreBuildingBlockValidator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreBuildingBlockValidator.java @@ -20,6 +20,6 @@ package org.onap.so.bpmn.common.validation; -public interface PreBuildingBlockValidator extends BuildingBlockValidator { +public interface PreBuildingBlockValidator extends FlowValidator { } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreWorkflowValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreWorkflowValidator.java new file mode 100644 index 0000000000..0bfbf5602f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreWorkflowValidator.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.validation; + +public interface PreWorkflowValidator extends FlowValidator { + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java new file mode 100644 index 0000000000..d8c8601865 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.validation; + +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.annotation.PostConstruct; +import javax.annotation.Priority; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.javatuples.Pair; +import org.onap.so.client.exception.ExceptionBuilder; +import org.reflections.Reflections; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + + +/** + * Controls running all pre and post validation for workflows. + * + * To define a validation you must make it a spring bean and implement either {@link org.onap.so.bpmn.common.validation.PreWorkflowValidator} or + * {@link org.onap.so.bpmn.common.validation.PostWorkflowValidator} your validation will automatically be + * run by this class. + * + */ +@Component +public class WorkflowValidatorRunner extends FlowValidatorRunner<PreWorkflowValidator, PostWorkflowValidator> { + + @PostConstruct + protected void init() { + + preFlowValidators = new ArrayList<>( + Optional.ofNullable(context.getBeansOfType(PreWorkflowValidator.class)).orElse(new HashMap<>()).values()); + postFlowValidators = new ArrayList<>( + Optional.ofNullable(context.getBeansOfType(PostWorkflowValidator.class)).orElse(new HashMap<>()).values()); + } + + protected List<PreWorkflowValidator> getPreFlowValidators() { + return this.preFlowValidators; + } + + protected List<PostWorkflowValidator> getPostFlowValidators() { + return this.postFlowValidators; + } + +} 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/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy index 1fa10a56c5..55f68f665e 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy @@ -57,7 +57,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{ private static final String VNF_PERSONAL_MODEL_VER = "14" private static final String VF_MODULE_NAME = "modTestName" private static final String VF_MODULE_MODEL_NAME = "modModelNameTest" - private static final String DEFAULT_AAI_VERSION = "9" + private static final String DEFAULT_AAI_VERSION = "14" private static final String DEFAULT_AAI_NAMESPACE = "defaultTestNamespace" @Spy diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy index 510dcf665c..a920b22c71 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy @@ -30,7 +30,7 @@ import org.junit.Test; class NetworkUtilsTest { - def volumeRequestXml = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> + String volumeRequestXml = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> <action>CREATE_VF_MODULE_VOL</action> <source>VID</source> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy index e351210586..3438c7957c 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy @@ -424,7 +424,7 @@ public class SDNCAdapterTest { </rest:payload> </sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>""" -def sdncAdapterResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> +String sdncAdapterResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapterworkflow:response-data> <tag0:CallbackHeader xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1"> <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId> @@ -439,7 +439,7 @@ def sdncAdapterResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xm </sdncadapterworkflow:SDNCAdapterWorkflowResponse> """ -def workflowErrorResponse = """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> +String workflowErrorResponse = """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> <aetgt:ErrorMessage>Received error from SDN-C: Error processing request to SDNC. Not Found. https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. SDNC Returned-[error-type:application, error-tag:data-missing, diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy index ef71e9073b..51dd77d383 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy @@ -180,7 +180,7 @@ public class SDNCAdapterUtilsTest { def rc = respcode def rm = respmsg - def output = """ + String output = """ <output xmlns="org:onap:sdnc:northbound:generic-resource"> <svc-request-id>8b46e36e-b44f-4085-9404-427be1bc8a3</svc-request-id> <response-code>${MsoUtils.xmlEscape(rc)}</response-code> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy index 52f59a3fad..14fb60c245 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy @@ -41,7 +41,7 @@ import org.junit.Test class TrinityExceptionUtilTest { - def aotsFault ="""<n1:Fault xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n1="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/SoapFault.xsd" xmlns:cer="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/ErrorResponse.xsd" xsi:schemaLocation="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/SoapFault.xsd SoapFault-CDM.xsd"> + String aotsFault ="""<n1:Fault xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n1="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/SoapFault.xsd" xmlns:cer="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/ErrorResponse.xsd" xsi:schemaLocation="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/SoapFault.xsd SoapFault-CDM.xsd"> <n1:faultcode>xml:space</n1:faultcode> <n1:faultstring>String</n1:faultstring> <n1:faultactor>http://test.com</n1:faultactor> @@ -113,7 +113,7 @@ class TrinityExceptionUtilTest { </requestError> </Fault> """ - def errorString = """<requestError> + String errorString = """<requestError> <serviceException> <messageId>SVC3002</messageId> <text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy index 1ab049571a..b80cb87c16 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy @@ -53,7 +53,7 @@ import org.junit.Test; class VidUtilsTest { - def vfModuleReqJson = """ + String vfModuleReqJson = """ { "requestDetails": { "modelInfo": { @@ -153,7 +153,7 @@ class VidUtilsTest { } } """ - def bpmnReq1 = """ + String bpmnReq1 = """ { "requestDetails": { "modelInfo": { @@ -220,7 +220,7 @@ class VidUtilsTest { } """ - def vidUtilResp1 = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> + String vidUtilResp1 = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> <action>CREATE_VF_MODULE_VOL</action> <source>VID</source> @@ -256,7 +256,7 @@ class VidUtilsTest { </volume-request> """ - def bpmnReq2 = """ + String bpmnReq2 = """ { "requestDetails": { "modelInfo": { @@ -305,7 +305,7 @@ class VidUtilsTest { } """ - def bpmnReqJsonVolumeSuppressRollbackTrue = """ + String bpmnReqJsonVolumeSuppressRollbackTrue = """ { "requestDetails": { "modelInfo": { @@ -354,7 +354,7 @@ class VidUtilsTest { } """ -def bpmnReqJsonVolumeSuppressRollbackFalse = """ +String bpmnReqJsonVolumeSuppressRollbackFalse = """ { "requestDetails": { "modelInfo": { @@ -403,7 +403,7 @@ def bpmnReqJsonVolumeSuppressRollbackFalse = """ } """ -def bpmnReqJsonVolumeSuppressRollbackNone = """ +String bpmnReqJsonVolumeSuppressRollbackNone = """ { "requestDetails": { "modelInfo": { @@ -451,7 +451,7 @@ def bpmnReqJsonVolumeSuppressRollbackNone = """ } """ - def bpmnReqJsonVfModuleSuppressRollbackTrue = """ + String bpmnReqJsonVfModuleSuppressRollbackTrue = """ { "requestDetails": { "modelInfo": { @@ -518,7 +518,7 @@ def bpmnReqJsonVolumeSuppressRollbackNone = """ } """ -def bpmnReqJsonVfModuleSuppressRollbackFalse = """ +String bpmnReqJsonVfModuleSuppressRollbackFalse = """ { "requestDetails": { "modelInfo": { @@ -585,7 +585,7 @@ def bpmnReqJsonVfModuleSuppressRollbackFalse = """ } """ -def bpmnReqJsonVfModuleSuppressRollbackNone = """ +String bpmnReqJsonVfModuleSuppressRollbackNone = """ { "requestDetails": { "modelInfo": { @@ -650,7 +650,7 @@ def bpmnReqJsonVfModuleSuppressRollbackNone = """ } } """ - def vidUtilResp2 = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> + String vidUtilResp2 = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> <action>CREATE_VF_MODULE_VOL</action> <source>VID</source> @@ -672,7 +672,7 @@ def bpmnReqJsonVfModuleSuppressRollbackNone = """ </volume-request> """ -def vidUtilVolumeRespBackoutOnFailureFalse = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> +String vidUtilVolumeRespBackoutOnFailureFalse = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> <action>CREATE_VF_MODULE_VOL</action> <source>VID</source> @@ -694,7 +694,7 @@ def vidUtilVolumeRespBackoutOnFailureFalse = """<volume-request xmlns="http://ww </volume-request> """ -def vidUtilVolumeRespBackoutOnFailureTrue = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> +String vidUtilVolumeRespBackoutOnFailureTrue = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> <action>CREATE_VF_MODULE_VOL</action> <source>VID</source> @@ -716,7 +716,7 @@ def vidUtilVolumeRespBackoutOnFailureTrue = """<volume-request xmlns="http://www </volume-request> """ -def vidUtilVolumeRespBackoutOnFailureEmpty = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> +String vidUtilVolumeRespBackoutOnFailureEmpty = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> <action>CREATE_VF_MODULE_VOL</action> <source>VID</source> @@ -738,7 +738,7 @@ def vidUtilVolumeRespBackoutOnFailureEmpty = """<volume-request xmlns="http://ww </volume-request> """ -def vidUtilVfModuleRespBackoutOnFailureFalse = """<vnf-request> +String vidUtilVfModuleRespBackoutOnFailureFalse = """<vnf-request> <request-info> <request-id>test-request-id-123</request-id> <action>CREATE_VF_MODULE</action> @@ -767,7 +767,7 @@ def vidUtilVfModuleRespBackoutOnFailureFalse = """<vnf-request> </vnf-request> """ -def vidUtilVfModuleRespBackoutOnFailureTrue = """<vnf-request> +String vidUtilVfModuleRespBackoutOnFailureTrue = """<vnf-request> <request-info> <request-id>test-request-id-123</request-id> <action>CREATE_VF_MODULE</action> @@ -796,7 +796,7 @@ def vidUtilVfModuleRespBackoutOnFailureTrue = """<vnf-request> </vnf-request> """ -def vidUtilVfModuleRespBackoutOnFailureEmpty = """<vnf-request> +String vidUtilVfModuleRespBackoutOnFailureEmpty = """<vnf-request> <request-info> <request-id>test-request-id-123</request-id> <action>CREATE_VF_MODULE</action> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy index 72cde00877..afc180e8a4 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy @@ -79,7 +79,7 @@ public class VnfAdapterRestV1Test { } - def rollbackReq = """ + String rollbackReq = """ <rollbackVolumeGroupRequest> <volumeGroupRollback> <volumeGroupId>8a07b246-155e-4b08-b56e-76e98a3c2d66</volumeGroupId> diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java index 9478b8f1f6..617f63f6f8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java @@ -57,11 +57,11 @@ public class BuildingBlockValidatorRunnerTest { MyPreValidatorOne one = new MyPreValidatorOne(); MyPreValidatorTwo two = new MyPreValidatorTwo(); MyPreValidatorThree three = new MyPreValidatorThree(); - List<BuildingBlockValidator> validators = Arrays.asList(one, two, three); + List<FlowValidator> validators = Arrays.asList(one, two, three); - List<BuildingBlockValidator> result = runner.filterValidators(validators, "test"); + List<FlowValidator> result = runner.filterValidators(validators, "test"); - List<BuildingBlockValidator> expected = Arrays.asList(two, one); + List<FlowValidator> expected = Arrays.asList(two, one); assertEquals(expected, result); } @@ -75,8 +75,8 @@ public class BuildingBlockValidatorRunnerTest { runner.preValidate("test", execution); fail("exception not thrown"); } catch (BpmnError e) { - WorkflowException workflowException = execution.getVariable("WorkflowException"); - assertEquals("Failed Validations:\norg.onap.so.bpmn.common.validation.MyPreValidatorTwo\norg.onap.so.bpmn.common.validation.MyPreValidatorOne", workflowException.getErrorMessage()); + WorkflowException workflowException = (WorkflowException)execution.getVariable("WorkflowException"); + assertEquals("Failed Validations:\norg.onap.so.bpmn.common.validation.MyPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.validation.MyPreValidatorOne: my-error-one", workflowException.getErrorMessage()); } runner.preValidate("test2", mock(BuildingBlockExecution.class)); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java index 1b52f049b3..fbd709b058 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.common.validation; import java.util.Collections; +import java.util.Optional; import java.util.Set; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -30,13 +31,13 @@ import org.springframework.stereotype.Component; public class MyPreValidatorFour implements PreBuildingBlockValidator { @Override - public Set<String> forBuildingBlock() { + public Set<String> forItems() { return Collections.singleton("test2"); } @Override - public boolean validate(BuildingBlockExecution exeuction) { - return true; + public Optional<String> validate(BuildingBlockExecution exeuction) { + return Optional.of("my-error-four"); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java index d6afea9b19..f642f915b7 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.common.validation; import java.util.Collections; +import java.util.Optional; import java.util.Set; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -30,14 +31,14 @@ import org.springframework.stereotype.Component; public class MyPreValidatorOne implements PreBuildingBlockValidator { @Override - public Set<String> forBuildingBlock() { + public Set<String> forItems() { return Collections.singleton("test"); } @Override - public boolean validate(BuildingBlockExecution exeuction) { - return false; + public Optional<String> validate(BuildingBlockExecution exeuction) { + return Optional.of("my-error-one"); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java index f7e93d5bd2..780fb43c2a 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.common.validation; import java.util.Collections; +import java.util.Optional; import java.util.Set; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -30,13 +31,13 @@ import org.springframework.stereotype.Component; public class MyPreValidatorThree implements PreBuildingBlockValidator { @Override - public Set<String> forBuildingBlock() { + public Set<String> forItems() { return Collections.singleton("test2"); } @Override - public boolean validate(BuildingBlockExecution exeuction) { - return true; + public Optional<String> validate(BuildingBlockExecution exeuction) { + return Optional.of("my-error-three"); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java index 0c15fd8589..c8ff6ef848 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.common.validation; import java.util.Collections; +import java.util.Optional; import java.util.Set; import javax.annotation.Priority; @@ -33,13 +34,13 @@ import org.springframework.stereotype.Component; public class MyPreValidatorTwo implements PreBuildingBlockValidator { @Override - public Set<String> forBuildingBlock() { + public Set<String> forItems() { return Collections.singleton("test"); } @Override - public boolean validate(BuildingBlockExecution exeuction) { - return false; + public Optional<String> validate(BuildingBlockExecution exeuction) { + return Optional.of("my-error-two"); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidator.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java index d4467b8270..bfe3ec06a3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidator.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java @@ -20,25 +20,25 @@ package org.onap.so.bpmn.common.validation; +import java.util.Collections; +import java.util.Optional; import java.util.Set; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.springframework.stereotype.Component; -public interface BuildingBlockValidator { +@Component +public class WorkflowPreValidatorOne implements PreWorkflowValidator { + + @Override + public Set<String> forItems() { + + return Collections.singleton("test"); + } + + @Override + public Optional<String> validate(BuildingBlockExecution exeuction) { + return Optional.of("my-error-one"); + } - - /** - * Name of the building block to be validated - * @return - */ - public Set<String> forBuildingBlock(); - - /** - * Determines whether or not the building block should be executed - * - * @param execution - * @return - */ - public boolean validate(BuildingBlockExecution execution); - } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java new file mode 100644 index 0000000000..ddf5f22f00 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.validation; + +import java.util.Collections; +import java.util.Optional; +import java.util.Set; + +import javax.annotation.Priority; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.springframework.stereotype.Component; + +@Priority(1) +@Component +public class WorkflowPreValidatorTwo implements PreWorkflowValidator { + + @Override + public Set<String> forItems() { + return Collections.singleton("test"); + } + + @Override + public Optional<String> validate(BuildingBlockExecution exeuction) { + return Optional.of("my-error-two"); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java new file mode 100644 index 0000000000..5629f99feb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.validation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; + +import java.util.Arrays; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.core.WorkflowException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {ValidationConfig.class}) +public class WorkflowValidatorRunnerTest { + + @Rule + public ExpectedException thrown= ExpectedException.none(); + + @Autowired + private WorkflowValidatorRunner runner; + + @Test + public void filterValidatorTest() { + + WorkflowPreValidatorOne one = new WorkflowPreValidatorOne(); + WorkflowPreValidatorTwo two = new WorkflowPreValidatorTwo(); + List<FlowValidator> validators = Arrays.asList(one, two); + + List<FlowValidator> result = runner.filterValidators(validators, "test"); + + List<FlowValidator> expected = Arrays.asList(two, one); + + assertEquals(expected, result); + } + + @Test + public void testValidate() { + + DelegateExecution execution = new DelegateExecutionFake(); + execution.setVariable("testProcessKey", "1234"); + try { + runner.preValidate("test", execution); + fail("exception not thrown"); + } catch (BpmnError e) { + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + assertEquals("Failed Validations:\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorOne: my-error-one", workflowException.getErrorMessage()); + } + runner.preValidate("test2", mock(DelegateExecution.class)); + } + + @Test + public void testEmptyList() { + boolean result = runner.preValidate("test3", mock(DelegateExecution.class)); + + assertTrue(result); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml index 2515603e82..203988a1a3 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml @@ -23,8 +23,12 @@ camunda: job-execution: deployment-aware: true #Actuator -management: - context-path: /manage +management: + endpoints: + web: + base-path: /manage + exposure: + include: "*" metrics: se-global-registry: false export: diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml index efabdb147a..09ffc0eb5c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml @@ -101,38 +101,14 @@ mso: default: aai: cloud-region: - version: '9' + version: '14' generic-vnf: - version: '9' - v8: - customer: - uri: /aai/v8/business/customers/customer - generic-query: - uri: /aai/v8/search/generic-query - l3-network: - uri: /aai/v8/network/l3-networks/l3-network - network-policy: - uri: /aai/v8/network/network-policies/network-policy - nodes-query: - uri: /aai/v8/search/nodes-query - route-table-reference: - uri: /aai/v8/network/route-table-references/route-table-reference - tenant: - uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant - vce: - uri: /aai/v8/network/vces/vce - vpn-binding: - uri: /aai/v8/network/vpn-bindings/vpn-binding - v9: - cloud-region: - uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner - generic-vnf: - uri: /aai/v9/network/generic-vnfs/generic-vnf + version: '14' global: default: aai: namespace: http://org.openecomp.aai.inventory/ - version: '8' + version: '14' message: endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage notification: diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn index 78a389a67d..19845c4e8d 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn @@ -21,6 +21,8 @@ <bpmn2:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0zzlwi7</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0wb238v</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn index 259a3341c2..ef19e6e35b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn @@ -21,6 +21,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1a495wm</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1j4x1ej</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn index e1f80dc77a..198b8d97e5 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn @@ -21,6 +21,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0wk5e4o</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ho00ja</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn index 967e01885c..7c86e964ec 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn @@ -66,6 +66,8 @@ <bpmn2:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0rt36co</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1mvf7b9</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn index a98db3ac7b..7368f35d31 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn @@ -41,6 +41,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1vmf5yv</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0c6u1cp</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn index 7dee0f709d..1109e9cd9d 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn @@ -31,6 +31,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0269euz</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1dttbxh</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn index f4db92ba5c..ce4d2e1dab 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn @@ -87,6 +87,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1qkhm79</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1vw20wu</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn index c2e960364c..044ab840db 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn @@ -21,6 +21,8 @@ <bpmn2:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_1q3rjt4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0ycnbyf</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn index 28957c6197..82c7e8d8b2 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn @@ -21,6 +21,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0m403q5</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0rpp4hi</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn index 59c35c3c5b..ea7167247e 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn @@ -32,6 +32,8 @@ <bpmn2:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_17yjhsl</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1h1zrcl</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn index 609edf4b9b..21f2fbeeb9 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateNetworkBB" name="CreateNetworkBB" isExecutable="true"> <bpmn2:startEvent id="createNetwork_startEvent"> <bpmn2:outgoing>SequenceFlow_1maepy7</bpmn2:outgoing> @@ -45,10 +45,10 @@ <bpmn2:linkEventDefinition name="CatchEvent_Create_Network" /> </bpmn2:intermediateCatchEvent> <bpmn2:intermediateThrowEvent id="ThrowEvent_ToCreateNetwork" name="ThrowEvent_ToCreateNetwork"> - <bpmn2:incoming>SequenceFlow_1h9kkhb</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_04w6hdq</bpmn2:incoming> <bpmn2:linkEventDefinition name="CatchEvent_Create_Network" /> </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1h9kkhb" sourceRef="QueryNetworkTableRef_ServiceTask" targetRef="ThrowEvent_ToCreateNetwork" /> + <bpmn2:sequenceFlow id="SequenceFlow_1h9kkhb" sourceRef="QueryNetworkTableRef_ServiceTask" targetRef="QueryNetworkSubnet_ServiceTask" /> <bpmn2:sequenceFlow id="SequenceFlow_1oc7wcr" sourceRef="CatchEvent_Collect_AAI_Data" targetRef="QueryVpnBinding_ServiceTask" /> <bpmn2:sequenceFlow id="SequenceFlow_1eqfh23" sourceRef="CatchEvent_Create_Network" targetRef="Create_Network_ServiceTask" /> <bpmn2:serviceTask id="ServiceTask_get_cloud_region" name="Process cloud region by version " camunda:expression="${AssignNetworkBBUtils.getCloudRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -56,6 +56,11 @@ <bpmn2:outgoing>SequenceFlow_03ebe6c</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_03ebe6c" sourceRef="ServiceTask_get_cloud_region" targetRef="ThrowEvent_ToCollectAAIData" /> + <bpmn2:serviceTask id="QueryNetworkSubnet_ServiceTask" name=" AAI Query (subnet) " camunda:expression="${AAIQueryTasks.querySubnet(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_1h9kkhb</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_04w6hdq</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_04w6hdq" sourceRef="QueryNetworkSubnet_ServiceTask" targetRef="ThrowEvent_ToCreateNetwork" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -142,16 +147,16 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_04qwhex_di" bpmnElement="ThrowEvent_ToCreateNetwork"> - <dc:Bounds x="827" y="113" width="36" height="36" /> + <dc:Bounds x="972" y="113" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="868" y="125" width="89" height="24" /> + <dc:Bounds x="1015" y="125" width="86" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1h9kkhb_di" bpmnElement="SequenceFlow_1h9kkhb"> <di:waypoint xsi:type="dc:Point" x="763" y="131" /> - <di:waypoint xsi:type="dc:Point" x="827" y="131" /> + <di:waypoint xsi:type="dc:Point" x="818" y="131" /> <bpmndi:BPMNLabel> - <dc:Bounds x="795" y="116" width="0" height="0" /> + <dc:Bounds x="745.5" y="116" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1oc7wcr_di" bpmnElement="SequenceFlow_1oc7wcr"> @@ -178,6 +183,16 @@ <dc:Bounds x="551" y="-52" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0j3odqk_di" bpmnElement="QueryNetworkSubnet_ServiceTask"> + <dc:Bounds x="818" y="91" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_04w6hdq_di" bpmnElement="SequenceFlow_04w6hdq"> + <di:waypoint xsi:type="dc:Point" x="918" y="131" /> + <di:waypoint xsi:type="dc:Point" x="972" y="131" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="945" y="110" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn index 29a03c4e6b..f4bd6c2953 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn @@ -21,6 +21,8 @@ <bpmn2:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0hfjdl4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0cu0wy4</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn index 41517871d0..d03d17db03 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn @@ -21,6 +21,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1j9qa4p</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ck1p4o</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn index 37fd2dbd98..48243881dc 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn @@ -21,6 +21,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_15ep3y7</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1gx4xce</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn index c627789119..11aa52ab86 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn @@ -21,6 +21,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_000o6c2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ageldf</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn index 1fdf2f3c66..cd62636b77 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> - <bpmn2:process id="HomingBB" name="Homing" isExecutable="true"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="HomingBB" name="HomingBB" isExecutable="true"> <bpmn2:startEvent id="start"> <bpmn2:outgoing>SequenceFlow_1x9usa6</bpmn2:outgoing> </bpmn2:startEvent> @@ -43,7 +43,7 @@ ex.processJavaException(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_0kamg53" name="" sourceRef="startJavaError" targetRef="processJavaException" /> <bpmn2:sequenceFlow id="SequenceFlow_1o7154s" name="" sourceRef="processJavaException" targetRef="endJavaError" /> </bpmn2:subProcess> - <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage"> + <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" calledElement="ReceiveWorkflowMessage" camunda:modelerTemplate="receiveWorkflowMessage"> <bpmn2:extensionElements> <camunda:in source="true" target="isDebugLogEnabled" /> <camunda:out source="WorkflowException" target="WorkflowException" /> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn index 8e4c8501b5..128135d808 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn @@ -31,6 +31,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1woj6rc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_15oc7ot</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn index 08f17469da..e44be1a19e 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn @@ -21,6 +21,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_00dyi16</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0uzdp0c</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn index dd00078fb5..7de68db4cf 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn @@ -21,6 +21,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_152ntu2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0py9tf7</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn index dec5681c9d..7ac8f9db76 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn @@ -26,6 +26,8 @@ <bpmn:extensionElements> <camunda:in source="SDNCRequest" target="SDNCRequest" /> <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0ielrmh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1cpzq86</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index bbb2a8a23d..38a1ccdf35 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true"> <bpmn:startEvent id="Start_WorkflowActionBB" name="start"> <bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing> @@ -29,9 +29,8 @@ <bpmn:sequenceFlow id="SequenceFlow_0mqrkxv" sourceRef="Task_SelectBB" targetRef="ServiceTask_0e2p0xs" /> <bpmn:serviceTask id="Task_SelectBB" name="Select BB" camunda:expression="${WorkflowActionBBTasks.selectBB(execution)}"> <bpmn:incoming>SequenceFlow_1atzsgn</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1wb59ic</bpmn:incoming> <bpmn:incoming>SequenceFlow_005hi8o</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0unbew4</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1tfizxf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mqrkxv</bpmn:outgoing> </bpmn:serviceTask> <bpmn:exclusiveGateway id="ExclusiveGateway_Finished" default="SequenceFlow_01j184u"> @@ -113,7 +112,7 @@ <bpmn:incoming>SequenceFlow_1r570x3</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1p8yxu6" sourceRef="Task_AbortAndCallErrorHandling" targetRef="EndEvent_0lzz1ya" /> - <bpmn:sequenceFlow id="SequenceFlow_1wb59ic" sourceRef="Task_SendSync" targetRef="Task_SelectBB" /> + <bpmn:sequenceFlow id="SequenceFlow_1wb59ic" sourceRef="Task_SendSync" targetRef="Task_PreValidateWorkflow" /> <bpmn:sequenceFlow id="SequenceFlow_01j184u" sourceRef="ExclusiveGateway_Finished" targetRef="Task_0a31dkf" /> <bpmn:sequenceFlow id="SequenceFlow_005hi8o" sourceRef="Task_0a31dkf" targetRef="Task_SelectBB" /> <bpmn:serviceTask id="Task_0a31dkf" name="Check Retry Status" camunda:expression="${WorkflowActionBBTasks.checkRetryStatus(execution)}"> @@ -126,7 +125,7 @@ <bpmn:outgoing>SequenceFlow_0unbew4</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0sckerv" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_SendSync" /> - <bpmn:sequenceFlow id="SequenceFlow_0unbew4" name="no" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_SelectBB"> + <bpmn:sequenceFlow id="SequenceFlow_0unbew4" name="no" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_PreValidateWorkflow"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowAbort" name="Is Top-Level Flow?" default="SequenceFlow_02ksbt0"> @@ -182,14 +181,20 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0mew9im" sourceRef="ServiceTask_0e2p0xs" targetRef="Call_ExecuteBB" /> <bpmn:sequenceFlow id="SequenceFlow_0kf5sen" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="Task_UpdateRequestComplete" /> + <bpmn:sequenceFlow id="SequenceFlow_1tfizxf" sourceRef="Task_PreValidateWorkflow" targetRef="Task_SelectBB" /> + <bpmn:serviceTask id="Task_PreValidateWorkflow" name="PreValidate Workflow" camunda:expression="${WorkflowValidatorRunner.preValidate(execution.getVariable("requestAction"), execution)}"> + <bpmn:incoming>SequenceFlow_0unbew4</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1wb59ic</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1tfizxf</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:process> <bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="WorkflowActionBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_WorkflowActionBB"> - <dc:Bounds x="-241" y="102" width="36" height="36" /> + <dc:Bounds x="-434" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-234" y="138" width="23" height="12" /> + <dc:Bounds x="-426" y="138" width="22" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1uv6erv_di" bpmnElement="End_WorkflowActionBB"> @@ -199,10 +204,10 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp"> - <di:waypoint xsi:type="dc:Point" x="-205" y="120" /> - <di:waypoint xsi:type="dc:Point" x="-172" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-398" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-365" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-233" y="99" width="90" height="13" /> + <dc:Bounds x="-381" y="99" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_03m7z4y_di" bpmnElement="Call_ExecuteBB"> @@ -240,10 +245,10 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0kn8jt8_di" bpmnElement="Task_RetrieveBBExectuionList"> - <dc:Bounds x="-172" y="80" width="100" height="80" /> + <dc:Bounds x="-365" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0654g3m_di" bpmnElement="Task_SendSync"> - <dc:Bounds x="46" y="-7" width="100" height="80" /> + <dc:Bounds x="-132" y="-6" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_UpdateRequestComplete"> <dc:Bounds x="942" y="206" width="100" height="80" /> @@ -290,10 +295,10 @@ <dc:Bounds x="239" y="222" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0vc9go9_di" bpmnElement="SequenceFlow_0vc9go9"> - <di:waypoint xsi:type="dc:Point" x="-72" y="120" /> - <di:waypoint xsi:type="dc:Point" x="-39" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-265" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-228" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-100" y="105" width="90" height="0" /> + <dc:Bounds x="-246" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei"> @@ -323,12 +328,12 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic"> - <di:waypoint xsi:type="dc:Point" x="146" y="33" /> - <di:waypoint xsi:type="dc:Point" x="193" y="33" /> - <di:waypoint xsi:type="dc:Point" x="193" y="120" /> - <di:waypoint xsi:type="dc:Point" x="239" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-32" y="34" /> + <di:waypoint xsi:type="dc:Point" x="32" y="34" /> + <di:waypoint xsi:type="dc:Point" x="32" y="120" /> + <di:waypoint xsi:type="dc:Point" x="80" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="163" y="77" width="90" height="0" /> + <dc:Bounds x="47" y="77" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u"> @@ -352,24 +357,24 @@ <dc:Bounds x="667" y="-76" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0ptb1yi_di" bpmnElement="ExclusiveGateway_isTopLevelFlow" isMarkerVisible="true"> - <dc:Bounds x="-39" y="95" width="50" height="50" /> + <dc:Bounds x="-228" y="95" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-45" y="145" width="61" height="24" /> + <dc:Bounds x="-235" y="145" width="63" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0sckerv_di" bpmnElement="SequenceFlow_0sckerv"> - <di:waypoint xsi:type="dc:Point" x="-13" y="96" /> - <di:waypoint xsi:type="dc:Point" x="-13" y="33" /> - <di:waypoint xsi:type="dc:Point" x="46" y="33" /> + <di:waypoint xsi:type="dc:Point" x="-202" y="96" /> + <di:waypoint xsi:type="dc:Point" x="-202" y="34" /> + <di:waypoint xsi:type="dc:Point" x="-132" y="34" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-7" y="55" width="19" height="12" /> + <dc:Bounds x="-195" y="55.55555555555556" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0unbew4_di" bpmnElement="SequenceFlow_0unbew4"> - <di:waypoint xsi:type="dc:Point" x="11" y="120" /> - <di:waypoint xsi:type="dc:Point" x="239" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-178" y="120" /> + <di:waypoint xsi:type="dc:Point" x="80" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="119" y="95" width="12" height="12" /> + <dc:Bounds x="-87" y="99.95468180757382" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_001g41v_di" bpmnElement="ExclusiveGateway_isTopLevelFlowAbort" isMarkerVisible="true"> @@ -543,6 +548,18 @@ <dc:Bounds x="872" y="217.6" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1tfizxf_di" bpmnElement="SequenceFlow_1tfizxf"> + <di:waypoint xsi:type="dc:Point" x="180" y="120" /> + <di:waypoint xsi:type="dc:Point" x="211" y="120" /> + <di:waypoint xsi:type="dc:Point" x="211" y="120" /> + <di:waypoint xsi:type="dc:Point" x="239" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="226" y="120" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0m5xr0e_di" bpmnElement="Task_PreValidateWorkflow"> + <dc:Bounds x="80" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java index e207bb914e..0aba1cc484 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java @@ -35,7 +35,7 @@ public class CreateNetworkBBTest extends BaseBPMNTest{ ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB",variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "ServiceTask_get_cloud_region", "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask", "Create_Network_ServiceTask", "Update_Network_AAI_ServiceTask", "createNetwork_EndEvent"); + assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "ServiceTask_get_cloud_region", "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask", "QueryNetworkSubnet_ServiceTask", "Create_Network_ServiceTask", "Update_Network_AAI_ServiceTask", "createNetwork_EndEvent"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 089239fa07..1d3d3331ef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -1003,7 +1003,7 @@ public class DoCreateVfModule extends VfModuleBase { svcInstId = serviceInstanceId } - def createVnfARequest = """ + String createVnfARequest = """ <createVfModuleRequest> <cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId> <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy index b42962adac..87f598db5d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy @@ -445,7 +445,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) { - def request = """ + String request = """ <rollbackVolumeGroupRequest> <volumeGroupRollback> <volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy index 161075f66e..1b92592e37 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy @@ -47,7 +47,7 @@ class CreateVfModuleVolumeInfraV1Test extends MsoGroovyTest { @Rule public ExpectedException thrown = ExpectedException.none(); - def jsonRequest = """ + String jsonRequest = """ { "requestDetails": { "modelInfo": { @@ -114,7 +114,7 @@ class CreateVfModuleVolumeInfraV1Test extends MsoGroovyTest { } """ - def volumeRequestXml = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> + String volumeRequestXml = """<volume-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> <action>CREATE_VF_MODULE_VOL</action> <source>VID</source> @@ -149,7 +149,7 @@ class CreateVfModuleVolumeInfraV1Test extends MsoGroovyTest { </volume-params> </volume-request>""" - def completeMsoRequestXml = """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + String completeMsoRequestXml = """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/request/types/v1" xmlns="http://org.onap/so/infra/vnf-request/v1"> <request-info> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy index 6ed5bfe89a..0e7114dd03 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy @@ -65,7 +65,7 @@ class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest { when(deleteVfModuleVolumeInfraV1.getAAIClient()).thenReturn(client) } - def deleteVnfAdapterRequestXml = """<deleteVolumeGroupRequest> + String deleteVnfAdapterRequestXml = """<deleteVolumeGroupRequest> <cloudSiteId>RDM2WAGPLCP</cloudSiteId> <tenantId>fba1bd1e195a404cacb9ce17a9b2b421</tenantId> <volumeGroupId>78987</volumeGroupId> @@ -79,7 +79,7 @@ class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest { <notificationUrl>http://localhost:28080/mso/WorkflowMessage/VNFAResponse/ebb9ef7b-a6a5-40e6-953e-f868f1767677</notificationUrl> </deleteVolumeGroupRequest>""" - def dbRequestXml = """<soapenv:Envelope xmlns:req="http://org.onap.so/requestsdb" + String dbRequestXml = """<soapenv:Envelope xmlns:req="http://org.onap.so/requestsdb" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> @@ -94,7 +94,7 @@ class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest { </soapenv:Body> </soapenv:Envelope>""" - def completionRequestXml = """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + String completionRequestXml = """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/request/types/v1" xmlns="http://org.onap/so/infra/vnf-request/v1"> <request-info> @@ -106,7 +106,7 @@ class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest { <aetgt:mso-bpel-name>BPMN VF Module Volume action: DELETE</aetgt:mso-bpel-name> </aetgt:MsoCompletionRequest>""" - def falloutHandlerRequestXml = """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + String falloutHandlerRequestXml = """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/request/types/v1" xmlns="http://org.onap/so/infra/vnf-request/v1"> <request-info> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy index 7523427c84..e8170ed2cb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy @@ -2954,7 +2954,7 @@ String sdncAdapterWorkflowAssignResponse = println "************ preProcessRequest_Payload ************* " - def networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", + String networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", "modelName": "CONTRAIL_EXTERNAL", "modelType": "CONTRAIL_EXTERNAL", "modelVersion": "1", @@ -2962,7 +2962,7 @@ String sdncAdapterWorkflowAssignResponse = "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" }""".trim() - def serviceModelInfo = """{"modelUuid": "36a3a8ea-49a6-4ac8-b06c-89a54544b9b6", + String serviceModelInfo = """{"modelUuid": "36a3a8ea-49a6-4ac8-b06c-89a54544b9b6", "modelName": "HNGW Protected OAM", "modelType": "service", "modelVersion": "1.0", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy index 53c164ab45..606efa8b73 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy @@ -60,7 +60,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) - def String volumeRollbackRequest = """ + String volumeRollbackRequest = """ <rollbackVolumeGroupRequest> <volumeGroupRollback> <volumeGroupId>171907d6-cdf0-4e08-953d-81ee104005a7</volumeGroupId> @@ -79,7 +79,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { </rollbackVolumeGroupRequest> """ - def String volumeRollbackRequestWithStackId = """ + String volumeRollbackRequestWithStackId = """ <rollbackVolumeGroupRequest> <volumeGroupRollback> <volumeGroupId>171907d6-cdf0-4e08-953d-81ee104005a7</volumeGroupId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy index f6efe1d7d1..a95a01912d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy @@ -1187,7 +1187,7 @@ String sdncAdapterWorkflowFormattedResponse_404 = //@Ignore public void preProcessRequest_vPER() { - def networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", + String networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", "modelName": "CONTRAIL_EXTERNAL", "modelType": "CONTRAIL_EXTERNAL", "modelVersion": "1", @@ -1354,7 +1354,7 @@ String sdncAdapterWorkflowFormattedResponse_404 = //@Ignore public void preProcessRequest_Json_MissingCloudRegion() { - def networkModelInfo = """{"modelVersionId": "sn5256d1-5a33-55df-13ab-12abad84e111", + String networkModelInfo = """{"modelVersionId": "sn5256d1-5a33-55df-13ab-12abad84e111", "modelName": "CONTRAIL_EXTERNAL", "modelType": "CONTRAIL_EXTERNAL", "modelVersion": "1", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy index 14dd10fc49..68a9ed659e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy @@ -1795,7 +1795,7 @@ String rollbackNetworkRequest = //@Ignore public void preProcessRequest_vPERNetworkRequest() { - def networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", + String networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", "modelName": "CONTRAIL_EXTERNAL", "modelType": "CONTRAIL_EXTERNAL", "modelVersion": "1", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn index 9e2049732a..627cee4293 100755 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateGenericALaCarteServiceInstance" name="CreateGenericALaCarteServiceInstance" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Create SI Start Flow"> <bpmn2:outgoing>SequenceFlow_0lp2z7l</bpmn2:outgoing> @@ -38,6 +38,7 @@ ex.processJavaException(execution)]]></bpmn2:script> <camunda:in sourceExpression="1610" target="sdncVersion" /> <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> <camunda:in source="bpmnRequest" target="requestJson" /> + <camunda:in source="msoRequestId" target="mso-request-id" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_1fv5tk6</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1lj31zp</bpmn2:outgoing> @@ -169,6 +170,7 @@ csi.prepareDecomposeService(execution)]]></bpmn2:script> <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="msoRequestId" target="mso-request-id" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0xhu1k3</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1o3ihrh</bpmn2:outgoing> @@ -185,7 +187,7 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_1tfe975" sourceRef="IntermediateCatchEvent_00tv706" targetRef="ScriptTask_1vr3ks5" /> <bpmn2:sequenceFlow id="SequenceFlow_14ajbme" sourceRef="CallActivity_1y1p4bd" targetRef="IntermediateThrowEvent_1tbopzu" /> <bpmn2:sequenceFlow id="SequenceFlow_1hjh5zy" sourceRef="IntermediateCatchEvent_1aouco1" targetRef="ScriptTask_04zaa1o" /> - <bpmn2:callActivity id="CallActivity_1y1p4bd" name="Call Homing Service" camunda:modelerTemplate="homingBlock" calledElement="Homing"> + <bpmn2:callActivity id="CallActivity_1y1p4bd" name="Call Homing Service" calledElement="Homing" camunda:modelerTemplate="homingBlock"> <bpmn2:extensionElements> <camunda:in source="true" target="isDebugLogEnabled" /> <camunda:in source="null" target="timeout" /> @@ -204,6 +206,7 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> <camunda:in source="homingModelIds" target="homingModelIds" /> <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in source="mso-request-id" target="mso-request-d" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0bng27u</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14ajbme</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn index 5c9a80072a..4224f9a94b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DeleteGenericALaCarteServiceInstance" name="DeleteGenericALaCarteServiceInstance" isExecutable="true"> <bpmn2:startEvent id="deleteSI_startEvent" name="Delete SI Start Flow"> <bpmn2:outgoing>SequenceFlow_0lp2z7l</bpmn2:outgoing> @@ -36,6 +36,7 @@ ex.processJavaException(execution)]]></bpmn2:script> <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> <camunda:in sourceExpression="1610" target="sdncVersion" /> + <camunda:in source="msoRequestId" target="mso-request-id" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0eto8sn</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1lj31zp</bpmn2:outgoing> @@ -328,4 +329,4 @@ csi.sendSyncResponse(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn2:definitions>
\ No newline at end of file +</bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn index 6092de6c79..3cb879ac3f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_9MhrcHqVEea26OhQB97uCQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_9MhrcHqVEea26OhQB97uCQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DeleteVnfInfra" name="DeleteVnfInfra" isExecutable="true"> <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -107,6 +107,7 @@ deleteVnf.prepareCompletionHandlerRequest(execution)]]></bpmn2:script> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> <camunda:in source="DELVI_vnfId" target="vnfId" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_00bhxtl</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1f56g06</bpmn2:outgoing> @@ -134,6 +135,7 @@ deleteVnf.prepareCompletionHandlerRequest(execution)]]></bpmn2:script> <camunda:in source="DELVI_serviceInstanceId" target="serviceInstanceId" /> <camunda:in source="DELVI_cloudConfiguration" target="cloudConfiguration" /> <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_00o02cv</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0dy2xw0</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn index e3f1d7721d..383a9f54e0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> - <bpmn2:process id="DoCreateServiceInstance" name="DoCreateServiceInstance " isExecutable="true"> + <bpmn2:process id="DoCreateServiceInstance" name="DoCreateServiceInstance" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> </bpmn2:startEvent> @@ -370,4 +370,4 @@ dcsi.processJavaException(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn2:definitions> +</bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index 6b89387a82..e83c27c400 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.buildingblock; import static org.apache.commons.lang3.StringUtils.*; import java.time.Duration; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; @@ -57,7 +58,14 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.sniro.SniroClient; import static org.onap.so.client.sniro.SniroValidator.*; +import org.onap.so.client.sniro.beans.Demand; +import org.onap.so.client.sniro.beans.LicenseInfo; +import org.onap.so.client.sniro.beans.ModelInfo; +import org.onap.so.client.sniro.beans.PlacementInfo; +import org.onap.so.client.sniro.beans.RequestInfo; +import org.onap.so.client.sniro.beans.ServiceInfo; import org.onap.so.client.sniro.beans.SniroManagerRequest; +import org.onap.so.client.sniro.beans.SubscriberInfo; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; @@ -122,27 +130,27 @@ public class SniroHomingV2 { timeout = env.getProperty("sniro.manager.timeout", "PT30M"); } - SniroManagerRequest request = new SniroManagerRequest(); //TODO Add additional pojos for each section + SniroManagerRequest request = new SniroManagerRequest(); - JSONObject requestInfo = buildRequestInfo(requestId, timeout); - request.setRequestInformation(requestInfo.toString()); + RequestInfo requestInfo = buildRequestInfo(requestId, timeout); + request.setRequestInformation(requestInfo); - JSONObject serviceInfo = buildServiceInfo(serviceInstance); - request.setServiceInformation(serviceInfo.toString()); + ServiceInfo serviceInfo = buildServiceInfo(serviceInstance); + request.setServiceInformation(serviceInfo); - JSONObject placementInfo = buildPlacementInfo(customer, requestParams); + PlacementInfo placementInfo = buildPlacementInfo(customer, requestParams); - JSONArray placementDemands = buildPlacementDemands(serviceInstance); - placementInfo.put("placementDemands", placementDemands); - request.setPlacementInformation(placementInfo.toString()); + List<Demand> placementDemands = buildPlacementDemands(serviceInstance); + placementInfo.setDemands(placementDemands); + request.setPlacementInformation(placementInfo); - JSONObject licenseInfo = new JSONObject(); + LicenseInfo licenseInfo = new LicenseInfo(); - JSONArray licenseDemands = buildLicenseDemands(serviceInstance); - licenseInfo.put("licenseDemands", licenseDemands); - request.setLicenseInformation(licenseInfo.toString()); + List<Demand> licenseDemands = buildLicenseDemands(serviceInstance); + licenseInfo.setDemands(licenseDemands); + request.setLicenseInformation(licenseInfo); - if(placementDemands.length() > 0 || licenseDemands.length() > 0){ + if(placementDemands.size() > 0 || licenseDemands.size() > 0){ client.postDemands(request); }else{ log.debug(SERVICE_MISSING_DATA + "resources eligible for homing or licensing"); @@ -156,10 +164,13 @@ public class SniroHomingV2 { log.trace("Completed Sniro Homing Call Sniro"); }catch(BpmnError e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); }catch(BadResponseException e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); }catch(Exception e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing sniro request: " + e.getMessage()); } } @@ -203,10 +214,13 @@ public class SniroHomingV2 { log.trace("Completed Sniro Homing Process Solution"); }catch(BpmnError e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); }catch(BadResponseException e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); }catch(Exception e){ + log.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage()); } } @@ -216,18 +230,21 @@ public class SniroHomingV2 { * * @throws Exception */ - private JSONObject buildRequestInfo(String requestId, String timeout) throws Exception{ + private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{ log.trace("Building request information"); - JSONObject requestInfo = new JSONObject(); + RequestInfo requestInfo = new RequestInfo(); if(requestId != null){ String host = env.getProperty("mso.workflow.message.endpoint"); String callbackUrl = host + "/" + UriUtils.encodePathSegment("SNIROResponse", "UTF-8") + "/" + UriUtils.encodePathSegment(requestId, "UTF-8"); Duration d = Duration.parse(timeout); - long timeoutSeconds = d.getSeconds(); - requestInfo.put("transactionId", requestId).put("requestId", requestId).put("callbackUrl", callbackUrl).put("sourceId", "mso").put("requestType", "create") - .put("timeout", timeoutSeconds); + requestInfo.setTransactionId(requestId); + requestInfo.setRequestId(requestId); + requestInfo.setCallbackUrl(callbackUrl); + requestInfo.setRequestType("create"); + requestInfo.setTimeout(d.getSeconds()); + } else{ throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId"); } @@ -238,19 +255,19 @@ public class SniroHomingV2 { * Builds the request information section for the homing/licensing request * */ - private JSONObject buildServiceInfo(ServiceInstance serviceInstance){ + private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){ log.trace("Building service information"); - JSONObject info = new JSONObject(); + ServiceInfo info = new ServiceInfo(); ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance(); if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){ - info.put("serviceInstanceId", serviceInstance.getServiceInstanceId()); + info.setServiceInstanceId(serviceInstance.getServiceInstanceId()); if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution - info.put("serviceName", modelInfo.getServiceType()); + info.setServiceName(modelInfo.getServiceType()); } if(modelInfo.getServiceRole() != null){ - info.put("serviceRole", modelInfo.getServiceRole()); + info.setServiceRole(modelInfo.getServiceRole()); } - info.put("modelInfo", buildModelInfo(serviceInstance.getModelInfoServiceInstance())); + info.setModelInfo(buildModelInfo(modelInfo)); }else{ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID); } @@ -261,14 +278,18 @@ public class SniroHomingV2 { * Builds initial section of placement info for the homing/licensing request * */ - private JSONObject buildPlacementInfo(Customer customer, RequestParameters requestParams){ - JSONObject placementInfo = new JSONObject(); + private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){ + PlacementInfo placementInfo = new PlacementInfo(); if(customer != null){ log.debug("Adding subscriber to placement information"); - placementInfo.put("subscriberInfo", new JSONObject().put("globalSubscriberId", customer.getGlobalCustomerId()).put("subscriberName", customer.getSubscriberName()).put("subscriberCommonSiteId", customer.getSubscriberCommonSiteId())); + SubscriberInfo subscriber = new SubscriberInfo(); + subscriber.setGlobalSubscriberId(customer.getGlobalCustomerId()); + subscriber.setSubscriberName(customer.getSubscriberName()); + subscriber.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId()); + placementInfo.setSubscriberInfo(subscriber); if(requestParams != null){ log.debug("Adding request parameters to placement information"); - placementInfo.put("requestParameters", new JSONObject(requestParams.toJsonString())); + placementInfo.setRequestParameters(requestParams.toJsonString()); } }else{ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer"); @@ -281,9 +302,9 @@ public class SniroHomingV2 { * Builds the placement demand list for the homing/licensing request * */ - private JSONArray buildPlacementDemands(ServiceInstance serviceInstance){ + private List<Demand> buildPlacementDemands(ServiceInstance serviceInstance){ log.trace("Building placement information demands"); - JSONArray placementDemands = new JSONArray(); + List<Demand> placementDemands = new ArrayList<Demand>(); List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources(); if(!allottedResourceList.isEmpty()){ @@ -292,9 +313,9 @@ public class SniroHomingV2 { if(isBlank(ar.getId())){ ar.setId(UUID.randomUUID().toString()); } - JSONObject demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource()); + Demand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource()); addCandidates(ar, demand); - placementDemands.put(demand); + placementDemands.add(demand); } } List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks(); @@ -306,9 +327,9 @@ public class SniroHomingV2 { if(isBlank(sp.getId())){ sp.setId(UUID.randomUUID().toString()); } - JSONObject demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy()); + Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy()); addCandidates(sp, demand); - placementDemands.put(demand); + placementDemands.add(demand); } } } @@ -319,15 +340,15 @@ public class SniroHomingV2 { * Builds the license demand list for the homing/licensing request * */ - private JSONArray buildLicenseDemands(ServiceInstance serviceInstance){ + private List<Demand> buildLicenseDemands(ServiceInstance serviceInstance){ log.trace("Building license information"); - JSONArray licenseDemands = new JSONArray(); + List<Demand> licenseDemands = new ArrayList<Demand>(); List<GenericVnf> vnfList = serviceInstance.getVnfs(); if(!vnfList.isEmpty()){ log.debug("Adding vnfs to license demands list"); for(GenericVnf vnf : vnfList){ - JSONObject demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf()); - licenseDemands.put(demand); + Demand demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf()); + licenseDemands.add(demand); } } return licenseDemands; @@ -337,13 +358,13 @@ public class SniroHomingV2 { * Builds a single demand object * */ - private JSONObject buildDemand(String id, ModelInfoMetadata metadata){ + private Demand buildDemand(String id, ModelInfoMetadata metadata){ log.debug("Building demand for service or resource: " + id); - JSONObject demand = new JSONObject(); + Demand demand = new Demand(); if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){ - demand.put(SERVICE_RESOURCE_ID, id); - demand.put(RESOURCE_MODULE_NAME, metadata.getModelInstanceName()); - demand.put(RESOURCE_MODEL_INFO, buildModelInfo(metadata)); + demand.setServiceResourceId(id); + demand.setResourceModuleName(metadata.getModelInstanceName()); + demand.setModelInfo(buildModelInfo(metadata)); }else{ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName"); } @@ -354,12 +375,15 @@ public class SniroHomingV2 { * Builds the resource model info section * */ - private JSONObject buildModelInfo(ModelInfoMetadata metadata){ - JSONObject object = new JSONObject(); + private ModelInfo buildModelInfo(ModelInfoMetadata metadata){ + ModelInfo object = new ModelInfo(); String invariantUuid = metadata.getModelInvariantUuid(); String modelUuid = metadata.getModelUuid(); if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){ - object.put(MODEL_INVARIANT_ID, invariantUuid).put(MODEL_VERSION_ID, modelUuid).put(MODEL_NAME, metadata.getModelName()).put(MODEL_VERSION, metadata.getModelVersion()); + object.setModelInvariantId(invariantUuid); + object.setModelVersionId(modelUuid); + object.setModelName(metadata.getModelName()); + object.setModelVersion(metadata.getModelVersion()); }else if(isNotBlank(invariantUuid)){ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_VERSION_ID); }else{ @@ -372,14 +396,34 @@ public class SniroHomingV2 { * Adds required, excluded, and existing candidates to a demand * */ - private void addCandidates(SolutionCandidates candidates, JSONObject demand){ + private void addCandidates(SolutionCandidates candidates, Demand demand){ List<Candidate> required = candidates.getRequiredCandidates(); List<Candidate> excluded = candidates.getExcludedCandidates(); if(!required.isEmpty()){ - demand.put("requiredCandidates", required); + List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>(); + for(Candidate c:required){ + org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); + org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType(); + type.setName(c.getCandidateType().getName()); + can.setCandidateType(type); + can.setCandidates(c.getCandidates()); + can.setCloudOwner(c.getCloudOwner()); + cans.add(can); + } + demand.setRequiredCandidates(cans); } if(!excluded.isEmpty()){ - demand.put("excludedCandidates", excluded); + List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>(); + for(Candidate c:excluded){ + org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); + org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType(); + type.setName(c.getCandidateType().getName()); + can.setCandidateType(type); + can.setCandidates(c.getCandidates()); + can.setCloudOwner(c.getCloudOwner()); + cans.add(can); + } + demand.setExcludedCandidates(cans); } //TODO support existing candidates } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java index 0079b351f2..46ff8495f9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java @@ -29,6 +29,7 @@ import org.modelmapper.PropertyMap; import org.onap.aai.domain.yang.NetworkPolicy; import org.onap.aai.domain.yang.RouteTableReference; import org.onap.aai.domain.yang.RouteTargets; +import org.onap.aai.domain.yang.Subnet; import org.onap.aai.domain.yang.VpnBinding; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -222,4 +223,28 @@ public class AAIQueryTasks { } return mappedRouteTargets; } + + public void querySubnet(BuildingBlockExecution execution) { + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, + execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); + Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships(); + if (!networkRelationships.isPresent()) { + throw (new Exception(ERROR_MSG)); + } + List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET); + + if(!subnetsUriList.isEmpty()) { + for(AAIResourceUri subnetUri : subnetsUriList) { + Optional<Subnet> oSubnet = aaiNetworkResources.getSubnet(subnetUri); + if(oSubnet.isPresent()) { + l3network.getSubnets().add(modelMapper.map(oSubnet.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class)); + } + } + } + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 10ee13ebed..50f2091ae2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -344,6 +344,18 @@ public class WorkflowAction { } return vfModuleResources; } + + protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) { + int count = 0; + for(Resource resource : vfModuleResources){ + if(resource.isBaseVfModule()){ + Collections.swap(vfModuleResources, vfModuleResources.size()-1, count); + break; + } + count++; + } + return vfModuleResources; + } private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) { @@ -969,8 +981,14 @@ public class WorkflowAction { requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey(), false)); } } else if (orchFlow.getFlowName().contains(VFMODULE)) { - List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) + List<Resource> vfModuleResourcesSorted = null; + if(requestAction.equals("createInstance")||requestAction.equals("assignInstance")||requestAction.equals("activateInstance")){ + vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) .collect(Collectors.toList())); + }else{ + vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) + .collect(Collectors.toList())); + } for (int i = 0; i < vfModuleResourcesSorted.size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i), apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false)); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index 4abb0a1b2c..3081ab86d8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -260,6 +260,7 @@ public class NetworkAdapterObjectMapper { map(source.getGatewayAddress(), destination.getGatewayIp()); map(source.getIpVersion(), destination.getIpVersion()); map(source.isDhcpEnabled(), destination.getEnableDHCP()); + map(source.getSubnetSequence(), destination.getSubnetSequence()); } }; modelMapper.addMappings(personMap); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java index f91ad44f2b..6bee5a9b1e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java @@ -1,5 +1,6 @@ package org.onap.so.client.namingservice; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -17,6 +18,7 @@ import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; +import org.springframework.web.client.HttpStatusCodeException; import org.springframework.web.client.RestTemplate; @@ -34,21 +36,31 @@ public class NamingClient{ @Autowired private NamingClientResponseValidator namingClientResponseValidator; - public String postNameGenRequest(NameGenRequest request) throws BadResponseException { + public String postNameGenRequest(NameGenRequest request) throws BadResponseException, IOException { String targetUrl = env.getProperty(ENDPOINT); HttpHeaders headers = setHeaders(env.getProperty(AUTH)); msoLogger.info("Sending postNameGenRequest to url: " + targetUrl); HttpEntity<NameGenRequest> requestEntity = new HttpEntity<>(request, headers); - ResponseEntity<NameGenResponse> response = restTemplate.postForEntity(targetUrl, requestEntity, NameGenResponse.class); + ResponseEntity<NameGenResponse> response; + try{ + response = restTemplate.postForEntity(targetUrl, requestEntity, NameGenResponse.class); + }catch(HttpStatusCodeException e){ + throw new BadResponseException(namingClientResponseValidator.formatError(e)); + } return namingClientResponseValidator.validateNameGenResponse(response); } - public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException { + public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException, IOException { String targetUrl = env.getProperty(ENDPOINT); HttpHeaders headers = setHeaders(env.getProperty(AUTH)); msoLogger.info("Sending deleteNameGenRequest to url: " + targetUrl); HttpEntity<NameGenDeleteRequest> requestEntity = new HttpEntity<>(request, headers); - ResponseEntity<NameGenDeleteResponse> response = restTemplate.exchange(targetUrl, HttpMethod.DELETE, requestEntity, NameGenDeleteResponse.class); + ResponseEntity<NameGenDeleteResponse> response; + try{ + response = restTemplate.exchange(targetUrl, HttpMethod.DELETE, requestEntity, NameGenDeleteResponse.class); + }catch(HttpStatusCodeException e){ + throw new BadResponseException(namingClientResponseValidator.formatError(e)); + } return namingClientResponseValidator.validateNameGenDeleteResponse(response); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java index ab0639574c..e790fa4b72 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java @@ -1,5 +1,6 @@ package org.onap.so.client.namingservice; +import java.io.IOException; import java.util.List; import org.apache.http.HttpStatus; @@ -12,6 +13,9 @@ import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; +import org.springframework.web.client.HttpStatusCodeException; + +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class NamingClientResponseValidator { @@ -99,5 +103,20 @@ public class NamingClientResponseValidator { private boolean isHttpCodeSuccess(int code) { return code >= HttpStatus.SC_OK && code < HttpStatus.SC_MULTIPLE_CHOICES || code == 0; } + + protected String formatError(HttpStatusCodeException e) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + NameGenResponse errorResponse = mapper.readValue(e.getResponseBodyAsString(), NameGenResponse.class); + NameGenResponseError error = errorResponse.getError(); + + String errorMessageString = null; + if (error != null) { + errorMessageString = error.getMessage(); + } + String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); + msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, errorMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, errorMessage); + return errorMessage; + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java index c3f216e288..82bad8db79 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java @@ -13,11 +13,11 @@ public class NamingRequestObjectBuilder{ public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType, String nfNamingCode, String instanceGroupName){ Element element = new Element(); - element.setExternalKey(instanceGroupId); - element.setPolicyInstanceName(policyInstanceName); - element.setNamingType(namingType); - element.setResourceName(instanceGroupName); - element.setNamingIngredientsZeroOrMore(nfNamingCode); + element.put("external-key", instanceGroupId); + element.put("policy-instance-name", policyInstanceName); + element.put("naming-type", namingType); + element.put("resource-name", instanceGroupName); + element.put("nf-naming-code", nfNamingCode); return element; } public Deleteelement deleteElementMapper(String instanceGroupId){ diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java index 16d5e8e1db..d2bf95a28e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -84,6 +84,10 @@ public class AAINetworkResources { public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) { return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class); } + + public Optional<org.onap.aai.domain.yang.Subnet> getSubnet(AAIResourceUri subnetUri) { + return injectionHelper.getAaiClient().get(subnetUri).asBean(org.onap.aai.domain.yang.Subnet.class); + } public Optional<RouteTableReference> getRouteTable(AAIResourceUri rTableUri) { return injectionHelper.getAaiClient().get(rTableUri).asBean(RouteTableReference.class); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java index 8b443a165b..d0bf6da6c9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java @@ -20,6 +20,7 @@ package org.onap.so.client.orchestration; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -44,14 +45,14 @@ public class NamingServiceResources { @Autowired private NamingRequestObjectBuilder namingRequestObjectBuilder; - public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode) throws BadResponseException { + public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode) throws BadResponseException, IOException { Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName, NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName()); List<Element> elements = new ArrayList<Element>(); elements.add(element); return(namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements))); } - public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException { + public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException, IOException { Deleteelement deleteElement = namingRequestObjectBuilder.deleteElementMapper(instanceGroup.getId()); List<Deleteelement> deleteElements = new ArrayList<Deleteelement>(); deleteElements.add(deleteElement); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java new file mode 100644 index 0000000000..6ba2d7d825 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java @@ -0,0 +1,44 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Candidate implements Serializable{ + + private static final long serialVersionUID = -5474502255533410907L; + + @JsonProperty("candidateType") + private CandidateType candidateType; + @JsonProperty("candidates") + private List<String> candidates; + @JsonProperty("cloudOwner") + private String cloudOwner; + + + public CandidateType getCandidateType(){ + return candidateType; + } + + public void setCandidateType(CandidateType candidateType){ + this.candidateType = candidateType; + } + + public List<String> getCandidates(){ + return candidates; + } + + public void setCandidates(List<String> candidates){ + this.candidates = candidates; + } + + public String getCloudOwner(){ + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner){ + this.cloudOwner = cloudOwner; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java new file mode 100644 index 0000000000..8c83f26afa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java @@ -0,0 +1,23 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CandidateType implements Serializable{ + + private static final long serialVersionUID = 2273215496314532173L; + + @JsonProperty("name") + private String name; + + + public String getName(){ + return name; + } + + public void setName(String name){ + this.name = name; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java new file mode 100644 index 0000000000..a82fe6dab8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java @@ -0,0 +1,64 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Demand implements Serializable{ + + private static final long serialVersionUID = 5676094538091859816L; + + @JsonProperty("serviceResourceId") + private String serviceResourceId; + @JsonProperty("resourceModuleName") + private String resourceModuleName; + @JsonProperty("resourceModelInfo") + private ModelInfo modelInfo; + @JsonProperty("requiredCandidates") + private List<Candidate> requiredCandidates; + @JsonProperty("excludedCandidates") + private List<Candidate> excludedCandidates; + + + public List<Candidate> getRequiredCandidates(){ + return requiredCandidates; + } + + public void setRequiredCandidates(List<Candidate> requiredCandidates){ + this.requiredCandidates = requiredCandidates; + } + + public List<Candidate> getExcludedCandidates(){ + return excludedCandidates; + } + + public void setExcludedCandidates(List<Candidate> excludedCandidates){ + this.excludedCandidates = excludedCandidates; + } + + public String getServiceResourceId(){ + return serviceResourceId; + } + + public void setServiceResourceId(String serviceResourceId){ + this.serviceResourceId = serviceResourceId; + } + + public String getResourceModuleName(){ + return resourceModuleName; + } + + public void setResourceModuleName(String resourceModuleName){ + this.resourceModuleName = resourceModuleName; + } + + public ModelInfo getModelInfo(){ + return modelInfo; + } + + public void setModelInfo(ModelInfo modelInfo){ + this.modelInfo = modelInfo; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java new file mode 100644 index 0000000000..2da675bd96 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java @@ -0,0 +1,25 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class LicenseInfo implements Serializable{ + + private static final long serialVersionUID = 6878164369491185856L; + + @JsonProperty("licenseDemands") + private List<Demand> demands = new ArrayList<Demand>(); + + + public List<Demand> getDemands(){ + return demands; + } + + public void setDemands(List<Demand> demands){ + this.demands = demands; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java new file mode 100644 index 0000000000..ad786b7da4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java @@ -0,0 +1,62 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonPropertyOrder({ + "modelName", + "modelVersionId", + "modelVersion", + "modelInvariantId" +}) +@JsonRootName("modelInfo") +public class ModelInfo implements Serializable{ + + private static final long serialVersionUID = 1488642558601651075L; + + @JsonProperty("modelInvariantId") + private String modelInvariantId; + @JsonProperty("modelVersionId") + private String modelVersionId; + @JsonProperty("modelName") + private String modelName; + @JsonProperty("modelVersion") + private String modelVersion; + + + public String getModelInvariantId(){ + return modelInvariantId; + } + + public void setModelInvariantId(String modelInvariantId){ + this.modelInvariantId = modelInvariantId; + } + + public String getModelVersionId(){ + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId){ + this.modelVersionId = modelVersionId; + } + + public String getModelName(){ + return modelName; + } + + public void setModelName(String modelName){ + this.modelName = modelName; + } + + public String getModelVersion(){ + return modelVersion; + } + + public void setModelVersion(String modelVersion){ + this.modelVersion = modelVersion; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java new file mode 100644 index 0000000000..4784fc9fc4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java @@ -0,0 +1,55 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRawValue; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonPropertyOrder({ + "subscriberInfo", + "placementDemands", + "requestParameters" +}) +@JsonRootName("placementInfo") +public class PlacementInfo implements Serializable{ + + private static final long serialVersionUID = -964488472247386556L; + + @JsonProperty("subscriberInfo") + private SubscriberInfo subscriberInfo; + @JsonProperty("placementDemands") + private List<Demand> demands = new ArrayList<Demand>(); + @JsonRawValue + @JsonProperty("requestParameters") + private String requestParameters; + + + public SubscriberInfo getSubscriberInfo(){ + return subscriberInfo; + } + + public void setSubscriberInfo(SubscriberInfo subscriberInfo){ + this.subscriberInfo = subscriberInfo; + } + + public List<Demand> getDemands(){ + return demands; + } + + public void setDemands(List<Demand> demands){ + this.demands = demands; + } + + public String getRequestParameters(){ + return requestParameters; + } + + public void setRequestParameters(String requestParameters){ + this.requestParameters = requestParameters; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java index 0d7e44224e..e92b5d1ca3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -36,6 +36,14 @@ public class RequestInfo implements Serializable{ String transactionId; @JsonProperty("requestId") String requestId; + @JsonProperty("callbackUrl") + String callbackUrl; + @JsonProperty("sourceId") + String sourceId = "mso"; + @JsonProperty("requestType") + String requestType; + @JsonProperty("timeout") + long timeout; public String getTransactionId(){ return transactionId; @@ -53,5 +61,37 @@ public class RequestInfo implements Serializable{ this.requestId = requestId; } + public String getCallbackUrl(){ + return callbackUrl; + } + + public void setCallbackUrl(String callbackUrl){ + this.callbackUrl = callbackUrl; + } + + public String getSourceId(){ + return sourceId; + } + + public void setSourceId(String sourceId){ + this.sourceId = sourceId; + } + + public String getRequestType(){ + return requestType; + } + + public void setRequestType(String requestType){ + this.requestType = requestType; + } + + public long getTimeout(){ + return timeout; + } + + public void setTimeout(long timeout){ + this.timeout = timeout; + } + } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java new file mode 100644 index 0000000000..8d4d7b1a85 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java @@ -0,0 +1,62 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonPropertyOrder({ + "modelInfo", + "serviceRole", + "serviceInstanceId", + "serviceName" +}) +@JsonRootName("serviceInfo") +public class ServiceInfo implements Serializable{ + + private static final long serialVersionUID = -6866022419398548585L; + + @JsonProperty("serviceInstanceId") + private String serviceInstanceId; + @JsonProperty("serviceName") + private String serviceName; + @JsonProperty("serviceRole") + private String serviceRole; + @JsonProperty("modelInfo") + private ModelInfo modelInfo; + + + public String getServiceInstanceId(){ + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId){ + this.serviceInstanceId = serviceInstanceId; + } + + public String getServiceName(){ + return serviceName; + } + + public void setServiceName(String serviceName){ + this.serviceName = serviceName; + } + + public String getServiceRole(){ + return serviceRole; + } + + public void setServiceRole(String serviceRole){ + this.serviceRole = serviceRole; + } + + public ModelInfo getModelInfo(){ + return modelInfo; + } + + public void setModelInfo(ModelInfo modelInfo){ + this.modelInfo = modelInfo; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java index 19b752ffd1..3c39456318 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,42 +37,38 @@ public class SniroManagerRequest implements Serializable{ private static final long serialVersionUID = -1541132882892163132L; private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroManagerRequest.class); - @JsonRawValue @JsonProperty("requestInfo") - private String requestInformation; - @JsonRawValue + private RequestInfo requestInformation; @JsonProperty("serviceInfo") - private String serviceInformation; - @JsonRawValue + private ServiceInfo serviceInformation; @JsonProperty("placementInfo") - private String placementInformation; - @JsonRawValue + private PlacementInfo placementInformation; @JsonProperty("licenseInfo") - private String licenseInformation; + private LicenseInfo licenseInformation; - public String getRequestInformation() { + public RequestInfo getRequestInformation() { return requestInformation; } - public void setRequestInformation(String requestInformation) { + public void setRequestInformation(RequestInfo requestInformation) { this.requestInformation = requestInformation; } - public String getServiceInformation() { + public ServiceInfo getServiceInformation() { return serviceInformation; } - public void setServiceInformation(String serviceInformation) { + public void setServiceInformation(ServiceInfo serviceInformation) { this.serviceInformation = serviceInformation; } - public String getPlacementInformation() { + public PlacementInfo getPlacementInformation() { return placementInformation; } - public void setPlacementInformation(String placementInformation) { + public void setPlacementInformation(PlacementInfo placementInformation) { this.placementInformation = placementInformation; } - public String getLicenseInformation() { + public LicenseInfo getLicenseInformation() { return licenseInformation; } - public void setLicenseInformation(String licenseInformation) { + public void setLicenseInformation(LicenseInfo licenseInformation) { this.licenseInformation = licenseInformation; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java new file mode 100644 index 0000000000..3e68519bf1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java @@ -0,0 +1,46 @@ +package org.onap.so.client.sniro.beans; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRawValue; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("subscriberInfo") +public class SubscriberInfo implements Serializable{ + + private static final long serialVersionUID = -6350949051379748872L; + + @JsonProperty("globalSubscriberId") + private String globalSubscriberId; + @JsonProperty("subscriberName") + private String subscriberName; + @JsonProperty("subscriberCommonSiteId") + private String subscriberCommonSiteId; + + + public String getGlobalSubscriberId(){ + return globalSubscriberId; + } + + public void setGlobalSubscriberId(String globalSubscriberId){ + this.globalSubscriberId = globalSubscriberId; + } + + public String getSubscriberName(){ + return subscriberName; + } + + public void setSubscriberName(String subscriberName){ + this.subscriberName = subscriberName; + } + + public String getSubscriberCommonSiteId(){ + return subscriberCommonSiteId; + } + + public void setSubscriberCommonSiteId(String subscriberCommonSiteId){ + this.subscriberCommonSiteId = subscriberCommonSiteId; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 5699c94137..72f0ce4e6d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -1200,6 +1200,24 @@ public class WorkflowActionTest extends BaseTaskTest { assertEquals("111",result.get(2).getResourceId()); } + @Test + public void sortVfModulesByBaseLastTest(){ + List<Resource> resources = new ArrayList<>(); + Resource resource1 = new Resource(WorkflowType.VFMODULE,"111",false); + resource1.setBaseVfModule(true); + resources.add(resource1); + Resource resource2 = new Resource(WorkflowType.VFMODULE,"222",false); + resource2.setBaseVfModule(false); + resources.add(resource2); + Resource resource3 = new Resource(WorkflowType.VFMODULE,"333",false); + resource3.setBaseVfModule(false); + resources.add(resource3); + List<Resource> result = workflowAction.sortVfModulesByBaseLast(resources); + assertEquals("333",result.get(0).getResourceId()); + assertEquals("222",result.get(1).getResourceId()); + assertEquals("111",result.get(2).getResourceId()); + } + private List<OrchestrationFlow> createFlowList (String... flowNames){ List<OrchestrationFlow> result = new ArrayList<>(); for(String flowName : flowNames){ diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java new file mode 100644 index 0000000000..c1769e3680 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java @@ -0,0 +1,99 @@ +package org.onap.so.client.namingservice; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.http.HttpStatus; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.namingservice.model.Deleteelement; +import org.onap.namingservice.model.Element; +import org.onap.namingservice.model.NameGenDeleteRequest; +import org.onap.namingservice.model.NameGenRequest; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.client.exception.BadResponseException; +import org.springframework.beans.factory.annotation.Autowired; + +import com.fasterxml.jackson.core.JsonProcessingException; + +public class NamingClientTest extends BaseIntegrationTest{ + @Autowired + NamingClient client; + @Autowired + NamingRequestObjectBuilder requestBuilder; + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public void assignNameGenRequest() throws BadResponseException, IOException{ + stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("NamingClient/AssignResponse.json") + .withStatus(HttpStatus.SC_ACCEPTED))); + + NameGenRequest request = assignSetup(); + String response = client.postNameGenRequest(request); + assertTrue(response.equals("$vnf-name")); + } + @Test + public void assignNameGenRequestError() throws BadResponseException, IOException{ + stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("NamingClient/ErrorResponse.json") + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + thrown.expect(BadResponseException.class); + thrown.expectMessage("Error from Naming Service: External Key is required and must be unique"); + NameGenRequest request = assignSetup(); + client.postNameGenRequest(request); + } + @Test + public void unassignNameGenRequest() throws BadResponseException, IOException{ + stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("NamingClient/UnassignResponse.json") + .withStatus(HttpStatus.SC_ACCEPTED))); + + String response = client.deleteNameGenRequest(unassignSetup()); + assertTrue(response.equals("")); + } + @Test + public void unassignNameGenRequestError() throws BadResponseException, IOException{ + stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("NamingClient/ErrorResponse.json") + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + thrown.expect(BadResponseException.class); + thrown.expectMessage("Error from Naming Service: External Key is required and must be unique"); + client.deleteNameGenRequest(unassignSetup()); + } + + public NameGenRequest assignSetup() throws JsonProcessingException{ + NameGenRequest request = new NameGenRequest(); + List<Element> elements = new ArrayList<>(); + Element testElement = new Element(); + testElement = requestBuilder.elementMapper("SomeUniqueValue", "SDNC_Policy.Config_MS_1806SRIOV_VNATJson.4.xml", "VNF", "nfNamingCode", "vnf_name"); + elements.add(testElement); + request = requestBuilder.nameGenRequestMapper(elements); + return request; + } + public NameGenDeleteRequest unassignSetup() throws JsonProcessingException{ + NameGenDeleteRequest request = new NameGenDeleteRequest(); + List<Deleteelement> deleteElements = new ArrayList<>(); + Deleteelement testElement = new Deleteelement(); + testElement = requestBuilder.deleteElementMapper("instanceGroupId"); + deleteElements.add(testElement); + request = requestBuilder.nameGenDeleteRequestMapper(deleteElements); + return request; + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java index 0a2dc1e4fa..27839d665b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectBuilderTest.java @@ -26,11 +26,11 @@ public class NamingRequestObjectBuilderTest { public void elementMapperTest(){ // Expected element Element expected = new Element(); - expected.setExternalKey(instanceGroupId); - expected.setPolicyInstanceName(policyInstanceName); - expected.setNamingType(namingType); - expected.setResourceName(instanceGroupName); - expected.setNamingIngredientsZeroOrMore(nfNamingCode); + expected.put("external-key", instanceGroupId); + expected.put("policy-instance-name", policyInstanceName); + expected.put("naming-type", namingType); + expected.put("resource-name", instanceGroupName); + expected.put("nf-naming-code", nfNamingCode); // Actual element Element actual = mapper.elementMapper(instanceGroupId, policyInstanceName, namingType, nfNamingCode, instanceGroupName); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java index 6b33440bd7..2efdbde28b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java @@ -340,4 +340,21 @@ public class AAINetworkResourcesTest extends TestDataSetup{ eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())), eq(AAIEdgeLabel.USES)); } + + @Test + public void getSubnetTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + Optional<org.onap.aai.domain.yang.Subnet> oSubnet = Optional.empty(); + AAIResourceUri subnetUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, "ModelInvariantUUID", "serviceModelVersionId"); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + oSubnet = aaiNetworkResources.getSubnet(subnetUri); + verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class)); + + if (oSubnet.isPresent()) { + org.onap.aai.domain.yang.Subnet subnet = oSubnet.get(); + assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.Subnet.class).get(), sameBeanAs(subnet)); + } + } } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json index dc2d99216f..b65203b24d 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json @@ -1,6 +1,56 @@ { - "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, - "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceRole":"testServiceRole1","serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, - "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, - "licenseInfo" : {"licenseDemands":[]} + "requestInfo" : { + "transactionId" : "testRequestId", + "requestId" : "testRequestId", + "callbackUrl" : "http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId", + "sourceId" : "mso", + "requestType" : "create", + "timeout" : 1800 + }, + "serviceInfo" : { + "modelInfo" : { + "modelName" : "testModelName1", + "modelVersionId" : "testModelUUID1", + "modelVersion" : "testModelVersion1", + "modelInvariantId" : "testModelInvariantUUID1" + }, + "serviceRole" : "testServiceRole1", + "serviceInstanceId" : "testServiceInstanceId1", + "serviceName" : "testServiceType1" + }, + "placementInfo" : { + "subscriberInfo" : { + "globalSubscriberId" : "testCustomerId", + "subscriberName" : "testCustomerName" + }, + "placementDemands" : [ { + "serviceResourceId" : "testProxyId1", + "resourceModuleName" : "testProxyInstanceName1", + "resourceModelInfo" : { + "modelName" : "testProxyModelName1", + "modelVersionId" : "testProxyModelUuid1", + "modelVersion" : "testProxyModelVersion1", + "modelInvariantId" : "testProxyModelInvariantUuid1" + } + }, { + "serviceResourceId" : "testProxyId2", + "resourceModuleName" : "testProxyInstanceName2", + "resourceModelInfo" : { + "modelName" : "testProxyModelName2", + "modelVersionId" : "testProxyModelUuid2", + "modelVersion" : "testProxyModelVersion2", + "modelInvariantId" : "testProxyModelInvariantUuid2" + }, + "requiredCandidates" : [ { + "candidateType" : { + "name" : "vnfId" + }, + "candidates" : [ "testVnfId" ] + } ] + } ], + "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false} + }, + "licenseInfo" : { + "licenseDemands" : [ ] + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json index 61f9496f05..ac460c328a 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json @@ -1,6 +1,59 @@ { - "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, - "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceRole":"testServiceRole1","serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, - "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testAllottedModelName1","modelVersionId":"testAllottedModelUuid1","modelVersion":"testAllottedModelVersion1","modelInvariantId":"testAllottedModelInvariantUuid1"},"resourceModuleName":"testAllottedModelInstanceName1","serviceResourceId":"testAllottedResourceId1"},{"resourceModelInfo":{"modelName":"testAllottedModelName2","modelVersionId":"testAllottedModelUuid2","modelVersion":"testAllottedModelVersion2","modelInvariantId":"testAllottedModelInvariantUuid2"},"resourceModuleName":"testAllottedModelInstanceName2","serviceResourceId":"testAllottedResourceId2"},{"resourceModelInfo":{"modelName":"testAllottedModelName3","modelVersionId":"testAllottedModelUuid3","modelVersion":"testAllottedModelVersion3","modelInvariantId":"testAllottedModelInvariantUuid3"},"resourceModuleName":"testAllottedModelInstanceName3","serviceResourceId":"testAllottedResourceId3"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, - "licenseInfo" : {"licenseDemands":[]} + "requestInfo" : { + "transactionId" : "testRequestId", + "requestId" : "testRequestId", + "callbackUrl" : "http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId", + "sourceId" : "mso", + "requestType" : "create", + "timeout" : 1800 + }, + "serviceInfo" : { + "modelInfo" : { + "modelName" : "testModelName1", + "modelVersionId" : "testModelUUID1", + "modelVersion" : "testModelVersion1", + "modelInvariantId" : "testModelInvariantUUID1" + }, + "serviceRole" : "testServiceRole1", + "serviceInstanceId" : "testServiceInstanceId1", + "serviceName" : "testServiceType1" + }, + "placementInfo" : { + "subscriberInfo" : { + "globalSubscriberId" : "testCustomerId", + "subscriberName" : "testCustomerName" + }, + "placementDemands" : [ { + "serviceResourceId" : "testAllottedResourceId1", + "resourceModuleName" : "testAllottedModelInstanceName1", + "resourceModelInfo" : { + "modelName" : "testAllottedModelName1", + "modelVersionId" : "testAllottedModelUuid1", + "modelVersion" : "testAllottedModelVersion1", + "modelInvariantId" : "testAllottedModelInvariantUuid1" + } + }, { + "serviceResourceId" : "testAllottedResourceId2", + "resourceModuleName" : "testAllottedModelInstanceName2", + "resourceModelInfo" : { + "modelName" : "testAllottedModelName2", + "modelVersionId" : "testAllottedModelUuid2", + "modelVersion" : "testAllottedModelVersion2", + "modelInvariantId" : "testAllottedModelInvariantUuid2" + } + }, { + "serviceResourceId" : "testAllottedResourceId3", + "resourceModuleName" : "testAllottedModelInstanceName3", + "resourceModelInfo" : { + "modelName" : "testAllottedModelName3", + "modelVersionId" : "testAllottedModelUuid3", + "modelVersion" : "testAllottedModelVersion3", + "modelInvariantId" : "testAllottedModelInvariantUuid3" + } + } ], + "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false} + }, + "licenseInfo" : { + "licenseDemands" : [ ] + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json index a7da6da7cc..6db2153691 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json @@ -1,6 +1,104 @@ { - "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, - "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceRole":"testServiceRole1","serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, - "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, - "licenseInfo" : {"licenseDemands":[]} + "requestInfo" : { + "transactionId" : "testRequestId", + "requestId" : "testRequestId", + "callbackUrl" : "http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId", + "sourceId" : "mso", + "requestType" : "create", + "timeout" : 1800 + }, + "serviceInfo" : { + "modelInfo" : { + "modelName" : "testModelName1", + "modelVersionId" : "testModelUUID1", + "modelVersion" : "testModelVersion1", + "modelInvariantId" : "testModelInvariantUUID1" + }, + "serviceRole" : "testServiceRole1", + "serviceInstanceId" : "testServiceInstanceId1", + "serviceName" : "testServiceType1" + }, + "placementInfo" : { + "subscriberInfo" : { + "globalSubscriberId" : "testCustomerId", + "subscriberName" : "testCustomerName" + }, + "placementDemands" : [ { + "serviceResourceId" : "testProxyId1", + "resourceModuleName" : "testProxyInstanceName1", + "resourceModelInfo" : { + "modelName" : "testProxyModelName1", + "modelVersionId" : "testProxyModelUuid1", + "modelVersion" : "testProxyModelVersion1", + "modelInvariantId" : "testProxyModelInvariantUuid1" + } + }, { + "serviceResourceId" : "testProxyId2", + "resourceModuleName" : "testProxyInstanceName2", + "resourceModelInfo" : { + "modelName" : "testProxyModelName2", + "modelVersionId" : "testProxyModelUuid2", + "modelVersion" : "testProxyModelVersion2", + "modelInvariantId" : "testProxyModelInvariantUuid2" + }, + "requiredCandidates" : [ { + "candidateType" : { + "name" : "vnfId" + }, + "candidates" : [ "testVnfId" ] + } ] + }, { + "serviceResourceId" : "testProxyId1", + "resourceModuleName" : "testProxyInstanceName1", + "resourceModelInfo" : { + "modelName" : "testProxyModelName1", + "modelVersionId" : "testProxyModelUuid1", + "modelVersion" : "testProxyModelVersion1", + "modelInvariantId" : "testProxyModelInvariantUuid1" + } + }, { + "serviceResourceId" : "testProxyId2", + "resourceModuleName" : "testProxyInstanceName2", + "resourceModelInfo" : { + "modelName" : "testProxyModelName2", + "modelVersionId" : "testProxyModelUuid2", + "modelVersion" : "testProxyModelVersion2", + "modelInvariantId" : "testProxyModelInvariantUuid2" + }, + "requiredCandidates" : [ { + "candidateType" : { + "name" : "vnfId" + }, + "candidates" : [ "testVnfId" ] + } ] + }, { + "serviceResourceId" : "testProxyId1", + "resourceModuleName" : "testProxyInstanceName1", + "resourceModelInfo" : { + "modelName" : "testProxyModelName1", + "modelVersionId" : "testProxyModelUuid1", + "modelVersion" : "testProxyModelVersion1", + "modelInvariantId" : "testProxyModelInvariantUuid1" + } + }, { + "serviceResourceId" : "testProxyId2", + "resourceModuleName" : "testProxyInstanceName2", + "resourceModelInfo" : { + "modelName" : "testProxyModelName2", + "modelVersionId" : "testProxyModelUuid2", + "modelVersion" : "testProxyModelVersion2", + "modelInvariantId" : "testProxyModelInvariantUuid2" + }, + "requiredCandidates" : [ { + "candidateType" : { + "name" : "vnfId" + }, + "candidates" : [ "testVnfId" ] + } ] + } ], + "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false} + }, + "licenseInfo" : { + "licenseDemands" : [ ] + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/AssignResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/AssignResponse.json new file mode 100644 index 0000000000..b065c21339 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/AssignResponse.json @@ -0,0 +1,14 @@ +{ + "elements": [ + { + "external-key": "$vnf-id", + "resource-name": "instance-group-name", + "resource-value": "$vnf-name" + }, + { + "external-key": "$vnf-id", + "resource-name": "vm-name", + "resource-value": "$vm-name" + } + ] +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/ErrorResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/ErrorResponse.json new file mode 100644 index 0000000000..8bac7cd1f9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/ErrorResponse.json @@ -0,0 +1,6 @@ +{ + "error": { + "errorId": "NELGEN-0003", + "message": "External Key is required and must be unique" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/UnassignResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/UnassignResponse.json new file mode 100644 index 0000000000..b065c21339 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/NamingClient/UnassignResponse.json @@ -0,0 +1,14 @@ +{ + "elements": [ + { + "external-key": "$vnf-id", + "resource-name": "instance-group-name", + "resource-value": "$vnf-name" + }, + { + "external-key": "$vnf-id", + "resource-name": "vm-name", + "resource-value": "$vm-name" + } + ] +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml index 3d45caddce..fed2aa69c7 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml +++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml @@ -43,7 +43,7 @@ pnf: mso: naming: endpoint: http://localhost:${wiremock.server.port}/web/service/v1/genNetworkElementName - auth: Basic YnBlbDptc28tZGItMTUwNyE= + auth: Basic YnBlbDptc28tZGItMTUwNyE= adapters: requestDb: auth: Basic YnBlbDptc28tZGItMTUwNyE= |