DMaaP Bus Controller Topic and Feed provisioning support via helm
This document highlights design considered for to Provision authenticated, authorized DMaaP topics on Message Router and feeds on Data Router .
Overview
Bus Controller is a RESTful web service used to provision DMaaP topics (on Message Router) and feeds (on Data Router), with associated authorization (on AAF).
Endpoints are used to provision :
Authorized topic on MR, and to create and grant permission for Publishers and Subscribers.
Feed on Data Router, with associated user authentication.
Bus Controller API link : https://docs.onap.org/projects/onap-dmaap-buscontroller/en/latest/apis/api.html
Gerrit review links
Ticket No. | Gerrit link | Comments | 5gbulkpm Test Result | Status |
---|---|---|---|---|
Updated dmaap-dbc script | Pass | Merged | ||
DCAEGEN2-2715 (DCAE Data File Collector) | To be tested with 5gBulkpm gaiting testcase | Pass | Merged | |
DCAEGEN2-2714 (DCAE PM-Mapper) | To be tested with 5gBulkpm gaiting testcase | Pass | Merged |
Dmaap dbc-client docker Image (onap/dmaap/dbc-client:2.0.7)
This dbc-client image is utility (containing shell script) by making use of which we can initiate HTTP REST Request towards Dmaap Bus Controller app for creating dynamic Feeds, Topics.
Design details
Existing design consist fo kubernetes Job Manifest which consist of onap/dmaap/dbc-client docker image for making http request toward dmaap-bc (Dmaap Bus Controller) pod.
In DCAE Design-1 highlighted in below pic is considered where we need to create dmmap provisionning Init-Container which will be making use of same onap/dmaap/dbc-client docker image to make Http Rest Request towards dmap-db pod.
Once the http request is made response will be written back to shared EmptyDir voulme.
Second Init-container (Update Config) will be reading the response from share EmptyDir voulme and will merge it with application config.
Draw.io design-1 :
Dmaap Provisioning init-container sends POST request to Dmaap Bus-Controller Pod for creation of Topics, Feeds.
DCAE Merge init config container merges dcae application config and response received back from dmaap provisioning init-container.
Feed + Dr_pubs _Dr_subs Input via Values.yaml
Data Router Feed, Publisher, Subscriber creation input details.
Old approach-
------------------------------------------
feedConfig:
owner: dcaecm
feedVersion: 0.0
feedName: bulk_pm_feed
asprClassification: unclassified
feedDescription: DFC Feed Creation
pubs:
- username: dcaepub
userpwd: tpJN3gjaAzPAiAa4
dcaeLocationName: loc00
------------------------------------------
New approach-
------------------------------------------
# DataRouter Feed Configuration
drFeedConfig:
- feedName: bulk_pm_feed
owner: dcaecm
feedVersion: 0.0
asprClassification: unclassified
feedDescription: DFC Feed Creation
# DataRouter Publisher Configuration
drPubConfig:
- feedName: bulk_pm_feed
dcaeLocationName: loc00
# DataRouter Subscriber Configuration
drSubConfig:
- feedName: bulk_pm_feed
decompress: true
username: ${DR_USERNAME}
userpwd: ${DR_PASSWORD}
dcaeLocationName: loc00
privilegedSubscriber: true
deliveryURL: https://dcae-pm-mapper:8443/delivery
# MessageRouter Topic, Publisher Configuration
mrTopicsConfig:
- topicName: PERFORMANCE_MEASUREMENTS
topicDescription: PM Mapper publishes perf3gpp VES PM Events to authenticated MR topic
owner: dcaecm
tnxEnabled: false
clients:
- dcaeLocationName: san-francisco
clientRole: org.onap.dcae.pmPublisher
action:
- pub
- view
------------------------------------------
ConfigMap Configuration for Feed, Dr_Publisher
------------------------------------------
volumes:
- name: feeds-config
path: /opt/app/config/feeds/
- name: drpub-config
path: /opt/app/config/dr_pubs/
- name: drsub-config
path: /opt/app/config/dr_subs/
- name: topics-config
path: /opt/app/config/topics
Code snip for updating application config with dmaap DR Feed/Pub/Sub and MR Topics details.
InitContainer Code Snip
- name: {{ include "common.name" $dot }}-init-merge-config
image: {{ include "repositoryGenerator.image.envsubst" $dot }}
imagePullPolicy: {{ $dot.Values.global.pullPolicy | default $dot.Values.pullPolicy }}
command:
- /bin/sh
args:
- -c
- |
if [ -d /opt/app/config/cache ]; then
cd /opt/app/config/cache
for file in $(ls feed*); do
NUM=$(echo "$file" | sed 's/feedConfig-\([0-9]\+\)-resp.json/\1/')
export DR_LOG_URL_"$NUM"="$(grep -o '"logURL":"[^"]*' "$file" | cut -d '"' -f4)"
export DR_FILES_PUBLISHER_URL_"$NUM"="$(grep -o '"publishURL":"[^"]*' "$file" | cut -d '"' -f4)"
done
for file in $(ls drpub*); do
NUM=$(echo "$file" | sed 's/drpubConfig-\([0-9]\+\)-resp.json/\1/')
export DR_USERNAME_"$NUM"="$(grep -o '"username":"[^"]*' "$file" | cut -d '"' -f4)"
export DR_PASSWORD_"$NUM"="$(grep -o '"userpwd":"[^"]*' "$file" | cut -d '"' -f4)"
export DR_FILES_PUBLISHER_ID_"$NUM"="$(grep -o '"pubId":"[^"]*' "$file" | cut -d '"' -f4)"
done
for file in $(ls drsub*); do
NUM=$(echo "$file" | sed 's/drsubConfig-\([0-9]\+\)-resp.json/\1/')
export DR_FILES_SUBSCRIBER_ID_"$NUM"="$(grep -o '"subId":"[^"]*' "$file" | cut -d '"' -f4)"
done
for file in $(ls topics*); do
NUM=$(echo "$file" | sed 's/topicsConfig-\([0-9]\+\)-resp.json/\1/')
export MR_FILES_PUBLISHER_CLIENT_ID_"$NUM"="$(grep -o '"mrClientId":"[^"]*' "$file" | cut -d '"' -f4)"
done
else
echo "No Response logged for Dmaap BusController Http POST Request..!"
fi
cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done
env:
{{- range $cred := $dot.Values.credentials }}
- name: {{ $cred.name }}
{{- include "common.secret.envFromSecretFast" (dict "global" $dot "uid" $cred.uid "key" $cred.key) | nindent 4 }}
{{- end }}
volumeMounts:
- mountPath: /opt/app/config/cache
name: dbc-response-cache
- mountPath: /config-input
name: app-config-input
- mountPath: /config
name: app-config
Container Logs
1. Log snippet collected for dmaap-bc-dmaap-provisioning conatiner making sure it work with updated changes in dbc script.
dmaap-bc-dmaap-provisioning Log
$ kubectl logs -f -n onap dev-dmaap-bc-dmaap-provisioning-n9zfp
+ export 'PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin'
+ RESP_CACHE=
+ RESP=/dev/null
+ APP_ROOT=/opt/app/dbc-client
+ CONFIGMAP_ROOT=/opt/app/config
+ PORT=8443
+ DBC=dmaap-bc
+ PROTO=https
+ PARAM='useExisting=true'
+ REQUESTID=dmaap-bc-dmaap-provisioning
+ URL=https://dmaap-bc:8443/webapi/
+ CA_PEM=ca.pem
+ KEY_PEM=key.pem
+ CLIENT_PEM=client.pem
+ PEM_DIR=/opt/app/osaaf/local
+ CERT_PWD='2U[iOZzMHI:.#tdCwlBqc;}S'
+ BA_PWD='demo123456!'
+ AUTH_METHOD=basicAuth
+ BA_IDENTITY=dmaap-bc@dmaap-bc.onap.org
+ init_config
+ '[' '!' -d /opt/app/dbc-client -a '!' -d /opt/app/config ]
+ cd /opt/app/osaaf/local
+ '[' basicAuth '=' basicAuth ]
+ echo '-u dmaap-bc@dmaap-bc.onap.org:demo123456!'
+ CURL_CRED='-K /opt/app/osaaf/local/curl.cred'
+ init_dbc_provisioning
+ cd /opt/app/config
+ '[' -d dmaap ]
+ ls dmaap/onap.json
+ do_http_post dmaap/onap.json dmaap
+ RETRY_TIME=60
+ '[' -n ]
+ true
+ '[' dmaap '!=' feeds -a dmaap '!=' topics ]
+ cat dmaap/onap.json
+ envsubst
+ json_input='{
"dmaapName": "mr",
"drProvUrl": "https://dmaap-dr-prov",
"version": "1",
"topicNsRoot": "org.onap.dmaap",
"bridgeAdminTopic": "DCAE_MM_AGENT"
}'
+ xcurl -o /dev/null -d '{
"dmaapName": "mr",
"drProvUrl": "https://dmaap-dr-prov",
"version": "1",
"topicNsRoot": "org.onap.dmaap",
"bridgeAdminTopic": "DCAE_MM_AGENT"
}' https://dmaap-bc:8443/webapi/dmaap
+ curl -X POST -s '-K /opt/app/osaaf/local/curl.cred' -w '%{http_code}' -H 'X-ECOMP-RequestID: dmaap-bc-dmaap-provisioning' -H 'Content-Type: application/json' -o /dev/null -d '{
"dmaapName": "mr",
"drProvUrl": "https://dmaap-dr-prov",
"version": "1",
"topicNsRoot": "org.onap.dmaap",
"bridgeAdminTopic": "DCAE_MM_AGENT"
}' https://dmaap-bc:8443/webapi/dmaap
Http Post request is successful with response code=200
+ rc=200
+ '[' 200 '=' 200 -o 200 '=' 201 -o 200 '=' 409 ]
+ echo 'Http Post request is successful with response code=200'
+ break
+ '[' -d dcaeLocations ]
+ ls dcaeLocations/san-francisco.json
+ do_http_post dcaeLocations/san-francisco.json dcaeLocations
+ RETRY_TIME=60
+ '[' -n ]
+ true
+ '[' dcaeLocations '!=' feeds -a dcaeLocations '!=' topics ]
+ cat dcaeLocations/san-francisco.json
+ envsubst
+ json_input='{
"dcaeLayer": "kubernetes-central",
"dcaeLocationName": "san-francisco"
}'
+ xcurl -o /dev/null -d '{
"dcaeLayer": "kubernetes-central",
"dcaeLocationName": "san-francisco"
}' https://dmaap-bc:8443/webapi/dcaeLocations
+ curl -X POST -s '-K /opt/app/osaaf/local/curl.cred' -w '%{http_code}' -H 'X-ECOMP-RequestID: dmaap-bc-dmaap-provisioning' -H 'Content-Type: application/json' -o /dev/null -d '{
"dcaeLayer": "kubernetes-central",
"dcaeLocationName": "san-francisco"
}' https://dmaap-bc:8443/webapi/dcaeLocations
+ rc=201
+ '[' 201 '=' 200 -o 201 '=' 201 -o 201 '=' 409 ]
+ echo 'Http Post request is successful with response code=201'
+ break
+ '[' -d mr_clusters ]
Http Post request is successful with response code=201
+ ls mr_clusters/san-francisco.json
+ do_http_post mr_clusters/san-francisco.json mr_clusters
+ RETRY_TIME=60
+ '[' -n ]
+ true
+ '[' mr_clusters '!=' feeds -a mr_clusters '!=' topics ]
+ cat mr_clusters/san-francisco.json
+ envsubst
+ json_input='{
"dcaeLocationName": "san-francisco",
"fqdn": "message-router",
"topicProtocol": "http",
"topicPort": "3904"
}'
+ xcurl -o /dev/null -d '{
"dcaeLocationName": "san-francisco",
"fqdn": "message-router",
"topicProtocol": "http",
"topicPort": "3904"
}' https://dmaap-bc:8443/webapi/mr_clusters
+ curl -X POST -s '-K /opt/app/osaaf/local/curl.cred' -w '%{http_code}' -H 'X-ECOMP-RequestID: dmaap-bc-dmaap-provisioning' -H 'Content-Type: application/json' -o /dev/null -d '{
"dcaeLocationName": "san-francisco",
"fqdn": "message-router",
"topicProtocol": "http",
"topicPort": "3904"
}' https://dmaap-bc:8443/webapi/mr_clusters
+ rc=201
+ '[' 201 '=' 200 -o 201 '=' 201 -o 201 '=' 409 ]
+ echo 'Http Post request is successful with response code=201'
+ break
+ '[' -d topics ]
Http Post request is successful with response code=201
+ ls topics/PNF_READY.json topics/PNF_REGISTRATION.json topics/mirrormakeragent.json
+ do_http_post topics/PNF_READY.json topics
+ RETRY_TIME=60
+ '[' -n ]
+ true
+ '[' topics '!=' feeds -a topics '!=' topics ]
+ xcurl -o /dev/null -d @topics/PNF_READY.json 'https://dmaap-bc:8443/webapi/topics/?useExisting=true'
+ curl -X POST -s '-K /opt/app/osaaf/local/curl.cred' -w '%{http_code}' -H 'X-ECOMP-RequestID: dmaap-bc-dmaap-provisioning' -H 'Content-Type: application/json' -o /dev/null -d @topics/PNF_READY.json 'https://dmaap-bc:8443/webapi/topics/?useExisting=true'
Http Post request for feed creation is successful with response code=201
+ rc=201
+ '[' 201 '=' 200 -o 201 '=' 201 -o 201 '=' 409 ]
+ echo 'Http Post request for feed creation is successful with response code=201'
+ break
+ do_http_post topics/PNF_REGISTRATION.json topics
+ RETRY_TIME=60
+ '[' -n ]
+ true
+ '[' topics '!=' feeds -a topics '!=' topics ]
+ xcurl -o /dev/null -d @topics/PNF_REGISTRATION.json 'https://dmaap-bc:8443/webapi/topics/?useExisting=true'
+ curl -X POST -s '-K /opt/app/osaaf/local/curl.cred' -w '%{http_code}' -H 'X-ECOMP-RequestID: dmaap-bc-dmaap-provisioning' -H 'Content-Type: application/json' -o /dev/null -d @topics/PNF_REGISTRATION.json 'https://dmaap-bc:8443/webapi/topics/?useExisting=true'
+ rc=201
+ '[' 201 '=' 200 -o 201 '=' 201 -o 201 '=' 409 ]
+ echo 'Http Post request for feed creation is successful with response code=201'
+ break
Http Post request for feed creation is successful with response code=201
+ do_http_post topics/mirrormakeragent.json topics
+ RETRY_TIME=60
+ '[' -n ]
+ true
+ '[' topics '!=' feeds -a topics '!=' topics ]
+ xcurl -o /dev/null -d @topics/mirrormakeragent.json 'https://dmaap-bc:8443/webapi/topics/?useExisting=true'
+ curl -X POST -s '-K /opt/app/osaaf/local/curl.cred' -w '%{http_code}' -H 'X-ECOMP-RequestID: dmaap-bc-dmaap-provisioning' -H 'Content-Type: application/json' -o /dev/null -d @topics/mirrormakeragent.json 'https://dmaap-bc:8443/webapi/topics/?useExisting=true'
Http Post request for feed creation is successful with response code=201
+ rc=201
+ '[' 201 '=' 200 -o 201 '=' 201 -o 201 '=' 409 ]
+ echo 'Http Post request for feed creation is successful with response code=201'
+ break
+ '[' -d mr_clients ]
+ '[' -d dr_nodes ]
+ ls 'dr_nodes/*.json'
ls: dr_nodes/*.json: No such file or directory
+ '[' -d feeds ]
+ ls 'feeds/*.json'
ls: feeds/*.json: No such file or directory
+ '[' -d dr_pubs ]
+ '[' -d dr_subs ]
2. Log snippet from dcae-datafile-collector initContainer dcae-datafile-collector-init-dmaap-provisioning for creation of Feeds and Dr Publisher.
dcae-datafile-collector initContainer dcae-datafile-collector-init-dmaap-provisioning Log
3. Log snippet from dcae-pm-mapper initContainer dcae-pm-mapper-init-dmaap-provisioning for creation of Feeds and Dr Subscriber and MessageRouter Topics.
dcae-pm-mapper initContainer dcae-pm-mapper-init-dmaap-provisioning Log
4. GET Request for DR Feeds, MR Topics from Bus Controller API.
GET Request for Feeds from BusController
Test details
Create Sftp server.
Upload PM Files to xNF SFTP Server.
Send File Ready Event to VES Collector.
Verify Ves Collector logs for Event send to unauthenticated.VES_NOTIFICATION_OUTPUT : Ves Collector log file.
Verify Data File Collector Logs if it contains message > Publishing file A1625946870.67.xml.gz to DR successful! : DFC log file.
Vefify PM-Mapper log if it contains > org.onap.dcaegen2.services.pmmapper.messagerouter.VESPublisher. Successfully published VES events to messagerouter : Pm-Mapper log file.
Verify Message-Router log if it contains Publisher Log Details : [publisherId=dcae, topicId=org.onap.dmaap.mr.PERFORMANCE_MEASUREMENTS, messageTimestamp=null, publisherIp=10.42.6.27, messageBatchId=10072021195549, messageSequence=1, messageLengthInBytes=2530, transactionEnabled=true, transactionId=10-07-2021::07:55:44:917::10.42.6.27::10072021195549::1, publishTimestamp=10-07-2021::07:55:44:918, serverIp=10.42.3.28]
Improvements
Datafile Collector not sending dr publisher credentails as secret.