/* * Copyright © 2017 Red Hat, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.genius.mdsalutil.instructions; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey; /** * Goto table instruction. */ public class InstructionGotoTable extends AbstractInstructionInfoImpl { private final short tableId; public InstructionGotoTable(short tableId) { this.tableId = tableId; } @Override public Instruction buildInstruction(int instructionKey) { return new InstructionBuilder() .setInstruction(new GoToTableCaseBuilder() .setGoToTable(new GoToTableBuilder() .setTableId(tableId) .build() ) .build() ) .withKey(new InstructionKey(instructionKey)) .build(); } public short getTableId() { return tableId; } @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } InstructionGotoTable that = (InstructionGotoTable) other; return tableId == that.tableId; } @Override public int hashCode() { return tableId; } @Override public String toString() { return "InstructionGotoTable[" + tableId + "]"; } }