2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netvirt.elan.internal;
10 public class ElanItmEventListener{
13 //public class ElanItmEventListener extends AbstractDataChangeListener<DataObject> implements AutoCloseable {
14 //FIXME: This class is to be made functional once ITM is added
15 // private static final Logger LOG = LoggerFactory.getLogger(ElanItmEventListener.class);
16 // private final DataBroker broker;
17 // private ListenerRegistration<DataChangeListener> listenerRegistration;
18 // private ElanInterfaceManager elanInterfaceManager;
20 // public ElanItmEventListener(final DataBroker db, final ElanInterfaceManager ifManager) {
21 // super(StateTunnelList.class);
23 // elanInterfaceManager = ifManager;
24 // registerListener(db);
27 // private void registerListener(final DataBroker db) {
29 // listenerRegistration = broker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
30 // getWildCardPath(), ElanItmEventListener.this, AsyncDataBroker.DataChangeScope.SUBTREE);
31 // } catch (final Exception e) {
32 // LOG.error("ITM Monitor Interfaces DataChange listener registration fail!", e);
33 // throw new IllegalStateException("ITM Monitor registration Listener failed.", e);
37 // private InstanceIdentifier<StateTunnelList> getWildCardPath() {
38 // return InstanceIdentifier.create(TunnelsState.class).child(StateTunnelList.class);
42 // public void close() throws Exception {
43 // if (listenerRegistration != null) {
45 // listenerRegistration.close();
46 // } catch (final Exception e) {
47 // LOG.error("Error when cleaning up DataChangeListener.", e);
49 // listenerRegistration = null;
54 // protected void remove(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList del) {
59 // protected void update(InstanceIdentifier<StateTunnelList> identifier,
60 // StateTunnelList original, StateTunnelList update) {
62 // BigInteger srcDpId = update.getSourceDPN();
63 // BigInteger dstDpId = update.getDestinationDPN();
64 // LOG.trace("ITM Tunnel state event changed from :{} to :{} for transportZone:{}",
65 // original.isLogicalTunnelState(), update.isLogicalTunnelState(), update.getLogicalTunnelGroupName());
67 // if(update.isLogicalTunnelState()) {
68 // LOG.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId);
69 // elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId);
74 // protected void add(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList add) {
75 // BigInteger srcDpId = add.getSourceDPN();
76 // BigInteger dstDpId = add.getDestinationDPN();
77 // LOG.trace("ITM Tunnel state event:{} for transportZone:{} of {}", add.isLogicalTunnelState(),
78 // add.getLogicalTunnelGroupName());
80 // if(add.isLogicalTunnelState()) {
81 // LOG.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId);
82 // elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId);