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.assertArrayEquals;
13 import org.junit.Test;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
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.SetNwDstActionCase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
22 public class SetNwDstActionSerializerTest extends AbstractSetFieldActionSerializerTest {
25 public void testSerialize() throws Exception {
26 final Ipv4 address = new Ipv4Builder()
27 .setIpv4Address(new Ipv4Prefix("192.168.76.2/32"))
30 final Action action = new SetNwDstActionCaseBuilder()
31 .setSetNwDstAction(new SetNwDstActionBuilder()
36 assertAction(action, out -> {
37 byte[] addressBytes = new byte[4];
38 out.readBytes(addressBytes);
39 assertArrayEquals(addressBytes, new byte[] { (byte) 192, (byte) 168, 76, 2 });
44 protected Class<? extends Action> getClazz() {
45 return SetNwDstActionCase.class;