Search in sources :

Example 1 with SyncBcfTopologyCommand

use of com.cloud.agent.api.SyncBcfTopologyCommand 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();
}
Also used : BcfAnswer(com.cloud.agent.api.BcfAnswer) SyncBcfTopologyCommand(com.cloud.agent.api.SyncBcfTopologyCommand)

Example 2 with SyncBcfTopologyCommand

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

the class BigSwitchBcfUtils method syncTopologyToBcfHost.

public String syncTopologyToBcfHost(HostVO bigswitchBcfHost, boolean natEnabled) {
    SyncBcfTopologyCommand syncCmd;
    if (natEnabled) {
        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();
}
Also used : BcfAnswer(com.cloud.agent.api.BcfAnswer) SyncBcfTopologyCommand(com.cloud.agent.api.SyncBcfTopologyCommand)

Example 3 with SyncBcfTopologyCommand

use of com.cloud.agent.api.SyncBcfTopologyCommand 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());
}
Also used : BcfAnswer(com.cloud.agent.api.BcfAnswer) BigSwitchBcfApiException(com.cloud.network.bigswitch.BigSwitchBcfApiException) TopologyData(com.cloud.network.bigswitch.TopologyData) SyncBcfTopologyCommand(com.cloud.agent.api.SyncBcfTopologyCommand) Test(org.junit.Test)

Aggregations

BcfAnswer (com.cloud.agent.api.BcfAnswer)3 SyncBcfTopologyCommand (com.cloud.agent.api.SyncBcfTopologyCommand)3 BigSwitchBcfApiException (com.cloud.network.bigswitch.BigSwitchBcfApiException)1 TopologyData (com.cloud.network.bigswitch.TopologyData)1 Test (org.junit.Test)1