Search in sources :

Example 6 with RollbackNetworkRequest

use of org.onap.so.adapters.nwrest.RollbackNetworkRequest in project so by onap.

the class NetworkAdapterClientIT method rollbackNetworkTest.

@Test
public void rollbackNetworkTest() throws NetworkAdapterClientException, JsonProcessingException {
    RollbackNetworkRequest request = new RollbackNetworkRequest();
    NetworkRollback rollback = new NetworkRollback();
    rollback.setCloudId(TESTING_ID);
    request.setNetworkRollback(rollback);
    RollbackNetworkResponse mockResponse = new RollbackNetworkResponse();
    mockResponse.setNetworkRolledBack(true);
    wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
    RollbackNetworkResponse response = client.rollbackNetwork(AAI_NETWORK_ID, request);
    assertEquals("Testing DeleteVfModule response", true, response.getNetworkRolledBack());
}
Also used : RollbackNetworkResponse(org.onap.so.adapters.nwrest.RollbackNetworkResponse) NetworkRollback(org.onap.so.openstack.beans.NetworkRollback) RollbackNetworkRequest(org.onap.so.adapters.nwrest.RollbackNetworkRequest) BaseIntegrationTest(org.onap.so.BaseIntegrationTest) Test(org.junit.Test)

Example 7 with RollbackNetworkRequest

use of org.onap.so.adapters.nwrest.RollbackNetworkRequest in project so by onap.

the class NetworkAdapterResourcesTest method rollbackCreateNetworkTest.

@Test
public void rollbackCreateNetworkTest() throws Exception {
    String cloudRegionPo = "cloudRegionPo";
    RollbackNetworkResponse expectedRollbackNetworkResponse = new RollbackNetworkResponse();
    expectedRollbackNetworkResponse.setMessageId("messageId");
    expectedRollbackNetworkResponse.setNetworkRolledBack(true);
    RollbackNetworkRequest rollbackNetworkRequest = new RollbackNetworkRequest();
    rollbackNetworkRequest.setMessageId("messageId");
    RollbackNetworkResponse rollbackNetworkResponse = new RollbackNetworkResponse();
    rollbackNetworkResponse.setMessageId("messageId");
    rollbackNetworkResponse.setNetworkRolledBack(true);
    CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
    createNetworkResponse.setMessageId("messageId");
    doReturn(rollbackNetworkResponse).when(MOCK_networkAdapterClient).rollbackNetwork(isA(String.class), isA(RollbackNetworkRequest.class));
    doReturn(rollbackNetworkRequest).when(MOCK_networkAdapterObjectMapper).createNetworkRollbackRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(String.class), isA(CreateNetworkResponse.class));
    RollbackNetworkResponse actualRollbackCreateNetwrokResponse = (networkAdapterResources.rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse)).get();
    verify(MOCK_networkAdapterClient, times(1)).rollbackNetwork(l3Network.getNetworkId(), rollbackNetworkRequest);
    verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse);
    assertThat(expectedRollbackNetworkResponse, Matchers.sameBeanAs(actualRollbackCreateNetwrokResponse));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) RollbackNetworkResponse(org.onap.so.adapters.nwrest.RollbackNetworkResponse) CreateNetworkResponse(org.onap.so.adapters.nwrest.CreateNetworkResponse) RollbackNetworkRequest(org.onap.so.adapters.nwrest.RollbackNetworkRequest) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) Map(java.util.Map) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) Test(org.junit.Test)

Example 8 with RollbackNetworkRequest

use of org.onap.so.adapters.nwrest.RollbackNetworkRequest in project so by onap.

the class NetworkAdapterResources method rollbackCreateNetwork.

public Optional<RollbackNetworkResponse> rollbackCreateNetwork(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, CreateNetworkResponse createNetworkResponse) throws UnsupportedEncodingException, NetworkAdapterClientException {
    RollbackNetworkRequest rollbackNetworkRequest = null;
    rollbackNetworkRequest = networkAdapterObjectMapper.createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse);
    return Optional.of(networkAdapterClient.rollbackNetwork(l3Network.getNetworkId(), rollbackNetworkRequest));
}
Also used : RollbackNetworkRequest(org.onap.so.adapters.nwrest.RollbackNetworkRequest)

Aggregations

RollbackNetworkRequest (org.onap.so.adapters.nwrest.RollbackNetworkRequest)8 NetworkRollback (org.onap.so.openstack.beans.NetworkRollback)5 Test (org.junit.Test)4 StringReader (java.io.StringReader)2 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)2 CreateNetworkResponse (org.onap.so.adapters.nwrest.CreateNetworkResponse)2 RollbackNetworkResponse (org.onap.so.adapters.nwrest.RollbackNetworkResponse)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MutableBoolean (org.apache.commons.lang3.mutable.MutableBoolean)1 CreateNetworkRequest (org.onap.so.adapters.nwrest.CreateNetworkRequest)1 DeleteNetworkRequest (org.onap.so.adapters.nwrest.DeleteNetworkRequest)1 DeleteNetworkResponse (org.onap.so.adapters.nwrest.DeleteNetworkResponse)1 RollbackNetworkError (org.onap.so.adapters.nwrest.RollbackNetworkError)1 UpdateNetworkRequest (org.onap.so.adapters.nwrest.UpdateNetworkRequest)1 UpdateNetworkResponse (org.onap.so.adapters.nwrest.UpdateNetworkResponse)1 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)1 CreateVolumeGroupRequest (org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest)1 DeleteVfModuleRequest (org.onap.so.adapters.vnfrest.DeleteVfModuleRequest)1 DeleteVfModuleResponse (org.onap.so.adapters.vnfrest.DeleteVfModuleResponse)1