use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey in project lispflowmapping by opendaylight.
the class MaskUtil method normalizeSrcDst.
private static Eid normalizeSrcDst(Eid eid) throws UnknownHostException {
final SimpleAddress normalizedSrc = normalizeSimpleAddress(((SourceDestKey) eid.getAddress()).getSourceDestKey().getSource());
final SimpleAddress normalizedDst = normalizeSimpleAddress(((SourceDestKey) eid.getAddress()).getSourceDestKey().getDest());
return LispAddressUtil.asSrcDstEid(new SourceDestKeyBuilder().setSource(normalizedSrc).setDest(normalizedDst).build(), eid.getVirtualNetworkId());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey in project lispflowmapping by opendaylight.
the class SourceDestKeySerializerTest method deserialize__Simple.
@Test
public void deserialize__Simple() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer(//
"40 03 00 00 " + //
"0C 20 00 10 " + // reserved + masks
"00 00 10 18 " + // AFI=1, IP=0x11223344
"00 01 11 22 33 44 " + // AFI=1, IP=0x22334455
"00 01 22 33 44 55"), new LispAddressSerializerContext(null));
assertEquals(SourceDestKeyLcaf.class, address.getAddressType());
SourceDestKey srcDestAddress = (SourceDestKey) address.getAddress();
assertEquals((byte) 0x10, MaskUtil.getMaskForAddress(srcDestAddress.getSourceDestKey().getSource()));
assertEquals((byte) 0x18, MaskUtil.getMaskForAddress(srcDestAddress.getSourceDestKey().getDest()));
assertEquals("17.34.51.68/16", String.valueOf(srcDestAddress.getSourceDestKey().getSource().getValue()));
assertEquals("34.51.68.85/24", String.valueOf(srcDestAddress.getSourceDestKey().getDest().getValue()));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey 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;
}
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey 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);
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKey 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);
}
}
Aggregations