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;
}
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));
}
}
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;
}
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);
}
}
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;
}
Aggregations