use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress in project lispflowmapping by opendaylight.
the class LispSouthboundHandler method refreshAuthKeyIfNecessary.
private MapRegisterCacheValue refreshAuthKeyIfNecessary(MapRegisterCacheValue mapRegisterCacheValue) {
final List<EidLispAddress> eids = mapRegisterCacheValue.getMapRegisterCacheMetadata().getEidLispAddress();
if (lispSbPlugin.getAuthenticationKeyDataListener().authKeysForEidsUnchanged(eids, lispSbPlugin.getMapRegisterCacheTimeout())) {
return mapRegisterCacheValue;
}
final MappingAuthkey mappingAuthkey = provideAuthenticateKey(eids);
final MapRegisterCacheValueBuilder newMapRegisterCacheValueBuilder = new MapRegisterCacheValueBuilder(mapRegisterCacheValue);
final MapRegisterCacheMetadataBuilder newMapRegisterCacheMetadataBuilder = new MapRegisterCacheMetadataBuilder(mapRegisterCacheValue.getMapRegisterCacheMetadata());
newMapRegisterCacheValueBuilder.setMappingAuthkey(mappingAuthkey);
newMapRegisterCacheValueBuilder.setMapRegisterCacheMetadata(newMapRegisterCacheMetadataBuilder.build());
return newMapRegisterCacheValueBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress in project lispflowmapping by opendaylight.
the class LispSouthboundHandler method provideEidPrefixesFromMessage.
private List<EidLispAddress> provideEidPrefixesFromMessage(final MapRegister mapRegister) {
List<EidLispAddress> eidsResult = new ArrayList<>();
for (MappingRecordItem mappingRecordItem : mapRegister.getMappingRecordItem()) {
final EidLispAddressBuilder eidLispAddressBuilder = new EidLispAddressBuilder();
final Eid eid = mappingRecordItem.getMappingRecord().getEid();
eidLispAddressBuilder.setEidLispAddressId(LispAddressStringifier.getString(eid));
eidLispAddressBuilder.setEid(eid);
eidsResult.add(eidLispAddressBuilder.build());
}
return eidsResult;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress in project lispflowmapping by opendaylight.
the class AuthenticationKeyDataListener method authKeysForEidsUnchanged.
/**
* We maintain a HashMap with the update times of AuthenticationKey objects in the updatedEntries field. We keep
* entries in the HashMap for the Map-Register cache timeout interval, and lazy remove them afterwards. As a result
* the same EID will be considered updated during that interval, even on subsequent queries. This is necessary
* because more than one xTR may register the same EID, and to avoid complexity we don't store origin information.
* The performance trade-off is not significant, because during a typical cache timeout the same xTR will send only
* a few registration packets (2 for the default value of 90s, when UDP Map-Registers are sent at 1 minute
* intervals).
*
* @param eids List of EIDs to check
* @param timeout MapRegister cache timeout value
* @return false if any of the EIDs in the eids list was updated in the last timout period, true otherwise
*/
public synchronized boolean authKeysForEidsUnchanged(List<EidLispAddress> eids, long timeout) {
boolean result = true;
Long currentTime = System.currentTimeMillis();
for (EidLispAddress eidLispAddress : eids) {
Long updateTime = updatedEntries.get(eidLispAddress.getEid());
if (updateTime != null) {
result = false;
if (currentTime - updateTime > timeout) {
updatedEntries.remove(eidLispAddress.getEid());
}
}
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress in project lispflowmapping by opendaylight.
the class LispMappingServiceTest method getDefaultMapRegisterCacheMetadata.
private static MapRegisterCacheMetadata getDefaultMapRegisterCacheMetadata() {
final EidLispAddress eidLispAddress_1 = new EidLispAddressBuilder().setEidLispAddressId("id-1").setEid(IPV4_EID_1).build();
final EidLispAddress eidLispAddress_2 = new EidLispAddressBuilder().setEidLispAddressId("id-2").setEid(IPV4_EID_2).build();
return new MapRegisterCacheMetadataBuilder().setEidLispAddress(Lists.newArrayList(eidLispAddress_1, eidLispAddress_2)).setTimestamp(TIMESTAMP).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress in project lispflowmapping by opendaylight.
the class LispMappingService method onMappingKeepAlive.
@Override
public void onMappingKeepAlive(MappingKeepAlive notification) {
final MapRegisterCacheMetadata cacheMetadata = notification.getMapRegisterCacheMetadata();
for (EidLispAddress eidLispAddress : cacheMetadata.getEidLispAddress()) {
final Eid eid = eidLispAddress.getEid();
final XtrId xtrId = cacheMetadata.getXtrId();
final Long timestamp = cacheMetadata.getTimestamp();
LOG.debug("Update map registration for eid {} with timestamp {}", LispAddressStringifier.getString(eid), timestamp);
mapService.refreshMappingRegistration(eid, xtrId, timestamp);
}
}
Aggregations