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 com.google.common.collect.ImmutableSet;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
13 import org.opendaylight.mdsal.binding.api.RpcProviderService;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
25 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
26 import org.opendaylight.yangtools.concepts.ObjectRegistration;
27 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
28 import org.opendaylight.yangtools.yang.common.RpcResult;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
32 public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable,
35 private static final Logger LOG = LoggerFactory
36 .getLogger(OpenflowpluginGroupTestServiceProvider.class);
37 private ObjectRegistration<SalGroupService> groupRegistration;
38 private NotificationPublishService notificationService;
41 * Get group registration.
43 * @return {@link #groupRegistration}
45 public ObjectRegistration<SalGroupService> getGroupRegistration() {
46 return groupRegistration;
50 * Set {@link #groupRegistration}.
52 public void setGroupRegistration(final ObjectRegistration<SalGroupService> groupRegistration) {
53 this.groupRegistration = groupRegistration;
57 * Get notification service.
59 * @return {@link #notificationService}
61 public NotificationPublishService getNotificationService() {
62 return notificationService;
66 * Set {@link #notificationService}.
68 public void setNotificationService(final NotificationPublishService notificationService) {
69 this.notificationService = notificationService;
73 OpenflowpluginGroupTestServiceProvider.LOG
74 .info("SalGroupServiceProvider Started.");
80 * @see java.lang.AutoCloseable#close()
83 public void close() throws Exception {
84 OpenflowpluginGroupTestServiceProvider.LOG
85 .info("SalGroupServiceProvide stopped.");
86 groupRegistration.close();
93 * org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918
95 * #addGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.group
96 * .service.rev130918.AddGroupInput)
99 public ListenableFuture<RpcResult<AddGroupOutput>> addGroup(AddGroupInput input) {
100 OpenflowpluginGroupTestServiceProvider.LOG.info("addGroup - {}", input);
108 * org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918
110 * #removeGroup(org.opendaylight.yang.gen.v1.urn.opendaylight
111 * .group.service.rev130918.RemoveGroupInput)
114 public ListenableFuture<RpcResult<RemoveGroupOutput>> removeGroup(
115 RemoveGroupInput input) {
116 OpenflowpluginGroupTestServiceProvider.LOG.info("removeGroup - {}", input);
124 * org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918
126 * #updateGroup(org.opendaylight.yang.gen.v1.urn.opendaylight
127 * .group.service.rev130918.UpdateGroupInput)
130 public ListenableFuture<RpcResult<UpdateGroupOutput>> updateGroup(
131 UpdateGroupInput input) {
132 OpenflowpluginGroupTestServiceProvider.LOG.info("updateGroup - {}", input);
136 public ObjectRegistration<OpenflowpluginGroupTestServiceProvider> register(final RpcProviderService rpcRegistry) {
137 setGroupRegistration(rpcRegistry.registerRpcImplementation(SalGroupService.class, this, ImmutableSet.of(
138 InstanceIdentifier.create(Nodes.class)
139 .child(Node.class, new NodeKey(new NodeId(OpenflowpluginTestActivator.NODE_ID))))));
141 return new AbstractObjectRegistration<OpenflowpluginGroupTestServiceProvider>(this) {
143 protected void removeRegistration() {
144 groupRegistration.close();