Search in sources :

Example 6 with NetworkRollback

use of org.onap.so.openstack.beans.NetworkRollback 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 NetworkRollback

use of org.onap.so.openstack.beans.NetworkRollback in project so by onap.

the class NetworkAdapterObjectMapper method buildNetworkRollback.

private NetworkRollback buildNetworkRollback(L3Network l3Network, CloudRegion cloudRegion, String cloudRegionPo, CreateNetworkResponse createNetworkResponse) {
    NetworkRollback networkRollback = new NetworkRollback();
    networkRollback.setNetworkId(l3Network.getNetworkId());
    networkRollback.setNeutronNetworkId(createNetworkResponse.getMessageId());
    networkRollback.setNetworkStackId(createNetworkResponse.getNetworkStackId());
    networkRollback.setTenantId(cloudRegion.getTenantId());
    networkRollback.setCloudId(cloudRegionPo);
    networkRollback.setNetworkType(l3Network.getNetworkType());
    ModelInfoNetwork modelInfoNetwork = l3Network.getModelInfoNetwork();
    if (modelInfoNetwork != null) {
        networkRollback.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID());
    }
    // rollback will only be called when network was actually created
    networkRollback.setNetworkCreated(createNetworkResponse.getNetworkCreated());
    // msoRequest
    return networkRollback;
}
Also used : NetworkRollback(org.onap.so.openstack.beans.NetworkRollback) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)

Aggregations

NetworkRollback (org.onap.so.openstack.beans.NetworkRollback)7 RollbackNetworkRequest (org.onap.so.adapters.nwrest.RollbackNetworkRequest)5 Test (org.junit.Test)3 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)2 StringReader (java.io.StringReader)1 CreateNetworkResponse (org.onap.so.adapters.nwrest.CreateNetworkResponse)1 RollbackNetworkError (org.onap.so.adapters.nwrest.RollbackNetworkError)1 RollbackNetworkResponse (org.onap.so.adapters.nwrest.RollbackNetworkResponse)1 ModelInfoNetwork (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)1