/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation
+ * Copyright (C) 2023-2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.ncmp.api.NetworkCmProxyDataService;
import org.onap.cps.ncmp.api.impl.client.DmiRestClient;
+import org.onap.cps.ncmp.api.impl.config.embeddedcache.TrustLevelCacheConfig;
import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel;
import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevelManager;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
private final DmiRestClient dmiRestClient;
private final NetworkCmProxyDataService networkCmProxyDataService;
private final TrustLevelManager trustLevelManager;
+
+ @Qualifier(TrustLevelCacheConfig.TRUST_LEVEL_PER_DMI_PLUGIN)
private final Map<String, TrustLevel> trustLevelPerDmiPlugin;
/**
* This class monitors the trust level of all DMI plugin by checking the health status
- * the resulting trustlevel wil be stored in the relevant cache.
+ * the resulting trust level wil be stored in the relevant cache.
* The @fixedDelayString is the time interval, in milliseconds, between consecutive checks.
*/
- @Scheduled(fixedDelayString = "${ncmp.timers.trust-evel.dmi-availability-watchdog-ms:30000}")
+ @Scheduled(fixedDelayString = "${ncmp.timers.trust-level.dmi-availability-watchdog-ms:30000}")
public void checkDmiAvailability() {
trustLevelPerDmiPlugin.entrySet().forEach(entry -> {
final TrustLevel newDmiTrustLevel;
} else {
newDmiTrustLevel = TrustLevel.NONE;
}
-
if (oldDmiTrustLevel.equals(newDmiTrustLevel)) {
- log.debug("The Dmi Plugin: {} has already the same trust level: {}", dmiServiceName,
- newDmiTrustLevel);
+ log.debug("The Dmi Plugin: {} has already the same trust level: {}", dmiServiceName, newDmiTrustLevel);
} else {
- trustLevelPerDmiPlugin.put(dmiServiceName, newDmiTrustLevel);
-
- final Collection<String> notificationCandidateCmHandleIds =
+ final Collection<String> cmHandleIds =
networkCmProxyDataService.getAllCmHandleIdsByDmiPluginIdentifier(dmiServiceName);
- for (final String cmHandleId: notificationCandidateCmHandleIds) {
- trustLevelManager.handleUpdateOfTrustLevels(cmHandleId, newDmiTrustLevel.name());
- }
+ trustLevelManager.handleUpdateOfDmiTrustLevel(dmiServiceName, cmHandleIds, newDmiTrustLevel);
}
});
}