diff options
101 files changed, 1962 insertions, 1097 deletions
@@ -98,9 +98,25 @@ committers: company: 'China Mobile' id: 'wangchengli' timezone: 'China/Beijing' + - name: 'Marcus Williams' + email: 'marcus.williams@intel.com' + company: 'Intel' + id: 'mgkwill' + timezone: 'America/Los Angeles' + - name: 'Sanchita Pathak' + email: 'sanchita@techmahindra.com' + company: 'Tech Mahindra' + id: 'sanchitap' + timezone: 'Asia/Kolkata' tsc: approval: 'https://lists.onap.org/pipermail/onap-tsc' changes: - type: 'removal' name: 'Tal Liron' - link: 'https://lists.onap.org/pipermail/onap-tsc/2018-February/004361.html' + name: 'Heliu Zhong' + name: 'Yuanwei Yang' + link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html' + - type: 'addition' + name: 'Marcus Williams' + name: 'Sanchita Pathak' + link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html' diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java index 6bec917d9d..1f3c43c79e 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java @@ -571,7 +571,8 @@ public class MsoKeystoneUtils extends MsoTenantUtils { } public boolean isExpired () { - return expires == null || System.currentTimeMillis() > expires.getTimeInMillis(); + // adding arbitrary guard timer of 5 minutes + return expires == null || System.currentTimeMillis() > (expires.getTimeInMillis() - 300000); } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java index a8969dd45d..9215c38706 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java @@ -80,8 +80,9 @@ public class QueryVfModule extends CatalogQuery { } @Override - public String JSON2(boolean isArray, boolean x) { + public String JSON2(boolean isArray, boolean isEmbed) { StringBuilder sb = new StringBuilder(); + if (!isEmbed && isArray) sb.append("{ "); if (isArray) sb.append("\"vfModules\": ["); Map<String, String> valueMap = new HashMap<>(); String sep = ""; @@ -112,6 +113,7 @@ public class QueryVfModule extends CatalogQuery { } if (!first) sb.append("\n"); if (isArray) sb.append("]"); + if (!isEmbed && isArray) sb.append("}"); return sb.toString(); } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java deleted file mode 100644 index 001a9f496a..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 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.adapters.catalogdb.catalogrest; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.db.catalog.beans.VfModule; -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@XmlRootElement(name = "vfModules") -public class QueryVfModules { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private List<VfModule> vfModules; - - public QueryVfModules() { - super(); - vfModules = new ArrayList<>(); - } - public QueryVfModules(List<VfModule> vlist) { - LOGGER.debug ("QueryVfModules:"); - vfModules = new ArrayList<>(); - for (VfModule o : vlist) { - LOGGER.debug ("-- o is a vfModules ----"); - LOGGER.debug (o.toString()); - vfModules.add(o); - LOGGER.debug ("-------------------"); - } - } - - public List<VfModule> getVfModules(){ return this.vfModules; } - - public void setVfModules(List<VfModule> v) { this.vfModules = v; } - - @Override - public String toString () { - StringBuilder sb = new StringBuilder(); - - boolean first = true; - int i = 1; - for (VfModule o : vfModules) { - sb.append(i).append("\t"); - if (!first) sb.append("\n"); - first = false; - sb.append(o); - } - return sb.toString(); - } - - public String toJsonString() { - String jsonString = null; - try { - ObjectMapper mapper = new ObjectMapper(); - jsonString = mapper.writeValueAsString(this); - LOGGER.debug ("QueryVfModules jsonString: "+jsonString); - } - catch (Exception e) { - LOGGER.debug ("Exception:", e); - LOGGER.debug ("QueryVfModules jsonString exception:"+e.getMessage()); - } - return jsonString; - } -} diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java index ee2c8db577..a4a5df7536 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.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. @@ -20,93 +20,136 @@ package org.openecomp.mso.adapters.catalogdb.catalogrest; -import java.io.StringReader; -import java.util.ArrayList; +import static org.assertj.core.api.Assertions.assertThat; + import java.util.HashMap; -import java.util.List; import java.util.Map; +import org.junit.Before; +import org.junit.Test; -import javax.json.Json; -import javax.json.JsonArray; -import javax.json.JsonObject; -import javax.json.JsonReader; +public class CatalogQueryTest { + private static final String MAP_KEY = "keyTest"; + private static final String VALUE_MAP = "valueTest"; + private CatalogQuery testedObject; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; -import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; + @Before + public void init() { + testedObject = new CatalogQueryForTesting(); + } -import static org.junit.Assert.*; + @Test + public void putStringValueToMap() { + Map<String, String> valueMap = new HashMap<>(); + testedObject.put(valueMap, MAP_KEY, VALUE_MAP); + assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "\"valueTest\""); + } + @Test + public void putNullStringValueToMap() { + Map<String, String> valueMap = new HashMap<>(); + String value = null; + testedObject.put(valueMap, MAP_KEY, value); + assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "null"); + } -@RunWith(MockitoJUnitRunner.class) -public class CatalogQueryTest { + @Test + public void putIntegerValueToMap() { + Map<String, String> valueMap = new HashMap<>(); + testedObject.put(valueMap, MAP_KEY, 1); + assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "1"); + } + + @Test + public void putNullIntegerValueToMap() { + Map<String, String> valueMap = new HashMap<>(); + Integer value = null; + testedObject.put(valueMap, MAP_KEY, value); + assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "null"); + } + + @Test + public void putTrueBooleanValueToMap() { + Map<String, String> valueMap = new HashMap<>(); + testedObject.put(valueMap, MAP_KEY, true); + assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "true"); + } + + @Test + public void putFalseBooleanValueToMap() { + Map<String, String> valueMap = new HashMap<>(); + testedObject.put(valueMap, MAP_KEY, false); + assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "false"); + } + + @Test + public void putNullBooleanValueToMap() { + Map<String, String> valueMap = new HashMap<>(); + Boolean value = null; + testedObject.put(valueMap, MAP_KEY, value); + assertThat(valueMap).hasSize(1).containsEntry(MAP_KEY, "null"); + } - @Test - public void catalogQuerySetTemplateImpl_Test(){ - CatalogQuery mockCatalogQuery = Mockito.mock(CatalogQuery.class); - Mockito.doCallRealMethod().when(mockCatalogQuery).setTemplate(Mockito.anyString(), Mockito.anyMapOf(String.class, String.class)); - - Map<String,String> valueMap = new HashMap<>(); - valueMap.put("somekey", "somevalue"); - - String ret = mockCatalogQuery.setTemplate("<somekey>", valueMap); - - assertTrue(ret.equalsIgnoreCase("somevalue")); - } - + public void setTemplate_keyFindInMap() { + Map<String, String> valueMap = new HashMap<>(); + valueMap.put(MAP_KEY, VALUE_MAP); + String template = "<keyTest>"; + String result = testedObject.setTemplate(template, valueMap); + assertThat(result).isEqualTo(VALUE_MAP); + } + + @Test + public void setTemplate_keyNotFindInMap() { + Map<String, String> valueMap = new HashMap<>(); + String template = "<keyTest>"; + String result = testedObject.setTemplate(template, valueMap); + assertThat(result).isEqualTo("\"TBD\""); + } + + @Test + public void setTemplate_templateDoesNotMatch() { + Map<String, String> valueMap = new HashMap<>(); + String template = "key"; + String result = testedObject.setTemplate(template, valueMap); + assertThat(result).isEqualTo("key"); + } + + @Test + public void smartToJson(){ + String expectedResult = "{\"s\":\"s1\"}"; + assertThat(testedObject.smartToJSON()).isEqualTo(expectedResult); + } + + @Test + public void toJsonString_withVersion1() { + String expectedResult = "{\"s\":\"s1\"}"; + assertThat(testedObject.toJsonString("v1",true)).isEqualTo(expectedResult); + } + @Test - public void smartToJson_Test() - { - List<VnfResourceCustomization> paramList = new ArrayList<>(); - VnfResourceCustomization d1 = new VnfResourceCustomization(); - d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"); - d1.setModelInstanceName("RG_6-26_mog11 0"); - d1.setVersion("v1"); - paramList.add(d1); - - QueryServiceVnfs qryResp = new QueryServiceVnfs(paramList); - QueryServiceVnfs mockCatalogQuery = Mockito.spy(qryResp); - Mockito.doCallRealMethod().when(mockCatalogQuery).smartToJSON(); - String ret = qryResp.smartToJSON(); - // System.out.println(ret); - - JsonReader reader = Json.createReader(new StringReader(ret.replaceAll("\r?\n", ""))); - JsonObject respObj = reader.readObject(); - reader.close(); - JsonArray jArray = respObj.getJsonArray("serviceVnfs"); - assertEquals(jArray.size(), 1); - assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391"); - } - + public void toJsonString_withVersion2() { + assertThat(testedObject.toJsonString("v2",true)).isEqualTo("json2"); + } + @Test - public void toJsonString_Test() - { - CatalogQueryExtendedTest mockCatalogQuery = Mockito.mock(CatalogQueryExtendedTest.class); - Mockito.doCallRealMethod().when(mockCatalogQuery).JSON2(Mockito.anyBoolean(), Mockito.anyBoolean()); - String ret = mockCatalogQuery.JSON2(true, true); - - // System.out.println(ret); - - JsonReader reader = Json.createReader(new StringReader(ret.replaceAll("\r?\n", ""))); - JsonObject respObj = reader.readObject(); - reader.close(); - JsonArray jArray = respObj.getJsonArray("serviceVnfs"); - assertEquals(jArray.size(), 1); - assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391"); - assertEquals(jArray.getJsonObject(0).getString("version"), "v2"); - } - - class CatalogQueryExtendedTest extends CatalogQuery{ + public void toJsonString_withInvalidVersion() { + assertThat(testedObject.toJsonString("ver77",true)).isEqualTo("invalid version: ver77"); + } + + private class CatalogQueryForTesting extends CatalogQuery { + + private String s = "s1"; + + public String getS() { + return s; + } + @Override public String JSON2(boolean isArray, boolean isEmbed) { - return "{\"serviceVnfs\":[{\"version\":\"v2\",\"modelCustomizationUuid\":\"16ea3e56-a8ce-4ad7-8edd-4d2eae095391\",\"modelInstanceName\":\"ciVFOnboarded-FNAT-aab06c41 1\",\"created\":null,\"vnfResourceModelUuid\":null,\"vnfResourceModelUUID\":null,\"minInstances\":null,\"maxInstances\":null,\"availabilityZoneMaxCount\":null,\"vnfResource\":null,\"nfFunction\":null,\"nfType\":null,\"nfRole\":null,\"nfNamingCode\":null,\"multiStageDesign\":null,\"vfModuleCustomizations\":null,\"serviceResourceCustomizations\":null,\"creationTimestamp\":null}]}"; + return "json2"; } - - } - + } + } diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java new file mode 100644 index 0000000000..fa1a1fc94e --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.adapters.catalogdb.catalogrest; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.Recipe; +import org.openecomp.mso.jsonpath.JsonPathUtil; + +public class QueryResourceRecipeTest { + + private static final int RECIPE_ID = 123; + private static final String RECIPE_ACTION = "actionTest"; + private static final String RECIPE_URI = "uriTest"; + private static final int RECIPE_TIMEOUT = 100; + private static final String RECIPE_PARAMS_XSD = "paramsXsdTest"; + private static final String RECIPE_DESCRIPTION = "descrTest"; + + private QueryResourceRecipe testedObject; + + @Before + public void init() { + testedObject = new QueryResourceRecipe(createRecipe()); + } + + @Test + public void convertingToJsonSuccessful() { + String jsonResult = testedObject.JSON2(true, true); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.id")).contains(String.valueOf(RECIPE_ID)); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.action")).contains(RECIPE_ACTION); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.orchestrationUri")).contains(RECIPE_URI); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.recipeTimeout")) + .contains(String.valueOf(RECIPE_TIMEOUT)); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.paramXSD")).contains(RECIPE_PARAMS_XSD); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.description")).contains(RECIPE_DESCRIPTION); + } + + @Test + public void toString_properContent() { + assertThat(testedObject.toString()).contains("RECIPE: actionTest,uri=uriTest"); + } + + private Recipe createRecipe() { + Recipe recipe = new Recipe(); + recipe.setId(RECIPE_ID); + recipe.setAction(RECIPE_ACTION); + recipe.setOrchestrationUri(RECIPE_URI); + recipe.setRecipeTimeout(RECIPE_TIMEOUT); + recipe.setParamXSD(RECIPE_PARAMS_XSD); + recipe.setDescription(RECIPE_DESCRIPTION); + return recipe; + } + +} diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java new file mode 100644 index 0000000000..e9c947d50e --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.adapters.catalogdb.catalogrest; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.ToscaCsar; +import org.openecomp.mso.jsonpath.JsonPathUtil; + +public class QueryServiceCsarTest { + + private static final String TOSCA_ARTIFACT_UUID = "artUuidTest"; + private static final String TOSCA_NAME = "toscaNameTest"; + private static final String TOSCA_VERSION = "v12"; + private static final String TOSCA_ARTIFACT_CHECKSUM = "tosArtCheck"; + private static final String TOSCA_URL = "tosUrl"; + private static final String TOSCA_DESCRIPTION = "toscaDescr"; + + private QueryServiceCsar testedObject; + + @Before + public void init() { + testedObject = new QueryServiceCsar(createToscaCsar()); + } + + @Test + public void convertToJson_successful() { + String jsonResult = testedObject.JSON2(true, true); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.artifactUUID")).contains(TOSCA_ARTIFACT_UUID); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.name")).contains(TOSCA_NAME); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.version")).contains(TOSCA_VERSION); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.artifactChecksum")) + .contains(String.valueOf(TOSCA_ARTIFACT_CHECKSUM)); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.url")).contains(TOSCA_URL); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.description")).contains(TOSCA_DESCRIPTION); + } + + @Test + public void toString_properContent() { + assertThat(testedObject.toString()).contains( + "TOSCACSAR: artifactUUID=artUuidTest,name=toscaNameTest,version=v12,description=toscaDescr,artifactChecksum=tosArtCheck,url=tosUrl"); + } + + private ToscaCsar createToscaCsar() { + ToscaCsar toscaCsar = new ToscaCsar(); + toscaCsar.setArtifactUUID(TOSCA_ARTIFACT_UUID); + toscaCsar.setName(TOSCA_NAME); + toscaCsar.setVersion(TOSCA_VERSION); + toscaCsar.setArtifactChecksum(TOSCA_ARTIFACT_CHECKSUM); + toscaCsar.setUrl(TOSCA_URL); + toscaCsar.setDescription(TOSCA_DESCRIPTION); + return toscaCsar; + } + +} diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModuleTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModuleTest.java new file mode 100644 index 0000000000..b00b5b7ca8 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModuleTest.java @@ -0,0 +1,96 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.adapters.catalogdb.catalogrest; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; +import java.util.List; +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; +import org.openecomp.mso.jsonpath.JsonPathUtil; + +public class QueryVfModuleTest { + + private static final String VF_MODULE_MODEL_NAME = "vfModelNameTest"; + private static final String VF_MODEL_UUID = "vfModelUuidTest"; + private static final String VF_MODULE_INVARIANT_UUID = "vfModuleInvUuid"; + private static final String VF_MODULE_VERSION = "vfModuleVerTest"; + + private static final String VF_MODEL_CUSTOMIZATION_UUID = "modelCustomizationUuid"; + private static final String VF_MODEL_CUSTOMIZATION_LABEL = "modelCustomizationLabel"; + private static final int VF_MODEL_CUSTOMIZATION_INITIAL_COUNT = 1; + + @Test + public void convertToJson_successful() { + QueryVfModule testedObject = new QueryVfModule(createList()); + String jsonResult = testedObject.JSON2(true, false); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].modelInfo.modelName")) + .contains(VF_MODULE_MODEL_NAME); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].modelInfo.modelUuid")) + .contains(VF_MODEL_UUID); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].modelInfo.modelInvariantUuid")) + .contains(VF_MODULE_INVARIANT_UUID); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].isBase")) + .contains("true"); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].vfModuleLabel")) + .contains(VF_MODEL_CUSTOMIZATION_LABEL); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].initialCount")) + .contains(String.valueOf(VF_MODEL_CUSTOMIZATION_INITIAL_COUNT)); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].hasVolumeGroup")) + .contains("false"); + } + + @Test + public void convertToJson_successful_hasVolumeGroupIsTrue() { + QueryVfModule testedObject = new QueryVfModule(createListWithHeatEnvironmentArtifactUuid()); + String jsonResult = testedObject.JSON2(true, false); + assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].hasVolumeGroup")) + .contains("true"); + } + + private List<VfModuleCustomization> createList() { + List<VfModuleCustomization> list = new ArrayList<>(); + + VfModule vfModule = new VfModule(); + vfModule.setModelName(VF_MODULE_MODEL_NAME); + vfModule.setModelUUID(VF_MODEL_UUID); + vfModule.setModelInvariantUuid(VF_MODULE_INVARIANT_UUID); + vfModule.setVersion(VF_MODULE_VERSION); + vfModule.setIsBase(1); + + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setVfModule(vfModule); + vfModuleCustomization.setModelCustomizationUuid(VF_MODEL_CUSTOMIZATION_UUID); + vfModuleCustomization.setLabel(VF_MODEL_CUSTOMIZATION_LABEL); + vfModuleCustomization.setInitialCount(VF_MODEL_CUSTOMIZATION_INITIAL_COUNT); + list.add(vfModuleCustomization); + return list; + } + + private List<VfModuleCustomization> createListWithHeatEnvironmentArtifactUuid() { + List<VfModuleCustomization> list = createList(); + list.get(0).setHeatEnvironmentArtifactUuid("heatEnvTest"); + return list; + } + +} diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfPluginAdapterImpl.java index 0b9ffd9468..4e0d51432e 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -58,7 +58,6 @@ import org.openecomp.mso.adapters.vdu.VduStatus; import org.openecomp.mso.adapters.vdu.mapper.VfModuleCustomizationToVduMapper; import org.openecomp.mso.adapters.vnf.exceptions.VnfAlreadyExists; import org.openecomp.mso.adapters.vnf.exceptions.VnfException; -import org.openecomp.mso.cloud.CloudConfig; import org.openecomp.mso.cloud.CloudConfigFactory; import org.openecomp.mso.cloud.CloudSite; import org.openecomp.mso.cloudify.utils.MsoCloudifyUtils; @@ -92,7 +91,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { CloudConfigFactory cloudConfigFactory = new CloudConfigFactory(); - protected CloudConfig cloudConfig = cloudConfigFactory.getCloudConfig(); protected MsoHeatUtils heatUtils; protected VfModuleCustomizationToVduMapper vduMapper; protected MsoCloudifyUtils cloudifyUtils; @@ -694,7 +692,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Perform a version check against cloudSite // Obtain the cloud site information where we will create the VF Module - Optional<CloudSite> cloudSite = cloudConfig.getCloudSite (cloudSiteId); + Optional<CloudSite> cloudSite = cloudConfigFactory.getCloudConfig().getCloudSite (cloudSiteId); if (!cloudSite.isPresent()) { throw new VnfException (new MsoCloudSiteNotFound (cloudSiteId)); } @@ -1223,7 +1221,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { * but we don't currently have access to that in Query and Delete cases. */ private VduPlugin getVduPlugin (String cloudSiteId) { - Optional<CloudSite> cloudSite = cloudConfig.getCloudSite(cloudSiteId); + Optional<CloudSite> cloudSite = cloudConfigFactory.getCloudConfig().getCloudSite(cloudSiteId); if (cloudSite.isPresent()) { String orchestrator = cloudSite.get().getOrchestrator(); diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java index fc4e522877..9d986d9df7 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java @@ -596,23 +596,34 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller { List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
- if(allottedResourceList != null){
-
- for(NodeTemplate allottedNode : allottedResourceList){
-
- createAllottedResource(allottedNode, toscaResourceStruct);
-
- catalogDB.saveAllottedResource(toscaResourceStruct.getAllottedResource());
-
- catalogDB.saveAllottedResourceCustomization(toscaResourceStruct.getCatalogAllottedResourceCustomization());
-
- catalogDB.saveServiceToResourceCustomization(toscaResourceStruct.getCatalogAllottedServiceToResourceCustomization());
-
- }
- }
-
+ if(allottedResourceList != null){
+
+ for(NodeTemplate allottedNode : allottedResourceList){
+
+ createAllottedResource(allottedNode, toscaResourceStruct);
+
+ catalogDB.saveAllottedResource(toscaResourceStruct.getAllottedResource());
+
+ catalogDB.saveAllottedResourceCustomization(toscaResourceStruct.getCatalogAllottedResourceCustomization());
+
+ catalogDB.saveServiceToResourceCustomization(toscaResourceStruct.getCatalogAllottedServiceToResourceCustomization());
+
+ }
+ }
+
+ // handle VF resource
+ List<NodeTemplate> serviceVfList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
+ if (serviceVfList != null) {
+ for (NodeTemplate vfNode : serviceVfList) {
+ createVnfResource(vfNode, toscaResourceStruct);
+ catalogDB.saveVnfResource(toscaResourceStruct.getCatalogVnfResource());
+ catalogDB.saveVnfResourceCustomization(toscaResourceStruct.getCatalogVnfResourceCustomization());
+ catalogDB.saveServiceToResourceCustomization(toscaResourceStruct.getCatalogVfServiceToResourceCustomization());
+ }
+ }
+
- List<NodeTemplate> nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper().getServiceVlList();
+ List<NodeTemplate> nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper().getServiceVlList();
if(nodeTemplatesVLList != null){
@@ -1104,6 +1115,8 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller { vnfResource.setToscaNodeType(testNull(vfNodeTemplate.getType()));
vnfResource.setAicVersionMax(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
vnfResource.setAicVersionMin(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ vnfResource.setCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ vnfResource.setSubCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
//vnfResource.setHeatTemplateArtifactUUId(toscaResourceStructure.getHeatTemplateUUID());
// vfNodeTemplate.getProperties()
diff --git a/asdc-controller/src/main/resources/resource-examples/resource_Extvl.csar b/asdc-controller/src/main/resources/resource-examples/resource_Extvl.csar Binary files differindex 7976e51d14..bd35b0ab60 100644 --- a/asdc-controller/src/main/resources/resource-examples/resource_Extvl.csar +++ b/asdc-controller/src/main/resources/resource-examples/resource_Extvl.csar diff --git a/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-csar-0904-2.csar b/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-csar-0904-2.csar Binary files differindex fc21af334d..29d30f8023 100644 --- a/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-csar-0904-2.csar +++ b/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-csar-0904-2.csar diff --git a/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-with-allotted.csar b/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-with-allotted.csar Binary files differindex 41ee2c7ce3..f2b95350b0 100644 --- a/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-with-allotted.csar +++ b/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-with-allotted.csar diff --git a/asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar b/asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar Binary files differindex 288498e841..beb4ddba46 100644 --- a/asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar +++ b/asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy index 88ed9fb330..1233d0423b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy @@ -294,8 +294,8 @@ class SNIROUtils{ if(isBlank(response)){
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Sniro Async Callback Response is Empty")
}else{
- if(JsonUtils.jsonElementExist(response, "solutionInfo.placementInfo")){
- placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo")
+ if(JsonUtils.jsonElementExist(response, "solutionInfo.placement")){
+ placements = jsonUtil.getJsonValue(response, "solutionInfo.placement")
if(isBlank(placements) || placements.equalsIgnoreCase("[]")){
String statusMessage = jsonUtil.getJsonValue(response, "statusMessage")
if(isBlank(statusMessage)){
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy index 3f534377d8..0fdd790137 100755 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy @@ -182,7 +182,7 @@ class SniroHoming extends AbstractServiceTaskProcessor { utils.logAudit("Sniro Async Callback Response is: " + response) sniroUtils.validateCallbackResponse(execution, response) - String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo") + String placements = jsonUtil.getJsonValue(response, "solutionInfo.placement") ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java index bee476526c..e6b1b2143f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java @@ -94,7 +94,11 @@ public class ResourceRequestBuilder { resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); } } - Map<String, Object> serviceInput =getJsonObject((String)JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class); + Map<String, Object> serviceInput = null; + if (JsonUtils.getJsonValue(serviceParameters, "requestInputs") != null) { + serviceInput = getJsonObject((String)JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class); + } + Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); if (serviceInput == null) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java index db11db59f7..b4543b1445 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -109,13 +109,13 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { msoLogger.debug(logMarker + "Exception in startProcessInstance by key");
WorkflowResponse response = new WorkflowResponse();
response.setMessage("Fail" );
- response.setResponse("Error occurred while executing the process: " + e);
+ response.setContent("Error occurred while executing the process: " + e);
response.setMessageCode(500);
recordEvents(processKey, response, startTime);
msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logMarker
+ response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse());
+ + processKey + " with content: " + response.getContent());
Response errorResponse = Response.serverError().entity(response).build();
asyncResponse.setResponse(errorResponse);
@@ -245,10 +245,10 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
logMarker + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+ + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + response.getMessage() + "for processKey: " + processKey + " with response: " + response.getResponse());
+ logMarker + response.getMessage() + "for processKey: " + processKey + " with content: " + response.getContent());
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java index 731b18db36..4dfae8b2a3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java @@ -108,15 +108,15 @@ public class WorkflowContextHolder { + ":process key:" + processKey); workflowResponse.setMessage("Fail"); workflowResponse.setMessageCode(400); - workflowResponse.setResponse("Unable to correlate workflow context, bad request. Request Id: " + requestId); + workflowResponse.setContent("Unable to correlate workflow context, bad request. Request Id: " + requestId); return Response.serverError().entity(workflowResponse).build(); } responseQueue.remove(workflowContext); msoLogger.debug("Using callback response for request id: " + requestId); - workflowResponse.setResponse(callbackResponse.getResponse()); - workflowResponse.setProcessInstanceID(processInstanceId); + workflowResponse.setContent(callbackResponse.getResponse()); + workflowResponse.setProcessInstanceId(processInstanceId); workflowResponse.setMessageCode(callbackResponse.getStatusCode()); workflowResponse.setMessage(callbackResponse.getMessage()); sendWorkflowResponseToClient(processKey, workflowContext, workflowResponse); @@ -152,7 +152,7 @@ public class WorkflowContextHolder { msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId()); WorkflowResponse response = new WorkflowResponse(); response.setMessage("Fail"); - response.setResponse("Request timedout, request id:" + requestObject.getRequestId()); + response.setContent("Request timedout, request id:" + requestObject.getRequestId()); //response.setProcessInstanceID(requestObject.getProcessInstance().getProcessInstanceId()); recordEvents(requestObject.getProcessKey(), response, requestObject.getStartTime()); response.setMessageCode(500); @@ -178,11 +178,11 @@ public class WorkflowContextHolder { msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker + response.getMessage() + " for processKey: " - + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); + + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null); msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker + response.getMessage() + " for processKey: " - + processKey + " with response: " + response.getResponse()); + + processKey + " with content: " + response.getContent()); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java index dd100a3824..25c67fed63 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java @@ -135,7 +135,7 @@ public class WorkflowResource extends ProcessEngineAwareService { }
String processInstanceId = processInstance.getId();
- workflowResponse.setProcessInstanceID(processInstanceId);
+ workflowResponse.setProcessInstanceId(processInstanceId);
responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
@@ -172,23 +172,23 @@ public class WorkflowResource extends ProcessEngineAwareService { workflowResponse.setMessage("Fail");
if (endedWithNoResponse) {
- workflowResponse.setResponse("Process ended without producing a response");
+ workflowResponse.setContent("Process ended without producing a response");
} else {
- workflowResponse.setResponse("Request timed out, process state: " + state);
+ workflowResponse.setContent("Request timed out, process state: " + state);
}
- workflowResponse.setProcessInstanceID(processInstanceId);
+ workflowResponse.setProcessInstanceId(processInstanceId);
recordEvents(processKey, workflowResponse, startTime);
workflowResponse.setMessageCode(500);
return Response.status(500).entity(workflowResponse).build();
} catch (Exception ex) {
msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex);
workflowResponse.setMessage("Fail" );
- workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage());
- if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId());
+ workflowResponse.setContent("Error occurred while executing the process: " + ex.getMessage());
+ if (processInstance != null) workflowResponse.setProcessInstanceId(processInstance.getId());
msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey),
MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage()
- + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse());
+ + " for processKey: " + processKey + " with content: " + workflowResponse.getContent());
workflowResponse.setMessageCode(500);
recordEvents(processKey, workflowResponse, startTime);
@@ -221,11 +221,11 @@ public class WorkflowResource extends ProcessEngineAwareService { msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+ + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse());
+ + processKey + " with content: " + response.getContent());
}
private void setLogContext(String processKey, Map<String, Object> inputVariables) {
@@ -262,13 +262,13 @@ public class WorkflowResource extends ProcessEngineAwareService { private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> responseMap) {
Object object = responseMap.get("Response");
- String response = object == null ? null : String.valueOf(object);
- if(response == null){
+ String content = object == null ? null : String.valueOf(object);
+ if (content == null){
object = responseMap.get("WorkflowResponse");
- response = object == null ? null : String.valueOf(object);
+ content = object == null ? null : String.valueOf(object);
}
- workflowResponse.setResponse(response);
+ workflowResponse.setContent(content);
object = responseMap.get("ResponseCode");
String responseCode = object == null ? null : String.valueOf(object);
@@ -584,31 +584,31 @@ public class WorkflowResource extends ProcessEngineAwareService { response.setVariables(variablesMap);
response.setMessage("Success");
- response.setResponse("Successfully retrieved the variables");
- response.setProcessInstanceID(processInstanceId);
+ response.setContent("Successfully retrieved the variables");
+ response.setProcessInstanceId(processInstanceId);
- msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse());
+ msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with content: " + response.getContent());
} catch (Exception ex) {
response.setMessage("Fail");
- response.setResponse("Failed to retrieve the variables," + ex.getMessage());
- response.setProcessInstanceID(processInstanceId);
+ response.setContent("Failed to retrieve the variables," + ex.getMessage());
+ response.setProcessInstanceId(processInstanceId);
msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER
+ response.getMessage()
+ " for processKey: "
+ processKey
- + " with response: "
- + response.getResponse());
+ + " with content: "
+ + response.getContent());
msoLogger.debug("Exception :",ex);
}
msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+ + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse());
+ + processKey + " with content: " + response.getContent());
return response;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java index e0382d1bda..02702e3b3c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java @@ -22,48 +22,76 @@ package org.openecomp.mso.bpmn.common.workflow.service; import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
/**
- * @version 1.0
- * Synchronous workflow response bean
- *
+ * A synchronous response from a workflow.
*/
public class WorkflowResponse {
- private String response;
- private String message;
- private String processInstanceID;
- private Map<String,String> variables;
+ @JsonProperty("processInstanceId")
+ private String processInstanceId;
+
+ @JsonProperty("messageCode")
private int messageCode;
+
+ @JsonProperty("message")
+ private String message;
- public String getResponse() {
- return response;
+ @JsonProperty("variables")
+ private Map<String,String> variables;
+
+ @JsonProperty("content")
+ private String content;
+
+ public String getProcessInstanceId() {
+ return processInstanceId;
}
- public void setResponse(String response) {
- this.response = response;
+
+ public void setProcessInstanceId(String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ }
+
+ public int getMessageCode() {
+ return messageCode;
}
+
+ public void setMessageCode(int messageCode) {
+ this.messageCode = messageCode;
+ }
+
public String getMessage() {
return message;
}
+
public void setMessage(String message) {
this.message = message;
}
- public String getProcessInstanceID() {
- return processInstanceID;
- }
- public void setProcessInstanceID(String pID) {
- this.processInstanceID = pID;
- }
- public Map<String, String> getVariables() {
+
+ public Map<String,String> getVariables() {
return variables;
}
- public void setVariables(Map<String, String> variables) {
+
+ public void setVariables(Map<String,String> variables) {
this.variables = variables;
}
- public void setMessageCode(int messageCode) {
- this.messageCode = messageCode;
+
+ public String getContent() {
+ return content;
}
-
- public int getMessageCode() {
- return messageCode;
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "["
+ + "processInstanceId=" + processInstanceId
+ + ",messageCode=" + messageCode
+ + ",message=" + message
+ + ",variables=" + variables
+ + ",content=" + content
+ + "]";
}
-}
+}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java index 9d4dac2333..bf69223b52 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java @@ -46,7 +46,7 @@ public class CompleteMsoProcessTest extends WorkflowTest { variables.put("CompleteMsoProcessRequest",inputRequestFile);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CompleteMsoProcess", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
logEnd();
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java index 457128f104..13c400e71e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java @@ -50,7 +50,7 @@ public class ConfirmVolumeGroupTenantTest extends WorkflowTest { setVariables(variables); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch"); String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch"); @@ -70,7 +70,7 @@ public class ConfirmVolumeGroupTenantTest extends WorkflowTest { setVariables(variables); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch"); String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch"); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java index 257cec9b11..c3259a0de5 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java @@ -62,7 +62,7 @@ public class FalloutHandlerTest extends WorkflowTest { variables.put("FalloutHandlerRequest",inputRequestFile);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "FalloutHandler", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
System.out.println("ENDED TEST: " + method);
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java index 125a9ad916..67ac34c1d0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java @@ -54,7 +54,7 @@ public class GenericDeleteServiceTest extends WorkflowTest { Map<String, String> variables = new HashMap<>(); setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); @@ -74,7 +74,7 @@ public class GenericDeleteServiceTest extends WorkflowTest { setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); @@ -98,7 +98,7 @@ public class GenericDeleteServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); @@ -122,7 +122,7 @@ public class GenericDeleteServiceTest extends WorkflowTest { setVariablesSubscription(variables, null, "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); @@ -146,7 +146,7 @@ public class GenericDeleteServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); @@ -168,7 +168,7 @@ public class GenericDeleteServiceTest extends WorkflowTest { setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", ""); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); @@ -193,7 +193,7 @@ public class GenericDeleteServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); @@ -214,7 +214,7 @@ public class GenericDeleteServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "1234"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); @@ -240,7 +240,7 @@ public class GenericDeleteServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java index add9a32d61..a318be5b10 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java @@ -55,7 +55,7 @@ public class GenericDeleteVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables("true", "true", "true", null); @@ -70,7 +70,7 @@ public class GenericDeleteVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "vce", "testReVer123"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables("true", "true", "true", null); @@ -87,7 +87,7 @@ public class GenericDeleteVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "generic-vnf", ""); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables("true", "true", "false", null); @@ -103,7 +103,7 @@ public class GenericDeleteVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "vce", null); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables("true", "true", "false", null); @@ -118,7 +118,7 @@ public class GenericDeleteVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables("true", "false", "true", null); @@ -133,7 +133,7 @@ public class GenericDeleteVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "vce", "testReVer123"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables("true", "false", "true", null); @@ -148,7 +148,7 @@ public class GenericDeleteVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "generic-vnf", ""); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables("true", "false", "false", null); @@ -162,7 +162,7 @@ public class GenericDeleteVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "", "testReVer123"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]"); @@ -177,7 +177,7 @@ public class GenericDeleteVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Received a bad response from AAI]"); @@ -192,7 +192,7 @@ public class GenericDeleteVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=412,errorMessage=Delete Vnf Received a resource-version Mismatch Error Response from AAI]"); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java index 0198395750..6da6924d11 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java @@ -59,7 +59,7 @@ public class GenericGetServiceTest extends WorkflowTest { Map<String, String> variables = new HashMap<>();
setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
@@ -85,7 +85,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET");
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -113,7 +113,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, null, "1604-MVM-26", null, null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -143,7 +143,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -172,7 +172,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -196,7 +196,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26");
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -223,7 +223,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, "", "1604-MVM-26", null, null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -250,7 +250,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -277,7 +277,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -301,7 +301,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, "", "1604-MVM-26", null, null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -328,7 +328,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -354,7 +354,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -379,7 +379,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -407,7 +407,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789");
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -434,7 +434,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -463,7 +463,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, null, "1604-MVM-26", null, null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -493,7 +493,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, null, "1604-MVM-26", "XyCorporation", null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
@@ -521,7 +521,7 @@ public class GenericGetServiceTest extends WorkflowTest { setVariablesInstance(variables, null, "1604-MVM-26", "CorporationNotPresent", null);
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java index 4922263744..7de493a621 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java @@ -56,7 +56,7 @@ public class GenericGetVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); @@ -83,7 +83,7 @@ public class GenericGetVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "testVnfName123", "vce"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); @@ -110,7 +110,7 @@ public class GenericGetVnfTest extends WorkflowTest { setVariables(variables, "", "testVnfName123", "generic-vnf"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); @@ -137,7 +137,7 @@ public class GenericGetVnfTest extends WorkflowTest { setVariables(variables, null, "testVnfName123", "vce"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); @@ -166,7 +166,7 @@ public class GenericGetVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java index 0e0a237090..7c003c986a 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java @@ -55,7 +55,7 @@ public class GenericPutVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); @@ -75,7 +75,7 @@ public class GenericPutVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", vcePayload, "vce"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); @@ -95,7 +95,7 @@ public class GenericPutVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", genericVnfPayload, ""); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); @@ -117,7 +117,7 @@ public class GenericPutVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", genericVnfPayload, ""); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); @@ -137,7 +137,7 @@ public class GenericPutVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); @@ -158,7 +158,7 @@ public class GenericPutVnfTest extends WorkflowTest { setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java index 0349b178cb..02e029de46 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java @@ -95,7 +95,7 @@ public class SDNCAdapterV1Test extends WorkflowTest { Response response = workflowResource.startProcessInstanceByKey("sdncAdapter", varMap);
WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
- //String pid = workflowResponse.getProcessInstanceID();
+ //String pid = workflowResponse.getProcessInstanceId();
//System.out.println("Back from executing process instance with pid=" + pid);
return workflowResponse;
}
@@ -364,7 +364,7 @@ public class SDNCAdapterV1Test extends WorkflowTest { WorkflowResponse response = thread.workflowResponse;
Assert.assertNotNull(response);
Assert.assertEquals("404 error", response.getMessageCode(),7000);
-// assertProcessInstanceFinished(response.getProcessInstanceID());
+// assertProcessInstanceFinished(response.getProcessInstanceId());
//System.out.println("SDNCAdapter bad synchronous response flow Completed!");
}
@@ -442,7 +442,7 @@ public class SDNCAdapterV1Test extends WorkflowTest { public void run() {
workflowResponse = invokeFlow(workflowRequest);
- workflowResponse.getProcessInstanceID();
+ workflowResponse.getProcessInstanceId();
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java index 541dc6e7a9..314d4d3b42 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java @@ -536,12 +536,12 @@ public class SniroHomingTest extends WorkflowTest { } private String verifySniroRequest(){ - String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"initial\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; + String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"initial\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placement\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; return request; } private String verifySniroRequest_existingLicense(){ - String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\",\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\",\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; + String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placement\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\",\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\",\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; return request; } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java index 5f91298958..5562cb80ae 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java @@ -48,7 +48,7 @@ public class WorkflowAsyncResourceTest extends WorkflowTest { variables.put("mso-service-request-timeout", "5"); WorkflowResponse workflowResponse = BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables); - assertEquals("Received the request, the process is getting executed, request message<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>", workflowResponse.getResponse()); + assertEquals("Received the request, the process is getting executed, request message<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>", workflowResponse.getContent()); assertEquals(200, workflowResponse.getMessageCode()); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java index 0da711a7b8..6e2699a40e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java @@ -87,7 +87,7 @@ public class WorkflowContextHolderTest { Assert.assertNotNull(response1.getMessage()); Assert.assertEquals(200,response1.getMessageCode()); Assert.assertEquals("Success", response1.getMessage()); - Assert.assertEquals("Successfully processed request", response1.getResponse()); + Assert.assertEquals("Successfully processed request", response1.getContent()); verify(asyncResponse).setResponse(any(Response.class)); WorkflowContext context1 = contextHolder.getWorkflowContext(workflowContext.getRequestId()); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java index 9b8a249511..de25107fcc 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java @@ -1526,7 +1526,7 @@ public class WorkflowTest { }
else {
try {
- String homingList = getJsonValue(content, "solutionInfo.placementInfo");
+ String homingList = getJsonValue(content, "solutionInfo.placement");
String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
JSONArray placementArr = new JSONArray(homingList);
JSONArray licenseArr = new JSONArray(licenseInfoList);
@@ -1558,7 +1558,7 @@ public class WorkflowTest { }
String newPlacementInfos = placementArr.toString();
String newLicenseInfos = licenseArr.toString();
- content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos);
+ content = updJsonValue(content, "solutionInfo.placement", newPlacementInfos);
content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
}
catch(Exception e) {
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java index 7bb10007ac..644f98349c 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java @@ -52,7 +52,7 @@ public class JsonUtilsTest { public void entryArrayToMapTest() throws IOException { JsonUtils utils = new JsonUtils(); String response = this.getJson("SNIROExample.json"); - String entry = utils.getJsonValue(response, "solutionInfo.placementInfo"); + String entry = utils.getJsonValue(response, "solutionInfo.placement"); JSONArray arr = new JSONArray(entry); JSONObject homingDataJson = arr.getJSONObject(0); JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json index 838bcd85a7..7e56b1a59d 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json @@ -11,7 +11,7 @@ ] } ], - "placementInfo": [ + "placement": [ { "assignmentInfo": [ { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy index 3f0b8d11f1..797086b125 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -35,6 +35,8 @@ import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.RollbackData
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.infrastructure.aai.AAICreateResources;
+import org.onap.aai.domain.yang.v12.GenericVnf;
public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
@@ -287,6 +289,25 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
+
+ /**
+ * Query AAI for vnf orchestration status to determine if health check and config scaling should be run
+ */
+ public void queryAAIForVnfOrchestrationStatus(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ def vnfId = execution.getVariable("CVFMI_vnfId")
+ execution.setVariable("runHealthCheck", false);
+ execution.setVariable("runConfigScaleOut", false);
+ AAICreateResources aaiCreateResources = new AAICreateResources();
+ Optional<GenericVnf> vnf = aaiCreateResources.getVnfInstance(vnfId);
+ if(vnf.isPresent()){
+ def vnfOrchestrationStatus = vnf.get().getOrchestrationStatus();
+ if("active".equalsIgnoreCase(vnfOrchestrationStatus)){
+ execution.setVariable("runHealthCheck", true);
+ execution.setVariable("runConfigScaleOut", true);
+ }
+ }
+ }
/**
*
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy index 39820dc2e1..d8405aa243 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy @@ -277,11 +277,19 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { } } - if (cloudRegionId != null) { - AAIUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.DEFAULT_CLOUD_REGION, cloudRegionId) + if (cloudRegionId != null) { + String cloudOwnerId = "att-aic"; + try { + cloudOwnerId = execution.getVariable("URN_mso_default_cloud_owner_id"); + if (cloudOwnerId == null) cloudOwnerId = "att-aic"; + } catch (RuntimeException e) { + cloudOwnerId = "att-aic"; + } + + AAIUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwnerId, cloudRegionId) // Check if this client region exists if (!client.exists(cloudRegionUri)) { - logDebug("Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI", isDebugLogEnabled) + logDebug("Cloud Region with cloudOwner ID " + cloudOwnerId + " and cloudRegionId " + cloudRegionId + " does not exist in A&AI", isDebugLogEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI") } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java index 93ba0ae5a4..3d05f76b03 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java @@ -24,8 +24,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; +import org.onap.aai.domain.yang.v12.GenericVnf; import org.openecomp.mso.client.aai.AAIObjectType; import org.openecomp.mso.client.aai.AAIResourcesClient; +import org.openecomp.mso.client.aai.entities.AAIResultWrapper; import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; @@ -81,4 +83,16 @@ public class AAICreateResources { aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty()); } + public Optional<GenericVnf> getVnfInstance(String vnfId){ + try{ + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + AAIResultWrapper aaiResponse = aaiRC.get(vnfURI); + Optional<GenericVnf> vnf = aaiResponse.asBean(GenericVnf.class); + return vnf; + } catch (Exception ex){ + return Optional.empty(); + } + } + } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java index 94d221a054..361313e932 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java @@ -29,4 +29,5 @@ public class ExecutionVariableNames { public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf"; public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp"; public final static String DMAAP_MESSAGE = "dmaapMessage"; + public final static String TIMEOUT_FOR_NOTIFICATION = "timeoutForPnfEntryNotification"; } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java new file mode 100644 index 0000000000..268113d28f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.pnf.delegate; + +import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.logger.MsoLogger; + +public class PnfCheckInputs implements JavaDelegate { + + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); + + private String defaultTimeout; + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(CORRELATION_ID); + if (correlationId == null) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined"); + } + String timeout = (String) execution.getVariable(TIMEOUT_FOR_NOTIFICATION); + if (timeout == null) { + LOGGER.debug("timeoutForPnfEntryNotification variable not found, setting default"); + if (defaultTimeout == null) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, + "default timeoutForPnfEntryNotification value not defined"); + } + execution.setVariable(TIMEOUT_FOR_NOTIFICATION, defaultTimeout); + } + } + + public void setDefaultTimeout(String defaultTimeout) { + this.defaultTimeout = defaultTimeout; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties b/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties index 5b1ffac571..6807a24ea9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties @@ -6,4 +6,6 @@ eventReadyTopicName=pnfEventReady consumerId=consumerId consumerGroup=group clientThreadInitialDelayInSeconds=1 -clientThreadDelayInSeconds=5
\ No newline at end of file +clientThreadDelayInSeconds=5 + +pnfDefaultTimeout=P14D diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn index c118105e35..8f2bf67b71 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn @@ -14,51 +14,42 @@ <bpmn:process id="CreateAndActivatePnfResource" name="CreateAndActivatePnfResource" isExecutable="true"> <bpmn:sequenceFlow id="SequenceFlow_1kc34bc" sourceRef="WaitForDmaapTimeout" targetRef="CancelDmaapClientSubscription" /> <bpmn:sequenceFlow id="SequenceFlow_1o8od8e" sourceRef="InformDmaapClient" targetRef="WaitForDmaapPnfReadyNotification" /> + <bpmn:sequenceFlow id="SequenceFlow_0v5ffpe" name="No" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="CreateAndActivatePnf_CreateAaiEntry"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutPnf}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="AaiEntryUpdated" /> <bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="InformDmaapClient" /> + <bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreateAndActivatePnf_CreateAaiEntry" targetRef="AaiEntryExists" /> + <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" /> + <bpmn:sequenceFlow id="SequenceFlow_0j5ksz1" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="CheckInputs" /> + <bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="CancelDmaapClientSubscription" targetRef="ThrowTimeoutException" /> <bpmn:sequenceFlow id="SequenceFlow_1ls8pua" name="No" sourceRef="DoesAaiContainInfoAboutIp" targetRef="AaiEntryExists"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutIp}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreateAndActivatePnf_CreateAaiEntry" targetRef="AaiEntryExists" /> - <bpmn:sequenceFlow id="SequenceFlow_0v5ffpe" name="No" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="CreateAndActivatePnf_CreateAaiEntry"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutPnf}</bpmn:conditionExpression> - </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1l1t6ak" name="Yes" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="DoesAaiContainInfoAboutIp"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" /> - <bpmn:sequenceFlow id="SequenceFlow_0j5ksz1" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="CheckAiiForCorrelationId" /> - <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="AaiEntryUpdated" /> <bpmn:sequenceFlow id="SequenceFlow_1h6yz62" name="Yes" sourceRef="DoesAaiContainInfoAboutIp" targetRef="AaiEntryAlreadyUpToDate"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutIp}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:endEvent id="AaiEntryAlreadyUpToDate" name="AAI entry already up-to-date"> - <bpmn:incoming>SequenceFlow_1h6yz62</bpmn:incoming> + <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated"> + <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming> </bpmn:endEvent> - <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutIp" name="Does AAI contain info about IPv4 or IPv6?"> - <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1h6yz62</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1ls8pua</bpmn:outgoing> - </bpmn:exclusiveGateway> <bpmn:endEvent id="ThrowTimeoutException" name="Throw timeout exception"> <bpmn:incoming>SequenceFlow_1miyzfe</bpmn:incoming> <bpmn:errorEventDefinition errorRef="Error_1" /> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="CancelDmaapClientSubscription" targetRef="ThrowTimeoutException" /> - <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${checkAaiForCorrelationIdDelegate}"> - <bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing> - </bpmn:serviceTask> + <bpmn:endEvent id="AaiEntryAlreadyUpToDate" name="AAI entry already up-to-date"> + <bpmn:incoming>SequenceFlow_1h6yz62</bpmn:incoming> + </bpmn:endEvent> <bpmn:startEvent id="CreateAndActivatePnf_StartEvent"> <bpmn:outgoing>SequenceFlow_0j5ksz1</bpmn:outgoing> </bpmn:startEvent> - <bpmn:intermediateThrowEvent id="AaiEntryExists" name="AAI entry exists, lacking IP"> - <bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1ls8pua</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing> - </bpmn:intermediateThrowEvent> - <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated"> - <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming> - </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForCorrelationId" /> + <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${checkAaiForCorrelationIdDelegate}"> + <bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutPnf" name="Does AAI contain info about pnf?"> <bpmn:incoming>SequenceFlow_1j4r3zt</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing> @@ -68,6 +59,16 @@ <bpmn:incoming>SequenceFlow_0v5ffpe</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1qr6cmf</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutIp" name="Does AAI contain info about IPv4 or IPv6?"> + <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1h6yz62</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1ls8pua</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:intermediateThrowEvent id="AaiEntryExists" name="AAI entry exists, lacking IP"> + <bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ls8pua</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing> + </bpmn:intermediateThrowEvent> <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${informDmaapClient}"> <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing> @@ -86,31 +87,35 @@ <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" /> + <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${pnfCheckInputs}"> + <bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:textAnnotation id="TextAnnotation_1eyzes8"> <bpmn:text><![CDATA[Inputs: Â -Â timeoutForPnfEntryNotification - String - correlationId - String ]]></bpmn:text> </bpmn:textAnnotation> + <bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" /> </bpmn:process> <bpmn:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> <bpmn:message id="Message_13h1tlo" name="WorkflowMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1d0w8lf"> <bpmndi:BPMNShape id="Participant_1egg397_di" bpmnElement="Participant_1egg397"> - <dc:Bounds x="0" y="0" width="1488" height="437" /> + <dc:Bounds x="-113" y="0" width="1601" height="438" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1cttgdo_di" bpmnElement="DoesAaiContainInfoAboutPnf" isMarkerVisible="true"> - <dc:Bounds x="338" y="182" width="50" height="50" /> + <dc:Bounds x="390" y="182" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="320" y="283" width="85" height="20" /> + <dc:Bounds x="372" y="283" width="85" height="20" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0yamdfm_di" bpmnElement="DoesAaiContainInfoAboutIp" isMarkerVisible="true"> - <dc:Bounds x="646" y="41" width="50" height="50" /> + <dc:Bounds x="682" y="41" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="627" y="5" width="87" height="30" /> + <dc:Bounds x="663" y="5" width="87" height="30" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0k52gr7_di" bpmnElement="AaiEntryUpdated"> @@ -120,93 +125,89 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_0j5ok9h_di" bpmnElement="CreateAndActivatePnf_StartEvent"> - <dc:Bounds x="49" y="189" width="36" height="36" /> + <dc:Bounds x="-54" y="189" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="23" y="228" width="90" height="20" /> + <dc:Bounds x="-80" y="228" width="90" height="20" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForCorrelationId"> - <dc:Bounds x="159" y="167" width="100" height="80" /> + <dc:Bounds x="219" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0iimk5v_di" bpmnElement="CreateAndActivatePnf_CreateAaiEntry"> - <dc:Bounds x="467" y="167" width="100" height="80" /> + <dc:Bounds x="511" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1j4r3zt_di" bpmnElement="SequenceFlow_1j4r3zt"> - <di:waypoint xsi:type="dc:Point" x="259" y="207" /> - <di:waypoint xsi:type="dc:Point" x="338" y="207" /> + <di:waypoint xsi:type="dc:Point" x="319" y="207" /> + <di:waypoint xsi:type="dc:Point" x="390" y="207" /> <bpmndi:BPMNLabel> - <dc:Bounds x="253.5" y="187" width="90" height="10" /> + <dc:Bounds x="309.5" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1l1t6ak_di" bpmnElement="SequenceFlow_1l1t6ak"> - <di:waypoint xsi:type="dc:Point" x="363" y="182" /> - <di:waypoint xsi:type="dc:Point" x="363" y="66" /> - <di:waypoint xsi:type="dc:Point" x="646" y="66" /> + <di:waypoint xsi:type="dc:Point" x="415" y="207" /> + <di:waypoint xsi:type="dc:Point" x="415" y="66" /> + <di:waypoint xsi:type="dc:Point" x="682" y="66" /> <bpmndi:BPMNLabel> - <dc:Bounds x="378" y="159" width="19" height="10" /> + <dc:Bounds x="430" y="180.1206896551724" width="19" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0v5ffpe_di" bpmnElement="SequenceFlow_0v5ffpe"> - <di:waypoint xsi:type="dc:Point" x="388" y="207" /> - <di:waypoint xsi:type="dc:Point" x="467" y="207" /> + <di:waypoint xsi:type="dc:Point" x="440" y="207" /> + <di:waypoint xsi:type="dc:Point" x="511" y="207" /> <bpmndi:BPMNLabel> - <dc:Bounds x="396.3963414634147" y="210" width="15" height="10" /> + <dc:Bounds x="447.32911392405055" y="210" width="15" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1h6yz62_di" bpmnElement="SequenceFlow_1h6yz62"> - <di:waypoint xsi:type="dc:Point" x="696" y="66" /> + <di:waypoint xsi:type="dc:Point" x="732" y="66" /> <di:waypoint xsi:type="dc:Point" x="1312" y="66" /> <bpmndi:BPMNLabel> - <dc:Bounds x="708.1232876712329" y="51" width="19" height="10" /> + <dc:Bounds x="742.7435064935065" y="51" width="19" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ls8pua_di" bpmnElement="SequenceFlow_1ls8pua"> - <di:waypoint xsi:type="dc:Point" x="671" y="91" /> - <di:waypoint xsi:type="dc:Point" x="671" y="164" /> - <di:waypoint xsi:type="dc:Point" x="671" y="164" /> - <di:waypoint xsi:type="dc:Point" x="671" y="189" /> + <di:waypoint xsi:type="dc:Point" x="707" y="91" /> + <di:waypoint xsi:type="dc:Point" x="707" y="189" /> <bpmndi:BPMNLabel> - <dc:Bounds x="681" y="105" width="15" height="10" /> + <dc:Bounds x="717" y="116.1917808219178" width="15" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qr6cmf_di" bpmnElement="SequenceFlow_1qr6cmf"> - <di:waypoint xsi:type="dc:Point" x="567" y="207" /> - <di:waypoint xsi:type="dc:Point" x="653" y="207" /> + <di:waypoint xsi:type="dc:Point" x="611" y="207" /> + <di:waypoint xsi:type="dc:Point" x="689" y="207" /> <bpmndi:BPMNLabel> - <dc:Bounds x="565" y="187" width="90" height="10" /> + <dc:Bounds x="605" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0j5ksz1_di" bpmnElement="SequenceFlow_0j5ksz1"> - <di:waypoint xsi:type="dc:Point" x="85" y="207" /> - <di:waypoint xsi:type="dc:Point" x="122" y="207" /> - <di:waypoint xsi:type="dc:Point" x="122" y="207" /> - <di:waypoint xsi:type="dc:Point" x="159" y="207" /> + <di:waypoint xsi:type="dc:Point" x="-18" y="207" /> + <di:waypoint xsi:type="dc:Point" x="48" y="207" /> <bpmndi:BPMNLabel> - <dc:Bounds x="92" y="202" width="90" height="10" /> + <dc:Bounds x="-30" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Participant_0i9ban2_di" bpmnElement="Participant_0atuyq0"> <dc:Bounds x="123" y="523" width="502" height="60" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="MessageFlow_1h3xu88_di" bpmnElement="MessageFlow_1h3xu88"> - <di:waypoint xsi:type="dc:Point" x="517" y="247" /> - <di:waypoint xsi:type="dc:Point" x="517" y="523" /> + <di:waypoint xsi:type="dc:Point" x="561" y="247" /> + <di:waypoint xsi:type="dc:Point" x="561" y="523" /> <bpmndi:BPMNLabel> - <dc:Bounds x="487" y="380" width="90" height="10" /> + <dc:Bounds x="531" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_09ibv5a_di" bpmnElement="MessageFlow_09ibv5a"> - <di:waypoint xsi:type="dc:Point" x="190" y="247" /> - <di:waypoint xsi:type="dc:Point" x="190" y="523" /> + <di:waypoint xsi:type="dc:Point" x="250" y="247" /> + <di:waypoint xsi:type="dc:Point" x="250" y="523" /> <bpmndi:BPMNLabel> - <dc:Bounds x="160" y="404" width="90" height="10" /> + <dc:Bounds x="220" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_0vjul4t_di" bpmnElement="MessageFlow_0vjul4t"> - <di:waypoint xsi:type="dc:Point" x="229" y="523" /> - <di:waypoint xsi:type="dc:Point" x="229" y="247" /> + <di:waypoint xsi:type="dc:Point" x="289" y="523" /> + <di:waypoint xsi:type="dc:Point" x="289" y="247" /> <bpmndi:BPMNLabel> - <dc:Bounds x="199" y="404" width="90" height="10" /> + <dc:Bounds x="259" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Participant_0vmrrhf_di" bpmnElement="Participant_19w87ws"> @@ -225,89 +226,99 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0fjcdy4_di" bpmnElement="AaiEntryExists"> - <dc:Bounds x="653" y="189" width="36" height="36" /> + <dc:Bounds x="689" y="189" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="634" y="235" width="80" height="20" /> + <dc:Bounds x="670" y="235" width="80" height="20" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1eyzes8_di" bpmnElement="TextAnnotation_1eyzes8"> - <dc:Bounds x="66" y="70" width="243" height="54" /> + <dc:Bounds x="-37" y="70" width="243" height="54" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_0d7oxnz_di" bpmnElement="Association_0d7oxnz"> - <di:waypoint xsi:type="dc:Point" x="67" y="189" /> - <di:waypoint xsi:type="dc:Point" x="67" y="124" /> + <di:waypoint xsi:type="dc:Point" x="-36" y="189" /> + <di:waypoint xsi:type="dc:Point" x="-36" y="124" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d"> - <di:waypoint xsi:type="dc:Point" x="1006" y="523" /> - <di:waypoint xsi:type="dc:Point" x="1006" y="247" /> + <di:waypoint xsi:type="dc:Point" x="1026" y="523" /> + <di:waypoint xsi:type="dc:Point" x="1026" y="247" /> <bpmndi:BPMNLabel> - <dc:Bounds x="976" y="380" width="90" height="10" /> + <dc:Bounds x="996" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_17s9025_di" bpmnElement="SequenceFlow_17s9025"> - <di:waypoint xsi:type="dc:Point" x="689" y="207" /> - <di:waypoint xsi:type="dc:Point" x="775" y="207" /> + <di:waypoint xsi:type="dc:Point" x="725" y="207" /> + <di:waypoint xsi:type="dc:Point" x="803" y="207" /> <bpmndi:BPMNLabel> - <dc:Bounds x="687" y="187" width="90" height="10" /> + <dc:Bounds x="719" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BoundaryEvent_15eo1k9_di" bpmnElement="WaitForDmaapTimeout"> - <dc:Bounds x="1020" y="229" width="36" height="36" /> + <dc:Bounds x="1040" y="229" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1051" y="260" width="40" height="10" /> + <dc:Bounds x="1071" y="260" width="40" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1kc34bc_di" bpmnElement="SequenceFlow_1kc34bc"> - <di:waypoint xsi:type="dc:Point" x="1038" y="265" /> - <di:waypoint xsi:type="dc:Point" x="1038" y="363" /> - <di:waypoint xsi:type="dc:Point" x="1133" y="363" /> + <di:waypoint xsi:type="dc:Point" x="1058" y="265" /> + <di:waypoint xsi:type="dc:Point" x="1058" y="363" /> + <di:waypoint xsi:type="dc:Point" x="1145" y="363" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1008" y="309" width="90" height="10" /> + <dc:Bounds x="1028" y="309" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ReceiveTask_1sfysua_di" bpmnElement="WaitForDmaapPnfReadyNotification"> - <dc:Bounds x="954" y="167" width="100" height="80" /> + <dc:Bounds x="974" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0p09qgm_di" bpmnElement="SequenceFlow_0p09qgm"> - <di:waypoint xsi:type="dc:Point" x="1054" y="207" /> + <di:waypoint xsi:type="dc:Point" x="1074" y="207" /> <di:waypoint xsi:type="dc:Point" x="1312" y="207" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1138" y="187" width="90" height="10" /> + <dc:Bounds x="1148" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1o8od8e_di" bpmnElement="SequenceFlow_1o8od8e"> - <di:waypoint xsi:type="dc:Point" x="875" y="207" /> - <di:waypoint xsi:type="dc:Point" x="954" y="207" /> + <di:waypoint xsi:type="dc:Point" x="903" y="207" /> + <di:waypoint xsi:type="dc:Point" x="974" y="207" /> <bpmndi:BPMNLabel> - <dc:Bounds x="869.5" y="187" width="90" height="10" /> + <dc:Bounds x="893.5" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_0tg4hw9_di" bpmnElement="MessageFlow_0tg4hw9"> - <di:waypoint xsi:type="dc:Point" x="825" y="247" /> - <di:waypoint xsi:type="dc:Point" x="825" y="523" /> + <di:waypoint xsi:type="dc:Point" x="853" y="247" /> + <di:waypoint xsi:type="dc:Point" x="853" y="523" /> <bpmndi:BPMNLabel> - <dc:Bounds x="795" y="380" width="90" height="10" /> + <dc:Bounds x="823" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1iax11n_di" bpmnElement="InformDmaapClient"> - <dc:Bounds x="775" y="167" width="100" height="80" /> + <dc:Bounds x="803" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1miyzfe_di" bpmnElement="SequenceFlow_1miyzfe"> - <di:waypoint xsi:type="dc:Point" x="1233" y="363" /> + <di:waypoint xsi:type="dc:Point" x="1245" y="363" /> <di:waypoint xsi:type="dc:Point" x="1312" y="363" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1227.5" y="343" width="90" height="10" /> + <dc:Bounds x="1233.5" y="343" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_1py54jr_di" bpmnElement="MessageFlow_1py54jr"> - <di:waypoint xsi:type="dc:Point" x="1183" y="403" /> - <di:waypoint xsi:type="dc:Point" x="1183" y="523" /> + <di:waypoint xsi:type="dc:Point" x="1195" y="403" /> + <di:waypoint xsi:type="dc:Point" x="1195" y="523" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1153" y="458" width="90" height="10" /> + <dc:Bounds x="1165" y="458" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_12j7hox_di" bpmnElement="CancelDmaapClientSubscription"> - <dc:Bounds x="1133" y="323" width="100" height="80" /> + <dc:Bounds x="1145" y="323" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0967g8p_di" bpmnElement="SequenceFlow_0967g8p"> + <di:waypoint xsi:type="dc:Point" x="148" y="207" /> + <di:waypoint xsi:type="dc:Point" x="219" y="207" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="183.5" y="187" width="0" height="10" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0lx02qn_di" bpmnElement="CheckInputs"> + <dc:Bounds x="48" y="167" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn index 2120e120a9..03d7362ac5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.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.8.2" 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.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateVcpeResCustService" name="CreateVcpeResCustService" isExecutable="true"> <bpmn2:scriptTask id="sendSyncAckResponse_ScriptTask" name="Send Sync Ack Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> @@ -447,6 +447,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(execution)]]></bpmn2:s <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> <camunda:in source="subscriberInfo" target="subscriberInfo" /> + <camunda:in source="homingService" target="homingService" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_11efpvh</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1jbuf1t</bpmn2:outgoing> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn index a3e63fa14e..94b88f7c3c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.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.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateVcpeResCustServiceV2" name="CreateVcpeResCustServiceV2" isExecutable="true"> <bpmn2:scriptTask id="sendSyncAckResponse_ScriptTask" name="Send Sync Ack Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> @@ -447,6 +447,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(execution)]]></bpmn2:s <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> <camunda:in source="subscriberInfo" target="subscriberInfo" /> + <camunda:in source="homingService" target="homingService" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_11efpvh</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1jbuf1t</bpmn2:outgoing> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn index 841dec96bd..f882094851 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn @@ -46,8 +46,8 @@ <bpmn2:scriptTask id="SendResponse" name="Send Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0e2ta6w</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def createVfModule = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def createVfModule = new CreateVfModuleInfra() createVfModule.sendResponse(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1" name="To FinishLine"> @@ -63,8 +63,8 @@ createVfModule.sendResponse(execution)]]></bpmn2:script> <bpmn2:scriptTask id="PrepareUpdateInfraRequest" name="Prepare Update Infra Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def createVfModule = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def createVfModule = new CreateVfModuleInfra() createVfModule.prepareUpdateInfraRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:serviceTask id="ServiceTask_1" name="Update Infra Request"> @@ -94,8 +94,8 @@ createVfModule.prepareUpdateInfraRequest(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_0td7d9m</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_0u8zesf</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def createVfModule = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def createVfModule = new CreateVfModuleInfra() createVfModule.postProcessResponse(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="PrepareMSOCompletionHandler" targetRef="MSOCompletionHandler" /> @@ -147,8 +147,8 @@ createVfModule.postProcessResponse(execution)]]></bpmn2:script> <bpmn2:scriptTask id="PrepareFalloutHandler" name="Prepare Fallout Handler" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_018p5wf</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def cvfm = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def cvfm = new CreateVfModuleInfra() cvfm.falloutHandlerPrep(execution, 'CVFMI_FalloutHandlerRequest')]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="PrepareFalloutHandler" targetRef="FalloutHandler" /> @@ -157,8 +157,8 @@ cvfm.falloutHandlerPrep(execution, 'CVFMI_FalloutHandlerRequest')]]></bpmn2:scri <bpmn2:scriptTask id="SendErrorResponse" name="Send Error Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0wsgnab</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_018p5wf</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def createVfModule = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def createVfModule = new CreateVfModuleInfra() createVfModule.sendErrorResponse(execution)]]></bpmn2:script> </bpmn2:scriptTask> </bpmn2:subProcess> @@ -185,8 +185,8 @@ createVfModule.sendErrorResponse(execution)]]></bpmn2:script> <bpmn2:scriptTask id="PreProcessRequest" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def createVfModule = new CreateVfModuleInfra()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def createVfModule = new CreateVfModuleInfra() createVfModule.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="PreProcessRequest" targetRef="SendResponse" /> @@ -194,8 +194,8 @@ createVfModule.preProcessRequest(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ProcessError" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1qvgrvq</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1jqizzo</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-ExceptionUtil exceptionUtil = new ExceptionUtil()
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil exceptionUtil = new ExceptionUtil() exceptionUtil.processJavaException(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:endEvent id="EndEvent_0100eju"> @@ -225,7 +225,7 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_1xggje5</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_07llpjo</bpmn2:outgoing> </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_0e2ta6w" sourceRef="SendResponse" targetRef="ExclusiveGateway_1qozral" /> + <bpmn2:sequenceFlow id="SequenceFlow_0e2ta6w" sourceRef="SendResponse" targetRef="Task_1o3z68c" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_09h60ub" name="Error on HealthCheck?" default="SequenceFlow_1vx081s"> <bpmn2:incoming>SequenceFlow_07llpjo</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1vx081s</bpmn2:outgoing> @@ -274,12 +274,12 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[execution.getVariable("errorConfigScaleOutCode") != "0"]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:exclusiveGateway id="ExclusiveGateway_1qozral" name="Do HealthCheck?" default="SequenceFlow_1y7d5qk"> - <bpmn2:incoming>SequenceFlow_0e2ta6w</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1b7348f</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1xggje5</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_1y7d5qk</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_1xggje5" name="yes" sourceRef="ExclusiveGateway_1qozral" targetRef="CallActivity_0i3men0"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA["VNF Orchestration Status" == "Active or Activated"]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[execution.getVariable("runHealthCheck")]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_1y7d5qk" name="no" sourceRef="ExclusiveGateway_1qozral" targetRef="DoCreateVfModuleSubprocess" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_0c8x2mq" name="Do ConfigScaleOut?" default="SequenceFlow_0u8zesf"> @@ -288,9 +288,17 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_0u8zesf</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_020dbkp" name="yes" sourceRef="ExclusiveGateway_0c8x2mq" targetRef="CallActivity_17ukiqm"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA["VNF Orchestration Status" == "Active or Activated"]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[execution.getVariable("runConfigScaleOut")]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0u8zesf" name="no" sourceRef="ExclusiveGateway_0c8x2mq" targetRef="PrepareMSOCompletionHandler" /> + <bpmn2:sequenceFlow id="SequenceFlow_1b7348f" sourceRef="Task_1o3z68c" targetRef="ExclusiveGateway_1qozral" /> + <bpmn2:scriptTask id="Task_1o3z68c" name="Query AAI For Orchestration Status" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0e2ta6w</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1b7348f</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def createVfModule = new CreateVfModuleInfra() +createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script> + </bpmn2:scriptTask> </bpmn2:process> <bpmn2:error id="Error_1" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_2" name="REST Fault" errorCode="RESTFault" /> @@ -323,19 +331,19 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_178" bpmnElement="DoCreateVfModuleSubprocess"> - <dc:Bounds x="597" y="-6" width="145" height="80" /> + <dc:Bounds x="762" y="-6" width="145" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_IntermediateThrowEvent_47" bpmnElement="IntermediateThrowEvent_1"> - <dc:Bounds x="812" y="16" width="36" height="36" /> + <dc:Bounds x="977" y="16" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="796" y="57" width="67" height="12" /> + <dc:Bounds x="963" y="57" width="64" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_178" targetElement="_BPMNShape_IntermediateThrowEvent_47"> - <di:waypoint xsi:type="dc:Point" x="742" y="34" /> - <di:waypoint xsi:type="dc:Point" x="812" y="34" /> + <di:waypoint xsi:type="dc:Point" x="907" y="34" /> + <di:waypoint xsi:type="dc:Point" x="977" y="34" /> <bpmndi:BPMNLabel> - <dc:Bounds x="732" y="19" width="90" height="0" /> + <dc:Bounds x="897" y="19" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_32" bpmnElement="IntermediateCatchEvent_1"> @@ -529,48 +537,48 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <dc:Bounds x="296" y="698" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0i3men0_di" bpmnElement="CallActivity_0i3men0"> - <dc:Bounds x="432" y="-145" width="145" height="80" /> + <dc:Bounds x="597" y="-145" width="145" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0e2ta6w_di" bpmnElement="SequenceFlow_0e2ta6w"> <di:waypoint xsi:type="dc:Point" x="409" y="34" /> - <di:waypoint xsi:type="dc:Point" x="480" y="34" /> + <di:waypoint xsi:type="dc:Point" x="460" y="34" /> <bpmndi:BPMNLabel> - <dc:Bounds x="399.5" y="19" width="90" height="0" /> + <dc:Bounds x="389.5" y="19" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_09h60ub_di" bpmnElement="ExclusiveGateway_09h60ub" isMarkerVisible="true"> - <dc:Bounds x="645" y="-130" width="50" height="50" /> + <dc:Bounds x="810" y="-130" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="632" y="-162" width="75" height="24" /> + <dc:Bounds x="800" y="-162" width="69" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1vx081s_di" bpmnElement="SequenceFlow_1vx081s"> - <di:waypoint xsi:type="dc:Point" x="670" y="-80" /> - <di:waypoint xsi:type="dc:Point" x="670" y="-38" /> - <di:waypoint xsi:type="dc:Point" x="670" y="-38" /> - <di:waypoint xsi:type="dc:Point" x="670" y="-6" /> + <di:waypoint xsi:type="dc:Point" x="835" y="-80" /> + <di:waypoint xsi:type="dc:Point" x="835" y="-38" /> + <di:waypoint xsi:type="dc:Point" x="835" y="-38" /> + <di:waypoint xsi:type="dc:Point" x="835" y="-6" /> <bpmndi:BPMNLabel> - <dc:Bounds x="674.9351851851853" y="-69.97752808988761" width="15" height="12" /> + <dc:Bounds x="841" y="-70" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07llpjo_di" bpmnElement="SequenceFlow_07llpjo"> - <di:waypoint xsi:type="dc:Point" x="577" y="-105" /> - <di:waypoint xsi:type="dc:Point" x="645" y="-105" /> + <di:waypoint xsi:type="dc:Point" x="742" y="-105" /> + <di:waypoint xsi:type="dc:Point" x="810" y="-105" /> <bpmndi:BPMNLabel> - <dc:Bounds x="566" y="-120" width="90" height="0" /> + <dc:Bounds x="731" y="-120" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0n6bb71_di" bpmnElement="EndEvent_0n6bb71"> - <dc:Bounds x="760" y="-123" width="36" height="36" /> + <dc:Bounds x="925" y="-123" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="733" y="-82" width="90" height="0" /> + <dc:Bounds x="898" y="-82" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0nszq2o_di" bpmnElement="SequenceFlow_0nszq2o"> - <di:waypoint xsi:type="dc:Point" x="695" y="-105" /> - <di:waypoint xsi:type="dc:Point" x="760" y="-105" /> + <di:waypoint xsi:type="dc:Point" x="860" y="-105" /> + <di:waypoint xsi:type="dc:Point" x="925" y="-105" /> <bpmndi:BPMNLabel> - <dc:Bounds x="700.9862881434168" y="-100.62310488133339" width="20" height="12" /> + <dc:Bounds x="867" y="-101" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_17ukiqm_di" bpmnElement="CallActivity_17ukiqm"> @@ -617,23 +625,23 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1qozral_di" bpmnElement="ExclusiveGateway_1qozral" isMarkerVisible="true"> - <dc:Bounds x="479.5474525474525" y="9" width="50" height="50" /> + <dc:Bounds x="645" y="9" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="463" y="66" width="86" height="12" /> + <dc:Bounds x="628" y="66" width="86" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xggje5_di" bpmnElement="SequenceFlow_1xggje5"> - <di:waypoint xsi:type="dc:Point" x="505" y="9" /> - <di:waypoint xsi:type="dc:Point" x="505" y="-65" /> + <di:waypoint xsi:type="dc:Point" x="670" y="9" /> + <di:waypoint xsi:type="dc:Point" x="670" y="-65" /> <bpmndi:BPMNLabel> - <dc:Bounds x="512" y="-26" width="20" height="12" /> + <dc:Bounds x="678" y="-26" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1y7d5qk_di" bpmnElement="SequenceFlow_1y7d5qk"> - <di:waypoint xsi:type="dc:Point" x="530" y="34" /> - <di:waypoint xsi:type="dc:Point" x="597" y="34" /> + <di:waypoint xsi:type="dc:Point" x="695" y="34" /> + <di:waypoint xsi:type="dc:Point" x="762" y="34" /> <bpmndi:BPMNLabel> - <dc:Bounds x="546" y="37" width="15" height="12" /> + <dc:Bounds x="713" y="37" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0c8x2mq_di" bpmnElement="ExclusiveGateway_0c8x2mq" isMarkerVisible="true"> @@ -656,6 +664,16 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <dc:Bounds x="585" y="372" width="15" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1b7348f_di" bpmnElement="SequenceFlow_1b7348f"> + <di:waypoint xsi:type="dc:Point" x="560" y="34" /> + <di:waypoint xsi:type="dc:Point" x="645" y="34" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="602.5" y="13" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_19vqej7_di" bpmnElement="Task_1o3z68c"> + <dc:Bounds x="460" y="-6" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml index 13ab4f8f17..7a0aa60bb3 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml +++ b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml @@ -38,4 +38,8 @@ <property name="locations" value="classpath:dmaap.properties"/>
</bean>
+ <bean id="pnfCheckInputs" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.PnfCheckInputs">
+ <property name="defaultTimeout" value="${pnfDefaultTimeout}"/>
+ </bean>
+
</beans>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java index 07fa4eb53a..a1a9e35865 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java @@ -99,7 +99,7 @@ public class CreateGenericALaCarteServiceInstanceTest extends WorkflowTest { Map<String, String> variables = setupVariables(); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateGenericALaCarteServiceInstance", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowResponse"); //assertNotNull(workflowResp); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java index d31f6e7b96..f993d066e4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java @@ -105,7 +105,7 @@ public class CreateNetworkInstanceTest extends WorkflowTest { System.out.println("----------------------------------------------------------"); System.out.println("- got workflow response -"); System.out.println("----------------------------------------------------------"); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); @@ -156,7 +156,7 @@ public class CreateNetworkInstanceTest extends WorkflowTest { Map<String, String> variables = setupVariables2(); //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); @@ -219,7 +219,7 @@ public class CreateNetworkInstanceTest extends WorkflowTest { Map<String, String> variables = setupVariablesVID1(); executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); @@ -269,7 +269,7 @@ public class CreateNetworkInstanceTest extends WorkflowTest { Map<String, String> variables = setupVariables1(); executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); @@ -308,7 +308,7 @@ public class CreateNetworkInstanceTest extends WorkflowTest { Map<String, String> variables = setupVariables2(); //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); @@ -345,7 +345,7 @@ public class CreateNetworkInstanceTest extends WorkflowTest { Map<String, String> variables = setupVariables2(); //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); @@ -395,7 +395,7 @@ public class CreateNetworkInstanceTest extends WorkflowTest { System.out.println("----------------------------------------------------------"); System.out.println("- got workflow response -"); System.out.println("----------------------------------------------------------"); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java index de2ae771a5..1e865dfd14 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java @@ -21,6 +21,7 @@ package org.openecomp.mso.bpmn.infrastructure;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSDNCAdapterVfModule;
@@ -87,6 +88,7 @@ public class CreateVfModuleInfraTest extends WorkflowTest { logStart();
MockAAIVfModule();
+ MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200);
MockPatchGenericVnf("skask");
MockPatchVfModuleId("skask", ".*");
MockSDNCAdapterVfModule();
@@ -105,7 +107,7 @@ public class CreateVfModuleInfraTest extends WorkflowTest { WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
+ String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
injectSDNCCallbacks(callbacks, "assign, query");
@@ -148,6 +150,7 @@ public class CreateVfModuleInfraTest extends WorkflowTest { logStart();
MockAAIVfModule();
+ MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200);
MockPatchGenericVnf("skask");
MockPatchVfModuleId("skask", ".*");
MockSDNCAdapterVfModule();
@@ -166,7 +169,7 @@ public class CreateVfModuleInfraTest extends WorkflowTest { WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
+ String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
injectSDNCCallbacks(callbacks, "assign, query");
@@ -239,6 +242,7 @@ public class CreateVfModuleInfraTest extends WorkflowTest { MockAAIVfModule();
+ MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200);
MockPatchGenericVnf("skask");
MockPatchVfModuleId("skask", ".*");
MockSDNCAdapterVfModule();
@@ -257,7 +261,7 @@ public class CreateVfModuleInfraTest extends WorkflowTest { WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
+ String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
injectSDNCCallbacks(callbacks, "assign, query");
@@ -325,6 +329,7 @@ public class CreateVfModuleInfraTest extends WorkflowTest { logStart();
MockAAIVfModule();
+ MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200);
MockPatchGenericVnf("skask");
MockPatchVfModuleId("skask", ".*");
MockSDNCAdapterVfModule();
@@ -343,7 +348,7 @@ public class CreateVfModuleInfraTest extends WorkflowTest { WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
+ String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
injectSDNCCallbacks(callbacks, "assign, query");
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java index 23999c99ad..2e5a7a418a 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java @@ -98,7 +98,7 @@ public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest { TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); @@ -148,7 +148,7 @@ public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest { TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); @@ -192,7 +192,7 @@ public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest { TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); @@ -239,7 +239,7 @@ public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest { TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); injectVNFRestCallbacks(callbacks, "volumeGroupException"); @@ -280,7 +280,7 @@ public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest { TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); @@ -320,7 +320,7 @@ public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest { TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); waitForProcessEnd(businessKey, 100000); checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); @@ -358,7 +358,7 @@ public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest { TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); waitForProcessEnd(businessKey, 100000); checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java index 075ddab80c..db43de7f14 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java @@ -96,7 +96,7 @@ public class CreateVnfInfraTest extends WorkflowTest { WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); //injectSDNCCallbacks(callbacks, "assign, query"); @@ -114,7 +114,7 @@ public class CreateVnfInfraTest extends WorkflowTest { // injectSDNCCallbacks(callbacks, "assign"); // injectSDNCCallbacks(callbacks, "activate"); //waitForProcessEnd(businessKey, 10000); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); //assertVariables("true", "true", "false", "true", "Success", null); @@ -130,7 +130,7 @@ public class CreateVnfInfraTest extends WorkflowTest { setVariables(variables, null, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables(null, null, null, null, null, "WorkflowException[processKey=CreateVnfInfra,errorCode=2500,errorMessage=Internal Error - WorkflowException Object and/or RequestInfo is null! CreateVnfInfra]"); @@ -148,7 +148,7 @@ public class CreateVnfInfraTest extends WorkflowTest { setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=404,errorMessage=Service Instance Not Found]"); @@ -180,7 +180,7 @@ public class CreateVnfInfraTest extends WorkflowTest { setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=5000,errorMessage=Generic Vnf Already Exist.]"); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java index aa05953493..1a52041bd7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java @@ -78,7 +78,7 @@ public class DeleteGenericALaCarteServiceInstanceTest extends WorkflowTest { Map<String, String> variables = setupVariables();
WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteGenericALaCarteServiceInstance", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowResponse");
//assertNotNull(workflowResp);
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java index 06eb79cfd1..9c32abe373 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java @@ -254,7 +254,7 @@ public class DeleteNetworkInstanceTest extends WorkflowTest { executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
//WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
Assert.assertNotNull(workflowResp);
@@ -338,4 +338,4 @@ public class DeleteNetworkInstanceTest extends WorkflowTest { }
-}
\ No newline at end of file +}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java index cdc547c47e..ba375f5d78 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java @@ -546,7 +546,7 @@ public class DeleteVfModuleInfraTest extends WorkflowTest { TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleInfra",
"v1", businessKey, deleteVfModuleRequest, variables);
WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
+ String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
// "changedelete" operation not required for deleting a Vf Module
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java index 84050c40e5..0e2cf1b6b3 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java @@ -74,7 +74,7 @@ public class DeleteVfModuleVolumeInfraV1Test extends WorkflowTest { "v1", businessKey, deleteVfModuleVolRequest, testVariables); WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); @@ -113,7 +113,7 @@ public class DeleteVfModuleVolumeInfraV1Test extends WorkflowTest { "v1", businessKey, deleteVfModuleVolRequest, testVariables); WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); //injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); @@ -153,7 +153,7 @@ public class DeleteVfModuleVolumeInfraV1Test extends WorkflowTest { "v1", businessKey, deleteVfModuleVolRequest, testVariables); WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); //injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java index 89bf141247..3ab3f713f4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java @@ -82,7 +82,7 @@ public class DeleteVnfInfraTest extends WorkflowTest { Map<String, String> variables = new HashMap<>(); setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete"); String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; String inUse = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "DELVI_vnfInUse"); @@ -112,7 +112,7 @@ public class DeleteVnfInfraTest extends WorkflowTest { Map<String, String> variables = new HashMap<>(); setVariables(variables, deleteVnfInfraRequestCascadeDelete, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); @@ -143,7 +143,7 @@ public class DeleteVnfInfraTest extends WorkflowTest { setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); @@ -177,7 +177,7 @@ public class DeleteVnfInfraTest extends WorkflowTest { setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java index f7cf3f480b..4161431297 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java @@ -187,7 +187,7 @@ public class ReplaceVnfInfraTest extends WorkflowTest { WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
+ String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
//injectSDNCCallbacks(callbacks, "deactivate");
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java index 7a43bbd771..80a4518599 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java @@ -99,7 +99,7 @@ public class UpdateNetworkInstanceTest extends WorkflowTest { System.out.println("----------------------------------------------------------"); System.out.println("- got workflow response -"); System.out.println("----------------------------------------------------------"); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); @@ -146,7 +146,7 @@ public class UpdateNetworkInstanceTest extends WorkflowTest { Map<String, String> variables = setupVariablesVIPER1(); //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); @@ -196,7 +196,7 @@ public class UpdateNetworkInstanceTest extends WorkflowTest { Map<String, String> variables = setupVariablesMissingNetworkId(); //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest")); @@ -260,7 +260,7 @@ public class UpdateNetworkInstanceTest extends WorkflowTest { Map<String, String> variables = setupVariablesVID1(); //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest")); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java index 37c548abf7..63cf62d17d 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java @@ -101,7 +101,7 @@ public class UpdateVfModuleInfraTest extends WorkflowTest { WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
+ String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
injectSDNCCallbacks(callbacks, "changeassign, query");
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java index b24eb56058..91327b087e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java @@ -84,7 +84,7 @@ public class UpdateVfModuleVolumeInfraV1Test extends WorkflowTest { TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
+ String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
@@ -130,7 +130,7 @@ public class UpdateVfModuleVolumeInfraV1Test extends WorkflowTest { TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
+ String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java index 36e9f2bfac..5ab1a04809 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java @@ -137,7 +137,7 @@ public class UpdateVnfInfraTest extends WorkflowTest { WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
+ String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
injectSDNCCallbacks(callbacks, "changeassign, query");
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java index 1a1e37714a..aca60026dc 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java @@ -117,7 +117,7 @@ public class VnfConfigUpdateTest extends WorkflowTest { WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); // TODO add appropriate assertions diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java index 17c48191c3..7d8a7e1856 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java @@ -132,7 +132,7 @@ public class VnfInPlaceUpdateTest extends WorkflowTest { WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - String responseBody = response.getResponse(); + String responseBody = response.getContent(); System.out.println("Workflow (Synch) Response:\n" + responseBody); // TODO add appropriate assertions diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java new file mode 100644 index 0000000000..1799e7fcbc --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.pnf.delegate; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Before; +import org.junit.Test; + +public class PnfCheckInputsTest { + + private PnfCheckInputs delegate; + + @Before + public void setUp() throws Exception { + delegate = new PnfCheckInputs(); + } + + private DelegateExecution mockDelegateExecution() { + DelegateExecution delegateExecution = mock(DelegateExecution.class); + when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); + return delegateExecution; + } + + @Test + public void shouldThrowException_whenPnfIdNotSet() throws Exception { + // given + DelegateExecution delegateExecution = mockDelegateExecution(); + // when, then + assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + + private DelegateExecution mockDelegateExecutionWithCorrelationId() { + DelegateExecution delegateExecution = mockDelegateExecution(); + when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId"); + return delegateExecution; + } + + @Test + public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() throws Exception { + // given + DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); + // when, then + assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + + @Test + public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() throws Exception { + // given + String defaultTimeout = "T1D"; + delegate.setDefaultTimeout(defaultTimeout); + DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); + // when + delegate.execute(delegateExecution); + // then + verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(defaultTimeout)); + } +}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfGet.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfGet.json new file mode 100644 index 0000000000..09d7758f04 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfGet.json @@ -0,0 +1,9 @@ +{
+ "vnf-id": "msoVnf123",
+ "vnf-name": "MSO-Test-VNF-123",
+ "vnf-type": "vnf-type",
+ "orchestration-status": "active",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1525360206136"
+}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml index 6dc3bbf880..980a0b1186 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml @@ -62,4 +62,9 @@ </bean> <bean id="dmaapClient" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.DmaapClientTestImpl"/> + + + <bean id="pnfCheckInputs" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.PnfCheckInputs"> + <property name="defaultTimeout" value="PT1S"/> + </bean> </beans> diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java index 1304fc24a7..85f9753634 100644 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java @@ -60,14 +60,15 @@ public class URNResource extends AbstractCockpitPluginResource{ public List<URNData> getUrnDataMap()
{
List<URNData> list = new ArrayList();
-
+ PreparedStatement psData = null;
+ ResultSet r = null;
try {
conn = getDBConnection();
- PreparedStatement psData = conn
+ psData = conn
.prepareStatement("select * from MSO_URN_MAPPING order by NAME_");
- ResultSet r = psData.executeQuery();
+ r = psData.executeQuery();
while(r.next())
{
@@ -78,14 +79,15 @@ public class URNResource extends AbstractCockpitPluginResource{ list.add(d);
}
-
- psData.close();
- conn.close();
} catch (Exception e)
{
e.printStackTrace();
+ } finally {
+ try { r.close(); } catch (Exception e) { /* ignored */ }
+ try { psData.close(); } catch (Exception e) { /* ignored */ }
+ try { conn.close(); } catch (Exception e) { /* ignored */ }
}
for(URNData d: list)
@@ -158,24 +160,26 @@ public class URNResource extends AbstractCockpitPluginResource{ nRow.setVer_("1");
final String myKey = key_;
final String myValue = value_;
-
+
+ PreparedStatement psData = null;
msoLogger.debug("----------- START ----------------------");
try {
conn = getDBConnection();
- PreparedStatement psData = conn
+ psData = conn
.prepareStatement("Insert into MSO_URN_MAPPING values ('" + key_ + "', '" + value_ + "', '1')");
psData.executeUpdate();
- psData.close();
- conn.close();
//}
} catch (Exception e)
{
e.printStackTrace();
+ } finally {
+ try { psData.close(); } catch (Exception e) { /* ignored */ }
+ try { conn.close(); } catch (Exception e) { /* ignored */ }
}
// getQueryService().executeQuery("cockpit.urnMap.insertNewRow", nRow, URNData.class);
}
@@ -184,21 +188,22 @@ public class URNResource extends AbstractCockpitPluginResource{ public void getPersistData(URNData d) {
//getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.class);
-
+ PreparedStatement psData = null;
try {
conn = getDBConnection();
- PreparedStatement psData = conn
+ psData = conn
.prepareStatement("UPDATE MSO_URN_MAPPING set VALUE_ ='"+ d.getURNValue() + "' WHERE NAME_='" + d.getURNName() + "'");
psData.executeUpdate();
- psData.close();
- conn.close();
} catch (Exception e)
{
e.printStackTrace();
+ } finally {
+ try { psData.close(); } catch (Exception e) { /* ignored */ }
+ try { conn.close(); } catch (Exception e) { /* ignored */ }
}
}
diff --git a/common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.java b/common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.java new file mode 100644 index 0000000000..95f72c4dd4 --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.utils; + +import java.io.IOException; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * A JSON deserializer that ignores the root element if it is present. + */ +public class RootIgnoringJsonDeserializer<T> extends JsonDeserializer<T> { + + private final ObjectMapper mapper = new ObjectMapper(); + private final Class<T> clazz; + private final String jsonRootName; + + public RootIgnoringJsonDeserializer(Class<T> clazz) { + this.clazz = clazz; + + JsonRootName annotation = clazz.getAnnotation(JsonRootName.class); + + if (annotation == null || annotation.value() == null || annotation.value().equals("")) { + jsonRootName = clazz.getSimpleName(); + } else { + jsonRootName = annotation.value(); + } + } + + @Override + public T deserialize(JsonParser jp, DeserializationContext dc) + throws IOException, JsonProcessingException { + JsonNode rootNode = jp.getCodec().readTree(jp); + Map.Entry<String,JsonNode> field = rootNode.fields().next(); + + if (jsonRootName.equals(field.getKey())) { + rootNode = field.getValue(); + } + + return mapper.convertValue(rootNode, clazz); + } +}
\ No newline at end of file diff --git a/common/src/main/java/org/openecomp/mso/utils/RootIgnoringObjectMapper.java b/common/src/main/java/org/openecomp/mso/utils/RootIgnoringObjectMapper.java new file mode 100644 index 0000000000..6f3c5b7d99 --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/utils/RootIgnoringObjectMapper.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.utils; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; + +/** + * An ObjectMapper for a specific class that ignores the root element + * if it is present. + */ +public class RootIgnoringObjectMapper<T> extends ObjectMapper { + + private static final long serialVersionUID = 6812584067195377395L; + + public RootIgnoringObjectMapper(Class<T> clazz) { + SimpleModule module = new SimpleModule(); + module.addDeserializer(clazz, new RootIgnoringJsonDeserializer<T>(clazz)); + registerModule(module); + } +}
\ No newline at end of file diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java index 1122c90438..6ac7002101 100644 --- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java +++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java @@ -87,7 +87,7 @@ public class MsoLoggerTest { public final void cleanAuditLogFile() throws FileNotFoundException { URL url = this.getClass().getClassLoader().getResource("logback-test.xml"); String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) - + "/MSO/Test/auditjbo ss.server.name_IS_UNDEFINED.log"; + + "/MSO/Test/auditjbo.server.name_IS_UNDEFINED.log"; PrintWriter asdcConfigFileWriter = new PrintWriter(logFile); asdcConfigFileWriter.print(""); asdcConfigFileWriter.flush(); diff --git a/common/src/test/java/org/openecomp/mso/utils/RootIgnoringObjectMapperTest.java b/common/src/test/java/org/openecomp/mso/utils/RootIgnoringObjectMapperTest.java new file mode 100644 index 0000000000..1c7e845f16 --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/utils/RootIgnoringObjectMapperTest.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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========================================================= + */ + +package org.openecomp.mso.utils; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class RootIgnoringObjectMapperTest { + + @Test + public void someObjectWithoutRootTest() throws Exception { + ObjectMapper mapper = new RootIgnoringObjectMapper<SomeObject>(SomeObject.class); + + String content = "{" + + "\"attribute\":\"charm\"" + + "}"; + + SomeObject response = mapper.readValue(content, SomeObject.class); + assertEquals("SomeObject[attribute=charm]", response.toString()); + } + + @Test + public void someObjectWithRootTest() throws Exception { + ObjectMapper mapper = new RootIgnoringObjectMapper<SomeObject>(SomeObject.class); + + String content = "{\"SomeObject\":{" + + "\"attribute\":\"charm\"" + + "}}"; + + SomeObject response = mapper.readValue(content, SomeObject.class); + assertEquals("SomeObject[attribute=charm]", response.toString()); + } + + @Test + public void annotatedObjectWithoutRootTest() throws Exception { + ObjectMapper mapper = new RootIgnoringObjectMapper<AnnotatedObject>(AnnotatedObject.class); + + String content = "{" + + "\"attribute\":\"charm\"" + + "}"; + + AnnotatedObject response = mapper.readValue(content, AnnotatedObject.class); + assertEquals("AnnotatedObject[attribute=charm]", response.toString()); + } + + @Test + public void annotatedObjectWithRootTest() throws Exception { + ObjectMapper mapper = new RootIgnoringObjectMapper<AnnotatedObject>(AnnotatedObject.class); + + String content = "{\"annotated-object\":{" + + "\"attribute\":\"charm\"" + + "}}"; + + AnnotatedObject response = mapper.readValue(content, AnnotatedObject.class); + assertEquals("AnnotatedObject[attribute=charm]", response.toString()); + } + + public static class SomeObject { + + @JsonProperty("attribute") + private String attribute; + + public String toString() { + return getClass().getSimpleName() + "[attribute=" + attribute + "]"; + } + } + + @JsonRootName(value = "annotated-object") + public static class AnnotatedObject extends SomeObject { + } +}
\ No newline at end of file diff --git a/docs/SO_R1_Interface.rst b/docs/SO_R1_Interface.rst index df68005d80..8346e2b98c 100644 --- a/docs/SO_R1_Interface.rst +++ b/docs/SO_R1_Interface.rst @@ -197,6 +197,7 @@ Platform Object +-------------------------+------------------+-------------------------------------------------+ LineOfBusiness Object + +-------------------------+------------------+-------------------------------------------------+ |Attribute |Content |Description | +=========================+==================+=================================================+ @@ -1025,7 +1026,7 @@ Request Object +-------------------+---------+-----------+--------------------------+-------------------------------------------+ |Attribute |Qualifier|Cardinality|Content |Description | +===================+=========+===========+==========================+===========================================+ -|requestId |M |1 |String |Request Id | +|requestId |M |1 |String |Request Id. | +-------------------+---------+-----------+--------------------------+-------------------------------------------+ |startTime |M |1 |request Object |Start time. | +-------------------+---------+-----------+--------------------------+-------------------------------------------+ @@ -1767,50 +1768,37 @@ Request Body: Service Object -+----------------+------------------+-------------------------------------------------+ -|Attribute |Content |Description | -+================+==================+=================================================+ -|name |String |Service instance name. | -+----------------+------------------+-------------------------------------------------+ -|description |String |Service instance description | -+----------------+------------------+-------------------------------------------------+ -|serviceDef ID |String |The service invariantUUID. It is defined in SDC. | -+----------------+------------------+-------------------------------------------------+ -|templateId |String |The service Template UUID. It is defined in SDC. | -+----------------+------------------+-------------------------------------------------+ -|parameters |Parameter Object |Parameter Object | -+----------------+------------------+-------------------------------------------------+ - -Parameter Object - -+----------------------+------------------+-----------------------------------------------------+ -|Attribute |Content |Description | -+======================+==================+=====================================================+ -|globalSubscriberId |String |The subscriber id. It is defined in AAI | -+----------------------+------------------+-----------------------------------------------------+ -|subscriberName |String |The subscriber name. It is defined in AAI | -+----------------------+------------------+-----------------------------------------------------+ -|serviceType |String |The service type. It is defined in AAI | -+----------------------+------------------+-----------------------------------------------------+ -|templateName |String |The service Template name | -+----------------------+------------------+-----------------------------------------------------+ -|resources |Object |This field manages parameters of resources | -+----------------------+------------------+-----------------------------------------------------+ -|resourceName |String |The resource name | -+----------------------+------------------+-----------------------------------------------------+ -|resouceDefId |String |The resource invariantUUID. It is defined in SDC. | -+----------------------+------------------+-----------------------------------------------------+ -|resourceId |String |The resource UUID. It is defined in SDC. | -+----------------------+------------------+-----------------------------------------------------+ -|nsParameters |String |Parameters for current resource object. | -+----------------------+------------------+-----------------------------------------------------+ -|locationConstraints |String |The DC location info for each VNF of current service | -+----------------------+------------------+-----------------------------------------------------+ -|vnfProfileId |String |VNFD id | -+----------------------+------------------+-----------------------------------------------------+ -|additionalParamForNs |String |The parameter for current resource | -+----------------------+------------------+-----------------------------------------------------+ - ++------------------------------+-----------------+------------------------------------+ +|Attribute |Content |Description | ++==============================+=================+====================================+ +|modelName |String |Service instance name. | ++------------------------------+-----------------+------------------------------------+ +|description |String |Service instance description | ++------------------------------+-----------------+------------------------------------+ +|modelUUID |String |Model UUID | ++------------------------------+-----------------+------------------------------------+ +|modelInvariantUUID |String |Model Invariant UUID | ++------------------------------+-----------------+------------------------------------+ +|created |Timestamp |Cretaed Timestamp | ++------------------------------+-----------------+------------------------------------+ +|toscaCsarArtifactUUID |String |tosca Csar Artifact UUID | ++------------------------------+-----------------+------------------------------------+ +|modelVersion |String |Model Version | ++------------------------------+-----------------+------------------------------------+ +|category |String |category | ++------------------------------+-----------------+------------------------------------+ +|serviceType |String |service Type | ++------------------------------+-----------------+------------------------------------+ +|serviceRole |String |service Role | ++------------------------------+-----------------+------------------------------------+ +|environmentContext |String |environment Context | ++------------------------------+-----------------+------------------------------------+ +|workloadContext |String |workload Context | ++------------------------------+-----------------+------------------------------------+ +|recipes |Object |recipes | ++------------------------------+-----------------+------------------------------------+ +|serviceResourceCustomizations |Object |serviceResourceCustomizations | ++------------------------------+-----------------+------------------------------------+ Response: @@ -1983,6 +1971,10 @@ Request Parameters: +-------------------+---------+-----------+-------+-----------------------+ |service-type |M |1 |String |Service Type | +-------------------+---------+-----------+-------+-----------------------+ +|subscriber-name |O |1 |String |Subscriber name | ++-------------------+---------+-----------+-------+-----------------------+ +|subscriber-type |O |1 |String |Subscriber type | ++-------------------+---------+-----------+-------+-----------------------+ Response: @@ -2568,7 +2560,7 @@ https://developer.openstack.org/api-ref/compute/#create-server +--------------------+-----------------------------------------------------------------------------------------------------------------------+ |Interface Definition|Description | +====================+=======================================================================================================================+ -|URI |http://msb.onap.org/api/multicloud/v0/{cloud-owner}_{cloud-region}/nova/v2.1/{tenant_id}/servers | +|URI |http://msb.onap.org/api/multicloud/v0/{cloud-owner}_{cloud-region}/nova/v2.37/{tenant_id}/servers | +--------------------+-----------------------------------------------------------------------------------------------------------------------+ |Operation Type |POST | +--------------------+-----------------------------------------------------------------------------------------------------------------------+ @@ -2652,6 +2644,8 @@ Response: +-------------------------+------------------+------------------------------------------------------------------------------+ |Attribute |Content |Description | +=========================+==================+==============================================================================+ +|Location |String |The location URL of the server. | ++-------------------------+------------------+------------------------------------------------------------------------------+ |server |object |A server object. | +-------------------------+------------------+------------------------------------------------------------------------------+ |id |String |The UUID of the server. | @@ -2820,6 +2814,10 @@ Request Body: +----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ |description |O |1 |string |A human-readable description for the resource. | +----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ +|is_default |O |1 |boolean |The network is default or not. | ++----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ +|availability_zone_hints |O |1 |array |The availability zone candidate for the network. | ++----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ Response: @@ -2834,10 +2832,16 @@ Response: +-----------------------------+------------------+------------------------------------------------------------------------------+ |availability_zones |array |The availability zone for the network. | +-----------------------------+------------------+------------------------------------------------------------------------------+ +|created_at |String |Time at which the resource has been created (in UTC ISO8601 format). | ++-----------------------------+------------------+------------------------------------------------------------------------------+ |dns_domain |String |A valid DNS domain. | +-----------------------------+------------------+------------------------------------------------------------------------------+ |id |String |The ID of the network. | +-----------------------------+------------------+------------------------------------------------------------------------------+ +|ipv4_address_scope |String |The ID of the IPv4 address scope that the network is associated with. | ++-----------------------------+------------------+------------------------------------------------------------------------------+ +|ipv6_address_scope |String |The ID of the IPv6 address scope that the network is associated with. | ++-----------------------------+------------------+------------------------------------------------------------------------------+ |mtu |integer |The maximum transmission unit (MTU) value to address fragmentation. | +-----------------------------+------------------+------------------------------------------------------------------------------+ |name |String |Human-readable name of the network. | @@ -2868,10 +2872,14 @@ Response: +-----------------------------+------------------+------------------------------------------------------------------------------+ |tenant_id |String |The ID of the project. | +-----------------------------+------------------+------------------------------------------------------------------------------+ +|updated_at |String |Time at which the resource has been updated (in UTC ISO8601 format). | ++-----------------------------+------------------+------------------------------------------------------------------------------+ |vlan_transparent |boolean |Indicates the VLAN transparency mode of the network. | +-----------------------------+------------------+------------------------------------------------------------------------------+ |description |String |A human-readable description for the resource. | +-----------------------------+------------------+------------------------------------------------------------------------------+ +|is_default |boolean |The network is default pool or not. | ++-----------------------------+------------------+------------------------------------------------------------------------------+ Delete Network +++++++++++++++ @@ -2893,7 +2901,7 @@ Request Body: +----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+ |Attribute |Qualifier|Cardinality|Content |Description | +============================+=========+===========+==========================+==============================================================+ -|network_id |M |1 |Object |The ID of the network. | +|network_id |M |1 |String |The ID of the network. | +----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+ Create Subnet @@ -2952,6 +2960,8 @@ Request Body: +----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ |use_default_subnetpool |O |1 |boolean |Whether to allocate this subnet from the default subnet pool. | +----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ +|service_types |O |1 |array |The service types associated with the subnet. | ++----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ Response: @@ -3082,6 +3092,8 @@ Request Body: +----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ |project_id |O |1 |string |The ID of the project that owns the resource. | +----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ +|qos_policy_id |O |1 |string |QoS policy associated with the port. | ++----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ |security_groups |O |1 |array |The IDs of security groups applied to the port. | +----------------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ |tenant_id |O |1 |string |The ID of the project that owns the resource. | @@ -3130,6 +3142,8 @@ Response: +-----------------------------+------------------+------------------------------------------------------------------------------+ |id |string |The ID of the resource. | +-----------------------------+------------------+------------------------------------------------------------------------------+ +|ip_allocation |string |Indicates when ports use either deferred, immediate or no IP allocation (none)| ++-----------------------------+------------------+------------------------------------------------------------------------------+ |mac_address |string |The MAC address of the port. | +-----------------------------+------------------+------------------------------------------------------------------------------+ |name |string |Human-readable name of the resource. | @@ -3142,6 +3156,8 @@ Response: +-----------------------------+------------------+------------------------------------------------------------------------------+ |revision_number |integer |The revision number of the resource. | +-----------------------------+------------------+------------------------------------------------------------------------------+ +|qos_policy_id |string |The ID of the QoS policy associated with the port. | ++-----------------------------+------------------+------------------------------------------------------------------------------+ |security_groups |array |The IDs of security groups applied to the port. | +-----------------------------+------------------+------------------------------------------------------------------------------+ |status |string |The port status. Values are ACTIVE, DOWN, BUILD and ERROR. | @@ -3218,6 +3234,10 @@ Response: +-----------------------------+------------------+------------------------------------------------------------------------------+ |project_id |string |The ID of the project. | +-----------------------------+------------------+------------------------------------------------------------------------------+ +|created_at |string |Time at which the resource has been created (in UTC ISO8601 format). | ++-----------------------------+------------------+------------------------------------------------------------------------------+ +|updated_at |string |Time at which the resource has been updated (in UTC ISO8601 format). | ++-----------------------------+------------------+------------------------------------------------------------------------------+ |revision_number |integer |The revision number of the resource. | +-----------------------------+------------------+------------------------------------------------------------------------------+ |name |string |Human-readable name of the resource. | diff --git a/docs/release-notes.rst b/docs/release-notes.rst index a806fe3e9b..f05f9ce938 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -8,6 +8,59 @@ Service Orchestrator Release Notes The SO provides the highest level of service orchestration in the ONAP architecture. +Version: 1.2.2 +-------------- + +:Release Date: 2018-05-24 + +The Beijing release is the second release of the Service Orchestrator (SO) project. + +**New Features** +* Enhance Platform maturity by improving CLAMP maturity matrix see `Wiki <https://wiki.onap.org/display/DW/Beijing+Release+Platform+Maturity>`_. +* Manual scaling of network services and VNFs. +* Homing and placement capabiliities through OOF interaction. +* Ability to perform change management. +* Integrated to APPC +* Integrated to OOF +* Integrated to OOM + +Bug Fixes +--------- +The defects fixed in this release could be found `here<https://jira.onap.org/issues/?jql=project%20%3D%20SO%20AND%20affectedVersion%20%3D%20%22Beijing%20Release%22%20AND%20status%20%3D%20Closed%20>`_. + +**Known Issues** + +**Security Issues** +SO CII Badging details can be found `here<https://bestpractices.coreinfrastructure.org/en/projects/1702>`_. +The remaining security issues and their workarounds are captured `here <https://wiki.onap.org/pages/viewpage.action?pageId=28377799>`_. + +**Upgrade Notes** + +**Deprecation Notes** + + +Version: 1.1.2 +-------------- + +:Release Date: 2018-01-18 + +Bug Fixes +--------- +The key defects fixed in this release : + +- `SO-344 <https://jira.onap.org/browse/SO-344>`_ + Only pass one VNF to DoCreateVnfAndModules. + +- `SO-348 <https://jira.onap.org/browse/SO-348>`_ + Json Analyze Exception in PreProcessRequest. + +- `SO-352 <https://jira.onap.org/browse/SO-352>`_ + SO failed to create VNF - with error message: Internal Error Occurred in CreateVnfInfra QueryCatalogDB Process. + +- `SO-354 <https://jira.onap.org/browse/SO-354>`_ + Change the Service Type And Service Role + + Version: 1.1.1 -------------- diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java index 3c5c5ecb1d..64b7d86b59 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java @@ -20,53 +20,41 @@ package org.openecomp.mso.apihandler.camundabeans; +import java.util.Map; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +// This class must be 100% JSON-compatible with the BPMN WorkflowResponse class. +// TODO: BPMN and the API-H should use a common class. /** - * JavaBean JSON class for a "variables" which contains the xml payload that - * will be passed to the Camunda process - * + * A synchronous response from a workflow. */ - +@JsonRootName(value = "WorkflowResponse") public class CamundaResponse { - - @JsonProperty("response") - private String response; + + @JsonProperty("processInstanceId") + private String processInstanceId; + @JsonProperty("messageCode") private int messageCode; + @JsonProperty("message") private String message; - @JsonProperty("processInstanceID") - private String processInstanceID; - @JsonProperty("variables") - private String variables; - public String getProcessInstanceID() { - return processInstanceID; - } - - public void setProcessInstanceID(String processInstanceID) { - this.processInstanceID = processInstanceID; - } - - public String getVariables() { - return variables; - } - - public void setVariables(String variables) { - this.variables = variables; - } + @JsonProperty("variables") + private Map<String,String> variables; - public CamundaResponse() { - } + @JsonProperty("content") + private String content; - public String getResponse() { - return response; + public String getProcessInstanceId() { + return processInstanceId; } - public void setResponse(String response) { - this.response = response; + public void setProcessInstanceId(String processInstanceId) { + this.processInstanceId = processInstanceId; } public int getMessageCode() { @@ -85,13 +73,30 @@ public class CamundaResponse { this.message = message; } + public Map<String,String> getVariables() { + return variables; + } + + public void setVariables(Map<String,String> variables) { + this.variables = variables; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + @Override public String toString() { - return "CamundaResponse [response=" + response + ", messageCode=" - + messageCode + ", message=" + message + "]"; + return getClass().getSimpleName() + "[" + + "processInstanceId=" + processInstanceId + + ",messageCode=" + messageCode + + ",message=" + message + + ",variables=" + variables + + ",content=" + content + + "]"; } - - - - -} +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java index faa669133f..9f30e67897 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java @@ -34,7 +34,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; CommonConstants.REQUEST_ID_HEADER, CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE, CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE, - CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, + CommonConstants.CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE, CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE, CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE, @@ -55,7 +55,6 @@ public class CamundaVIDRequest { @JsonProperty(CommonConstants.REQUEST_ID_HEADER) private CamundaInput msoRequestId; - @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) private CamundaBooleanInput isBaseVfModule; @@ -68,6 +67,9 @@ public class CamundaVIDRequest { @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) private CamundaInput serviceInstanceId; + @JsonProperty(CommonConstants.CORRELATION_ID) + private CamundaInput correlationId; + @JsonProperty(CommonConstants.VNF_ID_VARIABLE) private CamundaInput vnfId; @@ -177,6 +179,16 @@ public class CamundaVIDRequest { this.serviceInstanceId = serviceInstanceId; } + @JsonProperty(CommonConstants.CORRELATION_ID) + public CamundaInput getCorrelationId() { + return correlationId; + } + + @JsonProperty(CommonConstants.CORRELATION_ID) + public void setCorrelationId(CamundaInput correlationId) { + this.correlationId = correlationId; + } + @JsonProperty(CommonConstants.VNF_ID_VARIABLE) public CamundaInput getVnfId() { return vnfId; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java index 1a086ac35c..85fe52f24c 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java @@ -85,14 +85,10 @@ public class BPELRestClient extends RequestClient { } @Override - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater params) { return null; } - + @Override public HttpResponse get() { return null; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java index 9cc89530c4..d03aaef258 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java @@ -20,13 +20,12 @@ package org.openecomp.mso.apihandler.common; - import java.io.IOException; import javax.xml.bind.DatatypeConverter; +import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.openecomp.mso.apihandler.camundabeans.CamundaBooleanInput; @@ -51,8 +50,7 @@ public class CamundaClient extends RequestClient{ @Override public HttpResponse post(String camundaReqXML, String requestId, - String requestTimeout, String schemaVersion, String serviceInstanceId, String action) - throws ClientProtocolException, IOException{ + String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException { HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); @@ -77,7 +75,7 @@ public class CamundaClient extends RequestClient{ } @Override - public HttpResponse post(String jsonReq) throws ClientProtocolException, IOException{ + public HttpResponse post(String jsonReq) throws IOException { HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); @@ -102,21 +100,13 @@ public class CamundaClient extends RequestClient{ } @Override - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException{ + public HttpResponse post(RequestClientParamater params) throws IOException { HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); - String jsonReq = wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, - serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId, - serviceType, vnfType, vfModuleType, networkType, requestDetails, recipeParamXsd); + String jsonReq = wrapVIDRequest(params); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); - String encryptedCredentials; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); @@ -128,12 +118,10 @@ public class CamundaClient extends RequestClient{ } } } - post.setEntity(input); - return client.execute(post); } - + @Override public HttpResponse get() { return null; @@ -150,8 +138,6 @@ public class CamundaClient extends RequestClient{ if(schemaVersion == null){ schemaVersion = ""; } - - try{ CamundaRequest camundaRequest = new CamundaRequest(); CamundaInput camundaInput = new CamundaInput(); @@ -183,52 +169,8 @@ public class CamundaClient extends RequestClient{ return jsonReq; } - private String wrapVIDRequest(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParams){ + private String wrapVIDRequest(RequestClientParamater requestClientParamater) { String jsonReq = null; - if(requestId == null){ - requestId =""; - } - if(requestAction == null){ - requestAction =""; - } - if(serviceInstanceId == null){ - serviceInstanceId =""; - } - if(vnfId == null){ - vnfId =""; - } - if(vfModuleId == null){ - vfModuleId =""; - } - if(volumeGroupId == null){ - volumeGroupId =""; - } - if(networkId == null){ - networkId =""; - } - if(configurationId == null){ - configurationId =""; - } - if(serviceType == null){ - serviceType =""; - } - if(vnfType == null){ - vnfType =""; - } - if(vfModuleType == null){ - vfModuleType =""; - } - if(networkType == null){ - networkType =""; - } - if(requestDetails == null){ - requestDetails =""; - } - try{ CamundaVIDRequest camundaRequest = new CamundaVIDRequest(); CamundaInput serviceInput = new CamundaInput(); @@ -238,6 +180,7 @@ public class CamundaClient extends RequestClient{ CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput(); CamundaInput requestActionInput = new CamundaInput(); CamundaInput serviceInstanceIdInput = new CamundaInput(); + CamundaInput correlationIdInput = new CamundaInput(); CamundaInput vnfIdInput = new CamundaInput(); CamundaInput vfModuleIdInput = new CamundaInput(); CamundaInput volumeGroupIdInput = new CamundaInput(); @@ -248,23 +191,23 @@ public class CamundaClient extends RequestClient{ CamundaInput vfModuleTypeInput = new CamundaInput(); CamundaInput networkTypeInput = new CamundaInput(); CamundaInput recipeParamsInput = new CamundaInput(); - host.setValue(parseURL()); - requestIdInput.setValue(requestId); - isBaseVfModuleInput.setValue(isBaseVfModule); - recipeTimeoutInput.setValue(recipeTimeout); - requestActionInput.setValue(requestAction); - serviceInstanceIdInput.setValue(serviceInstanceId); - vnfIdInput.setValue(vnfId); - vfModuleIdInput.setValue(vfModuleId); - volumeGroupIdInput.setValue(volumeGroupId); - networkIdInput.setValue(networkId); - configurationIdInput.setValue(configurationId); - serviceTypeInput.setValue(serviceType); - vnfTypeInput.setValue(vnfType); - vfModuleTypeInput.setValue(vfModuleType); - networkTypeInput.setValue(networkType); - recipeParamsInput.setValue(recipeParams); - serviceInput.setValue(requestDetails); + requestIdInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestId())); + isBaseVfModuleInput.setValue(requestClientParamater.isBaseVfModule()); + recipeTimeoutInput.setValue(requestClientParamater.getRecipeTimeout()); + requestActionInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestAction())); + serviceInstanceIdInput.setValue(StringUtils.defaultString(requestClientParamater.getServiceInstanceId())); + correlationIdInput.setValue(StringUtils.defaultString(requestClientParamater.getCorrelationId())); + vnfIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVnfId())); + vfModuleIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVfModuleId())); + volumeGroupIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVolumeGroupId())); + networkIdInput.setValue(StringUtils.defaultString(requestClientParamater.getNetworkId())); + configurationIdInput.setValue(StringUtils.defaultString(requestClientParamater.getConfigurationId())); + serviceTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getServiceType())); + vnfTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getVnfType())); + vfModuleTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getVfModuleType())); + networkTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getNetworkType())); + recipeParamsInput.setValue(requestClientParamater.getRecipeParamXsd()); + serviceInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestDetails())); camundaRequest.setServiceInput(serviceInput); camundaRequest.setHost(host); camundaRequest.setRequestId(requestIdInput); @@ -273,6 +216,7 @@ public class CamundaClient extends RequestClient{ camundaRequest.setRecipeTimeout(recipeTimeoutInput); camundaRequest.setRequestAction(requestActionInput); camundaRequest.setServiceInstanceId(serviceInstanceIdInput); + camundaRequest.setCorrelationId(correlationIdInput); camundaRequest.setVnfId(vnfIdInput); camundaRequest.setVfModuleId(vfModuleIdInput); camundaRequest.setVolumeGroupId(volumeGroupIdInput); @@ -306,5 +250,4 @@ public class CamundaClient extends RequestClient{ return host; } - } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java index 3941e1e5af..845b140348 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java @@ -25,7 +25,6 @@ import java.io.IOException; import javax.xml.bind.DatatypeConverter;
import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
@@ -39,8 +38,7 @@ public class CamundaTaskClient extends RequestClient{ }
@Override
- public HttpResponse post(String jsonReq)
- throws ClientProtocolException, IOException{
+ public HttpResponse post(String jsonReq) throws IOException{
HttpPost post = new HttpPost(url);
msoLogger.debug("Camunda Task url is: "+ url);
@@ -65,25 +63,18 @@ public class CamundaTaskClient extends RequestClient{ @Override
public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
- throws ClientProtocolException, IOException{
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action) {
msoLogger.debug("Method not supported");
return null;
}
-
+
@Override
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd)
- throws ClientProtocolException, IOException{
- msoLogger.debug("Method not supported");
+ public HttpResponse post(RequestClientParamater params) {
return null;
}
-
+
@Override
- public HttpResponse get() throws ClientProtocolException, IOException{
+ public HttpResponse get() throws IOException{
HttpGet get = new HttpGet(url);
msoLogger.debug("Camunda Task url is: "+ url);
String encryptedCredentials;
@@ -97,7 +88,6 @@ public class CamundaTaskClient extends RequestClient{ }
}
}
-
return client.execute(get);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java index 4dac998527..daa411a963 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java @@ -25,13 +25,11 @@ public final class CommonConstants { public static final String DEFAULT_BPEL_AUTH = "admin:admin"; public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - public static final String REQUEST_ID_HEADER = "mso-request-id"; public static final String REQUEST_TIMEOUT_HEADER = "mso-service-request-timeout"; public static final String SCHEMA_VERSION_HEADER = "mso-schema-version"; public static final String SERVICE_INSTANCE_ID_HEADER = "mso-service-instance-id"; public static final String ACTION_HEADER = "mso-action"; - public static final String CAMUNDA_SERVICE_INPUT = "bpmnRequest"; public static final String CAMUNDA_ROOT_INPUT = "variables"; public static final String CONTENT_TYPE_JSON= "application/json"; @@ -47,13 +45,12 @@ public final class CommonConstants { public static final int CAMUNDA = 1; public static final int CAMUNDATASK = 2; public static final String CAMUNDA_HOST = "host"; - public static final String SDNC_UUID_HEADER = "mso-sdnc-request-id"; - public static final String REQUEST_ID_VARIABLE = "requestId"; public static final String IS_BASE_VF_MODULE_VARIABLE = "isBaseVfModule"; public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout"; public static final String REQUEST_ACTION_VARIABLE = "requestAction"; public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId"; + public static final String CORRELATION_ID = "correlationId"; public static final String VNF_ID_VARIABLE = "vnfId"; public static final String VF_MODULE_ID_VARIABLE = "vfModuleId"; public static final String VOLUME_GROUP_ID_VARIABLE = "volumeGroupId"; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java index d702a63fda..ed5d076d8c 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java @@ -67,17 +67,11 @@ public abstract class RequestClient { public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws ClientProtocolException, IOException; - public abstract HttpResponse post(String request) throws ClientProtocolException, IOException; - - public abstract HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException; + public abstract HttpResponse post(String request) throws IOException; + + public abstract HttpResponse post(RequestClientParamater params) throws IOException; - public abstract HttpResponse get() - throws ClientProtocolException, IOException; + public abstract HttpResponse get() throws IOException; protected String getEncryptedPropValue (String prop, String defaultValue, String encryptionKey) { try { diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java new file mode 100644 index 0000000000..4db69199da --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java @@ -0,0 +1,242 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 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.apihandler.common; + +public class RequestClientParamater { + + private String requestId; + private boolean isBaseVfModule; + private int recipeTimeout; + private String requestAction; + private String serviceInstanceId; + private String correlationId; + private String vnfId; + private String vfModuleId; + private String volumeGroupId; + private String networkId; + private String configurationId; + private String serviceType; + private String vnfType; + private String vfModuleType; + private String networkType; + private String requestDetails; + private String recipeParamXsd; + + private RequestClientParamater(Builder builder) { + requestId = builder.requestId; + isBaseVfModule = builder.isBaseVfModule; + recipeTimeout = builder.recipeTimeout; + requestAction = builder.requestAction; + serviceInstanceId = builder.serviceInstanceId; + correlationId = builder.correlationId; + vnfId = builder.vnfId; + vfModuleId = builder.vfModuleId; + volumeGroupId = builder.volumeGroupId; + networkId = builder.networkId; + configurationId = builder.configurationId; + serviceType = builder.serviceType; + vnfType = builder.vnfType; + vfModuleType = builder.vfModuleType; + networkType = builder.networkType; + requestDetails = builder.requestDetails; + recipeParamXsd = builder.recipeParamXsd; + } + + public String getRequestId() { + return requestId; + } + + public boolean isBaseVfModule() { + return isBaseVfModule; + } + + public int getRecipeTimeout() { + return recipeTimeout; + } + + public String getRequestAction() { + return requestAction; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public String getCorrelationId() { + return correlationId; + } + + public String getVnfId() { + return vnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public String getNetworkId() { + return networkId; + } + + public String getConfigurationId() { + return configurationId; + } + + public String getServiceType() { + return serviceType; + } + + public String getVnfType() { + return vnfType; + } + + public String getVfModuleType() { + return vfModuleType; + } + + public String getNetworkType() { + return networkType; + } + + public String getRequestDetails() { + return requestDetails; + } + + public String getRecipeParamXsd() { + return recipeParamXsd; + } + + public static class Builder { + private String requestId; + private boolean isBaseVfModule; + private int recipeTimeout; + private String requestAction; + private String serviceInstanceId; + private String correlationId; + private String vnfId; + private String vfModuleId; + private String volumeGroupId; + private String networkId; + private String configurationId; + private String serviceType; + private String vnfType; + private String vfModuleType; + private String networkType; + private String requestDetails; + private String recipeParamXsd; + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Builder setBaseVfModule(boolean baseVfModule) { + isBaseVfModule = baseVfModule; + return this; + } + + public Builder setRecipeTimeout(int recipeTimeout) { + this.recipeTimeout = recipeTimeout; + return this; + } + + public Builder setRequestAction(String requestAction) { + this.requestAction = requestAction; + return this; + } + + public Builder setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + return this; + } + + public Builder setCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + public Builder setVnfId(String vnfId) { + this.vnfId = vnfId; + return this; + } + + public Builder setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + return this; + } + + public Builder setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + return this; + } + + public Builder setNetworkId(String networkId) { + this.networkId = networkId; + return this; + } + + public Builder setConfigurationId(String configurationId) { + this.configurationId = configurationId; + return this; + } + + public Builder setServiceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + public Builder setVnfType(String vnfType) { + this.vnfType = vnfType; + return this; + } + + public Builder setVfModuleType(String vfModuleType) { + this.vfModuleType = vfModuleType; + return this; + } + + public Builder setNetworkType(String networkType) { + this.networkType = networkType; + return this; + } + + public Builder setRequestDetails(String requestDetails) { + this.requestDetails = requestDetails; + return this; + } + + public Builder setRecipeParamXsd(String recipeParamXsd) { + this.recipeParamXsd = recipeParamXsd; + return this; + } + + public RequestClientParamater build(){ + return new RequestClientParamater(this); + } + } + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java index 732b7786b2..a8b8984343 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java @@ -27,21 +27,22 @@ import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.util.EntityUtils; -import com.fasterxml.jackson.databind.ObjectMapper; - import org.openecomp.mso.apihandler.camundabeans.CamundaResponse; -import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.utils.RootIgnoringObjectMapper; + +import com.fasterxml.jackson.databind.ObjectMapper; public class ResponseHandler { private CamundaResponse response; private int status; - private String responseBody=""; + private String content = ""; private HttpResponse httpResponse; private int type; private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - private static final String RESPONSE_BODY_MSG = "response body is: "; + private static final String RESPONSE_CONTENT_MSG = "response content is: "; public ResponseHandler(HttpResponse httpResponse, int type) { this.httpResponse = httpResponse; @@ -67,29 +68,31 @@ public class ResponseHandler { + @SuppressWarnings("unchecked") private void parseCamunda(){ try{ - HttpEntity entity = httpResponse.getEntity(); - responseBody = EntityUtils.toString(entity); - } catch (IOException e) { - msoLogger.debug("IOException getting Camunda response body", e); - } - - ObjectMapper mapper = new ObjectMapper(); - try { - response = mapper.readValue(responseBody, CamundaResponse.class); - } catch (IOException e) { - msoLogger.debug("IOException getting Camunda response body", e); - } - msoLogger.debug("json response is: " + responseBody); - if(response!=null){ - responseBody = response.getResponse(); - } - msoLogger.debug(RESPONSE_BODY_MSG + responseBody); - - + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity); + } catch (IOException e) { + msoLogger.debug("IOException getting Camunda response content", e); + } + + ObjectMapper mapper = new RootIgnoringObjectMapper<CamundaResponse>(CamundaResponse.class); + + try { + response = mapper.readValue(content, CamundaResponse.class); + } catch (IOException e) { + msoLogger.debug("IOException getting Camunda response content", e); + } + msoLogger.debug("json response is: " + content); + if(response!=null){ + content = response.getContent(); + } + msoLogger.debug(RESPONSE_CONTENT_MSG + content); + + if(status!=HttpStatus.SC_ACCEPTED){ - msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "Camunda", String.valueOf(status), responseBody, "Camunda", "parseCamunda", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda"); + msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "Camunda", String.valueOf(status), content, "Camunda", "parseCamunda", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda"); } } @@ -99,16 +102,16 @@ public class ResponseHandler { try { if (bpelEntity!=null) { - responseBody = EntityUtils.toString(bpelEntity); - msoLogger.debug(RESPONSE_BODY_MSG + responseBody); + content = EntityUtils.toString(bpelEntity); + msoLogger.debug(RESPONSE_CONTENT_MSG + content); } if(status!=HttpStatus.SC_ACCEPTED){ - msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "BPEL", String.valueOf(status), responseBody, "BPEL", "parseBpel", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from BPEL"); + msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "BPEL", String.valueOf(status), content, "BPEL", "parseBpel", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from BPEL"); } } catch (IOException e) { - msoLogger.debug("IOException getting BPEL response body", e); + msoLogger.debug("IOException getting BPEL response content", e); } } @@ -118,16 +121,16 @@ public class ResponseHandler { try { if (camundataskEntity!=null) { - responseBody = EntityUtils.toString(camundataskEntity); - msoLogger.debug(RESPONSE_BODY_MSG + responseBody); + content = EntityUtils.toString(camundataskEntity); + msoLogger.debug(RESPONSE_CONTENT_MSG + content); } if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){ - msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "CAMUNDATASK", String.valueOf(status), responseBody, "CAMUNDATASK", "parseCamundaTask", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda Task"); + msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "CAMUNDATASK", String.valueOf(status), content, "CAMUNDATASK", "parseCamundaTask", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda Task"); } } catch (IOException e) { - msoLogger.debug("IOException getting Camunda Task response body", e); + msoLogger.debug("IOException getting Camunda Task response content", e); } } @@ -175,18 +178,17 @@ public class ResponseHandler { } - public String getResponseBody() { - return responseBody; + public String getContent() { + return content; } - public void setResponseBody(String responseBody) { - this.responseBody = responseBody; + public void setContent(String content) { + this.content = content; } public int getStatus() { return status; } - } diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java index 8bfc4ced76..69927e2126 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java @@ -24,7 +24,6 @@ package org.openecomp.mso.camunda.tests; import static org.junit.Assert.assertEquals; import java.io.IOException; -import java.util.UUID; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; @@ -42,12 +41,9 @@ import org.mockito.MockitoAnnotations; import org.openecomp.mso.apihandler.common.CommonConstants; import org.openecomp.mso.apihandler.common.RequestClient; import org.openecomp.mso.apihandler.common.RequestClientFactory; +import org.openecomp.mso.apihandler.common.RequestClientParamater; import org.openecomp.mso.properties.MsoJavaProperties; -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.JsonMappingException; - - /** * This class implements test methods of Camunda Beans. * @@ -66,8 +62,7 @@ public class CamundaClientTest { } @Test - public void tesCamundaPost() throws JsonGenerationException, - JsonMappingException, IOException { + public void tesCamundaPost() throws IOException { String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}"; HttpResponse mockResponse = createResponse(200, responseBody); @@ -106,8 +101,6 @@ public class CamundaClientTest { mockHttpClient = Mockito.mock(HttpClient.class); Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class))) .thenReturn(mockResponse); - - String reqXML = "<xml>test</xml>"; String orchestrationURI = "/engine-rest/process-definition/key/dummy/start"; MsoJavaProperties props = new MsoJavaProperties(); @@ -115,9 +108,7 @@ public class CamundaClientTest { RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props); requestClient.setClient(mockHttpClient); - HttpResponse response = requestClient.post("mso-req-id", false, 180, - "createInstance", "svc-inst-id", "vnf-id", "vf-module-id", "vg-id", "nw-id", "conf-id", "svc-type", - "vnf-type", "vf-module-type", "nw-type", "", ""); + HttpResponse response = requestClient.post(createParams()); assertEquals(requestClient.getType(), CommonConstants.CAMUNDA); assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK); } @@ -137,6 +128,15 @@ public class CamundaClientTest { return response; } + private RequestClientParamater createParams(){ + return new RequestClientParamater.Builder().setRequestId("mso-req-id").setBaseVfModule(false). + setRecipeTimeout(180).setRequestAction("createInstance").setServiceInstanceId("svc-inst-id"). + setVnfId("vnf-id").setVfModuleId("vf-module-id").setVolumeGroupId("vg-id").setNetworkId("nw-id"). + setConfigurationId("conf-id").setServiceType("svc-type").setVnfType("vnf-type"). + setVfModuleType("vf-module-type").setNetworkType("nw-type").setRequestDetails(""). + setRecipeParamXsd("").build(); + } + diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java index 9b36a984b1..7fc2815b4b 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java @@ -23,14 +23,10 @@ package org.openecomp.mso.camunda.tests; import static org.junit.Assert.assertEquals; -import java.io.IOException; - import org.junit.Test; import org.openecomp.mso.apihandler.camundabeans.CamundaResponse; +import org.openecomp.mso.utils.RootIgnoringObjectMapper; -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; /** @@ -41,19 +37,42 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class CamundaResponseTest { @Test - public final void testDeserialization() throws JsonGenerationException, - JsonMappingException, IOException { - ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally - mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - - String responseBody = "{ \"response\": \"<xml>xml</xml>\","+ - "\"messageCode\": 200,"+ - "\"message\": \"Successfully started the process\"," + - "\"processInstanceID\":null,\"variables\":null}"; - - CamundaResponse response = mapper.readValue(responseBody, CamundaResponse.class); - assertEquals(response.toString(), "CamundaResponse [response=<xml>xml</xml>, messageCode=200, message=Successfully started the process]"); + public final void testDeserializationWithoutRootElement() throws Exception { + + ObjectMapper mapper = new RootIgnoringObjectMapper<CamundaResponse>(CamundaResponse.class); + + String content = "{" + + "\"messageCode\":202" + + ",\"message\":\"Successfully started the process\"" + + ",\"content\":\"<xml>xml</xml>\"" + + ",\"processInstanceId\":\"4d3b3201a7ce\"" + + ",\"variables\":null" + + "}"; + CamundaResponse response = mapper.readValue(content, CamundaResponse.class); + + assertEquals( + "CamundaResponse[processInstanceId=4d3b3201a7ce,messageCode=202,message=Successfully started the process,variables=null,content=<xml>xml</xml>]", + response.toString()); } -} + @Test + public final void testDeserializationWithRootElement() throws Exception { + + ObjectMapper mapper = new RootIgnoringObjectMapper<CamundaResponse>(CamundaResponse.class); + + String content = "{\"WorkflowResponse\":{" + + "\"messageCode\":202" + + ",\"message\":\"Successfully started the process\"" + + ",\"content\":\"<xml>xml</xml>\"" + + ",\"processInstanceId\":\"4d3b3201a7ce\"" + + ",\"variables\":null" + + "}}"; + + CamundaResponse response = mapper.readValue(content, CamundaResponse.class); + + assertEquals( + "CamundaResponse[processInstanceId=4d3b3201a7ce,messageCode=202,message=Successfully started the process,variables=null,content=<xml>xml</xml>]", + response.toString()); + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java index d0031f3946..e04aba0ede 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java @@ -47,13 +47,15 @@ public class ResponseHandlerTest { @Test public void tesParseCamundaResponse () throws JsonGenerationException, JsonMappingException, IOException { - // String body - // ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}"; - String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 200," - + "\"message\": \"Successfully started the process\"}"; + String content = "{\"WorkflowResponse\":{" + + "\"messageCode\":202" + + ",\"message\":\"Successfully started the process\"" + + ",\"content\":\"<xml>xml</xml>\"" + + ",\"processInstanceId\":\"4d3b3201a7ce\"" + + "}}"; - HttpResponse response = createResponse (200, body, "application/json"); + HttpResponse response = createResponse (200, content, "application/json"); ResponseHandler respHandler = new ResponseHandler (response, 1); @@ -81,7 +83,7 @@ public class ResponseHandlerTest { int status = respHandler.getStatus (); assertEquals (status, HttpStatus.SC_ACCEPTED); - assertTrue (respHandler.getResponseBody () != null); + assertTrue (respHandler.getContent() != null); } @Test @@ -100,17 +102,21 @@ public class ResponseHandlerTest { @Test public void tesGenricErrorResponse () throws JsonGenerationException, JsonMappingException, IOException { - String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 500," - + "\"message\": \"Something went wrong\"}"; + String content = "{\"WorkflowResponse\":{" + + "\"messageCode\":500" + + ",\"message\":\"Something went wrong\"" + + ",\"content\":\"<xml>xml</xml>\"" + + ",\"processInstanceId\":\"4d3b3201a7ce\"" + + "}}"; - HttpResponse response = createResponse (500, body, "application/json"); + HttpResponse response = createResponse (500, content, "application/json"); ResponseHandler respHandler = new ResponseHandler (response, 1); int status = respHandler.getStatus (); assertEquals (HttpStatus.SC_BAD_GATEWAY, status); assertEquals (respHandler.getResponse ().getMessage (), "Something went wrong"); - System.out.println (respHandler.getResponseBody ()); + System.out.println (respHandler.getContent()); } 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 ccaf954aa1..dca2069cec 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 @@ -43,6 +43,7 @@ import org.json.JSONObject; import org.openecomp.mso.apihandler.common.ErrorNumbers; import org.openecomp.mso.apihandler.common.RequestClient; import org.openecomp.mso.apihandler.common.RequestClientFactory; +import org.openecomp.mso.apihandler.common.RequestClientParamater; import org.openecomp.mso.apihandler.common.ResponseHandler; import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.CompareModelsRequest; import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest; @@ -82,8 +83,6 @@ public class E2EServiceInstances { private ServiceInstancesRequest sir = null; public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: "; - public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB"; - public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine"; /** * POST Requests for E2E Service create Instance on a version provided @@ -228,7 +227,6 @@ public class E2EServiceInstances { // 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; @@ -239,14 +237,15 @@ public class E2EServiceInstances { 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); + RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). + setBaseVfModule(false).setRecipeTimeout(180).setRequestAction(action.name()). + setServiceInstanceId(instanceIdMap.get("serviceId")).setServiceType(e2eCompareModelReq.getServiceType()). + setRequestDetails(jjo.toString()).build(); + + response = requestClient.post(requestClientParamater); msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", workflowUrl, null); @@ -440,8 +439,6 @@ public class E2EServiceInstances { HttpResponse response = null; long subStartTime = System.currentTimeMillis(); - // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON); - try { requestClient = RequestClientFactory.getRequestClient( recipeLookupResult.getOrchestrationURI(), @@ -449,19 +446,16 @@ public class E2EServiceInstances { JSONObject jjo = new JSONObject(requestJSON); jjo.put("operationId", UUIDChecker.generateUUID(msoLogger)); - - 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 serviceInstanceType = e2eDelReq.getServiceType(); - response = requestClient.post(requestId, false, - recipeLookupResult.getRecipeTimeout(), action.name(), - serviceId, null, null, null, null, null, serviceInstanceType, - null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd()); + + RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). + setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()). + setRequestAction(action.name()).setServiceType(e2eDelReq.getServiceType()). + setRequestDetails(jjo.toString()).setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); + response = requestClient.post(requestClientParamater); msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, @@ -564,12 +558,6 @@ public class E2EServiceInstances { return response; } - //check for the current operation status -// Response resp = checkE2ESvcInstStatus(action, serviceId, startTime, msoRequest); -// if(resp != null && resp.getStatus() != 200) { -// return resp; -// } - CatalogDatabase db = null; RecipeLookupResult recipeLookupResult = null; try { @@ -615,18 +603,19 @@ public class E2EServiceInstances { HttpResponse response = null; long subStartTime = System.currentTimeMillis(); - String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON); - try { requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(), MsoPropertiesUtils.loadMsoProperties()); // Capture audit event msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); + RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). + setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()). + setServiceInstanceId(serviceId).setServiceType(serviceInstanceType). + setRequestDetails(mapReqJsonToSvcInstReq(e2eSir, requestJSON)). + setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); - response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(), - serviceId, null, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson, - recipeLookupResult.getRecipeParamXsd()); + response = requestClient.post(requestClientParamater); msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(), @@ -752,25 +741,23 @@ public class E2EServiceInstances { return response; } - String serviceInstanceType = e2eSir.getService().getServiceType(); - - String serviceId = ""; RequestClient requestClient = null; HttpResponse response = null; long subStartTime = System.currentTimeMillis(); - String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON); - try { requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(), MsoPropertiesUtils.loadMsoProperties()); // Capture audit event msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); + RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). + setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()). + setServiceInstanceId("").setServiceType(e2eSir.getService().getServiceType()). + setRequestDetails(mapReqJsonToSvcInstReq(e2eSir, requestJSON)). + setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); - response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(), - serviceId, null, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson, - recipeLookupResult.getRecipeParamXsd()); + response = requestClient.post(requestClientParamater); msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(), @@ -897,8 +884,6 @@ public class E2EServiceInstances { HttpResponse response = null; long subStartTime = System.currentTimeMillis(); - // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON); - try { requestClient = RequestClientFactory.getRequestClient( recipeLookupResult.getOrchestrationURI(), @@ -907,18 +892,18 @@ public class E2EServiceInstances { JSONObject jjo = new JSONObject(requestJSON); jjo.put("operationId", UUIDChecker.generateUUID(msoLogger)); - 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 serviceInstanceType = e2eScaleReq.getService().getServiceType(); - response = requestClient.post(requestId, false, - recipeLookupResult.getRecipeTimeout(), action.name(), - serviceId, null, null, null, null, null, serviceInstanceType, - null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd()); + RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). + setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()). + setServiceInstanceId(instanceIdMap.get("serviceId")). + setServiceType(e2eScaleReq.getService().getServiceType()). + setRequestDetails(jjo.toString()). + setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); + + response = requestClient.post(requestClientParamater); msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, @@ -985,7 +970,7 @@ public class E2EServiceInstances { HashMap<String, String> instanceIdMap) { // BPMN accepted the request, the request is in progress if (bpelStatus == HttpStatus.SC_ACCEPTED) { - String camundaJSONResponseBody = respHandler.getResponseBody(); + String camundaJSONResponseBody = respHandler.getContent(); msoLogger.debug("Received from Camunda: " + camundaJSONResponseBody); msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, @@ -996,7 +981,7 @@ public class E2EServiceInstances { } else { List<String> variables = new ArrayList<>(); variables.add(bpelStatus + ""); - String camundaJSONResponseBody = respHandler.getResponseBody(); + String camundaJSONResponseBody = respHandler.getContent(); if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty()) { Response resp = msoRequest.buildServiceErrorResponse( diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java index 2f2ef313f4..3f6cc35432 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java @@ -85,7 +85,6 @@ public class MsoRequest { private String requestId; private String requestXML; - private String requestJSON; private String requestUri; private VnfRequest vnfReq; private RequestInfo requestInfo; @@ -118,8 +117,6 @@ public class MsoRequest { private OwningEntity owningEntity; private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private static final String NOT_PROVIDED = "not provided"; - protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager (); MsoRequest (String requestId) { @@ -1153,7 +1150,7 @@ public class MsoRequest { mapper.setSerializationInclusion(Include.NON_NULL); //mapper.configure(Feature.WRAP_ROOT_VALUE, true); msoLogger.debug ("building sir from object " + sir); - requestJSON = mapper.writeValueAsString(sir); + String requestJSON = mapper.writeValueAsString(sir); // Perform mapping from VID-style modelInfo fields to ASDC-style modelInfo fields diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java index b809fc24c0..216a7ba43b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java @@ -37,6 +37,8 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import org.apache.http.HttpStatus; + +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import org.openecomp.mso.apihandler.common.ErrorNumbers; import org.openecomp.mso.logger.MessageEnum; @@ -300,7 +302,7 @@ public class OrchestrationRequests { Request request = new Request(); ObjectMapper mapper = new ObjectMapper(); - // mapper.configure(Feature.WRAP_ROOT_VALUE, true); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); request.setRequestId(requestDB.getRequestId()); request.setRequestScope(requestDB.getRequestScope()); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java index 7c3a3df0e2..581ad34939 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java @@ -20,6 +20,7 @@ */ package org.openecomp.mso.apihandlerinfra; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -42,6 +43,7 @@ import org.openecomp.mso.apihandler.common.CommonConstants; import org.openecomp.mso.apihandler.common.ErrorNumbers; import org.openecomp.mso.apihandler.common.RequestClient; import org.openecomp.mso.apihandler.common.RequestClientFactory; +import org.openecomp.mso.apihandler.common.RequestClientParamater; import org.openecomp.mso.apihandler.common.ResponseHandler; import org.openecomp.mso.apihandler.common.ValidationException; import org.openecomp.mso.serviceinstancebeans.ModelInfo; @@ -690,37 +692,7 @@ public class ServiceInstances { } db.close(); - - String serviceInstanceId = ""; - String vnfId = ""; - String vfModuleId = ""; - String volumeGroupId = ""; - String networkId = ""; - ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest(); - - if(siReq.getServiceInstanceId () != null){ - serviceInstanceId = siReq.getServiceInstanceId (); - } - - if(siReq.getVnfInstanceId () != null){ - vnfId = siReq.getVnfInstanceId (); - } - - if(siReq.getVfModuleInstanceId () != null){ - vfModuleId = siReq.getVfModuleInstanceId (); - } - - if(siReq.getVolumeGroupInstanceId () != null){ - volumeGroupId = siReq.getVolumeGroupInstanceId (); - } - - if(siReq.getNetworkInstanceId () != null){ - networkId = siReq.getNetworkInstanceId (); - } - - - requestId = msoRequest.getRequestId (); - msoLogger.debug ("requestId is: " + requestId); + msoLogger.debug ("requestId is: " + msoRequest.getRequestId()); msoLogger.debug ("About to insert a record"); try { @@ -736,15 +708,32 @@ public class ServiceInstances { return response; } - return postBPELRequest(action, requestId, startTime, msoRequest, recipeLookupResult.getOrchestrationURI(), recipeLookupResult.getRecipeTimeout(), - isBaseVfModule, serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, null, - msoRequest.getServiceInstanceType(), msoRequest.getVnfType(), msoRequest.getVfModuleType(), msoRequest.getNetworkType()); + return postBPELRequest(action, startTime, msoRequest, recipeLookupResult.getOrchestrationURI(), + recipeLookupResult.getRecipeTimeout(), isBaseVfModule); } - private Response postBPELRequest(Action action, String requestId, long startTime, MsoRequest msoRequest, - String orchestrationUri, int timeOut, Boolean isBaseVfModule, - String serviceInstanceId, String vnfId, String vfModuleId, String volumeGroupId, String networkId, - String configurationId, String serviceInstanceType, String vnfType, String vfModuleType, String networkType) { + private RequestClientParamater buildRequestClientParameter(MsoRequest msoRequest, boolean isBaseVfModule, + int timeOut, String requestAction) throws IOException { + return new RequestClientParamater.Builder(). + setRequestId(msoRequest.getRequestId()). + setBaseVfModule(isBaseVfModule).setRecipeTimeout(timeOut). + setRequestAction(requestAction). + setServiceInstanceId(msoRequest.getServiceInstancesRequest().getServiceInstanceId()). + setCorrelationId(msoRequest.getServiceInstancesRequest().getCorrelationId()). + setVnfId(msoRequest.getServiceInstancesRequest().getVnfInstanceId()). + setVfModuleId(msoRequest.getServiceInstancesRequest().getVfModuleInstanceId()). + setVolumeGroupId(msoRequest.getServiceInstancesRequest().getVolumeGroupInstanceId()). + setNetworkId(msoRequest.getServiceInstancesRequest().getNetworkInstanceId()). + setConfigurationId(msoRequest.getServiceInstancesRequest().getConfigurationId()). + setServiceType(msoRequest.getServiceInstanceType()). + setVnfType(msoRequest.getVnfType()). + setVfModuleType(msoRequest.getVfModuleType()). + setNetworkType(msoRequest.getNetworkType()). + setRequestDetails(msoRequest.getRequestJSON()).build(); + } + + private Response postBPELRequest(Action action, long startTime, MsoRequest msoRequest, + String orchestrationUri, int timeOut, Boolean isBaseVfModule) { RequestClient requestClient = null; HttpResponse response = null; long subStartTime = System.currentTimeMillis(); @@ -754,12 +743,7 @@ public class ServiceInstances { System.out.println("URL : " + requestClient.getUrl ()); - response = requestClient.post(requestId, isBaseVfModule, timeOut, action.name (), - serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId, - msoRequest.getServiceInstanceType (), - msoRequest.getVnfType (), msoRequest.getVfModuleType (), - msoRequest.getNetworkType (), msoRequest.getRequestJSON(), null); - + response = requestClient.post(buildRequestClientParameter(msoRequest, isBaseVfModule, timeOut, action.name())); msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationUri, null); } catch (Exception e) { msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationUri, null); @@ -798,7 +782,7 @@ public class ServiceInstances { // BPEL accepted the request, the request is in progress if (bpelStatus == HttpStatus.SC_ACCEPTED) { - String camundaJSONResponseBody = respHandler.getResponseBody (); + String camundaJSONResponseBody = respHandler.getContent(); msoLogger.debug ("Received from Camunda: " + camundaJSONResponseBody); msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS); (RequestsDatabase.getInstance()).updateInfraStatus (msoRequest.getRequestId (), @@ -811,7 +795,7 @@ public class ServiceInstances { } else { List<String> variables = new ArrayList<>(); variables.add(bpelStatus + ""); - String camundaJSONResponseBody = respHandler.getResponseBody (); + String camundaJSONResponseBody = respHandler.getContent(); if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) { msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, @@ -984,15 +968,15 @@ public class ServiceInstances { RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters(); if(reqParam!=null && reqParam.isaLaCarte()!=null && reqParam.isaLaCarte() && recipe==null){ return null; + } else if (recipe==null) { + //aLaCarte wasn't sent, so we'll try the default + serviceRecord = db.getServiceByModelName(defaultSourceServiceModelName); + if (serviceRecord == null) { + serviceRecord = db.getServiceByModelName(defaultServiceModelName); + } + recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name()); } - //aLaCarte wasn't sent, so we'll try the default - serviceRecord = db.getServiceByModelName(defaultSourceServiceModelName); - if (serviceRecord == null) { - serviceRecord = db.getServiceByModelName(defaultServiceModelName); - } - - recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name()); if(modelInfo.getModelVersionId() == null) { modelInfo.setModelVersionId(serviceRecord.getModelUUID()); } @@ -1191,7 +1175,6 @@ public class ServiceInstances { return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout()); } - private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; @@ -1299,18 +1282,6 @@ public class ServiceInstances { return response; } - - String serviceInstanceId = ""; - String configurationId = ""; - ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest(); - - if(siReq.getServiceInstanceId () != null){ - serviceInstanceId = siReq.getServiceInstanceId (); - } - - if(siReq.getConfigurationId() != null){ - configurationId = siReq.getConfigurationId(); - } requestId = msoRequest.getRequestId (); msoLogger.debug ("requestId is: " + requestId); @@ -1328,7 +1299,6 @@ public class ServiceInstances { return response; } - return postBPELRequest(action, requestId, startTime, msoRequest, orchestrationUri, Integer.parseInt(timeOut), false, - serviceInstanceId, null, null, null, null, configurationId, null, null, null, null); + return postBPELRequest(action, startTime, msoRequest, orchestrationUri, Integer.parseInt(timeOut), false); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java index 368807f9c9..9aac16aa4c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java @@ -176,7 +176,7 @@ public class TasksHandler { msoLogger.debug ("Received good response from Camunda"); msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request"); - String respBody = respHandler.getResponseBody(); + String respBody = respHandler.getContent(); if (respBody != null) { JSONArray data = new JSONArray(respBody); @@ -276,7 +276,7 @@ public class TasksHandler { msoLogger.debug ("Received good response from Camunda"); msoLogger.recordAuditEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request"); - String respBody = respHandler.getResponseBody(); + String respBody = respHandler.getContent(); if (respBody != null) { taskList = buildTaskList(taskId, respBody); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java index 4801811c41..ecbe97c637 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java @@ -281,10 +281,11 @@ public class CloudOrchestration { private CloudOrchestrationRequest convertJsonToCloudOrchestrationRequest(String requestJSON, Action action, long startTime, CloudOrchestrationRequest cor) throws Exception { + CloudOrchestrationRequest new_cor = null; try{ msoLogger.debug("Converting incoming JSON request to Object"); ObjectMapper mapper = new ObjectMapper(); - cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class); + new_cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class); } catch(Exception e){ msoLogger.debug ("Mapping of request to JSON object failed : ", e); if (getTenantIsolationRequest().getRequestId () != null) { @@ -295,7 +296,7 @@ public class CloudOrchestration { msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); throw new Exception(e); } - return cor; + return new_cor; } public TenantIsolationRequest getTenantIsolationRequest() { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java index f8caa54846..901e03fc17 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java @@ -40,12 +40,12 @@ import org.junit.Test; import org.openecomp.mso.apihandler.common.CamundaClient; import org.openecomp.mso.apihandler.common.RequestClient; import org.openecomp.mso.apihandler.common.RequestClientFactory; +import org.openecomp.mso.apihandler.common.RequestClientParamater; import org.openecomp.mso.apihandler.common.ValidationException; import org.openecomp.mso.db.AbstractSessionFactoryManager; import org.openecomp.mso.db.catalog.CatalogDatabase; import org.openecomp.mso.db.catalog.beans.Service; import org.openecomp.mso.db.catalog.beans.ServiceRecipe; -import org.openecomp.mso.properties.MsoDatabaseException; import org.openecomp.mso.properties.MsoJavaProperties; import org.openecomp.mso.properties.MsoPropertiesFactory; import org.openecomp.mso.requestsdb.OperationStatus; @@ -194,17 +194,12 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"success\",\"message\":\"success\"}"; + String body = "{\"content\":\"success\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); @@ -258,17 +253,12 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 500, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"success\",\"message\":\"success\"}"; + String body = "{\"content\":\"success\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); @@ -323,17 +313,12 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 500, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"\",\"message\":\"success\"}"; + String body = "{\"content\":\"\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); @@ -388,12 +373,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { HttpResponse resp = null; return resp; } @@ -625,16 +605,11 @@ public class E2EServiceInstancesTest { final MockUp<CamundaClient> mockCmaundaClient = new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 200, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"success\",\"message\":\"success\"}"; + String body = "{\"content\":\"success\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); @@ -822,17 +797,12 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"success\",\"message\":\"success\"}"; + String body = "{\"content\":\"success\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); @@ -888,17 +858,12 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"success\",\"message\":\"success\"}"; + String body = "{\"content\":\"success\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); @@ -955,17 +920,12 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"success\",\"message\":\"success\"}"; + String body = "{\"content\":\"success\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); @@ -1027,17 +987,12 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"success\",\"message\":\"success\"}"; + String body = "{\"content\":\"success\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); @@ -1093,17 +1048,12 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"success\",\"message\":\"success\"}"; + String body = "{\"content\":\"success\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); @@ -1160,12 +1110,7 @@ public class E2EServiceInstancesTest { MockUp<CamundaClient> client = new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) throws Exception { + public HttpResponse post(RequestClientParamater requestClientParamater) throws Exception { throw new Exception(); } }; @@ -1192,13 +1137,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException { - + public HttpResponse post(RequestClientParamater requestClientParamater) throws IOException { throw new ClientProtocolException(); } }; @@ -1216,18 +1155,12 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException { - + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "compareModelwithTargetVersion, test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"success\",\"message\":\"success\"}"; + String body = "{\"content\":\"success\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); @@ -1291,17 +1224,12 @@ public class E2EServiceInstancesTest { final MockUp<CamundaClient> mockCamundaClient = new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); - String body = "{\"response\":\"success\",\"message\":\"success\"}"; + String body = "{\"content\":\"success\",\"message\":\"success\"}"; InputStream instream = new ByteArrayInputStream(body.getBytes()); entity.setContent(instream); resp.setEntity(entity); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java index fa1cce462f..048efb1781 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java @@ -203,6 +203,7 @@ public class OrchestrationRequestsTest { throws JsonParseException, JsonMappingException, IOException, ValidationException {
ObjectMapper mapper = new ObjectMapper();
String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"ab1234\"}}}";
+ //String requestJSON = "{\"requestDetails\":{\"requestInfo\":{\"instanceName\":\"Vfmodule_vLB-0514-1\",\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"modelInfo\":{\"modelType\":\"vfModule\",\"modelInvariantId\":\"80d62376-2d6d-4618-b666-bf00d0e58296\",\"modelVersionId\":\"578b52e5-4572-444d-8de7-2c140ec2e6e5\",\"modelName\":\"Vloadbalancer..base_vlb..module-0\",\"modelVersion\":\"1\",\"modelCustomizationId\":\"bf87db73-2854-4cd1-adfd-8cd08e12befe\",\"modelCustomizationName\":\"Vloadbalancer..base_vlb..module-0\"},\"requestParameters\":{\"usePreload\":true},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"RegionOne\",\"tenantId\":\"ebb0ea7144004bacac1e39ff23105fa7\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceId\":\"60e28eb9-2808-4a5a-830f-ec982f01dcfe\",\"modelInfo\":{\"modelType\":\"service\",\"modelName\":\"vLoadBalancer\",\"modelInvariantId\":\"3f95e3ed-394d-4301-8c9b-c5f39ff89cfd\",\"modelVersion\":\"1.0\",\"modelVersionId\":\"da1b5347-7bcb-4cc4-8c29-d18dafdb1a47\"}}},{\"relatedInstance\":{\"instanceId\":\"338811a1-f7cd-4093-9903-d0f69b7cb176\",\"modelInfo\":{\"modelType\":\"vnf\",\"modelName\":\"vLoadBalancer\",\"modelInvariantId\":\"040740de-1ce8-4737-ad39-970684b0e3e8\",\"modelVersion\":\"1.0\",\"modelVersionId\":\"5fd1ce25-c414-4baf-903b-5042a60cfb02\",\"modelCustomizationId\":\"5801ace5-7cc7-4011-b677-165a0e8a2a27\",\"modelCustomizationName\":\"vLoadBalancer 0\"}}}]}}";
MsoRequest msoRequest = new MsoRequest("rq1234d1-5a33-55df-13ab-12abad84e333");
ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
@@ -222,6 +223,7 @@ public class OrchestrationRequestsTest { infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
infraRequests.setRequestStatus(Status.IN_PROGRESS.name());
infraRequests.setStartTime(Timestamp.valueOf(LocalDateTime.now()));
+ infraRequests.setRequestBody(requestJSON);
return infraRequests;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java index 28cb51aa70..938a1038a4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java @@ -21,6 +21,16 @@ package org.openecomp.mso.apihandlerinfra;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import javax.ws.rs.core.Response;
+import mockit.Mock;
+import mockit.MockUp;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.entity.BasicHttpEntity;
@@ -30,33 +40,23 @@ import org.hibernate.criterion.Order; import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-
-import javax.ws.rs.core.Response;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
import org.openecomp.mso.apihandler.common.CamundaClient;
import org.openecomp.mso.apihandler.common.RequestClient;
import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.apihandler.common.RequestClientParamater;
import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.*;
+import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
+import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
-import mockit.Mock;
-import mockit.MockUp;
-
public class ServiceInstanceTest {
/*** Create Service Instance Test Cases ***/
@@ -225,15 +225,11 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater) {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -295,15 +291,11 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater) {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -366,15 +358,11 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater) {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -437,11 +425,7 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater){
return null;
}
};
@@ -923,16 +907,12 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater) {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- final String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ final String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -1092,16 +1072,12 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- final String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ final String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
@@ -1143,16 +1119,12 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater) {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
- final String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ final String body = "{\"content\":\"success\",\"message\":\"success\"}";
InputStream instream = new ByteArrayInputStream(body.getBytes());
entity.setContent(instream);
resp.setEntity(entity);
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java index 4fb5ebc1f8..91c19dd97f 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java @@ -3826,6 +3826,22 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateAllottedResourceCustomization", null); } } + + public void saveVnfResource (VnfResource vnfResource) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save vnf Resource with Name " + vnfResource.getModelName()); + try { + VnfResource existing = this.getVnfResourceByModelUuid(vnfResource.getModelUuid()); + if (existing == null) { + this.getSession().save(vnfResource); + } else { + LOGGER.debug("Found existing vnfResource with this modelUuid - no need to save"); + } + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVnfResourceCustomization", null); + } + } public void saveNetworkResource (NetworkResource networkResource) throws RecordNotFoundException { long startTime = System.currentTimeMillis (); diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/resource_Extvl.csar b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/resource_Extvl.csar Binary files differindex 7976e51d14..b6281fc042 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/resource_Extvl.csar +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/resource_Extvl.csar diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service-ServiceFdnt-csar-0904-2.csar b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service-ServiceFdnt-csar-0904-2.csar Binary files differindex fc21af334d..daa270bb9f 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service-ServiceFdnt-csar-0904-2.csar +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service-ServiceFdnt-csar-0904-2.csar diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service-ServiceFdnt-with-allotted.csar b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service-ServiceFdnt-with-allotted.csar Binary files differindex 41ee2c7ce3..21b5f5e88a 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service-ServiceFdnt-with-allotted.csar +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service-ServiceFdnt-with-allotted.csar diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar Binary files differindex fa117c4ca5..6bbac7d3f1 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index abab75265a..5303ce366a 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -159,7 +159,9 @@ </image> <image> <name>openecomp/mso:%l</name> + <alias>onap/so:%1</alias> <alias>mso</alias> + <alias>so</alias> <build> <tags> <tag>${project.version}-STAGING-${maven.build.timestamp}</tag> |