Search in sources :

Example 1 with ILispDAO

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

the class AuthKeyDb method removeAuthenticationKey.

@Override
public void removeAuthenticationKey(Eid eid) {
    Eid key = MaskUtil.normalize(eid);
    ILispDAO table = getVniTable(key);
    if (table == null) {
        return;
    }
    table.removeSpecific(key, SubKeys.AUTH_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 2 with ILispDAO

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

the class AuthKeyDb method addAuthenticationKey.

@Override
public void addAuthenticationKey(Eid eid, MappingAuthkey authKey) {
    Eid key = MaskUtil.normalize(eid);
    ILispDAO table = getOrInstantiateVniTable(key);
    table.put(key, new MappingEntry<>(SubKeys.AUTH_KEY, authKey));
}
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 3 with ILispDAO

use of org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO 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 4 with ILispDAO

use of org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO 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 5 with ILispDAO

use of org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO 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

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