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.sal.binding.api.NotificationProviderService;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
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 DropTestRpcProvider implements AutoCloseable {
19 private static final Logger LOG = LoggerFactory.getLogger(DropTestDsProvider.class);
21 private SalFlowService flowService;
22 private NotificationProviderService notificationService;
23 private DropTestRpcSender commiter = new DropTestRpcSender();
24 private boolean active = false;
27 * @param flowService value for setter
29 public void setFlowService(final SalFlowService flowService) {
30 this.flowService = flowService;
34 * @param notificationService value for setter
36 public void setNotificationService(final NotificationProviderService notificationService) {
37 this.notificationService = notificationService;
41 * activates drop responder
44 commiter.setFlowService(flowService);
45 commiter.setNotificationService(notificationService);
48 LOG.debug("DropTestProvider Started.");
52 * @return message counts
54 public DropTestStats getStats() {
55 if (this.commiter != null) {
56 return commiter.getStats();
58 return new DropTestStats("Not initialized yet.");
63 * reset message counts
65 public void clearStats() {
66 if (commiter != null) {
67 commiter.clearStats();
73 LOG.debug("DropTestProvider stopped.");
74 if (commiter != null) {
83 public boolean isActive() {