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.controller.md.sal.binding.api.DataBroker;
11 import org.opendaylight.controller.md.sal.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 * @return message counts
29 public DropTestStats getStats() {
30 return commiter.getStats();
34 * reset message counts
36 public void clearStats() {
37 commiter.clearStats();
41 * @param dataService value for setter
43 public void setDataService(final DataBroker dataService) {
44 this.dataService = dataService;
49 * @param notificationService value for setter
51 public void setNotificationService(final NotificationService notificationService) {
52 this.notificationService = notificationService;
56 * activates the drop responder
59 commiter.setDataService(dataService);
60 commiter.setNotificationService(notificationService);
63 LOG.debug("DropTestProvider Started.");
68 LOG.debug("DropTestProvider stopped.");
69 if (commiter != null) {
78 public boolean isActive() {