use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest in project lispflowmapping by opendaylight.
the class MapRequestUtilTest method selectItrRlocTest_Ipv6Binary.
/**
* Tests {@link MapRequestUtil#selectItrRloc} method with Ipv6Binary.
*/
@Test
public void selectItrRlocTest_Ipv6Binary() {
final ItrRlocBuilder itrRloc = new ItrRlocBuilder().setRloc(new RlocBuilder().setAddress(IPV6_ADDRESS_BINARY).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.maprequestmessage.MapRequest in project lispflowmapping by opendaylight.
the class MapRequestUtilTest method selectItrRlocTest_noItrRlocs.
/**
* Tests {@link MapRequestUtil#selectItrRloc} method with no ItrRlocs.
*/
@Test
public void selectItrRlocTest_noItrRlocs() {
final MapRequest request = new MapRequestBuilder().build();
assertNull(MapRequestUtil.selectItrRloc(request));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest in project lispflowmapping by opendaylight.
the class MapRequestUtilTest method selectItrRlocTest_Ipv4.
/**
* Tests {@link MapRequestUtil#selectItrRloc} method with Ipv4.
*/
@Test
public void selectItrRlocTest_Ipv4() {
final ItrRlocBuilder itrRloc = new ItrRlocBuilder().setRloc(new RlocBuilder().setAddress(IPV4_ADDRESS).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.maprequestmessage.MapRequest in project lispflowmapping by opendaylight.
the class MapRequestSerializationTest method deserialize__ContainsMapReply.
@Test
public void deserialize__ContainsMapReply() 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 " + // end of map request
"00 20 00 01 01 02 03 04 " + "00 00 " + "00 02 01 20 00 00 00 00 " + "00 01 01 02 03 04 01 02 " + "03 04 00 06 00 01 0a 0a " + "0a 0a"), null);
assertEquals(1, mr.getEidItem().size());
assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32"), mr.getEidItem().get(0).getEid());
MappingRecord record = mr.getMapReply().getMappingRecord();
assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32"), record.getEid());
assertEquals(false, record.isAuthoritative());
assertEquals(Action.NoAction, record.getAction());
assertEquals(0, record.getMapVersion().shortValue());
assertEquals(32, MaskUtil.getMaskForAddress(record.getEid().getAddress()));
assertEquals(2, record.getRecordTtl().byteValue());
assertArrayEquals(new byte[] { 10, 10, 10, 10 }, ((Ipv4Binary) record.getLocatorRecord().get(0).getRloc().getAddress()).getIpv4Binary().getValue());
assertEquals(1, record.getLocatorRecord().get(0).getPriority().byteValue());
assertEquals(2, record.getLocatorRecord().get(0).getWeight().byteValue());
assertEquals(3, record.getLocatorRecord().get(0).getMulticastPriority().byteValue());
assertEquals(4, record.getLocatorRecord().get(0).getMulticastWeight().byteValue());
assertEquals(true, record.getLocatorRecord().get(0).isLocalLocator());
assertEquals(true, record.getLocatorRecord().get(0).isRlocProbed());
assertEquals(false, record.getLocatorRecord().get(0).isRouted());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest in project lispflowmapping by opendaylight.
the class MapRequestSerializationTest method deserialize__FlagsInFirstByte.
@Test
public void deserialize__FlagsInFirstByte() throws Exception {
MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("16 00 00 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);
assertFalse(mr.isAuthoritative());
assertTrue(mr.isMapDataPresent());
assertTrue(mr.isProbe());
assertFalse(mr.isSmr());
mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("19 00 00 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);
assertTrue(mr.isAuthoritative());
assertFalse(mr.isMapDataPresent());
assertFalse(mr.isProbe());
assertTrue(mr.isSmr());
mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("1C 00 00 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);
assertTrue(mr.isAuthoritative());
assertTrue(mr.isMapDataPresent());
assertFalse(mr.isProbe());
assertFalse(mr.isSmr());
}
Aggregations