*/
package org.opendaylight.openflowplugin.impl.services;
+import java.util.Optional;
import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.PacketOutConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
import org.opendaylight.yangtools.yang.common.RpcResult;
public final class PacketProcessingServiceImpl extends AbstractVoidService<TransmitPacketInput> implements PacketProcessingService {
- public PacketProcessingServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+ private final ConvertorExecutor convertorExecutor;
+
+ public PacketProcessingServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext);
+ this.convertorExecutor = convertorExecutor;
}
@Override
}
@Override
- protected OfHeader buildRequest(final Xid xid, final TransmitPacketInput input) {
- return PacketOutConvertor.toPacketOutInput(input, getVersion(), xid.getValue(), getDatapathId());
+ protected OfHeader buildRequest(final Xid xid, final TransmitPacketInput input) throws ServiceException {
+ final PacketOutConvertorData data = new PacketOutConvertorData(getVersion());
+ data.setDatapathId(getDatapathId());
+ data.setXid(xid.getValue());
+
+ final Optional<PacketOutInput> result = convertorExecutor.convert(input, data);
+ return result.orElse(PacketOutConvertor.defaultResult(getVersion()));
}
}