Search in sources :

Example 1 with IdManagerService

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

the class AclServiceUtils method releaseId.

public static void releaseId(IdManagerService idManager, String poolName, String idKey) {
    ReleaseIdInput idInput = new ReleaseIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
    try {
        Future<RpcResult<Void>> result = idManager.releaseId(idInput);
        RpcResult<Void> rpcResult = result.get();
        if (!rpcResult.isSuccessful()) {
            LOG.error("RPC Call to release Id with Key {} from pool {} returned with Errors {}", idKey, poolName, rpcResult.getErrors());
        } else {
            LOG.debug("Released ACL ID with key: {} from pool: {}", idKey, poolName);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("Exception when releasing Id for key {} from pool {} ", idKey, poolName, e);
    }
}
Also used : ReleaseIdInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ReleaseIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput) ExecutionException(java.util.concurrent.ExecutionException)

Example 2 with IdManagerService

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

the class NatEvpnUtil method releaseLPortTagForRouter.

public static void releaseLPortTagForRouter(DataBroker dataBroker, IdManagerService idManager, String routerName) {
    String rd = NatUtil.getVpnRd(dataBroker, routerName);
    long l3Vni = NatEvpnUtil.getL3Vni(dataBroker, rd);
    if (!NatEvpnUtil.isL3VpnOverVxLan(l3Vni)) {
        LOG.info("releaseLPortTagForRouter : Router:{} is not part of L3VPNOverVxlan", routerName);
        return;
    }
    ReleaseIdInput getIdInput = new ReleaseIdInputBuilder().setPoolName(IfmConstants.IFM_IDPOOL_NAME).setIdKey(routerName).build();
    try {
        Future<RpcResult<Void>> result = idManager.releaseId(getIdInput);
        RpcResult<Void> rpcResult = result.get();
        if (!rpcResult.isSuccessful()) {
            LOG.error("releaseLPortTagForRouter:ID manager failed while releasing allocated lport_tag " + "for router {}. Exception {} ", routerName, rpcResult.getErrors());
            return;
        }
    } catch (NullPointerException | InterruptedException | ExecutionException e) {
        LOG.error("releaseLPortTagForRouter:ID : ID manager failed while releasing allocated lport_tag " + "for router {}.", routerName, e);
    }
}
Also used : ReleaseIdInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ReleaseIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput) ExecutionException(java.util.concurrent.ExecutionException)

Example 3 with IdManagerService

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

the class NatOverVxlanUtil method getVNI.

public static BigInteger getVNI(String vniKey, IdManagerService idManager) {
    AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(NatConstants.ODL_VNI_POOL_NAME).setIdKey(vniKey).build();
    try {
        Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
        RpcResult<AllocateIdOutput> rpcResult = result.get();
        if (rpcResult.isSuccessful()) {
            return BigInteger.valueOf(rpcResult.getResult().getIdValue());
        }
    } catch (NullPointerException | InterruptedException | ExecutionException e) {
        LOG.error("getVNI : Exception in get VNI for key {}", vniKey, e);
    }
    return BigInteger.valueOf(-1);
}
Also used : AllocateIdInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder) AllocateIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ExecutionException(java.util.concurrent.ExecutionException) AllocateIdOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput)

Example 4 with IdManagerService

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

the class NatOverVxlanUtil method createOpenDaylightVniRangesPool.

public static void createOpenDaylightVniRangesPool(IdManagerService idManager, String poolName, long lowLimit, long highLimit) {
    CreateIdPoolInput createPool = null;
    createPool = new CreateIdPoolInputBuilder().setPoolName(poolName).setLow(lowLimit).setHigh(highLimit).build();
    try {
        Future<RpcResult<Void>> result = idManager.createIdPool(createPool);
        if (result != null && result.get().isSuccessful()) {
            LOG.debug("createOpenDaylightVniRangesPool : Created OpenDaylight VXLAN VNI range pool {} " + "with range {}-{}", poolName, lowLimit, highLimit);
        } else {
            LOG.error("createOpenDaylightVniRangesPool : Failed to create OpenDaylight VXLAN VNI range pool {} " + "with range {}-{}", poolName, lowLimit, highLimit);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("createOpenDaylightVniRangesPool : Failed to create OpenDaylight VXLAN VNI range pool {} " + "with range {}-{}", poolName, lowLimit, highLimit);
    }
}
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 5 with IdManagerService

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService 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)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)15 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)15 AllocateIdInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder)13 AllocateIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput)11 AllocateIdOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput)8 ReleaseIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput)6 ReleaseIdInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder)6 Test (org.junit.Test)3 HwVtep (org.opendaylight.genius.itm.confighelpers.HwVtep)2 DPNTEPsInfoBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoBuilder)2 DPNTEPsInfoKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoKey)2 TunnelEndPointsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsBuilder)2 ExternalTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel)2 ExternalTunnelKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey)2 TransportZoneBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneBuilder)2 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)2 SubnetsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsBuilder)2 SubnetsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey)2 DeviceVtepsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsBuilder)2 DeviceVtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey)2