import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleId;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.Uint32;
* {@link org.opendaylight.mdsal.binding.api.DataTreeModification}.
*/
public class GroupForwarder extends AbstractListeningCommiter<Group> {
-
private static final Logger LOG = LoggerFactory.getLogger(GroupForwarder.class);
- private ListenerRegistration<GroupForwarder> listenerRegistration;
-
- private final BundleGroupForwarder bundleGroupForwarder;
public GroupForwarder(final ForwardingRulesManager manager, final DataBroker db,
final ListenerRegistrationHelper registrationHelper) {
super(manager, db, registrationHelper);
- this.bundleGroupForwarder = new BundleGroupForwarder(manager);
- }
-
- @Override
- public void deregisterListener() {
- close();
- }
-
- @Override
- public void close() {
- if (listenerRegistration != null) {
- listenerRegistration.close();
- listenerRegistration = null;
- }
}
@Override
.build();
final ListenableFuture<RpcResult<RemoveGroupOutput>> resultFuture =
- this.provider.getSalGroupService()
+ provider.getSalGroupService()
.removeGroup(removeGroup);
Futures.addCallback(resultFuture,
new RemoveGroupCallBack(removeDataObj.getGroupId().getValue(), nodeId),
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
builder.setGroupRef(new GroupRef(identifier));
builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
- return this.provider.getSalGroupService().removeGroup(builder.build());
+ return provider.getSalGroupService().removeGroup(builder.build());
}
@Override
builder.setUpdatedGroup(new UpdatedGroupBuilder(updatedGroup).build());
builder.setOriginalGroup(new OriginalGroupBuilder(originalGroup).build());
UpdateGroupInput updateGroupInput = builder.build();
- final ListenableFuture<RpcResult<UpdateGroupOutput>> resultFuture = this.provider.getSalGroupService()
+ final ListenableFuture<RpcResult<UpdateGroupOutput>> resultFuture = provider.getSalGroupService()
.updateGroup(updateGroupInput);
LoggingFutures.addErrorLogging(resultFuture, LOG, "updateGroup");
Futures.addCallback(resultFuture,
builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
AddGroupInput addGroupInput = builder.build();
final ListenableFuture<RpcResult<AddGroupOutput>> resultFuture;
- resultFuture = this.provider.getSalGroupService().addGroup(addGroupInput);
+ resultFuture = provider.getSalGroupService().addGroup(addGroupInput);
Futures.addCallback(resultFuture,
new AddGroupCallBack(addGroupInput.getGroupId().getValue(), nodeId),
MoreExecutors.directExecutor());
}
@Override
- public void createStaleMarkEntity(InstanceIdentifier<Group> identifier, Group del,
- InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ public void createStaleMarkEntity(final InstanceIdentifier<Group> identifier, final Group del,
+ final InstanceIdentifier<FlowCapableNode> nodeIdent) {
LOG.debug("Creating Stale-Mark entry for the switch {} for Group {} ", nodeIdent, del);
StaleGroup staleGroup = makeStaleGroup(identifier, del, nodeIdent);
persistStaleGroup(staleGroup, nodeIdent);
}
- private static StaleGroup makeStaleGroup(InstanceIdentifier<Group> identifier, Group del,
- InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ private static StaleGroup makeStaleGroup(final InstanceIdentifier<Group> identifier, final Group del,
+ final InstanceIdentifier<FlowCapableNode> nodeIdent) {
StaleGroupBuilder staleGroupBuilder = new StaleGroupBuilder(del);
return staleGroupBuilder.setGroupId(del.getGroupId()).build();
}
- private void persistStaleGroup(StaleGroup staleGroup, InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ private void persistStaleGroup(final StaleGroup staleGroup, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getStaleGroupInstanceIdentifier(staleGroup, nodeIdent),
staleGroup);
handleStaleGroupResultFuture(submitFuture);
}
- private static void handleStaleGroupResultFuture(FluentFuture<?> submitFuture) {
+ private static void handleStaleGroupResultFuture(final FluentFuture<?> submitFuture) {
submitFuture.addCallback(new FutureCallback<Object>() {
@Override
- public void onSuccess(Object result) {
+ public void onSuccess(final Object result) {
LOG.debug("Stale Group creation success");
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Stale Group creation failed", throwable);
}
}, MoreExecutors.directExecutor());
private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.group
.types.rev131018.groups.StaleGroup> getStaleGroupInstanceIdentifier(
- StaleGroup staleGroup, InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ final StaleGroup staleGroup, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(StaleGroup.class, new StaleGroupKey(new GroupId(staleGroup.getGroupId())));
}
}
@Override
- public void onSuccess(RpcResult<AddGroupOutput> result) {
+ public void onSuccess(final RpcResult<AddGroupOutput> result) {
if (result.isSuccessful()) {
provider.getDevicesGroupRegistry().storeGroup(nodeId, groupId);
LOG.debug("Group add with id {} finished without error for node {}", groupId, nodeId);
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Service call for adding group {} failed for node with error {}", groupId, nodeId, throwable);
}
}
}
@Override
- public void onSuccess(RpcResult<UpdateGroupOutput> result) {
+ public void onSuccess(final RpcResult<UpdateGroupOutput> result) {
if (result.isSuccessful()) {
provider.getDevicesGroupRegistry().storeGroup(nodeId, groupId);
LOG.debug("Group update with id {} finished without error for node {}", groupId, nodeId);
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Service call for updating group {} failed for node {} with", groupId, nodeId,
throwable);
}
}
@Override
- public void onSuccess(RpcResult<RemoveGroupOutput> result) {
+ public void onSuccess(final RpcResult<RemoveGroupOutput> result) {
if (result.isSuccessful()) {
LOG.debug("Group remove with id {} finished without error for node {}", groupId, nodeId);
provider.getDevicesGroupRegistry().removeGroup(nodeId, groupId);
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Service call for removing group {} failed for node with error {}", groupId, nodeId, throwable);
}
}