Search in sources :

Example 6 with CreateLogicalRouterAnswer

use of com.cloud.legacymodel.communication.answer.CreateLogicalRouterAnswer in project cosmic by MissionCriticalCloud.

the class NiciraNvpResourceTest method testCreateLogicalRouterApiExceptionRollbackRouter.

@Test
public void testCreateLogicalRouterApiExceptionRollbackRouter() throws ConfigurationException, NiciraNvpApiException {
    resource.configure("NiciraNvpResource", parameters);
    final LogicalRouter lrc = mock(LogicalRouter.class);
    when(lrc.getUuid()).thenReturn("ccccc");
    when(nvpApi.createLogicalRouter((LogicalRouter) any())).thenReturn(lrc);
    when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort) any())).thenThrow(new NiciraNvpApiException());
    final CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
    final CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) resource.executeRequest(clrc);
    assertFalse(clra.getResult());
    verify(nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
}
Also used : CreateLogicalRouterCommand(com.cloud.legacymodel.communication.command.CreateLogicalRouterCommand) LogicalRouter(com.cloud.network.nicira.LogicalRouter) NiciraNvpApiException(com.cloud.network.nicira.NiciraNvpApiException) CreateLogicalRouterAnswer(com.cloud.legacymodel.communication.answer.CreateLogicalRouterAnswer) Test(org.junit.Test)

Aggregations

CreateLogicalRouterAnswer (com.cloud.legacymodel.communication.answer.CreateLogicalRouterAnswer)6 CreateLogicalRouterCommand (com.cloud.legacymodel.communication.command.CreateLogicalRouterCommand)5 LogicalRouter (com.cloud.network.nicira.LogicalRouter)4 NiciraNvpApiException (com.cloud.network.nicira.NiciraNvpApiException)4 Test (org.junit.Test)4 LogicalRouterPort (com.cloud.network.nicira.LogicalRouterPort)3 LogicalSwitchPort (com.cloud.network.nicira.LogicalSwitchPort)3 HostVO (com.cloud.host.HostVO)1 CloudRuntimeException (com.cloud.legacymodel.exceptions.CloudRuntimeException)1 Account (com.cloud.legacymodel.user.Account)1 BroadcastDomainType (com.cloud.model.enumeration.BroadcastDomainType)1 NiciraNvpDeviceVO (com.cloud.network.NiciraNvpDeviceVO)1 NiciraNvpRouterMappingVO (com.cloud.network.NiciraNvpRouterMappingVO)1 PublicIp (com.cloud.network.addr.PublicIp)1 L3GatewayAttachment (com.cloud.network.nicira.L3GatewayAttachment)1 Match (com.cloud.network.nicira.Match)1 NiciraNvpApi (com.cloud.network.nicira.NiciraNvpApi)1 NiciraNvpTag (com.cloud.network.nicira.NiciraNvpTag)1 PatchAttachment (com.cloud.network.nicira.PatchAttachment)1 RouterNextHop (com.cloud.network.nicira.RouterNextHop)1