Search in sources :

Example 6 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 MaskUtil method normalizeSrcDst.

private static Eid normalizeSrcDst(Eid eid) throws UnknownHostException {
    final SimpleAddress normalizedSrc = normalizeSimpleAddress(((SourceDestKey) eid.getAddress()).getSourceDestKey().getSource());
    final SimpleAddress normalizedDst = normalizeSimpleAddress(((SourceDestKey) eid.getAddress()).getSourceDestKey().getDest());
    return LispAddressUtil.asSrcDstEid(new SourceDestKeyBuilder().setSource(normalizedSrc).setDest(normalizedDst).build(), eid.getVirtualNetworkId());
}
Also used : SourceDestKeyBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKeyBuilder) 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 7 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 SourceDestKeySerializerTest method deserialize__Simple.

@Test
public void deserialize__Simple() throws Exception {
    Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer(// 
    "40 03 00 00 " + // 
    "0C 20 00 10 " + // reserved + masks
    "00 00 10 18 " + // AFI=1, IP=0x11223344
    "00 01 11 22 33 44 " + // AFI=1, IP=0x22334455
    "00 01 22 33 44 55"), new LispAddressSerializerContext(null));
    assertEquals(SourceDestKeyLcaf.class, address.getAddressType());
    SourceDestKey srcDestAddress = (SourceDestKey) address.getAddress();
    assertEquals((byte) 0x10, MaskUtil.getMaskForAddress(srcDestAddress.getSourceDestKey().getSource()));
    assertEquals((byte) 0x18, MaskUtil.getMaskForAddress(srcDestAddress.getSourceDestKey().getDest()));
    assertEquals("17.34.51.68/16", String.valueOf(srcDestAddress.getSourceDestKey().getSource().getValue()));
    assertEquals("34.51.68.85/24", String.valueOf(srcDestAddress.getSourceDestKey().getDest().getValue()));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) LispAddressSerializerContext(org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) Test(org.junit.Test)

Example 8 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 AuthKeyDb method getAuthenticationKey.

/*
     * Retrieves authentication key from the database. As opposed to the mapping cache, Source/Dest keys are treated as
     * exact match keys here, and a two level longest prefix match is NOT performed.
     */
@Override
public MappingAuthkey getAuthenticationKey(Eid eid) {
    ILispDAO table = getVniTable(eid);
    if (table == null) {
        return null;
    }
    if (MaskUtil.isMaskable(eid.getAddress()) && !(eid.getAddress() instanceof SourceDestKey)) {
        return getAuthKeyLpm(eid, table);
    } else {
        Eid key = MaskUtil.normalize(eid);
        Object password = table.getSpecific(key, SubKeys.AUTH_KEY);
        if (password != null && password instanceof MappingAuthkey) {
            return (MappingAuthkey) password;
        } else {
            LOG.warn("Failed to find password!");
            return null;
        }
    }
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) MappingAuthkey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey) ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)

Example 9 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 MultiTableMapCache method removeData.

@Override
public void removeData(Eid eid, String subKey) {
    Eid key = MaskUtil.normalize(eid);
    ILispDAO table = getVniTable(key);
    if (table == null) {
        return;
    }
    if (key.getAddress() instanceof SourceDestKey) {
        ILispDAO db = getSDInnerDao(key, table);
        if (db != null) {
            db.removeSpecific(SourceDestKeyHelper.getSrcBinary(key), subKey);
            if (db.isEmpty()) {
                removeSDInnerDao(key, table);
            }
        }
    } else {
        table.removeSpecific(key, subKey);
    }
    if (table.isEmpty()) {
        removeVniTable(eid);
    }
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)

Example 10 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 MultiTableMapCache method removeMapping.

public void removeMapping(Eid eid) {
    Eid key = MaskUtil.normalize(eid);
    ILispDAO table = getVniTable(key);
    if (table == null) {
        return;
    }
    if (key.getAddress() instanceof SourceDestKey) {
        ILispDAO db = getSDInnerDao(key, table);
        if (db != null) {
            db.remove(SourceDestKeyHelper.getSrcBinary(key));
            if (db.isEmpty()) {
                removeSDInnerDao(key, table);
            }
        }
    } else {
        table.remove(key);
    }
    if (table.isEmpty()) {
        removeVniTable(eid);
    }
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)

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