#!/usr/bin/env sh
#
# ============LICENSE_START=======================================================
-# Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
+# Copyright (C) 2021-2022, 2025,2026 OpenInfra Foundation Europe. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ============LICENSE_END=========================================================
#
-if [ "$#" -eq 1 ]; then
- CONFIG_FILE=$1
-fi
-
-if [ -z "$CONFIG_FILE" ]; then
- CONFIG_FILE="${POLICY_HOME}/etc/AcRuntimeParameters.yaml"
-fi
-
-echo "Policy clamp runtime acm config file: $CONFIG_FILE"
-
if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
echo "overriding logback xml file"
cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
"$JAVA_HOME"/bin/java \
-Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
- -Dcom.sun.management.jmxremote.rmi.port=9090 \
- -Dcom.sun.management.jmxremote=true \
- -Dcom.sun.management.jmxremote.port=9090 \
- -Dcom.sun.management.jmxremote.ssl=false \
- -Dcom.sun.management.jmxremote.authenticate=false \
- -Dcom.sun.management.jmxremote.local.only=false \
- -jar /app/app.jar \
- --spring.config.location="${CONFIG_FILE}"
+ -jar /app/app.jar
+++ /dev/null
-spring:
- security:
- user:
- name: runtimeUser
- password: zb!XztG34
- http:
- converters:
- preferred-json-mapper: gson
- datasource:
- url: jdbc:postgresql://${postgresql.host:postgres}:${postgresql.port:5432}/clampacm
- driverClassName: org.postgresql.jdbc.Driver
- username: policy_user
- password: policy_user
- hikari:
- connectionTimeout: 30000
- idleTimeout: 600000
- maxLifetime: 1800000
- maximumPoolSize: 10
- jpa:
- hibernate:
- ddl-auto: none
- naming:
- physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
- properties:
- hibernate:
- format_sql: true
-
-security:
- enable-csrf: false
-
-server:
- servlet:
- context-path: /onap/policy/clamp/acm
- port: 6969
- error:
- path: /error
-
-runtime:
- topics:
- operationTopic: policy-acruntime-participant
- syncTopic: acm-ppnt-sync
- participantParameters:
- heartBeatMs: 20000
- maxStatusWaitMs: 200000
- topicParameterGroup:
- topicSources:
- -
- topic: ${runtime.topics.operationTopic}
- servers:
- - ${topicServer:kafka:9092}
- topicCommInfrastructure: NOOP
- fetchTimeout: 15000
- useHttps: true
- topicSinks:
- -
- topic: ${runtime.topics.operationTopic}
- servers:
- - ${topicServer:kafka:9092}
- topicCommInfrastructure: NOOP
- useHttps: true
- -
- topic: ${runtime.topics.syncTopic}
- servers:
- - ${topicServer:kafka:9092}
- topicCommInfrastructure: NOOP
- useHttps: true
- acmParameters:
- toscaElementName: org.onap.policy.clamp.acm.AutomationCompositionElement
- toscaCompositionName: org.onap.policy.clamp.acm.AutomationComposition
-
-management:
- endpoints:
- web:
- base-path: /
- exposure:
- include: health, metrics, prometheus
- endpoint:
- health:
- show-details: always
- probes:
- enabled: true
- show-components: always
active: default
security:
user:
- name: runtimeUser
- password: zb!XztG34
+ name: ${RUNTIME_USER}
+ password: ${RUNTIME_PASSWORD}
http:
converters:
preferred-json-mapper: gson
datasource:
- url: jdbc:postgresql://${postgresql.host:localhost}:${postgresql.port:5432}/clampacm
+ url: jdbc:postgresql://${SQL_HOST:localhost}:${SQL_PORT:5432}/clampacm
driverClassName: org.postgresql.Driver
- username: policy
- password: P01icY
+ username: ${SQL_USER}
+ password: ${SQL_PASSWORD}
hikari:
connectionTimeout: 30000
idleTimeout: 600000
runtime:
topics:
- operationTopic: policy-acruntime-participant
- syncTopic: acm-ppnt-sync
+ operationTopic: ${RUNTIME_OPERATION_TOPIC:policy-acruntime-participant}
+ syncTopic: ${RUNTIME_SYNC_TOPIC:acm-ppnt-sync}
participantParameters:
- heartBeatMs: 20000
- maxStatusWaitMs: 150000
- maxOperationWaitMs: 200000
+ heartBeatMs: ${HEART_BEAT:120000}
+ maxStatusWaitMs: ${MAX_STATUS_WAIT:150000}
+ maxOperationWaitMs: ${MAX_OPERATION_WAIT:36000}
topicParameterGroup:
topicSources:
- topic: ${runtime.topics.operationTopic}
servers:
- - ${topicServer:kafka:9092}
- topicCommInfrastructure: NOOP
+ - ${KAFKA_SERVER:kafka:9092}
+ topicCommInfrastructure: ${TOPIC_COMM_INFRASTRUCTURE:NOOP}
fetchTimeout: 15000
+ useHttps: ${KAFKA_USE_HTTPS:false}
+ additionalProps:
+ group.id : ${KAFKA_GROUP_ID:acm-runtime}
+ max.poll.records: ${KAFKA_MAX_POLL_RECORDS:100}
+ max.partition.fetch.bytes: ${KAFKA_MAX_PARTITION_FETCH_BYTES:524288}
+ fetch.max.bytes: ${KAFKA_FETCH_MAX_BYTES:10485760}
+ enable.auto.commit: ${KAFKA_ENABLE_AUTO_COMMIT:true}
+ allow.auto.create.topics: ${KAFKA_ALLOW_AUTO_CREATE_TOPICS:true}
+ security.protocol: ${KAFKA_SECURITY_PROTOCOL:PLAINTEXT}
+ sasl.mechanism: ${KAFKA_SASL_MECHANISM:GSSAPI}
+ sasl.jaas.config: ${KAFKA_SASL_JAAS_CONFIG:}
topicSinks:
- topic: ${runtime.topics.operationTopic}
servers:
- - ${topicServer:kafka:9092}
- topicCommInfrastructure: NOOP
+ - ${KAFKA_SERVER:kafka:9092}
+ topicCommInfrastructure: ${TOPIC_COMM_INFRASTRUCTURE:NOOP}
+ useHttps: ${KAFKA_USE_HTTPS:false}
+ additionalProps:
+ allow.auto.create.topics: ${KAFKA_ALLOW_AUTO_CREATE_TOPICS:true}
+ security.protocol: ${KAFKA_SECURITY_PROTOCOL:PLAINTEXT}
+ sasl.mechanism: ${KAFKA_SASL_MECHANISM:GSSAPI}
+ sasl.jaas.config: ${KAFKA_SASL_JAAS_CONFIG:}
- topic: ${runtime.topics.syncTopic}
servers:
- - ${topicServer:kafka:9092}
- topicCommInfrastructure: NOOP
+ - ${KAFKA_SERVER:kafka:9092}
+ topicCommInfrastructure: ${TOPIC_COMM_INFRASTRUCTURE:NOOP}
+ useHttps: ${KAFKA_USE_HTTPS:false}
+ additionalProps:
+ allow.auto.create.topics: ${KAFKA_ALLOW_AUTO_CREATE_TOPICS:true}
+ security.protocol: ${KAFKA_SECURITY_PROTOCOL:PLAINTEXT}
+ sasl.mechanism: ${KAFKA_SASL_MECHANISM:GSSAPI}
+ sasl.jaas.config: ${KAFKA_SASL_JAAS_CONFIG:}
acmParameters:
- toscaElementName: org.onap.policy.clamp.acm.AutomationCompositionElement
- toscaCompositionName: org.onap.policy.clamp.acm.AutomationComposition
- enableEncryption: true
+ toscaElementName: ${TOSCA_ELEMENT_NAME:org.onap.policy.clamp.acm.AutomationCompositionElement}
+ toscaCompositionName: ${TOSCA_COMPOSITION_NAME:org.onap.policy.clamp.acm.AutomationComposition}
+ enableEncryption: ${MSG_ENABLE_ENCRYPTION:false}
management:
+ server:
+ port: ${PROMETHEUS_PORT:6970}
+ tracing:
+ propagation:
+ produce: ${JAEGER_PRODUCER_TYPE:B3}
+ sampling:
+ probability: ${JAEGER_SAMPLING_PROBABILITY:1.0}
endpoints:
web:
- base-path: /
+ base-path: /actuator
exposure:
include: health, metrics, prometheus
endpoint:
probes:
enabled: true
show-components: always
+ health:
+ db:
+ enabled: false
+
+tracing:
+ enabled: ${ALLOW_TRACING:false}
+ exporter:
+ endpoint: ${TRACING_EXPORTER_ENDPOINT:http://jaeger:4318/v1/traces}
+ protocol: ${TRACING_EXPORTER_PROTOCOL:http}
+ sampler:
+ jaeger-remote:
+ endpoint: ${TRACING_SAMPLER_ENDPOINT:http://jaeger:14250}
+
+basicAuth: ${BASIC_AUTH:true}
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
+ * Copyright (C) 2021-2026 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.onap.policy.common.message.bus.event.TopicEndpoint;
import org.onap.policy.common.message.bus.event.TopicEndpointManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@AutoConfigureObservability
@AutoConfigureWebTestClient
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"management.server.port:"})
@ActiveProfiles("test")
class ActuatorControllerTest {
+ public static final String HEALTH = "/actuator/health";
+ public static final String STATUS_CODE = "$.status.code";
+
@Autowired
private WebTestClient webClient;
@Test
void testGetHealth() {
- webClient.get().uri("/health").accept(APPLICATION_JSON)
+ webClient.get().uri(HEALTH).accept(APPLICATION_JSON)
.exchange().expectStatus().isOk()
- .expectBody().jsonPath("$.status.code").isEqualTo("UP");
+ .expectBody().jsonPath(STATUS_CODE).isEqualTo("UP");
- TopicEndpoint topicEndpoint = TopicEndpointManager.getManager();
+ var topicEndpoint = TopicEndpointManager.getManager();
topicEndpoint.stop();
- webClient.get().uri("/health").accept(APPLICATION_JSON)
+ webClient.get().uri(HEALTH).accept(APPLICATION_JSON)
.exchange().expectStatus().is5xxServerError()
- .expectBody().jsonPath("$.status.code").isEqualTo("DOWN");
+ .expectBody().jsonPath(STATUS_CODE).isEqualTo("DOWN");
topicEndpoint.start();
}
@Test
void testHealthIndicator() {
- TopicEndpoint topicEndpoint = TopicEndpointManager.getManager();
+ var topicEndpoint = TopicEndpointManager.getManager();
topicEndpoint.getNoopTopicSource("policy-acruntime-participant").stop();
- webClient.get().uri("/health").accept(APPLICATION_JSON)
+ webClient.get().uri(HEALTH).accept(APPLICATION_JSON)
.exchange().expectStatus().is5xxServerError()
- .expectBody().jsonPath("$.status.code").isEqualTo("OUT_OF_SERVICE");
+ .expectBody().jsonPath(STATUS_CODE).isEqualTo("OUT_OF_SERVICE");
topicEndpoint.getNoopTopicSource("policy-acruntime-participant").start();
topicEndpoint.getNoopTopicSink("acm-ppnt-sync").stop();
- webClient.get().uri("/health").accept(APPLICATION_JSON)
+ webClient.get().uri(HEALTH).accept(APPLICATION_JSON)
.exchange().expectStatus().is5xxServerError()
- .expectBody().jsonPath("$.status.code").isEqualTo("OUT_OF_SERVICE");
+ .expectBody().jsonPath(STATUS_CODE).isEqualTo("OUT_OF_SERVICE");
topicEndpoint.getNoopTopicSink("acm-ppnt-sync").start();
}
@Test
void testGetMetrics() {
- webClient.get().uri("/metrics").accept(APPLICATION_JSON)
+ webClient.get().uri("/actuator/metrics").accept(APPLICATION_JSON)
.exchange().expectStatus().isOk();
}
@Test
void testGetPrometheus() {
- webClient.get().uri("/prometheus").accept(TEXT_PLAIN)
+ webClient.get().uri("/actuator/prometheus").accept(TEXT_PLAIN)
.exchange().expectStatus().isOk();
}
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2023-2024 Nordix Foundation.
+ * Copyright (C) 2023-2024,2026 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@AutoConfigureObservability(tracing = false)
@ExtendWith(SpringExtension.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {"management.server.port:"})
@ActiveProfiles({"prometheus-noauth", "default"})
class PrometheusNoAuthTest {
@Test
void testGetPrometheus() {
- webClient.get().uri("/prometheus").accept(TEXT_PLAIN)
+ webClient.get().uri("/actuator/prometheus").accept(TEXT_PLAIN)
.exchange().expectStatus().isOk();
}
}
spring:
+ security:
+ user:
+ name: runtimeUser
+ password: zb!XztG34
liquibase:
enabled: true
jpa:
spring:
+ security:
+ user:
+ name: runtimeUser
+ password:
datasource:
url: jdbc:h2:mem:testdb
driverClassName: org.h2.Driver
spring:
+ security:
+ user:
+ name: runtimeUser
+ password: zb!XztG34
datasource:
url: jdbc:h2:mem:testdb
driverClassName: org.h2.Driver