use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput in project netvirt by opendaylight.
the class DhcpAllocationPoolManager method createIdAllocation.
private long createIdAllocation(String groupIdKey, String idKey) {
AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(groupIdKey).setIdKey(idKey).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("Failed to allocate id for DHCP Allocation Pool Service", e);
}
return 0;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput in project netvirt by opendaylight.
the class ArpResponderUtil method retrieveStandardArpResponderGroupId.
/**
* Uses the IdManager to retrieve ARP Responder GroupId from ELAN pool.
*
* @param idManager
* the id manager
* @return the integer
*/
public static Long retrieveStandardArpResponderGroupId(IdManagerService idManager) {
AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(ArpResponderConstant.ELAN_ID_POOL_NAME.value()).setIdKey(ArpResponderConstant.ARP_RESPONDER_GROUP_ID.value()).build();
try {
Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
RpcResult<AllocateIdOutput> rpcResult = result.get();
if (rpcResult.isSuccessful()) {
LOG.trace("Retrieved Group Id is {}", rpcResult.getResult().getIdValue());
return rpcResult.getResult().getIdValue();
} else {
LOG.warn("RPC Call to Allocate Id returned with Errors {}", rpcResult.getErrors());
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when Allocating Id", e);
}
return 0L;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput in project genius by opendaylight.
the class ItmInternalTunnelAddTest method testBuild_all_tunnels_VXLANtype.
@Test
public void testBuild_all_tunnels_VXLANtype() {
AllocateIdInput getIdInput1 = new AllocateIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey("1:phy0:100:192.168.56.101:192.168.56.102:VXLAN").build();
AllocateIdInput getIdInput2 = new AllocateIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey("1:phy0:100:192.168.56.102:192.168.56.101:VXLAN").build();
doReturn(idOutputOptional1).when(idManagerService).allocateId(getIdInput1);
doReturn(idOutputOptional2).when(idManagerService).allocateId(getIdInput2);
trunkInterfaceName1 = ItmUtils.getTrunkInterfaceName(parentInterfaceName, tepIp1, tepIp2, tunnelType1.getName());
trunkInterfaceName2 = ItmUtils.getTrunkInterfaceName(parentInterfaceName, tepIp2, tepIp1, tunnelType1.getName());
internalTunnel1 = ItmUtils.buildInternalTunnel(dpId1, dpId2, tunnelType1, trunkInterfaceName1);
internalTunnel2 = ItmUtils.buildInternalTunnel(dpId2, dpId1, tunnelType1, trunkInterfaceName2);
itmInternalTunnelAddWorker.buildAllTunnels(mdsalApiManager, cfgdDpnListVxlan, meshDpnListVxlan);
// Add some verifications
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, internalTunnelIdentifierVxlan1, internalTunnel1, true);
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, internalTunnelIdentifierVxlan2, internalTunnel2, true);
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, dpnEndpointsIdentifier, dpnEndpointsVxlan);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput in project genius by opendaylight.
the class ItmInternalTunnelAddTest method testBuild_all_tunnels_GREtype.
@Test
public void testBuild_all_tunnels_GREtype() {
AllocateIdInput getIdInput1 = new AllocateIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey("1:phy0:100:192.168.56.101:192.168.56.102:GRE").build();
AllocateIdInput getIdInput2 = new AllocateIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey("1:phy0:100:192.168.56.102:192.168.56.101:GRE").build();
doReturn(idOutputOptional1).when(idManagerService).allocateId(getIdInput1);
doReturn(idOutputOptional2).when(idManagerService).allocateId(getIdInput2);
trunkInterfaceName1 = ItmUtils.getTrunkInterfaceName(parentInterfaceName, tepIp1, tepIp2, tunnelType2.getName());
trunkInterfaceName2 = ItmUtils.getTrunkInterfaceName(parentInterfaceName, tepIp2, tepIp1, tunnelType2.getName());
internalTunnel1 = ItmUtils.buildInternalTunnel(dpId1, dpId2, tunnelType2, trunkInterfaceName1);
internalTunnel2 = ItmUtils.buildInternalTunnel(dpId2, dpId1, tunnelType2, trunkInterfaceName2);
itmInternalTunnelAddWorker.buildAllTunnels(mdsalApiManager, cfgdDpnListGre, meshDpnListGre);
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, internalTunnelIdentifierGre1, internalTunnel1, true);
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, internalTunnelIdentifierGre2, internalTunnel2, true);
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, dpnEndpointsIdentifier, dpnEndpointsGre);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput in project genius by opendaylight.
the class IfmUtil method allocateId.
public static Integer allocateId(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 INVALID_ID;
}
Aggregations