2bc4caadd24f3c8dd6e0abdf7dc86e831b63ec37
[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.sal.binding.api.AbstractBindingAwareProvider;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
12 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
13 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
14 import org.opendaylight.openflowplugin.outputtest.OutputTestCommandProvider;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
16 import org.osgi.framework.BundleContext;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 @SuppressWarnings("all")
21 public class DropTestActivator extends AbstractBindingAwareProvider {
22     private static Logger LOG = LoggerFactory.getLogger(DropTestActivator.class);
23
24     private static DropTestProvider provider = new DropTestProvider();
25
26     private static DropTestRpcProvider rpcProvider = new DropTestRpcProvider();
27
28     private static DropTestCommandProvider cmdProvider;
29
30     private static OutputTestCommandProvider outCmdProvider;
31
32     public void onSessionInitiated(final ProviderContext session) {
33         LOG.debug("Activator DropAllPack INIT");
34         provider.setDataService(session.<DataProviderService>getSALService(DataProviderService.class));
35
36         provider.setNotificationService(session.<NotificationProviderService>getSALService(NotificationProviderService.class));
37
38         cmdProvider.onSessionInitiated(session);
39
40         rpcProvider.setNotificationService(session.<NotificationProviderService>getSALService(NotificationProviderService.class));
41
42         rpcProvider.setFlowService(session.<SalFlowService>getRpcService(SalFlowService.class));
43         outCmdProvider.onSessionInitiated(session);
44
45         LOG.debug("Activator DropAllPack END");
46     }
47
48     public void startImpl(final BundleContext ctx) {
49         super.startImpl(ctx);
50 //      LOG.debug("-------------------------------------    DROP ALL PACK TEST INITIATED ------------------------ ")
51         cmdProvider = new DropTestCommandProvider(ctx, provider, rpcProvider);;
52         outCmdProvider = new OutputTestCommandProvider(ctx);
53     }
54
55     protected void stopImpl(final BundleContext context) {
56 //      LOG.debug("--------------------------------------    DROP ALL PACK TEST STOPED --------------------------- ")
57         provider.close();
58     }
59 }