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.sal.binding.api.NotificationProviderService;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
12 import org.opendaylight.yangtools.concepts.Registration;
13 import org.opendaylight.yangtools.yang.binding.NotificationListener;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 @SuppressWarnings("all")
18 public class DropTestRpcProvider implements AutoCloseable {
19 private final static Logger LOG = LoggerFactory.getLogger(DropTestProvider.class);
21 private SalFlowService _flowService;
22 private NotificationProviderService _notificationService;
23 private DropTestRpcSender commiter;
24 private Registration<NotificationListener> listenerRegistration;
26 public SalFlowService getFlowService() {
27 return this._flowService;
30 public void setFlowService(final SalFlowService flowService) {
31 this._flowService = flowService;
34 public NotificationProviderService getNotificationService() {
35 return this._notificationService;
38 public void setNotificationService(final NotificationProviderService notificationService) {
39 this._notificationService = notificationService;
43 this.commiter = new DropTestRpcSender(this.getFlowService());
44 this.listenerRegistration = this.getNotificationService().registerNotificationListener(this.commiter);
45 LOG.debug("DropTestProvider Started.");
48 public DropTestStats getStats() {
49 if(this.commiter != null) {
50 return this.commiter.getStats();
52 return new DropTestStats("Not initialized yet.");
56 public void clearStats() {
57 if(this.commiter != null) {
58 this.commiter.clearStats();
65 LOG.debug("DropTestProvider stopped.");
66 if (this.listenerRegistration != null) {
67 this.listenerRegistration.close();
69 } catch (Exception _e) {