2 * Copyright (c) 2017 HPE, Inc. 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.statistics;
10 import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
13 import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
14 import org.opendaylight.netvirt.statistics.api.ICountersInterfaceChangeHandler;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
17 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19 public class CountersServiceInterfaceListener
20 extends AsyncDataTreeChangeListenerBase<Interface, CountersServiceInterfaceListener>
21 implements ClusteredDataTreeChangeListener<Interface> {
23 private final ICountersInterfaceChangeHandler cich;
24 private final DataBroker db;
26 public CountersServiceInterfaceListener(final DataBroker db, final ICountersInterfaceChangeHandler cich) {
27 super(Interface.class, CountersServiceInterfaceListener.class);
30 registerListener(LogicalDatastoreType.CONFIGURATION, db);
34 protected InstanceIdentifier<Interface> getWildCardPath() {
35 return InstanceIdentifier.create(Interfaces.class).child(Interface.class);
39 protected void remove(InstanceIdentifier<Interface> key, Interface port) {
40 cich.handleInterfaceRemoval(port.getName());
44 protected void update(InstanceIdentifier<Interface> key, Interface portBefore, Interface portAfter) {
48 protected void add(InstanceIdentifier<Interface> key, Interface port) {
52 protected CountersServiceInterfaceListener getDataTreeChangeListener() {