summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/test/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-24 17:06:39 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-24 17:13:01 -0500
commit7ab8e99936aa0dd72c8b0f54620bbfef8d7ec455 (patch)
tree7018cb258315e327f4817a7f01abe344426f4426 /adapters/mso-openstack-adapters/src/test/java
parent147e9ee814448c8bbec4aa3aeac4b7118b7c1bc7 (diff)
bugfixes jan 24th
Fix null pointer exception when no requestParameters are specified Add configurable timer in ActivateVfModuleBB to delay call to SDNC activate - Use raw slf4j logger - use {} formatting Add configurable timer in ActivateVfModuleBB to delay call to SDNC activate - Use raw slf4j logger Add configurable timer in ActivateVfModuleBB to delay call to SDNC activate - removed unused references in test class Add configurable timer in ActivateVfModuleBB to delay call to SDNC activate Update PortGroup objects separately from the parent VCE object - restore setVariable calls back into vce object - they might be needed later. Update PortGroup objects separately from the parent VCE object - updated test class extra call to get PortGroups Update PortGroup objects separately from the parent VCE object - use PortGroup.getInterfaceRole() getter method instead of accessing field directly. Update PortGroup objects separately from the parent VCE object Added back required headers for tenant isolation. removed workflow exception from outmapping in execute Fix possible null ptr exception, fix to add braces. Default networkTechnology in Update as done in Create Fix failing junits, mapper force upper case nwtech update exception builder to properly throw exception error message supporting assign service instance a la carte as well adding in proper exception handling in network rest v1 add the unassign action to R macro data file Change-Id: Ide420514f81b8083b4c76c762c064de199624cf7 Issue-ID: SO-1424 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java')
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java25
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java29
2 files changed, 47 insertions, 7 deletions
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
index 094d308221..f8dcddde04 100644
--- 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
@@ -25,10 +25,12 @@ 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 java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
@@ -184,8 +186,11 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
" </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<>(), "messageId",
+ "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<Subnet>(), networkParams, "messageId",
new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
}
@@ -199,14 +204,17 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_UpdateComplete.json");
mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200();
+ 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<>(), "messageId",
+ "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<>(), "messageId",
+ "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), new HashMap<String,String>(), "messageId",
new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
}
@@ -237,8 +245,10 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
.withStatus(HttpStatus.SC_OK)));
mockOpenStackGetStackCreatedVUSP_200();
mockOpenStackPostStacks_200();
+ mockOpenStackPostStacks_200();
+ 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<>(), "messageId",
+ "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), networkParams, "messageId",
new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
}
@@ -251,15 +261,18 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
.withStatus(HttpStatus.SC_OK)));
mockOpenStackGetStackCreatedVUSP_200();
mockOpenStackPostStacks_200();
+ 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<>(), "messageId",
+ "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<>(), "messageId",
+ "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
index 6123415b41..3910d9ec44 100644
--- 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
@@ -88,7 +88,7 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
request.setSkipAAI(true);
request.setFailIfExists(false);
MsoRequest msoReq = new MsoRequest();
- NetworkTechnology networkTechnology = NetworkTechnology.CONTRAIL;
+ String networkTechnology = "CONTRAIL";
msoReq.setRequestId(MSO_REQUEST_ID);
msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
@@ -296,6 +296,33 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
assertThat(response.getBody(), sameBeanAs(expectedResponse));
}
+ @Test
+ public void testCreateNetworkNC_Shared_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException {
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackPostPublicUrlWithBodyFile_200();
+
+ mockOpenStackGetStackCreatedAppC_200();
+
+ mockOpenStackGetStackAppC_404();
+
+ 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)));