X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fservices%2FSalGroupServiceImpl.java;h=1e1ff0e9f5e53f2adb583902da28d68f488b4779;hb=d1ced6c56a6a9c7d43633cc074454c9843f964bd;hp=cdbc10b6f08f0083cf503a734154994c0ca60c6a;hpb=7bc04367dae6c4acfef928a358e3f3869cb453af;p=openflowplugin.git diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalGroupServiceImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalGroupServiceImpl.java index cdbc10b6f0..1e1ff0e9f5 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalGroupServiceImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalGroupServiceImpl.java @@ -17,6 +17,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; 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; @@ -45,11 +46,11 @@ public class SalGroupServiceImpl implements SalGroupService, ItemLifeCycleSource 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 @@ -59,7 +60,6 @@ public class SalGroupServiceImpl implements SalGroupService, ItemLifeCycleSource @Override public Future> addGroup(final AddGroupInput input) { - addGroup.getDeviceRegistry().getDeviceGroupRegistry().store(input.getGroupId()); final ListenableFuture> resultFuture = addGroup.handleServiceCall(input); Futures.addCallback(resultFuture, new FutureCallback>() { @Override @@ -68,17 +68,17 @@ public class SalGroupServiceImpl implements SalGroupService, ItemLifeCycleSource 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); } }); @@ -115,7 +115,6 @@ public class SalGroupServiceImpl implements SalGroupService, ItemLifeCycleSource @Override public Future> removeGroup(final RemoveGroupInput input) { - removeGroup.getDeviceRegistry().getDeviceGroupRegistry().markToBeremoved(input.getGroupId()); final ListenableFuture> resultFuture = removeGroup.handleServiceCall(input); Futures.addCallback(resultFuture, new FutureCallback>() { @Override @@ -124,6 +123,7 @@ public class SalGroupServiceImpl implements SalGroupService, ItemLifeCycleSource 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(), @@ -173,4 +173,4 @@ public class SalGroupServiceImpl implements SalGroupService, ItemLifeCycleSource } return errors.toString(); } -} +} \ No newline at end of file