use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder 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.MapRequestBuilder 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.MapRequestBuilder 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.MapRequestBuilder in project lispflowmapping by opendaylight.
the class MapRequestSerializationTest method serialize__FlagsInFirstByte.
@Test
public void serialize__FlagsInFirstByte() throws Exception {
MapRequestBuilder mrBuilder = new MapRequestBuilder();
mrBuilder.setAuthoritative(true);
mrBuilder.setProbe(true);
ByteBuffer expected = hexToByteBuffer("1A 00 00 00 00 00 " + "00 00 00 00 00 00 00 00");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
mrBuilder = new MapRequestBuilder();
mrBuilder.setSmr(true);
mrBuilder.setMapDataPresent(true);
expected = hexToByteBuffer("15 00 00 00 00 00 " + "00 00 00 00 00 00 00 00");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
mrBuilder.setAuthoritative(true);
mrBuilder.setProbe(true);
expected = hexToByteBuffer("1F 00 00 00 00 00 " + "00 00 00 00 00 00 00 00");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder in project lispflowmapping by opendaylight.
the class MapRequestSerializationTest method prefix__NoPrefix.
@Test
public void prefix__NoPrefix() throws Exception {
MapRequestBuilder mrBuilder = new MapRequestBuilder();
mrBuilder.setEidItem(new ArrayList<EidItem>());
mrBuilder.getEidItem().add(new EidItemBuilder().setEid(LispAddressUtil.getNoAddressEid()).build());
assertEquals(NoAddressAfi.class, mrBuilder.getEidItem().get(0).getEid().getAddressType());
}
Aggregations