Fixes in interface manager and aliveness monitor
[vpnservice.git] / interfacemgr / interfacemgr-impl / src / main / java / org / opendaylight / vpnservice / interfacemgr / listeners / AlivenessMonitorListener.java
index 9f8b84ccbec423903a66eddd2c5f65da6ba3592f..e7ddbab96818417fa896196b0280669c21daaa92 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
+ * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -52,23 +52,17 @@ public class AlivenessMonitorListener implements org.opendaylight.yang.gen.v1.ur
     @Override
     public void onMonitorEvent(MonitorEvent notification) {
         Long monitorId = notification.getEventData().getMonitorId();
     @Override
     public void onMonitorEvent(MonitorEvent notification) {
         Long monitorId = notification.getEventData().getMonitorId();
-        String trunkInterfaceName = AlivenessMonitorUtils.getInterfaceFromMonitorId(dataBroker, monitorId);
-        if (trunkInterfaceName == null) {
-            LOG.debug("Either monitoring for interface - {} not started by Interfacemgr or it is not LLDP monitoring", trunkInterfaceName);
+        String tunnelInterface = AlivenessMonitorUtils.getInterfaceFromMonitorId(dataBroker, monitorId);
+        if (tunnelInterface == null) {
+            LOG.debug("Either monitoring for interface - {} not started by Interfacemgr or it is not LLDP monitoring", tunnelInterface);
             return;
         }
         LivenessState livenessState = notification.getEventData().getMonitorState();
             return;
         }
         LivenessState livenessState = notification.getEventData().getMonitorState();
-        Interface interfaceInfo = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(trunkInterfaceName),
-                dataBroker);
-        IfTunnel tunnelInfo = interfaceInfo.getAugmentation(IfTunnel.class);
-        // Not handling monitoring event if it is GRE Trunk Interface.
-        if (tunnelInfo.getTunnelInterfaceType().isAssignableFrom(TunnelTypeGre.class)) {
-            return;
-        }
+        LOG.debug("received monitor event for {} with livenessstate {}", tunnelInterface, livenessState);
         org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus opState =
                 livenessState == LivenessState.Up ? org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus.Up :
                         org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus.Down;
         org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus opState =
                 livenessState == LivenessState.Up ? org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus.Up :
                         org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus.Down;
-        InterfaceManagerCommonUtils.setOpStateForInterface(dataBroker, trunkInterfaceName, opState);
+        InterfaceManagerCommonUtils.setOpStateForInterface(dataBroker, tunnelInterface, opState);
     }
 
     }
 
-}
\ No newline at end of file
+}