use of com.cloud.network.bigswitch.BigSwitchBcfApiException in project cloudstack by apache.
the class BigSwitchBcfResourceTest method testDeleteSourceNatRetryOnce.
@Test
public void testDeleteSourceNatRetryOnce() 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 testDeleteAttachmentException.
@Test
public void testDeleteAttachmentException() throws ConfigurationException, BigSwitchBcfApiException {
_resource.configure("BigSwitchBcfResource", _parameters);
doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).deleteAttachment((String) any(), (String) any(), (String) any());
BcfAnswer ans = (BcfAnswer) _resource.executeRequest(new DeleteBcfAttachmentCommand("networkId", "portid", "tenantid"));
assertFalse(ans.getResult());
verify(_bigswitchBcfApi, times(3)).deleteAttachment((String) any(), (String) any(), (String) any());
}
use of com.cloud.network.bigswitch.BigSwitchBcfApiException in project cloudstack by apache.
the class BigSwitchBcfResourceTest method testDeleteNetworkApiException.
@Test
public void testDeleteNetworkApiException() throws ConfigurationException, BigSwitchBcfApiException {
_resource.configure("BigSwitchBcfResource", _parameters);
doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).deleteNetwork((String) any(), (String) any());
DeleteBcfSegmentCommand cmd = new DeleteBcfSegmentCommand("tenantid", "networkid");
BcfAnswer ans = (BcfAnswer) _resource.executeRequest(cmd);
assertFalse(ans.getResult());
verify(_bigswitchBcfApi, times(3)).deleteNetwork((String) any(), (String) any());
}
use of com.cloud.network.bigswitch.BigSwitchBcfApiException 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());
}
use of com.cloud.network.bigswitch.BigSwitchBcfApiException 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());
}
Aggregations