* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2022 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.
notification.setNotification(ControlLoopNotificationType.REJECTED);
notification.setFrom("policy");
notification.setMessage("Missing requestId");
- notification.setPolicyName($params.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($params.getPolicyName());
notification.setPolicyVersion($params.getPolicyVersion());
} else {
notification = manager.makeNotification();
notification.setNotification(ControlLoopNotificationType.ACTIVE);
- notification.setPolicyName($params.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($params.getPolicyName());
+ notification.setPolicyVersion($params.getPolicyVersion());
} else {
// Note: the notification will be generated lazily
notification = new VirtualControlLoopNotification($event);
notification.setNotification(ControlLoopNotificationType.REJECTED);
notification.setMessage("Exception occurred: " + e.getMessage());
- notification.setPolicyName($params.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($params.getPolicyName());
notification.setPolicyVersion($params.getPolicyVersion());
}
//
VirtualControlLoopNotification notification = $manager.makeNotification();
notification.setNotification(ControlLoopNotificationType.ACTIVE);
- notification.setPolicyName($manager.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($manager.getPolicyName());
+ notification.setPolicyVersion($manager.getPolicyVersion());
$manager.deliver("POLICY-CL-MGT", notification, "notification", drools.getRule().getName());
} catch(RuntimeException e) {
try {
VirtualControlLoopNotification notification = $manager.makeNotification();
notification.setNotification(ControlLoopNotificationType.OPERATION);
- notification.setPolicyName($manager.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($manager.getPolicyName());
+ notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory(Collections.emptyList());
// get actor/operation name from the policy step, not from the guard step
VirtualControlLoopNotification notification = $manager.makeNotification();
notification.setNotification(ControlLoopNotificationType.OPERATION);
- notification.setPolicyName($manager.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($manager.getPolicyName());
+ notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory(Collections.emptyList());
notification.setMessage($manager.getOperationMessage());
VirtualControlLoopNotification notification = $manager.makeNotification();
notification.setNotification(ControlLoopNotificationType.OPERATION_SUCCESS);
- notification.setPolicyName($manager.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($manager.getPolicyName());
+ notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory($manager.getPartialHistory().stream().map(OperationOutcome2::getClOperation)
.collect(Collectors.toList()));
VirtualControlLoopNotification notification = $manager.makeNotification();
notification.setNotification(ControlLoopNotificationType.OPERATION_FAILURE);
- notification.setPolicyName($manager.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($manager.getPolicyName());
+ notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory($manager.getPartialHistory().stream().map(OperationOutcome2::getClOperation)
.collect(Collectors.toList()));
VirtualControlLoopNotification notification = $manager.makeNotification();
notification.setNotification(ControlLoopNotificationType.REJECTED);
- notification.setPolicyName($manager.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($manager.getPolicyName());
+ notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory($manager.getPartialHistory().stream().map(OperationOutcome2::getClOperation)
.collect(Collectors.toList()));
VirtualControlLoopNotification notification = $manager.makeNotification();
notification.setNotification(ControlLoopNotificationType.OPERATION_FAILURE);
- notification.setPolicyName($manager.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($manager.getPolicyName());
+ notification.setPolicyVersion($manager.getPolicyVersion());
$manager.deliver("POLICY-CL-MGT", notification, "notification", drools.getRule().getName());
try {
VirtualControlLoopNotification notification = $manager.makeNotification();
- notification.setPolicyName($manager.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope(drools.getRule().getName());
+ notification.setPolicyName($manager.getPolicyName());
+ notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory($manager.getFullHistory().stream().map(OperationOutcome2::getClOperation)
.collect(Collectors.toList()));
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2022 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.
String policyName = policy.getIdentifier().getName();
policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.ACTIVE
- && (policyName + ".EVENT.MANAGER.ACCEPT").equals(notif.getPolicyName()));
+ && "EVENT.MANAGER.ACCEPT".equals(notif.getPolicyScope())
+ && policyName.equals(notif.getPolicyName()));
policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.OPERATION
- && (policyName + ".EVENT.MANAGER.PROCESS.GUARD.OUTCOME").equals(notif.getPolicyName())
+ && "EVENT.MANAGER.PROCESS.GUARD.OUTCOME".equals(notif.getPolicyScope())
+ && policyName.equals(notif.getPolicyName())
&& notif.getMessage().startsWith("Sending guard query"));
policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.OPERATION
- && (policyName + ".EVENT.MANAGER.PROCESS.GUARD.OUTCOME").equals(notif.getPolicyName())
- && notif.getMessage().startsWith("Guard result") && notif.getMessage().endsWith("Permit"));
+ && "EVENT.MANAGER.PROCESS.GUARD.OUTCOME".equals(notif.getPolicyScope())
+ && policyName.equals(notif.getPolicyName())
+ && notif.getMessage().startsWith("Guard result")
+ && notif.getMessage().endsWith("Permit"));
policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.OPERATION
- && (policyName + ".EVENT.MANAGER.PROCESS.POLICY.STARTED").equals(notif.getPolicyName())
+ && "EVENT.MANAGER.PROCESS.POLICY.STARTED".equals(notif.getPolicyScope())
+ && policyName.equals(notif.getPolicyName())
&& notif.getMessage().startsWith("actor="));
}
Listener<VirtualControlLoopNotification> policyClMgt, ControlLoopNotificationType finalType) {
return policyClMgt.await(notif -> notif.getNotification() == finalType
- && (policy.getIdentifier().getName() + ".EVENT.MANAGER.FINAL").equals(notif.getPolicyName()));
+ && "EVENT.MANAGER.FINAL".equals(notif.getPolicyScope())
+ && (policy.getIdentifier().getName()).equals(notif.getPolicyName()));
}
@Override
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2022 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.
protected void evicted(VirtualControlLoopNotification notification) {
MdcTransaction
.newTransaction(notification.getRequestId().toString(), notification.getFrom())
- .setServiceName(notification.getClosedLoopControlName()).setTargetEntity(notification.getTarget())
- .setStartTime(notification.getNotificationTime().toInstant()).setEndTime(Instant.now())
- .setResponseDescription("EVICTED").setStatusCode(false).metric().resetTransaction();
+ .setServiceName(notification.getClosedLoopControlName())
+ .setServiceInstanceId(notification.getPolicyName() + ":" + notification.getPolicyVersion())
+ .setProcessKey("" + notification.getAai())
+ .setTargetEntity(notification.getTargetType() + "." + notification.getTarget())
+ .setResponseCode(UNKNOWN_RESPONSE_CODE)
+ .setStartTime(notification.getNotificationTime().toInstant())
+ .setEndTime(Instant.now())
+ .setResponseDescription("EVICTED")
+ .setStatusCode(false)
+ .setCustomField1((notification.getNotification() != null)
+ ? notification.getNotification().name() : "")
+ .setCustomField2(notification.getPolicyScope())
+ .setClientIpAddress(notification.getClosedLoopEventClient())
+ .metric()
+ .resetTransaction();
+
}
@Override
return MdcTransaction
.newTransaction(notification.getRequestId().toString(), notification.getFrom())
.setServiceName(notification.getClosedLoopControlName())
- .setServiceInstanceId(notification.getPolicyScope()
- + ":" + notification.getPolicyName() + ":" + notification.getPolicyVersion())
+ .setServiceInstanceId(notification.getPolicyName() + ":" + notification.getPolicyVersion())
.setProcessKey("" + notification.getAai())
.setTargetEntity(notification.getTargetType() + "." + notification.getTarget())
.setResponseCode((notification.getNotification() != null)
: UNKNOWN_RESPONSE_CODE)
.setCustomField1((notification.getNotification() != null)
? notification.getNotification().name() : "")
+ .setCustomField2(notification.getPolicyScope())
.setResponseDescription(notification.getMessage())
.setClientIpAddress(notification.getClosedLoopEventClient());
}