Search in sources :

Example 1 with CreateIdPoolOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolOutput in project netvirt by opendaylight.

the class StatisticsImpl method createIdPool.

private void createIdPool() {
    if (checkPoolExists()) {
        return;
    }
    CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(CountersServiceUtils.COUNTERS_PULL_NAME).setLow(CountersServiceUtils.COUNTERS_PULL_START).setHigh(CountersServiceUtils.COUNTERS_PULL_START + CountersServiceUtils.COUNTERS_PULL_END).build();
    ListenableFuture<RpcResult<CreateIdPoolOutput>> result = idManagerService.createIdPool(createPool);
    Futures.addCallback(result, new FutureCallback<RpcResult<CreateIdPoolOutput>>() {

        @Override
        public void onFailure(Throwable error) {
            LOG.error("Failed to create idPool for Aliveness Monitor Service", error);
        }

        @Override
        public void onSuccess(@NonNull RpcResult<CreateIdPoolOutput> rpcResult) {
            if (rpcResult.isSuccessful()) {
                LOG.debug("Created IdPool for tap");
            } else {
                LOG.error("RPC to create Idpool failed {}", rpcResult.getErrors());
            }
        }
    }, MoreExecutors.directExecutor());
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) CreateIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput) CreateIdPoolOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolOutput) CreateIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder)

Example 2 with CreateIdPoolOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolOutput in project netvirt by opendaylight.

the class NaptManager method createNaptPortPool.

protected void createNaptPortPool(String poolName) {
    LOG.debug("createNaptPortPool : requested for : {}", poolName);
    CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(poolName).setLow(LOW_PORT).setHigh(HIGH_PORT).build();
    try {
        Future<RpcResult<CreateIdPoolOutput>> result = idManager.createIdPool(createPool);
        if (result != null && result.get().isSuccessful()) {
            LOG.debug("createNaptPortPool : Created PortPool :{}", poolName);
        } else {
            LOG.error("createNaptPortPool : Unable to create PortPool : {}", poolName);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("createNaptPortPool : Failed to create PortPool for NAPT Service", e);
    }
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) CreateIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) ExecutionException(java.util.concurrent.ExecutionException) CreateIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder)

Example 3 with CreateIdPoolOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolOutput in project netvirt by opendaylight.

the class DhcpAllocationPoolManager method createIdAllocationPool.

protected void createIdAllocationPool(String networkId, AllocationPool pool) {
    String poolName = getPoolKeyIdByAllocationPool(networkId, pool);
    long low = DhcpServiceUtils.convertIpToLong(pool.getAllocateFrom());
    long high = DhcpServiceUtils.convertIpToLong(pool.getAllocateTo());
    CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(poolName).setLow(low).setHigh(high).build();
    try {
        Future<RpcResult<CreateIdPoolOutput>> result = idManager.createIdPool(createPool);
        if (result != null && result.get().isSuccessful()) {
            LOG.info("DHCP Allocation Pool Service : Created IdPool name {}", poolName);
        } else {
            LOG.error("DHCP Allocation Pool Service : Unable to create IdPool name {}", poolName);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("Failed to create Pool for DHCP Allocation Pool Service", e);
    }
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) CreateIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput) ExecutionException(java.util.concurrent.ExecutionException) CreateIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder)

Example 4 with CreateIdPoolOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolOutput in project netvirt by opendaylight.

the class ElanServiceProvider method createIdPool.

private void createIdPool() throws Exception {
    CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(ElanConstants.ELAN_ID_POOL_NAME).setLow(ElanConstants.ELAN_ID_LOW_VALUE).setHigh(ElanConstants.ELAN_ID_HIGH_VALUE).build();
    Future<RpcResult<CreateIdPoolOutput>> result = idManager.createIdPool(createPool);
    if (result != null && result.get().isSuccessful()) {
        LOG.debug("ELAN Id Pool is created successfully");
    }
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) CreateIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput) CreateIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder)

Example 5 with CreateIdPoolOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolOutput in project netvirt by opendaylight.

the class VpnManagerImpl method createIdPool.

private void createIdPool() {
    CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(VpnConstants.VPN_IDPOOL_NAME).setLow(VpnConstants.VPN_IDPOOL_LOW).setHigh(VpnConstants.VPN_IDPOOL_HIGH).build();
    try {
        Future<RpcResult<CreateIdPoolOutput>> result = idManager.createIdPool(createPool);
        if (result != null && result.get().isSuccessful()) {
            LOG.info("Created IdPool for VPN Service");
        } else {
            LOG.error("createIdPool: Unable to create ID pool for VPNService");
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("Failed to create idPool for VPN Service", e);
    }
    // Now an IdPool for InterVpnLink endpoint's pseudo ports
    CreateIdPoolInput createPseudoLporTagPool = new CreateIdPoolInputBuilder().setPoolName(VpnConstants.PSEUDO_LPORT_TAG_ID_POOL_NAME).setLow(VpnConstants.LOWER_PSEUDO_LPORT_TAG).setHigh(VpnConstants.UPPER_PSEUDO_LPORT_TAG).build();
    try {
        Future<RpcResult<CreateIdPoolOutput>> result = idManager.createIdPool(createPseudoLporTagPool);
        if (result != null && result.get().isSuccessful()) {
            LOG.debug("Created IdPool for Pseudo Port tags");
        } else {
            StringBuilder errMsg = new StringBuilder();
            if (result != null && result.get() != null) {
                Collection<RpcError> errors = result.get().getErrors();
                for (RpcError err : errors) {
                    errMsg.append(err.getMessage()).append("\n");
                }
            }
            LOG.error("IdPool creation for PseudoPort tags failed. Reasons: {}", errMsg);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("Failed to create idPool for Pseudo Port tags", e);
    }
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) RpcError(org.opendaylight.yangtools.yang.common.RpcError) CreateIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput) ExecutionException(java.util.concurrent.ExecutionException) CreateIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder)

Aggregations

CreateIdPoolInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput)5 CreateIdPoolInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder)5 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)5 ExecutionException (java.util.concurrent.ExecutionException)3 UncheckedExecutionException (com.google.common.util.concurrent.UncheckedExecutionException)1 CreateIdPoolOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolOutput)1 RpcError (org.opendaylight.yangtools.yang.common.RpcError)1