X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=test-provider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Ftest%2FOpenflowpluginGroupTestServiceProvider.java;h=7f12e32b604c5416cfac4235e688962f3a3be508;hb=cfe3a97837951ebbedb337dc988027f10c49f714;hp=fb75736a36a0a4ac67ac9005dc97dd05f8771dc8;hpb=e1ef8b31e7f6c908e06d947bd10f51e498378ab5;p=openflowplugin.git diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java index fb75736a36..7f12e32b60 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java @@ -1,17 +1,16 @@ -/** +/* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowplugin.test; -import java.util.concurrent.Future; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; -import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import com.google.common.collect.ImmutableSet; +import com.google.common.util.concurrent.ListenableFuture; +import org.opendaylight.mdsal.binding.api.NotificationPublishService; +import org.opendaylight.mdsal.binding.api.RpcProviderService; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput; @@ -19,7 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.Rem import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; @@ -27,7 +25,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N import org.opendaylight.yangtools.concepts.AbstractObjectRegistration; import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder; import org.opendaylight.yangtools.yang.common.RpcResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,44 +34,38 @@ public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable, private static final Logger LOG = LoggerFactory .getLogger(OpenflowpluginGroupTestServiceProvider.class); - private RoutedRpcRegistration groupRegistration; - private NotificationProviderService notificationService; + private ObjectRegistration groupRegistration; + private NotificationPublishService notificationService; /** - * get group registration + * Get group registration. * * @return {@link #groupRegistration} */ - public RoutedRpcRegistration getGroupRegistration() { + public ObjectRegistration getGroupRegistration() { return groupRegistration; } /** - * set {@link #groupRegistration} - * - * @param groupRegistration + * Set {@link #groupRegistration}. */ - public void setGroupRegistration( - final RoutedRpcRegistration groupRegistration) { + public void setGroupRegistration(final ObjectRegistration groupRegistration) { this.groupRegistration = groupRegistration; } /** - * get notification service + * Get notification service. * * @return {@link #notificationService} */ - public NotificationProviderService getNotificationService() { + public NotificationPublishService getNotificationService() { return notificationService; } /** - * set {@link #notificationService} - * - * @param notificationService + * Set {@link #notificationService}. */ - public void setNotificationService( - final NotificationProviderService notificationService) { + public void setNotificationService(final NotificationPublishService notificationService) { this.notificationService = notificationService; } @@ -105,9 +96,8 @@ public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable, * .service.rev130918.AddGroupInput) */ @Override - public Future> addGroup(AddGroupInput input) { - String plus = ("addGroup - " + input); - OpenflowpluginGroupTestServiceProvider.LOG.info(plus); + public ListenableFuture> addGroup(AddGroupInput input) { + OpenflowpluginGroupTestServiceProvider.LOG.info("addGroup - {}", input); return null; } @@ -121,10 +111,9 @@ public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable, * .group.service.rev130918.RemoveGroupInput) */ @Override - public Future> removeGroup( + public ListenableFuture> removeGroup( RemoveGroupInput input) { - String plus = ("removeGroup - " + input); - OpenflowpluginGroupTestServiceProvider.LOG.info(plus); + OpenflowpluginGroupTestServiceProvider.LOG.info("removeGroup - {}", input); return null; } @@ -138,42 +127,22 @@ public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable, * .group.service.rev130918.UpdateGroupInput) */ @Override - public Future> updateGroup( + public ListenableFuture> updateGroup( UpdateGroupInput input) { - String plus = ("updateGroup - " + input); - OpenflowpluginGroupTestServiceProvider.LOG.info(plus); + OpenflowpluginGroupTestServiceProvider.LOG.info("updateGroup - {}", input); return null; } - /** - * @param ctx - * @return {@link ObjectRegistration} - */ - public ObjectRegistration register( - final ProviderContext ctx) { - RoutedRpcRegistration addRoutedRpcImplementation = ctx - . addRoutedRpcImplementation( - SalGroupService.class, this); - setGroupRegistration(addRoutedRpcImplementation); - - InstanceIdentifierBuilder builder1 = InstanceIdentifier - . builder(Nodes.class); + public ObjectRegistration register(final RpcProviderService rpcRegistry) { + setGroupRegistration(rpcRegistry.registerRpcImplementation(SalGroupService.class, this, ImmutableSet.of( + InstanceIdentifier.create(Nodes.class) + .child(Node.class, new NodeKey(new NodeId(OpenflowpluginTestActivator.NODE_ID)))))); - NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID); - NodeKey nodeKey = new NodeKey(nodeId); - - InstanceIdentifierBuilder nodeIndentifier = builder1 - . child(Node.class, nodeKey); - InstanceIdentifier instance = nodeIndentifier.build(); - groupRegistration.registerPath(NodeContext.class, instance); - RoutedRpcRegistration groupRegistration1 = this - .getGroupRegistration(); return new AbstractObjectRegistration(this) { @Override protected void removeRegistration() { - groupRegistration1.close(); + groupRegistration.close(); } }; } - }