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.flow.cases;
11 import java.util.Optional;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.openflowplugin.api.OFConstants;
14 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
15 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTable;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCaseBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice._goto.table._case.GotoTableBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
22 public class GoToTableCase extends ConvertorCase<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase, Instruction, ActionConvertorData> {
23 public GoToTableCase() {
24 super(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase.class, true, OFConstants.OFP_VERSION_1_0, OFConstants.OFP_VERSION_1_3);
28 public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase source, final ActionConvertorData data) {
29 GoToTable goToTable = source.getGoToTable();
30 GotoTableCaseBuilder gotoTableCaseBuilder = new GotoTableCaseBuilder();
31 GotoTableBuilder gotoTableBuilder = new GotoTableBuilder();
32 gotoTableBuilder.setTableId(goToTable.getTableId());
33 gotoTableCaseBuilder.setGotoTable(gotoTableBuilder.build());
34 InstructionBuilder instructionBuilder = new InstructionBuilder();
35 instructionBuilder.setInstructionChoice(gotoTableCaseBuilder.build());
36 return Optional.of(instructionBuilder.build());