2 * Copyright (c) 2016 Cisco Systems, Inc. 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
9 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.cases;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.openflowplugin.api.OFConstants;
14 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
15 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
16 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanVidCaseBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.vlan.vid._case.SetVlanVidActionBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
23 public class SalToOfSetFieldV10Case extends ConvertorCase<SetFieldCase, Action, ActionConvertorData> {
24 public SalToOfSetFieldV10Case() {
25 super(SetFieldCase.class, true, OFConstants.OFP_VERSION_1_0);
30 public Optional<Action> process(@NonNull final SetFieldCase source, final ActionConvertorData data,
31 ConvertorExecutor convertorExecutor) {
32 SetVlanVidCaseBuilder setVlanVidCaseBuilder = new SetVlanVidCaseBuilder();
34 if (source.getSetField().getVlanMatch() != null) {
35 setVlanVidCaseBuilder.setSetVlanVidAction(new SetVlanVidActionBuilder()
36 .setVlanVid(source.getSetField().getVlanMatch().getVlanId().getVlanId().getValue())
40 return Optional.of(new ActionBuilder()
41 .setActionChoice(setVlanVidCaseBuilder.build())