aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controlloop/common/controller-frankfurt/src/test/resources/config/event-manager.properties9
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/feature/config/event-manager.properties9
-rw-r--r--controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java33
-rw-r--r--controlloop/common/feature-controlloop-trans/src/test/resources/logback.xml10
-rw-r--r--controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java24
5 files changed, 49 insertions, 36 deletions
diff --git a/controlloop/common/controller-frankfurt/src/test/resources/config/event-manager.properties b/controlloop/common/controller-frankfurt/src/test/resources/config/event-manager.properties
index ac78eb81b..7dd1e73c2 100644
--- a/controlloop/common/controller-frankfurt/src/test/resources/config/event-manager.properties
+++ b/controlloop/common/controller-frankfurt/src/test/resources/config/event-manager.properties
@@ -81,12 +81,3 @@ actor.service.VFC.maxPolls=20
actor.service.VFC.pollWaitSec=20
actor.service.VFC.operations.Restart.path=ns
actor.service.VFC.operations.Restart.timeoutSec=60
-
-# these can be deleted once the corresponding actor review is merged
-actor.service.SO.pathGet=orchestrationRequests/v5/
-actor.service.SO.maxGets=20
-actor.service.SO.waitSecGet=20
-actor.service.VFC.operations.Restart.clientName=VFC
-actor.service.VFC.operations.Restart.pathGet=jobs
-actor.service.VFC.operations.Restart.maxGets=20
-actor.service.VFC.operations.Restart.waitSecGet=20
diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/event-manager.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/event-manager.properties
index f1afd2509..b10b8970e 100644
--- a/controlloop/common/feature-controlloop-management/src/main/feature/config/event-manager.properties
+++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/event-manager.properties
@@ -82,12 +82,3 @@ actor.service.VFC.maxPolls=20
actor.service.VFC.pollWaitSec=20
actor.service.VFC.operations.Restart.path=ns
actor.service.VFC.operations.Restart.timeoutSec=60
-
-# these can be deleted once the corresponding actor review is merged
-actor.service.SO.pathGet=orchestrationRequests/v5/
-actor.service.SO.maxGets=20
-actor.service.SO.waitSecGet=20
-actor.service.VFC.operations.Restart.clientName=VFC
-actor.service.VFC.operations.Restart.pathGet=jobs
-actor.service.VFC.operations.Restart.maxGets=20
-actor.service.VFC.operations.Restart.waitSecGet=20
diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java
index 75e0f1f4d..956d28ed8 100644
--- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java
+++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java
@@ -28,10 +28,12 @@ import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.apache.commons.collections4.CollectionUtils;
+import org.onap.policy.controlloop.ControlLoopNotificationType;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.drools.persistence.SystemPersistenceConstants;
@@ -54,6 +56,22 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
private long transactionTimeout = ControlLoopMetricsFeature.CL_CACHE_TRANS_TIMEOUT_SECONDS_DEFAULT;
+ /**
+ * Numeric response code.
+ */
+ private static final Map<String, String> note2code = Map.of(
+ ControlLoopNotificationType.ACTIVE.name(), "100",
+ ControlLoopNotificationType.REJECTED.name(), "200",
+ ControlLoopNotificationType.OPERATION.name(), "300",
+ ControlLoopNotificationType.OPERATION_SUCCESS.name(), "301",
+ ControlLoopNotificationType.OPERATION_FAILURE.name(), "302",
+ ControlLoopNotificationType.FINAL_FAILURE.name(), "400",
+ ControlLoopNotificationType.FINAL_SUCCESS.name(), "401",
+ ControlLoopNotificationType.FINAL_OPENLOOP.name(), "402"
+ );
+
+ private static final String UNKNOWN_RESPONSE_CODE = "900";
+
public CacheBasedControlLoopMetricsManager() {
Properties properties = SystemPersistenceConstants.getManager()
@@ -288,7 +306,11 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
+ ":" + notification.getPolicyName() + ":" + notification.getPolicyVersion())
.setProcessKey("" + notification.getAai())
.setTargetEntity(notification.getTargetType() + "." + notification.getTarget())
- .setResponseCode((notification.getNotification() != null) ? notification.getNotification().name() : "-")
+ .setResponseCode((notification.getNotification() != null)
+ ? notificationTypeToResponseCode(notification.getNotification().name())
+ : UNKNOWN_RESPONSE_CODE)
+ .setCustomField1((notification.getNotification() != null)
+ ? notification.getNotification().name() : "")
.setResponseDescription(notification.getMessage())
.setClientIpAddress(notification.getClosedLoopEventClient());
}
@@ -362,4 +384,13 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
+ getCacheOccupancy()
+ "}";
}
+
+ private String notificationTypeToResponseCode(String notificationType) {
+ String code = note2code.get(notificationType);
+ if (code != null) {
+ return code;
+ } else {
+ return UNKNOWN_RESPONSE_CODE;
+ }
+ }
}
diff --git a/controlloop/common/feature-controlloop-trans/src/test/resources/logback.xml b/controlloop/common/feature-controlloop-trans/src/test/resources/logback.xml
index 6a25769e3..f2acc70e7 100644
--- a/controlloop/common/feature-controlloop-trans/src/test/resources/logback.xml
+++ b/controlloop/common/feature-controlloop-trans/src/test/resources/logback.xml
@@ -2,7 +2,7 @@
============LICENSE_START=======================================================
policy-management
================================================================================
- Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2020 AT&T Intellectual Property. 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.
@@ -20,7 +20,7 @@
<configuration scan="true" scanPeriod="30 seconds" debug="false">
- <property name="logDir" value="target/test-classes" />
+ <property name="logDir" value="logs" />
<property name="errorLog" value="error" />
<property name="debugLog" value="debug" />
@@ -37,9 +37,9 @@
value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}] [%X{networkEventType:-NULL}|%X{networkProtocol:-NULL}|%X{networkTopic:-NULL}|%X{requestID:-NULL}]%n" />
<property name="metricPattern"
- value="%X{RequestID}|%X{InvocationID}|%X{ServiceName}|%X{PartnerName}|%X{BeginTimestamp}|%X{EndTimestamp}|%X{ElapsedTime}|%X{ServiceInstanceID}|%X{VirtualServerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%X{Severity}|%X{TargetEntity}|%X{TargetServiceName}|%X{Server}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{ClientIPAddress}|%X{ProcessKey}|%X{RemoteHost}||%X{TargetVirtualEntity}|%level|%thread| %msg%n" />
- <property name="transactionPattern" value="${metricPattern}" />
-
+ value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity:-NA}|%X{TargetServiceName:-NA}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%class||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ <property name="transactionPattern"
+ value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%class|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
<appender name="ErrorOut" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logDir}/${errorLog}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
diff --git a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java
index cd28ab408..780039978 100644
--- a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java
+++ b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java
@@ -438,7 +438,7 @@ public class AppcLcmOperationTest {
assertEquals("Start", appcRequest.getAction());
assertNotNull(appcRequest.getActionIdentifiers());
assertEquals(event.getAai().get("generic-vnf.vnf-id"), appcRequest.getActionIdentifiers().get("vnf-id"));
- assertEquals(appcRequest.getActionIdentifiers().get("vserver-id"), null);
+ assertNull(appcRequest.getActionIdentifiers().get("vserver-id"));
assertNull(appcRequest.getPayload());
logger.info("vnf start request: {}", Serialization.gson.toJson(request, AppcLcmDmaapWrapper.class));
@@ -498,7 +498,7 @@ public class AppcLcmOperationTest {
assertEquals("Stop", appcRequest.getAction());
assertNotNull(appcRequest.getActionIdentifiers());
assertEquals(event.getAai().get("generic-vnf.vnf-id"), appcRequest.getActionIdentifiers().get("vnf-id"));
- assertEquals(appcRequest.getActionIdentifiers().get("vserver-id"), null);
+ assertNull(appcRequest.getActionIdentifiers().get("vserver-id"));
assertNull(appcRequest.getPayload());
logger.info("vnf stop request: {}", Serialization.gson.toJson(request, AppcLcmDmaapWrapper.class));
@@ -553,7 +553,7 @@ public class AppcLcmOperationTest {
AppcLcmDmaapWrapper restartResponse = Serialization.gson.fromJson(lcmRespJson, AppcLcmDmaapWrapper.class);
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), PolicyResult.SUCCESS);
+ assertEquals(PolicyResult.SUCCESS, operation.getResult());
}
@Test
@@ -568,13 +568,13 @@ public class AppcLcmOperationTest {
/* Send in several partial success messages */
for (int i = 0; i < 5; i++) {
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), null);
+ assertNull(operation.getResult());
}
/* Send in an operation success */
restartResponse.getBody().getOutput().getStatus().setCode(400);
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), PolicyResult.SUCCESS);
+ assertEquals(PolicyResult.SUCCESS, operation.getResult());
}
@Test
@@ -587,7 +587,7 @@ public class AppcLcmOperationTest {
AppcLcmDmaapWrapper restartResponse = Serialization.gson.fromJson(lcmRespJson, AppcLcmDmaapWrapper.class);
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), PolicyResult.FAILURE);
+ assertEquals(PolicyResult.FAILURE, operation.getResult());
}
@Test
@@ -602,7 +602,7 @@ public class AppcLcmOperationTest {
/* Send in ALL failure messages */
for (int i = 0; i < 5; i++) {
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), null);
+ assertNull(operation.getResult());
}
/* Send in an operation failure */
@@ -610,7 +610,7 @@ public class AppcLcmOperationTest {
operation.incomingMessage(restartResponse);
/* Because every VM failed in the VNF, it should be failure result */
- assertEquals(operation.getResult(), PolicyResult.FAILURE);
+ assertEquals(PolicyResult.FAILURE, operation.getResult());
}
@Test
@@ -625,7 +625,7 @@ public class AppcLcmOperationTest {
/* Send in several partial success messages */
for (int i = 0; i < 5; i++) {
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), null);
+ assertNull(operation.getResult());
}
/* Change status to partial failure */
@@ -634,7 +634,7 @@ public class AppcLcmOperationTest {
/* Send in several partial failures messages */
for (int i = 0; i < 5; i++) {
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), null);
+ assertNull(operation.getResult());
}
/* Send in an operation failure */
@@ -645,7 +645,7 @@ public class AppcLcmOperationTest {
* Only a subset of VMs failed in the VNF so the
* result will be failure_exception
*/
- assertEquals(operation.getResult(), PolicyResult.FAILURE_EXCEPTION);
+ assertEquals(PolicyResult.FAILURE_EXCEPTION, operation.getResult());
}
/* ===================================================================== */
@@ -671,7 +671,7 @@ public class AppcLcmOperationTest {
VirtualControlLoopEvent noAaiTag = new VirtualControlLoopEvent();
noAaiTag.setAai(null);
assertFalse(AppcLcmOperation.isAaiValid(transaction, noAaiTag));
- assertEquals(transaction.getNotificationMessage(), "No A&AI Subtag");
+ assertEquals("No A&AI Subtag", transaction.getNotificationMessage());
}
@Test