2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.openflow.md.core.sal.convertor.action.cases;
10 import java.util.Optional;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.openflowplugin.api.OFConstants;
13 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
14 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
15 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCase;
22 public class OfToSalSetTpSrcCase extends ConvertorCase<SetTpSrcCase, Action, ActionResponseConvertorData> {
23 public OfToSalSetTpSrcCase() {
24 super(SetTpSrcCase.class, true, OFConstants.OFP_VERSION_1_0);
28 public Optional<Action> process(@NonNull final SetTpSrcCase source, final ActionResponseConvertorData data,
29 final ConvertorExecutor convertorExecutor) {
30 return Optional.of(new SetTpSrcActionCaseBuilder()
31 .setSetTpSrcAction(new SetTpSrcActionBuilder()
32 .setPort(new PortNumber(source.getSetTpSrcAction().getPort().getValue().toUint16()))
33 .setIpProtocol(data.getIpProtocol())