aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--common/pom.xml2
-rw-r--r--common/src/main/resources/tosca/ControlLoopTOSCAServiceTemplateTypes.yaml19
-rw-r--r--common/src/main/resources/tosca/PolicyControlLoopElementType.yaml4
-rw-r--r--common/src/test/resources/demo/Notes.txt31
-rw-r--r--models/pom.xml2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java10
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimed.java32
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimedResponse.java41
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java5
-rw-r--r--packages/policy-clamp-docker/pom.xml16
-rw-r--r--packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh5
-rw-r--r--packages/policy-clamp-docker/src/main/docker/http-participant.sh7
-rw-r--r--packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh7
-rw-r--r--packages/policy-clamp-docker/src/main/docker/policy-participant.sh5
-rw-r--r--packages/policy-clamp-tarball/pom.xml2
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml2
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml3
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml4
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml12
-rw-r--r--packages/pom.xml2
-rw-r--r--participant/participant-impl/participant-impl-cds/pom.xml2
-rw-r--r--participant/participant-impl/participant-impl-http/pom.xml2
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/pom.xml2
-rw-r--r--participant/participant-impl/participant-impl-policy/pom.xml2
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyPapHttpClient.java87
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java75
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java11
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml10
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java20
-rw-r--r--participant/participant-impl/participant-impl-simulator/pom.xml2
-rw-r--r--participant/participant-impl/pom.xml2
-rw-r--r--participant/participant-intermediary/pom.xml2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java19
-rw-r--r--participant/pom.xml53
-rw-r--r--pom.xml6
-rw-r--r--releases/6.1.2-container.yaml18
-rw-r--r--releases/6.1.2.yaml5
-rw-r--r--runtime-controlloop/pom.xml2
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java29
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java62
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java40
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java10
-rw-r--r--runtime/clean_node_modules.sh44
-rw-r--r--runtime/pom.xml23
-rw-r--r--version.properties2
47 files changed, 665 insertions, 85 deletions
diff --git a/.gitignore b/.gitignore
index 31aad71b5..b54ca2afa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,10 @@ target
.idea
.checkstyle
*.iml
-ui-react/node_modules
+runtime/ui-react/node_modules
+runtime/ui-react/package-lock.json
+runtime/ui-react-lib/node_modules
+runtime/ui-react-lib/package-lock.json
ui-react/build
**/.evosuite/
**/debug-logs/
diff --git a/common/pom.xml b/common/pom.xml
index 063a68c05..1c2645342 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.clamp</groupId>
<artifactId>policy-clamp</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-common</artifactId>
diff --git a/common/src/main/resources/tosca/ControlLoopTOSCAServiceTemplateTypes.yaml b/common/src/main/resources/tosca/ControlLoopTOSCAServiceTemplateTypes.yaml
index e45a06257..a17cb7624 100644
--- a/common/src/main/resources/tosca/ControlLoopTOSCAServiceTemplateTypes.yaml
+++ b/common/src/main/resources/tosca/ControlLoopTOSCAServiceTemplateTypes.yaml
@@ -47,7 +47,7 @@ node_types:
type: integer
required: false
constraints:
- - greater-or-equal: 0
+ - greater_or_equal: 0
metadata:
common: true
description: A value indicating the start phase in which this control loop element will be started, the
@@ -58,7 +58,7 @@ node_types:
type: integer
required: false
constraints:
- - greater-or-equal: 0
+ - greater_or_equal: 0
default: 60
metadata:
common: true
@@ -67,7 +67,7 @@ node_types:
type: integer
required: false
constraints:
- - greater-or-equal: 0
+ - greater_or_equal: 0
default: 60
metadata:
common: true
@@ -76,7 +76,7 @@ node_types:
type: integer
required: false
constraints:
- - greater-or-equal: 0
+ - greater_or_equal: 0
default: 60
metadata:
common: true
@@ -85,11 +85,20 @@ node_types:
type: integer
required: false
constraints:
- - greater-or-equal: 0
+ - greater_or_equal: 0
default: 60
metadata:
common: true
description: The maximum time in seconds to wait for a state chage from passive to uninitialized
+ startDelay:
+ type: integer
+ required: false
+ constraints:
+ - greater_or_equal: 0
+ default: 0
+ metadata:
+ common: true
+ description: The number of milliseconds that the start of this control loop element should be delayed
org.onap.policy.clamp.controlloop.ControlLoop:
version: 1.0.1
derived_from: tosca.nodetypes.Root
diff --git a/common/src/main/resources/tosca/PolicyControlLoopElementType.yaml b/common/src/main/resources/tosca/PolicyControlLoopElementType.yaml
index bf66718ca..b4631ba14 100644
--- a/common/src/main/resources/tosca/PolicyControlLoopElementType.yaml
+++ b/common/src/main/resources/tosca/PolicyControlLoopElementType.yaml
@@ -37,3 +37,7 @@ node_types:
default: defaultGroup
description: The PDP group to which the policy should be deployed. This parameter is used when the policy is
deployed to PAP. The value defaults to the "defaultGroup", which always exists.
+ pdpType:
+ type: string
+ required: true
+ description: The PDP type to which the policy will run on. This parameter is used when the policy is deployed to PAP. \ No newline at end of file
diff --git a/common/src/test/resources/demo/Notes.txt b/common/src/test/resources/demo/Notes.txt
index 43b75e915..f937e0969 100644
--- a/common/src/test/resources/demo/Notes.txt
+++ b/common/src/test/resources/demo/Notes.txt
@@ -14,15 +14,14 @@ Go to clamp/runtime-controlloop
mvn spring-boot:run -Dspring-boot.run.arguments="--topicServer=localhost --mariadb.host=localhost"
Run Participant from command line using Maven
-mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8080 --topicServer=localhost"
-mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8081 --topicServer=localhost"
-mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8082 --topicServer=localhost"
+mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8080
+mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8081
+mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8082
Run Participant from command line using Jar
-java -jar -Dserver.port=8080 -DtopicServer=localhost target/policy-clamp-participant-impl-simulator-6.1.2-SNAPSHOT.jar
-java -jar -Dserver.port=8081 -DtopicServer=localhost target/policy-clamp-participant-impl-dcae-6.1.2-SNAPSHOT.jar
-java -jar -Dserver.port=8082 -DtopicServer=localhost target/policy-clamp-participant-impl-policy-6.1.2-SNAPSHOT.jar
-java -jar -DtopicServer=localhost target/policy-clamp-participant-impl-kubernetes-6.1.2-SNAPSHOT.jar
+java -jar -Dserver.port=8080 target/policy-clamp-participant-impl-simulator-6.1.2-SNAPSHOT.jar
+java -jar -Dserver.port=8082 target/policy-clamp-participant-impl-policy-6.1.2-SNAPSHOT.jar
+java -jar target/policy-clamp-participant-impl-kubernetes-6.1.2-SNAPSHOT.jar
Config of DB
@@ -39,6 +38,24 @@ MariaDB [(none)]> SHOW GRANTS for 'policy'@localhost;
+---------------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)
+//Generate the keystore
+//clone policy/docker
+cd docker/csit
+./gen_truststore.sh
+./gen_keystore.sh
+//the keystore generated: /docker/csit/config/ks.jks
+
+Run Participant from command line using Docker
+docker run --add-host=message-router:<ip-router> -p 6969:6969 --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-cl-runtime
+docker run --add-host=message-router:<ip-router> -p 8083:8083 --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-cl-k8s-ppnt
+docker run --add-host=message-router:<ip-router> --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-cl-http-ppnt
+docker run --add-host=message-router:<ip-router> --mount type=bind,source=<path-keystore-file>,target=/opt/app/policy/clamp/etc/ssl/policy-keystore onap/policy-clamp-cl-pf-ppnt
+
+Note:
+/policy-clamp-tarball/src/main/resources/etc/ssl/policy-truststore is the truststore for DMaap of oom project
+Participant-k8 swagger: https://localhost:8083/onap/k8sparticipant/swagger-ui/
+CL-Runtime swagger: https://localhost:6969/onap/controlloop/swagger-ui/
+
Run Policy API:
mvn exec:java -Dexec.mainClass=org.onap.policy.api.main.startstop.Main -Dexec.args="-c ../../clamp-tpn/tosca-controlloop/common/src/test/resources/demo/policy-api/PolicyAPIConfig.json"
diff --git a/models/pom.xml b/models/pom.xml
index 380ae0c03..c5eea9c73 100644
--- a/models/pom.xml
+++ b/models/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.clamp</groupId>
<artifactId>policy-clamp</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-models</artifactId>
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java
index f2397602b..4d3d37236 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java
@@ -52,6 +52,9 @@ public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop>
private Map<UUID, ControlLoopElement> elements;
+ @NonNull
+ private Boolean primed = false;
+
@Override
public String getType() {
return definition.getName();
@@ -73,6 +76,7 @@ public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop>
this.state = otherControlLoop.state;
this.orderedState = otherControlLoop.orderedState;
this.elements = PfUtils.mapMap(otherControlLoop.elements, ControlLoopElement::new);
+ this.primed = otherControlLoop.primed;
}
@Override
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java
index 2a2cde2ae..756c4f1bf 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java
@@ -91,6 +91,9 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
@Column
private String description;
+ @Column
+ private Boolean primed;
+
// @formatter:off
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@NotNull
@@ -141,6 +144,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
this.orderedState = copyConcept.orderedState;
this.description = copyConcept.description;
this.elements = PfUtils.mapMap(copyConcept.elements, JpaControlLoopElement::new, new LinkedHashMap<>(0));
+ this.primed = copyConcept.primed;
}
/**
@@ -163,6 +167,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
controlLoop.setOrderedState(orderedState != null ? orderedState : state.asOrderedState());
controlLoop.setDescription(description);
controlLoop.setElements(PfUtils.mapMap(elements, JpaControlLoopElement::toAuthorative, new LinkedHashMap<>(0)));
+ controlLoop.setPrimed(primed);
return controlLoop;
}
@@ -177,6 +182,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
this.state = controlLoop.getState();
this.orderedState = controlLoop.getOrderedState();
this.description = controlLoop.getDescription();
+ this.primed = controlLoop.getPrimed();
this.elements = new LinkedHashMap<>(controlLoop.getElements().size());
for (Entry<UUID, ControlLoopElement> elementEntry : controlLoop.getElements().entrySet()) {
@@ -249,6 +255,10 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
return result;
}
+ result = ObjectUtils.compare(primed, other.primed);
+ if (result != 0) {
+ return result;
+ }
return PfUtils.compareObjects(elements, other.elements);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimed.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimed.java
new file mode 100644
index 000000000..d6e670060
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimed.java
@@ -0,0 +1,32 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+
+import lombok.Data;
+
+@Data
+public class ControlLoopPrimed {
+
+ private String name;
+
+ private String version;
+
+ private boolean primed;
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimedResponse.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimedResponse.java
new file mode 100644
index 000000000..993c6e592
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimedResponse.java
@@ -0,0 +1,41 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
+import org.onap.policy.clamp.controlloop.models.messages.rest.GenericNameVersion;
+import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+
+
+/**
+ * Response to provide all primed controlLoops.
+ */
+@Getter
+@Setter
+@ToString(callSuper = true)
+public class ControlLoopPrimedResponse extends SimpleResponse {
+
+ private List<ControlLoopPrimed> primedControlLoopsList = new ArrayList<>();
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java
index ff6cc7619..d705c49b5 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java
@@ -240,6 +240,11 @@ class JpaControlLoopTest {
testJpaControlLoop.setDescription(null);
assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
+ testJpaControlLoop.setPrimed(true);
+ assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
+ testJpaControlLoop.setPrimed(false);
+ assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
+
assertEquals(testJpaControlLoop, new JpaControlLoop(testJpaControlLoop));
}
diff --git a/packages/policy-clamp-docker/pom.xml b/packages/policy-clamp-docker/pom.xml
index 4b848636d..451be1ec4 100644
--- a/packages/policy-clamp-docker/pom.xml
+++ b/packages/policy-clamp-docker/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.clamp</groupId>
<artifactId>clamp-packages</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
@@ -92,7 +92,7 @@
<images>
<image>
- <name>onap/policy-controlloop-runtime</name>
+ <name>onap/policy-clamp-cl-runtime</name>
<build>
<cleanup>try</cleanup>
<dockerFile>ClRuntimeDockerfile</dockerFile>
@@ -123,8 +123,8 @@
</build>
</image>
<image>
- <name>onap/policy-participant</name>
- <alias>onap-policy-participant</alias>
+ <name>onap/policy-clamp-cl-pf-ppnt</name>
+ <alias>onap-policy-clamp-cl-pf-ppnt</alias>
<build>
<cleanup>try</cleanup>
<dockerFile>PolicyParticipantDockerfile</dockerFile>
@@ -155,8 +155,8 @@
</build>
</image>
<image>
- <name>onap/kubernetes-participant</name>
- <alias>onap-kubernetes-participant</alias>
+ <name>onap/policy-clamp-cl-k8s-ppnt</name>
+ <alias>onap-policy-clamp-cl-k8s-ppnt</alias>
<build>
<cleanup>try</cleanup>
<dockerFile>KubernetesParticipantDockerfile</dockerFile>
@@ -187,8 +187,8 @@
</build>
</image>
<image>
- <name>onap/http-participant</name>
- <alias>onap-http-participant</alias>
+ <name>onap/policy-clamp-cl-http-ppnt</name>
+ <alias>onap-policy-clamp-cl-http-ppnt</alias>
<build>
<cleanup>try</cleanup>
<dockerFile>HttpParticipantDockerfile</dockerFile>
diff --git a/packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh b/packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh
index 6d12e590a..59d31dc8e 100644
--- a/packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh
+++ b/packages/policy-clamp-docker/src/main/docker/controlloop-runtime.sh
@@ -56,8 +56,9 @@ touch /app/app.jar
mkdir -p "${POLICY_HOME}"/config/
cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/ClRuntimeParameters.yaml
-$JAVA_HOME/bin/java -Djavax.net.ssl.keyStore="${KEYSTORE}" \
- -Djavax.net.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
+$JAVA_HOME/bin/java -Dserver.ssl.enabled="true" \
+ -Dserver.ssl.keyStore="${KEYSTORE}" \
+ -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
diff --git a/packages/policy-clamp-docker/src/main/docker/http-participant.sh b/packages/policy-clamp-docker/src/main/docker/http-participant.sh
index d74b903e3..17daa18f9 100644
--- a/packages/policy-clamp-docker/src/main/docker/http-participant.sh
+++ b/packages/policy-clamp-docker/src/main/docker/http-participant.sh
@@ -55,9 +55,10 @@ fi
mkdir -p "${POLICY_HOME}"/config/
cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/HttpParticipantParameters.yaml
-$JAVA_HOME/bin/java -Dserver.ssl.keyStore="${KEYSTORE}" \
+$JAVA_HOME/bin/java -Dserver.ssl.enabled="true" \
+ -Dserver.ssl.keyStore="${KEYSTORE}" \
-Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
- -Dserver.ssl.trustStore="${TRUSTSTORE}" \
- -Dserver.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
+ -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
+ -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
--spring.config.location="${POLICY_HOME}/config/HttpParticipantParameters.yaml"
diff --git a/packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh b/packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh
index cb5ae9251..3c5fe5c63 100644
--- a/packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh
+++ b/packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh
@@ -55,9 +55,10 @@ fi
mkdir -p "${POLICY_HOME}"/config/
cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/KubernetesParticipantParameters.yaml
-$JAVA_HOME/bin/java -Dserver.ssl.keyStore="${KEYSTORE}" \
+$JAVA_HOME/bin/java -Dserver.ssl.enabled="true" \
+ -Dserver.ssl.keyStore="${KEYSTORE}" \
-Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
- -Dserver.ssl.trustStore="${TRUSTSTORE}" \
- -Dserver.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
+ -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
+ -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
--spring.config.location="${POLICY_HOME}/config/KubernetesParticipantParameters.yaml"
diff --git a/packages/policy-clamp-docker/src/main/docker/policy-participant.sh b/packages/policy-clamp-docker/src/main/docker/policy-participant.sh
index 7949fab72..77cd0c02b 100644
--- a/packages/policy-clamp-docker/src/main/docker/policy-participant.sh
+++ b/packages/policy-clamp-docker/src/main/docker/policy-participant.sh
@@ -56,8 +56,9 @@ touch /app/app.jar
mkdir -p "${POLICY_HOME}"/config/
cp -f "${CONFIG_FILE}" "${POLICY_HOME}"/config/PolicyParticipantParameters.yaml
-$JAVA_HOME/bin/java -Djavax.net.ssl.keyStore="${KEYSTORE}" \
- -Djavax.net.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
+$JAVA_HOME/bin/java -Dserver.ssl.enabled="true" \
+ -Dserver.ssl.keyStore="${KEYSTORE}" \
+ -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
diff --git a/packages/policy-clamp-tarball/pom.xml b/packages/policy-clamp-tarball/pom.xml
index f70b5c5c1..ea564c4dc 100644
--- a/packages/policy-clamp-tarball/pom.xml
+++ b/packages/policy-clamp-tarball/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.clamp</groupId>
<artifactId>clamp-packages</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-tarball</artifactId>
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml
index ade249e99..c8601cbdd 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml
@@ -44,12 +44,14 @@ runtime:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
+ useHttps: true
topicSinks:
-
topic: POLICY-CLRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
+ useHttps: true
management:
endpoints:
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml
index 76f48bbdd..be421fcae 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml
@@ -15,9 +15,10 @@ participant:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
+ useHttps: true
topicSinks:
- topic: POLICY-CLRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
-
+ useHttps: true
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
index ebd744f13..d605cfa1d 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
@@ -26,12 +26,14 @@ participant:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
+ useHttps: true
topicSinks:
-
topic: POLICY-CLRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
+ useHttps: true
management:
endpoints:
@@ -42,6 +44,8 @@ server:
# Configuration of the HTTP/REST server. The parameters are defined and handled by the springboot framework.
# See springboot documentation.
port: 8083
+ servlet:
+ context-path: /onap/k8sparticipant
logging:
# Configuration of logging
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
index 1ea5d68c0..bd9a6260a 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
@@ -1,5 +1,7 @@
participant:
+ pdpGroup: defaultGroup
+ pdpType: apex
policyApiParameters:
clientName: api
hostname: policy-api
@@ -8,6 +10,14 @@ participant:
password: zb!XztG34
https: true
allowSelfSignedCerts: true
+ policyPapParameters:
+ clientName: pap
+ hostname: policy-pap
+ port: 6969
+ userName: healthcheck
+ password: zb!XztG34
+ https: true
+ allowSelfSignedCerts: true
intermediaryParameters:
reportingTimeIntervalMs: 120000
description: Participant Description
@@ -25,9 +35,11 @@ participant:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
+ useHttps: true
topicSinks:
-
topic: POLICY-CLRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
+ useHttps: true
diff --git a/packages/pom.xml b/packages/pom.xml
index 4f5a0849e..07258cd44 100644
--- a/packages/pom.xml
+++ b/packages/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.policy.clamp</groupId>
<artifactId>policy-clamp</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>clamp-packages</artifactId>
diff --git a/participant/participant-impl/participant-impl-cds/pom.xml b/participant/participant-impl/participant-impl-cds/pom.xml
index ccdd8bee7..170a800da 100644
--- a/participant/participant-impl/participant-impl-cds/pom.xml
+++ b/participant/participant-impl/participant-impl-cds/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.clamp.participant</groupId>
<artifactId>policy-clamp-participant-impl</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-participant-impl-cds</artifactId>
diff --git a/participant/participant-impl/participant-impl-http/pom.xml b/participant/participant-impl/participant-impl-http/pom.xml
index 85d65e707..5cfb30f6a 100644
--- a/participant/participant-impl/participant-impl-http/pom.xml
+++ b/participant/participant-impl/participant-impl-http/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.clamp.participant</groupId>
<artifactId>policy-clamp-participant-impl</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-participant-impl-http</artifactId>
diff --git a/participant/participant-impl/participant-impl-kubernetes/pom.xml b/participant/participant-impl/participant-impl-kubernetes/pom.xml
index ebaa7a198..68c1a1418 100644
--- a/participant/participant-impl/participant-impl-kubernetes/pom.xml
+++ b/participant/participant-impl/participant-impl-kubernetes/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.clamp.participant</groupId>
<artifactId>policy-clamp-participant-impl</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-participant-impl-kubernetes</artifactId>
diff --git a/participant/participant-impl/participant-impl-policy/pom.xml b/participant/participant-impl/participant-impl-policy/pom.xml
index 367e3d664..bed42b081 100644
--- a/participant/participant-impl/participant-impl-policy/pom.xml
+++ b/participant/participant-impl/participant-impl-policy/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.clamp.participant</groupId>
<artifactId>policy-clamp-participant-impl</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-participant-impl-policy</artifactId>
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyPapHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyPapHttpClient.java
new file mode 100644
index 000000000..3cce3bd8a
--- /dev/null
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyPapHttpClient.java
@@ -0,0 +1,87 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.controlloop.participant.policy.client;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters;
+import org.springframework.stereotype.Component;
+
+@Component
+public class PolicyPapHttpClient extends AbstractHttpClient {
+
+ private static final String PAP_URI = "/policy/pap/v1/";
+ private final String pdpGroup;
+ private final String pdpType;
+
+ /**
+ * Constructor.
+ *
+ * @param parameters the policy participant parameters
+ */
+ public PolicyPapHttpClient(ParticipantPolicyParameters parameters) {
+ super(parameters.getPolicyPapParameters());
+ this.pdpGroup = parameters.getPdpGroup();
+ this.pdpType = parameters.getPdpType();
+ }
+
+ /**
+ * Deploy or undeploy Policies.
+ *
+ * @param policyName the name of the policy to be deployed/undeployed
+ * @param policyVersion the version of the policy to be deployed/undeployed
+ * @param action the action to deploy/undeploy policy
+ * @return Response
+ */
+ public Response handlePolicyDeployOrUndeploy(final String policyName, final String policyVersion,
+ final String action) {
+ // policies
+ JsonObject policyArrayBody = new JsonObject();
+ policyArrayBody.addProperty("name", policyName);
+ policyArrayBody.addProperty("version", policyVersion);
+ JsonArray policyArr = new JsonArray();
+ policyArr.add(policyArrayBody);
+
+ // deploymentSubgroups
+ JsonObject deploymentSubGrpBody = new JsonObject();
+ deploymentSubGrpBody.addProperty("pdpType", pdpType);
+ deploymentSubGrpBody.addProperty("action", action);
+ deploymentSubGrpBody.add("policies", policyArr);
+ JsonArray deployArr = new JsonArray();
+ deployArr.add(deploymentSubGrpBody);
+
+ // groups
+ JsonObject groupArrayBody = new JsonObject();
+ groupArrayBody.addProperty("name", pdpGroup);
+ groupArrayBody.add("deploymentSubgroups", deployArr);
+ JsonArray groupArr = new JsonArray();
+ groupArr.add(groupArrayBody);
+
+ // main json
+ JsonObject mainJson = new JsonObject();
+ mainJson.add("groups", groupArr);
+
+ return executePost(PAP_URI + "pdps/deployments/batch", Entity.entity(mainJson, MediaType.APPLICATION_JSON));
+ }
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
index 9054788f9..29a7852f1 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
@@ -36,6 +36,7 @@ import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.Parti
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyApiHttpClient;
+import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyPapHttpClient;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -58,6 +59,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
private final Map<String, String> policyMap = new LinkedHashMap<>();
private final PolicyApiHttpClient apiHttpClient;
+ private final PolicyPapHttpClient papHttpClient;
@Setter
private ParticipantIntermediaryApi intermediaryApi;
@@ -66,49 +68,62 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
* constructor.
*
* @param apiHttpClient the Policy Api Http Client
+ * @param papHttpClient the Policy Pap Http Client
*/
- public ControlLoopElementHandler(PolicyApiHttpClient apiHttpClient) {
+ public ControlLoopElementHandler(PolicyApiHttpClient apiHttpClient, PolicyPapHttpClient papHttpClient) {
+ this.papHttpClient = papHttpClient;
this.apiHttpClient = apiHttpClient;
}
/**
* Callback method to handle a control loop element state change.
*
+ * @param controlLoopId the ID of the control loop
* @param controlLoopElementId the ID of the control loop element
* @param currentState the current state of the control loop element
- * @param newState the state to which the control loop element is changing to
+ * @param orderedState the state to which the control loop element is changing to
* @throws PfModelException in case of an exception
*/
@Override
public void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId,
UUID controlLoopElementId, ControlLoopState currentState,
- ControlLoopOrderedState newState) throws PfModelException {
- switch (newState) {
+ ControlLoopOrderedState orderedState) throws PfModelException {
+ switch (orderedState) {
case UNINITIALISED:
try {
- deletePolicyData(controlLoopId, controlLoopElementId, newState);
+ deletePolicyData(controlLoopId, controlLoopElementId, orderedState);
+ intermediaryApi.updateControlLoopElementState(controlLoopId,
+ controlLoopElementId, orderedState, ControlLoopState.UNINITIALISED,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
} catch (PfModelRuntimeException e) {
LOGGER.debug("Deleting policy data failed", e);
}
break;
case PASSIVE:
+ try {
+ undeployPolicies(controlLoopElementId, orderedState);
+ } catch (PfModelRuntimeException e) {
+ LOGGER.debug("Undeploying policies failed - no policies to undeploy {}", controlLoopElementId);
+ }
intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ controlLoopElementId, orderedState, ControlLoopState.PASSIVE,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
break;
case RUNNING:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.RUNNING,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ try {
+ deployPolicies(controlLoopId, controlLoopElementId, orderedState);
+ } catch (PfModelRuntimeException e) {
+ LOGGER.debug("Deploying policies failed {}", controlLoopElementId);
+ }
break;
default:
- LOGGER.debug("Unknown orderedstate {}", newState);
+ LOGGER.debug("Unknown orderedstate {}", orderedState);
break;
}
}
private void deletePolicyData(ToscaConceptIdentifier controlLoopId,
- UUID controlLoopElementId, ControlLoopOrderedState newState) {
+ UUID controlLoopElementId, ControlLoopOrderedState newState) {
// Delete all policies of this controlLoop from policy framework
for (Entry<String, String> policy : policyMap.entrySet()) {
apiHttpClient.deletePolicy(policy.getKey(), policy.getValue());
@@ -120,8 +135,36 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
}
policyTypeMap.clear();
intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.UNINITIALISED,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ controlLoopElementId, newState, ControlLoopState.UNINITIALISED,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ }
+
+ private void deployPolicies(ToscaConceptIdentifier controlLoopId, UUID controlLoopElementId,
+ ControlLoopOrderedState newState) {
+ // Deploy all policies of this controlLoop from Policy Framework
+ if (policyMap.entrySet() != null) {
+ for (Entry<String, String> policy : policyMap.entrySet()) {
+ papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(), "POST");
+ }
+ LOGGER.debug("Policies deployed to {} successfully", controlLoopElementId);
+ } else {
+ LOGGER.debug("No policies to deploy to {}", controlLoopElementId);
+ }
+ intermediaryApi.updateControlLoopElementState(controlLoopId,
+ controlLoopElementId, newState, ControlLoopState.RUNNING,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ }
+
+ private void undeployPolicies(UUID controlLoopElementId, ControlLoopOrderedState newState) {
+ // Undeploy all policies of this controlloop from Policy Framework
+ if (policyMap.entrySet() != null) {
+ for (Entry<String, String> policy : policyMap.entrySet()) {
+ papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(), "DELETE");
+ }
+ LOGGER.debug("Undeployed policies from {} successfully", controlLoopElementId);
+ } else {
+ LOGGER.debug("No policies are deployed to {}", controlLoopElementId);
+ }
}
/**
@@ -133,7 +176,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
*/
@Override
public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId, ControlLoopElement element,
- ToscaNodeTemplate clElementDefinition)
+ ToscaNodeTemplate clElementDefinition)
throws PfModelException {
intermediaryApi.updateControlLoopElementState(controlLoopId, element.getId(), element.getOrderedState(),
ControlLoopState.PASSIVE, ParticipantMessageType.CONTROL_LOOP_UPDATE);
@@ -176,4 +219,4 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
intermediaryApi.updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics);
}
}
-}
+} \ No newline at end of file
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java
index ced9d1bd0..8e1de36b9 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java
@@ -21,6 +21,7 @@
package org.onap.policy.clamp.controlloop.participant.policy.main.parameters;
import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
@@ -48,4 +49,14 @@ public class ParticipantPolicyParameters implements ParticipantParameters {
@NotNull
@ParameterGroupConstraint
private RestClientParameters policyApiParameters;
+
+ @NotNull
+ @ParameterGroupConstraint
+ private RestClientParameters policyPapParameters;
+
+ @NotBlank
+ private String pdpGroup;
+
+ @NotBlank
+ private String pdpType;
}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
index 32cd28cd3..e5b2b2ab1 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
@@ -2,6 +2,8 @@ server:
port: 8082
participant:
+ pdpGroup: defaultGroup
+ pdpType: apex
policyApiParameters:
clientName: api
hostname: policy-api
@@ -10,6 +12,14 @@ participant:
password: zb!XztG34
https: true
allowSelfSignedCerts: true
+ policyPapParameters:
+ clientName: pap
+ hostname: policy-pap
+ port: 6969
+ userName: healthcheck
+ password: zb!XztG34
+ https: true
+ allowSelfSignedCerts: true
intermediaryParameters:
reportingTimeIntervalMs: 120000
description: Participant Description
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
index a34c9cda5..41af8a6ec 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
@@ -68,6 +68,26 @@ public class CommonTestData {
map.put("name", name);
map.put("intermediaryParameters", getIntermediaryParametersMap(false));
map.put("policyApiParameters", getPolicyApiParametersMap());
+ map.put("policyPapParameters", getPolicyPapParametersMap());
+ map.put("pdpGroup", "defaultGroup");
+ map.put("pdpType", "apex");
+ return map;
+ }
+
+ /**
+ * Returns a property map for a policyPapParameters map for test cases.
+ *
+ * @return a property map suitable for constructing an object
+ */
+ public Map<String, Object> getPolicyPapParametersMap() {
+ final Map<String, Object> map = new TreeMap<>();
+ map.put("clientName", "pap");
+ map.put("hostname", "localhost");
+ map.put("port", 6968);
+ map.put("userName", "healthcheck");
+ map.put("password", "zb!XztG34");
+ map.put("https", false);
+ map.put("allowSelfSignedCerts", true);
return map;
}
diff --git a/participant/participant-impl/participant-impl-simulator/pom.xml b/participant/participant-impl/participant-impl-simulator/pom.xml
index 5e315ba9e..d0d364605 100644
--- a/participant/participant-impl/participant-impl-simulator/pom.xml
+++ b/participant/participant-impl/participant-impl-simulator/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.clamp.participant</groupId>
<artifactId>policy-clamp-participant-impl</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-participant-impl-simulator</artifactId>
diff --git a/participant/participant-impl/pom.xml b/participant/participant-impl/pom.xml
index 006d38def..3d1acb0f0 100644
--- a/participant/participant-impl/pom.xml
+++ b/participant/participant-impl/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.clamp.participant</groupId>
<artifactId>policy-clamp-participant</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-participant-impl</artifactId>
diff --git a/participant/participant-intermediary/pom.xml b/participant/participant-intermediary/pom.xml
index aac80a4a2..0b111fbcc 100644
--- a/participant/participant-intermediary/pom.xml
+++ b/participant/participant-intermediary/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.clamp.participant</groupId>
<artifactId>policy-clamp-participant</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-participant-intermediary</artifactId>
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
index 8bdf91824..30a06ba22 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
@@ -103,9 +103,11 @@ public class ControlLoopHandler {
return null;
}
+ // Update states of ControlLoopElement in controlLoopMap
for (var controlLoop : controlLoopMap.values()) {
var element = controlLoop.getElements().get(id);
if (element != null) {
+ element.setOrderedState(orderedState);
element.setState(newState);
}
var checkOpt = controlLoop.getElements().values().stream()
@@ -116,6 +118,7 @@ public class ControlLoopHandler {
}
}
+ // Update states of ControlLoopElement in elementsOnThisParticipant
var clElement = elementsOnThisParticipant.get(id);
if (clElement != null) {
var controlLoopStateChangeAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
@@ -339,16 +342,16 @@ public class ControlLoopHandler {
return;
}
- for (var clElementListener : listeners) {
- try {
- for (var element : controlLoop.getElements().values()) {
- clElementListener.controlLoopElementStateChange(controlLoop.getDefinition(), element.getId(),
- element.getState(), orderedState);
+ controlLoop.getElements().values().stream().forEach(clElement -> {
+ for (var clElementListener : listeners) {
+ try {
+ clElementListener.controlLoopElementStateChange(controlLoop.getDefinition(),
+ clElement.getId(), clElement.getState(), orderedState);
+ } catch (PfModelException e) {
+ LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition());
}
- } catch (PfModelException e) {
- LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition());
}
- }
+ });
}
/**
diff --git a/participant/pom.xml b/participant/pom.xml
index 015308bbe..77108fbf5 100644
--- a/participant/pom.xml
+++ b/participant/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.clamp</groupId>
<artifactId>policy-clamp</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.clamp.participant</groupId>
@@ -40,6 +40,49 @@
<module>participant-impl</module>
</modules>
+ <profiles>
+ <!-- These profiles are required because the tests jar from policy-clamp-common is not available in staging
+ Jenkins jobs -->
+ <profile>
+ <id>ExcludeTestJar1</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>false</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.policy.clamp</groupId>
+ <artifactId>policy-clamp-common</artifactId>
+ <classifier>tests</classifier>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>ExcludeTestJar2</id>
+ <activation>
+ <property>
+ <name>skipTests</name>
+ <value>false</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.policy.clamp</groupId>
+ <artifactId>policy-clamp-common</artifactId>
+ <classifier>tests</classifier>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
<dependencies>
<dependency>
<groupId>org.onap.policy.clamp</groupId>
@@ -51,14 +94,6 @@
<artifactId>policy-clamp-models</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.onap.policy.clamp</groupId>
- <artifactId>policy-clamp-common</artifactId>
- <classifier>tests</classifier>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/pom.xml b/pom.xml
index 0996f0586..020f708f3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.onap.policy.clamp</groupId>
<artifactId>policy-clamp</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
@@ -50,8 +50,8 @@
</description>
<properties>
- <policy.common.version>1.9.0-SNAPSHOT</policy.common.version>
- <policy.models.version>2.5.0-SNAPSHOT</policy.models.version>
+ <policy.common.version>1.9.0</policy.common.version>
+ <policy.models.version>2.5.0</policy.models.version>
</properties>
<modules>
diff --git a/releases/6.1.2-container.yaml b/releases/6.1.2-container.yaml
new file mode 100644
index 000000000..49431923f
--- /dev/null
+++ b/releases/6.1.2-container.yaml
@@ -0,0 +1,18 @@
+distribution_type: 'container'
+container_release_tag: '6.1.2'
+project: 'policy-clamp'
+log_dir: 'policy-clamp-maven-docker-stage-master/280'
+ref: e00af2f84ef9bf8ffdc5fff9bff1c35b16a22b65
+containers:
+ - name: 'policy-clamp-backend'
+ version: '6.1-STAGING-20210915T154312Z'
+ - name: 'policy-clamp-frontend'
+ version: '6.1-STAGING-20210915T154312Z'
+ - name: 'policy-clamp-cl-pf-ppnt'
+ version: '6.1.2-20210915T1543'
+ - name: 'policy-clamp-cl-k8s-ppnt'
+ version: '6.1.2-20210915T1543'
+ - name: 'policy-clamp-cl-http-ppnt'
+ version: '6.1.2-20210915T1543'
+ - name: 'policy-clamp-cl-runtime'
+ version: '6.1.2-20210915T1543'
diff --git a/releases/6.1.2.yaml b/releases/6.1.2.yaml
new file mode 100644
index 000000000..93cd2c809
--- /dev/null
+++ b/releases/6.1.2.yaml
@@ -0,0 +1,5 @@
+distribution_type: 'maven'
+version: '6.1.2'
+project: 'policy-clamp'
+tag_release: false
+log_dir: 'policy-clamp-maven-stage-master/282/'
diff --git a/runtime-controlloop/pom.xml b/runtime-controlloop/pom.xml
index 54405548f..a5fc707f1 100644
--- a/runtime-controlloop/pom.xml
+++ b/runtime-controlloop/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.clamp</groupId>
<artifactId>policy-clamp</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-runtime-controlloop</artifactId>
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java
index dc40cc274..28558cc02 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java
@@ -47,6 +47,8 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
import org.onap.policy.clamp.controlloop.models.messages.rest.GenericNameVersion;
import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopOrderStateResponse;
+import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopPrimed;
+import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopPrimedResponse;
import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstancePropertiesResponse;
import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand;
import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
@@ -389,6 +391,33 @@ public class ControlLoopInstantiationProvider {
/**
* Saves Instance Properties and Control Loop.
+ * Gets a list of control loops which are primed or de-primed.
+ *
+ * @param name the name of the control loop to get, null for all control loops
+ * @param version the version of the control loop to get, null for all control loops
+ * @return a list of Instantiation Command
+ * @throws PfModelException on errors getting control loops
+ */
+ public ControlLoopPrimedResponse getControlLoopPriming(String name, String version)
+ throws PfModelException {
+
+ List<ControlLoop> controlLoops = controlLoopProvider.getControlLoops(name, version);
+
+ var response = new ControlLoopPrimedResponse();
+
+ controlLoops.forEach(controlLoop -> {
+ var primed = new ControlLoopPrimed();
+ primed.setName(controlLoop.getName());
+ primed.setVersion(controlLoop.getVersion());
+ primed.setPrimed(controlLoop.getPrimed());
+ response.getPrimedControlLoopsList().add(primed);
+ });
+
+ return response;
+ }
+
+ /**
+ * Creates instance element name.
*
* @param serviceTemplate the service template
* @param controlLoops a list of control loops
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java
index 91958f97a..b65d3b784 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/rest/InstantiationController.java
@@ -34,6 +34,7 @@ import lombok.RequiredArgsConstructor;
import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopOrderStateResponse;
+import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopPrimedResponse;
import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstancePropertiesResponse;
import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand;
import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
@@ -571,4 +572,65 @@ public class InstantiationController extends AbstractRestController {
return ResponseEntity.ok().body(provider.getInstantiationOrderState(name, version));
}
+
+ /**
+ * Queries Primed/De-Primed status of a control loop.
+ *
+ * @param requestId request ID used in ONAP logging
+ * @param name the name of the control loop to get, null for all control loops
+ * @param version the version of the control loop to get, null for all control loops
+ * @return the control loops
+ * @throws PfModelException on errors getting priming of control loop
+ */
+ // @formatter:off
+ @GetMapping(value = "/controlLoopPriming",
+ produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
+ @ApiOperation(value = "Query priming details of the requested control loops",
+ notes = "Queries priming details of the requested control loops, returning primed/deprimed control loops",
+ response = ControlLoopPrimedResponse.class,
+ tags = {TAGS},
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE),
+ responseHeaders = {
+ @ResponseHeader(
+ name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
+ response = UUID.class)},
+ extensions = {
+ @Extension
+ (
+ name = EXTENSION_NAME,
+ properties = {
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
+ @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
+ }
+ )
+ }
+ )
+ @ApiResponses(
+ value = {
+ @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
+ @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
+ @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
+ }
+ )
+ // @formatter:on
+ public ResponseEntity<ControlLoopPrimedResponse> getControlLoopPriming(
+ @RequestHeader(
+ name = REQUEST_ID_NAME,
+ required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Control Loop definition name", required = false) @RequestParam(
+ value = "name",
+ required = false) String name,
+ @ApiParam(value = "Control Loop definition version", required = false) @RequestParam(
+ value = "version",
+ required = false) String version)
+ throws PfModelException {
+
+ return ResponseEntity.ok().body(provider.getControlLoopPriming(name, version));
+ }
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
index a426cac4a..c4ca568f7 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
@@ -34,6 +34,8 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
@@ -159,6 +161,22 @@ public class SupervisionHandler {
@MessageIntercept
public void handleParticipantMessage(ParticipantDeregister participantDeregisterMessage) {
LOGGER.debug("Participant Deregister received {}", participantDeregisterMessage);
+ try {
+ var participantList =
+ participantProvider.getParticipants(participantDeregisterMessage.getParticipantId().getName(),
+ participantDeregisterMessage.getParticipantId().getVersion());
+
+ if (participantList != null) {
+ for (Participant participant : participantList) {
+ participant.setParticipantState(ParticipantState.TERMINATED);
+ participant.setHealthStatus(ParticipantHealthStatus.OFF_LINE);
+ }
+ participantProvider.updateParticipants(participantList);
+ }
+ } catch (PfModelException pfme) {
+ LOGGER.warn("Model exception occured {}", participantDeregisterMessage.getParticipantId());
+ }
+
participantDeregisterAckPublisher.send(participantDeregisterMessage.getMessageId());
}
@@ -240,7 +258,8 @@ public class SupervisionHandler {
var controlLoop = controlLoopProvider.getControlLoop(controlLoopAckMessage.getControlLoopId());
if (controlLoop != null) {
var updated = updateState(controlLoop, controlLoopAckMessage
- .getControlLoopResultMap().entrySet());
+ .getControlLoopResultMap().entrySet())
+ || setPrimed(controlLoop);
if (updated) {
controlLoopProvider.updateControlLoop(controlLoop);
}
@@ -266,6 +285,23 @@ public class SupervisionHandler {
return updated;
}
+ private boolean setPrimed(ControlLoop controlLoop) {
+ var clElements = controlLoop.getElements().values();
+ if (clElements != null) {
+ Boolean primedFlag = true;
+ var checkOpt = controlLoop.getElements().values().stream()
+ .filter(clElement -> (!clElement.getState().equals(ControlLoopState.PASSIVE)
+ || !clElement.getState().equals(ControlLoopState.RUNNING))).findAny();
+ if (checkOpt.isEmpty()) {
+ primedFlag = false;
+ }
+ controlLoop.setPrimed(primedFlag);
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Supervise a control loop, performing whatever actions need to be performed on the control loop.
*
@@ -392,7 +428,7 @@ public class SupervisionHandler {
var participant = new Participant();
participant.setName(participantStatusMessage.getParticipantId().getName());
participant.setVersion(participantStatusMessage.getParticipantId().getVersion());
- participant.setDefinition(new ToscaConceptIdentifier("unknown", "0.0.0"));
+ participant.setDefinition(participantStatusMessage.getParticipantId());
participant.setParticipantState(participantStatusMessage.getState());
participant.setHealthStatus(participantStatusMessage.getHealthStatus());
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java
index a6756eece..42e4ddee2 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java
@@ -36,6 +36,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
+import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.ControlLoopPrimedResponse;
import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand;
import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.clamp.controlloop.runtime.instantiation.ControlLoopInstantiationProvider;
@@ -80,6 +81,8 @@ class InstantiationControllerTest extends CommonRestController {
private static final String INSTANTIATION_COMMAND_ENDPOINT = "instantiation/command";
+ private static final String PRIMING_ENDPOINT = "controlLoopPriming";
+
private static ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
@@ -174,6 +177,13 @@ class InstantiationControllerTest extends CommonRestController {
assertThat(controlLoopsFromDb.getControlLoopList()).hasSize(1);
assertEquals(controlLoopFromRsc, controlLoopsFromDb.getControlLoopList().get(0));
}
+
+ invocationBuilder = super.sendRequest(PRIMING_ENDPOINT + "?name="
+ + "PMSHInstance0Create" + "&version=" + "1.0.1");
+ Response rawresp = invocationBuilder.buildGet().invoke();
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ ControlLoopPrimedResponse primResponse = rawresp.readEntity(ControlLoopPrimedResponse.class);
+ assertEquals(false, primResponse.getPrimedControlLoopsList().get(0).isPrimed());
}
@Test
diff --git a/runtime/clean_node_modules.sh b/runtime/clean_node_modules.sh
new file mode 100644
index 000000000..154e6614e
--- /dev/null
+++ b/runtime/clean_node_modules.sh
@@ -0,0 +1,44 @@
+#
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+
+#!/bin/sh
+
+if test -d ui-react/node_modules;
+then
+ echo "DELETING node_modules inside ui-react"
+ rm -rf ui-react/node_modules
+fi
+
+if test -f ui-react/package-lock.json;
+then
+ echo "DELETING package-lock.json inside ui-react"
+ rm ui-react/package-lock.json
+fi
+
+if test -d ui-react-lib/node_modules;
+then
+ echo "DELETING node_modules inside ui-react-lib"
+ rm -rf ui-react-lib/node_modules
+fi
+
+if test -f ui-react-lib/package-lock.json;
+then
+ echo "DELETING package-lock.json inside ui-react-lib"
+ rm ui-react-lib/package-lock.json
+fi
diff --git a/runtime/pom.xml b/runtime/pom.xml
index ef15198dc..4fb1ac6cc 100644
--- a/runtime/pom.xml
+++ b/runtime/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.clamp</groupId>
<artifactId>policy-clamp</artifactId>
- <version>6.1.2-SNAPSHOT</version>
+ <version>6.1.3-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-runtime</artifactId>
@@ -99,7 +99,7 @@
<npm.publish.url>https://nexus3.onap.org/repository/npm.snapshot/</npm.publish.url>
<!-- This property triggers generation of the Swagger documents -->
- <swagger.generation.phase>post-integration-test</swagger.generation.phase>
+ <!-- swagger.generation.phase>post-integration-test</swagger.generation.phase-->
</properties>
<profiles>
@@ -932,6 +932,25 @@
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>cleanNodeModules</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <executable>bash</executable>
+ <arguments>
+ <argument>${project.build.directory}/clean_node_modules.sh</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.11.3</version>
diff --git a/version.properties b/version.properties
index 063474d7e..077f8aeb0 100644
--- a/version.properties
+++ b/version.properties
@@ -27,7 +27,7 @@
major=6
minor=1
-patch=2
+patch=3
base_version=${major}.${minor}.${patch}