X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=elanmanager%2Felanmanager-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fvpnservice%2Felan%2Finternal%2FElanItmEventListener.java;fp=elanmanager%2Felanmanager-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fvpnservice%2Felan%2Finternal%2FElanItmEventListener.java;h=2f8394cdecdbaa6cfc61f447f48d77c6afab72da;hb=3510292a1184e25751f8690ea49a8c2312bba4b3;hp=0000000000000000000000000000000000000000;hpb=00b0d63ef8325f3b9b32b4dbee0c11a51eed1440;p=vpnservice.git diff --git a/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/vpnservice/elan/internal/ElanItmEventListener.java b/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/vpnservice/elan/internal/ElanItmEventListener.java new file mode 100755 index 00000000..2f8394cd --- /dev/null +++ b/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/vpnservice/elan/internal/ElanItmEventListener.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 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, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.vpnservice.elan.internal; + +//import org.opendaylight.controller.md.sal.binding.api.DataBroker; +//import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +//import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; +//import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +//import org.opendaylight.vpnservice.mdsalutil.AbstractDataChangeListener; +//import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.itm.op.rev150701.TunnelsState; +//import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.itm.op.rev150701.tunnels_state.StateTunnelList; +//import org.opendaylight.yangtools.concepts.ListenerRegistration; +//import org.opendaylight.yangtools.yang.binding.DataObject; +//import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +// +//import java.math.BigInteger; + +public class ElanItmEventListener{ + +} +//public class ElanItmEventListener extends AbstractDataChangeListener implements AutoCloseable { +//FIXME: This class is to be made functional once ITM is added +// private static final Logger logger = LoggerFactory.getLogger(ElanItmEventListener.class); +// private final DataBroker broker; +// private ListenerRegistration listenerRegistration; +// private ElanInterfaceManager elanInterfaceManager; +// +// public ElanItmEventListener(final DataBroker db, final ElanInterfaceManager ifManager) { +// super(StateTunnelList.class); +// broker = db; +// elanInterfaceManager = ifManager; +// registerListener(db); +// } +// +// private void registerListener(final DataBroker db) { +// try { +// listenerRegistration = broker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, +// getWildCardPath(), ElanItmEventListener.this, AsyncDataBroker.DataChangeScope.SUBTREE); +// } catch (final Exception e) { +// logger.error("ITM Monitor Interfaces DataChange listener registration fail!", e); +// throw new IllegalStateException("ITM Monitor registration Listener failed.", e); +// } +// } +// +// private InstanceIdentifier getWildCardPath() { +// return InstanceIdentifier.create(TunnelsState.class).child(StateTunnelList.class); +// } +// +// @Override +// public void close() throws Exception { +// if (listenerRegistration != null) { +// try { +// listenerRegistration.close(); +// } catch (final Exception e) { +// logger.error("Error when cleaning up DataChangeListener.", e); +// } +// listenerRegistration = null; +// } +// } +// +// @Override +// protected void remove(InstanceIdentifier identifier, StateTunnelList del) { +// +// } +// +// @Override +// protected void update(InstanceIdentifier identifier, StateTunnelList original, StateTunnelList update) { +// BigInteger srcDpId = update.getSourceDPN(); +// BigInteger dstDpId = update.getDestinationDPN(); +// logger.trace("ITM Tunnel state event changed from :{} to :{} for transportZone:{}",original.isLogicalTunnelState(), update.isLogicalTunnelState(), update.getLogicalTunnelGroupName()); +// +// if(update.isLogicalTunnelState()) { +// logger.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId); +// elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId); +// } +// } +// +// @Override +// protected void add(InstanceIdentifier identifier, StateTunnelList add) { +// BigInteger srcDpId = add.getSourceDPN(); +// BigInteger dstDpId = add.getDestinationDPN(); +// logger.trace("ITM Tunnel state event:{} for transportZone:{} of {}", add.isLogicalTunnelState(), add.getLogicalTunnelGroupName()); +// +// if(add.isLogicalTunnelState()) { +// logger.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId); +// elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId); +// } +// } +//}