with current DRL rules files syntax.
Issue-ID: POLICY-4857
Change-Id: I40889288828da9aea757087e2c74004008336e41
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
* 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.
throw new IllegalArgumentException("The target type is null");
}
- return switch (targetType) {
- case PNF -> detmPnfTarget();
- case VM, VNF, VFMODULE -> detmVfModuleTarget();
- default -> throw new IllegalArgumentException("The target type is not supported");
- };
+ switch (targetType) {
+ case PNF:
+ return detmPnfTarget();
+ case VM:
+ case VNF:
+ case VFMODULE:
+ return detmVfModuleTarget();
+ default:
+ throw new IllegalArgumentException("The target type is not supported");
+ }
}
/**
import static org.onap.policy.drools.apps.controller.usecases.UsecasesConstants.VSERVER_PROV_STATUS;
import static org.onap.policy.drools.apps.controller.usecases.UsecasesConstants.VSERVER_VSERVER_NAME;
-import java.io.Serial;
import java.util.Deque;
import java.util.Map;
import java.util.Set;
*/
public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> implements StepContext {
- @Serial
private static final long serialVersionUID = -1216568161322872641L;
/**
throw new ControlLoopException("The Target type is null");
}
switch (event.getTargetType()) {
- case VM, VNF:
+ case VM:
+ case VNF:
validateAaiVmVnfData(eventAai);
return;
case PNF:
notification.setPolicyName($manager.getPolicyName());
notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory($manager.getPartialHistory().stream().map(OperationOutcome2::getClOperation)
- .toList());
+ .collect(Collectors.toList()));
// trigger move to the next policy - clear all steps
$manager.getSteps().clear();
notification.setPolicyName($manager.getPolicyName());
notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory($manager.getPartialHistory().stream().map(OperationOutcome2::getClOperation)
- .toList());
+ .collect(Collectors.toList()));
$manager.deliver("policy-cl-mgt", notification, "notification", drools.getRule().getName());
notification.setPolicyName($manager.getPolicyName());
notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory($manager.getFullHistory().stream().map(OperationOutcome2::getClOperation)
- .toList());
+ .collect(Collectors.toList()));
OperationFinalResult finalResult = $manager.getFinalResult();
if (finalResult == null) {
eventmanager
================================================================================
Copyright (C) 2017-2022 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019,2023 Nordix Foundation.
+ Modifications Copyright (C) 2019, 2023-2024 Nordix Foundation.
Modifications Copyright (C) 2019-2020 Bell Canada.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
<version>${policy.models.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
+ <groupId>org.apache.httpcomponents.client5</groupId>
+ <artifactId>httpclient5</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
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;
package org.onap.policy.controlloop.eventmanager;
-import java.io.Serial;
import java.util.HashMap;
import lombok.AccessLevel;
import lombok.Getter;
implements StepContext {
private static final Logger logger = LoggerFactory.getLogger(ClEventManagerWithEvent.class);
- @Serial
private static final long serialVersionUID = -1216568161322872641L;
public enum NewEventStatus {
* ONAP
* ================================================================================
* Copyright (C) 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.
package org.onap.policy.controlloop.eventmanager;
-import java.io.Serial;
import java.util.Deque;
import java.util.LinkedList;
import java.util.UUID;
public abstract class ClEventManagerWithOutcome<T extends Step> extends ClEventManagerWithSteps<T>
implements StepContext {
- @Serial
private static final long serialVersionUID = -1216568161322872641L;
/**
* ONAP
* ================================================================================
* Copyright (C) 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.
package org.onap.policy.controlloop.eventmanager;
-import java.io.Serial;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.LinkedHashMap;
public abstract class ClEventManagerWithSteps<T extends Step> extends ControlLoopEventManager implements StepContext {
private static final Logger logger = LoggerFactory.getLogger(ClEventManagerWithSteps.class);
- @Serial
private static final long serialVersionUID = -1216568161322872641L;
/**
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;
/**
* ONAP
* ================================================================================
* Copyright (C) 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.
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import java.io.Serial;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
private class MyManager extends ClEventManagerWithSteps<MyStep> {
- @Serial
private static final long serialVersionUID = 1L;
public MyManager(EventManagerServices services, ControlLoopParams params, UUID requestId, WorkingMemory workMem)
private static class RealManager extends ClEventManagerWithSteps<MyStep> {
- @Serial
private static final long serialVersionUID = 1L;
public RealManager(EventManagerServices services, ControlLoopParams params, UUID requestId,
* ONAP
* ================================================================================
* Copyright (C) 2019-2022 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.
setNotificationValues(controller, notification);
switch (notification.getNotification()) {
- case REJECTED, FINAL_FAILURE, FINAL_SUCCESS, FINAL_OPENLOOP:
+ case REJECTED:
+ case FINAL_FAILURE:
+ case FINAL_SUCCESS:
+ case FINAL_OPENLOOP:
endTransaction(controller, notification);
break;
- case ACTIVE, OPERATION, OPERATION_SUCCESS, OPERATION_FAILURE:
+ case ACTIVE:
+ case OPERATION:
+ case OPERATION_SUCCESS:
+ case OPERATION_FAILURE:
/* any other value is an in progress transaction */
inProgressTransaction(notification);
break;
.setEndTime(notification.getNotificationTime().toInstant());
switch (notification.getNotification()) {
- case FINAL_OPENLOOP,
+ case FINAL_OPENLOOP:
/* fall through */
- FINAL_SUCCESS:
+ case FINAL_SUCCESS:
trans.setStatusCode(true);
break;
- case FINAL_FAILURE,
+ case FINAL_FAILURE:
/* fall through */
- REJECTED:
+ case REJECTED:
trans.setStatusCode(false);
break;
default:
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.AccessLevel;
import lombok.Getter;
/**
* Service123 with Tosca Compliant Policy.
*/
- //TODO This test needs to be enabled in java-17 branch
+ @Test
public void testService123Compliant() {
policyClMgt = createNoficationTopicListener();
appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmMessageWrapper.class, APPC_LCM_CODER);
* to obtain a lock since it is a different target. After processing of all events
* there should only be the policy and params objects left in memory.
*/
- //TODO This test needs to be enabled in java-17 branch
+ @Test
public void testDuplicatesEvents() {
policyClMgt = createNoficationTopicListener();
appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmMessageWrapper.class, APPC_LCM_CODER);
// get the list of target names, so we can ensure there's one of each
List<String> actual = Stream.of(notif1, notif2).map(notif -> notif.getAai().get("generic-vnf.vnf-id"))
- .sorted().toList();
+ .sorted().collect(Collectors.toList());
assertEquals(List.of("duplicate-VNF", "vCPE_Infrastructure_vGMUX_demo_app").toString(), actual.toString());
/**
* Sunny Day with Tosca Compliant Policy.
*/
- //TODO This test needs to be enabled in java-17 branch
+ @Test
public void testVcpeSunnyDayCompliant() {
appcLcmSunnyDay(VCPE_TOSCA_COMPLIANT_POLICY, VCPE_ONSET_1, APPC_RESTART_OP);
}
* simulate the flooding behavior of the DCAE TCA microservice. TCA could blast tens
* or hundreds of ONSETs within sub-second intervals.
*/
- //TODO This test needs to be enabled in java-17 branch
+ @Test
public void testVcpeOnsetFloodPrevention() {
appcLcmSunnyDay(VCPE_TOSCA_COMPLIANT_POLICY, List.of(VCPE_ONSET_1, VCPE_ONSET_2, VCPE_ONSET_3),
APPC_RESTART_OP);
/**
* Sunny Day with Tosca Compliant Policy.
*/
- //TODO This test needs to be enabled in java-17 branch
+ @Test
public void testVdnsSunnyDayCompliant() {
httpSunnyDay(VDNS_TOSCA_COMPLIANT_POLICY, VDNS_ONSET);
}
/**
* VFW Sunny Day with Tosca Compliant Policy.
*/
- //TODO This test needs to be enabled in java-17 branch
+ @Test
public void testVfwSunnyDayCompliant() {
appcLegacySunnyDay(VFW_TOSCA_COMPLIANT_POLICY, VFW_ONSET, APPC_MODIFY_CONFIG_OP);
}
/**
* VPCI Sunny Day Tosca Policy.
*/
- //TODO This test needs to be enabled in java-17 branch
+ @Test
public void testVpciSunnyDayCompliant() {
sdnrSunnyDay(VPCI_TOSCA_COMPLIANT_POLICY, VPCI_ONSET, VPCI_SDNR_SUCCESS,
SDNR_MODIFY_CONFIG_OP, SDNR_CL_TOPIC, SDNR_CL_RSP_TOPIC);
/**
* VSONH Sunny Day with Tosca Policy.
*/
- //TODO This test needs to be enabled in java-17 branch
+ @Test
public void testVsonhSunnyDayCompliant() {
sdnrSunnyDay(VSONH_TOSCA_COMPLIANT_POLICY, VSONH_ONSET, VSONH_SDNR_SUCCESS,
SNDR_MODIFY_CONFIG_ANR_OP, SDNR_CL_TOPIC, SDNR_CL_RSP_TOPIC);
/**
* Sunny day 5G SON 01 Modify01Config Operational Policy.
*/
- //TODO This test needs to be enabled in java-17 branch
+ @Test
public void test5gSonO1SunnyDayCompliant() {
sdnrSunnyDay(V5G_SON_O1_TOSCA_POLICY, V5G_SON_O1_ONSET, V5G_SON_O1_SDNR_SUCCESS,
MODIFY_O1_CONFIG_OPERATION, SDNR_CL_TOPIC, SDNR_CL_RSP_TOPIC);
/**
* Sunny day 5G SON A1 ModifyA1Policy Operational Policy.
*/
- //TODO This test needs to be enabled in java-17 branch
+ @Test
public void test5gSonA1SunnyDayCompliant() {
sdnrSunnyDay(V5G_SON_A1_TOSCA_POLICY, V5G_SON_A1_ONSET, V5G_SON_A1_SDNR_SUCCESS,
PUT_A1_POLICY_OPERATION, A1P_CL_TOPIC, A1P_CL_RSP_TOPIC);
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() {
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
- <release>${java.version}</release>
+ <release>11</release>
</configuration>
</plugin>
<plugin>