ELAN FT Support for BE
[vpnservice.git] / elanmanager / elanmanager-impl / src / main / java / org / opendaylight / vpnservice / 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.vpnservice.elan.internal;
9
10 //import org.opendaylight.controller.md.sal.binding.api.DataBroker;
11 //import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
12 //import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
13 //import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
14 //import org.opendaylight.vpnservice.mdsalutil.AbstractDataChangeListener;
15 //import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.itm.op.rev150701.TunnelsState;
16 //import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.itm.op.rev150701.tunnels_state.StateTunnelList;
17 //import org.opendaylight.yangtools.concepts.ListenerRegistration;
18 //import org.opendaylight.yangtools.yang.binding.DataObject;
19 //import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
20 //import org.slf4j.Logger;
21 //import org.slf4j.LoggerFactory;
22 //
23 //import java.math.BigInteger;
24
25 public class ElanItmEventListener{
26
27 }
28 //public class ElanItmEventListener extends AbstractDataChangeListener<DataObject> implements AutoCloseable {
29 //FIXME: This class is to be made functional once ITM is added
30 //    private static final Logger logger = LoggerFactory.getLogger(ElanItmEventListener.class);
31 //    private final DataBroker broker;
32 //    private ListenerRegistration<DataChangeListener> listenerRegistration;
33 //    private ElanInterfaceManager elanInterfaceManager;
34 //
35 //    public ElanItmEventListener(final DataBroker db, final ElanInterfaceManager ifManager) {
36 //        super(StateTunnelList.class);
37 //        broker = db;
38 //        elanInterfaceManager = ifManager;
39 //        registerListener(db);
40 //    }
41 //
42 //    private void registerListener(final DataBroker db) {
43 //        try {
44 //            listenerRegistration = broker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
45 //                    getWildCardPath(), ElanItmEventListener.this, AsyncDataBroker.DataChangeScope.SUBTREE);
46 //        } catch (final Exception e) {
47 //            logger.error("ITM Monitor Interfaces DataChange listener registration fail!", e);
48 //            throw new IllegalStateException("ITM Monitor registration Listener failed.", e);
49 //        }
50 //    }
51 //
52 //    private InstanceIdentifier<StateTunnelList> getWildCardPath() {
53 //        return InstanceIdentifier.create(TunnelsState.class).child(StateTunnelList.class);
54 //    }
55 //
56 //    @Override
57 //    public void close() throws Exception {
58 //        if (listenerRegistration != null) {
59 //            try {
60 //                listenerRegistration.close();
61 //            } catch (final Exception e) {
62 //                logger.error("Error when cleaning up DataChangeListener.", e);
63 //            }
64 //            listenerRegistration = null;
65 //        }
66 //    }
67 //
68 //    @Override
69 //    protected void remove(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList del) {
70 //
71 //    }
72 //
73 //    @Override
74 //    protected void update(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList original, StateTunnelList update) {
75 //        BigInteger srcDpId = update.getSourceDPN();
76 //        BigInteger dstDpId = update.getDestinationDPN();
77 //        logger.trace("ITM Tunnel state event changed from :{} to :{} for transportZone:{}",original.isLogicalTunnelState(), update.isLogicalTunnelState(), update.getLogicalTunnelGroupName());
78 //
79 //        if(update.isLogicalTunnelState()) {
80 //            logger.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId);
81 //            elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId);
82 //        }
83 //    }
84 //
85 //    @Override
86 //    protected void add(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList add) {
87 //        BigInteger srcDpId =  add.getSourceDPN();
88 //        BigInteger dstDpId = add.getDestinationDPN();
89 //        logger.trace("ITM Tunnel state event:{} for transportZone:{} of {}", add.isLogicalTunnelState(), add.getLogicalTunnelGroupName());
90 //
91 //        if(add.isLogicalTunnelState()) {
92 //            logger.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId);
93 //            elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId);
94 //        }
95 //    }
96 //}