Skip to content

Latest commit

 

History

History
134 lines (107 loc) · 6.4 KB

Build_guide.md

File metadata and controls

134 lines (107 loc) · 6.4 KB

Deploy the RAN Insights rApp over R1

Works on an O-RAN SC / ONAP SMO (MicroK8s, nonrtric + onap namespaces: rApp Manager, ChartMuseum, ACM + K8s/DME participants, CAPIF/Kong, ICS, Strimzi Kafka, local image registry on localhost:5000).

You need: this repository, docker, helm, python3, go (for the build).

0. Set once per shell

export SMO_IP=<your SMO host IP>
export REPO=<path to your checkout of this repository>
export RM=$(sudo microk8s kubectl get svc rappmanager -n nonrtric -o jsonpath='{.spec.clusterIP}')
export CM=$(sudo microk8s kubectl get svc chartmuseum -n nonrtric -o jsonpath='{.spec.clusterIP}')
export ICS=$(sudo microk8s kubectl get svc informationservice -n nonrtric -o jsonpath='{.spec.clusterIP}')
export KONG=$(sudo microk8s kubectl get svc oran-nonrtric-kong-admin -n nonrtric -o jsonpath='{.spec.clusterIP}')
export CAPIF=$(sudo microk8s kubectl get svc capifcore -n nonrtric -o jsonpath='{.spec.clusterIP}')

First time on a new environment:

# fill every empty credential in deploy/helm/ran-insights-crl/values.yaml
# Kafka SASL password of your cluster:
sudo microk8s kubectl get secret strimzi-kafka-admin -n onap -o jsonpath='{.data.password}' | base64 -d; echo
# confirm chartmuseum is whitelisted for the K8s participant:
sudo microk8s kubectl get configmap onap-policy-clamp-ac-k8s-ppnt-configmap -n onap -o yaml | grep -A3 repos

1. Build the image into the local registry (one-time)

cd $REPO
docker build -t ran-insights-crl-rapp:1.0.0 -f Dockerfile .
docker tag ran-insights-crl-rapp:1.0.0 localhost:5000/ran-insights-crl-rapp:1.0.0
docker push localhost:5000/ran-insights-crl-rapp:1.0.0
curl -s http://localhost:5000/v2/ran-insights-crl-rapp/tags/list        # expect it to include "1.0.0"

2. Build the CSAR and upload the chart

Regenerate the ACM element UUID before EVERY fresh onboard (ACM rejects reused ones):

cd $REPO
python3 - << 'EOF'
import json, uuid
p = "rapp-package/Files/Acm/instances/raninsightscrl-instance.json"
d = json.load(open(p)); old = next(iter(d["elements"])); new = str(uuid.uuid4())
el = d["elements"].pop(old); el["id"] = new; d["elements"][new] = el
json.dump(d, open(p, "w"), indent=2); print("element uuid:", new)
EOF

