Search in sources :

Example 21 with BcfAnswer

use of com.cloud.agent.api.BcfAnswer in project cloudstack by apache.

the class BigSwitchBcfResourceTest method testCreateNetworkRetryOnce.

@Test
public void testCreateNetworkRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
    _resource.configure("BigSwitchBcfResource", _parameters);
    NetworkData networkdata = mock(NetworkData.class);
    NetworkData.Network network = mock(NetworkData.Network.class);
    when(networkdata.getNetwork()).thenReturn(network);
    when(network.getId()).thenReturn("cccc");
    when(_bigswitchBcfApi.createNetwork((NetworkData) any())).thenThrow(new BigSwitchBcfApiException()).thenReturn(UUID.randomUUID().toString());
    CreateBcfSegmentCommand cmd = new CreateBcfSegmentCommand("tenantid", "tenantname", (String) _parameters.get("guid"), "networkName", 0);
    BcfAnswer ans = (BcfAnswer) _resource.executeRequest(cmd);
    assertTrue(ans.getResult());
}
Also used : CreateBcfSegmentCommand(com.cloud.agent.api.CreateBcfSegmentCommand) BcfAnswer(com.cloud.agent.api.BcfAnswer) BigSwitchBcfApiException(com.cloud.network.bigswitch.BigSwitchBcfApiException) NetworkData(com.cloud.network.bigswitch.NetworkData) Test(org.junit.Test)

Example 22 with BcfAnswer

use of com.cloud.agent.api.BcfAnswer in project cloudstack by apache.

the class BigSwitchBcfResourceTest method testDeleteSourceNatApiException.

@Test
public void testDeleteSourceNatApiException() throws ConfigurationException, BigSwitchBcfApiException {
    _resource.configure("BigSwitchBcfResource", _parameters);
    doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).modifyRouter((String) any(), (RouterData) any());
    UpdateBcfRouterCommand cmd = new UpdateBcfRouterCommand("tenantid");
    BcfAnswer ans = (BcfAnswer) _resource.executeRequest(cmd);
    assertFalse(ans.getResult());
    verify(_bigswitchBcfApi, times(3)).modifyRouter((String) any(), (RouterData) any());
}
Also used : BcfAnswer(com.cloud.agent.api.BcfAnswer) BigSwitchBcfApiException(com.cloud.network.bigswitch.BigSwitchBcfApiException) UpdateBcfRouterCommand(com.cloud.agent.api.UpdateBcfRouterCommand) Test(org.junit.Test)

Example 23 with BcfAnswer

use of com.cloud.agent.api.BcfAnswer in project cloudstack by apache.

the class BigSwitchBcfResourceTest method testDeleteStaticNatRetryOnce.

@Test
public void testDeleteStaticNatRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
    _resource.configure("BigSwitchBcfResource", _parameters);
    when(_bigswitchBcfApi.deleteFloatingIp((String) any(), (String) any())).thenThrow(new BigSwitchBcfApiException()).thenReturn(UUID.randomUUID().toString());
    DeleteBcfStaticNatCommand cmd = new DeleteBcfStaticNatCommand("tenantid", "10.4.4.100");
    BcfAnswer ans = (BcfAnswer) _resource.executeRequest(cmd);
    assertTrue(ans.getResult());
}
Also used : DeleteBcfStaticNatCommand(com.cloud.agent.api.DeleteBcfStaticNatCommand) BcfAnswer(com.cloud.agent.api.BcfAnswer) BigSwitchBcfApiException(com.cloud.network.bigswitch.BigSwitchBcfApiException) Test(org.junit.Test)

Example 24 with BcfAnswer

use of com.cloud.agent.api.BcfAnswer in project cloudstack by apache.

the class BigSwitchBcfResourceTest method testCreateRouterApiException.

@Test
public void testCreateRouterApiException() throws ConfigurationException, BigSwitchBcfApiException {
    _resource.configure("BigSwitchBcfResource", _parameters);
    doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).createRouter((String) any(), (RouterData) any());
    CreateBcfRouterCommand cmd = new CreateBcfRouterCommand("tenantid");
    BcfAnswer ans = (BcfAnswer) _resource.executeRequest(cmd);
    assertFalse(ans.getResult());
    verify(_bigswitchBcfApi, times(3)).createRouter((String) any(), (RouterData) any());
}
Also used : BcfAnswer(com.cloud.agent.api.BcfAnswer) CreateBcfRouterCommand(com.cloud.agent.api.CreateBcfRouterCommand) BigSwitchBcfApiException(com.cloud.network.bigswitch.BigSwitchBcfApiException) Test(org.junit.Test)

Example 25 with BcfAnswer

use of com.cloud.agent.api.BcfAnswer in project cloudstack by apache.

the class BigSwitchBcfResourceTest method testCreateStaticNatApiException.

@Test
public void testCreateStaticNatApiException() throws ConfigurationException, BigSwitchBcfApiException {
    _resource.configure("BigSwitchBcfResource", _parameters);
    doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).createFloatingIp((String) any(), (FloatingIpData) any());
    CreateBcfStaticNatCommand cmd = new CreateBcfStaticNatCommand("tenantid", "networkid", "192.168.0.10", "10.4.4.100", "90:b1:1c:49:d8:56");
    BcfAnswer ans = (BcfAnswer) _resource.executeRequest(cmd);
    assertFalse(ans.getResult());
    verify(_bigswitchBcfApi, times(3)).createFloatingIp((String) any(), (FloatingIpData) any());
}
Also used : BcfAnswer(com.cloud.agent.api.BcfAnswer) BigSwitchBcfApiException(com.cloud.network.bigswitch.BigSwitchBcfApiException) CreateBcfStaticNatCommand(com.cloud.agent.api.CreateBcfStaticNatCommand) Test(org.junit.Test)

Aggregations

BcfAnswer (com.cloud.agent.api.BcfAnswer)33 BigSwitchBcfApiException (com.cloud.network.bigswitch.BigSwitchBcfApiException)29 Test (org.junit.Test)21 UpdateBcfRouterCommand (com.cloud.agent.api.UpdateBcfRouterCommand)5 AttachmentData (com.cloud.network.bigswitch.AttachmentData)5 RouterData (com.cloud.network.bigswitch.RouterData)5 SyncBcfTopologyCommand (com.cloud.agent.api.SyncBcfTopologyCommand)3 NetworkData (com.cloud.network.bigswitch.NetworkData)3 CreateBcfAttachmentCommand (com.cloud.agent.api.CreateBcfAttachmentCommand)2 CreateBcfRouterCommand (com.cloud.agent.api.CreateBcfRouterCommand)2 CreateBcfSegmentCommand (com.cloud.agent.api.CreateBcfSegmentCommand)2 CreateBcfStaticNatCommand (com.cloud.agent.api.CreateBcfStaticNatCommand)2 DeleteBcfAttachmentCommand (com.cloud.agent.api.DeleteBcfAttachmentCommand)2 DeleteBcfSegmentCommand (com.cloud.agent.api.DeleteBcfSegmentCommand)2 DeleteBcfStaticNatCommand (com.cloud.agent.api.DeleteBcfStaticNatCommand)2 UpdateBcfAttachmentCommand (com.cloud.agent.api.UpdateBcfAttachmentCommand)2 AclData (com.cloud.network.bigswitch.AclData)2 FloatingIpData (com.cloud.network.bigswitch.FloatingIpData)2 TopologyData (com.cloud.network.bigswitch.TopologyData)2 CacheBcfTopologyCommand (com.cloud.agent.api.CacheBcfTopologyCommand)1