import org.opendaylight.yang.gen.v1.urn.opendaylight.l3vpn.rev130911.adjacency.list.AdjacencyKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.rpcs.rev151217.GetExternalTunnelInterfaceNameInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.rpcs.rev151217.GetExternalTunnelInterfaceNameOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.rpcs.rev151217.GetInternalOrExternalInterfaceNameInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.rpcs.rev151217.GetInternalOrExternalInterfaceNameOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.rpcs.rev151217.GetTunnelInterfaceNameInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.rpcs.rev151217.GetTunnelInterfaceNameOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.rpcs.rev151217.ItmRpcService;
private static final short FIB_TABLE = 21;
private static final short DEFAULT_FLOW_PRIORITY = 10;
private static final String NEXTHOP_ID_POOL_NAME = "nextHopPointerPool";
+ private static final long FIXED_DELAY_IN_MILLISECONDS = 4000;
private static final FutureCallback<Void> DEFAULT_CALLBACK =
new FutureCallback<Void>() {
}
protected String getTunnelInterfaceName(BigInteger srcDpId, BigInteger dstDpId) {
- // FIXME: Enable during itm integration
-
try {
Future<RpcResult<GetTunnelInterfaceNameOutput>> result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder()
.setSourceDpid(srcDpId)
return null;
}
- protected String getExternalTunnelInterfaceName(BigInteger srcDpId, IpAddress dstIp) {
- // FIXME: Enable during itm integration
-
+ protected String getTunnelInterfaceName(BigInteger srcDpId, IpAddress dstIp) {
try {
- Future<RpcResult<GetExternalTunnelInterfaceNameOutput>> result = itmManager.getExternalTunnelInterfaceName(new GetExternalTunnelInterfaceNameInputBuilder()
+ Future<RpcResult<GetInternalOrExternalInterfaceNameOutput>> result = itmManager.getInternalOrExternalInterfaceName(new GetInternalOrExternalInterfaceNameInputBuilder()
.setSourceDpid(srcDpId)
.setDestinationIp(dstIp).build());
- RpcResult<GetExternalTunnelInterfaceNameOutput> rpcResult = result.get();
+ RpcResult<GetInternalOrExternalInterfaceNameOutput> rpcResult = result.get();
if(!rpcResult.isSuccessful()) {
- LOG.warn("RPC Call to getExternalTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
+ LOG.warn("RPC Call to getTunnelInterfaceName returned with Errors {}", rpcResult.getErrors());
} else {
return rpcResult.getResult().getInterfaceName();
}
} catch (InterruptedException | ExecutionException e) {
- LOG.warn("Exception when getting external tunnel interface Id for tunnel between {} and {}", srcDpId, dstIp, e);
+ LOG.warn("Exception when getting tunnel interface Id for tunnel between {} and {}", srcDpId, dstIp, e);
}
return null;
addVpnNexthopToDS(dpnId, vpnId, ipAddress, groupId);
// install Group
- // FIXME: mdsalManager.syncInstallGroup(groupEntity);
- mdsalManager.installGroup(groupEntity);
+ mdsalManager.syncInstallGroup(groupEntity, FIXED_DELAY_IN_MILLISECONDS);
} else {
//nexthop exists already; a new flow is going to point to it, increment the flowrefCount by 1
LOG.trace("getRemoteNextHopPointer: input [localDpnId {} remoteDpnId {}, vpnId {}, prefixIp {}, nextHopIp {} ]",
localDpnId, remoteDpnId, vpnId, prefixIp, nextHopIp);
- // check if the incoming VM is within the same DC. If so, retrieve the local tunnel group pointer.
- // Else retrieve the tunnel to DC gateway group pointer.
-
- if (localDpnId == null || BigInteger.ZERO.equals(localDpnId)) {
- VpnNexthop vpnNexthop = getVpnNexthop(vpnId, prefixIp);
- //If the vrf entry is a static/extra route, the nexthop of the entry would be a adjacency in the vpn
- if(vpnNexthop == null) {
- vpnNexthop = getVpnNexthop(vpnId, nextHopIp + "/32");
- }
- localDpnId = (vpnNexthop == null) ? null : vpnNexthop.getDpnId();
- }
LOG.trace("getRemoteNextHopPointer: Calling ITM with localDpnId {} ", localDpnId);
- try{
- // here use the config for tunnel type param
- if(localDpnId != null){
- //internal tunnel
- tunnelIfName = getTunnelInterfaceName(remoteDpnId, localDpnId);
- } else {
- //external tunnel
- tunnelIfName = getExternalTunnelInterfaceName(remoteDpnId,
- IpAddressBuilder.getDefaultInstance(nextHopIp));
+ if (nextHopIp != null && !nextHopIp.isEmpty()) {
+ try{
+ // here use the config for tunnel type param
+ tunnelIfName = getTunnelInterfaceName(remoteDpnId, IpAddressBuilder.getDefaultInstance(nextHopIp));
+ }catch(Exception ex){
+ LOG.error("Error while retrieving nexthop pointer for nexthop {} : ", nextHopIp, ex.getMessage());
}
- }catch(Exception ex){
- LOG.error("Error while retrieving nexthop pointer for DC Gateway : ", ex.getMessage());
}
return tunnelIfName;
}
GroupEntity groupEntity = MDSALUtil.buildGroupEntity(
dpnId, nh.getEgressPointer(), ipAddress, GroupTypes.GroupIndirect, null);
// remove Group ...
- // FIXME: mdsalManager.syncRemoveGroup(groupEntity);
- mdsalManager.removeGroup(groupEntity);
+ mdsalManager.syncRemoveGroup(groupEntity);
//update MD-SAL DS
removeVpnNexthopFromDS(vpnId, ipAddress);
//release groupId
.child(VpnInterface.class, new VpnInterfaceKey(vpnInterfaceName)).augmentation(
Adjacencies.class).child(Adjacency.class, new AdjacencyKey(ipAddress)).build();
}
+
+ InstanceIdentifier<Adjacencies> getAdjListPath(String vpnInterfaceName) {
+ return InstanceIdentifier.builder(VpnInterfaces.class)
+ .child(VpnInterface.class, new VpnInterfaceKey(vpnInterfaceName)).augmentation(
+ Adjacencies.class).build();
+ }
}