use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MapRequestUtilTest method selectItrRlocTest_Ipv6.
/**
* Tests {@link MapRequestUtil#selectItrRloc} method with Ipv6.
*/
@Test
public void selectItrRlocTest_Ipv6() {
final ItrRlocBuilder itrRloc = new ItrRlocBuilder().setRloc(new RlocBuilder().setAddress(IPV6_ADDRESS).build());
final MapRequest request = new MapRequestBuilder().setItrRloc(Lists.newArrayList(itrRloc.build())).build();
// expected result
InetAddress expectedResult = InetAddresses.forString(IPV6_STRING);
// result
InetAddress result = MapRequestUtil.selectItrRloc(request);
assertEquals(expectedResult, result);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MapRequestUtilTest method selectItrRlocTest_Ipv4Binary.
/**
* Tests {@link MapRequestUtil#selectItrRloc} method with Ipv4Binary.
*/
@Test
public void selectItrRlocTest_Ipv4Binary() {
final ItrRlocBuilder itrRloc = new ItrRlocBuilder().setRloc(new RlocBuilder().setAddress(IPV4_ADDRESS_BINARY).build());
final MapRequest request = new MapRequestBuilder().setItrRloc(Lists.newArrayList(itrRloc.build())).build();
// expected result
InetAddress expectedResult = InetAddresses.forString(IPV4_STRING);
// result
InetAddress result = MapRequestUtil.selectItrRloc(request);
assertEquals(expectedResult, result);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MapRequestSerializationTest method deserialize__SingleItrRloc.
@Test
public void deserialize__SingleItrRloc() throws Exception {
MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("10 00 " + //
"00 " + // This means 1 ITR-RLOC
"01 3d 8d 2a cd 39 c8 d6 08 00 00 " + //
"00 01 c0 a8 88 0a " + // IPv4 (ITR-RLOC #1 of 1)
"00 20 00 01 01 02 03 04"), null);
assertEquals(1, mr.getItrRloc().size());
assertArrayEquals(new byte[] { (byte) 192, (byte) 168, (byte) 136, (byte) 10 }, ((Ipv4Binary) mr.getItrRloc().get(0).getRloc().getAddress()).getIpv4Binary().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MapRequestSerializationTest method deserialize__LispMobMapRequestWithReply.
@Test
public void deserialize__LispMobMapRequestWithReply() throws Exception {
MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("14 00 00 01 3e f7 " + "7f 5b 41 7c 77 3c 00 01 01 01 01 01 00 01 c0 a8 " + "38 66 00 20 00 01 01 02 03 04 00 00 00 0a 01 20 " + "10 00 00 00 00 01 01 01 01 01 01 64 ff 00 00 05 " + "00 01 c0 a8 38 66"), null);
assertArrayEquals(new byte[] { 1, 1, 1, 1 }, ((Ipv4Binary) mr.getSourceEid().getEid().getAddress()).getIpv4Binary().getValue());
assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32"), mr.getEidItem().get(0).getEid());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MapRequestSerializationTest method deserialize__SingleEidItem.
@Test
public void deserialize__SingleEidItem() throws Exception {
MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("16 80 00 " + // single record
"01 " + "3d 8d 2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a " + "00 20 00 01 01 02 03 04"), null);
assertEquals(1, mr.getEidItem().size());
assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32"), mr.getEidItem().get(0).getEid());
}
Aggregations