use of org.onap.so.openstack.beans.NetworkRollback in project so by onap.
the class NetworkAdapterObjectMapper method createNetworkRollbackRequestMapper.
/**
* Access method to build Rollback Network Request
*
* @return
* @throws UnsupportedEncodingException
*/
public RollbackNetworkRequest createNetworkRollbackRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, CreateNetworkResponse createNetworkResponse) {
RollbackNetworkRequest rollbackNetworkRequest = new RollbackNetworkRequest();
rollbackNetworkRequest = setCommonRollbackRequestFields(rollbackNetworkRequest, requestContext);
NetworkRollback networkRollback = buildNetworkRollback(l3Network, cloudRegion, cloudRegionPo, createNetworkResponse);
rollbackNetworkRequest.setNetworkRollback(networkRollback);
return rollbackNetworkRequest;
}
use of org.onap.so.openstack.beans.NetworkRollback in project so by onap.
the class NetworkAdapterObjectMapperTest method createNetworkRollbackRequestMapperTest.
@Test
public void createNetworkRollbackRequestMapperTest() throws Exception {
String cloudRegionPo = "cloudRegionPo";
RollbackNetworkRequest expectedRollbackNetworkRequest = new RollbackNetworkRequest();
expectedRollbackNetworkRequest.setMessageId(requestContext.getMsoRequestId());
NetworkRollback networkRollback = new NetworkRollback();
networkRollback.setCloudId(cloudRegionPo);
networkRollback.setNetworkCreated(true);
networkRollback.setNetworkId(l3Network.getNetworkId());
networkRollback.setNetworkType(l3Network.getNetworkType());
networkRollback.setTenantId(cloudRegion.getTenantId());
expectedRollbackNetworkRequest.setNetworkRollback(networkRollback);
expectedRollbackNetworkRequest.setSkipAAI(true);
CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
createNetworkResponse.setNetworkCreated(true);
RollbackNetworkRequest rollbackNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse);
assertThat(rollbackNetworkRequest, sameBeanAs(expectedRollbackNetworkRequest).ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId"));
}
use of org.onap.so.openstack.beans.NetworkRollback in project so by onap.
the class NetworkAdapterClientIT method rollbackNetworkTestThrowException.
@Test(expected = NetworkAdapterClientException.class)
public void rollbackNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException {
RollbackNetworkRequest request = new RollbackNetworkRequest();
NetworkRollback rollback = new NetworkRollback();
rollback.setCloudId(TESTING_ID);
request.setNetworkRollback(rollback);
RollbackNetworkError mockResponse = new RollbackNetworkError();
mockResponse.setMessage("Error in rollback network");
wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
client.rollbackNetwork(AAI_NETWORK_ID, request);
}
use of org.onap.so.openstack.beans.NetworkRollback in project so by onap.
the class PollService method buildNetworkRollback.
private NetworkRollback buildNetworkRollback(CreateNetworkRequest req, String stackId) {
NetworkRollback networkRollback = new NetworkRollback();
networkRollback.setCloudId(req.getCloudSiteId());
networkRollback.setTenantId(req.getTenantId());
networkRollback.setMsoRequest(req.getMsoRequest());
networkRollback.setModelCustomizationUuid(req.getModelCustomizationUuid());
networkRollback.setNetworkStackId(stackId);
networkRollback.setNetworkCreated(true);
networkRollback.setNetworkType(req.getNetworkType());
return networkRollback;
}
use of org.onap.so.openstack.beans.NetworkRollback in project so by onap.
the class StackService method rollbackNetwork.
private void rollbackNetwork(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success) throws NetworkException {
backout.setFalse();
RollbackNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), RollbackNetworkRequest.class);
NetworkRollback rollback = req.getNetworkRollback();
networkAdapterImpl.rollbackNetwork(rollback);
canonicalStackId.value = rollback.getNetworkStackId();
success.setTrue();
}
Aggregations