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
8 package org.opendaylight.openflowplugin.impl.protocol.serialization.actions;
10 import static org.junit.Assert.assertEquals;
12 import org.junit.Test;
13 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
18 import org.opendaylight.yangtools.yang.common.Uint16;
20 public class PopMplsActionSerializerTest extends AbstractActionSerializerTest {
23 public void testSerialize() {
24 final Action action = new PopMplsActionCaseBuilder()
25 .setPopMplsAction(new PopMplsActionBuilder().setEthernetType(Uint16.TEN).build())
28 assertAction(action, out -> {
29 assertEquals(out.readUnsignedShort(), 10);
30 out.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
35 protected Class<? extends Action> getClazz() {
36 return PopMplsActionCase.class;
40 protected int getType() {
41 return ActionConstants.POP_MPLS_CODE;
45 protected int getLength() {
46 return ActionConstants.GENERAL_ACTION_LENGTH;