use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder in project lispflowmapping by opendaylight.
the class LispXtrSouthboundHandlerTest method getDefaultMapRequestBuilder.
private static MapRequestBuilder getDefaultMapRequestBuilder() {
final ItrRloc itrRloc = new ItrRlocBuilder().setRloc(new RlocBuilder().setAddressType(Ipv4BinaryAfi.class).setAddress(new Ipv4BinaryBuilder().setIpv4Binary(new Ipv4AddressBinary(new byte[] { 127, 0, 0, 2 })).build()).build()).build();
final EidItem eidItem = new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixBinaryEid(IPV4_STRING_2 + IPV4_STRING_PREFIX)).build();
return new MapRequestBuilder().setItrRloc(Lists.newArrayList(itrRloc)).setEidItem(Lists.newArrayList(eidItem)).setNonce(NONCE).setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(IPV4_STRING_1)).build()).setAuthoritative(false).setMapDataPresent(false).setPitr(false).setProbe(false).setSmr(false).setSmrInvoked(false);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder in project lispflowmapping by opendaylight.
the class MapRequestUtilTest method selectItrRlocTest_Ipv4Prefix.
/**
* Tests {@link MapRequestUtil#selectItrRloc} method with Ipv4Prefix.
*/
@Test
public void selectItrRlocTest_Ipv4Prefix() {
final ItrRlocBuilder itrRloc = new ItrRlocBuilder().setRloc(new RlocBuilder().setAddress(IPV4_ADDRESS_PREFIX).build());
final MapRequest request = new MapRequestBuilder().setItrRloc(Lists.newArrayList(itrRloc.build())).build();
assertNull(MapRequestUtil.selectItrRloc(request));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder 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.rloc.container.RlocBuilder 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.rloc.container.RlocBuilder in project lispflowmapping by opendaylight.
the class ExplicitLocatorPathSerializerTest method serialize__NoAddresses.
@Test
public void serialize__NoAddresses() throws Exception {
RlocBuilder rb = new RlocBuilder();
rb.setAddressType(ExplicitLocatorPathLcaf.class);
rb.setVirtualNetworkId(null);
rb.setAddress((Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPathBuilder().build());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(rb.build()));
LispAddressSerializer.getInstance().serialize(buf, rb.build());
ByteBuffer expectedBuf = hexToByteBuffer(//
"40 03 00 00 " + "0A 00 00 00");
ArrayAssert.assertEquals(expectedBuf.array(), buf.array());
}
Aggregations