summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2021-12-03 11:27:32 +0000
committera.sreekumar <ajith.sreekumar@bell.ca>2021-12-14 17:58:20 +0000
commit4694c152f69380f4d3d64bde0a13d15fb59a71f3 (patch)
tree38c9e0b1117323c58536706a66830109225d6200 /packages
parentc51fa0d4e953518571a115af4afdea80a17ed605 (diff)
Migrate pap startup & controllers to spring boot
This commit migrates pap config, startup and controllers to spring boot. Change-Id: Icf91d728160a23db614dfba6b40ddccd2f6163a5 Issue-ID: POLICY-3754 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'packages')
-rw-r--r--packages/policy-pap-docker/pom.xml8
-rw-r--r--packages/policy-pap-docker/src/main/docker/Dockerfile8
-rw-r--r--packages/policy-pap-docker/src/main/docker/policy-pap.sh18
-rw-r--r--packages/policy-pap-tarball/src/main/package/tarball/assembly.xml2
-rw-r--r--packages/policy-pap-tarball/src/main/resources/etc/defaultConfig.json84
-rw-r--r--packages/policy-pap-tarball/src/main/resources/etc/papParameters.yaml84
6 files changed, 110 insertions, 94 deletions
diff --git a/packages/policy-pap-docker/pom.xml b/packages/policy-pap-docker/pom.xml
index 6e6a66e3..2de149e0 100644
--- a/packages/policy-pap-docker/pom.xml
+++ b/packages/policy-pap-docker/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2019 Nordix Foundation.
- Modifications Copyright (C) 2020 Bell Canada.
+ Modifications Copyright (C) 2020-2021 Bell Canada.
Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
@@ -96,6 +96,12 @@
<outputDirectory>/lib</outputDirectory>
<outputFileNameMapping>policy-pap.tar.gz</outputFileNameMapping>
</dependencySet>
+ <dependencySet>
+ <includes>
+ <include>org.onap.policy.pap:pap-main</include>
+ </includes>
+ <outputFileNameMapping>pap.jar</outputFileNameMapping>
+ </dependencySet>
</dependencySets>
</inline>
</assembly>
diff --git a/packages/policy-pap-docker/src/main/docker/Dockerfile b/packages/policy-pap-docker/src/main/docker/Dockerfile
index 337352fe..36205643 100644
--- a/packages/policy-pap-docker/src/main/docker/Dockerfile
+++ b/packages/policy-pap-docker/src/main/docker/Dockerfile
@@ -2,6 +2,7 @@
# Dockerfile
# ============LICENSE_START=======================================================
# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -31,14 +32,17 @@ ENV POLICY_HOME=$POLICY_HOME/pap
RUN mkdir -p $POLICY_HOME $POLICY_LOGS $POLICY_HOME/bin && \
chown -R policy:policy $POLICY_HOME $POLICY_LOGS && \
mkdir /packages
-COPY /maven/* /packages
+COPY /maven/lib/policy-pap.tar.gz /packages
+
RUN tar xvfz /packages/policy-pap.tar.gz --directory $POLICY_HOME \
&& rm /packages/policy-pap.tar.gz
WORKDIR $POLICY_HOME
COPY policy-pap.sh bin/.
+COPY /maven/pap.jar /app
+
-RUN chown -R policy:policy * && chmod 755 bin/*.sh
+RUN chown -R policy:policy * && chmod 755 bin/*.sh && chown -R policy:policy /app
USER policy
WORKDIR $POLICY_HOME/bin
diff --git a/packages/policy-pap-docker/src/main/docker/policy-pap.sh b/packages/policy-pap-docker/src/main/docker/policy-pap.sh
index 26e69503..a276e34f 100644
--- a/packages/policy-pap-docker/src/main/docker/policy-pap.sh
+++ b/packages/policy-pap-docker/src/main/docker/policy-pap.sh
@@ -3,6 +3,7 @@
# ============LICENSE_START=======================================================
# Copyright (C) 2019-2020 Nordix Foundation.
# Modifications Copyright (C) 2019-2021 AT&T Intellectual Property.
+# Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -32,8 +33,10 @@ else
CONFIG_FILE=${CONFIG_FILE}
fi
+touch /app/pap.jar
+
if [ -z "$CONFIG_FILE" ]; then
- CONFIG_FILE="${POLICY_HOME}/etc/defaultConfig.json"
+ CONFIG_FILE="${POLICY_HOME}/etc/papParameters.yaml"
fi
echo "Policy pap config file: $CONFIG_FILE"
@@ -59,14 +62,15 @@ fi
# to load a default group.
if [ -f "${POLICY_HOME}/etc/mounted/groups.json" ]; then
- CUSTOM_GROUPS="-g ${POLICY_HOME}/etc/mounted/groups.json"
+ CUSTOM_GROUPS="${POLICY_HOME}/etc/mounted/groups.json"
fi
-$JAVA_HOME/bin/java -cp "${POLICY_HOME}/etc:${POLICY_HOME}/lib/*" \
+$JAVA_HOME/bin/java \
-Dlogback.configurationFile="${POLICY_HOME}/etc/logback.xml" \
- -Djavax.net.ssl.keyStore="${KEYSTORE}" \
- -Djavax.net.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
+ -Dserver.ssl.key-store="${KEYSTORE}" \
+ -Dserver.ssl.key-store-password="${KEYSTORE_PASSWD}" \
-Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
- org.onap.policy.pap.main.startstop.Main \
- -c "${CONFIG_FILE}" ${CUSTOM_GROUPS}
+ -jar /app/pap.jar \
+ --spring.config.location="${CONFIG_FILE}" \
+ --group-config-file="${CUSTOM_GROUPS}"
diff --git a/packages/policy-pap-tarball/src/main/package/tarball/assembly.xml b/packages/policy-pap-tarball/src/main/package/tarball/assembly.xml
index 9a4e018f..72830bcb 100644
--- a/packages/policy-pap-tarball/src/main/package/tarball/assembly.xml
+++ b/packages/policy-pap-tarball/src/main/package/tarball/assembly.xml
@@ -2,6 +2,7 @@
============LICENSE_START=======================================================
Copyright (C) 2019 Nordix Foundation.
Modifications Copyright (C) 2019 AT&T Intellectual Property.
+ Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -44,6 +45,7 @@
<include>*.json</include>
<include>*.properties</include>
<include>*.xml</include>
+ <include>*.yaml</include>
</includes>
<outputDirectory>${file.separator}etc</outputDirectory>
<lineEnding>unix</lineEnding>
diff --git a/packages/policy-pap-tarball/src/main/resources/etc/defaultConfig.json b/packages/policy-pap-tarball/src/main/resources/etc/defaultConfig.json
deleted file mode 100644
index c350e16c..00000000
--- a/packages/policy-pap-tarball/src/main/resources/etc/defaultConfig.json
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- "name": "PapGroup",
- "restServerParameters": {
- "host": "0.0.0.0",
- "port": 6969,
- "userName": "policyadmin",
- "password": "zb!XztG34",
- "https": true,
- "aaf": false,
- "prometheus": true
- },
- "pdpParameters": {
- "heartBeatMs": 120000,
- "updateParameters": {
- "maxRetryCount": 1,
- "maxWaitMs": 30000
- },
- "stateChangeParameters": {
- "maxRetryCount": 1,
- "maxWaitMs": 30000
- }
- },
- "databaseProviderParameters": {
- "name": "PolicyProviderParameterGroup",
- "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
- "databaseDriver": "org.mariadb.jdbc.Driver",
- "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin",
- "databaseUser": "policy_user",
- "databasePassword": "policy_user",
- "persistenceUnit": "PolicyMariaDb"
- },
- "savePdpStatisticsInDb": true,
- "topicParameterGroup": {
- "topicSources" : [{
- "topic" : "POLICY-PDP-PAP",
- "servers" : [ "message-router" ],
- "topicCommInfrastructure" : "dmaap",
- "fetchTimeout": 15000
- },
- {
- "topic" : "POLICY-HEARTBEAT",
- "effectiveTopic": "POLICY-PDP-PAP",
- "consumerGroup": "policy-pap",
- "servers" : [ "message-router" ],
- "topicCommInfrastructure" : "dmaap",
- "fetchTimeout": 15000
- }],
- "topicSinks" : [{
- "topic" : "POLICY-PDP-PAP",
- "servers" : [ "message-router" ],
- "topicCommInfrastructure" : "dmaap"
- },
- {
- "topic" : "POLICY-NOTIFICATION",
- "servers" : [ "message-router" ],
- "topicCommInfrastructure" : "dmaap"
- }]
- },
- "healthCheckRestClientParameters":[{
- "clientName": "api",
- "hostname": "policy-api",
- "port": 6969,
- "userName": "policyadmin",
- "password": "zb!XztG34",
- "useHttps": true,
- "basePath": "policy/api/v1/healthcheck"
- },
- {
- "clientName": "distribution",
- "hostname": "policy-distribution",
- "port": 6969,
- "userName": "healthcheck",
- "password": "zb!XztG34",
- "useHttps": true,
- "basePath": "healthcheck"
- },
- {
- "clientName": "dmaap",
- "hostname": "message-router",
- "port": 3905,
- "useHttps": true,
- "basePath": "topics"
- }]
-}
diff --git a/packages/policy-pap-tarball/src/main/resources/etc/papParameters.yaml b/packages/policy-pap-tarball/src/main/resources/etc/papParameters.yaml
new file mode 100644
index 00000000..8c907a6e
--- /dev/null
+++ b/packages/policy-pap-tarball/src/main/resources/etc/papParameters.yaml
@@ -0,0 +1,84 @@
+spring:
+ security:
+ user:
+ name: policyadmin
+ password: zb!XztG34
+ http:
+ converters:
+ preferred-json-mapper: gson
+
+server:
+ port: 6969
+ ssl:
+ enabled: false
+
+pap:
+ name: PapGroup
+ pdpParameters:
+ heartBeatMs: 120000
+ updateParameters:
+ maxRetryCount: 1
+ maxWaitMs: 30000
+ stateChangeParameters:
+ maxRetryCount: 1
+ maxWaitMs: 30000
+ databaseProviderParameters:
+ name: PolicyProviderParameterGroup
+ implementation: org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl
+ databaseDriver: org.mariadb.jdbc.Driver
+ databaseUrl: jdbc:mariadb://mariadb:3306/policyadmin
+ databaseUser: policy_user
+ databasePassword: policy_user
+ persistenceUnit: PolicyMariaDb
+ savePdpStatisticsInDb: true
+ topicParameterGroup:
+ topicSources:
+ - topic: POLICY-PDP-PAP
+ servers:
+ - message-router
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ - topic: POLICY-HEARTBEAT
+ effectiveTopic: POLICY-PDP-PAP
+ consumerGroup: policy-pap
+ servers:
+ - message-router
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks:
+ - topic: POLICY-PDP-PAP
+ servers:
+ - message-router
+ topicCommInfrastructure: dmaap
+ - topic: POLICY-NOTIFICATION
+ servers:
+ - message-router
+ topicCommInfrastructure: dmaap
+ healthCheckRestClientParameters:
+ - clientName: api
+ hostname: policy-api
+ port: 6969
+ userName: policyadmin
+ password: zb!XztG34
+ useHttps: true
+ basePath: policy/api/v1/healthcheck
+ - clientName: distribution
+ hostname: policy-distribution
+ port: 6969
+ userName: healthcheck
+ password: zb!XztG34
+ useHttps: true
+ basePath: healthcheck
+ - clientName: dmaap
+ hostname: message-router
+ port: 3905
+ useHttps: true
+ basePath: topics
+
+management:
+ endpoints:
+ web:
+ base-path: /
+ exposure:
+ include: health, metrics, prometheus
+ path-mapping.prometheus: metrics