summaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/controller-frankfurt/pom.xml5
-rw-r--r--controlloop/common/controller-frankfurt/src/test/resources/config/event-manager.properties13
-rw-r--r--controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-controller.properties13
-rw-r--r--controlloop/common/controller-usecases/src/test/resources/config/controlloop.properties.environment4
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java23
-rw-r--r--controlloop/common/eventmanager/src/test/resources/eventService/event-svc-guard-disabled.properties3
-rw-r--r--controlloop/common/eventmanager/src/test/resources/eventService/event-svc-invalid-db.properties3
-rw-r--r--controlloop/common/eventmanager/src/test/resources/eventService/event-svc-with-db.properties3
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/feature/config/event-manager.properties12
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java6
10 files changed, 66 insertions, 19 deletions
diff --git a/controlloop/common/controller-frankfurt/pom.xml b/controlloop/common/controller-frankfurt/pom.xml
index 39511705c..078235d07 100644
--- a/controlloop/common/controller-frankfurt/pom.xml
+++ b/controlloop/common/controller-frankfurt/pom.xml
@@ -195,6 +195,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<profiles>
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 7416d0480..9244fd2ed 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
@@ -29,8 +29,11 @@ operation.history.password=
# configured and started. Thus some of them have a "placeholder" property.
#
-actor.service.GUARD.disabled=true
+#actor.service.GUARD.disabled=true
actor.service.GUARD.clientName=GUARD
+actor.service.GUARD.onapName=my-onap-name
+actor.service.GUARD.onapComponent=my-onap-component
+actor.service.GUARD.onapInstance=my-onap-instance
actor.service.GUARD.operations.Decision.path=decision
actor.service.AAI.clientName=AAI
@@ -57,7 +60,13 @@ actor.service.CDS.grpcTimeout=10
actor.service.CDS.operations.xxx.yyy=
actor.service.SDNC.clientName=SDNC
-actor.service.SDNC.operations.xxx.yyy=
+actor.service.SDNC.path=/
+actor.service.SDNC.operations.BandwidthOnDemand.placeholder=
+actor.service.SDNC.operations.Reroute.placeholder=
+
+actor.service.SDNR.sinkTopic=SDNR-CL
+actor.service.SDNR.sourceTopic=SDNR-CL-RSP
+actor.service.SDNR.operations.ModifyConfig.placeholder=
actor.service.SO.clientName=SO
actor.service.SO.pathGet=orchestrationRequests/v5/
diff --git a/controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-controller.properties b/controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-controller.properties
index 025a60bfa..8ed43c492 100644
--- a/controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-controller.properties
+++ b/controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-controller.properties
@@ -24,7 +24,7 @@ rules.groupId=org.onap.policy.controlloop
rules.artifactId=frankfurt
rules.version=1.0.0
-noop.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP,POLICY-CL-MGT,APPC-LCM-READ,SDNR-CL,DCAE_CL_RSP
+noop.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP,POLICY-CL-MGT,APPC-LCM-READ
noop.source.topics.DCAE_TOPIC.events=\
org.onap.policy.controlloop.CanonicalOnset,org.onap.policy.controlloop.CanonicalAbated
@@ -53,13 +53,10 @@ noop.source.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.
noop.source.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
noop.source.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-noop.source.topics.SDNR-CL.events=org.onap.policy.sdnr.PciRequestWrapper
-noop.source.topics.SDNR-CL.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
-
-noop.source.topics.DCAE_CL_RSP.events=org.onap.policy.controlloop.ControlLoopResponse
-noop.source.topics.DCAE_CL_RSP.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
-noop.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL,DCAE_CL_RSP
+noop.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL
noop.sink.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification
noop.sink.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
+
+noop.sink.topics.SDNR-CL.events=org.onap.policy.sdnr.PciRequestWrapper
+noop.sink.topics.SDNR-CL.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
diff --git a/controlloop/common/controller-usecases/src/test/resources/config/controlloop.properties.environment b/controlloop/common/controller-usecases/src/test/resources/config/controlloop.properties.environment
index f5d1c5d83..d0b5448c4 100644
--- a/controlloop/common/controller-usecases/src/test/resources/config/controlloop.properties.environment
+++ b/controlloop/common/controller-usecases/src/test/resources/config/controlloop.properties.environment
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# ONAP
# ================================================================================
-# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
# Modifications Copyright (C) 2019 Bell Canada.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,7 +41,7 @@ pdpx.password=pdpx
guard.url=http://localhost:6669/policy/pdpx/v1/decision
guard.jdbc.url=jdbc:mariadb://localhost:3306/operationshistory
-guard.disabled=true
+guard.disabled=false
sdnc.url=sdnc
sdnc.username=sdnc
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
index b880fd190..156dad7e6 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
@@ -107,6 +107,13 @@ public class ControlLoopOperationManager2 implements Serializable {
private final Deque<Operation> operationHistory = new ConcurrentLinkedDeque<>();
/**
+ * Set to {@code true} to prevent the last item in {@link #operationHistory} from
+ * being included in the outcome of {@link #getHistory()}. Used when the operation
+ * aborts prematurely due to lock-denied, guard-denied, etc.
+ */
+ private boolean holdLast = false;
+
+ /**
* Queue of outcomes yet to be processed. Outcomes are added to this each time the
* "start" or "complete" callback is invoked.
*/
@@ -417,6 +424,7 @@ public class ControlLoopOperationManager2 implements Serializable {
case LOCK_LOST:
case GUARD_DENIED:
case CONTROL_LOOP_TIMEOUT:
+ holdLast = false;
return false;
default:
break;
@@ -541,8 +549,16 @@ public class ControlLoopOperationManager2 implements Serializable {
* @return the list of control loop operations
*/
public List<ControlLoopOperation> getHistory() {
- return operationHistory.stream().map(Operation::getClOperation).map(ControlLoopOperation::new)
- .collect(Collectors.toList());
+ Operation last = (holdLast ? operationHistory.removeLast() : null);
+
+ List<ControlLoopOperation> result = operationHistory.stream().map(Operation::getClOperation)
+ .map(ControlLoopOperation::new).collect(Collectors.toList());
+
+ if (last != null) {
+ operationHistory.add(last);
+ }
+
+ return result;
}
/**
@@ -553,6 +569,9 @@ public class ControlLoopOperationManager2 implements Serializable {
* @param message message to put into the DB
*/
private void storeFailureInDataBase(OperationOutcome outcome, PolicyResult result, String message) {
+ // don't include this in history yet
+ holdLast = true;
+
outcome.setActor(actor);
outcome.setOperation(operation);
outcome.setMessage(message);
diff --git a/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-guard-disabled.properties b/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-guard-disabled.properties
index 65f6c0cc1..289de44eb 100644
--- a/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-guard-disabled.properties
+++ b/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-guard-disabled.properties
@@ -20,4 +20,7 @@
actor.service.GUARD.disabled=true
actor.service.GUARD.clientName=guard-client
+actor.service.GUARD.onapName=my-onap-name
+actor.service.GUARD.onapComponent=my-onap-component
+actor.service.GUARD.onapInstance=my-onap-instance
actor.service.GUARD.operations.Decision.path=decide
diff --git a/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-invalid-db.properties b/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-invalid-db.properties
index 59b0615b0..09a6fbb31 100644
--- a/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-invalid-db.properties
+++ b/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-invalid-db.properties
@@ -20,6 +20,9 @@
#actor.service.GUARD.disabled=true
actor.service.GUARD.clientName=guard-client
+actor.service.GUARD.onapName=my-onap-name
+actor.service.GUARD.onapComponent=my-onap-component
+actor.service.GUARD.onapInstance=my-onap-instance
actor.service.GUARD.operations.Decision.path=decide
# purposely missing the URL
diff --git a/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-with-db.properties b/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-with-db.properties
index 6e003f6d6..0fd886b46 100644
--- a/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-with-db.properties
+++ b/controlloop/common/eventmanager/src/test/resources/eventService/event-svc-with-db.properties
@@ -20,6 +20,9 @@
#actor.service.GUARD.disabled=true
actor.service.GUARD.clientName=guard-client
+actor.service.GUARD.onapName=my-onap-name
+actor.service.GUARD.onapComponent=my-onap-component
+actor.service.GUARD.onapInstance=my-onap-instance
actor.service.GUARD.operations.Decision.path=decide
operation.history.url=jdbc:h2:mem:EventManagerServicesTest
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 791bb8947..21476847f 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
@@ -32,6 +32,9 @@ operation.history.password=${env:SQL_PASSWORD}
actor.service.GUARD.disabled=${envd:GUARD_DISABLED:false}
actor.service.GUARD.clientName=GUARD
+actor.service.GUARD.onapName=Policy
+actor.service.GUARD.onapComponent=Drools PDP
+actor.service.GUARD.onapInstance=Frankfurt
actor.service.GUARD.operations.Decision.path=decision
actor.service.AAI.clientName=AAI
@@ -58,8 +61,13 @@ actor.service.CDS.grpcTimeout=10
actor.service.CDS.operations.gRPC.placeholder=
actor.service.SDNC.clientName=SDNC
-actor.service.SDNC.operations.Reroute.path=
-actor.service.SDNC.operations.BandwidthOnDemand.path=
+actor.service.SDNC.path=
+actor.service.SDNC.operations.Reroute.placeholder=
+actor.service.SDNC.operations.BandwidthOnDemand.placeholder=
+
+actor.service.SDNR.sinkTopic=SDNR-CL
+actor.service.SDNR.sourceTopic=SDNR-CL-RSP
+actor.service.SDNR.operations.ModifyConfig.placeholder=
actor.service.SO.clientName=SO
actor.service.SO.pathGet=orchestrationRequests/v5/
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
index ed6cd6c5f..5a5218c40 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * guard
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -72,7 +72,7 @@ public class PolicyGuardXacmlHelper {
decisionRequest.setAction("guard");
Map<String, String> guard = new HashMap<>();
guard.put("actor", xacmlReq.getActorId());
- guard.put("recipe", xacmlReq.getOperationId());
+ guard.put("operation", xacmlReq.getOperationId());
guard.put("target", xacmlReq.getTargetId());
if (xacmlReq.getClnameId() != null) {
guard.put("clname", xacmlReq.getClnameId());