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.inventory.rev130819.NodeId;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
21 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
22 import org.opendaylight.yangtools.concepts.ObjectRegistration;
23 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
24 import org.opendaylight.yangtools.yang.common.RpcResult;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
28 public class OpenflowpluginTableFeaturesTestServiceProvider implements
29 AutoCloseable, SalTableService {
31 private static final Logger LOG = LoggerFactory
32 .getLogger(OpenflowpluginTableFeaturesTestServiceProvider.class);
33 private ObjectRegistration<SalTableService> tableRegistration;
34 private NotificationPublishService notificationService;
37 * Get table registration.
39 * @return {@link #tableRegistration}
41 public ObjectRegistration<SalTableService> getTableRegistration() {
42 return this.tableRegistration;
46 * Set {@link #tableRegistration}.
48 public void setTableRegistration(final ObjectRegistration<SalTableService> tableRegistration) {
49 this.tableRegistration = tableRegistration;
53 * Get notification service.
55 * @return {@link #notificationService}
57 public NotificationPublishService getNotificationService() {
58 return this.notificationService;
62 * Set {@link #notificationService}.
64 public void setNotificationService(final NotificationPublishService notificationService) {
65 this.notificationService = notificationService;
69 OpenflowpluginTableFeaturesTestServiceProvider.LOG
70 .info("SalTableServiceProvider Started.");
76 * @see java.lang.AutoCloseable#close()
79 public void close() throws Exception {
80 OpenflowpluginTableFeaturesTestServiceProvider.LOG
81 .info("SalTableServiceProvider stopped.");
82 tableRegistration.close();
89 * org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026
91 * #updateTable(org.opendaylight.yang.gen.v1.urn.opendaylight
92 * .table.service.rev131026.UpdateTableInput)
95 public ListenableFuture<RpcResult<UpdateTableOutput>> updateTable(
96 UpdateTableInput input) {
97 OpenflowpluginTableFeaturesTestServiceProvider.LOG.info("updateTable - {}", input);
101 public ObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider> register(
102 final RpcProviderService rpcRegistry) {
103 setTableRegistration(rpcRegistry.registerRpcImplementation(SalTableService.class, this, ImmutableSet.of(
104 InstanceIdentifier.create(Nodes.class)
105 .child(Node.class, new NodeKey(new NodeId(OpenflowpluginTestActivator.NODE_ID))))));
107 return new AbstractObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider>(this) {
109 protected void removeRegistration() {
110 tableRegistration.close();