import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.IdManagerService;
import org.opendaylight.vpnservice.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.interfacemgr.rev150331.TunnelTypeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.op.rev150701.DpnEndpoints;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.op.rev150701.TunnelList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.op.rev150701.dpn.endpoints.DPNTEPsInfo;
}
for (DPNTEPsInfo srcDpn : dpnTepsList) {
logger.trace("Processing srcDpn " + srcDpn);
- List<TunnelEndPoints> meshedEndPtCache = new ArrayList<TunnelEndPoints>(srcDpn.getTunnelEndPoints()) ;
+ List<TunnelEndPoints> meshedEndPtCache = new ArrayList<TunnelEndPoints>(ItmUtils.getTEPsForDpn(srcDpn.getDPNID(), meshedDpnList)) ;
+ if(meshedEndPtCache == null ) {
+ logger.debug("No Tunnel End Point configured for this DPN {}", srcDpn.getDPNID());
+ continue ;
+ }
+ logger.debug( "Entries in meshEndPointCache {} ", meshedEndPtCache.size() );
for (TunnelEndPoints srcTep : srcDpn.getTunnelEndPoints()) {
logger.trace("Processing srcTep " + srcTep);
String srcTZone = srcTep.getTransportZone();
for (TunnelEndPoints dstTep : dstDpn.getTunnelEndPoints()) {
logger.trace("Processing dstTep " + dstTep);
if (dstTep.getTransportZone().equals(srcTZone)) {
- if( checkIfTrunkExists(dstDpn.getDPNID(), srcDpn.getDPNID(), dataBroker)) {
+ if( checkIfTrunkExists(dstDpn.getDPNID(), srcDpn.getDPNID(), srcTep.getTunnelType(),dataBroker)) {
// remove all trunk interfaces
logger.trace("Invoking removeTrunkInterface between source TEP {} , Destination TEP {} " ,srcTep , dstTep);
removeTrunkInterface(dataBroker, idManagerService, srcTep, dstTep, srcDpn.getDPNID(), dstDpn.getDPNID(), t, futures);
InstanceIdentifier.builder(DpnEndpoints.class).child(DPNTEPsInfo.class, srcDpn.getKey())
.child(TunnelEndPoints.class, srcTep.getKey()).build();
- logger.trace("Tep Removal from DPNTEPSINFO CONFIG DS " + srcTep);
+ logger.trace("Tep Removal of TEP {} from DPNTEPSINFO CONFIG DS with Key {} " + srcTep, srcTep.getKey());
t.delete(LogicalDatastoreType.CONFIGURATION, tepPath);
// remove the tep from the cache
meshedEndPtCache.remove(srcTep) ;
TunnelEndPoints srcTep, TunnelEndPoints dstTep, BigInteger srcDpnId, BigInteger dstDpnId,
WriteTransaction t, List<ListenableFuture<Void>> futures) {
String trunkfwdIfName =
- ItmUtils.getTrunkInterfaceName(idManagerService, srcTep.getInterfaceName(), srcTep.getIpAddress()
- .getIpv4Address().getValue(), dstTep.getIpAddress().getIpv4Address()
- .getValue());
+ ItmUtils.getTrunkInterfaceName( idManagerService, srcTep.getInterfaceName(),
+ srcTep.getIpAddress().getIpv4Address().getValue(),
+ dstTep.getIpAddress().getIpv4Address().getValue(),
+ srcTep.getTunnelType().getName());
logger.trace("Removing forward Trunk Interface " + trunkfwdIfName);
InstanceIdentifier<Interface> trunkIdentifier = ItmUtils.buildId(trunkfwdIfName);
logger.debug( " Removing Trunk Interface Name - {} , Id - {} from Config DS ", trunkfwdIfName, trunkIdentifier ) ;
t.delete(LogicalDatastoreType.CONFIGURATION, trunkIdentifier);
-
+ ItmUtils.itmCache.removeInterface(trunkfwdIfName);
// also update itm-state ds -- Delete the forward tunnel-interface from the tunnel list
InstanceIdentifier<InternalTunnel> path = InstanceIdentifier.create(
TunnelList.class)
- .child(InternalTunnel.class, new InternalTunnelKey( srcDpnId, dstDpnId));
+ .child(InternalTunnel.class, new InternalTunnelKey( dstDpnId, srcDpnId, srcTep.getTunnelType()));
t.delete(LogicalDatastoreType.CONFIGURATION,path) ;
+ ItmUtils.itmCache.removeInternalTunnel(trunkfwdIfName);
// Release the Ids for the forward trunk interface Name
ItmUtils.releaseIdForTrunkInterfaceName(idManagerService,srcTep.getInterfaceName(), srcTep.getIpAddress()
.getIpv4Address().getValue(), dstTep.getIpAddress().getIpv4Address()
- .getValue() );
+ .getValue(), srcTep.getTunnelType().getName() );
String trunkRevIfName =
- ItmUtils.getTrunkInterfaceName(idManagerService, dstTep.getInterfaceName(), dstTep.getIpAddress()
- .getIpv4Address().getValue(), srcTep.getIpAddress().getIpv4Address()
- .getValue());
+ ItmUtils.getTrunkInterfaceName( idManagerService, dstTep.getInterfaceName(),
+ dstTep.getIpAddress().getIpv4Address().getValue(),
+ srcTep.getIpAddress().getIpv4Address().getValue(),
+ srcTep.getTunnelType().getName());
logger.trace("Removing Reverse Trunk Interface " + trunkRevIfName);
trunkIdentifier = ItmUtils.buildId(trunkRevIfName);
logger.debug( " Removing Trunk Interface Name - {} , Id - {} from Config DS ", trunkRevIfName, trunkIdentifier ) ;
// also update itm-state ds -- Delete the reverse tunnel-interface from the tunnel list
path = InstanceIdentifier.create(
TunnelList.class)
- .child(InternalTunnel.class, new InternalTunnelKey(dstDpnId, srcDpnId));
+ .child(InternalTunnel.class, new InternalTunnelKey(dstDpnId, srcDpnId, srcTep.getTunnelType()));
t.delete(LogicalDatastoreType.CONFIGURATION,path) ;
// Release the Ids for the reverse trunk interface Name
ItmUtils.releaseIdForTrunkInterfaceName(idManagerService, dstTep.getInterfaceName(), dstTep.getIpAddress()
.getIpv4Address().getValue(), srcTep.getIpAddress().getIpv4Address()
- .getValue());
+ .getValue(),dstTep.getTunnelType().getName());
}
- private static boolean checkIfTrunkExists( BigInteger srcDpnId, BigInteger dstDpnId, DataBroker dataBroker) {
+ private static boolean checkIfTrunkExists(BigInteger srcDpnId, BigInteger dstDpnId, Class<? extends TunnelTypeBase> tunType, DataBroker dataBroker) {
boolean existsFlag = false ;
InstanceIdentifier<InternalTunnel> path = InstanceIdentifier.create(
TunnelList.class)
- .child(InternalTunnel.class, new InternalTunnelKey( srcDpnId, dstDpnId));
+ .child(InternalTunnel.class, new InternalTunnelKey( dstDpnId, srcDpnId, tunType));
Optional<InternalTunnel> internalTunnels = ItmUtils.read(LogicalDatastoreType.CONFIGURATION,path, dataBroker) ;
if( internalTunnels.isPresent())
existsFlag = true ;