Added test-provider project.
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / OpenflowpluginTestActivator.xtend
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.test
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.osgi.framework.BundleContext
15
16 class OpenflowpluginTestActivator extends AbstractBindingAwareProvider {
17
18     static var OpenflowpluginTestServiceProvider provider = new OpenflowpluginTestServiceProvider();
19     var OpenflowpluginTestCommandProvider cmdProvider;
20     public static final String NODE_ID =  "foo:node:1";
21
22     override onSessionInitiated(ProviderContext session) {
23         provider.dataService = session.getSALService(DataProviderService)
24         provider.notificationService = session.getSALService(NotificationProviderService)
25         provider.start();
26         provider.register(session);
27         cmdProvider.onSessionInitiated(session);
28         
29     }
30     
31     override startImpl(BundleContext ctx) {
32         super.startImpl(ctx);
33         cmdProvider = new OpenflowpluginTestCommandProvider(ctx);
34         
35     }
36
37     override protected stopImpl(BundleContext context) {
38         provider.close();
39     }
40
41 }