642efc448e5bed91878df721b6b1274e1bd00f09
[openflowplugin.git] / drop-test / src / main / java / org / opendaylight / openflowplugin / droptest / DropTestActivator.java
1 /**
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.openflowplugin.droptest;
9
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
11 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
12 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
13 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
14 import org.opendaylight.openflowplugin.outputtest.OutputTestCommandProvider;
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.osgi.framework.BundleContext;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
21
22 @SuppressWarnings("all")
23 public class DropTestActivator extends AbstractBindingAwareProvider {
24     private static Logger LOG = LoggerFactory.getLogger(DropTestActivator.class);
25
26     private static DropTestDsProvider provider = new DropTestDsProvider();
27
28     private static DropTestRpcProvider rpcProvider = new DropTestRpcProvider();
29
30     private static DropTestCommandProvider cmdProvider;
31
32     private static OutputTestCommandProvider outCmdProvider;
33
34
35     public void onSessionInitiated(final ProviderContext session) {
36         LOG.debug("Activator DropAllPack INIT");
37         provider.setDataService(session.<DataBroker>getSALService(DataBroker.class));
38
39         provider.setNotificationService(session.<NotificationProviderService>getSALService(NotificationProviderService.class));
40
41         cmdProvider.onSessionInitiated(session);
42
43         rpcProvider.setNotificationService(session.<NotificationProviderService>getSALService(NotificationProviderService.class));
44
45         rpcProvider.setFlowService(session.<SalFlowService>getRpcService(SalFlowService.class));
46         outCmdProvider.onSessionInitiated(session);
47
48         LOG.debug("Activator DropAllPack END");
49     }
50
51     public void startImpl(final BundleContext ctx) {
52         super.startImpl(ctx);
53 //      LOG.debug("-------------------------------------    DROP ALL PACK TEST INITIATED ------------------------ ")
54         cmdProvider = new DropTestCommandProvider(ctx, provider, rpcProvider);
55         outCmdProvider = new OutputTestCommandProvider(ctx);
56     }
57
58     protected void stopImpl(final BundleContext context) {
59 //      LOG.debug("--------------------------------------    DROP ALL PACK TEST STOPED --------------------------- ")
60         provider.close();
61     }
62 }