use of com.cloud.network.bigswitch.BigSwitchBcfApiException 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());
}
use of com.cloud.network.bigswitch.BigSwitchBcfApiException 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());
}
use of com.cloud.network.bigswitch.BigSwitchBcfApiException 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());
}
use of com.cloud.network.bigswitch.BigSwitchBcfApiException in project cloudstack by apache.
the class BigSwitchBcfResourceTest method testCreateSourceNatRetryOnce.
@Test
public void testCreateSourceNatRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
_resource.configure("BigSwitchBcfResource", _parameters);
when(_bigswitchBcfApi.modifyRouter((String) any(), (RouterData) any())).thenThrow(new BigSwitchBcfApiException()).thenReturn(UUID.randomUUID().toString());
UpdateBcfRouterCommand cmd = new UpdateBcfRouterCommand("tenantid");
BcfAnswer ans = (BcfAnswer) _resource.executeRequest(cmd);
assertTrue(ans.getResult());
}
use of com.cloud.network.bigswitch.BigSwitchBcfApiException in project cloudstack by apache.
the class BigSwitchBcfResourceTest method testDeleteStaticNatApiException.
@Test
public void testDeleteStaticNatApiException() throws ConfigurationException, BigSwitchBcfApiException {
_resource.configure("BigSwitchBcfResource", _parameters);
doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).deleteFloatingIp((String) any(), (String) any());
DeleteBcfStaticNatCommand cmd = new DeleteBcfStaticNatCommand("tenantid", "10.4.4.100");
BcfAnswer ans = (BcfAnswer) _resource.executeRequest(cmd);
assertFalse(ans.getResult());
verify(_bigswitchBcfApi, times(3)).deleteFloatingIp((String) any(), (String) any());
}
Aggregations