Add warning message when the default storage class is not set 61/13361/1 master
authoraravind.est <aravindhan.a@est.tech>
Tue, 17 Sep 2024 16:21:59 +0000 (17:21 +0100)
committeraravind.est <aravindhan.a@est.tech>
Wed, 18 Sep 2024 08:51:58 +0000 (09:51 +0100)
Warning message added when the default storage class is not set.
This prevents the kong installation as the dependent postgres expects the PV to be available.

Issue-ID: NONRTRIC-1030
Change-Id: Ia11d7ab261095a875acec3fb690632a2f1f4e25a
Signed-off-by: aravind.est <aravindhan.a@est.tech>
59 files changed:
.gitignore
README.md
bin/build-nonrtric-base [new file with mode: 0755]
bin/deploy-nonrtric
bin/undeploy-nonrtric
bin/verify-nonrtric-charts [new file with mode: 0755]
bin/verify-ric-charts
ci/Dockerfile-nonrtric-install [new file with mode: 0644]
nonrtric/RECIPE_EXAMPLE/example_recipe.yaml
nonrtric/data/run_in_k8s/populate_policy_data.sh
nonrtric/helm/a1simulator/values.yaml
nonrtric/helm/capifcore/values.yaml
nonrtric/helm/controlpanel/resources-ing/nginx.conf
nonrtric/helm/controlpanel/values.yaml
nonrtric/helm/dmaapadapterservice/values.yaml
nonrtric/helm/dmeparticipant/values.yaml
nonrtric/helm/kongstorage/kongvalues.yaml
nonrtric/helm/nonrtric/values.yaml
nonrtric/helm/nonrtricgateway/resources/config/application.yaml
nonrtric/helm/policymanagementservice/templates/statefulset.yaml
nonrtric/helm/policymanagementservice/values.yaml
nonrtric/helm/rappcatalogueenhancedservice/values.yaml
nonrtric/helm/rappmanager/values.yaml
nonrtric/helm/servicemanager/templates/configmap.yaml
nonrtric/helm/servicemanager/values.yaml
nonrtric/servicemanager-preload/README.md [new file with mode: 0644]
nonrtric/servicemanager-preload/config-nonrtric.yaml [new file with mode: 0644]
nonrtric/servicemanager-preload/config-smo.yaml [new file with mode: 0644]
nonrtric/servicemanager-preload/servicemanager-preload.sh [new file with mode: 0755]
ranpm
ric-aux/helm/mrsub/resources/mrsub.sh
ric-common/Common-Template/helm/nonrtric-common/templates/_servicemanager.tpl [moved from ric-common/Common-Template/helm/nonrtric-common/templates/servicemanager.tpl with 99% similarity]
smo-install/helm-override/cnf/oran-override.yaml
smo-install/helm-override/default/oran-override.yaml
smo-install/helm-override/pythonsdk-tests/oran-override.yaml
smo-install/oran_oom/a1simulator/values.yaml
smo-install/oran_oom/capifcore/values.yaml
smo-install/oran_oom/controlpanel/resources-ing/nginx.conf
smo-install/oran_oom/dmaapadapterservice/values.yaml
smo-install/oran_oom/kong/.helmignore [new file with mode: 0644]
smo-install/oran_oom/kong/Chart.yaml [new file with mode: 0644]
smo-install/oran_oom/kong/templates/00-kong-pv.yaml [new file with mode: 0644]
smo-install/oran_oom/kong/templates/01-kongpvc.yaml [new file with mode: 0644]
smo-install/oran_oom/kong/values.yaml [new file with mode: 0644]
smo-install/oran_oom/nonrtric/Chart.yaml
smo-install/oran_oom/nonrtric/values.yaml
smo-install/oran_oom/policy-clamp-ac-dme-ppnt/values.yaml
smo-install/oran_oom/policymanagementservice/values.yaml
smo-install/oran_oom/rappmanager/values.yaml
smo-install/oran_oom/servicemanager/Chart.yaml [new file with mode: 0644]
smo-install/oran_oom/servicemanager/templates/configmap.yaml [new file with mode: 0644]
smo-install/oran_oom/servicemanager/templates/deployment.yaml [new file with mode: 0644]
smo-install/oran_oom/servicemanager/templates/service.yaml [new file with mode: 0644]
smo-install/oran_oom/servicemanager/values.yaml [new file with mode: 0644]
smo-install/scripts/sub-scripts/install-nonrtric.sh
smo-install/scripts/sub-scripts/uninstall-nonrtric.sh
smo-install/test/a1-validation/subscripts/health_check.sh
smo-install/test/a1-validation/subscripts/prepareDmaapMsg.sh
smo-install/test/a1-validation/subscripts/preparePmsData.sh

index a14e5c2..6d47f3f 100644 (file)
@@ -7,3 +7,4 @@
 .tox
 .DS_Store
 docs/_build/
