ONAP
================================================================================
Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 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.
limitations under the License.
============LICENSE_END=========================================================
-->
-<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
+<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="onap.policies.controlloop.operational.common.Drools" equalsBehavior="equality"
packages="org.onap.policy.controlloop">
<ksession name="usecases"/>
manager.start();
if (manager.getSteps().isEmpty()) {
- // no steps implies no policies, thus go straight to DONE state
+ // no steps imply no policies, thus go straight to DONE state
manager.setState(State.DONE);
manager.setAccepted(true);
rule "APPC-LCM.Response.CLEANUP"
salience 1
when
- $msg : org.onap.policy.appclcm.AppcLcmDmaapWrapper( )
+ $msg : org.onap.policy.appclcm.AppcLcmMessageWrapper( )
then
retract($msg);
end
* ONAP
* ================================================================================
* Copyright (C) 2020-2021, 2023 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications 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.
@Test
void testStoreInDataBase() throws ControlLoopException {
+ when(services.getDataManager()).thenReturn(dataMgr);
+ when(workMem.getFactHandle(any())).thenReturn(factHandle);
mgr.start();
var outcome = makeOutcome();
mgr.addToHistory(outcome);
noop.source.topics.appc-cl.events.org.onap.policy.appc.Request.filter=[?($.CommonHeader && $.Action)]
noop.source.topics.appc-cl.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
-noop.source.topics.appc-lcm-write.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-noop.source.topics.appc-lcm-write.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')]
+noop.source.topics.appc-lcm-write.events=org.onap.policy.appclcm.AppcLcmMessageWrapper
+noop.source.topics.appc-lcm-write.events.org.onap.policy.appclcm.AppcLcmMessageWrapper.filter=[?($.type == 'response')]
noop.source.topics.appc-lcm-write.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
noop.source.topics.sdnr-cl-rsp.events=org.onap.policy.sdnr.PciResponseWrapper
noop.source.topics.policy-cl-mgt.events=org.onap.policy.controlloop.VirtualControlLoopNotification
noop.source.topics.policy-cl-mgt.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-noop.source.topics.appc-lcm-read.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
+noop.source.topics.appc-lcm-read.events=org.onap.policy.appclcm.AppcLcmMessageWrapper
noop.source.topics.appc-lcm-read.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
noop.sink.topics=appc-cl,appc-lcm-read,policy-cl-mgt,sdnr-cl,dcae_cl_rsp,a1-p
* guard
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 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.
package org.onap.policy.coordination;
import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+@Setter
+@Getter
public class CoordinationDirective {
private List<String> controlLoop;
private String coordinationFunction;
- public List<String> getControlLoop() {
- return controlLoop;
- }
-
/**
* gets the ith control loop.
*
return controlLoop.get(index);
}
- public void setControlLoop(List<String> controlLoop) {
- this.controlLoop = controlLoop;
- }
-
- public String getCoordinationFunction() {
- return coordinationFunction;
- }
-
- public void setCoordinationFunction(String coordinationFunction) {
- this.coordinationFunction = coordinationFunction;
- }
-
/**
* toString.
*
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 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.
package org.onap.policy.controlloop.drl.legacy;
+import java.io.Serial;
import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class ControlLoopParams implements Serializable {
+ @Serial
private static final long serialVersionUID = 970755684770982776L;
private String closedLoopControlName;
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 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.
package org.onap.policy.controlloop.eventmanager;
+import java.io.Serial;
import java.util.HashMap;
import lombok.AccessLevel;
import lombok.Getter;
* Manager for a single control loop event. Once this has been created, the event can be
* retracted from working memory.
*/
+@Getter
public abstract class ClEventManagerWithEvent<T extends Step> extends ClEventManagerWithOutcome<T>
implements StepContext {
private static final Logger logger = LoggerFactory.getLogger(ClEventManagerWithEvent.class);
+ @Serial
private static final long serialVersionUID = -1216568161322872641L;
public enum NewEventStatus {
FIRST_ONSET, SUBSEQUENT_ONSET, FIRST_ABATEMENT, SUBSEQUENT_ABATEMENT, SYNTAX_ERROR
}
- @Getter
private final VirtualControlLoopEvent event;
- @Getter
@Setter(AccessLevel.PROTECTED)
private VirtualControlLoopEvent abatement = null;
* ONAP
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 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.
package org.onap.policy.controlloop.eventmanager;
+import java.io.Serial;
import java.io.Serializable;
import java.time.Instant;
import java.util.Deque;
public class ControlLoopEventManager implements StepContext, Serializable {
private static final Logger logger = LoggerFactory.getLogger(ControlLoopEventManager.class);
+ @Serial
private static final long serialVersionUID = -1216568161322872641L;
/**
* otherwise. This will be {@code false} if this object is reconstituted from a
* persistent store or by transfer from another server.
*/
- private transient boolean createdByThisJvmInstance;
+ private final transient boolean createdByThisJvmInstance;
private final transient EventManagerServices services;
/**
* Set of properties used while processing the event.
*/
- private Map<String, Serializable> properties = new ConcurrentHashMap<>();
+ private final Map<String, Serializable> properties = new ConcurrentHashMap<>();
/**
* Unprocessed outcomes from the operations. Outcomes are added to this each time the
*/
private long detmControlLoopTimeoutMs() {
// validation checks preclude null or 0 timeout values in the policy
- Integer timeout = processor.getPolicy().getProperties().getTimeout();
+ int timeout = processor.getPolicy().getProperties().getTimeout();
return TimeUnit.MILLISECONDS.convert(timeout, TimeUnit.SECONDS);
}
# ONAP
# ================================================================================
# Copyright (C) 2022 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 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.
# limitations under the License.
# ============LICENSE_END=========================================================
-
-dmaap.source.topics=A1-P-RSP
-dmaap.source.topics.A1-P-RSP.servers=${envd:DMAAP_SERVERS}
-dmaap.source.topics.A1-P-RSP.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.source.topics=a1-p-rsp
-#kafka.source.topics.a1-p-rsp.servers=${envd:DMAAP_SERVERS}
-#kafka.source.topics.a1-p-rsp.https=${envd:DMAAP_HTTPS:true}
+kafka.source.topics=a1-p-rsp
+kafka.source.topics.a1-p-rsp.servers=${envd:KAFKA_SERVERS}
# ONAP
# ================================================================================
# Copyright (C) 2022 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 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.
# limitations under the License.
# ============LICENSE_END=========================================================
-dmaap.sink.topics=A1-P
-
-dmaap.sink.topics.A1-P.servers=${envd:DMAAP_SERVERS}
-dmaap.sink.topics.A1-P.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.sink.topics=a1-p
-
-#kafka.sink.topics.A1-P.servers=${envd:DMAAP_SERVERS}
-#kafka.sink.topics.A1-P.https=${envd:DMAAP_HTTPS:true}
+kafka.sink.topics=a1-p
+kafka.sink.topics.A1-P.servers=${envd:KAFKA_SERVERS}
# ONAP
# ================================================================================
# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 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.
# limitations under the License.
# ============LICENSE_END=========================================================
-
-dmaap.source.topics=APPC-CL
-dmaap.sink.topics=APPC-CL
-
-dmaap.source.topics.APPC-CL.servers=${envd:DMAAP_SERVERS}
-dmaap.source.topics.APPC-CL.https=${envd:DMAAP_HTTPS:true}
-
-dmaap.sink.topics.APPC-CL.servers=${envd:DMAAP_SERVERS}
-dmaap.sink.topics.APPC-CL.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.source.topics=appc-cl
-#kafka.sink.topics=appc-cl
-
-#kafka.source.topics.appc-cl.servers=${envd:DMAAP_SERVERS}
-#kafka.source.topics.appc-cl.https=${envd:DMAAP_HTTPS:true}
-
-#kafka.sink.topics.appc-cl.servers=${envd:DMAAP_SERVERS}
-#kafka.sink.topics.appc-cl.https=${envd:DMAAP_HTTPS:true}
+kafka.source.topics=appc-cl
+kafka.sink.topics=appc-cl
+kafka.source.topics.appc-cl.servers=${envd:KAFKA_SERVERS}
+kafka.sink.topics.appc-cl.servers=${envd:KAFKA_SERVERS}
# ONAP
# ================================================================================
# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 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.
# limitations under the License.
# ============LICENSE_END=========================================================
-
-dmaap.sink.topics=APPC-LCM-READ
-
-dmaap.sink.topics.APPC-LCM-READ.servers=${envd:DMAAP_SERVERS}
-dmaap.sink.topics.APPC-LCM-READ.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.sink.topics=appc-lcm-read
-
-#kafka.sink.topics.appc-lcm-read.servers=${envd:DMAAP_SERVERS}
-#kafka.sink.topics.appc-lcm-read.https=${envd:DMAAP_HTTPS:true}
-
+kafka.sink.topics=appc-lcm-read
+kafka.sink.topics.appc-lcm-read.servers=${envd:KAFKA_SERVERS}
# ONAP
# ================================================================================
# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 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.
# limitations under the License.
# ============LICENSE_END=========================================================
-
-dmaap.source.topics=APPC-LCM-WRITE
-
-dmaap.source.topics.APPC-LCM-WRITE.servers=${envd:DMAAP_SERVERS}
-dmaap.source.topics.APPC-LCM-WRITE.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.source.topics=appc-lcm-write
-
-#kafka.source.topics.appc-lcm-write.servers=${envd:DMAAP_SERVERS}
-#kafka.source.topics.appc-lcm-write.https=${envd:DMAAP_HTTPS:true}
+kafka.source.topics=appc-lcm-write
+kafka.source.topics.appc-lcm-write.servers=${envd:KAFKA_SERVERS}
# ONAP
# ================================================================================
# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
-# Modifications Copyright (C) 2022 Nordix Foundation.
+# Modifications Copyright (C) 2022, 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.
# limitations under the License.
# ============LICENSE_END=========================================================
-dmaap.sink.topics=DCAE_CL_RSP
-
-dmaap.sink.topics.DCAE_CL_RSP.servers=${env:DMAAP_SERVERS}
-dmaap.sink.topics.DCAE_CL_RSP.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.sink.topics=dcae-cl-rsp
-
-#kafka.sink.topics.dcae-cl-rsp.servers=${env:DMAAP_SERVERS}
-#kafka.sink.topics.dcae-cl-rsp.https=${envd:DMAAP_HTTPS:true}
+kafka.sink.topics=dcae-cl-rsp
+kafka.sink.topics.dcae-cl-rsp.servers=${env:KAFKA_SERVERS}
# ONAP
# ================================================================================
# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 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.
# limitations under the License.
# ============LICENSE_END=========================================================
-dmaap.source.topics=DCAE_TOPIC
-
-dmaap.source.topics.DCAE_TOPIC.effectiveTopic=${envd:DCAE_TOPIC}
-dmaap.source.topics.DCAE_TOPIC.servers=${envd:DMAAP_SERVERS}
-dmaap.source.topics.DCAE_TOPIC.consumerGroup=${envd:DCAE_CONSUMER_GROUP}
-dmaap.source.topics.DCAE_TOPIC.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.source.topics=dcae_topic
-
-#kafka.source.topics.dcae_topic.effectiveTopic=${envd:DCAE_TOPIC}
-#kafka.source.topics.dcae_topic.servers=${envd:DMAAP_SERVERS}
-#kafka.source.topics.dcae_topic.consumerGroup=${envd:DCAE_CONSUMER_GROUP}
-#kafka.source.topics.dcae_topic.https=${envd:DMAAP_HTTPS:true}
+kafka.source.topics=dcae_topic
+kafka.source.topics.dcae_topic.effectiveTopic=${envd:DCAE_TOPIC}
+kafka.source.topics.dcae_topic.servers=${envd:KAFKA_SERVERS}
+kafka.source.topics.dcae_topic.consumerGroup=${envd:DCAE_CONSUMER_GROUP}
# ONAP
# ================================================================================
# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 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.
# limitations under the License.
# ============LICENSE_END=========================================================
-dmaap.sink.topics=POLICY-CL-MGT
-dmaap.sink.topics.POLICY-CL-MGT.servers=${envd:DMAAP_SERVERS}
-dmaap.sink.topics.POLICY-CL-MGT.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.sink.topics=policy-cl-mgt
-#kafka.sink.topics.policy-cl-mgt.servers=${envd:DMAAP_SERVERS}
-#kafka.sink.topics.policy-cl-mgt.https=${envd:DMAAP_HTTPS:true}
+kafka.sink.topics=policy-cl-mgt
+kafka.sink.topics.policy-cl-mgt.servers=${envd:KAFKA_SERVERS}
# ONAP
# ================================================================================
# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 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.
# limitations under the License.
# ============LICENSE_END=========================================================
-
-dmaap.source.topics=SDNR-CL-RSP
-dmaap.source.topics.SDNR-CL-RSP.servers=${envd:DMAAP_SERVERS}
-dmaap.source.topics.SDNR-CL-RSP.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.source.topics=sdnr-cl-rsp
-#kafka.source.topics.sdnr-cl-rsp.servers=${envd:DMAAP_SERVERS}
-#kafka.source.topics.sdnr-cl-rsp.https=${envd:DMAAP_HTTPS:true}
+kafka.source.topics=sdnr-cl-rsp
+kafka.source.topics.sdnr-cl-rsp.servers=${envd:KAFKA_SERVERS}
# ONAP
# ================================================================================
# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 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.
# limitations under the License.
# ============LICENSE_END=========================================================
-
-
-dmaap.sink.topics=SDNR-CL
-
-dmaap.sink.topics.SDNR-CL.servers=${envd:DMAAP_SERVERS}
-dmaap.sink.topics.SDNR-CL.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.sink.topics=sdnr-cl
-
-#kafka.sink.topics.sdnr-cl.servers=${envd:DMAAP_SERVERS}
-#kafka.sink.topics.sdnr-cl.https=${envd:DMAAP_HTTPS:true}
-
+kafka.sink.topics=sdnr-cl
+kafka.sink.topics.sdnr-cl.servers=${envd:KAFKA_SERVERS}
ONAP
================================================================================
Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 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.
============LICENSE_END=========================================================
-->
-<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
+<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="kbop">
<ksession name="op"/>
</kbase>
* ONAP
* ================================================================================
* Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications 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.
void testInvalidNotifications() {
var feature = new ControlLoopMetricsFeature();
var notification = new VirtualControlLoopNotification();
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, notification);
this.testCacheDefaults();
var requestId = UUID.randomUUID();
notification.setRequestId(requestId);
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, notification);
assertNull(ControlLoopMetricsManager.getManager().getTransaction(requestId));
this.testCacheDefaults();
}
notification.setRequestId(requestId);
notification.setNotification(ControlLoopNotificationType.ACTIVE);
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, notification);
assertNotNull(ControlLoopMetricsManager.getManager().getTransaction(requestId));
assertTrue(ControlLoopMetricsManager.getManager().getTransaction(requestId).getFrom()
.contains(testController.getName()));
@Test
void testReset() {
var notification = this.generateNotification();
- new ControlLoopMetricsFeature().beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT,
+ new ControlLoopMetricsFeature().beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT,
notification);
assertNotNull(ControlLoopMetricsManager.getManager().getTransaction(notification.getRequestId()));
var feature = new ControlLoopMetricsFeature();
for (int i = 0; i < ControlLoopMetricsManager.getManager().getCacheSize(); i++) {
var notification = generateNotification();
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, notification);
assertNotNull(ControlLoopMetricsManager.getManager().getTransaction(notification.getRequestId()));
}
ControlLoopMetricsManager.getManager().getCacheOccupancy());
var overflowNotification = generateNotification();
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, overflowNotification);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, overflowNotification);
assertEquals(ControlLoopMetricsManager.getManager().getCacheOccupancy(),
ControlLoopMetricsManager.getManager().getCacheOccupancy());
assertNotNull(ControlLoopMetricsManager.getManager().getTransaction(overflowNotification.getRequestId()));
var activeNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-active.json");
var active =
Serialization.gsonPretty.fromJson(activeNotification, VirtualControlLoopNotification.class);
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, active);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, active);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
var opStartNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-operation.json");
var opStart =
Serialization.gsonPretty.fromJson(opStartNotification, VirtualControlLoopNotification.class);
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, opStart);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, opStart);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
var permitNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-permit.json");
var permit =
Serialization.gsonPretty.fromJson(permitNotification, VirtualControlLoopNotification.class);
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, permit);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, permit);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
var restartNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-restart.json");
var restart =
Serialization.gsonPretty.fromJson(restartNotification, VirtualControlLoopNotification.class);
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, restart);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, restart);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
var restartSuccessNotification =
ResourceUtils.getResourceAsString("policy-cl-mgt-restart-success.json");
var restartSuccess =
Serialization.gsonPretty.fromJson(restartSuccessNotification, VirtualControlLoopNotification.class);
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, restartSuccess);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, restartSuccess);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
var finalSuccessNotification =
ResourceUtils.getResourceAsString("policy-cl-mgt-final-success.json");
var finalSuccess =
Serialization.gsonPretty.fromJson(finalSuccessNotification, VirtualControlLoopNotification.class);
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, finalSuccess);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, finalSuccess);
assertEquals(0, ControlLoopMetricsManager.getManager().getTransactionIds().size());
assertEquals(1,
PolicyEngineConstants.getManager().getStats().getGroupStat().getPolicyExecutedSuccessCount());
var finalSuccess =
Serialization.gsonPretty.fromJson(finalSuccessNotification, VirtualControlLoopNotification.class);
finalSuccess.setRequestId(UUID.randomUUID());
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, finalSuccess);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, finalSuccess);
assertEquals(0, ControlLoopMetricsManager.getManager().getTransactionIds().size());
var opStartNotification =
ResourceUtils.getResourceAsString("policy-cl-mgt-operation.json");
var opStart =
Serialization.gsonPretty.fromJson(opStartNotification, VirtualControlLoopNotification.class);
- feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, opStart);
+ feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, opStart);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
Thread.sleep((ControlLoopMetricsManager.getManager().getTransactionTimeout() + 1) * 1000L); // NOSONAR
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications 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.
var activeNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-active.json");
var active =
Serialization.gsonPretty.fromJson(activeNotification, VirtualControlLoopNotification.class);
- feature.beforeDeliver(testController, Topic.CommInfrastructure.DMAAP, "POLICY-CL-MGT", active);
+ feature.beforeDeliver(testController, Topic.CommInfrastructure.NOOP, "POLICY-CL-MGT", active);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
assertFalse(HttpClient.getBody(get("/inprogress", Response.Status.OK.getStatusCode()),
# ONAP
# ================================================================================
# Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 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.
controller.name=usecases
-dmaap.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP
-dmaap.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL,DCAE_CL_RSP
+kafka.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP
+kafka.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL,DCAE_CL_RSP
-dmaap.source.topics.DCAE_TOPIC.events=\
+kafka.source.topics.DCAE_TOPIC.events=\
org.onap.policy.controlloop.CanonicalOnset,org.onap.policy.controlloop.CanonicalAbated
-dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalOnset.\
+kafka.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalOnset.\
filter=[?($.closedLoopEventStatus == 'ONSET')]
-dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalAbated.\
+kafka.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalAbated.\
filter=[?($.closedLoopEventStatus == 'ABATED')]
-dmaap.source.topics.DCAE_TOPIC.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gson
+kafka.source.topics.DCAE_TOPIC.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gson
-dmaap.source.topics.APPC-CL.events=org.onap.policy.appc.Response
-dmaap.source.topics.APPC-CL.events.org.onap.policy.appc.Response.filter=[?($.CommonHeader && $.Status)]
-dmaap.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
+kafka.source.topics.APPC-CL.events=org.onap.policy.appc.Response
+kafka.source.topics.APPC-CL.events.org.onap.policy.appc.Response.filter=[?($.CommonHeader && $.Status)]
+kafka.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
-dmaap.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')]
-dmaap.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
+kafka.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmMessageWrapper
+kafka.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmMessageWrapper.filter=[?($.type == 'response')]
+kafka.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-dmaap.sink.topics.APPC-CL.events=org.onap.policy.appc.Request
-dmaap.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
+kafka.sink.topics.APPC-CL.events=org.onap.policy.appc.Request
+kafka.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
-dmaap.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-dmaap.sink.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
+kafka.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmMessageWrapper
+kafka.sink.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-dmaap.sink.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification
-dmaap.sink.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
+kafka.sink.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification
+kafka.sink.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-dmaap.sink.topics.SDNR-CL.events=org.onap.policy.sdnr.PciRequestWrapper
-dmaap.sink.topics.SDNR-CL.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
+kafka.sink.topics.SDNR-CL.events=org.onap.policy.sdnr.PciRequestWrapper
+kafka.sink.topics.SDNR-CL.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
-dmaap.sink.topics.DCAE_CL_RSP.events=org.onap.policy.controlloop.ControlLoopResponse
-dmaap.sink.topics.DCAE_CL_RSP.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
+kafka.sink.topics.DCAE_CL_RSP.events=org.onap.policy.controlloop.ControlLoopResponse
+kafka.sink.topics.DCAE_CL_RSP.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-dmaap.source.topics.SDNR-CL-RSP.events=org.onap.policy.sdnr.PciResponseWrapper
-dmaap.source.topics.SDNR-CL-RSP.events.org.onap.policy.sdnr.PciResponseWrapper.filter=[?($.type == 'response')]
-dmaap.source.topics.SDNR-CL-RSP.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
+kafka.source.topics.SDNR-CL-RSP.events=org.onap.policy.sdnr.PciResponseWrapper
+kafka.source.topics.SDNR-CL-RSP.events.org.onap.policy.sdnr.PciResponseWrapper.filter=[?($.type == 'response')]
+kafka.source.topics.SDNR-CL-RSP.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
rules.groupId=${project.groupId}
rules.artifactId=controller-usecases
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.onap.policy.appc.Request;
-import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
+import org.onap.policy.appclcm.AppcLcmMessageWrapper;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
// used to wait for messages on SINK topics
protected Listener<VirtualControlLoopNotification> policyClMgt;
protected Listener<Request> appcClSink;
- protected Listener<AppcLcmDmaapWrapper> appcLcmRead;
+ protected Listener<AppcLcmMessageWrapper> appcLcmRead;
protected Listener<PciMessage> sdnrClSink;
/*
//TODO This test needs to be enabled in java-17 branch
public void testService123Compliant() {
policyClMgt = createNoficationTopicListener();
- appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmDmaapWrapper.class, APPC_LCM_CODER);
+ appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmMessageWrapper.class, APPC_LCM_CODER);
policy = checkPolicy(SERVICE123_TOSCA_COMPLIANT_POLICY);
// inject an ONSET event over the DCAE topic
// restart request should be sent and fail four times (i.e., because retry=3)
for (var count = 0; count < 4; ++count) {
- AppcLcmDmaapWrapper appcreq = appcLcmRead.await(req -> APPC_RESTART_OP.equals(req.getRpcName()));
+ AppcLcmMessageWrapper appcreq = appcLcmRead.await(req -> APPC_RESTART_OP.equals(req.getRpcName()));
topics.inject(APPC_LCM_WRITE_TOPIC, SERVICE123_APPC_RESTART_FAILURE,
appcreq.getBody().getInput().getCommonHeader().getSubRequestId());
}
// rebuild request should be sent and fail once
- AppcLcmDmaapWrapper appcreq = appcLcmRead.await(req -> "rebuild".equals(req.getRpcName()));
+ AppcLcmMessageWrapper appcreq = appcLcmRead.await(req -> "rebuild".equals(req.getRpcName()));
topics.inject(APPC_LCM_WRITE_TOPIC, SERVICE123_APPC_REBUILD_FAILURE,
appcreq.getBody().getInput().getCommonHeader().getSubRequestId());
// migrate request should be sent and succeed
//TODO This test needs to be enabled in java-17 branch
public void testDuplicatesEvents() {
policyClMgt = createNoficationTopicListener();
- appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmDmaapWrapper.class, APPC_LCM_CODER);
+ appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmMessageWrapper.class, APPC_LCM_CODER);
policy = checkPolicy(DUPLICATES_TOSCA_COMPLIANT_POLICY);
// should see two restarts
for (var count = 0; count < 2; ++count) {
- AppcLcmDmaapWrapper appcreq = appcLcmRead.await(req -> APPC_RESTART_OP.equals(req.getRpcName()));
+ AppcLcmMessageWrapper appcreq = appcLcmRead.await(req -> APPC_RESTART_OP.equals(req.getRpcName()));
// indicate success
topics.inject(APPC_LCM_WRITE_TOPIC, DUPLICATES_APPC_SUCCESS,
*/
protected void appcLcmSunnyDay(String policyFile, List<String> onsetFiles, String operation) {
policyClMgt = createNoficationTopicListener();
- appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmDmaapWrapper.class, APPC_LCM_CODER);
+ appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmMessageWrapper.class, APPC_LCM_CODER);
policy = checkPolicy(policyFile);
/*
* Ensure that an APPC RESTART request was sent in response to the matching ONSET
*/
- AppcLcmDmaapWrapper appcreq = appcLcmRead.await(req -> operation.equals(req.getRpcName()));
+ AppcLcmMessageWrapper appcreq = appcLcmRead.await(req -> operation.equals(req.getRpcName()));
/*
* Inject a 400 APPC Response Return over the APPC topic, with appropriate
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 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.
package org.onap.policy.controlloop.common.rules.test;
+import java.io.Serial;
+
/**
* Exception thrown by <i>Simulators</i>.
*/
public class SimulatorException extends RuntimeException {
+ @Serial
private static final long serialVersionUID = 1L;
public SimulatorException() {
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 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.
}
/**
- * Stops all of the simulators.
+ * Stops all the simulators.
*/
public void destroy() {
for (HttpServletServer server : servers) {
}
@FunctionalInterface
- public static interface SimulatorBuilder {
- public HttpServletServer build() throws InterruptedException;
+ public interface SimulatorBuilder {
+ HttpServletServer build() throws InterruptedException;
}
}
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021,2023 Nordix Foundation.
+ * Modifications Copyright (C) 2021, 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 org.onap.policy.appc.Request;
import org.onap.policy.appclcm.AppcLcmBody;
import org.onap.policy.appclcm.AppcLcmCommonHeader;
-import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.appclcm.AppcLcmInput;
+import org.onap.policy.appclcm.AppcLcmMessageWrapper;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.coder.StandardCoderInstantAsMillis;
import org.onap.policy.controlloop.ControlLoopNotificationType;
private BaseTest base;
private LinkedList<VirtualControlLoopNotification> clMgtQueue;
- private Queue<AppcLcmDmaapWrapper> appcLcmQueue;
+ private Queue<AppcLcmMessageWrapper> appcLcmQueue;
private Queue<Request> appcLegacyQueue;
private Queue<PciMessage> sdnrQueue;
private int permitCount;
private final Topics topics = mock(Topics.class);
private final Listener<VirtualControlLoopNotification> policyClMgt = mock();
private final Listener<Request> appcClSink = mock();
- private final Listener<AppcLcmDmaapWrapper> appcLcmRead = mock();
+ private final Listener<AppcLcmMessageWrapper> appcLcmRead = mock();
private final Listener<PciMessage> sdnrClSink = mock();
private final DroolsController drools = mock(DroolsController.class);
private final ToscaPolicy policy = mock(ToscaPolicy.class);
public void setUp() {
when(topics.createListener(eq(BaseTest.POLICY_CL_MGT_TOPIC), eq(VirtualControlLoopNotification.class),
any(StandardCoder.class))).thenReturn(policyClMgt);
- when(topics.createListener(eq(BaseTest.APPC_LCM_READ_TOPIC), eq(AppcLcmDmaapWrapper.class),
+ when(topics.createListener(eq(BaseTest.APPC_LCM_READ_TOPIC), eq(AppcLcmMessageWrapper.class),
any(StandardCoder.class))).thenReturn(appcLcmRead);
when(topics.createListener(eq(BaseTest.APPC_CL_TOPIC), eq(Request.class),
any(StandardCoderInstantAsMillis.class))).thenReturn(appcClSink);
});
when(appcLcmRead.await(any())).thenAnswer(args -> {
- AppcLcmDmaapWrapper req = appcLcmQueue.remove();
- Predicate<AppcLcmDmaapWrapper> pred = args.getArgument(0);
+ AppcLcmMessageWrapper req = appcLcmQueue.remove();
+ Predicate<AppcLcmMessageWrapper> pred = args.getArgument(0);
assertTrue(pred.test(req));
return req;
});
private void enqueueAppcLcm(String... operationNames) {
for (var oper : operationNames) {
- var req = new AppcLcmDmaapWrapper();
+ var req = new AppcLcmMessageWrapper();
req.setRpcName(oper);
var body = new AppcLcmBody();
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021,2023 Nordix Foundation.
+ * Modifications Copyright (C) 2021, 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 org.junit.jupiter.api.Test;
import org.onap.policy.appclcm.AppcLcmBody;
import org.onap.policy.appclcm.AppcLcmCommonHeader;
-import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.appclcm.AppcLcmInput;
+import org.onap.policy.appclcm.AppcLcmMessageWrapper;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.controlloop.ControlLoopNotificationType;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
private DroolsRuleTest base;
private LinkedList<VirtualControlLoopNotification> clMgtQueue;
- private Queue<AppcLcmDmaapWrapper> appcLcmQueue;
+ private Queue<AppcLcmMessageWrapper> appcLcmQueue;
private int permitCount;
private int finalCount;
private final Simulators simulators = mock(Simulators.class);
private final Topics topics = mock(Topics.class);
private final Listener<VirtualControlLoopNotification> policyClMgt = mock();
- private final Listener<AppcLcmDmaapWrapper> appcLcmRead = mock();
+ private final Listener<AppcLcmMessageWrapper> appcLcmRead = mock();
private final DroolsController drools = mock(DroolsController.class);
private final ToscaPolicy policy = mock(ToscaPolicy.class);
when(topics.createListener(DroolsRuleTest.POLICY_CL_MGT_TOPIC,
VirtualControlLoopNotification.class, controller)).thenReturn(policyClMgt);
- when(topics.createListener(eq(DroolsRuleTest.APPC_LCM_READ_TOPIC), eq(AppcLcmDmaapWrapper.class),
+ when(topics.createListener(eq(DroolsRuleTest.APPC_LCM_READ_TOPIC), eq(AppcLcmMessageWrapper.class),
any(StandardCoder.class))).thenReturn(appcLcmRead);
Function<String, Rules> ruleMaker = this::makeRules;
});
when(appcLcmRead.await(any())).thenAnswer(args -> {
- AppcLcmDmaapWrapper req = appcLcmQueue.remove();
- Predicate<AppcLcmDmaapWrapper> pred = args.getArgument(0);
+ AppcLcmMessageWrapper req = appcLcmQueue.remove();
+ Predicate<AppcLcmMessageWrapper> pred = args.getArgument(0);
assertTrue(pred.test(req));
return req;
});
private void enqueueAppcLcm(String... operationNames) {
for (String oper : operationNames) {
- AppcLcmDmaapWrapper req = new AppcLcmDmaapWrapper();
+ AppcLcmMessageWrapper req = new AppcLcmMessageWrapper();
req.setRpcName(oper);
AppcLcmBody body = new AppcLcmBody();
ONAP
================================================================================
Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 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.
limitations under the License.
============LICENSE_END=========================================================
-->
-<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
+<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="onap.policies.controlloop.operational.common.Drools" equalsBehavior="equality"
packages="org.onap.policy.controlloop">
<ksession name="rulesTest"/>
drools-pdp-apps
================================================================================
Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019,2023 Nordix Foundation.
+ Modifications Copyright (C) 2019, 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.
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>