Search in sources :

Example 16 with SourceDestKey

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey in project lispflowmapping by opendaylight.

the class MultiTableMapCacheTest method addMappingTest_withSourceDestKey.

/**
 * Tests {@link MultiTableMapCache#addMapping} with SourceDestKey address type.
 */
@Test
public void addMappingTest_withSourceDestKey() {
    final Eid normalized_Eid = MaskUtil.normalize(EID_SOURCE_DEST_KEY_TYPE);
    final Eid dstKey = SourceDestKeyHelper.getDstBinary(normalized_Eid);
    final Eid srcKey = SourceDestKeyHelper.getSrcBinary(normalized_Eid);
    when(daoMock.getSpecific(VNI, SubKeys.VNI)).thenReturn(tableDaoMock);
    when(tableDaoMock.getSpecific(dstKey, SubKeys.LCAF_SRCDST)).thenReturn(srcDstDaoMock);
    multiTableMapCache.addMapping(EID_SOURCE_DEST_KEY_TYPE, DUMMY_OBJECT);
    verify(srcDstDaoMock).put(srcKey, new MappingEntry<>(SubKeys.RECORD, DUMMY_OBJECT));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Test(org.junit.Test)

Example 17 with SourceDestKey

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method registerAndQuery__SrcDestLCAF.

// ------------------------------- LCAF Tests ---------------------------
public void registerAndQuery__SrcDestLCAF() throws SocketTimeoutException {
    cleanUP();
    String ipPrefix = "10.20.30.200/32";
    String macString = "01:02:03:04:05:06";
    SourceDestKeyBuilder builder = new SourceDestKeyBuilder();
    builder.setSource(new SimpleAddress(new IpPrefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix(ipPrefix))));
    builder.setDest(new SimpleAddress(new MacAddress(macString)));
    EidBuilder eb = new EidBuilder();
    eb.setAddressType(SourceDestKeyLcaf.class);
    eb.setVirtualNetworkId(null);
    eb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKeyBuilder().setSourceDestKey(builder.build()).build());
    MapReply reply = registerAddressAndQuery(eb.build());
    Eid fromNetwork = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(SourceDestKeyLcaf.class, fromNetwork.getAddressType());
    SourceDestKey sourceDestFromNetwork = (SourceDestKey) fromNetwork.getAddress();
    SimpleAddress receivedAddr1 = sourceDestFromNetwork.getSourceDestKey().getSource();
    SimpleAddress receivedAddr2 = sourceDestFromNetwork.getSourceDestKey().getDest();
    assertNotNull(receivedAddr1.getIpPrefix().getIpv4Prefix());
    assertNotNull(receivedAddr2.getMacAddress());
    IpPrefix receivedIP = receivedAddr1.getIpPrefix();
    MacAddress receivedMAC = receivedAddr2.getMacAddress();
    assertEquals(ipPrefix, receivedIP.getIpv4Prefix().getValue());
    assertEquals(macString, receivedMAC.getValue());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) SourceDestKeyBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKeyBuilder) 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) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)

Example 18 with SourceDestKey

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method registerAndQuery__SrcDestLCAFOverlap.