+index-cache.yaml
index bfc2832..b79262a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -89,7 +89,7 @@ $ . ./undeploy-ric-aux
 ```
 
 ### NOTE: To Deploy RANPM
-RANPM helm charts are integrated as a submodule in this repository. To deploy RANPM function set installRanpm: true in the RECEPIE_EXAMPLE file as below:
+RANPM helm charts are integrated as a submodule in this repository. To deploy RANPM function set installRanpm: true in the RECIPE_EXAMPLE file as below:
 
 nonrtric:
   installPms: true
@@ -100,13 +100,14 @@ nonrtric:
   installRappcatalogueservice: true
   installRappcatalogueEnhancedservice: true
   installNonrtricgateway: true
-  installKong: false
+  installKong: true
   installDmaapadapterservice: true
   installDmaapmediatorservice: true
   installHelmmanager: true
   installOruclosedlooprecovery: true
   installOdusliceassurance: true
   installCapifcore: true
+  installServicemanager: true
   installRanpm: true
   
    volume1:
diff --git a/bin/build-nonrtric-base b/bin/build-nonrtric-base
new file mode 100755 (executable)
index 0000000..00dd64e
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/bash
+################################################################################
+#   Copyright (C) 2024 OpenInfra Foundation Europe. 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.                                             #
+################################################################################
+
+ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+#Check for helm3
+IS_HELM3=$(helm version -c --short|grep -e "^v3")
+
+CM_VERSION="v0.16.2"
+CM_PORT="8879"
+CM_BASE_URL="http://127.0.0.1:$CM_PORT"
+CM_CHART_GET_URL="$CM_BASE_URL/charts"
+CM_CHART_POST_URL="$CM_BASE_URL/charts/api/charts"
+
+if ! command -v chartmuseum &> /dev/null
+then
+  pushd /tmp
+  echo "Installing ChartMuseum binary..."
+  wget https://get.helm.sh/chartmuseum-$CM_VERSION-linux-amd64.tar.gz
+  tar xvfz chartmuseum-$CM_VERSION-linux-amd64.tar.gz
+  sudo mv /tmp/linux-amd64/chartmuseum /usr/local/bin/chartmuseum
+  popd
+else
+  echo "ChartMuseum is already installed."
+fi
+
+# Package common templates and serve it using Helm local repo
+HELM_LOCAL_REPO="./chartstorage"
+rm $HELM_LOCAL_REPO/*
+
+#Start Chart Museum server if there isn't one
+CHART_MUSEUM_PID=$(lsof -i :"$CM_PORT" | grep "chartmus" | grep -v "grep" | awk '{print $2}')
+if [ -z "$CHART_MUSEUM_PID" ]; then
+  echo "Starting ChartMuseum on port $CM_PORT..."
+  nohup chartmuseum --port=$CM_PORT --storage="local" --context-path=/charts --storage-local-rootdir=$HELM_LOCAL_REPO >/dev/null 2>&1 &
+  echo $! > $ROOT_DIR/CM_PID.txt
+else
+  echo "ChartMuseum is already running..."
+fi
+
+# Check if ChartMuseum  is ready to serve request
+command="curl --silent --output /dev/null  $CM_BASE_URL"
+for i in $(seq 1 5)
+do $command && s=0 && break || s=$? && echo "Failed to establish a connection with the ChartMuseum server. Retrying after 5s" && sleep 5;
+done
+
+if [ $s -gt 0 ]
+then
+        echo "Cmd to test ChartMuseum failed with ($s): $command"
+        exit $s
+fi
+
+helm repo remove local
+helm repo add local $CM_CHART_GET_URL
+
+echo -e "\nPackaging NONRTRIC common [nonrtric-common]"
+NONRTRIC_COMMON_CHART_VERSION=$(cat $ROOT_DIR/../ric-common/Common-Template/helm/nonrtric-common/Chart.yaml | grep version | awk '{print $2}')
+helm package -d /tmp $ROOT_DIR/../ric-common/Common-Template/helm/nonrtric-common
+curl --data-binary @/tmp/nonrtric-common-$NONRTRIC_COMMON_CHART_VERSION.tgz $CM_CHART_POST_URL
index 2125ef3..6ce07a5 100755 (executable)
@@ -50,67 +50,46 @@ if [ -z "$OVERRIDEYAML" ];then
     exit 1
 fi
 
-
-ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
-
-echo "** $ROOT_DIR"
-rm $ROOT_DIR/../nonrtric/helm/*/charts/*.tgz
-
-#ChartMuseum configuration
-CM_VERSION="v0.16.1"
-CM_PORT="8879"
-CM_BASE_URL="http://127.0.0.1:$CM_PORT"
-CM_CHART_GET_URL="$CM_BASE_URL/charts"
-CM_CHART_POST_URL="$CM_BASE_URL/charts/api/charts"
-
-#Check for helm3
-IS_HELM3=$(helm version -c --short|grep -e "^v3")
-
-if ! command -v chartmuseum &> /dev/null
-then
-  pushd /tmp
-  echo "Installing ChartMuseum binary..."
-  wget https://get.helm.sh/chartmuseum-$CM_VERSION-linux-amd64.tar.gz
-  tar xvfz chartmuseum-$CM_VERSION-linux-amd64.tar.gz
-  sudo mv /tmp/linux-amd64/chartmuseum /usr/local/bin/chartmuseum
-  popd
-else
-  echo "ChartMuseum is already installed."
+if ! command -v yq > /dev/null 2>&1; then
+    echo "yq is not installed. Installing yq..."
+    sudo snap install yq --channel=v4/stable
 fi
 
-# Package common templates and serve it using Helm local repo
-HELM_LOCAL_REPO="./chartstorage"
-rm $HELM_LOCAL_REPO/*
+INSTALL_KONG=$(cat $OVERRIDEYAML | yq e '.nonrtric.installKong' -)
+if [ $? -ne 0 ] || [ -z "$INSTALL_KONG"  ]; then
+    echo "Error: failed to parse installKong from YAML with yq. Aborting install."
+    exit 1
+fi
 
-#Start Chart Museum server if there isn't one
-CHART_MUSEUM_PID=$(lsof -i :"$CM_PORT" | grep "chartmus" | grep -v "grep" | awk '{print $2}')
-if [ -z "$CHART_MUSEUM_PID" ]; then
-  echo "Starting ChartMuseum on port $CM_PORT..."
-  nohup chartmuseum --port=$CM_PORT --storage="local" --context-path=/charts --storage-local-rootdir=$HELM_LOCAL_REPO >/dev/null 2>&1 &
-  echo $! > $ROOT_DIR/CM_PID.txt
-else
-  echo "ChartMuseum is already running..."
+INSTALL_CAPIF=$(cat $OVERRIDEYAML | yq e '.nonrtric.installCapifcore' -)
+if [ $? -ne 0 ] || [ -z "$INSTALL_CAPIF"  ]; then
+    echo "Error: failed to parse installCapifcore from YAML with yq. Aborting install."
+    exit 1
 fi
 
-# Check if ChartMuseum  is ready to serve request
-command="curl --silent --output /dev/null  $CM_BASE_URL"
-for i in $(seq 1 5)
-do $command && s=0 && break || s=$? && echo "Failed to establish a connection with the ChartMuseum server. Retrying after 5s" && sleep 5;
-done
+INSTALL_SERVICEMANAGER=$(cat $OVERRIDEYAML | yq e '.nonrtric.installServicemanager' -)
+if [ $? -ne 0 ] || [ -z "$INSTALL_SERVICEMANAGER"  ]; then
+    echo "Error: failed to parse installServicemanager from YAML with yq. Aborting install."
+    exit 1
+fi
 
-if [ $s -gt 0 ]
-then
-        echo "Cmd to test ChartMuseum failed with ($s): $command"
-        exit $s
+if [ "$INSTALL_SERVICEMANAGER" == "true" ]; then
+    if [ "$INSTALL_KONG" == "false" ]; then
+        echo "Error: INSTALL_KONG must be true if INSTALL_SERVICEMANAGER is true. Aborting install."
+        exit 1
+    fi
+    if [ "$INSTALL_CAPIF" == "false" ]; then
+        echo "Error: INSTALL_CAPIF must be true if INSTALL_SERVICEMANAGER is true. Aborting install."
+        exit 1
+    fi
 fi
 
-helm repo remove local
-helm repo add local $CM_CHART_GET_URL
+ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
-echo -e "\nPackaging NONRTRIC common [nonrtric-common]"
-NONRTRIC_COMMON_CHART_VERSION=$(cat $ROOT_DIR/../ric-common/Common-Template/helm/nonrtric-common/Chart.yaml | grep version | awk '{print $2}')
-helm package -d /tmp $ROOT_DIR/../ric-common/Common-Template/helm/nonrtric-common
-curl --data-binary @/tmp/nonrtric-common-$NONRTRIC_COMMON_CHART_VERSION.tgz $CM_CHART_POST_URL
+echo "** $ROOT_DIR"
+rm $ROOT_DIR/../nonrtric/helm/*/charts/*.tgz
+
+source $ROOT_DIR/build-nonrtric-base
 
 charts_already_exists=()
 
@@ -168,7 +147,6 @@ COMMON_BLOCK=$(cat $OVERRIDEYAML | awk '/^common:/{getline; while ($0 ~ /^ +.*|^
 NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^  namespace:/{getline; while ($0 ~ /^    .*|^ *$/) {print $0; if (getline == 0) {break}}}')
 NONRTRIC_NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *nonrtric:/{print $2}')
 RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
-INSTALL_KONG=$(cat $OVERRIDEYAML | awk '/^  installKong:/{print $2}')
 INSTALL_RANPM=$(cat $OVERRIDEYAML | awk '/^  installRanpm:/{print $2}')
 
 if ! kubectl get ns ${NONRTRIC_NAMESPACE:-nonrtric}> /dev/null 2>&1; then
@@ -187,13 +165,24 @@ fi
 echo "Install Kong- $INSTALL_KONG"
 
 if [ "$INSTALL_KONG" = true ];then
+  DEFAULT_SC=$(kubectl get sc -o jsonpath='{.items[?(@.metadata.annotations.storageclass\.kubernetes\.io/is-default-class=="true")].metadata.name}')
+  if [ -z "$DEFAULT_SC" ];then
+    echo "----------------------------------- WARNING!!! -------------------------------------------------------"
+    echo "Default storage class is not set."
+    echo "Kong PV and PVC creation may fail if it unable to create/use a storage class."
+    echo "Storage class for the kong installation can be specified in nonrtric/helm/kongstorage/kongvalues.yaml"
+    echo "------------------------------------------------------------------------------------------------------"
+  else
+    echo "Default storage class is set to $DEFAULT_SC"
+  fi
+
   echo "Install kongstorage through helm"
   helm install kongstorage -n "${NONRTRIC_NAMESPACE:-nonrtric}" ${HELM_NAME_OPT}  "$ROOT_DIR/../nonrtric/helm/kongstorage"
 
   echo "Installing Kong"
   helm repo add kong https://charts.konghq.com --force-update
   helm repo update
-  helm install kong-nonrtric kong/kong -n ${NONRTRIC_NAMESPACE:-nonrtric} -f dep/nonrtric/helm/kongstorage/kongvalues.yaml
+  helm install oran-nonrtric kong/kong -n ${NONRTRIC_NAMESPACE:-nonrtric} -f "$ROOT_DIR/../nonrtric/helm/kongstorage/kongvalues.yaml"
 fi
 
 kubectl create configmap -n ${NONRTRIC_NAMESPACE:-nonrtric} nonrtric-recipe --from-file=recipe=$OVERRIDEYAML
@@ -211,3 +200,10 @@ fi
 
 echo "helm install -f $OVERRIDEYAML --namespace ${NONRTRIC_NAMESPACE:-nonrtric} ${HELM_NAME_OPT} ${RELEASE_PREFIX} $ROOT_DIR/../nonrtric/helm/nonrtric"
 helm install -f $OVERRIDEYAML -n "${NONRTRIC_NAMESPACE:-nonrtric}" ${HELM_NAME_OPT} "${RELEASE_PREFIX}" "$ROOT_DIR/../nonrtric/helm/nonrtric"
+
+if [ "$INSTALL_SERVICEMANAGER" == "true" ]; then
+    pushd "$ROOT_DIR/../nonrtric/servicemanager-preload"
+    # Send stderr to null to turn off chatty logging
+    ./servicemanager-preload.sh config-nonrtric.yaml 2>/dev/null
+    popd
+fi
index af9a31d..adfe287 100755 (executable)
@@ -66,7 +66,7 @@ if [ "$INSTALL_KONG" = true ];then
   echo "Uninstalling kongstorage"
   helm delete kongstorage -n "${NONRTRIC_NAMESPACE:-nonrtric}"
   echo "Uninstalling Kong"
-  helm delete kong-nonrtric -n ${NONRTRIC_NAMESPACE:-nonrtric}
+  helm delete oran-nonrtric -n ${NONRTRIC_NAMESPACE:-nonrtric}
 fi
 
 ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
diff --git a/bin/verify-nonrtric-charts b/bin/verify-nonrtric-charts
new file mode 100755 (executable)
index 0000000..c454792
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/bash
+################################################################################
+#   Copyright (C) 2024 OpenInfra Foundation Europe. 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.                                             #
+################################################################################
+
+OVERRIDEYAML=$1
+
+ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+source $ROOT_DIR/build-nonrtric-base
+
+echo "Create array of helm charts"
+CHART_ARRAY=()
+while IFS= read -r -d $'\0'; do
+    echo -e "File - $REPLY \n"
+    CHART_ARRAY+=("$REPLY")
+done < <(find $ROOT_DIR/../nonrtric -maxdepth 5 -name Chart.yaml -printf '%h\0')
+
+echo "***************************************"
+echo "Remove nonrtric parent chart from linting as its a conceptual visualization of Nonrtric components. This chart doesn't contain any templates & it's primarily
+used for grouping of all Nonrtric components in deployment"
+
+for dir in "${CHART_ARRAY[@]}"
+do
+    if [[ $dir == *"/helm/nonrtric"* ]]; then
+        echo "Skip Nonrtric Parent chart"
+    else
+    echo "Update chart dependency for directory $dir"
+    helm dep up $dir
+    # Lint clearly marks errors; e.g., [ERROR]
+    if [ -z $OVERRIDEYAML ]; then
+        helm lint $dir > /tmp/output 2>&1
+    else
+        helm lint -f $OVERRIDEYAML $dir> /tmp/output 2>&1
+    fi
+    echo "***************************************************************************************************************"
+    cat /tmp/output
+
+    egrep -q '^Error: [0-9]* chart\(s\) linted, [0-9]* chart\(s\) failed' /tmp/output && exit 1
+    echo "***************************************************************************************************************"
+
+    if [ -z $OVERRIDEYAML ]; then
+        helm template $dir > /tmp/output 2>&1
+    else
+       helm template -f $OVERRIDEYAML $dir > /tmp/output 2>&1
+    fi
+    echo "***************************************************************************************************************"
+    cat /tmp/output
+   sleep 1
+    egrep -n '%!.\(.*=.*\)' /tmp/output && echo "Error: Type mismatch." && exit 1
+    echo "***************************************************************************************************************"
+    fi
+done
index 53cc831..51e9b58 100755 (executable)
@@ -2,6 +2,7 @@
 ##############################################################################
 #
 #   Copyright (c) 2019 AT&T Intellectual Property.
+#   Copyright (C) 2024 OpenInfra Foundation Europe. 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.
@@ -58,13 +59,9 @@ AUX_COMMON_CHART_VERSION=$(cat $ROOT_DIR/../ric-common/Common-Template/helm/aux-
 helm package -d /tmp $ROOT_DIR/../ric-common/Common-Template/helm/aux-common
 cp /tmp/aux-common-$AUX_COMMON_CHART_VERSION.tgz $HELM_LOCAL_REPO
 
-NONRTRIC_COMMON_CHART_VERSION=$(cat $ROOT_DIR/../ric-common/Common-Template/helm/nonrtric-common/Chart.yaml | grep version | awk '{print $2}')
-helm package -d /tmp $ROOT_DIR/../ric-common/Common-Template/helm/nonrtric-common
-cp /tmp/nonrtric-common-$NONRTRIC_COMMON_CHART_VERSION.tgz $HELM_LOCAL_REPO
 
 
-
-helm repo index $HELM_HOME/repository/local/
+helm repo index $HELM_LOCAL_REPO
 
 echo "Make sure that helm local repo is added"
 helm repo remove local
@@ -75,7 +72,7 @@ echo "Create array of helm charts"
 CHART_ARRAY=()
 while IFS= read -r -d $'\0'; do
     CHART_ARRAY+=("$REPLY")
-done < <(find $ROOT_DIR/../ -maxdepth 5 -name Chart.yaml -printf '%h\0')
+done < <(find $ROOT_DIR/../ -not -path "$ROOT_DIR/../nonrtric/*" -maxdepth 5 -name Chart.yaml -printf '%h\0')
 
 echo "***************************************"
 echo "Remove nonrtric parent chart from linting as its a conceptual visualization of Nonrtric components. This chart doesn't contain any templates & it's primarily
diff --git a/ci/Dockerfile-nonrtric-install b/ci/Dockerfile-nonrtric-install
new file mode 100644 (file)
index 0000000..ae6a9fd
--- /dev/null
@@ -0,0 +1,27 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#   Copyright (C) 2024 OpenInfra Foundation Europe. 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.                                             #
+################################################################################
+
+FROM ubuntu:24.04
+RUN apt-get update && apt-get -y install curl ca-certificates wget curl lsof sudo
+ARG HELMVERSION=v3.15.4
+# often times out during LF jenkins build
+RUN wget https://get.helm.sh/helm-${HELMVERSION}-linux-amd64.tar.gz && tar -xvf ../helm-${HELMVERSION}-linux-amd64.tar.gz && mv linux-amd64/helm /usr/local/bin/helm
+ARG TGT=/tmp/it-dep
+COPY . $TGT
+# Remove the smo-install as this one will be verified in another verify job
+RUN rm -rf $TGT/smo-install
+RUN $TGT/bin/verify-nonrtric-charts
index 1a67607..2c69607 100644 (file)
@@ -38,6 +38,7 @@ nonrtric:
   installRansliceassurance: true
   installCapifcore: true
   installServicemanager: true
+  # When enabling Ranpm switch to false installControlpanel, installInformationservice, installNonrtricgateway
   installRanpm: false
   # rApp Manager functionality relies on ACM for its operation
   installrAppmanager: true
@@ -100,14 +101,14 @@ policymanagementservice:
     image:
       registry: 'nexus3.o-ran-sc.org:10002/o-ran-sc'
       name: nonrtric-plt-a1policymanagementservice
-      tag: 2.7.0
+      tag: 2.8.0
     service:
       allowHttp: true
       httpName: http
-      internalPort1: 9080
+      internalPort1: 8081
       targetPort1: 8081
       httpsName: https
-      internalPort2: 9081
+      internalPort2: 8433
       targetPort2: 8433
     liveness:
       initialDelaySeconds: 20
@@ -122,6 +123,10 @@ policymanagementservice:
       storageClassName: pms-storage
     ingress:
       enabled: true
+    #Volumepermissions needs to align with the container build arguments
+    volumepermissions:
+      groupid: 120957
+      userid: 120957
 
 # A1 Controller may take few more minutes to start. Increase the initialDelaySeconds in liveness to avoid container restart.
 a1controller:
@@ -154,7 +159,7 @@ a1simulator:
     image:
       registry: 'nexus3.o-ran-sc.org:10002/o-ran-sc'
       name: a1-simulator
-      tag: 2.6.1
+      tag: 2.7.0
     service:
       allowHttp: true
       httpName: http
@@ -234,7 +239,7 @@ rappcatalogueenhancedservice:
     image:
       registry: 'nexus3.o-ran-sc.org:10002/o-ran-sc'
       name: nonrtric-plt-rappcatalogue-enhanced
-      tag: 1.1.0
+      tag: 1.2.0
     service:
       allowHttp: true
       httpName: http
@@ -272,7 +277,7 @@ dmaapadapterservice:
     image:
       registry: 'nexus3.o-ran-sc.org:10002/o-ran-sc'
       name: 'nonrtric-plt-dmaapadapter'
-      tag: 1.3.0
+      tag: 1.4.0
     service:
       allowHttp: true
       httpName: http
@@ -376,7 +381,7 @@ capifcore:
     image:
       registry: "nexus3.o-ran-sc.org:10004/o-ran-sc"
       name: nonrtric-plt-capifcore
-      tag: 1.3.1
+      tag: 1.4.0
     env:
       chart_museum_url: "http://chartmuseum:8080"
       repo_name: "capifcore"
@@ -387,7 +392,7 @@ servicemanager:
     image:
       registry: "nexus3.o-ran-sc.org:10004/o-ran-sc"
       name: nonrtric-plt-servicemanager
-      tag: 0.1.1
+      tag: 0.1.3
 
 rappmanager:
   rappmanager:
@@ -395,7 +400,7 @@ rappmanager:
     image:
       registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
       name: nonrtric-plt-rappmanager
-      tag: 0.0.1
+      tag: 0.1.0
     service:
       httpName: http
       internalPort1: 8080
@@ -418,7 +423,7 @@ dmeparticipant:
     image:
       registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
       name: nonrtric-plt-participant-impl-dme
-      tag: 0.0.1
+      tag: 0.1.0
     service:
       httpName: http
       internalPort1: 8080
index 4a3f1b8..4f15e89 100755 (executable)
@@ -25,7 +25,7 @@
 # one policy-type and one policy in a1-sim-STD2_0
 
 policy_agent_host="policymanagementservice"
-policy_agent_port="9080"
+policy_agent_port="8081"
 a1_sim_osc_0_host="a1-sim-osc-0.a1-sim"
 a1_sim_osc_0_port="8085"
 a1_sim_osc_1_host="a1-sim-osc-1.a1-sim"
index dc44113..22e0096 100644 (file)
@@ -1,7 +1,7 @@
-#  ============LICENSE_START===============================================
+#  ============LICENSE_START================================================
 #  Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
-#  Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
-#  ========================================================================
+#  Copyright (C) 2023-2024 OpenInfra Foundation Europe. 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
@@ -13,7 +13,7 @@
 #  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=================================================
+#  ============LICENSE_END==================================================
 
 # Default values for a1-simulator.
 # This is a YAML-formatted file.
@@ -25,7 +25,7 @@ a1simulator:
   image:
     registry: 'nexus3.o-ran-sc.org:10002/o-ran-sc'
     name: a1-simulator
-    tag: 2.6.1
+    tag: 2.7.0
   service:
     allowHttp: true
     httpName: http
index e7ca92f..2dd263a 100644 (file)
@@ -24,7 +24,7 @@ capifcore:
   image:
     registry: 'nexus3.o-ran-sc.org:10004/o-ran-sc'
     name: nonrtric-plt-capifcore
-    tag: 1.3.1
+    tag: 1.4.0
   service:
     httpName: http
     allowHttp: true
index d72eea7..4e53c54 100644 (file)
@@ -4,7 +4,7 @@ http {
     include /etc/nginx/mime.types;
 
     upstream backend {
-        server  kong-proxy.kong:80;
+        server oran-nonrtric-kong-proxy.nonrtric:80;
     }
 
     server {
@@ -25,4 +25,4 @@ http {
             try_files $uri $uri/ /index.html;
         }
     }
-}
\ No newline at end of file
+}
index a151950..e3e41dc 100644 (file)
@@ -32,7 +32,7 @@ controlpanel:
     targetPort1: 8080
     externalPort1: 30091
     httpsName: https
-    internalPort2: 8081
+    internalPort2: 8082
     targetPort2: 8082
     externalPort2: 30092
   liveness:
index 38e5e0b..0a53d14 100644 (file)
@@ -1,5 +1,6 @@
 ################################################################################
-#   Copyright (c) 2021 Nordix Foundation.                                      #
+#  Copyright (c) 2021 Nordix Foundation. All rights reserved.                  #
+#  Copyright (C) 2023-2024 OpenInfra Foundation Europe. 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.           #
@@ -23,7 +24,7 @@ dmaapadapterservice:
   image:
     registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
     name: "nonrtric-plt-dmaapadapter"
-    tag: 1.3.0
+    tag: 1.4.0
   service:
     allowHttp: true
     httpName: http
index 92f21cf..e451871 100644 (file)
@@ -1,6 +1,6 @@
-#  ============LICENSE_START===============================================
-#  Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
-#  ========================================================================
+#  ============LICENSE_START================================================
+#  Copyright (C) 2023-2024 OpenInfra Foundation Europe. 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
@@ -12,7 +12,7 @@
 #  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=================================================
+#  ============LICENSE_END==================================================
 #
 
 # Default values for DME Participant.
@@ -24,7 +24,7 @@ dmeparticipant:
   image:
     registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
     name: nonrtric-plt-participant-impl-dme
-    tag: 1.0.0
+    tag: 0.1.0
   service:
     httpName: http
     internalPort1: 8080
index 350cb03..c6fff53 100644 (file)
@@ -121,6 +121,10 @@ postgresql:
   primary:
     persistence:
       existingClaim: kongpvc
+      # If the default storage class is not set,
+      # This value should be set to create the PV
+      # storageClass: standard
+
 # -----------------------------------------------------------------------------
 # Miscellaneous parameters
 # -----------------------------------------------------------------------------
index 4f067e9..c8edf87 100644 (file)
@@ -30,7 +30,7 @@ nonrtric:
   installOrufhrecovery: true
   installRansliceassurance: true
   installCapifcore: true
-  installServicemanager: false
+  installServicemanager: true
   installRanpm: true
   installrAppmanager: true
   installDmeParticipant: true
index 0d96d68..602252b 100644 (file)
@@ -27,7 +27,7 @@ spring:
         wiretap: true
       routes:
       - id: A1-Policy
-        uri: https://policymanagementservice:9081
+        uri: https://policymanagementservice:8433
         predicates:
         - Path=/a1-policy/**
       - id: A1-EI
index a279067..fd4a34a 100644 (file)
@@ -53,6 +53,7 @@ spec:
             cp  /etc/app/policy-management-service/application_configuration_json_initial/application_configuration.json $FILE;
           fi;
           chmod 666 $FILE;
+          chown {{ .Values.policymanagementservice.volumepermissions.groupid }}:{{ .Values.policymanagementservice.volumepermissions.userid }} -R /var/policy-management-service/;
         volumeMounts:
         - name: {{ include "common.name.policymanagementservice" . }}-vardata
           mountPath: "/var/policy-management-service"
index c6a312e..8103bfb 100644 (file)
@@ -1,7 +1,7 @@
-#  ============LICENSE_START===============================================
+#  ============LICENSE_START================================================
 #  Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
-#  Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
-#  ========================================================================
+#  Copyright (C) 2023-2024 OpenInfra Foundation Europe. 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
@@ -13,7 +13,7 @@
 #  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=================================================
+#  ============LICENSE_END==================================================
 
 # Default values for Policy Management Service.
 # This is a YAML-formatted file.
@@ -24,14 +24,14 @@ policymanagementservice:
   image:
     registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
     name: nonrtric-plt-a1policymanagementservice
-    tag: 2.7.0
+    tag: 2.8.0
   service:
     allowHttp: true
     httpName: http
-    internalPort1: 9080
+    internalPort1: 8081
     targetPort1: 8081
     httpsName: https
-    internalPort2: 9081
+    internalPort2: 8433
     targetPort2: 8433
   liveness:
     initialDelaySeconds: 20
@@ -44,3 +44,7 @@ policymanagementservice:
     storageClassName: standard
   ingress:
     enabled: false
+  #Volumepermissions needs to align with the container build arguments
+  volumepermissions:
+    groupid: 120957
+    userid: 120957
\ No newline at end of file
index 2628dc4..bddf679 100644 (file)
@@ -1,7 +1,7 @@
-#  ============LICENSE_START===============================================
+#  ============LICENSE_START================================================
 #  Copyright (C) 2022-2023 Nordix Foundation. All rights reserved.
-#  Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
-#  ========================================================================
+#  Copyright (C) 2023-2024 OpenInfra Foundation Europe. 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
@@ -13,7 +13,7 @@
 #  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=================================================
+#  ============LICENSE_END==================================================
 
 # Default values for rAPP Catalogue Enhanced Service.
 # This is a YAML-formatted file.
@@ -24,7 +24,7 @@ rappcatalogueenhancedservice:
   image:
     registry: 'nexus3.o-ran-sc.org:10002/o-ran-sc'
     name: nonrtric-plt-rappcatalogue-enhanced
-    tag: 1.1.0
+    tag: 1.2.0
   service:
     allowHttp: true
     httpName: http
index cf6aab7..75c54cc 100644 (file)
@@ -1,6 +1,6 @@
-#  ============LICENSE_START===============================================
+#  ============LICENSE_START================================================
 #  Copyright (C) 2023-2024 OpenInfra Foundation Europe. 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
@@ -12,7 +12,7 @@
 #  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=================================================
+#  ============LICENSE_END==================================================
 #
 
 # Default values for rApp Manager.
@@ -25,7 +25,7 @@ rappmanager:
   image:
     registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
     name: nonrtric-plt-rappmanager
-    tag: 0.0.1
+    tag: 0.1.0
   service:
     httpName: http
     internalPort1: 8080
index 746b039..280e58f 100644 (file)
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
+
+
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: servicemanager-configmap
+  name: {{ include "common.name.servicemanager" . }}-configmap
+  namespace: {{ include "common.namespace.nonrtric" . }}
+  labels:
+    app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.servicemanager" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
 data:
 {{- range $key, $value := .Values.data }}
   {{ $key }}: |
index 7a36304..1463130 100644 (file)
@@ -21,7 +21,7 @@ servicemanager:
   image:
     registry: 'nexus3.o-ran-sc.org:10004/o-ran-sc'
     name: nonrtric-plt-servicemanager
-    tag: 0.1.1
+    tag: 0.1.3
   apiVersion: v1
   kind: ConfigMap
   metadataName: servicemanager-configmap
@@ -36,13 +36,17 @@ servicemanager:
 
 data:
   .env: |
+    # The Kong Data plane provides the endpoint that Service Manager gives to the rApp so that the rApp can invoke the CAPIF published API.
+    # In a Kubernetes environment, we need to use the Kong NodePort IP and nodePort if the rApp needs access from outside the Kong cluster.
+    # From inside the Kong cluster, we can use the Kubernetes cluster DNS entry, oran-nonrtric-kong-proxy.nonrtric.svc.cluster.local.
     KONG_DOMAIN: "kong"
     KONG_PROTOCOL: "http"
-    KONG_IPV4: "kong-nonrtric-kong-admin.nonrtric.svc.cluster.local"
-    KONG_DATA_PLANE_PORT: "80"
+    KONG_CONTROL_PLANE_IPV4: "oran-nonrtric-kong-admin.nonrtric.svc.cluster.local"
     KONG_CONTROL_PLANE_PORT: "8001"
+    KONG_DATA_PLANE_IPV4: "oran-nonrtric-kong-proxy.nonrtric.svc.cluster.local"
+    KONG_DATA_PLANE_PORT: "80"
     CAPIF_PROTOCOL: "http"
     CAPIF_IPV4: "capifcore.nonrtric.svc.cluster.local"
     CAPIF_PORT: "8090"
-    LOG_LEVEL: "Debug"
+    LOG_LEVEL: "Info"
     SERVICE_MANAGER_PORT: "8095"
diff --git a/nonrtric/servicemanager-preload/README.md b/nonrtric/servicemanager-preload/README.md
new file mode 100644 (file)
index 0000000..7fcfac0
--- /dev/null
@@ -0,0 +1,103 @@
+<!---
+
+Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+
+Licensed under the Creative Commons License, Attribution 4.0 Intl.
+(the"Documentation License"); you may not use this documentation
+except incompliance with the Documentation License. You may obtain
+a copy of the Documentation License at
+
+    https://creativecommons.org/licenses/by/4.0/
+
+Unless required by applicable law or agreed to in writing,
+documentation distributed under the Documentation License is
+distributed on an "AS IS"BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, either express or implied. See the Documentation
+License for the specific language governing permissions and
+limitations under the Documentation License.
+
+-->
+
+# Service Manager Preload
+
+## Config format
+The config file follows a format that is similar to the format required by the Service Manager/CAPIFcore Publisher.
+
+## Running
+
+At the end of the Kubernetes deployment, following script runs automatically.
+
+```sh
+servicemanager-preload.sh [config.yaml]
+```
+where [config.yaml] is a config file. If this arguement is not specified, the default is config.yaml. The input file is expected to be in the same directory as the `servicemanager-preload.sh` script. You can call the command without arguements as below.
+
+In our installation we provide 2 config files, `config-nonrtric.yaml` and `config-smo.yaml`. The file `config-nonrtric.yaml` is used by both the NONRTRIC install and SMO installs. For the SMO install we concatate both files into a file called `config-nonrtric-smo.yaml` and use that. This file is deleted after use in the installation script. We do it this way to avoid duplicating the information in `config-nonrtric.yaml`.
+
+## Script Action
+
+1. The script runs through the provided config.yaml file and selects the root entries in the YAML as Kubernetes service names.
+1. For each service, we check if the service exists, using `kubectl get service` for both the nonrtric and onap namespaces.
+1. If the service is exists, we add it to a list, `running_services_list`.
+1. Next, we run through all entries in the supplied YAML file.
+1. If the service is on the `running_services_list`, we build a payload from the entries for that YAML item.
+1. We use the payload to call the Service Manager. This in turn calls Kong and Capif to set up the service.
+
+## Interface Descriptions
+
+To distinguish between multiple interface descriptions, Service Manager prepends the port number and a hash code to the URL path.
+
+## Static and Dynamic Routes
+
+We can specify either static or dynamic routes. Static routing defines a route when there is a single route for traffic to reach a destination. Dynamic routing allows us to specify path parameters. In this config file, we specify path parameters using regular expressions.
+
+Kong uses the regex definition from the [Rust programming language](https://docs.rs/regex/latest/regex/) to specify the regular expression (regex) that describes the path parameters, [Kong regex](https://docs.konghq.com/gateway/latest/key-concepts/routes/#regular-expressions).
+
+An example of a static path is as follows. This is the straightforward case.
+
+```http
+   /rapps
+```
+
+An example of a dynamic path is
+
+```http
+   ~/rapps/(?<rappId>[a-zA-Z0-9]+([-_][a-zA-Z0-9]+)*)
+```
+
+Our dynamic path starts with a ~ character. In this example, we have a path parameter that is described by a regex capture group called rappId. The regex describes a word made of mixed-case alphanumeric characters optionally followed by one or more sets of a dash or underscore together with another word.
+
+When the Service Manager client calls a dynamic API, we call the URL without the '~'. Kong substitutes the path parameter according to the rules specified in the regex. Therefore, we can call the above example by using
+
+```http
+   /rapps/my-rApp-id
+```
+
+as the URL where my-rApp-id is the rApp id of in the rApp Manager. The name my-rApp-id has to match the regex shown above.
+
+It is required to name the capture group in this YAML config file. The capture group name is used by Service Manager when creating a Kong Request Transformer plugin. We can specify multiple capture groups in a URL if there are multiple path parameters in the API path.
+
+We create a Kong Request Transformer plugin with .data[].config.replace, as in the following example curl with abridged response.
+
+```sh
+curl -X GET http://oran-nonrtric-kong-admin.nonrtric.svc.cluster.local:8001/plugins
+```
+
+```json
+{
+  "body": [],
+  "uri": "/rapps/$(uri_captures[\"rappId\"])",
+  "headers": [],
+  "querystring": []
+}
+```
+
+In our example, this allows Kong to match /rapps/my-rApp-id. 
+
+The Service Manager uses the following regex to search and replace the YAML file regexes.
+
+```regex
+/\(\?<([^>]+)>([^\/]+)/
+```
+
+Please note that the example path, /rapps/my-rApp-id, is not terminated by a '/'. Service Manager adds a '/' for internal matching. This made the regex easier to develop. Service Manager will match on /rapps/my-rApp-id/ for this case.
diff --git a/nonrtric/servicemanager-preload/config-nonrtric.yaml b/nonrtric/servicemanager-preload/config-nonrtric.yaml
new file mode 100644 (file)
index 0000000..6b687bd
--- /dev/null
@@ -0,0 +1,392 @@
+################################################################################
+#   Copyright (C) 2024 OpenInfra Foundation Europe. 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.                                             #
+################################################################################
+
+---
+
+# Preload services for nonrtric install
+
+# https://docs.o-ran-sc.org/projects/o-ran-sc-nonrtric-plt-sme/en/latest/overview.html#
+
+servicemanager:
+  AefProfiles:
+  - interfaceDescriptions:
+    - ipv4Addr: "servicemanager.nonrtric.svc.cluster.local"
+      port: 8095
+      securityMethods:
+      - PKI
+    Versions:
+      - ApiVersion: "v1"
+        Resources:
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: healthcheck
+          Uri: "/"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - POST
+          ResourceName: registrations
+          Uri: "/api-provider-management/registrations"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - PUT
+          - PATCH
+          - DELETE
+          ResourceName: registrations-domain_id
+          Uri: "/api-provider-management/registrations/{registrationId}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          - POST
+          ResourceName: publisher
+          Uri: "/published-apis/{apfId}/service-apis"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          - PUT
+          - PATCH
+          - DELETE
+          ResourceName: publisher-api_id
+          Uri: "/published-apis/{apfId}/service-apis/{serviceApiId}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - POST
+          ResourceName: invoker
+          Uri: "/api-invoker-management/onboardedInvokers"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - PUT
+          - PATCH
+          - DELETE
+          ResourceName: invoker-invoker_id
+          Uri: "/api-invoker-management/onboardedInvokers/{onboardingId}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: discovery
+          Uri: "/service-apis/allServiceAPIs"
+  ApiName: servicemanager-http
+
+# https://docs.o-ran-sc.org/projects/o-ran-sc-nonrtric-plt-rappmanager/en/latest/rappmanager-api.html
+
+rappmanager:
+  AefProfiles:
+  - interfaceDescriptions:
+    - ipv4Addr: "rappmanager.nonrtric.svc.cluster.local"
+      port: 8080
+      securityMethods:
+      - PKI
+    - ipv4Addr: "rappmanager.nonrtric.svc.cluster.local"
+      port: 8433
+      securityMethods:
+      - PSK
+    Versions:
+      - ApiVersion: ""
+        Resources:
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          - POST
+          - PUT
+          - DELETE
+          ResourceName: "rapps-rappId"
+          Uri: "/rapps/{rappId}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "rapps"
+          Uri: "/rapps"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          - PUT
+          - DELETE
+          ResourceName: "rapps-instance"
+          Uri: "/rapps/{rappId}/instance/{rappInstanceId}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          - POST
+          ResourceName: "rapps-all-instances"
+          Uri: "/rapps/{rappId}/instance"
+  ApiName: rapp-http
+
+# https://docs.o-ran-sc.org/projects/o-ran-sc-nonrtric-plt-a1policymanagementservice/en/latest/pms-api.html
+
+policymanagementservice:
+  AefProfiles:
+  - interfaceDescriptions:
+    - ipv4Addr: "policymanagementservice.nonrtric.svc.cluster.local"
+      port: 8081
+      securityMethods:
+      - PKI
+    - ipv4Addr: "policymanagementservice.nonrtric.svc.cluster.local"
+      port: 8433
+      securityMethods:
+      - PSK
+    Versions:
+      - ApiVersion: ""
+        Resources:
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - PUT
+          ResourceName: "putPolicy"
+          Uri: "/a1-policy/v2/policies"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          - DELETE
+          ResourceName: "Policy"
+          Uri: "/a1-policy/v2/policies/{policy_id}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "getPolicyIds"
+          Uri: "/a1-policy/v2/policies"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "getPolicyInstances"
+          Uri: "/a1-policy/v2/policy-instances"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "getPolicyStatus"
+          Uri: "/a1-policy/v2/policies/{policy_id}/status"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "getPolicyTypeDefinition"
+          Uri: "/a1-policy/v2/policy-types/{policytype_id}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "getPolicyTypes"
+          Uri: "/a1-policy/v2/policy-types"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "health"
+          Uri: "/actuator/health"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "healthPath"
+          Uri: "/actuator/health/**"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "heapdump"
+          Uri: "/actuator/heapdump"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "info"
+          Uri: "/actuator/info"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "ActuatorRootWebEndpoint"
+          Uri: "/actuator"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "logfile"
+          Uri: "/actuator/logfile"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "loggers"
+          Uri: "/actuator/loggers"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          - POST
+          ResourceName: "loggersName"
+          Uri: "/actuator/loggers/{name}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "metrics"
+          Uri: "/actuator/metrics"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "metricsRequiredMetricName"
+          Uri: "/actuator/metrics/{requiredMetricName}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - POST
+          ResourceName: "shutdown"
+          Uri: "/actuator/shutdown"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "threaddump"
+          Uri: "/actuator/threaddump"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          - PUT
+          ResourceName: "Configuration"
+          Uri: "/a1-policy/v2/configuration"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "getStatus"
+          Uri: "/a1-policy/v2/status"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "getStatusV1"
+          Uri: "/status"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "getRic"
+          Uri: "/a1-policy/v2/rics/ric"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "getRics"
+          Uri: "/a1-policy/v2/rics"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - DELETE
+          ResourceName: "deleteService"
+          Uri: "/a1-policy/v2/services/{service_id}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - PUT
+          ResourceName: "keepAliveService"
+          Uri: "/a1-policy/v2/services/{service_id}/keepalive"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - DELETE
+          ResourceName: "putService"
+          Uri: "/a1-policy/v2/services"
+  ApiName: a1-policy-http
+
+# https://docs.o-ran-sc.org/projects/o-ran-sc-nonrtric-plt-informationcoordinatorservice/en/h-release/ics-api.html
+
+informationservice:
+  AefProfiles:
+  - interfaceDescriptions:
+    - ipv4Addr: "informationservice.nonrtric.svc.cluster.local"
+      port: 9082
+      securityMethods:
+      - PKI
+    - ipv4Addr: "informationservice.nonrtric.svc.cluster.local"
+      port: 9083
+      securityMethods:
+      - PSK
+    Versions:
+      - ApiVersion: "v1"
+        Resources:
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "IndividualEIType"
+          Uri: "/A1-EI/eitypes/{eiTypeId}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "EIJobStatus"
+          Uri: "/A1-EI/v1/eijobs/{eiJobId}/status"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "EITypeIdentifiers"
+          Uri: "/A1-EI/eitypes"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          - DELETE
+          - PUT
+          ResourceName: "IndividualEIJob"
+          Uri: "/A1-EI/v1/eijobs/{eiJobId}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "EIJobIdentifiers"
+          Uri: "/A1-EI/v1/eijobs"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "ServiceStatus"
+          Uri: "/status"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "threaddump"
+          Uri: "/actuator/threaddump"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "loggers"
+          Uri: "/actuator/loggers"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "health"
+          Uri: "/actuator/health"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "healthPath"
+          Uri: "/actuator/health/**"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - POST
+          ResourceName: "shutdown"
+          Uri: "/actuator/shutdown"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "metrics"
+          Uri: "/actuator/metrics"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "metricsRequiredMetricName"
+          Uri: "/actuator/metrics/{requiredMetricName}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "ActuatorRootWebEndpoint"
+          Uri: "/actuator"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "info"
+          Uri: "/actuator/info"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "logfile"
+          Uri: "/actuator/logfile"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          - POST
+          ResourceName: "loggersName"
+          Uri: "/actuator/loggers/{name}"
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - GET
+          ResourceName: "heapdump"
+          Uri: "/actuator/heapdump"
+  ApiName: informationservice-http
diff --git a/nonrtric/servicemanager-preload/config-smo.yaml b/nonrtric/servicemanager-preload/config-smo.yaml
new file mode 100644 (file)
index 0000000..51f365c
--- /dev/null
@@ -0,0 +1,132 @@
+################################################################################
+#   Copyright (C) 2024 OpenInfra Foundation Europe. 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.                                             #
+################################################################################
+
+---
+
+# Preload services for smo install
+
+policy-apex-pdp:
+  AefProfiles:
+  - interfaceDescriptions:
+    - ipv4Addr: "policy-apex-pdp.nonrtric.svc.cluster.local"
+      port: 6969
+      securityMethods:
+      - PKI
+    Versions:
+      - ApiVersion: ""
+        Resources:
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - DELETE
+          - GET
+          - PATCH
+          - POST
+          - PUT
+          ResourceName: root
+          Uri: "/"
+  ApiName: policy-apex-pdp-http
+
+policy-api:
+  AefProfiles:
+  - interfaceDescriptions:
+    - ipv4Addr: "policy-api.nonrtric.svc.cluster.local"
+      port: 6969
+      securityMethods:
+      - PKI
+    Versions:
+      - ApiVersion: ""
+        Resources:
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - DELETE
+          - GET
+          - PATCH
+          - POST
+          - PUT
+          ResourceName: root
+          Uri: "/"
+  ApiName: policy-api-http
+
+policy-pap:
+  AefProfiles:
+  - interfaceDescriptions:
+    - ipv4Addr: "policy-pap.nonrtric.svc.cluster.local"
+      port: 6969
+      securityMethods:
+      - PKI
+    - ipv4Addr: "policy-pap.nonrtric.svc.cluster.local"
+      port: 5005
+      securityMethods:
+      - PSK
+    Versions:
+      - ApiVersion: ""
+        Resources:
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - DELETE
+          - GET
+          - PATCH
+          - POST
+          - PUT
+          ResourceName: root
+          Uri: "/"
+  ApiName: policy-pap-http
+
+sdnc-oam:
+  AefProfiles:
+  - interfaceDescriptions:
+    - ipv4Addr: "sdnc-oam.nonrtric.svc.cluster.local"
+      port: 8282
+      securityMethods:
+      - PKI
+    - ipv4Addr: "sdnc-oam.nonrtric.svc.cluster.local"
+      port: 8202
+      securityMethods:
+      - PSK
+    Versions:
+      - ApiVersion: ""
+        Resources:
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - DELETE
+          - GET
+          - PATCH
+          - POST
+          - PUT
+          ResourceName: root
+          Uri: "/"
+  ApiName: sdnc-oam-http
+
+sdnc-web:
+  AefProfiles:
+  - interfaceDescriptions:
+    - ipv4Addr: "sdnc-web.nonrtric.svc.cluster.local"
+      port: 8080
+      securityMethods:
+      - PKI
+    Versions:
+      - ApiVersion: ""
+        Resources:
+        - CommType: REQUEST_RESPONSE
+          Operations:
+          - DELETE
+          - GET
+          - PATCH
+          - POST
+          - PUT
+          ResourceName: root
+          Uri: "/"
+  ApiName: sdnc-web-http
diff --git a/nonrtric/servicemanager-preload/servicemanager-preload.sh b/nonrtric/servicemanager-preload/servicemanager-preload.sh
new file mode 100755 (executable)
index 0000000..fcf4a82
--- /dev/null
@@ -0,0 +1,382 @@
+#!/bin/bash
+
+################################################################################
+#   Copyright (C) 2024 OpenInfra Foundation Europe. 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.                                             #
+################################################################################
+
+function get_published_apis_payload() {
+
+    IFS=$'\n' read -d '' -r -a ipv4Ar <<< ${interfaceDescIpv4Addr}
+    IFS=$'\n' read -d '' -r -a portAr <<< ${interfaceDescPort}
+    IFS=$'\n' read -d '' -r -a securityMethodsAr <<< ${interfaceDescSecurityMethods}
+
+    interfaceDescArLen=${#ipv4Ar[@]}
+    >&2 echo "interfaceDescArLen: ${interfaceDescArLen}"
+
+    # Iterate over the array using array indexing
+    interfaceDescBlock=""
+    for (( i=0; i<interfaceDescArLen; i++ )); do
+        >&2 echo "ipv4Ar[$i]: ${ipv4Ar[$i]}"
+
+        interfaceDescItem="
+        {
+            \"ipv4Addr\": \"${ipv4Ar[$i]}\",
+            \"port\":  ${portAr[$i]},
+            \"securityMethods\":  ${securityMethodsAr[$i]}
+        }"
+        interfaceDescBlock="${interfaceDescBlock}${interfaceDescItem}, "
+        >&2 echo "interfaceDescItem: ${interfaceDescItem}"
+    done
+
+    # Trim the trailing space and comma
+    interfaceDescBlock="${interfaceDescBlock%??}"
+
+    >&2 echo "interfaceDescBlock: ${interfaceDescBlock}"
+
+
+    declare -a commType_array
+    read -r -a commType_array <<< "${resourcesAr["CommType"]}"
+
+    declare -a resourceName_array
+    read -r -a resourceName_array <<< "${resourcesAr["ResourceName"]}"
+
+    declare -a uri_array
+    read -r -a uri_array <<< "${resourcesAr["Uri"]}"
+
+    declare -a ops_array
+
+    ops_array=$(echo ${resourcesAr["Operations"]} | tr ' ' '*')
+
+    declare -a operations_array
+
+    IFS=',' read -r -a operations_array <<< "${ops_array}"
+
+    for operation in ${operations_array[@]}; do
+        >&2 echo "Operations Element: ${operation}"
+    done
+
+    ops_ar_length=${#operations_array[@]}
+
+    >&2 echo "ops_ar_length operations_array ${ops_ar_length}"
+
+    # Iterate over the array using array indexing
+    resourceBlock=""
+    for (( i=0; i<ops_ar_length; i++ )); do
+        IFS='*' read -r -a ops_per_resource <<< "${operations_array[$i]}"
+
+        resourceStart="
+        {
+            \"CommType\": \"${commType_array[$i]}\",
+            \"Operations\": [
+                "
+
+        # Print the array elements
+        resourceMid=""
+        for element in "${ops_per_resource[@]}"; do
+            resourceMid="${resourceMid}\"${element}\", "
+        done
+
+        resourceMid=$(sed 's/..$//' <<< "$resourceMid")
+        resourceMid="${resourceMid}
+            ],"
+
+
+        resourceEnd="
+            \"ResourceName\": \"${resourceName_array[$i]}\",
+            \"Uri\": \"${uri_array[$i]}\"
+        }"
+
+
+        resourceItem="${resourceStart}${resourceMid}${resourceEnd}"
+
+        resourceBlock="${resourceBlock}${resourceItem}, "
+    done
+
+    resourceBlock=${resourceBlock::-2}
+
+    payload="{
+    \"AefProfiles\": [
+        {
+            \"AefId\": \"${aefId}\",
+            \"interfaceDescriptions\": [
+                ${interfaceDescBlock}
+            ],
+            \"DomainName\": \"${domainName}\",
+            \"Protocol\": \"HTTP_1_1\",
+            \"Versions\": [
+                {
+                    \"ApiVersion\": ${ApiVersion},
+                    \"Resources\": [
+                    ${resourceBlock}
+                    ]
+                }
+            ]
+        }
+    ],
+    \"ApiName\": ${api_name},
+    \"Description\": \"Description,namespace,repoName,chartName,releaseName\"
+}"
+    >&2 echo "payload ${payload}"
+
+    echo $payload | jq .
+}
+
+function publish_service() {
+    echo "Publish  service  for $service_name"
+
+    aef_profiles=$(echo "$service" | jq -c '.value.AefProfiles')
+    api_name=$(echo "$service" | jq -c '.value.ApiName')
+
+    echo "$aef_profiles" | jq -c '.[]' | while read -r aef_profile; do
+
+        interfaceDescriptions=$(echo "$aef_profile" | jq -c '.interfaceDescriptions')
+
+        >&2 echo "interfaceDescriptions: ${interfaceDescriptions}";
+
+        interfaceDescIpv4Addr=$(echo $interfaceDescriptions | jq -r .[]."ipv4Addr")
+        interfaceDescPort=$(echo $interfaceDescriptions | jq .[]."port")
+        interfaceDescSecurityMethods=$(echo $interfaceDescriptions | jq -c .[]."securityMethods")
+
+        >&2 echo "interfaceDescIpv4Addr: ${interfaceDescIpv4Addr}";
+        >&2 echo "interfaceDescPort: ${interfaceDescPort}";
+        >&2 echo "interfaceDescSecurityMethods: ${interfaceDescSecurityMethods}";
+
+        versions=$(echo "$aef_profile" | jq -c '.Versions[]')
+
+        ApiVersion=$(echo "$versions" | jq -c '.ApiVersion')
+        >&2 echo "ApiVersion: $ApiVersion"
+
+        Resources=$(echo "$versions" | jq -c '.Resources[]')
+
+        # Parse Resources
+        declare -A resourcesAr
+
+        commTypeCsv=""
+
+        for row in $(echo "$Resources" | jq -c '.CommType'); do
+            commType=$(echo "$row" | jq -r '.');
+            >&2 echo "commType: $commType";
+            commTypeCsv="${commTypeCsv}${commType} "
+            >&2 echo "Building commTypeCsv ${commTypeCsv}"
+        done
+
+        commTypeCsv=$(echo "$commTypeCsv" | xargs)
+        resourcesAr["CommType"]=${commTypeCsv}
+
+        resourceNameCsv=""
+        for row in $(echo "$Resources" | jq -c '.ResourceName'); do
+            resourceName=$(echo "$row" | jq -r '.');
+            >&2 echo "resourceName: $resourceName";
+            resourceNameCsv="${resourceNameCsv}${resourceName} "
+            >&2 echo "Building resourceNameCsv ${resourceNameCsv}"
+        done
+        resourceNameCsv=$(echo "$resourceNameCsv" | xargs)
+        resourcesAr["ResourceName"]=$resourceNameCsv
+
+        uriCsv=""
+        for row in $(echo "$Resources" | jq -c '.Uri'); do
+            uri=$(echo "$row" | jq -r '.');
+            >&2 echo "uri: $uri";
+            uriCsv="${uriCsv}${uri} "
+            >&2 echo "Building uriCsv ${uriCsv}"
+        done
+        uriCsv=$(echo "$uriCsv" | xargs)
+        resourcesAr["Uri"]=$uriCsv
+
+        operationsCsv=""
+        for row in $(echo "$Resources" | jq -c '.Operations'); do
+            operations=$(echo "$row" | jq -r '.[]')
+            >&2 echo "operations: $operations";
+            operationsCsv="${operationsCsv}${operations},"
+            >&2 echo "Building operationsCsv ${operationsCsv}"
+        done
+        resourcesAr["Operations"]=$operationsCsv
+
+        payload=$(get_published_apis_payload)
+
+        # Make the REST call
+        url="http://${first_node_ip}:${servicemanager_node_port}/published-apis/v1/${apfId}/service-apis"
+        >&2 echo "published-apis url: ${url}"
+        response=$(curl -s -X POST -H "Content-Type: application/json" -d "$payload" "$url")
+
+        ret=$?
+        if [ $ret -ne 0 ]; then
+            echo "REST call to Service Manager/published-apis failed, error code $ret"
+            return $ret
+        fi
+
+        resp_code=$(echo $response | jq -r '.status')
+        if [ "$resp_code" != "null" ] && [ "$resp_code" != "201" ]; then
+            echo "Failed to publish service $service_name with response code $resp_code"
+        fi
+
+        response=$(echo "${response}" | jq .)
+        >&2 echo "Response for published service $service_name: $response"
+    done
+    return 0
+}
+
+function register_provider() {
+    # Make the REST call
+    url="http://${first_node_ip}:${servicemanager_node_port}/api-provider-management/v1/registrations"
+    response=$(curl -s -X POST -H "Content-Type: application/json" -d "$payload" "$url")
+
+    ret=$?
+    if [ $ret -ne 0 ]; then
+        echo "REST call to Service Manager/api-provider-management failed, error code $ret"
+        status="$ret"
+    else
+        check_resp=$(jq --argjson resp "$response" -n '$resp.apiProvDomId')
+        if [ $check_resp != "null" ]; then
+            status=201
+        else
+            status=$(jq --argjson resp "$response" -n '$resp.status')
+        fi
+    fi
+    echo $status
+}
+
+function get_registrations_payload() {
+    payload="{
+    \"apiProvDomInfo\": \"${domainName}\",
+    \"apiProvFuncs\": [
+        {
+            \"apiProvFuncInfo\": \"${apf_info}\",
+            \"apiProvFuncRole\": \"APF\",
+            \"regInfo\": {
+                \"apiProvPubKey\": \"APF-PublicKey\"
+            }
+        },
+        {
+            \"apiProvFuncInfo\": \"${aef_info}\",
+            \"apiProvFuncRole\": \"AEF\",
+            \"regInfo\": {
+                \"apiProvPubKey\": \"AEF-PublicKey\"
+            }
+        }
+    ],
+    \"regSec\": \"${service_name}-regsec\"
+}"
+    echo $payload
+}
+
+function register_apf() {
+    echo "Register provider for ${service_name}"
+    # Prepare the JSON payload for the REST calls
+    apf_info="${service_name} as APF"
+    aef_info="${service_name} as AEF"
+    aefId="AEF_id_${service_name}_as_AEF"
+    apfId="APF_id_${service_name}_as_APF"
+
+    payload=$(get_registrations_payload)
+    >&2 echo "Registration payload: $payload"
+    resp=$(register_provider)
+
+    if [ $resp != 201 ]; then
+        >&2 echo "Failed to register provider with error code ${resp}"
+        return $resp
+    fi
+    return 0
+}
+
+function find_running_services_from_config() {
+    result=""
+
+    # Extract service names from YAML using yq and strip leading/trailing whitespace
+    SERVICE_NAMES=$(yq eval '. | keys[]' "$yaml_file")
+
+    # Check each service using kubectl
+    for service in $SERVICE_NAMES; do
+        >&2 echo "Checking service: $service in nonrtric"
+        # Use kubectl get to check if the service exists and capture the output
+        SERVICE_STATUS=$(kubectl get service "$service" -n nonrtric)
+
+        if [ $? = 0 ]; then
+            >&2 echo "Service $service is found in nonrtric"
+            result+="$service "
+        else
+            >&2 echo "Service $service is not running in nonrtric"
+            SERVICE_STATUS=$(kubectl get service "$service" -n onap)
+            if [ $? = 0 ]; then
+                >&2 echo "Service $service is found in onap"
+                result+="$service "
+            else
+                >&2 echo "Service $service is not found in onap"
+            fi
+        fi
+    done
+
+    # Trim trailing whitespace
+    result=$(echo "$result" | xargs)
+    echo $result
+}
+
+function publish_services_from_config() {
+    echo "Find running services"
+    domainName="kong"
+    running_services_list=$(find_running_services_from_config)
+
+    # Iterate through the configured services
+    echo "$json_config" | jq -c 'to_entries[]' | while read -r service; do
+        service_name=$(echo "$service" | jq -r '.key')
+        if echo "$running_services_list" | grep -q "$service_name"; then
+            register_apf
+            ret=$?
+            if [ $ret -ne 0 ]; then
+                break
+            fi
+
+            publish_service
+            ret=$?
+            if [ $ret -ne 0 ]; then
+                break
+            fi
+        fi
+    done
+}
+
+# Ensure yq and jq are installed
+if ! command -v yq &> /dev/null; then
+    >&2 echo "yq is not installed. Installing yq..."
+    sudo snap install yq --channel=v4/stable
+fi
+
+if ! command -v jq &> /dev/null; then
+    >&2 echo "jq is not installed. Installing jq..."
+    sudo snap install jq
+fi
+
+# Read and parse the YAML file
+yaml_file="${1:-config.yaml}"
+json_config=$(yq eval "$yaml_file" -o=json)
+
+echo "Preloading Service Manager from ${yaml_file}"
+
+# Get our Node IP and nodePort
+first_node_ip=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
+servicemanager_node_port=$(kubectl get service servicemanager -n nonrtric -o jsonpath='{.spec.ports[0].nodePort}')
+
+echo "Waiting for capifcore deployment"
+kubectl wait --for=condition=Available -n nonrtric --timeout=300s deploy/capifcore
+
+echo "Waiting for servicemanager deployment"
+kubectl wait --for=condition=Available -n nonrtric --timeout=300s deploy/servicemanager
+
+echo "Waiting for kong deployment"
+kubectl wait --for=condition=Available -n nonrtric --timeout=300s deploy/oran-nonrtric-kong
+
+publish_services_from_config
+
+echo "Service Manager preload completed for ${yaml_file}"
diff --git a/ranpm b/ranpm
index 696b3a4..a0cc224 160000 (submodule)
--- a/ranpm
+++ b/ranpm
@@ -1 +1 @@
-Subproject commit 696b3a4eb9eecf92b99e62e0081f7140c0294155
+Subproject commit a0cc224eb1784bd9fc7626531d02cd4d9c39cd38
index 2743951..9992193 100644 (file)
@@ -4,7 +4,7 @@ MR_HOSTPORT="$_MR_HOSTPORT"
 MR_TOPIC="$_MR_TOPIC"
 LOGSTASH_URL="$_LOGSTASH_URL"
 
-if ! jq --version > /dev/null 2&>1 ; then
+if ! jq --version > /dev/null 2>&1 ; then
   apt-get update
   apt-get install -y jq curl
 fi
@@ -30,8 +30,8 @@ while true; do
     DATA=$(echo $DATA |jq -r --arg source "$source"  '.[] | $source+","+((.event.measurementsForVfScalingFields.additionalFields[1].value) | tostring)+ ","+ ((.event.measurementsForVfScalingFields.additionalFields[2].value) | tostring)')
   #EVENTS=$(echo $DATA |jq -r '.event.measurementFields.additionalFields.SgNBRequestRate')
   #for EVENT in $EVENTS; do
-  elif [ "$source" == "AC xAPP" ] 
-  then  
+  elif [ "$source" == "AC xAPP" ]
+  then
     DATA=$(echo $DATA |jq -r --arg source "$source"  '.[] | $source+","+((.event.measurementsForVfScalingFields.additionalFields[0].value) | tostring)')
   else
     DATA="No supportive reporting entity provided"
@@ -40,4 +40,3 @@ while true; do
   curl -i -XPUT "${LOGSTASH_URL}" -d "${DATA}"
   #done
 done
-
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
+
 {{- define "common.name.servicemanager" -}}
   {{- printf "servicemanager" -}}
 {{- end -}}
+
 {{- define "common.container.servicemanager" -}}
   {{- $name := ( include "common.name.servicemanager" . ) -}}
   {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}}
index 52403d2..b159e96 100644 (file)
@@ -43,6 +43,7 @@ nonrtric:
   installHelmmanager: true
   installrAppmanager: true
   installCapifcore: true
+  installServicemanager: true
   # override default mount path root directory
   # referenced by persistent volumes and log files
   persistence:
index 574ef5d..40d8173 100644 (file)
@@ -43,6 +43,7 @@ nonrtric:
   installHelmmanager: true
   installrAppmanager: true
   installCapifcore: true
+  installServicemanager: true
   # override default mount path root directory
   # referenced by persistent volumes and log files
   persistence:
index 9b0c2de..50634cc 100644 (file)
@@ -43,6 +43,7 @@ nonrtric:
   installHelmmanager: true
   installrAppmanager: true
   installCapifcore: true
+  installServicemanager: true
   # override default mount path root directory
   # referenced by persistent volumes and log files
   persistence:
index a2145ae..b2459ae 100644 (file)
@@ -1,7 +1,7 @@
-#  ============LICENSE_START===============================================
+#  ============LICENSE_START================================================
 #  Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
-#  Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
-#  ========================================================================
+#  Copyright (C) 2023-2024 OpenInfra Foundation Europe. 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
 #  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=================================================
+#  ============LICENSE_END==================================================
 
 image:
   repository: 'nexus3.o-ran-sc.org:10002/o-ran-sc'
   name: a1-simulator
-  tag: 2.6.1
+  tag: 2.7.0
   pullPolicy: IfNotPresent
 service:
   type: ClusterIP
index 8d9cf80..fb4e1cd 100644 (file)
@@ -20,9 +20,9 @@
 
 imagePullPolicy: IfNotPresent
 image:
-  registry: 'nexus3.o-ran-sc.org:10002/o-ran-sc'
+  registry: 'nexus3.o-ran-sc.org:10004/o-ran-sc'
   name: nonrtric-plt-capifcore
-  tag: 1.2.0
+  tag: 1.4.0
 service:
   type: ClusterIP
   ports:
index 374861f..4e53c54 100644 (file)
@@ -1,9 +1,12 @@
 events{}
+
 http {
     include /etc/nginx/mime.types;
+
     upstream backend {
-        server  kong-proxy.kong:80;
+        server oran-nonrtric-kong-proxy.nonrtric:80;
     }
+
     server {
         listen 8080;
         server_name localhost;
index 40665dc..62cc766 100644 (file)
@@ -1,5 +1,6 @@
 ################################################################################
-#   Copyright (c) 2021 Nordix Foundation.                                      #
+#  Copyright (c) 2021-22 Nordix Foundation. All rights reserved.               #
+#  Copyright (C) 2023-2024 OpenInfra Foundation Europe. 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.           #
@@ -22,7 +23,7 @@ imagePullPolicy: IfNotPresent
 image:
   registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
   name: "nonrtric-plt-dmaapadapter"
-  tag: 1.3.0
+  tag: 1.4.0
 service:
   type: ClusterIP
   ports:
diff --git a/smo-install/oran_oom/kong/.helmignore b/smo-install/oran_oom/kong/.helmignore
new file mode 100644 (file)
index 0000000..0e8a0eb
--- /dev/null
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/smo-install/oran_oom/kong/Chart.yaml b/smo-install/oran_oom/kong/Chart.yaml
new file mode 100644 (file)
index 0000000..9e2ab91
--- /dev/null
@@ -0,0 +1,26 @@
+#  ============LICENSE_START========================================================
+#  Modification Copyright (C) 2024 OpenInfra Foundation Europe. 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==========================================================
+
+apiVersion: v2
+name: kong
+description: A Helm chart for deploying DB-mode Kong with Postgres
+version: 1.0.0
+appVersion: "1.0.0"
+
+dependencies:
+  - name: kong
+    version: "2.38.0"
+    repository: https://nexus3.o-ran-sc.org/repository/helm-konghq/
diff --git a/smo-install/oran_oom/kong/templates/00-kong-pv.yaml b/smo-install/oran_oom/kong/templates/00-kong-pv.yaml
new file mode 100644 (file)
index 0000000..a12ad6a
--- /dev/null
@@ -0,0 +1,33 @@
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2024 OpenInfra Foundation Europe. 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=================================================
+#
+
+{{- if .Values.kongpv.enabled }}
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: kongpv
+  labels:
+    type: local
+spec:
+  capacity:
+    storage: "{{ .Values.kongpv.persistence.size }}"
+  accessModes:
+    - "{{ .Values.kongpv.persistence.accessMode }}"
+  hostPath:
+    path: "{{ .Values.kongpv.persistence.path }}"
+  persistentVolumeReclaimPolicy: "{{ .Values.kongpv.persistence.volumeReclaimPolicy }}"
+{{- end }}
diff --git a/smo-install/oran_oom/kong/templates/01-kongpvc.yaml b/smo-install/oran_oom/kong/templates/01-kongpvc.yaml
new file mode 100644 (file)
index 0000000..5f631cf
--- /dev/null
@@ -0,0 +1,29 @@
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2024 OpenInfra Foundation Europe. 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=================================================
+#
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: data-oran-nonrtric-postgresql-0
+spec:
+  accessModes:
+    - "{{ .Values.kongpvc.persistence.accessMode }}"
+  resources:
+    requests:
+      storage: "{{ .Values.kongpvc.persistence.size }}"
+{{- if .Values.kongpv.enabled }}
+  volumeName: kongpv
+{{- end }}
diff --git a/smo-install/oran_oom/kong/values.yaml b/smo-install/oran_oom/kong/values.yaml
new file mode 100644 (file)
index 0000000..527f0d0
--- /dev/null
@@ -0,0 +1,149 @@
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2024 OpenInfra Foundation Europe. 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=================================================
+
+# Default values for Kong PV and PVC
+
+kongpv:
+  enabled: true # Disabled for Minikube
+  persistence:
+    volumeReclaimPolicy: Delete
+    accessMode: ReadWriteOnce
+    size: 2Gi
+    path: "/tmp/kongpv"
+
+kongpvc:
+  persistence:
+    volumeReclaimPolicy: Delete
+    accessMode: ReadWriteOnce
+    size: 2Gi
+
+#
+# Default values for Kong's Helm Chart.
+#
+
+kong:
+  # Sections:
+  # - Deployment parameters
+  # - Kong parameters
+  # - Ingress Controller parameters
+  # - Postgres sub-chart parameters
+  # - Miscellaneous parameters
+  # For a detailed example of values.yaml, please see https://github.com/Kong/charts/blob/main/charts/kong/values.yaml
+  # -----------------------------------------------------------------------------
+  # Deployment parameters
+  # -----------------------------------------------------------------------------
+  deployment:
+    kong:
+      enabled: true
+    serviceAccount:
+      create: true
+      automountServiceAccountToken: false
+  # -----------------------------------------------------------------------------
+  # Kong parameters
+  # -----------------------------------------------------------------------------
+  env:
+    database: "postgres"
+  # Specify Kong's Docker image and repository details here
+  image:
+    repository: kong
+    tag: "3.4"
+    pullPolicy: IfNotPresent
+  # Specify Kong admin API service and listener configuration
+  admin:
+    enabled: true
+    type: NodePort
+    http:
+      # Enable plaintext HTTP listen for the admin API
+      enabled: true
+      servicePort: 8001
+      containerPort: 8001
+      nodePort: 32081
+      parameters: []
+    tls:
+      # Enable HTTPS listen for the admin API
+      enabled: false
+      servicePort: 8444
+      containerPort: 8444
+      nodePort: 32444
+      parameters:
+      - http2
+    ingress:
+      enabled: false
+  # Specify Kong proxy service configuration
+  proxy:
+    # Enable creating a Kubernetes service for the proxy
+    enabled: true
+    type: LoadBalancer
+    loadBalancerClass:
+    nameOverride: ""
+    annotations: {}
+    labels:
+      enable-metrics: "true"
+    http:
+      # Enable plaintext HTTP listen for the proxy
+      enabled: true
+      servicePort: 80
+      containerPort: 8000
+      # Set a nodePort which is available if service type is NodePort
+      nodePort: 32080
+      parameters: []
+    tls:
+      # Enable HTTPS listen for the proxy
+      enabled: false
+      servicePort: 443
+      containerPort: 8443
+      parameters:
+      - http2
+  # -----------------------------------------------------------------------------
+  # Ingress Controller parameters
+  # -----------------------------------------------------------------------------
+  ingressController:
+    enabled: true
+    installCRDs: false
+    image:
+      repository: kong/kubernetes-ingress-controller
+      tag: "3.0"
+    env:
+      kong_admin_tls_skip_verify: true
+  # -----------------------------------------------------------------------------
+  # Postgres sub-chart parameters
+  # -----------------------------------------------------------------------------
+  postgresql:
+    enabled: true
+    auth:
+      database: kong
+      username: kong
+      password: kong
+      postgresPassword: kong
+    image:
+      # use postgres < 14 until is https://github.com/Kong/kong/issues/8533 resolved
+      tag: 13.11.0-debian-11-r20
+    service:
+      ports:
+        postgresql: "5432"
+    volumePermissions:
+      enabled: true
+    primary:
+      persistence:
+        existingClaim: data-oran-nonrtric-postgresql-0
+  # -----------------------------------------------------------------------------
+  # Miscellaneous parameters
+  # -----------------------------------------------------------------------------
+  waitImage:
+    enabled: true
+    pullPolicy: IfNotPresent
+  replicaCount: 1
index e7dd005..5462a68 100644 (file)
@@ -1,3 +1,19 @@
+#  ============LICENSE_START========================================================
+#  Modification Copyright (C) 2024 OpenInfra Foundation Europe. 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==========================================================
+
 apiVersion: v2
 name: nonrtric
 version: 1.0.0
@@ -79,8 +95,8 @@ dependencies:
     condition: nonrtric.installHelmmanager
 
   - name: kong
-    version: ~2.4.0
-    repository: https://nexus3.o-ran-sc.org/repository/helm-konghq/
+    version: ~1.0.0
+    repository: "@local"
     condition: nonrtric.installKong
 
   - name: dmaapadapterservice
@@ -97,3 +113,8 @@ dependencies:
     version: ~1.0.0
     repository: "@local"
     condition: nonrtric.installCapifcore
+
+  - name: servicemanager
+    version: ~1.0.0
+    repository: "@local"
+    condition: nonrtric.installServicemanager
index f344441..7b862a7 100644 (file)
@@ -44,6 +44,7 @@ nonrtric:
   installHelmmanager: true
   installrAppmanager: true
   installCapifcore: true
+  installServicemanager: true
 
   volume1:
     size: 1Gi
index f75f811..c7027e5 100644 (file)
@@ -42,7 +42,7 @@ secrets:
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.o-ran-sc.org:10002/o-ran-sc/nonrtric-plt-participant-impl-dme:0.0.1
+image: nexus3.o-ran-sc.org:10002/o-ran-sc/nonrtric-plt-participant-impl-dme:0.1.0
 pullPolicy: Always
 
 componentName: &componentName policy-clamp-ac-dme-ppnt
index e34f886..cac8329 100644 (file)
@@ -1,7 +1,7 @@
-#  ============LICENSE_START===============================================
+#  ============LICENSE_START================================================
 #  Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
-#  Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
-#  ========================================================================
+#  Copyright (C) 2023-2024 OpenInfra Foundation Europe. 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
@@ -13,7 +13,7 @@
 #  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=================================================
+#  ============LICENSE_END==================================================
 
 # Default values for Policy Management Service.
 # This is a YAML-formatted file.
@@ -23,7 +23,7 @@ imagePullPolicy: IfNotPresent
 image:
   registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
   name: nonrtric-plt-a1policymanagementservice
-  tag: 2.7.0
+  tag: 2.8.0
 service:
   type: NodePort
   ports:
index dd7a2c7..1429b07 100644 (file)
@@ -24,7 +24,7 @@ imagePullPolicy: IfNotPresent
 image:
   registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
   name: nonrtric-plt-rappmanager
-  tag: 0.0.1
+  tag: 0.1.0
 service:
   type: ClusterIP
   ports:
diff --git a/smo-install/oran_oom/servicemanager/Chart.yaml b/smo-install/oran_oom/servicemanager/Chart.yaml
new file mode 100644 (file)
index 0000000..db6a13e
--- /dev/null
@@ -0,0 +1,27 @@
+################################################################################
+#   Copyright (c) 2024 OpenInfra Foundation Europe.                            #
+#                                                                              #
+#   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.                                             #
+################################################################################
+
+
+apiVersion: v2
+appVersion: "2.0.0"
+description: A Helm chart for ServiceManager
+name: servicemanager
+version: 1.0.0
+
+dependencies:
+  - name: nonrtric-common
+    version: ^2.0.0
+    repository: "@local"
diff --git a/smo-install/oran_oom/servicemanager/templates/configmap.yaml b/smo-install/oran_oom/servicemanager/templates/configmap.yaml
new file mode 100644 (file)
index 0000000..746b039
--- /dev/null
@@ -0,0 +1,24 @@
+################################################################################
+#   Copyright (c) 2024 OpenInfra Foundation Europe.                            #
+#                                                                              #
+#   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.                                             #
+################################################################################
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: servicemanager-configmap
+data:
+{{- range $key, $value := .Values.data }}
+  {{ $key }}: |
+{{ $value | indent 4 }}
+{{- end }}
diff --git a/smo-install/oran_oom/servicemanager/templates/deployment.yaml b/smo-install/oran_oom/servicemanager/templates/deployment.yaml
new file mode 100644 (file)
index 0000000..fd76886
--- /dev/null
@@ -0,0 +1,39 @@
+################################################################################
+#   Copyright (c) 2024 OpenInfra Foundation Europe.                            #
+#                                                                              #
+#   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.                                             #
+################################################################################
+
+kind: Deployment
+apiVersion: apps/v1
+metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
+spec:
+  replicas: 1
+  selector: {{- include "common.selectors" . | nindent 4 }}
+  template:
+    metadata: {{- include "common.templateMetadata" . | nindent 6 }}
+    spec:
+      hostname: {{ include "common.name" . }}
+      containers:
+      - name:  {{ include "common.containername" . }}
+        image: {{ .Values.image.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag }}
+        imagePullPolicy: {{ .Values.imagePullPolicy }}
+        {{- include "common.tcpsocketProbes" . | nindent 8 }}
+        volumeMounts:
+        - name: servicemanager-config-volume
+          mountPath: /app/servicemanager/.env
+          subPath: .env
+      volumes:
+      - name: servicemanager-config-volume
+        configMap:
+          name:  servicemanager-configmap
diff --git a/smo-install/oran_oom/servicemanager/templates/service.yaml b/smo-install/oran_oom/servicemanager/templates/service.yaml
new file mode 100644 (file)
index 0000000..3a64f6a
--- /dev/null
@@ -0,0 +1,17 @@
+################################################################################
+#   Copyright (C) 2024 OpenInfra Foundation Europe. 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.                                             #
+################################################################################
+
+{{ include "common.service" . }}
diff --git a/smo-install/oran_oom/servicemanager/values.yaml b/smo-install/oran_oom/servicemanager/values.yaml
new file mode 100644 (file)
index 0000000..28a4974
--- /dev/null
@@ -0,0 +1,75 @@
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2024 OpenInfra Foundation Europe. 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=================================================
+
+# Default values for Servicemanager
+
+imagePullPolicy: IfNotPresent
+image:
+  registry: 'nexus3.o-ran-sc.org:10004/o-ran-sc'
+  name: nonrtric-plt-servicemanager
+  tag: 0.1.3
+service:
+  httpName: http
+  ports:
+  - name: http
+    internalPort: "8095"
+    targetPort: "8095"
+    nodePort: 31575
+  type: NodePort
+liveness:
+  initialDelaySeconds: 300
+  periodSeconds: 10
+readiness:
+  initialDelaySeconds: 60
+  periodSeconds: 10
+resources:
+  small:
+    limits:
+      cpu: 250m
+      memory: 256Mi
+    requests:
+      cpu: 80m
+      memory: 128Mi
+  large:
+    limits:
+      cpu: 400m
+      memory: 8Gi
+    requests:
+      cpu: 200m
+      memory: 2Gi
+  unlimited: {}
+nameOverride: ""
+
+
+allowHttp: true
+SERVICE_MANAGER_ENV: ""
+
+data:
+  .env: |
+    # The Kong Data plane provides the endpoint that Service Manager gives to the rApp so that the rApp can invoke the CAPIF published API.
+    # In a Kubernetes environment, we need to use the Kong NodePort IP and nodePort if the rApp needs access from outside the Kong cluster.
+    # From inside the Kong cluster, we can use the Kubernetes cluster DNS entry, oran-nonrtric-kong-proxy.nonrtric.svc.cluster.local.
+    KONG_DOMAIN: "kong"
+    KONG_PROTOCOL: "http"
+    KONG_CONTROL_PLANE_IPV4: "oran-nonrtric-kong-admin.nonrtric.svc.cluster.local"
+    KONG_CONTROL_PLANE_PORT: "8001"
+    KONG_DATA_PLANE_IPV4: "oran-nonrtric-kong-proxy.nonrtric.svc.cluster.local"
+    KONG_DATA_PLANE_PORT: "80"
+    CAPIF_PROTOCOL: "http"
+    CAPIF_IPV4: "capifcore.nonrtric.svc.cluster.local"
+    CAPIF_PORT: "8090"
+    LOG_LEVEL: "Info"
+    SERVICE_MANAGER_PORT: "8095"
index 2926b40..4f58600 100755 (executable)
@@ -1,12 +1,12 @@
 #!/bin/bash
 
 ###
-# ============LICENSE_START=======================================================
+# ============LICENSE_START========================================================
 # ORAN SMO Package
-# ================================================================================
-# Copyright (C) 2021 AT&T Intellectual Property. All rights
-#                             reserved.
-# ================================================================================
+# =================================================================================
+# Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+# Modification Copyright (C) 2024 OpenInfra Foundation Europe. 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
 # 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============================================
-# ===================================================================
-# 
+# ============LICENSE_END==========================================================
+# =================================================================================
+#
 ###
 
 kubectl create namespace nonrtric
 echo  '### Installing ORAN NONRTRIC part ###'
-helm install --debug oran-nonrtric local/nonrtric --namespace nonrtric -f $1 --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$2"
+
+OVERRIDEYAML=$1
+
+if ! command -v yq > /dev/null 2>&1; then
+    echo "yq is not installed. Installing yq..."
+    sudo snap install yq --channel=v4/stable
+fi
+
+INSTALL_KONG=$(cat $OVERRIDEYAML | yq e '.nonrtric.installKong' -)
+if [ $? -ne 0 ] || [ -z "$INSTALL_KONG"  ]; then
+    echo "Error: failed to parse installKong from YAML with yq. Aborting install."
+    exit 1
+fi
+
+INSTALL_CAPIF=$(cat $OVERRIDEYAML | yq e '.nonrtric.installCapifcore' -)
+if [ $? -ne 0 ] || [ -z "$INSTALL_CAPIF"  ]; then
+    echo "Error: failed to parse installCapifcore from YAML with yq. Aborting install."
+    exit 1
+fi
+
+INSTALL_SERVICEMANAGER=$(cat $OVERRIDEYAML | yq e '.nonrtric.installServicemanager' -)
+if [ $? -ne 0 ] || [ -z "$INSTALL_SERVICEMANAGER"  ]; then
+    echo "Error: failed to parse installServicemanager from YAML with yq. Aborting install."
+    exit 1
+fi
+
+if [ "$INSTALL_SERVICEMANAGER" == "true" ]; then
+    if [ "$INSTALL_KONG" == "false" ]; then
+        echo "Error: INSTALL_KONG must be true if INSTALL_SERVICEMANAGER is true. Aborting install."
+        exit 1
+    fi
+    if [ "$INSTALL_CAPIF" == "false" ]; then
+        echo "Error: INSTALL_CAPIF must be true if INSTALL_SERVICEMANAGER is true. Aborting install."
+        exit 1
+    fi
+fi
+
+helm install --debug oran-nonrtric local/nonrtric --namespace nonrtric -f $OVERRIDEYAML --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$2"
+
+if [ "$INSTALL_SERVICEMANAGER" == "true" ]; then
+    pushd ../../../servicemanager-preload
+    # Send stderr to /dev/null to turn off chatty logging
+    ./servicemanager-preload.sh config-nonrtric.yaml 2>/dev/null
+    ./servicemanager-preload.sh config-smo.yaml 2>/dev/null
+    popd
+fi
index 6c528e3..ee52b7c 100755 (executable)
@@ -1,12 +1,13 @@
 #!/bin/bash
 
 ###
-# ============LICENSE_START=======================================================
+# ============LICENSE_START========================================================
 # ORAN SMO Package
-# ================================================================================
+# =================================================================================
 # Copyright (C) 2021 AT&T Intellectual Property. All rights
 #                             reserved.
-# ================================================================================
+# Modification Copyright (C) 2024 OpenInfra Foundation Europe. 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
 # 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============================================
-# ===================================================================
-# 
+# ============LICENSE_END==========================================================
+# =================================================================================
+#
 ###
 
+if ! jq --version > /dev/null 2>&1 ; then
+    sudo apt-get update
+    sudo apt-get install -y jq
+fi
+
+INSTALL_KONG=$(helm get values oran-nonrtric -n nonrtric -o json | jq '.nonrtric.installKong')
+if [ $? -ne 0 ]; then
+    echo "Failed to parse helm release value installKong with jq."
+    exit 1
+fi
+
+if [ "$INSTALL_KONG" = true ];then
+    echo "Warning - deleting Kong routes and services for ServiceManager."
+    SERVICEMANAGER_POD=$(kubectl get pods -o custom-columns=NAME:.metadata.name -l app.kubernetes.io/name=servicemanager --no-headers -n nonrtric)
+    if [[ -n $SERVICEMANAGER_POD ]]; then
+        kubectl exec $SERVICEMANAGER_POD -n nonrtric -- ./kongclearup
+    else
+        echo "Error - Servicemanager pod not found, didn't delete Kong routes and services for ServiceManager."
+    fi
+fi
+
 kubectl delete namespace nonrtric
 kubectl delete pv nonrtric-pv2
 kubectl delete pv nonrtric-pv1
index 9f675ab..3857b30 100755 (executable)
@@ -4,7 +4,7 @@ enrichment_service_url=${1:-localhost:9082}
 a1_sim_OSC_url=${2:-localhost:8085}
 a1_sim_STD_url=${3:-localhost:8085}
 a1_sim_STD_v2_url=${4:-localhost:8085}
-policy_agent_url=${5:-localhost:9080}
+policy_agent_url=${5:-localhost:8081}
 a1_controller_url=${6:false}
 
 echo -e "NONRTRIC HealthCheck\n"
@@ -47,7 +47,7 @@ checkStatus "curl -vskw %{http_code} http://$a1_sim_STD_v2_url/" "OK200" "SIM3"
 
 # check PMS status
 echo "check Policy Agent status:"
-checkStatus "curl -vskw %{http_code} http://$policy_agent_url/status" "hunky dory200" "PMS"
+checkStatus "curl -vskw %{http_code} http://$policy_agent_url/status" "success200" "PMS"
 
 # check ECS status
 echo "check Enrichment service status:"
index 9a06a86..2d3fd23 100755 (executable)
@@ -31,7 +31,7 @@ dmaap_mr_url=${1:-localhost:3904}
 a1_sim_OSC_url=${2:-localhost:8085}
 a1_sim_STD_url=${3:-localhost:8085}
 a1_sim_STD_v2_url=${4:-localhost:8085}
-policy_agent_url=${5:-localhost:9081}
+policy_agent_url=${5:-localhost:8081}
 httpx=${6:-"http"}
 
 echo "using dmaap-mr url: "$dmaap_mr_url
index 4919481..fc874e0 100755 (executable)
@@ -29,7 +29,7 @@
 
 a1_sim_OSC_url=${1:-localhost:8085}
 a1_sim_STD_v2_url=${2:-localhost:8085}
-policy_agent_url=${3:-localhost:9081}
+policy_agent_url=${3:-localhost:8081}
 httpx=${4:-"http"}
 SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
 
@@ -52,7 +52,7 @@ echo "policy agent status:"
 curlString="curl -skw %{http_code} $httpx://$policy_agent_url/status"
 res=$($curlString)
 echo "$res"
-expect="hunky dory200"
+expect="success200"
 checkRes
 echo -e "\n"