use of com.cloud.agent.api.BcfAnswer in project cloudstack by apache.
the class BigSwitchBcfResourceTest method testSyncTopologyRetryOnce.
@Test
public void testSyncTopologyRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
_resource.configure("BigSwitchBcfResource", _parameters);
_resource.setTopology(new TopologyData());
when(_bigswitchBcfApi.syncTopology((TopologyData) any())).thenThrow(new BigSwitchBcfApiException()).thenReturn(UUID.randomUUID().toString());
BcfAnswer ans = (BcfAnswer) _resource.executeRequest(new SyncBcfTopologyCommand(true, false));
assertTrue(ans.getResult());
}
use of com.cloud.agent.api.BcfAnswer in project cloudstack by apache.
the class BigSwitchBcfResourceTest method testDeleteAttachmentRetryOnce.
@Test
public void testDeleteAttachmentRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
_resource.configure("BigSwitchBcfResource", _parameters);
when(_bigswitchBcfApi.deleteAttachment((String) any(), (String) any(), (String) any())).thenThrow(new BigSwitchBcfApiException()).thenReturn(UUID.randomUUID().toString());
BcfAnswer ans = (BcfAnswer) _resource.executeRequest(new DeleteBcfAttachmentCommand("networkId", "portid", "tenantid"));
assertTrue(ans.getResult());
}
use of com.cloud.agent.api.BcfAnswer in project cloudstack by apache.
the class BigSwitchBcfResourceTest method testCreateStaticNatRetryOnce.
@Test
public void testCreateStaticNatRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
_resource.configure("BigSwitchBcfResource", _parameters);
when(_bigswitchBcfApi.createFloatingIp((String) any(), (FloatingIpData) any())).thenThrow(new BigSwitchBcfApiException()).thenReturn(UUID.randomUUID().toString());
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);
assertTrue(ans.getResult());
}
use of com.cloud.agent.api.BcfAnswer in project cloudstack by apache.
the class BigSwitchBcfResourceTest method testCreateSourceNatApiException.
@Test
public void testCreateSourceNatApiException() 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());
}
use of com.cloud.agent.api.BcfAnswer in project cloudstack by apache.
the class BigSwitchBcfUtils method syncTopologyToBcfHost.
public String syncTopologyToBcfHost(HostVO bigswitchBcfHost) {
SyncBcfTopologyCommand syncCmd;
if (isNatEnabled()) {
syncCmd = new SyncBcfTopologyCommand(true, true);
} else {
syncCmd = new SyncBcfTopologyCommand(true, false);
}
BcfAnswer syncAnswer = (BcfAnswer) _agentMgr.easySend(bigswitchBcfHost.getId(), syncCmd);
if (syncAnswer == null || !syncAnswer.getResult()) {
s_logger.error("SyncBcfTopologyCommand failed");
return null;
}
return syncAnswer.getHash();
}
Aggregations