Search in sources :

Example 16 with ILispDAO

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

the class AuthKeyDb 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 17 with ILispDAO

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

the class MultiTableMapCache method addData.

@Override
public void addData(Eid eid, String subKey, Object data) {
    Eid key = MaskUtil.normalize(eid);
    ILispDAO table = getOrInstantiateVniTable(key);
    if (key.getAddress() instanceof SourceDestKey) {
        ILispDAO srcDstDao = getOrInstantiateSDInnerDao(key, table);
        srcDstDao.put(SourceDestKeyHelper.getSrcBinary(key), new MappingEntry<>(subKey, data));
    } else {
        table.put(key, new MappingEntry<>(subKey, data));
    }
}
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 18 with ILispDAO

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

the class MultiTableMapCache method getOrInstantiateSDInnerDao.

// SrcDst LCAFs are stored in a 2-tier DAO with dst having priority over src.
// This method returns the DAO associated to a dst or creates it if it doesn't exist.
private ILispDAO getOrInstantiateSDInnerDao(Eid address, ILispDAO mappingsDb) {
    Eid dstKey = SourceDestKeyHelper.getDstBinary(address);
    ILispDAO srcDstDao = (ILispDAO) mappingsDb.getSpecific(dstKey, SubKeys.LCAF_SRCDST);
    if (srcDstDao == null) {
        // inserts nested table for source
        srcDstDao = mappingsDb.putNestedTable(dstKey, SubKeys.LCAF_SRCDST);
    }
    return srcDstDao;
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)

Example 19 with ILispDAO

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

the class SimpleMapCache method removeMapping.

@Override
public void removeMapping(Eid eid) {
    ILispDAO table = getVniTable(eid);
    if (table == null) {
        return;
    }
    Eid key = MaskUtil.normalize(eid);
    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) ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)

Example 20 with ILispDAO

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

the class SimpleMapCache method getAllXtrIdMappings.

@Override
public List<Object> getAllXtrIdMappings(Eid eid) {
    ILispDAO table = getVniTable(eid);
    if (table == null) {
        return null;
    }
    Map<String, ?> daoEntry = table.getBest(MaskUtil.normalize(eid));
    if (daoEntry != null) {
        ILispDAO xtrIdTable = (ILispDAO) daoEntry.get(SubKeys.XTRID_RECORDS);
        if (xtrIdTable != null) {
            return getXtrIdMappingList(xtrIdTable);
        }
    }
    return null;
}
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