# helm is often only reachable through microk8s: HELM="sudo microk8s helm3"
HELM=${HELM:-helm}
PKG=rapp-package
mkdir -p $PKG/Artifacts/Deployment/HELM $PKG/dist
rm -f $PKG/Artifacts/Deployment/HELM/*.tgz $PKG/dist/*.csar
$HELM package deploy/helm/ran-insights-crl -d $PKG/Artifacts/Deployment/HELM

# the manifest carries a SHA-256 for every packaged file, so regenerate it here
{
  printf 'metadata:\n  vnf_product_name: RAN Insights CRL rApp\n'
  printf '  vnf_provider_id: coRAN Labs\n  vnf_package_version: 1.0.0\n'
  (cd $PKG && find ASD.yaml Files Artifacts/Deployment/HELM -type f | sort | while read -r f; do
    printf '\nSource: %s\nAlgorithm: SHA-256\nHash: %s\n' "$f" "$(sha256sum "$f" | cut -d' ' -f1)"
  done)
} > $PKG/ran-insights-crl-rapp.mf

(cd $PKG && zip -qr dist/ran-insights-crl-rapp-1.0.0.csar \
   ASD.yaml TOSCA-Metadata ran-insights-crl-rapp.mf Files Artifacts/Deployment/HELM)

curl -s -X DELETE http://$CM:8080/api/charts/ran-insights-crl/1.0.0
curl -s --data-binary @$PKG/Artifacts/Deployment/HELM/ran-insights-crl-1.0.0.tgz http://$CM:8080/api/charts

3. Onboard, prime, instance, deploy

curl -X POST http://$RM:8080/rapps/ran-insights-crl-rapp \
  -F file=@$REPO/rapp-package/dist/ran-insights-crl-rapp-1.0.0.csar

curl -X PUT http://$RM:8080/rapps/ran-insights-crl-rapp \
  -H 'Content-Type: application/json' -d '{"primeOrder":"PRIME"}'
curl -s http://$RM:8080/rapps/ran-insights-crl-rapp | grep -o '"state":"[^"]*"'   # wait for PRIMED

IID=$(curl -s -X POST http://$RM:8080/rapps/ran-insights-crl-rapp/instance \
  -H 'Content-Type: application/json' -d '{
    "acm":{"instance":"raninsightscrl-instance"},
    "sme":{"providerFunction":"ran-insights-crl-provider","serviceApis":"ran-insights-crl-metrics-api","invokers":"ics-invoker"},
    "dme":{"infoTypesProducer":["ran-alerts-events","ran-metrics-timeseries"],"infoProducer":"ran-insights-crl-metrics-producer"}
  }' | python3 -c 'import json,sys;print(json.load(sys.stdin)["rappInstanceId"])')
echo $IID | tee /tmp/ran_insights_iid

curl -X PUT http://$RM:8080/rapps/ran-insights-crl-rapp/instance/$IID \
  -H 'Content-Type: application/json' -d '{"deployOrder":"DEPLOY"}'
watch -n5 "curl -s http://$RM:8080/rapps/ran-insights-crl-rapp/instance/$IID | grep -o '\"state\":\"[^\"]*\"'"

4. Verify

sudo microk8s kubectl get pods -n nonrtric | grep ran-insights
curl -s -o /dev/null -w '%{http_code}\n' http://$SMO_IP:30080/health              # 200 (dashboard)
curl -s -o /dev/null -w '%{http_code}\n' http://$SMO_IP:30085/r1/producer-health  # 200 (R1 callback)
curl -s http://$ICS:9082/data-producer/v1/info-producers/ran-insights-crl-metrics-producer/status
curl -s http://$KONG:8001/services | grep -c ran-insights

Open the dashboard on http://$SMO_IP:30080. It fills with data once your environment feeds PM files to it over the Kafka topic set in the chart values.

5. Teardown (always this order)

IID=$(cat /tmp/ran_insights_iid)
curl -X PUT    http://$RM:8080/rapps/ran-insights-crl-rapp/instance/$IID -H 'Content-Type: application/json' -d '{"deployOrder":"UNDEPLOY"}'
# wait for state UNDEPLOYED, then:
curl -X DELETE http://$RM:8080/rapps/ran-insights-crl-rapp/instance/$IID
curl -X PUT    http://$RM:8080/rapps/ran-insights-crl-rapp -H 'Content-Type: application/json' -d '{"primeOrder":"DEPRIME"}'
curl -X DELETE http://$RM:8080/rapps/ran-insights-crl-rapp
# SME cleanup is often skipped by teardown, so check and clean Kong + CAPIF:
curl -s http://$KONG:8001/services | grep ran-insights

6. If it goes wrong

  • Onboard fails because the rApp already exists: run the teardown (step 5) first.
  • Deploy 502 "Unable to deploy SME": leftover Kong services or a CAPIF published-api from a prior run. Clean as in step 5, then retry.
  • Instance stuck DEPLOYING: check the pods, then the ACM instance via policy-clamp-runtime-acm (onap ns, :6969, user runtimeUser, password in secret rappmanager-acm-secret).
  • ICS producer DISABLED: a NetworkPolicy is blocking ICS. Set networkPolicy.allowExternal: true in values, or delete the policy.
  • Onboard rejected with a duplicate ACM element UUID: rerun step 2 (the UUID regen and repackage).
  • Pods ImagePullBackOff: the image is not in localhost:5000. Rerun step 1 and check the tags list.