Search in sources :

Example 11 with ILispDAO

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

the class SimpleMapCache method addMapping.

@Override
public void addMapping(Eid key, Object value, Set<IpAddressBinary> sourceRlocs) {
    Eid eid = MaskUtil.normalize(key);
    ILispDAO table = getOrInstantiateVniTable(key);
    table.put(eid, new MappingEntry<>(SubKeys.RECORD, value));
    if (sourceRlocs != null) {
        table.put(eid, new MappingEntry<>(SubKeys.SRC_RLOCS, sourceRlocs));
    }
}
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 12 with ILispDAO

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

the class SimpleMapCache method addData.

@Override
public void addData(Eid eid, String subKey, Object data) {
    ILispDAO table = getOrInstantiateVniTable(eid);
    Eid key = MaskUtil.normalize(eid);
    table.put(key, new MappingEntry<>(subKey, data));
}
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 13 with ILispDAO

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

the class SimpleMapCacheTest method getAllXtrIdMappings_withNonMaskableAddress.

/**
 * Tests {@link SimpleMapCache#getAllXtrIdMappings} method with non maskable address.
 */
@Test
@SuppressWarnings("unchecked")
public void getAllXtrIdMappings_withNonMaskableAddress() {
    final Map<String, Object> entryMock = Mockito.mock(Map.class);
    final ILispDAO xtrIdRecordsMock = Mockito.mock(ILispDAO.class);
    Mockito.when(daoMock.getSpecific(VNI_0, SubKeys.VNI)).thenReturn(tableMock);
    Mockito.when(tableMock.getBest(NORMALIZED_EID_IPV4)).thenReturn(entryMock);
    Mockito.when(entryMock.get(SubKeys.XTRID_RECORDS)).thenReturn(xtrIdRecordsMock);
    Mockito.when(xtrIdRecordsMock.getSpecific(EID_IPV4, SubKeys.RECORD)).thenReturn(xtrIdDaoMock);
    simpleMapCache.getAllXtrIdMappings(EID_IPV4);
    Mockito.verify(tableMock).getBest(Mockito.any(Eid.class));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO) Test(org.junit.Test)

Example 14 with ILispDAO

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

the class HashMapDb method putTable.

@Override
public ILispDAO putTable(String key) {
    ILispDAO table = (ILispDAO) getSpecific(TABLES, key);
    if (table != null) {
        LOG.warn("Trying to add table that already exists. Aborting!");
        return table;
    }
    table = new HashMapDb();
    put(TABLES, new MappingEntry<>(key, table));
    return table;
}
Also used : ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)

Example 15 with ILispDAO

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

the class HashMapDbTest method testPutTable_entryExists.

@Test
public void testPutTable_entryExists() throws Exception {
    Object dbEntryKey = "tables";
    String mapKey1 = "mapKey1";
    ILispDAO mapValue1 = new HashMapDb();
    map.put(dbEntryKey, new MappingEntry<>(mapKey1, mapValue1));
    Assert.assertEquals(mapValue1, map.putTable(mapKey1));
    Assert.assertEquals(mapValue1, map.getSpecific(dbEntryKey, mapKey1));
}
Also used : ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO) Test(org.junit.Test)

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