2 * Copyright (c) 2016 Brocade Communications Systems, 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.controller.clustering.it.provider;
10 import org.opendaylight.mdsal.binding.api.DataObjectModification;
11 import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
12 import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
13 import org.opendaylight.mdsal.binding.api.DataTreeModification;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.Cars;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * Provides a basic DTCL implementation for performance testing reasons. Emits a rudimentary
21 * summary of the changes that occurred.
23 * @author Ryan Goulding (ryandgoulding@gmail.com)
25 public class CarDataTreeChangeListener implements DataTreeChangeListener<Cars> {
26 private static final Logger LOG = LoggerFactory.getLogger(CarDataTreeChangeListener.class);
29 public void onDataTreeChanged(final java.util.Collection<DataTreeModification<Cars>> changes) {
30 if (LOG.isTraceEnabled()) {
31 for (DataTreeModification<Cars> change : changes) {
32 outputChanges(change);
37 private static void outputChanges(final DataTreeModification<Cars> change) {
38 final DataObjectModification<Cars> rootNode = change.getRootNode();
39 final ModificationType modificationType = rootNode.getModificationType();
40 final InstanceIdentifier<Cars> rootIdentifier = change.getRootPath().getRootIdentifier();
41 switch (modificationType) {
43 case SUBTREE_MODIFIED: {
44 LOG.trace("onDataTreeChanged - Cars config with path {} was added or changed from {} to {}",
45 rootIdentifier, rootNode.getDataBefore(), rootNode.getDataAfter());
49 LOG.trace("onDataTreeChanged - Cars config with path {} was deleted", rootIdentifier);
53 LOG.trace("onDataTreeChanged called with unknown modificationType: {}", modificationType);