2 * Copyright (c) 2015 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
9 package org.opendaylight.openflowplugin.droptestkaraf;
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
13 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
14 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
15 import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
16 import org.opendaylight.openflowplugin.testcommon.DropTestRpcProvider;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 * Created by Martin Bobak <mbobak@cisco.com> on 26.4.2015.
24 public class DropTestProviderImpl implements AutoCloseable {
26 private static Logger LOG = LoggerFactory.getLogger(DropTestProviderImpl.class);
28 private static DropTestDsProvider dropDsProvider = new DropTestDsProvider();
30 private static DropTestRpcProvider dropRpcProvider = new DropTestRpcProvider();
32 public DropTestProviderImpl(final DataBroker dataBroker,
33 final NotificationService notificationService,
34 final SalFlowService salFlowService) {
35 Preconditions.checkNotNull(dataBroker, "Data broker can't be empty");
36 Preconditions.checkNotNull(notificationService, "NotificationProviderService can't be empty");
37 Preconditions.checkNotNull(salFlowService, "SalFlowService can't be empty");
39 LOG.debug("Activator DropAllPack INIT");
41 dropDsProvider.setDataService(dataBroker);
42 dropDsProvider.setNotificationService(notificationService);
44 dropRpcProvider.setNotificationService(notificationService);
45 dropRpcProvider.setFlowService(salFlowService);
47 LOG.debug("Activator DropAllPack END");
50 public static DropTestDsProvider getDropDsProvider() {
51 return dropDsProvider;
54 public static DropTestRpcProvider getDropRpcProvider() {
55 return dropRpcProvider;
59 public void close() throws Exception {
60 dropDsProvider.close();
61 dropRpcProvider.close();