import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
private final DeviceContext deviceContext;
private ItemLifecycleListener itemLifecycleListener;
- public SalGroupServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+ public SalGroupServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
this.deviceContext = deviceContext;
- addGroup = new GroupService<>(requestContextStack, deviceContext, AddGroupOutput.class);
- updateGroup = new GroupService<>(requestContextStack, deviceContext, UpdateGroupOutput.class);
- removeGroup = new GroupService<>(requestContextStack, deviceContext, RemoveGroupOutput.class);
+ addGroup = new GroupService<>(requestContextStack, deviceContext, AddGroupOutput.class, convertorExecutor);
+ updateGroup = new GroupService<>(requestContextStack, deviceContext, UpdateGroupOutput.class, convertorExecutor);
+ removeGroup = new GroupService<>(requestContextStack, deviceContext, RemoveGroupOutput.class, convertorExecutor);
}
@Override
@Override
public Future<RpcResult<AddGroupOutput>> addGroup(final AddGroupInput input) {
- addGroup.getDeviceRegistry().getDeviceGroupRegistry().store(input.getGroupId());
final ListenableFuture<RpcResult<AddGroupOutput>> resultFuture = addGroup.handleServiceCall(input);
Futures.addCallback(resultFuture, new FutureCallback<RpcResult<AddGroupOutput>>() {
@Override
if(LOG.isDebugEnabled()) {
LOG.debug("group add with id={} finished without error", input.getGroupId().getValue());
}
+ deviceContext.getDeviceGroupRegistry().store(input.getGroupId());
addIfNecessaryToDS(input.getGroupId(), input);
} else {
- LOG.error("group add with id={} failed, errors={}", input.getGroupId().getValue(),
- errorsToString(result.getErrors()));
- }
+ LOG.error("group add with id={} failed, errors={}", input.getGroupId().getValue(),
+ errorsToString(result.getErrors()));
+ }
}
@Override
public void onFailure(Throwable t) {
- LOG.error("Service call for group add failed for id={}. Exception: {}",
- input.getGroupId().getValue(), t);
+ LOG.error("Service call for group add failed for id={}. Exception: {}", input.getGroupId().getValue(), t);
}
});
@Override
public Future<RpcResult<RemoveGroupOutput>> removeGroup(final RemoveGroupInput input) {
- removeGroup.getDeviceRegistry().getDeviceGroupRegistry().markToBeremoved(input.getGroupId());
final ListenableFuture<RpcResult<RemoveGroupOutput>> resultFuture = removeGroup.handleServiceCall(input);
Futures.addCallback(resultFuture, new FutureCallback<RpcResult<RemoveGroupOutput>>() {
@Override
if(LOG.isDebugEnabled()) {
LOG.debug("Group remove for id {} succeded", input.getGroupId().getValue());
}
+ removeGroup.getDeviceRegistry().getDeviceGroupRegistry().markToBeremoved(input.getGroupId());
removeIfNecessaryFromDS(input.getGroupId());
}else{
LOG.error("group remove failed with id={}, errors={}", input.getGroupId().getValue(),
}
return errors.toString();
}
-}
+}
\ No newline at end of file