2 * Copyright (c) 2013 Cisco 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.openflowplugin.testcommon;
10 import org.opendaylight.mdsal.binding.api.DataBroker;
11 import org.opendaylight.mdsal.binding.api.NotificationService;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
16 * Provides activation and deactivation of drop responder service - responds on packetIn.
18 public class DropTestDsProvider implements AutoCloseable {
19 private static final Logger LOG = LoggerFactory.getLogger(DropTestDsProvider.class);
21 private DataBroker dataService;
22 private NotificationService notificationService;
23 private final DropTestCommiter commiter = new DropTestCommiter();
24 private boolean active = false;
27 * Returns the message counts.
29 public DropTestStats getStats() {
30 return commiter.getStats();
34 * Reset message counts.
36 public void clearStats() {
37 commiter.clearStats();
40 public void setDataService(final DataBroker dataService) {
41 this.dataService = dataService;
44 public void setNotificationService(final NotificationService notificationService) {
45 this.notificationService = notificationService;
49 * Activates the drop responder.
52 commiter.setDataService(dataService);
53 commiter.setNotificationService(notificationService);
56 LOG.debug("DropTestProvider Started.");
61 LOG.debug("DropTestProvider stopped.");
62 if (commiter != null) {
69 * Returns the active state.
71 public boolean isActive() {