Search in sources :

Example 6 with ILispDAO

use of org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO in project lispflowmapping by opendaylight.

the class MultiTableMapCache method addMapping.

public void addMapping(Eid key, Object value) {
    Eid eid = MaskUtil.normalize(key);
    ILispDAO table = getOrInstantiateVniTable(key);
    if (eid.getAddress() instanceof SourceDestKey) {
        Eid srcKey = SourceDestKeyHelper.getSrcBinary(eid);
        ILispDAO srcDstDao = getOrInstantiateSDInnerDao(eid, table);
        srcDstDao.put(srcKey, new MappingEntry<>(SubKeys.RECORD, value));
    } else {
        table.put(eid, new MappingEntry<>(SubKeys.RECORD, value));
    }
}
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 7 with ILispDAO

use of org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO in project lispflowmapping by opendaylight.

the class MultiTableMapCache method getData.

@Override
public Object getData(Eid eid, String subKey) {
    Eid key = MaskUtil.normalize(eid);
    ILispDAO table = getVniTable(key);
    if (table == null) {
        return null;
    }
    if (key.getAddress() instanceof SourceDestKey) {
        ILispDAO srcDstDao = getSDInnerDao(key, table);
        return srcDstDao.getSpecific(SourceDestKeyHelper.getSrcBinary(key), subKey);
    } else {
        return table.getSpecific(key, subKey);
    }
}
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 8 with ILispDAO

use of org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO in project lispflowmapping by opendaylight.

the class MultiTableMapCache method getOrInstantiateVniTable.

private ILispDAO getOrInstantiateVniTable(Eid eid) {
    long vni = getVni(eid);
    ILispDAO table = (ILispDAO) dao.getSpecific(vni, SubKeys.VNI);
    if (table == null) {
        table = dao.putNestedTable(vni, SubKeys.VNI);
    }
    return table;
}
Also used : ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)

Example 9 with ILispDAO

use of org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO in project lispflowmapping by opendaylight.

the class MultiTableMapCache method getMapping.

public Object getMapping(Eid srcEid, Eid dstEid) {
    if (dstEid == null) {
        return null;
    }
    ILispDAO table = getVniTable(dstEid);
    if (table == null) {
        return null;
    }
    // a map-request for an actual SrcDst LCAF, ignore src eid
    if (dstEid.getAddress() instanceof SourceDestKey) {
        Eid srcAddr = SourceDestKeyHelper.getSrcBinary(dstEid);
        Eid dstAddr = SourceDestKeyHelper.getDstBinary(dstEid);
        return getMappingLpmSD(srcAddr, dstAddr, table);
    }
    // potential map-request for SrcDst LCAF from non SrcDst capable devices
    return getMappingLpmSD(srcEid, dstEid, table);
}
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 ILispDAO

use of org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO in project lispflowmapping by opendaylight.

the class SimpleMapCache method getOrInstantiateVniTable.

private ILispDAO getOrInstantiateVniTable(Eid eid) {
    long vni = getVni(eid);
    ILispDAO table = (ILispDAO) dao.getSpecific(vni, SubKeys.VNI);
    if (table == null) {
        table = dao.putNestedTable(vni, SubKeys.VNI);
    }
    return table;
}
Also used : ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)

Aggregations

ILispDAO (org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)27 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)19 SourceDestKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey)7 Test (org.junit.Test)4 XtrId (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId)1 MappingAuthkey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey)1