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.vpnservice.elan.internal;
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;
23 //import java.math.BigInteger;
25 public class ElanItmEventListener{
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;
35 // public ElanItmEventListener(final DataBroker db, final ElanInterfaceManager ifManager) {
36 // super(StateTunnelList.class);
38 // elanInterfaceManager = ifManager;
39 // registerListener(db);
42 // private void registerListener(final DataBroker db) {
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);
52 // private InstanceIdentifier<StateTunnelList> getWildCardPath() {
53 // return InstanceIdentifier.create(TunnelsState.class).child(StateTunnelList.class);
57 // public void close() throws Exception {
58 // if (listenerRegistration != null) {
60 // listenerRegistration.close();
61 // } catch (final Exception e) {
62 // logger.error("Error when cleaning up DataChangeListener.", e);
64 // listenerRegistration = null;
69 // protected void remove(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList del) {
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());
79 // if(update.isLogicalTunnelState()) {
80 // logger.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId);
81 // elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId);
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());
91 // if(add.isLogicalTunnelState()) {
92 // logger.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId);
93 // elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId);