Search in sources :

Example 1 with DeleteIdPoolInputBuilder

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

the class NaptManager method removeNaptPortPool.

void removeNaptPortPool(String poolName) {
    DeleteIdPoolInput deleteIdPoolInput = new DeleteIdPoolInputBuilder().setPoolName(poolName).build();
    LOG.debug("removeNaptPortPool : Remove Napt port pool requested for : {}", poolName);
    try {
        Future<RpcResult<Void>> result = idManager.deleteIdPool(deleteIdPoolInput);
        if (result != null && result.get().isSuccessful()) {
            LOG.debug("removeNaptPortPool : Deleted PortPool {}", poolName);
        } else {
            LOG.error("removeNaptPortPool : Unable to delete PortPool {}", poolName);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("removeNaptPortPool : Failed to delete PortPool {} for NAPT Service", poolName, e);
    }
}
Also used : DeleteIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.DeleteIdPoolInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) ExecutionException(java.util.concurrent.ExecutionException) DeleteIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.DeleteIdPoolInput)

Example 2 with DeleteIdPoolInputBuilder

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

the class NatOverVxlanUtil method deleteOpenDaylightVniRangesPool.

public static void deleteOpenDaylightVniRangesPool(IdManagerService idManager, String poolName) {
    DeleteIdPoolInput deletePool = new DeleteIdPoolInputBuilder().setPoolName(poolName).build();
    Future<RpcResult<Void>> result = idManager.deleteIdPool(deletePool);
    try {
        if (result != null && result.get().isSuccessful()) {
            LOG.debug("deleteOpenDaylightVniRangesPool : Deleted OpenDaylight VXLAN VNI range pool {} successfully", poolName);
        } else {
            LOG.error("deleteOpenDaylightVniRangesPool : Failed to delete OpenDaylight VXLAN VNI range pool {} ", poolName);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("deleteOpenDaylightVniRangesPool : Failed to delete OpenDaylight VXLAN VNI range pool {} ", poolName, e);
    }
}
Also used : DeleteIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.DeleteIdPoolInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ExecutionException(java.util.concurrent.ExecutionException) DeleteIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.DeleteIdPoolInput)

Example 3 with DeleteIdPoolInputBuilder

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

the class DhcpAllocationPoolManager method releaseIdAllocationPool.

protected void releaseIdAllocationPool(String networkId, AllocationPool pool) {
    String poolName = getPoolKeyIdByAllocationPool(networkId, pool);
    DeleteIdPoolInput deletePool = new DeleteIdPoolInputBuilder().setPoolName(poolName).build();
    try {
        Future<RpcResult<Void>> result = idManager.deleteIdPool(deletePool);
        if (result != null && result.get().isSuccessful()) {
            LOG.info("DHCP Allocation Pool Service : Deleted IdPool name {}", poolName);
        } else {
            LOG.error("DHCP Allocation Pool Service : Unable to delete IdPool name {}", poolName);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("Failed to delete Pool for DHCP Allocation Pool Service", e);
    }
}
Also used : DeleteIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.DeleteIdPoolInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ExecutionException(java.util.concurrent.ExecutionException) DeleteIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.DeleteIdPoolInput)

Example 4 with DeleteIdPoolInputBuilder

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

the class IdManagerTest method testDeletePool.

@Test
public void testDeletePool() throws Exception {
    CreateIdPoolInput createIdPoolInput = new CreateIdPoolInputBuilder().setHigh(ID_HIGH).setLow(ID_LOW).setPoolName(ID_POOL_NAME).build();
    idManagerService.createIdPool(createIdPoolInput);
    DeleteIdPoolInput deleteIdPoolInput = new DeleteIdPoolInputBuilder().setPoolName(ID_POOL_NAME).build();
    assertTrue(idManagerService.deleteIdPool(deleteIdPoolInput).get().isSuccessful());
    coordinatorEventsWaiter.awaitEventsConsumption();
    Optional<IdPool> actualIdPoolParent = singleTxdataBroker.syncReadOptional(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.builder(IdPools.class).child(IdPool.class, new IdPoolKey(ID_POOL_NAME)).build());
    Optional<IdPool> actualIdPoolChild = singleTxdataBroker.syncReadOptional(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.builder(IdPools.class).child(IdPool.class, new IdPoolKey(idUtils.getLocalPoolName(ID_POOL_NAME))).build());
    assertEquals(false, actualIdPoolParent.isPresent());
    assertEquals(false, actualIdPoolChild.isPresent());
}
Also used : DeleteIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.DeleteIdPoolInputBuilder) CreateIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput) IdPools(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdPools) IdPoolKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPoolKey) DeleteIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.DeleteIdPoolInput) CreateIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder) IdPool(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool) Test(org.junit.Test)

Aggregations

DeleteIdPoolInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.DeleteIdPoolInput)4 DeleteIdPoolInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.DeleteIdPoolInputBuilder)4 ExecutionException (java.util.concurrent.ExecutionException)3 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)3 UncheckedExecutionException (com.google.common.util.concurrent.UncheckedExecutionException)1 Test (org.junit.Test)1 CreateIdPoolInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput)1 CreateIdPoolInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder)1 IdPools (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdPools)1 IdPool (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool)1 IdPoolKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPoolKey)1