public void registerAndQuery__SrcDestLCAFOverlap() throws SocketTimeoutException {
    cleanUP();
    String ipString1 = "10.10.10.0";
    String ipString2 = "20.20.20.0";
    String ipPrefix1 = ipString1 + "/24";
    String ipPrefix2 = ipString2 + "/24";
    Eid srcDst = LispAddressUtil.asSrcDstEid(ipString1, ipString2, 24, 24, 0);
    registerAddress(LispAddressUtil.asIpv4PrefixBinaryEid(ipPrefix2));
    registerAddress(srcDst);
    // exact match
    MapReply reply = queryForAddress(srcDst, null);
    Eid fromNetwork = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(SourceDestKeyLcaf.class, fromNetwork.getAddressType());
    SourceDestKey sourceDestFromNetwork = (SourceDestKey) fromNetwork.getAddress();
    IpPrefix receivedAddr1 = sourceDestFromNetwork.getSourceDestKey().getSource().getIpPrefix();
    IpPrefix receivedAddr2 = sourceDestFromNetwork.getSourceDestKey().getDest().getIpPrefix();
    assertNotNull(receivedAddr1.getIpv4Prefix());
    assertNotNull(receivedAddr2.getIpv4Prefix());
    assertEquals(ipPrefix1, receivedAddr1.getIpv4Prefix().getValue());
    assertEquals(ipPrefix2, receivedAddr2.getIpv4Prefix().getValue());
    // srcEid/dstEid match
    reply = queryForAddress(LispAddressUtil.asIpv4PrefixBinaryEid("20.20.20.1/32"), "10.10.10.1");
    fromNetwork = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(Ipv4PrefixBinaryAfi.class, fromNetwork.getAddressType());
    assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid(ipPrefix2), fromNetwork);
    // dstEid match only
    reply = queryForAddress(LispAddressUtil.asIpv4PrefixBinaryEid("20.20.20.1/32"), "1.2.3.4");
    fromNetwork = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(Ipv4PrefixBinaryAfi.class, fromNetwork.getAddressType());
    assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid(ipPrefix2), fromNetwork);
}
Also used : IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) 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) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey)

Example 19 with SourceDestKey

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey in project lispflowmapping by opendaylight.

the class MappingMergeUtilTest method computeNbSbIntersectionTest_withMaskableSourceDestKeyEIDs_Ipv4SB.

/**
 * Tests {@link MappingMergeUtil#computeNbSbIntersection} method with SourceDestKey Eid address type, Ipv4Prefix
 * SB Eid, Nb mask less than SB mask.
 */
@Test
public void computeNbSbIntersectionTest_withMaskableSourceDestKeyEIDs_Ipv4SB() {
    MappingRecord nbMappingRecord = getDefaultMappingRecordBuilder().setEid(SOURCE_DEST_KEY_EID_1).build();
    MappingRecord sbMappingRecord = getDefaultMappingRecordBuilder().setEid(IPV4_PREFIX_EID_1).build();
    MappingData nbMappingData = getDefaultMappingData(nbMappingRecord);
    MappingData sbMappingData = getDefaultMappingData(sbMappingRecord);
    // result
    final MappingData result = MappingMergeUtil.computeNbSbIntersection(nbMappingData, sbMappingData);
    final Eid eid = LispAddressUtil.asSrcDstEid(IPV4_STRING_3, IPV4_STRING_1, 24, 24, 1);
    assertEquals(eid, result.getRecord().getEid());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData) Test(org.junit.Test)

Example 20 with SourceDestKey

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey in project lispflowmapping by opendaylight.

the class MapServer method handleSmr.

private void handleSmr(Eid eid, Set<Subscriber> subscribers) {
    sendSmrs(eid, subscribers);
    // For SrcDst LCAF also send SMRs to Dst prefix
    if (eid.getAddress() instanceof SourceDestKey) {
        Eid dstAddr = SourceDestKeyHelper.getDstBinary(eid);
        Set<Subscriber> dstSubs = mapService.getSubscribers(dstAddr);
        sendSmrs(dstAddr, dstSubs);
    }
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Subscriber(org.opendaylight.lispflowmapping.interfaces.dao.Subscriber) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey)

Aggregations

Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)28 SourceDestKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey)20 Test (org.junit.Test)16 ILispDAO (org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)7 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)6 EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)6 SourceDestKeyBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKeyBuilder)5 Subscriber (org.opendaylight.lispflowmapping.interfaces.dao.Subscriber)4 SourceDestKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey)4 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)3 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)3 LispAddressSerializerContext (org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext)2 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)2 Ipv4PrefixAfi (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4PrefixAfi)2 Ipv4PrefixBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder)2 Ipv4PrefixBinaryAfi (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.Ipv4PrefixBinaryAfi)2 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)2 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)2 Preconditions (com.google.common.base.Preconditions)1 Inet4Address (java.net.Inet4Address)1