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.instructions;
11 import static org.junit.Assert.assertEquals;
13 import org.junit.Test;
14 import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
21 public class MeterInstructionSerializerTest extends AbstractInstructionSerializerTest {
24 public void testSerialize() {
27 final Instruction instruction = new MeterCaseBuilder()
28 .setMeter(new MeterBuilder()
29 .setMeterId(new MeterId(meter))
33 assertInstruction(instruction, out -> assertEquals(out.readUnsignedInt(), meter));
37 protected Class<? extends Instruction> getClazz() {
38 return MeterCase.class;
42 protected int getType() {
43 return InstructionConstants.METER_TYPE;
47 protected int getLength() {
48 return InstructionConstants.STANDARD_INSTRUCTION_LENGTH;