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.mdsal.binding.api.DataBroker;
13 import org.opendaylight.mdsal.binding.api.NotificationService;
14 import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
15 import org.opendaylight.openflowplugin.testcommon.DropTestRpcProvider;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 * Created by Martin Bobak <mbobak@cisco.com> on 26.4.2015.
23 public class DropTestProviderImpl implements AutoCloseable {
25 private static final Logger LOG = LoggerFactory.getLogger(DropTestProviderImpl.class);
27 private static DropTestDsProvider dropDsProvider = new DropTestDsProvider();
29 private static DropTestRpcProvider dropRpcProvider = new DropTestRpcProvider();
31 public DropTestProviderImpl(final DataBroker dataBroker,
32 final NotificationService notificationService,
33 final SalFlowService salFlowService) {
34 Preconditions.checkNotNull(dataBroker, "Data broker can't be empty");
35 Preconditions.checkNotNull(notificationService, "NotificationProviderService can't be empty");
36 Preconditions.checkNotNull(salFlowService, "SalFlowService can't be empty");
38 LOG.debug("Activator DropAllPack INIT");
40 dropDsProvider.setDataService(dataBroker);
41 dropDsProvider.setNotificationService(notificationService);
43 dropRpcProvider.setNotificationService(notificationService);
44 dropRpcProvider.setFlowService(salFlowService);
46 LOG.debug("Activator DropAllPack END");
49 public static DropTestDsProvider getDropDsProvider() {
50 return dropDsProvider;
53 public static DropTestRpcProvider getDropRpcProvider() {
54 return dropRpcProvider;
58 public void close() throws Exception {
59 dropDsProvider.close();
60 dropRpcProvider.close();