2 * Copyright (c) 2015 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.impl.services;
10 import java.util.concurrent.Future;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
18 import org.opendaylight.yangtools.yang.common.RpcResult;
19 import org.slf4j.Logger;
24 public class SalGroupServiceImpl extends CommonService implements SalGroupService {
26 private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(SalGroupServiceImpl.class);
29 public Future<RpcResult<AddGroupOutput>> addGroup(final AddGroupInput input) {
30 // LOG.debug("Calling the GroupMod RPC method on MessageDispatchService");
32 // ListenableFuture<RpcResult<UpdateGroupOutput>> result = SettableFuture.create();
34 // // Convert the AddGroupInput to GroupModInput
35 // final GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(input, version, datapathId);
36 // final Xid xId = deviceContext.getNextXid();
37 // ofGroupModInput.setXid(xId.getValue());
39 // final Future<RpcResult<UpdateGroupOutput>> resultFromOFLib = messageService.groupMod(ofGroupModInput.build(),
41 // result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
43 // result = chainFutureBarrier(result);
44 // hookFutureNotification(result, notificationProviderService, createGroupAddedNotification(input));
46 // return Futures.transform(result, OFRpcFutureResultTransformFactory.createForAddGroupOutput());
51 public Future<RpcResult<UpdateGroupOutput>> updateGroup(final UpdateGroupInput input) {
52 // LOG.debug("Calling the update Group Mod RPC method on MessageDispatchService");
54 // // use primary connection
56 // ListenableFuture<RpcResult<UpdateGroupOutput>> result = null;
58 // // Convert the UpdateGroupInput to GroupModInput
59 // final GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(input.getUpdatedGroup(), version,
61 // final Xid xId = deviceContext.getNextXid();
62 // ofGroupModInput.setXid(xId.getValue());
64 // final Future<RpcResult<UpdateGroupOutput>> resultFromOFLib = messageService.groupMod(ofGroupModInput.build(),
66 // result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
68 // result = chainFutureBarrier(result);
69 // hookFutureNotification(result, notificationProviderService, createGroupUpdatedNotification(input));
76 public Future<RpcResult<RemoveGroupOutput>> removeGroup(final RemoveGroupInput input) {
77 // LOG.debug("Calling the Remove Group RPC method on MessageDispatchService");
79 // ListenableFuture<RpcResult<UpdateGroupOutput>> result = SettableFuture.create();
81 // // Convert the AddGroupInput to GroupModInput
82 // final GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(input, version, datapathId);
83 // final Xid xId = deviceContext.getNextXid();
84 // ofGroupModInput.setXid(xId.getValue());
86 // final Future<RpcResult<UpdateGroupOutput>> resultFromOFLib = messageService.groupMod(ofGroupModInput.build(),
88 // result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
90 // result = chainFutureBarrier(result);
91 // hookFutureNotification(result, notificationProviderService, createGroupRemovedNotification(input));
93 // return Futures.transform(result, OFRpcFutureResultTransformFactory.createForRemoveGroupOutput());