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.api.util.OxmMatchConstants;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder;
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.ApplySetfield;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder;
20 import org.opendaylight.yangtools.yang.binding.util.BindingMap;
22 public class ApplySetfieldTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
24 public void testSerialize() {
25 final ApplySetfield property = new ApplySetfieldBuilder()
26 .setApplySetfield(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature
27 .prop.type.table.feature.prop.type.apply.setfield
28 .ApplySetfieldBuilder()
29 .setSetFieldMatch(BindingMap.of(new SetFieldMatchBuilder()
30 .setMatchType(ArpOp.VALUE)
36 assertProperty(property, out -> {
37 assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
38 assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
39 out.skipBytes(Byte.BYTES); // Skip match entry length
44 protected Class<? extends TableFeaturePropType> getClazz() {
45 return ApplySetfield.class;
49 protected int getType() {
50 return TableFeaturesPropType.OFPTFPTAPPLYSETFIELD.getIntValue();