Search in sources :

Example 1 with EidLispAddress

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();
}
Also used : MapRegisterCacheMetadataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.MapRegisterCacheMetadataBuilder) EidLispAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress) MappingAuthkey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey) MapRegisterCacheValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.value.grouping.MapRegisterCacheValueBuilder)

Example 2 with EidLispAddress

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;
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) EidLispAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress) MappingRecordItem(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem) ArrayList(java.util.ArrayList) EidLispAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddressBuilder)

Example 3 with EidLispAddress

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;
}
Also used : EidLispAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress)

Example 4 with EidLispAddress

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();
}
Also used : MapRegisterCacheMetadataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.MapRegisterCacheMetadataBuilder) EidLispAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress) EidLispAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddressBuilder)

Example 5 with EidLispAddress

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);
    }
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) EidLispAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress) MapRegisterCacheMetadata(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.MapRegisterCacheMetadata) XtrId(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId)

Aggregations

EidLispAddress (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress)5 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)2 MapRegisterCacheMetadataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.MapRegisterCacheMetadataBuilder)2 EidLispAddressBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddressBuilder)2 ArrayList (java.util.ArrayList)1 XtrId (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId)1 MapRegisterCacheMetadata (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.MapRegisterCacheMetadata)1 MapRegisterCacheValueBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.value.grouping.MapRegisterCacheValueBuilder)1 MappingAuthkey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey)1 MappingRecordItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem)1