diff options
16 files changed, 665 insertions, 20 deletions
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java index d1c090dc9e..cf7e26c7b1 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java @@ -23,6 +23,8 @@ package org.openecomp.mso.adapters.vnf; import java.util.HashMap;
import java.util.Map;
import javax.xml.ws.Holder;
+
+import org.junit.Assert;
import org.junit.Test;
import org.openecomp.mso.adapters.vnf.MsoVnfAdapterImpl;
import org.openecomp.mso.entity.MsoRequest;
@@ -30,7 +32,49 @@ import org.openecomp.mso.openstack.beans.VnfRollback; public class MsoVnfAdapterImplTest {
- @Test
+ MsoVnfAdapter msoVnfAdapter = new MsoVnfAdapterImpl();
+
+ @Test
+ public void updateVnf() throws Exception {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ msoVnfAdapter.updateVnf("cloudsite", "tenantid", "vfw", "v1", "test",
+ "update", "heatid", new HashMap<>(), msoRequest, new Holder<>(), new Holder<>());
+ Assert.assertTrue(true);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void queryVnfNullPoinerExceptionTest() throws Exception {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ msoVnfAdapter.queryVnf("cloudSiteId",
+ "tenantId",
+ "vnfName",
+ msoRequest,
+ new Holder<>(),
+ new Holder<>(),
+ new Holder<>(),
+ new Holder<>());
+ Assert.assertFalse(true);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void rollbackVnfCloudSiteInfoNotAvail() throws Exception {
+ VnfRollback rollback = new VnfRollback();
+ rollback.setVnfId("vnfid");
+ rollback.setVfModuleStackId("stackid");
+ rollback.setCloudSiteId("11234");
+ rollback.setTenantId("234");
+
+ msoVnfAdapter.rollbackVnf(rollback);
+ Assert.assertFalse(true);
+ }
+
+ @Test
public void healthCheckVNFTest() {
MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
instance.healthCheck();
diff --git a/aria/aria-rest-server/VERSION b/aria/aria-rest-server/VERSION new file mode 100644 index 0000000000..51f7e73a94 --- /dev/null +++ b/aria/aria-rest-server/VERSION @@ -0,0 +1 @@ +1.0.1-SNAPSHOT diff --git a/aria/aria-rest-server/setup.py b/aria/aria-rest-server/setup.py new file mode 100644 index 0000000000..799fe46021 --- /dev/null +++ b/aria/aria-rest-server/setup.py @@ -0,0 +1,41 @@ +# org.onap.dcae +# ============LICENSE_START==================================================== +# Copyright (c) 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====================================================== +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. + +from setuptools import setup, find_packages + +try: + with open('VERSION') as v_file: + version = v_file.read().strip() +except IOError: + print "There was a problem parsing the VERSION file." + +setup( + name='aria-rest-server', + version=version, + packages=find_packages(), + author = '', + author_email = '', + description = ('Library for ...'), + license = 'Apache 2.0', + keywords = '', + url = '', + zip_safe = True, + install_requires=[], + entry_points = {} +) diff --git a/aria/aria-rest-server/tox.ini b/aria/aria-rest-server/tox.ini new file mode 100644 index 0000000000..e74b672b26 --- /dev/null +++ b/aria/aria-rest-server/tox.ini @@ -0,0 +1,13 @@ +[tox] +envlist = py27,py35 +[testenv] +deps= + pytest + coverage + pytest-cov +setenv = + PYTHONPATH={toxinidir} +commands= + echo "There are no tests yet" + #pytest --junitxml xunit-results.xml --cov dcaeapplib --cov-report xml + #coverage xml diff --git a/aria/pom.xml b/aria/pom.xml index 9d91f476f0..e238351bd8 100644 --- a/aria/pom.xml +++ b/aria/pom.xml @@ -17,7 +17,7 @@ <modules> <module>aria-rest-java-client</module> - <module>aria-rest-server</module> + <!-- <module>aria-rest-server</module> --> <module>multivim-plugin</module> </modules> </project> diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index ff21372240..94a8dd5249 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -98,11 +98,25 @@ <dependency> + <!-- This version should be upgraded in Beijing --> <groupId>org.openecomp.sdc.sdc-tosca</groupId> <artifactId>sdc-tosca</artifactId> <version>1.2.3</version> + <exclusions> + <exclusion> + <groupId>org.openecomp.sdc.jtosca</groupId> + <artifactId>jtosca</artifactId> + <!-- <version>1.2.2-SNAPSHOT</version> --> + </exclusion> + </exclusions> </dependency> - + <dependency> + <!-- When the sdc-tosca version is upgraded from 1.2.3, + this dependency should be removed entirely --> + <groupId>org.openecomp.sdc.jtosca</groupId> + <artifactId>jtosca</artifactId> + <version>1.2.1</version> + </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index a0a5a24e3f..b0ec0c01bc 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -350,11 +350,26 @@ <artifactId>spring-test</artifactId> <version>4.3.14.RELEASE</version> </dependency> - <dependency> - <groupId>org.openecomp.sdc.sdc-tosca</groupId> - <artifactId>sdc-tosca</artifactId> - <version>1.2.3</version> - </dependency> + <dependency> + <!-- This version should be upgraded in Beijing --> + <groupId>org.openecomp.sdc.sdc-tosca</groupId> + <artifactId>sdc-tosca</artifactId> + <version>1.2.3</version> + <exclusions> + <exclusion> + <groupId>org.openecomp.sdc.jtosca</groupId> + <artifactId>jtosca</artifactId> + <!-- <version>1.2.2-SNAPSHOT</version> --> + </exclusion> + </exclusions> + </dependency> + <dependency> + <!-- When the sdc-tosca version is upgraded from 1.2.3, + this dependency should be removed entirely --> + <groupId>org.openecomp.sdc.jtosca</groupId> + <artifactId>jtosca</artifactId> + <version>1.2.1</version> + </dependency> <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-engine-spring</artifactId> diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResult.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResult.java new file mode 100644 index 0000000000..740e89b9d7 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResult.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.openecomp.mso.bpmn.core.domain; + +import java.io.Serializable; +import java.util.List; + +public class CompareModelsResult extends JsonWrapper implements Serializable +{ + private static final long serialVersionUID = 1L; + + List<ResourceModelInfo> addedResourceList; + List<ResourceModelInfo> deletedResourceList; + List<String> requestInputs; + + public List<ResourceModelInfo> getAddedResourceList() { + return addedResourceList; + } + public void setAddedResourceList(List<ResourceModelInfo> addedResourceList) { + this.addedResourceList = addedResourceList; + } + public List<ResourceModelInfo> getDeletedResourceList() { + return deletedResourceList; + } + public void setDeletedResourceList(List<ResourceModelInfo> deletedResourceList) { + this.deletedResourceList = deletedResourceList; + } + public List<String> getRequestInputs() { + return requestInputs; + } + public void setRequestInputs(List<String> requestInputs) { + this.requestInputs = requestInputs; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceModelInfo.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceModelInfo.java new file mode 100644 index 0000000000..724fe16bdc --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceModelInfo.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.openecomp.mso.bpmn.core.domain; + +import java.io.Serializable; + +public class ResourceModelInfo extends JsonWrapper implements Serializable{ + + private static final long serialVersionUID = 1L; + String resourceName; + String resourceInvariantUuid; + String resourceUuid; + String resourceCustomizationUuid; + + public String getResourceName() { + return resourceName; + } + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + public String getResourceInvariantUuid() { + return resourceInvariantUuid; + } + public void setResourceInvariantUuid(String resourceInvariantUuid) { + this.resourceInvariantUuid = resourceInvariantUuid; + } + public String getResourceUuid() { + return resourceUuid; + } + public void setResourceUuid(String resourceUuid) { + this.resourceUuid = resourceUuid; + } + public String getResourceCustomizationUuid() { + return resourceCustomizationUuid; + } + public void setResourceCustomizationUuid(String resourceCustomizationUuid) { + this.resourceCustomizationUuid = resourceCustomizationUuid; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn new file mode 100644 index 0000000000..f5a87b0c3e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn @@ -0,0 +1,221 @@ +<?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:process id="DoCompareModelofE2EServiceInstance" name="DoCompareModelofE2EServiceInstance" isExecutable="true"> + <bpmn2:sequenceFlow id="SequenceFlow_1rebkae" sourceRef="StartEvent_0jhv664" targetRef="CallActivity_1va14ul" /> + <bpmn2:intermediateCatchEvent id="StartEvent_0jhv664" name="StartCompare"> + <bpmn2:outgoing>SequenceFlow_1rebkae</bpmn2:outgoing> + <bpmn2:linkEventDefinition name="StartCompare" /> + </bpmn2:intermediateCatchEvent> + <bpmn2:endEvent id="EndEvent_0x8im5g"> + <bpmn2:incoming>SequenceFlow_1lkpfe2</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1lkpfe2" sourceRef="ScriptTask_1odhh8p" targetRef="EndEvent_0x8im5g" /> + <bpmn2:subProcess id="SubProcess_0roysbg" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_0xtpw6j"> + <bpmn2:outgoing>SequenceFlow_19sogyb</bpmn2:outgoing> + <bpmn2:errorEventDefinition /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_05a2pr9"> + <bpmn2:incoming>SequenceFlow_17mr4jl</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:scriptTask id="ScriptTask_0xk9fk3" name="Log / Print Unexpected Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_19sogyb</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_17mr4jl</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_19sogyb" name="" sourceRef="StartEvent_0xtpw6j" targetRef="ScriptTask_0xk9fk3" /> + <bpmn2:sequenceFlow id="SequenceFlow_17mr4jl" name="" sourceRef="ScriptTask_0xk9fk3" targetRef="EndEvent_05a2pr9" /> + </bpmn2:subProcess> + <bpmn2:startEvent id="StartEvent_13da9hl" name="Start Flow"> + <bpmn2:outgoing>SequenceFlow_1chfao3</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1dhdmdy" name="GoTo StartCompare"> + <bpmn2:incoming>SequenceFlow_1cpg3ku</bpmn2:incoming> + <bpmn2:linkEventDefinition name="StartCompare" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1chfao3" name="" sourceRef="StartEvent_13da9hl" targetRef="ScriptTask_0ba0el1" /> + <bpmn2:callActivity id="CallActivity_1va14ul" name="Call DoCompareModelVersions" calledElement="DoCompareModelVersions"> + <bpmn2:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_1rebkae</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1pe6r93</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:scriptTask id="ScriptTask_1odhh8p" name="Post for Compare Model Versions " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1pe6r93</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1lkpfe2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi= new DoCompareModelofE2EServiceInstance() +dcsi.postCompareModelVersions(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1pe6r93" sourceRef="CallActivity_1va14ul" targetRef="ScriptTask_1odhh8p" /> + <bpmn2:scriptTask id="ScriptTask_0ba0el1" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1chfao3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1xzphe4</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCompareModelofE2EServiceInstance() +dcsi.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:callActivity id="CallActivity_1a3n88w" name="Call AAI Generic GetService" calledElement="GenericGetService"> + <bpmn2:extensionElements> + <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> + <camunda:in sourceExpression="service-instance" target="GENGS_type" /> + <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> + <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> + <camunda:out source="GENGS_service" target="GENGS_service" /> + <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> + <camunda:in source="serviceType" target="GENGS_serviceType" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_1xzphe4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0b6eqin</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:scriptTask id="ScriptTask_18k4xnm" name="Post Process AAI GET" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0b6eqin</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1cpg3ku</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCompareModelofE2EServiceInstance() +dcsi.postProcessAAIGET(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1xzphe4" name="" sourceRef="ScriptTask_0ba0el1" targetRef="CallActivity_1a3n88w" /> + <bpmn2:sequenceFlow id="SequenceFlow_0b6eqin" sourceRef="CallActivity_1a3n88w" targetRef="ScriptTask_18k4xnm" /> + <bpmn2:sequenceFlow id="SequenceFlow_1cpg3ku" sourceRef="ScriptTask_18k4xnm" targetRef="IntermediateThrowEvent_1dhdmdy" /> + </bpmn2:process> + <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCompareModelofE2EServiceInstance"> + <bpmndi:BPMNEdge id="SequenceFlow_1rebkae_di" bpmnElement="SequenceFlow_1rebkae"> + <di:waypoint xsi:type="dc:Point" x="6" y="259" /> + <di:waypoint xsi:type="dc:Point" x="363" y="259" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="139.5" y="238" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_05z1jyy_di" bpmnElement="StartEvent_0jhv664"> + <dc:Bounds x="-30" y="241" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-46" y="281" width="68" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0x8im5g_di" bpmnElement="EndEvent_0x8im5g"> + <dc:Bounds x="1038" y="241" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1011" y="281" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1lkpfe2_di" bpmnElement="SequenceFlow_1lkpfe2"> + <di:waypoint xsi:type="dc:Point" x="801" y="259" /> + <di:waypoint xsi:type="dc:Point" x="1038" y="259" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="874.5" y="238" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_0roysbg_di" bpmnElement="SubProcess_0roysbg" isExpanded="true"> + <dc:Bounds x="216" y="387" width="467" height="193" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0xtpw6j_di" bpmnElement="StartEvent_0xtpw6j"> + <dc:Bounds x="284" y="454" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="167" y="495" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_05a2pr9_di" bpmnElement="EndEvent_05a2pr9"> + <dc:Bounds x="577" y="454" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="460" y="495" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xk9fk3_di" bpmnElement="ScriptTask_0xk9fk3"> + <dc:Bounds x="388" y="432" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_19sogyb_di" bpmnElement="SequenceFlow_19sogyb"> + <di:waypoint xsi:type="dc:Point" x="320" y="472" /> + <di:waypoint xsi:type="dc:Point" x="388" y="472" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="219" y="457" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_17mr4jl_di" bpmnElement="SequenceFlow_17mr4jl"> + <di:waypoint xsi:type="dc:Point" x="488" y="472" /> + <di:waypoint xsi:type="dc:Point" x="577" y="472" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="400" y="457" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_13da9hl_di" bpmnElement="StartEvent_13da9hl"> + <dc:Bounds x="-20" y="83" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-26" y="124" width="50" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1dhdmdy_di" bpmnElement="IntermediateThrowEvent_1dhdmdy"> + <dc:Bounds x="1048" y="83" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1023" y="123" width="88" height="36" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1chfao3_di" bpmnElement="SequenceFlow_1chfao3"> + <di:waypoint xsi:type="dc:Point" x="16" y="101" /> + <di:waypoint xsi:type="dc:Point" x="211" y="101" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="68.5" y="80" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1va14ul_di" bpmnElement="CallActivity_1va14ul"> + <dc:Bounds x="363" y="219" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1odhh8p_di" bpmnElement="ScriptTask_1odhh8p"> + <dc:Bounds x="701" y="219" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1pe6r93_di" bpmnElement="SequenceFlow_1pe6r93"> + <di:waypoint xsi:type="dc:Point" x="463" y="259" /> + <di:waypoint xsi:type="dc:Point" x="701" y="259" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="537" y="238" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0ba0el1_di" bpmnElement="ScriptTask_0ba0el1"> + <dc:Bounds x="211" y="61" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1a3n88w_di" bpmnElement="CallActivity_1a3n88w"> + <dc:Bounds x="499" y="59" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_18k4xnm_di" bpmnElement="ScriptTask_18k4xnm"> + <dc:Bounds x="776" y="61" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1xzphe4_di" bpmnElement="SequenceFlow_1xzphe4"> + <di:waypoint xsi:type="dc:Point" x="311" y="101" /> + <di:waypoint xsi:type="dc:Point" x="499" y="99" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="360" y="85" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0b6eqin_di" bpmnElement="SequenceFlow_0b6eqin"> + <di:waypoint xsi:type="dc:Point" x="599" y="99" /> + <di:waypoint xsi:type="dc:Point" x="776" y="101" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="643.5" y="79" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1cpg3ku_di" bpmnElement="SequenceFlow_1cpg3ku"> + <di:waypoint xsi:type="dc:Point" x="876" y="101" /> + <di:waypoint xsi:type="dc:Point" x="968" y="101" /> + <di:waypoint xsi:type="dc:Point" x="968" y="101" /> + <di:waypoint xsi:type="dc:Point" x="1048" y="101" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="983" y="95" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/common/pom.xml b/common/pom.xml index adc102e150..3ad3fa36bd 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -128,7 +128,7 @@ <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-lib</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.0</version> </dependency> <dependency> <groupId>org.springframework</groupId> @@ -138,7 +138,7 @@ <dependency> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-schema</artifactId> - <version>1.2.1-SNAPSHOT</version> + <version>1.2.0</version> </dependency> <dependency> <groupId>org.modelmapper</groupId> diff --git a/common/src/test/java/org/openecomp/mso/entity/MsoRequestTest.java b/common/src/test/java/org/openecomp/mso/entity/MsoRequestTest.java new file mode 100644 index 0000000000..a7fc7e223e --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/entity/MsoRequestTest.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.entity; + +import org.junit.Test; +import org.openecomp.mso.openpojo.rules.HasToStringRule; +import org.openecomp.mso.openpojo.rules.ToStringTester; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterEnum; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + + +public class MsoRequestTest { + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.openecomp.mso.entity"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), new FilterEnum(), filterTestClasses); + } + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } + +} + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java index 86cacb9d1c..8c99d067e9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java @@ -36,5 +36,6 @@ public enum Action { addRelationships, removeRelationships, inPlaceSoftwareUpdate, - applyUpdatedConfig + applyUpdatedConfig, + compareModel } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java index c27e8277da..6d6227af37 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java @@ -50,6 +50,7 @@ import org.openecomp.mso.apihandler.common.ResponseHandler; import org.openecomp.mso.apihandlerinfra.Messages;
import org.openecomp.mso.apihandlerinfra.MsoException;
import org.openecomp.mso.apihandlerinfra.MsoRequest;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.CompareModelsRequest;
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.DelE2ESvcResp;
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;
@@ -158,6 +159,125 @@ public class E2EServiceInstances { @PathParam("operationId") String operationId) {
return getE2EServiceInstances(serviceId, operationId);
}
+
+ /**
+ * GET Requests for Comparing model of service instance with target version
+ */
+
+ @GET
+ @Path("/{version:[vV][3-5]}/{serviceId}/modeldifferences")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId ", response = Response.class)
+ public Response compareModelwithTargetVersion(String request,
+ @PathParam("serviceId") String serviceId,
+ @PathParam("version") String version) {
+
+ instanceIdMap.put("serviceId", serviceId);
+
+ return compareModelwithTargetVersion(request, Action.compareModel, instanceIdMap, version);
+ }
+
+ private Response compareModelwithTargetVersion(String requestJSON, Action action,
+ HashMap<String, String> instanceIdMap, String version) {
+
+ String requestId = instanceIdMap.get("serviceId");
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
+
+ CompareModelsRequest e2eCompareModelReq = null;
+
+ MsoRequest msoRequest = new MsoRequest(requestId);
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ e2eCompareModelReq = mapper.readValue(requestJSON, CompareModelsRequest.class);
+
+ } catch (Exception e) {
+
+ msoLogger.debug("Mapping of request to JSON object failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
+ "Mapping of request to JSON object failed");
+ msoLogger.debug("End of the transaction, the final response is: " + response.getEntity().toString());
+
+ return response;
+ }
+
+ Response returnResp = runCompareModelBPMWorkflow(e2eCompareModelReq, msoRequest, requestJSON, requestId,
+ startTime, action);
+
+ return returnResp;
+
+ }
+
+ private Response runCompareModelBPMWorkflow(CompareModelsRequest e2eCompareModelReq, MsoRequest msoRequest,
+ String requestJSON, String requestId, long startTime, Action action) {
+
+ // Define RecipeLookupResult info here instead of query DB for efficiency
+ String workflowUrl = "/mso/async/services/CompareModelofE2EServiceInstance";
+ int recipeTimeout = 180;
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+
+ long subStartTime = System.currentTimeMillis();
+
+ try {
+ requestClient = RequestClientFactory.getRequestClient(workflowUrl, MsoPropertiesUtils.loadMsoProperties());
+
+ JSONObject jjo = new JSONObject(requestJSON);
+ String bpmnRequest = jjo.toString();
+
+ // Capture audit event
+ msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+ String serviceId = instanceIdMap.get("serviceId");
+ String serviceType = e2eCompareModelReq.getServiceType();
+ response = requestClient.post(requestId, false, recipeTimeout, action.name(), serviceId, null, null, null,
+ null, null, serviceType, null, null, null, bpmnRequest, null);
+
+ msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully received response from BPMN engine", "BPMN", workflowUrl, null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
+ workflowUrl, null);
+ Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL,
+ Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
+ "Exception while communicate with BPMN engine");
+ msoLogger.debug("End of the transaction, the final response is: " + resp.getEntity().toString());
+ return resp;
+ }
+
+ if (response == null) {
+ Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
+ "Null response from BPMN");
+ msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
+ return resp;
+ }
+
+ ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
+ int bpelStatus = respHandler.getStatus();
+ // String responseBody = respHandler.getResponseBody();
+ // CompareModelsResult modelDiffResponse = new CompareModelsResult();
+
+ return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action,
+ instanceIdMap);
+ }
private Response getE2EServiceInstances(String serviceId, String operationId) {
RequestsDatabase requestsDB = RequestsDatabase.getInstance();
@@ -814,8 +934,7 @@ public class E2EServiceInstances { // BPMN accepted the request, the request is in progress
if (bpelStatus == HttpStatus.SC_ACCEPTED) {
String camundaJSONResponseBody = respHandler.getResponseBody();
- msoLogger
- .debug("Received from Camunda: " + camundaJSONResponseBody);
+ msoLogger.debug("Received from Camunda: " + camundaJSONResponseBody);
// currently only for delete case we update the status here
if (action == Action.deleteInstance) {
@@ -834,6 +953,7 @@ public class E2EServiceInstances { + bpelStatus);
}
}
+
msoLogger.recordAuditEvent(startTime,
MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
"BPMN accepted the request, the request is in progress");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeansTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeansTest.java index 4bd88bed6a..aede3635f6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeansTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeansTest.java @@ -47,7 +47,7 @@ public class BeansTest { @Test public void pojoStructure() { test("org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans"); - test("org.openecomp.mso.apihandlerinfra.taskbeans"); + test("org.openecomp.mso.apihandlerinfra.tasksbeans"); } private void test(String pojoPackage) { @@ -453,12 +453,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.10.19</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.jmockit</groupId> <artifactId>jmockit</artifactId> <version>1.19</version> @@ -585,6 +579,12 @@ <version>1.2.13</version> <scope>compile</scope> </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>1.10.19</version> + <scope>test</scope> + </dependency> </dependencies> </dependencyManagement> </project> |