Merge "Fix checkstyle warnings for impl/protocol package"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / protocol / deserialization / instruction / GoToTableInstructionDeserializer.java
1 /*
2  * Copyright (c) 2016 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
10
11 import io.netty.buffer.ByteBuf;
12 import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
16
17 public class GoToTableInstructionDeserializer extends AbstractInstructionDeserializer {
18
19     @Override
20     public Instruction deserialize(ByteBuf message) {
21         processHeader(message);
22         final short tableId = message.readUnsignedByte();
23         message.skipBytes(InstructionConstants.PADDING_IN_GOTO_TABLE);
24
25         return new GoToTableCaseBuilder()
26                 .setGoToTable(new GoToTableBuilder()
27                         .setTableId(tableId)
28                         .build())
29                 .build();
30     }
31
32     @Override
33     public Instruction deserializeHeader(ByteBuf message) {
34         processHeader(message);
35         return new GoToTableCaseBuilder().build();
36     }
37
38 }