2 * Copyright (c) 2013 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
8 package org.opendaylight.openflowplugin.test
10 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration
12 import org.opendaylight.controller.sal.binding.api.NotificationProviderService
13 import org.opendaylight.controller.sal.binding.api.data.DataProviderService
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext
19 import org.opendaylight.yangtools.concepts.CompositeObjectRegistration
20 import org.opendaylight.yangtools.concepts.Registration
21 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
22 import org.opendaylight.yangtools.yang.binding.NotificationListener
23 import org.slf4j.LoggerFactory
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId
29 class OpenflowpluginTestServiceProvider implements AutoCloseable, SalFlowService {
32 static val LOG = LoggerFactory.getLogger(OpenflowpluginTestServiceProvider);
35 DataProviderService dataService;
38 RoutedRpcRegistration<SalFlowService> flowRegistration;
42 NotificationProviderService notificationService;
46 LOG.info("SalFlowServiceProvider Started.");
52 LOG.info("SalFlowServiceProvide stopped.");
53 flowRegistration.close;
56 override addFlow(AddFlowInput input) {
57 LOG.info("addFlow - " + input);
62 override removeFlow(RemoveFlowInput input) {
63 LOG.info("removeFlow - " + input);
67 override updateFlow(UpdateFlowInput input) {
68 LOG.info("updateFlow - " + input);
73 def CompositeObjectRegistration<OpenflowpluginTestServiceProvider> register(ProviderContext ctx) {
74 val builder = CompositeObjectRegistration
75 .<OpenflowpluginTestServiceProvider> builderFor(this);
77 flowRegistration = ctx.addRoutedRpcImplementation(SalFlowService, this);
78 val nodeIndentifier = InstanceIdentifier.builder(Nodes).child(Node, new NodeKey(new NodeId(OpenflowpluginTestActivator.NODE_ID)));
79 flowRegistration.registerPath(NodeContext, nodeIndentifier.toInstance());
80 builder.add(flowRegistration);
82 return builder.toInstance();