2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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
8 package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
10 import static org.junit.Assert.assertEquals;
12 import org.junit.Test;
13 import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMiss;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMissBuilder;
20 import org.opendaylight.yangtools.yang.binding.util.BindingMap;
22 public class InstructionsMissTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
24 public void testSerialize() {
25 final InstructionsMiss property = new InstructionsMissBuilder()
26 .setInstructionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight
27 .table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss
28 .InstructionsMissBuilder()
29 .setInstruction(BindingMap.of(new InstructionBuilder()
31 .setInstruction(new ApplyActionsCaseBuilder().build())
36 assertProperty(property, out -> {
37 assertEquals(out.readUnsignedShort(), InstructionConstants.APPLY_ACTIONS_TYPE);
38 out.skipBytes(Short.BYTES); // Skip length of set field action
43 protected Class<? extends TableFeaturePropType> getClazz() {
44 return InstructionsMiss.class;
48 protected int getType() {
49 return TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS.getIntValue();