private void createIdPool() { CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(NeutronConstants.RD_IDPOOL_NAME) .setLow(NeutronConstants.RD_IDPOOL_START) .setHigh(new BigInteger(NeutronConstants.RD_IDPOOL_SIZE).longValue()).build(); try { Future<RpcResult<Void>> result = idManager.createIdPool(createPool); if ((result != null) && (result.get().isSuccessful())) { LOG.info("Created IdPool for Bgpvpn RD"); } } catch (InterruptedException | ExecutionException e) { LOG.error("Failed to create idPool for Bgpvpn RD", e); } }
void removePortFromPool(String internalIpPort, String externalIp) { LOG.debug("NAPT Service : removePortFromPool method called"); ReleaseIdInput idInput = new ReleaseIdInputBuilder(). setPoolName(externalIp) .setIdKey(internalIpPort).build(); try { Future<RpcResult<Void>> result = idManager.releaseId(idInput); RpcResult<Void> rpcResult = result.get(); if(!rpcResult.isSuccessful()) { LOG.error("NAPT Service : idmanager failed to remove port from pool {}", rpcResult.getErrors()); } LOG.debug("NAPT Service : Removed port from pool for InternalIpPort {} with externalIp {}",internalIpPort,externalIp); } catch (InterruptedException | ExecutionException e) { LOG.error("NAPT Service : idmanager failed with Exception {} when removing entry in pool with key {}, ", e, internalIpPort); } }
protected static Integer getUniqueRDId(IdManagerService idManager, String poolName, String idKey) { AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build(); try { Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput); RpcResult<AllocateIdOutput> rpcResult = result.get(); if (rpcResult.isSuccessful()) { return rpcResult.getResult().getIdValue().intValue(); } else { logger.debug("RPC Call to Get Unique Id returned with Errors", rpcResult.getErrors()); } } catch (InterruptedException | ExecutionException e) { logger.debug("Exception when getting Unique Id", e); } return null; }
void removeNaptPortPool(String poolName) { DeleteIdPoolInput deleteIdPoolInput = new DeleteIdPoolInputBuilder().setPoolName(poolName).build(); LOG.debug("NAPT Service : Remove Napt port pool requested for : {}", poolName); try { Future<RpcResult<Void>> result = idManager.deleteIdPool(deleteIdPoolInput); if ((result != null) && (result.get().isSuccessful())) { LOG.debug("NAPT Service : Deleted PortPool {}", poolName); } else { LOG.error("NAPT Service : Unable to delete PortPool {}", poolName); } } catch (InterruptedException | ExecutionException e) { LOG.error("Failed to delete PortPool {} for NAPT Service", poolName, e); } }
allocateIdRangeBuilder.setIdKey(input.getIdKey()).setPoolName(resourceMap.get(input.getResourceType())) .setSize(input.getSize()); Future<RpcResult<AllocateIdRangeOutput>> output = idManager.allocateIdRange(allocateIdRangeBuilder.build()); AllocateResourceOutputBuilder allocateResourceOutputBuilder = new AllocateResourceOutputBuilder(); RpcResultBuilder<AllocateResourceOutput> allocateResourceOutputRpcBuilder = null;
protected static void releaseRDId(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()) { logger.debug("RPC Call to Get Unique Id returned with Errors", rpcResult.getErrors()); } else { logger.info("ID for RD " + idKey + " released successfully"); } } catch (InterruptedException | ExecutionException e) { logger.debug("Exception when trying to release ID into the pool", idKey, e); } }
private void createIdPool() { CreateIdPoolInput createPool = new CreateIdPoolInputBuilder() .setPoolName(ITMConstants.ITM_IDPOOL_NAME) .setLow(ITMConstants.ITM_IDPOOL_START) .setHigh(new BigInteger(ITMConstants.ITM_IDPOOL_SIZE).longValue()) .build(); try { Future<RpcResult<Void>> result = idManager.createIdPool(createPool); if ((result != null) && (result.get().isSuccessful())) { LOG.debug("Created IdPool for ITM Service"); } } catch (InterruptedException | ExecutionException e) { LOG.error("Failed to create idPool for ITM Service",e); } }
protected long createGroupId(String groupIdKey) { AllocateIdInput getIdInput = new AllocateIdInputBuilder() .setPoolName(NatConstants.SNAT_IDPOOL_NAME).setIdKey(groupIdKey) .build(); try { Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput); RpcResult<AllocateIdOutput> rpcResult = result.get(); return rpcResult.getResult().getIdValue(); } catch (NullPointerException | InterruptedException | ExecutionException e) { LOG.trace("",e); } return 0; }
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.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors()); } } catch (InterruptedException | ExecutionException e) { LOG.warn("Exception when getting Unique Id for key {}", idKey, e); } }
protected void createNaptPortPool(String PoolName) { LOG.debug("NAPT Service : createPortPool requested for : {}", PoolName); CreateIdPoolInput createPool = new CreateIdPoolInputBuilder() .setPoolName(PoolName) .setLow(LOW_PORT) .setHigh(HIGH_PORT) .build(); try { Future<RpcResult<Void>> result = idManager.createIdPool(createPool); if ((result != null) && (result.get().isSuccessful())) { LOG.debug("NAPT Service : Created PortPool"); } else { LOG.error("NAPT Service : Unable to create PortPool"); } } catch (InterruptedException | ExecutionException e) { LOG.error("Failed to create PortPool for NAPT Service",e); } }
public static long createGroupId(String groupIdKey,IdManagerService idManager) { AllocateIdInput getIdInput = new AllocateIdInputBuilder() .setPoolName(NatConstants.SNAT_IDPOOL_NAME).setIdKey(groupIdKey) .build(); try { Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput); RpcResult<AllocateIdOutput> rpcResult = result.get(); return rpcResult.getResult().getIdValue(); } catch (NullPointerException | InterruptedException | ExecutionException e) { LOG.trace("", e); } return 0; }
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.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors()); } } catch (InterruptedException | ExecutionException e) { LOG.warn("Exception when getting Unique Id for key {}", idKey, e); } }
protected void createGroupIdPool() { CreateIdPoolInput createPool = new CreateIdPoolInputBuilder() .setPoolName(NatConstants.SNAT_IDPOOL_NAME) .setLow(NatConstants.SNAT_ID_LOW_VALUE) .setHigh(NatConstants.SNAT_ID_HIGH_VALUE) .build(); try { Future<RpcResult<Void>> result = idManager.createIdPool(createPool); if ((result != null) && (result.get().isSuccessful())) { LOG.debug("NAT Service : Created GroupIdPool"); } else { LOG.error("NAT Service : Unable to create GroupIdPool"); } } catch (InterruptedException | ExecutionException e) { LOG.error("Failed to create PortPool for NAPT Service",e); } }
public static int getUniqueId(IdManagerService idManager, String poolName, String idKey) { AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build(); try { Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput); RpcResult<AllocateIdOutput> rpcResult = result.get(); if (rpcResult.isSuccessful()) { return rpcResult.getResult().getIdValue().intValue(); } else { LOG.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors()); } } catch (InterruptedException | ExecutionException e) { LOG.warn("Exception when getting Unique Id", e); } return 0; }
public static void releaseId(IdManagerService idManager, String idKey) { ReleaseIdInput idInput = new ReleaseIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey(idKey).build(); try { Future<RpcResult<Void>> result = idManager.releaseId(idInput); RpcResult<Void> rpcResult = result.get(); if(!rpcResult.isSuccessful()) { LOG.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors()); } } catch (InterruptedException | ExecutionException e) { LOG.warn("Exception when getting Unique Id for key {}", idKey, e); } }
private void createIdPool() { CreateIdPoolInput createPool = new CreateIdPoolInputBuilder() .setPoolName(NEXTHOP_ID_POOL_NAME) .setLow(150000L) .setHigh(175000L) .build(); try { Future<RpcResult<Void>> result = idManager.createIdPool(createPool); if ((result != null) && (result.get().isSuccessful())) { LOG.info("Created IdPool for NextHopPointerPool"); } } catch (InterruptedException | ExecutionException e) { LOG.error("Failed to create idPool for NextHopPointerPool",e); } }
protected long createNextHopPointer(String nexthopKey) { AllocateIdInput getIdInput = new AllocateIdInputBuilder() .setPoolName(NEXTHOP_ID_POOL_NAME).setIdKey(nexthopKey) .build(); //TODO: Proper error handling once IdManager code is complete try { Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput); RpcResult<AllocateIdOutput> rpcResult = result.get(); return rpcResult.getResult().getIdValue(); } catch (NullPointerException | InterruptedException | ExecutionException e) { LOG.trace("",e); } return 0; }
protected void removeNextHopPointer(String nexthopKey) { ReleaseIdInput idInput = new ReleaseIdInputBuilder(). setPoolName(NEXTHOP_ID_POOL_NAME) .setIdKey(nexthopKey).build(); try { Future<RpcResult<Void>> result = idManager.releaseId(idInput); RpcResult<Void> rpcResult = result.get(); if(!rpcResult.isSuccessful()) { LOG.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors()); } } catch (InterruptedException | ExecutionException e) { LOG.warn("Exception when getting Unique Id for key {}", nexthopKey, e); } }
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<Void>> result = idManager.createIdPool(createPool); if (result != null && result.get().isSuccessful()) { LOG.debug("ELAN Id Pool is created successfully"); } }
public static int getUniqueId(IdManagerService idManager, String poolName, String idKey) { AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build(); try { Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput); RpcResult<AllocateIdOutput> rpcResult = result.get(); if (rpcResult.isSuccessful()) { return rpcResult.getResult().getIdValue().intValue(); } else { LOG.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors()); } } catch (InterruptedException | ExecutionException e) { LOG.warn("Exception when getting Unique Id", e); } return 0; }