use of com.cloud.agent.api.DeleteBcfSegmentCommand in project cloudstack by apache.
the class BigSwitchBcfGuestNetworkGuru method shutdown.
@Override
public void shutdown(NetworkProfile profile, NetworkOffering offering) {
NetworkVO networkObject = _networkDao.findById(profile.getId());
if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Vlan || networkObject.getBroadcastUri() == null) {
s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText());
return;
}
bcfUtilsInit();
// tenantId stored in network domain field at creation
String tenantId = networkObject.getNetworkDomain();
String networkId = networkObject.getUuid();
DeleteBcfSegmentCommand cmd = new DeleteBcfSegmentCommand(tenantId, networkId);
_bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd, networkObject);
super.shutdown(profile, offering);
}
use of com.cloud.agent.api.DeleteBcfSegmentCommand in project cloudstack by apache.
the class BigSwitchBcfResourceTest method testDeleteNetworkRetryOnce.
@Test
public void testDeleteNetworkRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
_resource.configure("BigSwitchBcfResource", _parameters);
when(_bigswitchBcfApi.deleteNetwork((String) any(), (String) any())).thenThrow(new BigSwitchBcfApiException()).thenReturn(UUID.randomUUID().toString());
DeleteBcfSegmentCommand cmd = new DeleteBcfSegmentCommand("tenantid", "networkid");
BcfAnswer ans = (BcfAnswer) _resource.executeRequest(cmd);
assertTrue(ans.getResult());
}
use of com.cloud.agent.api.DeleteBcfSegmentCommand 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());
}
Aggregations