use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address in project openflowplugin by opendaylight.
the class TunnelIpv4SourceEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final Match ipv4match = new MatchBuilder().setLayer3Match(new TunnelIpv4MatchBuilder().setTunnelIpv4Source(new Ipv4Prefix("10.0.2.0/24")).build()).build();
assertMatch(ipv4match, true, (out) -> {
byte[] address = new byte[4];
out.readBytes(address);
assertArrayEquals(address, new byte[] { 10, 0, 2, 0 });
byte[] mask = new byte[4];
out.readBytes(mask);
assertArrayEquals(mask, new byte[] { (byte) 255, (byte) 255, (byte) 255, 0 });
});
final Match ipv4matchNoMask = new MatchBuilder().setLayer3Match(new TunnelIpv4MatchBuilder().setTunnelIpv4Source(new Ipv4Prefix("10.0.0.0/32")).build()).build();
assertMatch(ipv4matchNoMask, false, (out) -> {
byte[] address = new byte[4];
out.readBytes(address);
assertArrayEquals(address, new byte[] { 10, 0, 0, 0 });
});
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address in project openflowplugin by opendaylight.
the class OxmArpShaSerializerTest method testSerializeWithoutMask.
/**
* Test correct serialization.
*/
@Test
public void testSerializeWithoutMask() {
MatchEntryBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(builder.build(), buffer);
checkHeader(buffer, false);
byte[] address = new byte[6];
buffer.readBytes(address);
Assert.assertArrayEquals("Wrong address", new byte[] { 0, 1, 2, 3, 4, 5 }, address);
assertTrue("Unexpected data", buffer.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address in project openflowplugin by opendaylight.
the class OxmArpThaSerializerTest method testSerializeWithMask.
/**
* Test correct serialization.
*/
@Test
public void testSerializeWithMask() {
MatchEntryBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(builder.build(), buffer);
checkHeader(buffer, true);
byte[] address = new byte[6];
buffer.readBytes(address);
Assert.assertArrayEquals("Wrong address", new byte[] { 0, 1, 2, 3, 4, 10 }, address);
byte[] tmp = new byte[6];
buffer.readBytes(tmp);
Assert.assertArrayEquals("Wrong mask", new byte[] { 15, 15, 0, 0, 10, 10 }, tmp);
assertTrue("Unexpected data", buffer.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address in project openflowplugin by opendaylight.
the class OxmEthDstSerializerTest method testSerializeWithoutMask.
/**
* Test correct serialization.
*/
@Test
public void testSerializeWithoutMask() {
MatchEntryBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(builder.build(), buffer);
checkHeader(buffer, false);
byte[] address = new byte[6];
buffer.readBytes(address);
Assert.assertArrayEquals("Wrong address", new byte[] { 0, 1, 2, 3, 4, 5 }, address);
assertTrue("Unexpected data", buffer.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address in project openflowplugin by opendaylight.
the class OxmIpv4SrcSerializerTest method testSerializeWithoutMask.
/**
* Test correct serialization.
*/
@Test
public void testSerializeWithoutMask() {
MatchEntryBuilder builder = prepareMatchEntry(false, "10.0.0.1");
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(builder.build(), buffer);
checkHeader(buffer, false);
byte[] address = new byte[4];
buffer.readBytes(address);
Assert.assertArrayEquals("Wrong address", new byte[] { 10, 0, 0, 1 }, address);
assertTrue("Unexpected data", buffer.readableBytes() == 0);
}
Aggregations