use of org.onap.so.adapters.nwrest.UpdateNetworkResponse in project so by onap.
the class NetworkAdapterResourcesTest method updateNetworkTest.
@Test
public void updateNetworkTest() throws UnsupportedEncodingException, NetworkAdapterClientException {
doReturn(new UpdateNetworkRequest()).when(MOCK_networkAdapterObjectMapper).createNetworkUpdateRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(Customer.class));
doReturn(new UpdateNetworkResponse()).when(MOCK_networkAdapterClient).updateNetwork(isA(String.class), isA(UpdateNetworkRequest.class));
Optional<UpdateNetworkResponse> actualUpdateNetworkResponse = networkAdapterResources.updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer);
verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer);
verify(MOCK_networkAdapterClient, times(1)).updateNetwork(isA(String.class), isA(UpdateNetworkRequest.class));
assertNotNull(actualUpdateNetworkResponse);
}
use of org.onap.so.adapters.nwrest.UpdateNetworkResponse in project so by onap.
the class AAIUpdateTasksTest method updateNetworkUpdatedTest.
@Test
public void updateNetworkUpdatedTest() throws Exception {
UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse();
updateNetworkResponse.setNeutronNetworkId("testNeutronNetworkId");
HashMap<String, String> subnetMap = new HashMap<>();
subnetMap.put("testSubnetId", "testNeutronSubnetId");
updateNetworkResponse.setSubnetMap(subnetMap);
network.getSubnets().add(subnet);
execution.setVariable("updateNetworkResponse", updateNetworkResponse);
doNothing().when(aaiNetworkResources).updateNetwork(network);
doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
aaiUpdateTasks.updateNetworkUpdated(execution);
verify(aaiNetworkResources, times(1)).updateNetwork(network);
verify(aaiNetworkResources, times(1)).updateSubnet(network, subnet);
String neutronSubnetId = updateNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue();
assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId());
}
Aggregations