Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Assumptions

Issues & Decisions

...

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

Previous Update:  

Latest Update:  

Code Block
languagexml
titleSubscription YANG model
linenumberstrue
module subscription {
    yang-version 1.1;
    namespace "org:onap:ncmp:subscription";

    prefix subs;

    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;
            }

            container predicates {
                leaf-list targets {
                  type string;
                }

                leaf datastore {
                  type string;
                }
            }

            list respondedCmHandle {
              key "cmHandleId status";

              leaf cmHandleId {
                 type string;
              }

              leaf status {
                 type string;
              }
            }

        }
    }
}



Note:

leaf-list dmi-service-names : added as part of

Jira
serverONAP Jira
serverId425b2b0a-557c-3c0c-b515-579789cceedb
keyCPS-1496


Onboarding via docker container

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

...

ddd

dddd
Code Block
linenumberstrue
collapsetrue
#!/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
Section
Column
width50%
          • line 3: psql returns 't' for true
          • line 6: while loop used to re try uploading the model whenever the dataspace and anchor is ready
          • line 8: sleep for number of seconds to allow the liquibase set up of the database via cps-and-ncmp container
          • line 10-11: postgres commands to confirm that the needed dataspace and anchor exists (for this POC case subscription model requires the 'NCMP-Admin' dataspace and 'ncmp-dmi-registry' anchor)
          • line 17: if condition specifies to only upload the model if dataspace and anchor exists
          • line 21: command to get the IP address of 'cps-and-ncmp' docker container via ping's output manipulation and store in a variable; this variable is used in call of curl 
          • line 23-25: curl 'POST' commands to create dataspace, anchor and upload schemaset
      • - 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'

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


POC: init-db container log output

Image Modified


Image Added

Image Added



Onboarding via JAVA / Spring boot

Image Added


Image Added


Image Added  Image Added


Image Added


Image Added


Image Added