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.droptest;
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
11 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
12 import org.opendaylight.yangtools.concepts.Registration;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
16 @SuppressWarnings("all")
17 public class DropTestProvider implements AutoCloseable {
18 private final static Logger LOG = LoggerFactory.getLogger(DropTestProvider.class);
20 private DataBroker _dataService;
21 private NotificationProviderService _notificationService;
22 private Registration listenerRegistration;
23 private final DropTestCommiter commiter = new DropTestCommiter(this);
25 public DropTestStats getStats() {
26 return this.commiter.getStats();
29 public void clearStats() {
30 this.commiter.clearStats();
33 public DataBroker getDataService() {
34 return this._dataService;
37 public void setDataService(final DataBroker dataService) {
38 this._dataService = dataService;
42 public NotificationProviderService getNotificationService() {
43 return this._notificationService;
46 public void setNotificationService(final NotificationProviderService notificationService) {
47 this._notificationService = notificationService;
51 this.listenerRegistration = this.getNotificationService().registerNotificationListener(commiter);
52 LOG.debug("DropTestProvider Started.");
57 LOG.debug("DropTestProvider stopped.");
58 if (this.listenerRegistration != null) {
59 this.listenerRegistration.close();
61 } catch (Exception e) {