SubnetRoute enhancements to VPN Service models
[vpnservice.git] / vpnmanager / vpnmanager-impl / src / main / java / org / opendaylight / vpnservice / InterfaceStateChangeListener.java
index 206f884a3c6dcfb56bbd25669cd6e9c9bb33d7f2..5e6cc303cd61fefa48cfdd898175cedc1def958c 100644 (file)
@@ -80,10 +80,12 @@ public class InterfaceStateChangeListener extends AbstractDataChangeListener<Int
         if (configInterface != null && configInterface.getType().equals(Tunnel.class)) {
           if(intrf.getOperStatus().equals(Interface.OperStatus.Up)) {
             //advertise all prefixes in all vpns for this dpn to bgp
-            vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.ADVERTISE_ROUTE);
+            // FIXME: Blocked until tunnel event[vxlan/gre] support is available
+            // vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.ADVERTISE_ROUTE);
           }
         } else {
           vpnInterfaceManager.processVpnInterfaceUp(dpnId, interfaceName, intrf.getIfIndex());
+          vpnInterfaceManager.getVpnSubnetRouteHandler().onInterfaceUp(intrf);
         }
       } catch (Exception e) {
         LOG.error("Exception caught in Interface Operational State Up event", e);
@@ -101,17 +103,15 @@ public class InterfaceStateChangeListener extends AbstractDataChangeListener<Int
       try {
         String interfaceName = intrf.getName();
         LOG.info("Received port DOWN event for interface {} ", interfaceName);
-        org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface
-            intf = InterfaceUtils.getInterface(broker, interfaceName);
         BigInteger dpId = InterfaceUtils.getDpIdFromInterface(intrf);
-        if (intf != null && intf.getType().equals(Tunnel.class)) {
-          if(intrf.getOperStatus().equals(Interface.OperStatus.Down)) {
-            //withdraw all prefixes in all vpns for this dpn from bgp
-            vpnInterfaceManager.updatePrefixesForDPN(dpId, VpnInterfaceManager.UpdateRouteAction.WITHDRAW_ROUTE);
-          }
+        if (intrf != null && intrf.getType() != null && intrf.getType().equals(Tunnel.class)) {
+          //withdraw all prefixes in all vpns for this dpn from bgp
+          // FIXME: Blocked until tunnel event[vxlan/gre] support is available
+          // vpnInterfaceManager.updatePrefixesForDPN(dpId, VpnInterfaceManager.UpdateRouteAction.WITHDRAW_ROUTE);
         } else {
           if (VpnUtil.isVpnInterfaceConfigured(broker, interfaceName)) {
             vpnInterfaceManager.processVpnInterfaceDown(dpId, interfaceName, intrf.getIfIndex(), true);
+            vpnInterfaceManager.getVpnSubnetRouteHandler().onInterfaceDown(intrf);
           }
         }
       } catch (Exception e) {
@@ -127,14 +127,18 @@ public class InterfaceStateChangeListener extends AbstractDataChangeListener<Int
       org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface
           intf = InterfaceUtils.getInterface(broker, interfaceName);
       if (intf != null && intf.getType().equals(Tunnel.class)) {
+        /*
+        // FIXME: Blocked until tunnel event[vxlan/gre] support is available
         BigInteger dpnId = InterfaceUtils.getDpIdFromInterface(update);
         if(update.getOperStatus().equals(Interface.OperStatus.Up)) {
           //advertise all prefixes in all vpns for this dpn to bgp
-          vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.ADVERTISE_ROUTE);
+          // vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.ADVERTISE_ROUTE);
+                    vpnInterfaceManager.getVpnSubnetRouteHandler().onInterfaceUp(update);
         } else if(update.getOperStatus().equals(Interface.OperStatus.Down)) {
           //withdraw all prefixes in all vpns for this dpn from bgp
-          vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.WITHDRAW_ROUTE);
-        }
+          // vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.WITHDRAW_ROUTE);
+                   vpnInterfaceManager.getVpnSubnetRouteHandler().onInterfaceDown(update);
+        }*/
       }
 
     }