aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/test/java
diff options
context:
space:
mode:
authorBoslet, Cory <cory.boslet@att.com>2020-04-16 10:43:38 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-04-16 10:43:44 -0400
commitfa9a707c87654330dfb5788a6029b8199c6cdf17 (patch)
treeebd981e12166281957b47353a45b6b3c9b3ee490 /adapters/mso-openstack-adapters/src/test/java
parentb0f5ac59c297f81b7f17c1f367e64257ef7be2d2 (diff)
move network adapter to an external client task
Began impelenting new network external task. Made the vnfAdapterTask subflow an openstack subflow, refactored infra flows and BB to call it for network functions. Fixed bugs discovered through a robot dry run, added unit test, added support for rollback network request Updated junit test files for comparison due to not polling for response Removed the no longer used network adapter rest task from bpmn tasks Removed the unused network adapter async and its beans Removed network async client package from open pojo scan Issue-ID: SO-2813 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I4c25892012cc86659ab122448ed1aca5cab91671
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java')
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java269
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java364
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java2
6 files changed, 4 insertions, 638 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
index 5bafe2b1d6..d8e1e2a9a9 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
@@ -49,7 +49,6 @@ public class BeansTest {
@Test
public void pojoStructure() {
- test("org.onap.so.adapters.network.async.client");
test("org.onap.so.adapters.vnf.async.client");
test("org.onap.so.adapters.network");
test("org.onap.so.adapters.vnf");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java
deleted file mode 100644
index 00961a16b9..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.onap.so.adapters.network;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.patch;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static org.onap.so.bpmn.mock.StubOpenStack.getBodyFromFile;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreated_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackDeleteOrUpdateComplete_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessQueryNetwork;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import org.apache.http.HttpStatus;
-import org.junit.Test;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.beans.NetworkRollback;
-import org.onap.so.openstack.beans.Subnet;
-import org.springframework.beans.factory.annotation.Autowired;
-import com.github.tomakehurst.wiremock.WireMockServer;
-
-public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
- @Autowired
- MsoNetworkAdapterAsyncImpl impl;
-
- @Test
- public void healthCheckATest() {
- MsoNetworkAdapterAsyncImpl mNAAimpl = new MsoNetworkAdapterAsyncImpl();
- mNAAimpl.healthCheckA();
- }
-
- @Test
- public void rollbackNetworkATest() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
- .withRequestBody(containing("<completed>true</completed>"))
- .willReturn(aResponse().withBody(
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n"
- + " <soapenv:Header/>\n" + " <soapenv:Body>\n"
- + " <net:rollbackNetworkNotificationResponse>\n"
- + " </net:rollbackNetworkNotificationResponse>\n" + " </soapenv:Body>\n"
- + "</soapenv:Envelope>")
- .withStatus(HttpStatus.SC_OK)));
- NetworkRollback nrb = getNetworkRollback("mtn13");
- impl.rollbackNetworkA(nrb, "messageId", "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void rollbackNetworkATest_NotifyException() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(
- post(urlPathEqualTo("/notificationUrl")).withRequestBody(containing("<completed>true</completed>"))
- .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
- NetworkRollback nrb = getNetworkRollback("mtn13");
- impl.rollbackNetworkA(nrb, "messageId", "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- private NetworkRollback getNetworkRollback(String cloudId) {
- NetworkRollback nrb = new NetworkRollback();
- nrb.setCloudId(cloudId);
- nrb.setMsoRequest(new MsoRequest());
- nrb.setModelCustomizationUuid("3bdbb104-476c-483e-9f8b-c095b3d3068c");
- nrb.setNetworkCreated(true);
- nrb.setNetworkId("networkId");
- nrb.setNetworkName("networkName");
- nrb.setNetworkStackId("networkStackId");
- nrb.setNetworkType("networkType");
- nrb.setNeutronNetworkId("neutronNetworkId");
- nrb.setPhysicalNetwork("physicalNetwork");
- nrb.setTenantId("tenantId");
- nrb.setVlans(new ArrayList<>());
- return nrb;
- }
-
- @Test
- public void rollbackNetworkATestNetworkException() {
- NetworkRollback nrb = getNetworkRollback("cloudId");
-
- impl.rollbackNetworkA(nrb, "messageId", "http://localhost");
- }
-
- @Test
- public void noRollbackNetworkATest() {
- impl.rollbackNetworkA(null, "messageId", "http://localhost");
- }
-
-
- @Test
- public void deleteNetworkATest() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
- .withRequestBody(containing("<completed>true</completed>"))
- .willReturn(aResponse().withBody(
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n"
- + " <soapenv:Header/>\n" + " <soapenv:Body>\n"
- + " <net:deleteNetworkNotificationResponse>\n"
- + " </net:deleteNetworkNotificationResponse>\n" + " </soapenv:Body>\n"
- + "</soapenv:Envelope>")
- .withStatus(HttpStatus.SC_OK)));
- impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId", "messageId",
- new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void deleteNetworkATest_NotifyException() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(
- post(urlPathEqualTo("/notificationUrl")).withRequestBody(containing("<completed>true</completed>"))
- .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
- impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId", "messageId",
- new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void deleteNetworkATest_NetworkException() {
- impl.deleteNetworkA("cloudSiteId", "tenantId", "networkType", "modelCustomizationUuid", "networkId",
- "messageId", new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void updateNetworkATest() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
- "dvspg-VCE_VPE-mtjnj40avbc");
- mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json");
- mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer);
- wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
- .withRequestBody(containing("updateNetworkNotification"))
- .willReturn(aResponse().withBody(
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n"
- + " <soapenv:Header/>\n" + " <soapenv:Body>\n"
- + " <net:updateNetworkNotificationResponse>\n"
- + " </net:updateNetworkNotificationResponse>\n" + " </soapenv:Body>\n"
- + "</soapenv:Envelope>")
- .withStatus(HttpStatus.SC_OK)));
- HashMap<String, String> networkParams = new HashMap<String, String>();
- networkParams.put("shared", "true");
- networkParams.put("external", "false");
- impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "dvspg-VCE_VPE-mtjnj40avbc", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(),
- new ArrayList<Subnet>(), networkParams, "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void updateNetworkATest_NotifyExcpetion() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
- "dvspg-VCE_VPE-mtjnj40avbc");
- mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json");
- mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer);
- HashMap<String, String> networkParams = new HashMap<String, String>();
- networkParams.put("shared", "true");
- networkParams.put("external", "false");
- impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "dvspg-VCE_VPE-mtjnj40avbc", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(),
- new ArrayList<>(), networkParams, "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void updateNetworkATest_NetworkException() {
- impl.updateNetworkA("cloudSiteId", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "networkId", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(),
- new HashMap<String, String>(), "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void queryNetworkATest() throws IOException {
- mockOpenStackResponseAccessQueryNetwork(wireMockServer, wireMockPort);
- impl.queryNetworkA("mtn13", "tenantId", "networkId", "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void createNetworkATest() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
- .withRequestBody(containing("createNetworkNotification"))
- .willReturn(aResponse().withBody(
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n"
- + " <soapenv:Header/>\n" + " <soapenv:Body>\n"
- + " <net:createNetworkNotificationResponse>\n"
- + " </net:createNetworkNotificationResponse>\n" + " </soapenv:Body>\n"
- + "</soapenv:Envelope>")
- .withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreatedVUSP_200(wireMockServer);
- mockOpenStackPostStacks_200(wireMockServer);
- mockOpenStackPostStacks_200(wireMockServer);
- HashMap<String, String> networkParams = new HashMap<String, String>();
- impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false,
- false, new ArrayList<>(), networkParams, "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void createNetworkATest_NotifyException() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreatedVUSP_200(wireMockServer);
- mockOpenStackPostStacks_200(wireMockServer);
- HashMap<String, String> networkParams = new HashMap<String, String>();
- networkParams.put("shared", "true");
- networkParams.put("external", "false");
- impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false,
- false, new ArrayList<>(), networkParams, "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void createNetworkATest_NetworkException() {
- impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false,
- false, new ArrayList<>(), new HashMap<String, String>(), "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
deleted file mode 100644
index 412abeab3b..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network;
-
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.assertEquals;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeletePublicUrlStackByNameAndID_204;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetPublicUrlStackByNameAndID_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetPublicUrlStackByNameAndID_204;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackAppC_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedAppC_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVUSP_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostPublicUrlWithBodyFile_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPublicUrlStackByID_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPublicUrlStackByName_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.json.JSONException;
-import org.junit.Test;
-import org.onap.so.adapters.nwrest.CreateNetworkRequest;
-import org.onap.so.adapters.nwrest.CreateNetworkResponse;
-import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
-import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
-import org.onap.so.adapters.nwrest.QueryNetworkError;
-import org.onap.so.adapters.nwrest.QueryNetworkResponse;
-import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
-import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
-import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
-import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.onap.so.client.policy.JettisonStyleMapperProvider;
-import org.onap.so.entity.MsoRequest;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-
-public class NetworkAdapterRestTest extends BaseRestTestUtils {
-
- @Autowired
- private JettisonStyleMapperProvider jettisonTypeObjectMapper;
- private static final String CLOUDSITE_ID = "mtn13";
- private static final String TENANT_ID = "ba38bc24a2ef4fb2ad2810c894f1938f";
- private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b";
- private static final String NETWORK_TYPE = "CONTRAIL30_BASIC";
- private static final String MODEL_CUSTOMIZATION_UUID = "3bdbb104-476c-483e-9f8b-c095b3d308ac";
- private static final String MSO_SERVICE_INSTANCE_ID = "05869d5f-47df-4b45-bbfc-4f03ce0a50bf";
- private static final String MSO_REQUEST_ID = "requestId";
- private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0";
-
- @Test
- public void testCreateNetwork() throws JSONException, JsonParseException, JsonMappingException, IOException {
-
- CreateNetworkRequest request = new CreateNetworkRequest();
- request.setBackout(true);
- request.setSkipAAI(true);
- request.setFailIfExists(false);
- MsoRequest msoReq = new MsoRequest();
- String networkTechnology = "CONTRAIL";
-
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- request.setMsoRequest(msoReq);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setNetworkId(NETWORK_ID);
- request.setNetworkName(NETWORK_NAME);
- request.setNetworkType(NETWORK_TYPE);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setNetworkTechnology(networkTechnology);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
-
- mockOpenStackGetStackCreatedVUSP_200(wireMockServer);
-
- mockOpenStackGetStackVUSP_404(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<CreateNetworkRequest> entity = new HttpEntity<CreateNetworkRequest>(request, headers);
- ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
-
- CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateNetworkResponse.json"), CreateNetworkResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- }
-
- @Test
- public void testCreateNetwork_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException {
-
-
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
-
- mockOpenStackGetStackCreatedAppC_200(wireMockServer);
-
- mockOpenStackGetStackAppC_404(wireMockServer);
-
- headers.add("Content-Type", MediaType.APPLICATION_JSON);
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- String request = readJsonFileAsString("src/test/resources/CreateNetwork.json");
- HttpEntity<String> entity = new HttpEntity<String>(request, headers);
-
- ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
-
- CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateNetworkResponse2.json"), CreateNetworkResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- }
-
-
-
- @Test
- public void testDeleteNetwork() throws IOException {
-
- DeleteNetworkRequest request = new DeleteNetworkRequest();
-
- MsoRequest msoReq = new MsoRequest();
-
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- request.setMsoRequest(msoReq);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setNetworkId(NETWORK_ID);
- request.setNetworkType(NETWORK_TYPE);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setNetworkStackId(NETWORK_ID);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort);
-
- mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort);
-
- mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(request, headers);
-
- ResponseEntity<DeleteNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.DELETE,
- entity, DeleteNetworkResponse.class);
-
- DeleteNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/DeleteNetworkResponse.json"), DeleteNetworkResponse.class);
-
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
-
- }
-
- @Test
- public void testRollbackNetwork() throws IOException {
-
- RollbackNetworkRequest request = new RollbackNetworkRequest();
- MsoRequest msoReq = new MsoRequest();
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort);
-
- mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort);
-
- mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- HttpEntity<RollbackNetworkRequest> entity = new HttpEntity<>(request, headers);
-
- ResponseEntity<RollbackNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b/rollback"),
- HttpMethod.DELETE, entity, RollbackNetworkResponse.class);
-
- RollbackNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/RollbackNetworkResponse.json"), RollbackNetworkResponse.class);
-
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
-
- }
-
- @Test
- public void testQueryNetwork_Exception() throws IOException {
- MsoRequest msoReq = new MsoRequest();
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers);
-
- ResponseEntity<QueryNetworkError> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.GET,
- entity, QueryNetworkError.class);
-
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
-
- }
-
- @Test
- public void testQueryNetwork() throws IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackVfModule_200(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers);
-
- ResponseEntity<QueryNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b" + "?cloudSiteId="
- + CLOUDSITE_ID + "&tenantId=" + TENANT_ID + "&aaiNetworkId=aaiNetworkId"),
- HttpMethod.GET, entity, QueryNetworkResponse.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
-
- }
-
- @Test
- public void testUpdateNetwork() throws IOException {
-
- UpdateNetworkRequest request = new UpdateNetworkRequest();
-
- MsoRequest msoReq = new MsoRequest();
-
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- request.setMsoRequest(msoReq);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setNetworkId(NETWORK_ID);
- request.setNetworkName(NETWORK_NAME);
- request.setNetworkType(NETWORK_TYPE);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setNetworkStackId(NETWORK_ID);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPublicUrlStackByName_200(wireMockServer, wireMockPort);
-
- mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort);
-
- mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockServer, wireMockPort);
-
- mockOpenStackPutPublicUrlStackByNameAndID_200(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- HttpEntity<UpdateNetworkRequest> entity = new HttpEntity<UpdateNetworkRequest>(request, headers);
-
- ResponseEntity<UpdateNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.PUT,
- entity, UpdateNetworkResponse.class);
-
- UpdateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/UpdateNetworkResponse.json"), UpdateNetworkResponse.class);
-
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testCreateNetworkCNRC_JSON()
- throws JSONException, JsonParseException, JsonMappingException, IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
-
- mockOpenStackGetStackCreatedAppC_200(wireMockServer);
-
- mockOpenStackGetStackAppC_404(wireMockServer);
-
- headers.add("Content-Type", MediaType.APPLICATION_JSON);
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- String request = readJsonFileAsString("src/test/resources/CreateNetwork3.json");
- HttpEntity<String> entity = new HttpEntity<String>(request, headers);
-
- ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
-
- CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateNetworkResponse3.json"), CreateNetworkResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- }
-
- @Test
- public void testCreateNetworkNC_Shared_JSON()
- throws JSONException, JsonParseException, JsonMappingException, IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
-
- mockOpenStackGetStackCreatedAppC_200(wireMockServer);
-
- mockOpenStackGetStackAppC_404(wireMockServer);
-
- headers.add("Content-Type", MediaType.APPLICATION_JSON);
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- String request = readJsonFileAsString("src/test/resources/CreateNetwork4.json");
- HttpEntity<String> entity = new HttpEntity<String>(request, headers);
-
- ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
-
- CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateNetworkResponse4.json"), CreateNetworkResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- }
-
- @Override
- protected String readJsonFileAsString(String fileLocation)
- throws JsonParseException, JsonMappingException, IOException {
- return new String(Files.readAllBytes(Paths.get(fileLocation)));
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
index b5b0f5a8ef..8d5ab8234e 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
@@ -44,7 +44,7 @@ public class PollServiceTest {
String xmlString =
new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
- Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString);
+ Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(xmlString);
Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(false);
Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(Stack.class), eq("CREATE_IN_PROGRESS"), eq("regionOne"),
@@ -64,7 +64,7 @@ public class PollServiceTest {
String xmlString =
new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
- Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString);
+ Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(xmlString);
Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(true);
Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(), eq("DELETE_IN_PROGRESS"), eq("regionOne"),
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
index f7613909ec..1f68106f78 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
@@ -65,7 +65,7 @@ public class RollbackServiceTest {
Stack stack = new Stack();
stack.setId("heatId");
- Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload);
+ Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload);
Mockito.doNothing().when(vnfAdapterImpl).deleteVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any());
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
index 2f583b30a2..cc2dfa213e 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
@@ -64,7 +64,7 @@ public class StackServiceTest {
Stack stack = new Stack();
stack.setId("heatId");
- Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload);
+ Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload);
Mockito.doNothing().when(vnfAdapterImpl).createVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),