+## License
+
+Copyright (C) 2023 Nordix Foundation. 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.
+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.
+
## RANPM project in docker
A docker compose project showing pm file flow from simulated network elements to filtered pm data.
To update the filter edit and run:
`./update-pmlog.sh`
+### PM rApp
+Additionally you can install PM rApp.
+
+Build PM rApp
+
+`cd ranpm/pm-rapp`
+
+`./build.sh no-push`
+
+Install PM rApp
+
+`cd ranpm/docker-proj`
+
+Example cmd: \
+`./pmrapp-setup.sh`
+
+To remove run:
+`./pmrapp-tear-down.sh`
+
### Tools for monitoring
--- /dev/null
+{
+ "info_type_id": "PmData",
+ "job_owner": "console",
+ "job_definition": {
+ "filter": {
+ "sourceNames": [],
+ "measObjInstIds": [],
+ "measTypeSpecs": [
+ {
+ "measuredObjClass": "NRCellDU",
+ "measTypes": [
+ "pmCounterNumber101"
+ ]
+ }
+ ],
+ "measuredEntityDns": []
+ }
+ }
+}
--- /dev/null
+# ============LICENSE_START===============================================
+# Copyright (C) 2023 Nordix Foundation. 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.
+# 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.
+# ============LICENSE_END=================================================
+#
+
+version: '3.0'
+networks:
+ default:
+ external: true
+ name: nonrtric-docker-net
+
+services:
+ pm-rapp:
+ image: $PMRAPP_IMAGE
+ container_name: pm-rapp
+ environment:
+ APPID: pm-rapp
+ APPNS: 'nonrtric'
+ KAFKA_SERVER: kafka-1:9097
+ ICS: ics:8083
+ TOPIC: rapp-topic
+ LOG_PAYLOAD: '1'
+ GZIP: ''
+ CREDS_GRANT_TYPE: client_credentials
+ CREDS_CLIENT_SECRET: $PMRAPP_CLIENT_SECRET
+ CREDS_CLIENT_ID: pm-rapp
+ volumes:
+ - ./config/pmrapp:/config
+ labels:
+ - "ranpm=yes"
+ - "ranpmrapp=yes"
--- /dev/null
+#!/bin/bash
+
+# ============LICENSE_START===============================================
+# Copyright (C) 2023 Nordix Foundation. 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.
+# 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.
+# ============LICENSE_END=================================================
+#
+
+. scripts/get_influxdb2_token.sh
+. scripts/populate_keycloak.sh
+
+print_usage() {
+ echo "Usage: pmrapp-setup.sh"
+ exit 1
+}
+
+check_error() {
+ if [ $1 -ne 0 ]; then
+ echo "Failed $2"
+ echo "Exiting..."
+ exit 1
+ fi
+}
+
+setup_init() {
+echo "Cleaning previously started containers..."
+./pmrapp-tear-down.sh
+}
+
+check_images(){
+export PMRAPP_IMAGE="pm-rapp:latest"
+}
+
+create_topic() {
+TOPIC="rapp-topic"
+retcode=1
+rt=43200000
+echo "Creating topic $TOPIC with retention $(($rt/1000)) seconds"
+while [ $retcode -ne 0 ]; do
+ cmd_output=$(docker exec -it common-kafka-1-1 ./bin/kafka-topics.sh \
+ --create --topic $TOPIC --config retention.ms=$rt --bootstrap-server kafka-1:9092)
+ retcode=$?
+ test_string="Topic 'rapp-topic' already exists"
+ if [[ $cmd_output == *${test_string}* ]]; then
+ echo $test_string
+ retcode=0
+ fi
+done
+}
+
+setup_pmrapp() {
+create_topic
+
+cid="pm-rapp"
+create_clients nonrtric-realm $cid
+check_error $?
+generate_client_secrets nonrtric-realm $cid
+check_error $?
+
+export PMRAPP_CLIENT_SECRET=$(< .sec_nonrtric-realm_$cid)
+envsubst < docker-compose-pmrapp.yaml > docker-compose-pmrapp_gen.yaml
+docker-compose -p pmrapp -f docker-compose-pmrapp_gen.yaml up -d
+}
+## Main ##
+setup_init
+
+check_images
+
+setup_pmrapp
+check_error $?
--- /dev/null
+#!/bin/bash
+
+# ============LICENSE_START===============================================
+# Copyright (C) 2023 Nordix Foundation. 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.
+# 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.
+# ============LICENSE_END=================================================
+#
+
+echo "Stop and remove all pm-rapp containers in the project"
+
+docker stop $(docker ps -qa --filter "label=ranpmrapp") 2> /dev/null
+docker stop $(docker ps -qa --filter "label=ranpmrapp") 2> /dev/null
+docker rm -f $(docker ps -qa --filter "label=ranpmrapp") 2> /dev/null
+
+docker-compose -f docker-compose-pmrapp_gen.yaml -p pmrapp down
{
- "info_type_id": "json-file-data-from-filestore",
+ "info_type_id": "PmData",
"job_owner": "console",
"status_notification_uri": "http://callback.nonrtric:80/post",
"job_definition": {
- "kafkaOutputTopic": "",
- "filterType": "pmdata",
"filter": {
- "measTypes": [
- "pmCounterNumber101"
- ]
+ "sourceNames": [],
+ "measObjInstIds": [],
+ "measTypeSpecs": [
+ {
+ "measuredObjClass": "NRCellDU",
+ "measTypes": [
+ "pmCounterNumber101"
+ ]
+ }
+ ],
+ "measuredEntityDns": []
}
}
-}
\ No newline at end of file
+}
type JobDefinition struct {
InfoTypeID string `json:"info_type_id"`
JobOwner string `json:"job_owner"`
- JobResultURI string `json:"job_result_uri"`
+ StatusNotificationURI string `json:"status_notification_uri"`
JobDefinition struct {
- KafkaOutputTopic string `json:"kafkaOutputTopic"`
- FilterType string `json:"filterType"`
Filter json.RawMessage `json:"filter"`
DeliveryInfo struct {
Topic string `json:"topic"`
os.Exit(1)
}
job_type := job_json.InfoTypeID
- job_json.JobDefinition.KafkaOutputTopic = topic
job_json.JobDefinition.DeliveryInfo.Topic = topic
job_json.JobDefinition.DeliveryInfo.BootStrapServers = bootstrapserver
- gid = "pm-rapp-" + job_type + "-" + rapp_id
+ gid = "pm-rapp-" + job_type + "-" + rapp_id
- jobid = "rapp-job-" + job_type + "-" + rapp_id
+ jobid = "rapp-job-" + job_type + "-" + rapp_id
json_bytes, err := json.Marshal(job_json)
if err != nil {