You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

References

Assumptions

Issues & Decisions

#IssueNotesDecisions
1What dataspace and anchor to use?

Dataspace: NCMP-Admin 

Anchor: AVC-Subscriptions

2How do we load the data ( not using cps-core / not using Liquibase )?

Options

  1. Liquibase steps in CPS-Core (not preferred, adds to Technical Debt)
  2. Add Liquibase to NCMP (possible but would make NMCP install aware/dependent on Postgres)
  3. Startup Hooks that trigger CPS-Admin (rest or Java) interface calls
    1. Helm 
    2. Springboot
  4. Use of native SQL in an init container that runs after Liquibase (assumption: Liquibase runs from an init container)

Need to discuss with stakeholders re. Priority and Cost


Tony: Preference over native SQL in an init container

3

Predicate details are unclear at the moment. Which component(s) processes the predicates?! Device, DMI-Plugin and or NCMP


Predicate Example
"datastore": “passthrough-operational",  (O)
                "datastore-xpath-filter" : "//_3gpp-nr-nrm-nbdufunction:GNBDUFunction/ 
                       _3gpp-nr-nrm-nrcelldu:NRCellDU/ | //_3gpp-nr-nrm-gnbcuupfunction:GNBCUUPFunction// |
                      //_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction/_3gpp-nr-nrm-nrcelldu:NRCellCU// |
                     //_3gpp-nr-nrm-nrsectorcarrier:NRSectorCarrier//”


kieran mccarthy  confirmed that predicates is not to be included in the data infromation to be stored, hence not part of the YANG model to be defined.

Background

NCMP wil need to store which subscriptions are current for each cm-handle

  • Dataspace: NCMP-Admin (existing)
  • Anchor: AVC-Subscriptions (new)
  • Top level list Container?! (if need wrap in a top-level container)
    • CONTAINER: subscription-registry
      • LIST: subscription[@clientId=AppB and @name=mySubscription]
        • LEAF: clientId (leaf)
        • LEAF: name
        • LEAF: topic
        • LEAF: isTagged

YANG model

The following yang model will be used to store the payload information of subscription data

Subscription YANG model
module subscription {
    yang-version 1.1;
    namespace "org:onap:ncmp:subscription";

    revision "2022-10-12" {
        description
        "NCMP subscription model";
    }

    container subscription-registry {
        
        list subscription {
            key "clientID clientName";

            leaf clientID {
                type string;
            }

            leaf clientName {
                type string;
            }

            leaf topic {
                type string;
            }

            leaf isTagged {
                type boolean;
            }
        }
    }
}



Onboarding via docker container

Starting CPS requires running the project via a docker-compose file wherein the following services/containers are set up:

  • postgres database
  • cps-and-ncmp
  • zookeeper
  • kafka
  • ncmp-dmi-plugin

Adding a new container 'init-db' to run a script file that calls psql (postgres) and curl commands to upload the new YANG model:

  • docker-compose configuration of 'init-db' service
  init-db:
    build: ./initfile
    environment:
      POSTGRES_USER: ${DB_USERNAME:-cps}
      POSTGRES_PASSWORD: ${DB_PASSWORD:-cps}
    volumes:
      - ./initfile:/docker-entrypoint-initdb.d/
      - ./model:/model/
    depends_on:
      db:
        condition: service_healthy
      cps-and-ncmp:
        condition: service_started
    • build - creates from the Dockerfile created which is based on postgres and added curl
    • environment - mandatory config values for postgres image; added same config values as the main Postgres DB used by cps
    • volumes : folders located inside cps project's docker-compose folder
      • -initfile: contains the bash script and Dockerfile; mounted on ENTRYPOINT

-POC: 'initprojecct.sh'

#!/bin/bash

true=t
echo "Getting ready to upload model for subscription events"

while :
do
  sleep 30
  echo "Checking that NCMP dataspace and anchor exist ..."
  ncmpDataspaceExists=$(psql -h db -d cpsdb -U cps -t -c "SELECT EXISTS (SELECT FROM public.dataspace WHERE name = 'NCMP-Admin');")
  ncmpAnchorExists=$(psql -h db -d cpsdb -U cps -t -c "SELECT EXISTS (SELECT FROM public.anchor WHERE name = 'ncmp-dmi-registry');")

  echo "NCMP dataspace exist: $ncmpDataspaceExists"
  echo "NCMP anchor exist: $ncmpAnchorExists"
  echo "$ncmpDataspaceExists == $true and $ncmpAnchorExists == $true"

  if [ $ncmpDataspaceExists == $true ] && [ $ncmpAnchorExists == $true ]
  then
    echo "Uploading model ..."

    cpsAndNcmpAsHostAddress=$(ping -c1 cps-and-ncmp | sed -nE 's/^PING[^(]+\(([^)]+)\).*/\1/p')

    curl -X 'POST' -i 'http://'"$cpsAndNcmpAsHostAddress"':8080/cps/api/v2/dataspaces?dataspace-name=my-dataspace' -H 'accept: */*' --header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE='
    curl -X 'POST' 'http://'"$cpsAndNcmpAsHostAddress"':8080/cps/api/v2/dataspaces/my-dataspace/schema-sets?schema-set-name=my-schema-set' -H 'accept: */*' --form "file=@"/model/subscription.yang"" --header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE='
    curl -X 'POST' 'http://'"$cpsAndNcmpAsHostAddress"':8080/cps/api/v2/dataspaces/my-dataspace/anchors?schema-set-name=my-schema-set&anchor-name=my-anchor' -H 'accept: */*' --header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE='

    echo "Model upload finish ..."
    break
  fi
  sleep 10 &
  echo $!
  echo $?
done


      • - model: contains the subscription model
    • depends_on: 
      • -db: healthcheck is added on the db container/service which leaves seconds after the database has started
      • -cps-and-ncmp: service should be started before init-db container is brought up
  •  
    • Service/Container 'init-db' is built from a customised image supported by a Dockerfile containing the following:
      • Image from Dockerfile is based from postgres image and added 'curl'

        # syntax=docker/dockerfile:1
        FROM postgres:14.1-alpine
        
        RUN apk --no-cache add curl




  • No labels