Search in sources :

Example 11 with ItrRloc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc 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);
}
Also used : ItrRloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc) Ipv4AddressBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary) 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) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) Ipv4BinaryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4BinaryBuilder) 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 12 with ItrRloc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method runPrefixTest.

private void runPrefixTest(Eid registerEID, Eid matchedAddress, Eid unMatchedAddress) throws SocketTimeoutException {
    mapService.addAuthenticationKey(registerEID, NULL_AUTH_KEY);
    sleepForSeconds(1);
    MapRegisterBuilder mapRegister = new MapRegisterBuilder();
    mapRegister.setWantMapNotify(true);
    mapRegister.setNonce((long) 8);
    mapRegister.setWantMapNotify(true);
    mapRegister.setKeyId((short) 0);
    mapRegister.setAuthenticationData(new byte[0]);
    mapRegister.setNonce((long) 8);
    mapRegister.setProxyMapReply(false);
    MappingRecordBuilder etlr = new MappingRecordBuilder();
    etlr.setRecordTtl(254);
    etlr.setAction(Action.NoAction);
    etlr.setAuthoritative(false);
    etlr.setMapVersion((short) 0);
    etlr.setEid(registerEID);
    etlr.setRecordTtl(254);
    LocatorRecordBuilder record = new LocatorRecordBuilder();
    record.setRloc(LispAddressUtil.asIpv4Rloc("4.3.2.1"));
    record.setLocalLocator(false);
    record.setRlocProbed(false);
    record.setRouted(true);
    record.setMulticastPriority((short) 0);
    record.setMulticastWeight((short) 0);
    record.setPriority((short) 0);
    record.setWeight((short) 0);
    etlr.setLocatorRecord(new ArrayList<LocatorRecord>());
    etlr.getLocatorRecord().add(record.build());
    mapRegister.setMappingRecordItem(new ArrayList<MappingRecordItem>());
    mapRegister.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(etlr.build()).build());
    sendMapRegister(mapRegister.build());
    MapNotify mapNotify = receiveMapNotify();
    assertEquals(8, mapNotify.getNonce().longValue());
    sleepForSeconds(1);
    MapRequestBuilder mapRequest = new MapRequestBuilder();
    mapRequest.setNonce((long) 4);
    mapRequest.setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(ourAddress)).build());
    mapRequest.setEidItem(new ArrayList<EidItem>());
    mapRequest.setAuthoritative(false);
    mapRequest.setMapDataPresent(false);
    mapRequest.setPitr(false);
    mapRequest.setProbe(false);
    mapRequest.setSmr(false);
    mapRequest.setSmrInvoked(false);
    mapRequest.getEidItem().add(new EidItemBuilder().setEid(matchedAddress).build());
    mapRequest.setItrRloc(new ArrayList<ItrRloc>());
    mapRequest.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(ourAddress)).build());
    sendMapRequest(mapRequest.build());
    MapReply mapReply = receiveMapReply();
    assertEquals(4, mapReply.getNonce().longValue());
    assertEquals(record.getRloc(), mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
    mapRequest.setEidItem(new ArrayList<EidItem>());
    mapRequest.getEidItem().add(new EidItemBuilder().setEid(unMatchedAddress).build());
    sendMapRequest(mapRequest.build());
    mapReply = receiveMapReply();
    assertEquals(0, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
}
Also used : LocatorRecordBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecordBuilder) MappingRecordItemBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder) MappingRecordItem(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply) MappingRecordBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder) GotMapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify) MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify) 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) MapRegisterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapregisternotification.MapRegisterBuilder) LocatorRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord) ItrRloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc) ItrRlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)

Example 13 with ItrRloc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTestUtil method getDefaultItrRlocList.

/**
 * Create a default ItrRloc List.
 *
 * @param rloc the single Rloc to be added to the list
 * @return the ItrRloc List object
 */
static List<ItrRloc> getDefaultItrRlocList(Rloc rloc) {
    if (rloc == null) {
        rloc = DEFAULT_IPV4_ITR_RLOC;
    }
    final List<ItrRloc> itrRlocList = new ArrayList<>();
    final ItrRloc itrRloc = new ItrRlocBuilder().setKey(new ItrRlocKey(LispAddressStringifier.getString(rloc))).setItrRlocId(LispAddressStringifier.getString(rloc)).setRloc(rloc).build();
    itrRlocList.add(itrRloc);
    return itrRlocList;
}
Also used : ItrRloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc) ItrRlocKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocKey) ItrRlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder) ArrayList(java.util.ArrayList)

Example 14 with ItrRloc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc 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 15 with ItrRloc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc 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)

Aggregations

ItrRloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc)17 ItrRlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder)16 Test (org.junit.Test)11 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder)9 EidItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem)8 EidItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder)7 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)7 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)6 RlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder)6 ByteBuffer (java.nio.ByteBuffer)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 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder)5 InetAddress (java.net.InetAddress)4 Subscriber (org.opendaylight.lispflowmapping.interfaces.dao.Subscriber)3 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)3 LocatorRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord)3 MappingRecordItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder)3 ArrayList (java.util.ArrayList)2 Ignore (org.junit.Ignore)2