cc2ef5e839a3cebf4516542fcc583fd156e90fb1
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / instruction / ClearActionsInstructionDeserializer.java
1 /*\r
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 \r
9 package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;\r
10 \r
11 import io.netty.buffer.ByteBuf;\r
12 \r
13 import java.util.ArrayList;\r
14 import java.util.List;\r
15 \r
16 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
17 import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;\r
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
23 \r
24 /**\r
25  * @author michal.polkorab\r
26  *\r
27  */\r
28 public class ClearActionsInstructionDeserializer extends AbstractInstructionDeserializer {\r
29 \r
30     @Override\r
31     public Instruction deserialize(ByteBuf input) {\r
32         InstructionBuilder builder = super.processHeader(input);\r
33         input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
34         input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);\r
35         ActionsInstructionBuilder actionsBuilder = \r
36                 new ActionsInstructionBuilder();\r
37         List<Action> actions = new ArrayList<>();\r
38         actionsBuilder.setAction(actions);\r
39         builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
40         return builder.build();\r
41     }\r
42 }