9a91f31fed2ff1a255b09922e9b9405ce402598a
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / internal / ElanItmEventListener.java
1 /*
2  * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.netvirt.elan.internal;
9
10 public class ElanItmEventListener{
11
12 }
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;
19 //
20 //    public ElanItmEventListener(final DataBroker db, final ElanInterfaceManager ifManager) {
21 //        super(StateTunnelList.class);
22 //        broker = db;
23 //        elanInterfaceManager = ifManager;
24 //        registerListener(db);
25 //    }
26 //
27 //    private void registerListener(final DataBroker db) {
28 //        try {
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);
34 //        }
35 //    }
36 //
37 //    private InstanceIdentifier<StateTunnelList> getWildCardPath() {
38 //        return InstanceIdentifier.create(TunnelsState.class).child(StateTunnelList.class);
39 //    }
40 //
41 //    @Override
42 //    public void close() throws Exception {
43 //        if (listenerRegistration != null) {
44 //            try {
45 //                listenerRegistration.close();
46 //            } catch (final Exception e) {
47 //                LOG.error("Error when cleaning up DataChangeListener.", e);
48 //            }
49 //            listenerRegistration = null;
50 //        }
51 //    }
52 //
53 //    @Override
54 //    protected void remove(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList del) {
55 //
56 //    }
57 //
58 //    @Override
59 //    protected void update(InstanceIdentifier<StateTunnelList> identifier,
60 //        StateTunnelList original, StateTunnelList update) {
61 //
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());
66 //
67 //        if(update.isLogicalTunnelState()) {
68 //            LOG.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId);
69 //            elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId);
70 //        }
71 //    }
72 //
73 //    @Override
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());
79 //
80 //        if(add.isLogicalTunnelState()) {
81 //            LOG.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId);
82 //            elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId);
83 //        }
84 //    }
85 //}