use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder in project lispflowmapping by opendaylight.
the class MultiSiteScenario method emitMapRequestMessage.
private MapReply emitMapRequestMessage(final String siteFromEidPrefix, final String siteToEidPrefix, final InstanceIdType vniValue) {
final MapRequestBuilder mapRequestBuilder = new MapRequestBuilder();
final EidItemBuilder eidItemBuilder = new EidItemBuilder();
Eid dstEid = toEid(siteToEidPrefix, vniValue, IP_MASK);
eidItemBuilder.setEid(dstEid);
eidItemBuilder.setEidItemId(siteFromEidPrefix + siteToEidPrefix);
final List<EidItem> eidItem = Collections.singletonList(eidItemBuilder.build());
final Eid srcEid = MappingServiceIntegrationTestUtil.removePrefixIfNecessary(toEid(siteFromEidPrefix, vniValue, IP_MASK));
mapRequestBuilder.setSourceEid(new SourceEidBuilder().setEid(srcEid).build());
mapRequestBuilder.setEidItem(eidItem);
mapRequestBuilder.setItrRloc(MappingServiceIntegrationTestUtil.getDefaultItrRlocList(LispAddressUtil.asIpv4Rloc(ourAddress)));
mapRequestBuilder.setSmrInvoked(false);
return lms.handleMapRequest(mapRequestBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder 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.maprequestnotification.MapRequestBuilder 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.MapRequestBuilder 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.MapRequestBuilder in project lispflowmapping by opendaylight.
the class MapRequestSerializationTest method serialize__SingleEidItem.
@Test
public void serialize__SingleEidItem() throws Exception {
MapRequestBuilder mrBuilder = new MapRequestBuilder();
mrBuilder.setEidItem(new ArrayList<EidItem>());
mrBuilder.getEidItem().add(new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("1.2.3.4/32")).build());
ByteBuffer expected = hexToByteBuffer(//
"10 00 00 01 00 00 " + "00 00 00 00 00 00 00 00 00 20 00 01 01 02 03 04");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
}
Aggregations