Add new parameter for timeout for all operations 05/140905/2
authorFrancescoFioraEst <francesco.fiora@est.tech>
Fri, 16 May 2025 13:20:58 +0000 (14:20 +0100)
committerFrancesco Fiora <francesco.fiora@est.tech>
Mon, 19 May 2025 11:05:51 +0000 (11:05 +0000)
Issue-ID: POLICY-5368
Change-Id: Ia5ab8850588925edeb8c52974b1a183e5de78244
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantParameters.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/scanner/AbstractScanner.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/scanner/AcDefinitionScanner.java
runtime-acm/src/main/resources/application.yaml
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/scanner/AcDefinitionScannerTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/scanner/PhaseScannerTest.java
runtime-acm/src/test/resources/parameters/TestParameters.json

index ae5f22a..f92ff94 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2021,2023 Nordix Foundation.
+ *  Copyright (C) 2021,2023,2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -32,8 +32,11 @@ import org.springframework.validation.annotation.Validated;
 public class ParticipantParameters {
 
     @Min(100)
-    private long heartBeatMs;
+    private long heartBeatMs = 20000;
 
     @Min(100)
-    private long maxStatusWaitMs;
+    private long maxStatusWaitMs = 150000;
+
+    @Min(100)
+    private long maxOperationWaitMs = 200000;
 }
index 0f9b941..a4c05ce 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2025 Nordix Foundation.
+ * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public abstract class AbstractScanner {
 
     protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractScanner.class);
 
-    protected final long maxStatusWaitMs;
+    protected final long maxOperationWaitMs;
 
     protected final AutomationCompositionProvider acProvider;
     private final ParticipantSyncPublisher participantSyncPublisher;
@@ -48,7 +48,7 @@ public abstract class AbstractScanner {
             final AcRuntimeParameterGroup acRuntimeParameterGroup, final EncryptionUtils encryptionUtils) {
         this.acProvider = acProvider;
         this.participantSyncPublisher = participantSyncPublisher;
-        this.maxStatusWaitMs = acRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs();
+        this.maxOperationWaitMs = acRuntimeParameterGroup.getParticipantParameters().getMaxOperationWaitMs();
         this.encryptionUtils = encryptionUtils;
     }
 
@@ -98,7 +98,7 @@ public abstract class AbstractScanner {
         }
         var now = TimestampHelper.nowEpochMilli();
         var lastMsg = TimestampHelper.toEpochMilli(automationComposition.getLastMsg());
-        if ((now - lastMsg) > maxStatusWaitMs) {
+        if ((now - lastMsg) > maxOperationWaitMs) {
             LOGGER.debug("Report timeout for the ac instance {}", automationComposition.getInstanceId());
             automationComposition.setStateChangeResult(StateChangeResult.TIMEOUT);
             updateSync.setUpdated(true);
index d3f9726..e390dfa 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2025 Nordix Foundation.
+ * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ import org.springframework.stereotype.Component;
 public class AcDefinitionScanner {
     private static final Logger LOGGER = LoggerFactory.getLogger(AcDefinitionScanner.class);
 
-    private final long maxStatusWaitMs;
+    private final long maxOperationWaitMs;
 
     private final AcDefinitionProvider acDefinitionProvider;
     private final ParticipantSyncPublisher participantSyncPublisher;
@@ -53,7 +53,7 @@ public class AcDefinitionScanner {
             final AcRuntimeParameterGroup acRuntimeParameterGroup) {
         this.acDefinitionProvider = acDefinitionProvider;
         this.participantSyncPublisher = participantSyncPublisher;
-        this.maxStatusWaitMs = acRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs();
+        this.maxOperationWaitMs = acRuntimeParameterGroup.getParticipantParameters().getMaxOperationWaitMs();
     }
 
     private UpdateSync handlePrimeAckElement(DocMessage message, AutomationCompositionDefinition acDefinition) {
@@ -145,7 +145,7 @@ public class AcDefinitionScanner {
         }
         var now = TimestampHelper.nowEpochMilli();
         var lastMsg = TimestampHelper.toEpochMilli(acDefinition.getLastMsg());
-        if ((now - lastMsg) > maxStatusWaitMs) {
+        if ((now - lastMsg) > maxOperationWaitMs) {
             LOGGER.debug("Report timeout for the ac definition {}", acDefinition.getCompositionId());
             acDefinition.setStateChangeResult(StateChangeResult.TIMEOUT);
             result.setUpdated(true);
index 59d1aa5..349f3f3 100644 (file)
@@ -41,7 +41,8 @@ runtime:
     syncTopic: acm-ppnt-sync
   participantParameters:
     heartBeatMs: 20000
-    maxStatusWaitMs: 200000
+    maxStatusWaitMs: 150000
+    maxOperationWaitMs: 200000
   topicParameterGroup:
     topicSources:
       - topic: ${runtime.topics.operationTopic}
index 2e6d282..66c4715 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2025 Nordix Foundation.
+ * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -205,7 +205,7 @@ class AcDefinitionScannerTest {
         verify(acDefinitionProvider, times(0)).updateAcDefinitionState(any());
         verify(participantSyncPublisher, times(0)).sendSync(any(), any());
 
-        acRuntimeParameterGroup.getParticipantParameters().setMaxStatusWaitMs(-1);
+        acRuntimeParameterGroup.getParticipantParameters().setMaxOperationWaitMs(-1);
         acDefinitionScanner = new AcDefinitionScanner(acDefinitionProvider, participantSyncPublisher,
                 acRuntimeParameterGroup);
         acDefinition = createAutomationCompositionDefinition(AcTypeState.PRIMING, StateChangeResult.NO_ERROR);
index c2860a8..657a21f 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2025 Nordix Foundation.
+ * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -121,7 +121,7 @@ class PhaseScannerTest {
         var acStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
         var participantSyncPublisher = mock(ParticipantSyncPublisher.class);
         var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
-        acRuntimeParameterGroup.getParticipantParameters().setMaxStatusWaitMs(-1);
+        acRuntimeParameterGroup.getParticipantParameters().setMaxOperationWaitMs(-1);
         var encryptionUtils = new EncryptionUtils(acRuntimeParameterGroup);
 
         // verify timeout scenario
index 1558abc..7829a62 100644 (file)
@@ -1,24 +1,9 @@
 {
     "name": "AutomationCompositionRuntimeGroup",
-    "supervisionScannerIntervalSec": 1000,
-    "participantAcUpdateIntervalSec": 1000,
-    "participantAcStateChangeIntervalSec": 1000,
     "participantParameters": {
         "heartBeatMs": 120000,
         "maxStatusWaitMs": 100000,
-        "updateParameters": {
-            "maxRetryCount": 1,
-            "maxWaitMs": 30000
-        }
-    },
-    "databaseProviderParameters": {
-        "name": "PolicyProviderParameterGroup",
-        "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
-        "databaseDriver": "org.h2.Driver",
-        "databaseUrl": "${dbName}",
-        "databaseUser": "policy",
-        "databasePassword": "P01icY",
-        "persistenceUnit": "InstantiationTests"
+        "maxOperationWaitMs": 200000
     },
     "topics":{
         "operationTopic": "policy-acruntime-participant",