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);
}
}
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);
}
}
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);
}
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);
}
}
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);
}
}
Aggregations