Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / instruction / ClearActionsInstructionDeserializer.java
1 /*
2  * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.instruction;
10
11 import io.netty.buffer.ByteBuf;
12
13 import java.util.ArrayList;
14 import java.util.List;
15
16 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
17 import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
23
24 /**
25  * @author michal.polkorab
26  *
27  */
28 public class ClearActionsInstructionDeserializer extends AbstractInstructionDeserializer {
29
30     @Override
31     public Instruction deserialize(ByteBuf input) {
32         InstructionBuilder builder = super.processHeader(input);
33         input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
34         input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
35         ActionsInstructionBuilder actionsBuilder = 
36                 new ActionsInstructionBuilder();
37         List<Action> actions = new ArrayList<>();
38         actionsBuilder.setAction(actions);
39         builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
40         return builder.build();
41     }
42 }