2 * Copyright (c) 2016 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.actions;
11 import static org.junit.Assert.assertEquals;
13 import org.junit.Test;
14 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
20 public class SetMplsTtlActionSerializerTest extends AbstractActionSerializerTest {
23 public void testSerialize() throws Exception {
24 final short mpls = (short) 10;
26 final Action action = new SetMplsTtlActionCaseBuilder()
27 .setSetMplsTtlAction(new SetMplsTtlActionBuilder()
32 assertAction(action, out -> {
33 assertEquals(out.readUnsignedByte(), mpls);
34 out.skipBytes(ActionConstants.SET_MPLS_TTL_PADDING);
39 protected Class<? extends Action> getClazz() {
40 return SetMplsTtlActionCase.class;
44 protected int getType() {
45 return ActionConstants.SET_MPLS_TTL_CODE;
49 protected int getLength() {
50 return ActionConstants.GENERAL_ACTION_LENGTH;