Search in sources :

Example 1 with RouterInterfaceData

use of com.cloud.network.bigswitch.RouterInterfaceData in project cloudstack by apache.

the class BigSwitchBcfResource method executeRequest.

private Answer executeRequest(CreateBcfRouterInterfaceCommand cmd, int numRetries) {
    RouterInterfaceData routerInterface = new RouterInterfaceData(cmd.getTenantId(), cmd.getGateway(), cmd.getCidr(), cmd.getNetworkId(), cmd.getNetworkName());
    try {
        String hash;
        hash = _bigswitchBcfApi.createRouterInterface(cmd.getTenantId(), cmd.getTenantId(), routerInterface);
        return new BcfAnswer(cmd, true, "router " + cmd.getTenantId() + " created.", hash);
    } catch (BigSwitchBcfApiException e) {
        if (e.is_topologySyncRequested()) {
            cmd.setTopologySyncRequested(true);
            return new BcfAnswer(cmd, true, " created; topology sync required.");
        } else {
            if (numRetries > 0) {
                return retry(cmd, --numRetries);
            } else {
                return new BcfAnswer(cmd, e);
            }
        }
    }
}
Also used : BcfAnswer(com.cloud.agent.api.BcfAnswer) BigSwitchBcfApiException(com.cloud.network.bigswitch.BigSwitchBcfApiException) RouterInterfaceData(com.cloud.network.bigswitch.RouterInterfaceData)

Aggregations

BcfAnswer (com.cloud.agent.api.BcfAnswer)1 BigSwitchBcfApiException (com.cloud.network.bigswitch.BigSwitchBcfApiException)1 RouterInterfaceData (com.cloud.network.bigswitch.RouterInterfaceData)1