Search in sources :

Example 21 with MapRequestBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.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());
}
Also used : SourceEid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEid) Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder) EidItemBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder) EidItem(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem)

Example 22 with MapRequestBuilder

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_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));
}
Also used : MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) ItrRlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder) RlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder) ItrRlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder) MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder) Test(org.junit.Test)

Example 23 with MapRequestBuilder

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_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);
}
Also used : MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) ItrRlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder) RlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder) ItrRlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder) MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder) InetAddress(java.net.InetAddress) Test(org.junit.Test)

Example 24 with MapRequestBuilder

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_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);
}
Also used : MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) ItrRlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder) RlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder) ItrRlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder) MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder) InetAddress(java.net.InetAddress) Test(org.junit.Test)

Example 25 with MapRequestBuilder

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__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());
}
Also used : MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder) EidItemBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder) EidItem(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Aggregations

MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder)25 Test (org.junit.Test)20 ItrRlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder)17 EidItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder)15 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)13 EidItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem)11 ItrRloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc)11 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder)10 ByteBuffer (java.nio.ByteBuffer)9 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)9 RlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder)6 InetAddress (java.net.InetAddress)5 LocatorRecordBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecordBuilder)5 MappingRecordBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder)5 ArrayList (java.util.ArrayList)4 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)3 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)3 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)3 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)3 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)3