diff options
12 files changed, 203 insertions, 187 deletions
diff --git a/components/datalake-handler/des/Dockerfile b/components/datalake-handler/des/Dockerfile index 584ba9d6..46683a1d 100644 --- a/components/datalake-handler/des/Dockerfile +++ b/components/datalake-handler/des/Dockerfile @@ -1,6 +1,7 @@ # ============LICENSE_START=================================================== # Copyright (C) 2020 China Mobile. # Copyright (C) 2021 Wipro Limited +# Copyright (C) 2021 Samsung Electronics. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,36 +17,34 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END===================================================== - FROM nexus3.onap.org:10001/onap/integration-java11:8.0.0 -MAINTAINER Kai Lu <lukai@chinamobile.com> +LABEL maintainer="Kai Lu <lukai@chinamobile.com>" + +ARG user=datalake +ARG group=datalake EXPOSE 1681 USER root -RUN addgroup datalake && adduser -G datalake -h /home/datalake -D datalake -RUN mkdir /home/datalake/db_init - -WORKDIR /home/datalake +WORKDIR /datalake +RUN addgroup $group && adduser --system --shell /bin/false --disabled-password --no-create-home --ingroup $group $user && \ + mkdir -p /datalake/db_init && \ + chown -R $user:$group /datalake && \ + chmod g+s /datalake #add the fat jar -COPY target/${JAR_FILE} . -COPY src/assembly/run.sh . -COPY src/assembly/init_db/db_scripts/init_db.sql . -COPY src/assembly/init_db/db_scripts/init_db_data.sql . - -WORKDIR /home/datalake/db_init -ADD src/assembly/init_db/scripts/db_init . - -WORKDIR /home/datalake - -RUN chmod -R 0755 ./* && \ - chown -R datalake:datalake /home/datalake - -RUN apk --update add postgresql-client curl - -USER datalake - -ENTRYPOINT /home/datalake/run.sh +COPY --chown=$user:$group target/${JAR_FILE} . +COPY --chown=$user:$group src/assembly/run.sh . +COPY --chown=$user:$group src/assembly/init_db/db_scripts/init_db.sql . +COPY --chown=$user:$group src/assembly/init_db/db_scripts/init_db_data.sql . +COPY --chown=$user:$group src/assembly/init_db/scripts/db_init ./db_init/ + +RUN chmod -R 0755 *.sql && \ + chmod u+x run.sh && \ + apk add --no-cache postgresql-client curl + +USER $user +ENTRYPOINT ["/bin/sh"] +CMD ["run.sh"] diff --git a/components/datalake-handler/des/pom.xml b/components/datalake-handler/des/pom.xml index e23c0c72..4beba3ce 100644 --- a/components/datalake-handler/des/pom.xml +++ b/components/datalake-handler/des/pom.xml @@ -313,6 +313,14 @@ </dependency> </dependencies> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> </plugins> </build> </project> diff --git a/components/datalake-handler/des/src/assembly/run.sh b/components/datalake-handler/des/src/assembly/run.sh index e6df159d..c8014d2a 100644 --- a/components/datalake-handler/des/src/assembly/run.sh +++ b/components/datalake-handler/des/src/assembly/run.sh @@ -28,7 +28,7 @@ sh db_init/20_db-initdb echo "finish init db" -cmd=`find . -name des*-execute.jar` +cmd=`find . -name "des*-execute.jar"` if [ -n "$cmd" ]; then java -jar "$cmd" else diff --git a/components/datalake-handler/feeder/Dockerfile b/components/datalake-handler/feeder/Dockerfile index 9d79f7ef..769d21b8 100644 --- a/components/datalake-handler/feeder/Dockerfile +++ b/components/datalake-handler/feeder/Dockerfile @@ -1,31 +1,31 @@ FROM nexus3.onap.org:10001/onap/integration-java11:8.0.0 -MAINTAINER Guobiao Mo <guobiaomo@chinamobile.com> +LABEL maintainer="Guobiao Mo <guobiaomo@chinamobile.com>" + +ARG user=datalake +ARG group=datalake EXPOSE 1680 USER root -RUN addgroup datalake && adduser -G datalake -h /home/datalake -D datalake -RUN mkdir /home/datalake/db_init - -WORKDIR /home/datalake +WORKDIR /datalake +RUN addgroup $group && adduser --system --shell /bin/false --disabled-password --no-create-home --ingroup $group $user && \ + chown -R $user:$group /datalake && \ + chmod g+s /datalake && \ + mkdir -p /datalake/db_init #add the fat jar -COPY target/${JAR_FILE} /home/datalake/ -COPY src/assembly/run.sh /home/datalake/ - -WORKDIR /home/datalake/db_init -ADD src/assembly/init_db/scripts/db_init . -WORKDIR /home/datalake -COPY src/assembly/init_db/db_scripts/init_db.sql . -COPY src/assembly/init_db/db_scripts/init_db_data.sql . - -RUN chmod -R 0755 ./* && \ - chown -R datalake:datalake /home/datalake - -RUN apk --update add postgresql-client curl - -USER datalake - -ENTRYPOINT /home/datalake/run.sh +COPY --chown=$user:$group target/${JAR_FILE} . +COPY --chown=$user:$group src/assembly/run.sh . +COPY --chown=$user:$group src/assembly/init_db/scripts/db_init ./db_init/ +COPY --chown=$user:$group src/assembly/init_db/db_scripts/init_db.sql . +COPY --chown=$user:$group src/assembly/init_db/db_scripts/init_db_data.sql . + +RUN chmod -R 0755 *.sql && \ + chmod u+x run.sh && \ + apk add --no-cache postgresql-client curl + +USER $user +ENTRYPOINT ["/bin/sh"] +CMD ["run.sh"] diff --git a/components/datalake-handler/feeder/src/assembly/run.sh b/components/datalake-handler/feeder/src/assembly/run.sh index 0cef6b48..cb89a1de 100644 --- a/components/datalake-handler/feeder/src/assembly/run.sh +++ b/components/datalake-handler/feeder/src/assembly/run.sh @@ -9,8 +9,9 @@ sh db_init/20_db-initdb echo "finish init db" -cmd=`find . -name feeder*-exec.jar` -cmd1=`find . -regex '\./feeder-[0-9]+\.[0-9]+\.[0-9]+\-exec.jar'` +cmd=`find . -name "*.jar" | grep -E '.*(feeder)-([0-9]+\.[0-9]+\.[0-9]+)(-SNAPSHOT)(-exec\.jar)$'` +cmd1=`find . -name "*.jar" | grep -E '.*(feeder)-([0-9]+\.[0-9]+\.[0-9]+)(-exec.jar)$'` + if [ -n "$cmd" ]; then java -jar $cmd elif [ -n "$cmd1" ]; then diff --git a/components/pm-subscription-handler/Changelog.md b/components/pm-subscription-handler/Changelog.md index 91900070..be2a7a73 100755 --- a/components/pm-subscription-handler/Changelog.md +++ b/components/pm-subscription-handler/Changelog.md @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [1.3.1] +### Changed +* Updated Subscription object retrieving key from App Config data (DCAEGEN2-2713) + +## [1.3.0] +### Changed +* Change pmsh baseOS img to integration (DCAEGEN2-2420) + ## [1.2.0] ### Changed * Bug fix prevent sub threads from crashing permanently (DCAEGEN2-2501) diff --git a/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py b/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py index a5fc86e6..9ddff315 100755 --- a/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py +++ b/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py @@ -88,7 +88,7 @@ class AppConfig: self.operational_policy_name = conf['config'].get('operational_policy_name') self.control_loop_name = conf['config'].get('control_loop_name') self.sub_schema = _load_sub_schema_from_file() - self.subscription = Subscription(**conf['policy']['subscription']) + self.subscription = Subscription(**conf['config']['pmsh_policy']['subscription']) self.nf_filter = None def __new__(cls, *args, **kwargs): @@ -141,7 +141,7 @@ class AppConfig: """ try: app_conf = self._get_pmsh_config() - self.subscription = Subscription(**app_conf['policy']['subscription']) + self.subscription = Subscription(**app_conf['config']['pmsh_policy']['subscription']) logger.info("AppConfig data has been refreshed") except Exception: logger.error('Failed to refresh PMSH AppConfig') diff --git a/components/pm-subscription-handler/pom.xml b/components/pm-subscription-handler/pom.xml index d4f7eaf1..fbf44977 100644 --- a/components/pm-subscription-handler/pom.xml +++ b/components/pm-subscription-handler/pom.xml @@ -32,7 +32,7 @@ <groupId>org.onap.dcaegen2.services</groupId> <artifactId>pmsh</artifactId> <name>dcaegen2-services-pm-subscription-handler</name> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.1-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <sonar.sources>.</sonar.sources> diff --git a/components/pm-subscription-handler/setup.py b/components/pm-subscription-handler/setup.py index 6a2ef242..e4d31332 100644 --- a/components/pm-subscription-handler/setup.py +++ b/components/pm-subscription-handler/setup.py @@ -21,7 +21,7 @@ from setuptools import setup, find_packages setup( name="pm_subscription_handler", - version="1.2.0", + version="1.3.1", packages=find_packages(), author="lego@est.tech", author_email="lego@est.tech", diff --git a/components/pm-subscription-handler/tests/data/cbs_data_1.json b/components/pm-subscription-handler/tests/data/cbs_data_1.json index 2e405d09..f872bb50 100644 --- a/components/pm-subscription-handler/tests/data/cbs_data_1.json +++ b/components/pm-subscription-handler/tests/data/cbs_data_1.json @@ -1,78 +1,78 @@ { - "policy":{ - "subscription":{ - "subscriptionName":"ExtraPM-All-gNB-R2B", - "administrativeState":"UNLOCKED", - "fileBasedGP":15, - "fileLocation":"\/pm\/pm.xml", - "nfFilter":{ - "nfNames":[ - "^pnf.*", - "^vnf.*" - ], - "modelInvariantIDs": [ - - ], - "modelVersionIDs": [ - - ], - "modelNames": [ - - ] - }, - "measurementGroups":[ - { - "measurementGroup":{ - "measurementTypes":[ - { - "measurementType":"countera" - }, - { - "measurementType":"counterb" - } - ], - "managedObjectDNsBasic":[ - { - "DN":"dna" - }, - { - "DN":"dnb" - } - ] - } - }, - { - "measurementGroup":{ - "measurementTypes":[ - { - "measurementType":"counterc" - }, - { - "measurementType":"counterd" - } - ], - "managedObjectDNsBasic":[ - { - "DN":"dnc" - }, - { - "DN":"dnd" - } - ] - } - } - ] - } - }, "config":{ - "control_loop_name": "pmsh-control-loop", - "operational_policy_name": "pmsh-operational-policy", + "control_loop_name":"pmsh-control-loop", + "operational_policy_name":"pmsh-operational-policy", "aaf_password":"demo123456!", "aaf_identity":"dcae@dcae.onap.org", "cert_path":"/opt/app/pmsh/etc/certs/cert.pem", "key_path":"/opt/app/pmsh/etc/certs/key.pem", "ca_cert_path":"/opt/app/pmsh/etc/certs/cacert.pem", "enable_tls":"true", + "pmsh_policy":{ + "subscription":{ + "subscriptionName":"ExtraPM-All-gNB-R2B", + "administrativeState":"UNLOCKED", + "fileBasedGP":15, + "fileLocation":"\/pm\/pm.xml", + "nfFilter":{ + "nfNames":[ + "^pnf.*", + "^vnf.*" + ], + "modelInvariantIDs":[ + + ], + "modelVersionIDs":[ + + ], + "modelNames":[ + + ] + }, + "measurementGroups":[ + { + "measurementGroup":{ + "measurementTypes":[ + { + "measurementType":"countera" + }, + { + "measurementType":"counterb" + } + ], + "managedObjectDNsBasic":[ + { + "DN":"dna" + }, + { + "DN":"dnb" + } + ] + } + }, + { + "measurementGroup":{ + "measurementTypes":[ + { + "measurementType":"counterc" + }, + { + "measurementType":"counterd" + } + ], + "managedObjectDNsBasic":[ + { + "DN":"dnc" + }, + { + "DN":"dnd" + } + ] + } + } + ] + } + }, "streams_subscribes":{ "aai_subscriber":{ "type":"message_router", diff --git a/components/pm-subscription-handler/tests/data/cbs_invalid_data.json b/components/pm-subscription-handler/tests/data/cbs_invalid_data.json index 92da2b9c..a6f63680 100644 --- a/components/pm-subscription-handler/tests/data/cbs_invalid_data.json +++ b/components/pm-subscription-handler/tests/data/cbs_invalid_data.json @@ -1,77 +1,77 @@ { - "policy":{ - "subscription":{ - "subscriptionName":"ExtraPM-All-gNB-R2B", - "administrativeState":"UNLOCKED", - "fileBasedGP":15, - "fileLocation":"\/pm\/pm.xml", - "nfFilter":{ - "nfNames":[ - - ], - "modelInvariantIDs": [ - - ], - "modelVersionIDs": [ - - ], - "modelNames": [ - - ] - }, - "measurementGroups":[ - { - "measurementGroup":{ - "measurementTypes":[ - { - "measurementType":"countera" - }, - { - "measurementType":"counterb" - } - ], - "managedObjectDNsBasic":[ - { - "DN":"dna" - }, - { - "DN":"dnb" - } - ] - } - }, - { - "measurementGroup":{ - "measurementTypes":[ - { - "measurementType":"counterc" - }, - { - "measurementType":"counterd" - } - ], - "managedObjectDNsBasic":[ - { - "DN":"dnc" - }, - { - "DN":"dnd" - } - ] - } - } - ] - } - }, "config":{ - "control_loop_name": "pmsh-control-loop", - "operational_policy_name": "pmsh-operational-policy", + "control_loop_name":"pmsh-control-loop", + "operational_policy_name":"pmsh-operational-policy", "aaf_password":"demo123456!", "aaf_identity":"dcae@dcae.onap.org", "cert_path":"/opt/app/pmsh/etc/certs/cert.pem", "key_path":"/opt/app/pmsh/etc/certs/key.pem", "ca_cert_path":"/opt/app/pmsh/etc/certs/cacert.pem", "enable_tls":"true", + "pmsh_policy":{ + "subscription":{ + "subscriptionName":"ExtraPM-All-gNB-R2B", + "administrativeState":"UNLOCKED", + "fileBasedGP":15, + "fileLocation":"\/pm\/pm.xml", + "nfFilter":{ + "nfNames":[ + + ], + "modelInvariantIDs":[ + + ], + "modelVersionIDs":[ + + ], + "modelNames":[ + + ] + }, + "measurementGroups":[ + { + "measurementGroup":{ + "measurementTypes":[ + { + "measurementType":"countera" + }, + { + "measurementType":"counterb" + } + ], + "managedObjectDNsBasic":[ + { + "DN":"dna" + }, + { + "DN":"dnb" + } + ] + } + }, + { + "measurementGroup":{ + "measurementTypes":[ + { + "measurementType":"counterc" + }, + { + "measurementType":"counterd" + } + ], + "managedObjectDNsBasic":[ + { + "DN":"dnc" + }, + { + "DN":"dnd" + } + ] + } + } + ] + } + }, "streams_subscribes":{ "aai_subscriber":{ "type":"message_router", diff --git a/components/pm-subscription-handler/version.properties b/components/pm-subscription-handler/version.properties index 7d6815b1..fee49286 100644 --- a/components/pm-subscription-handler/version.properties +++ b/components/pm-subscription-handler/version.properties @@ -1,6 +1,6 @@ major=1 minor=3 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT |