use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project openflowplugin by opendaylight.
the class SetVlanPcpActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final short vlan = 1;
final Action action = new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(new SetVlanPcpActionBuilder().setVlanPcp(new VlanPcp(vlan)).build()).build();
assertAction(action, out -> assertEquals(out.readUnsignedByte(), vlan));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project openflowplugin by opendaylight.
the class PushMplsActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final int ethType = 10;
final Action action = new PushMplsActionCaseBuilder().setPushMplsAction(new PushMplsActionBuilder().setEthernetType(ethType).build()).build();
assertAction(action, out -> {
assertEquals(out.readUnsignedShort(), ethType);
out.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project openflowplugin by opendaylight.
the class SetDlSrcActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final MacAddress address = new MacAddress("00:01:02:03:04:05");
final Action action = new SetDlSrcActionCaseBuilder().setSetDlSrcAction(new SetDlSrcActionBuilder().setAddress(address).build()).build();
assertAction(action, out -> {
byte[] addressBytes = new byte[6];
out.readBytes(addressBytes);
assertEquals(new MacAddress(ByteBufUtils.macAddressToString(addressBytes)).getValue(), address.getValue());
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project openflowplugin by opendaylight.
the class SetNwDstActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final Ipv4 address = new Ipv4Builder().setIpv4Address(new Ipv4Prefix("192.168.76.2/32")).build();
final Action action = new SetNwDstActionCaseBuilder().setSetNwDstAction(new SetNwDstActionBuilder().setAddress(address).build()).build();
assertAction(action, out -> {
byte[] addressBytes = new byte[4];
out.readBytes(addressBytes);
assertArrayEquals(addressBytes, new byte[] { (byte) 192, (byte) 168, 76, 2 });
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project openflowplugin by opendaylight.
the class SetTpSrcActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final PortNumber port = new PortNumber(20);
// TCP
final short protocol = 6;
final Action action = new SetTpSrcActionCaseBuilder().setSetTpSrcAction(new SetTpSrcActionBuilder().setPort(port).setIpProtocol(protocol).build()).build();
assertAction(action, out -> assertEquals(Integer.valueOf(out.readUnsignedShort()), port.getValue()));
}
Aggregations