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
9 package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
11 import static org.junit.Assert.assertEquals;
13 import java.util.Collections;
14 import org.junit.Test;
15 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
16 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActions;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder;
24 public class ApplyActionsTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
27 public void testSerialize() {
28 final ApplyActions property = new ApplyActionsBuilder()
29 .setApplyActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature
30 .prop.type.table.feature.prop.type.apply.actions
31 .ApplyActionsBuilder()
32 .setAction(Collections.singletonList(new ActionBuilder()
34 .setAction(new SetNwSrcActionCaseBuilder()
40 assertProperty(property, out -> {
41 assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
42 out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // Skip length of set field action
47 protected Class<? extends TableFeaturePropType> getClazz() {
48 return ApplyActions.class;
52 protected int getType() {
53 return TableFeaturesPropType.OFPTFPTAPPLYACTIONS.getIntValue();