Skip to content

Commit

Permalink
Adding OAI RAN and UE test deployment scripts (nephio-project#227)
Browse files Browse the repository at this point in the history
* Changes to add ue and ran deployment scripts

* changes to repo register and name corrections

* changes to file permissions

* Some OAI RAN fixes

Signed-off-by: Victor Morales <v.morales@samsung.com>

* remove private catalog repository reference

* Changes to correct scripts to work on different setups

Signed-off-by: josephthaliath <jo.thaliath@samsung.com>

* Change repo name in 002-oai-operators.yaml

Co-authored-by: Victor Morales <chipahuac@hotmail.com>

* Update repo in 004-ran-cucp.yaml

Co-authored-by: Victor Morales <chipahuac@hotmail.com>

* Update year in 004-ran-cucp.yaml

Co-authored-by: Victor Morales <chipahuac@hotmail.com>

* year update in 004.sh

Co-authored-by: Victor Morales <chipahuac@hotmail.com>

* Update repo information in 004.sh

Co-authored-by: Victor Morales <chipahuac@hotmail.com>

* update year in 005.sh

Co-authored-by: Victor Morales <chipahuac@hotmail.com>

* Update repo in 005.sh

Co-authored-by: Victor Morales <chipahuac@hotmail.com>

* changes to deploy ran operator only in regional and edge cluster

Signed-off-by: josephthaliath <jo.thaliath@samsung.com>

* Corrections to package variant names

Signed-off-by: josephthaliath <jo.thaliath@samsung.com>

* removing the file added by mistake

Signed-off-by: josephthaliath <jo.thaliath@samsung.com>

---------

Signed-off-by: Victor Morales <v.morales@samsung.com>
Signed-off-by: josephthaliath <jo.thaliath@samsung.com>
Co-authored-by: Victor Morales <v.morales@samsung.com>
Co-authored-by: Victor Morales <chipahuac@hotmail.com>
  • Loading branch information
3 people authored and dkosteck committed Aug 15, 2024
1 parent 11c7c64 commit c57d0f1
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 3 deletions.
36 changes: 36 additions & 0 deletions e2e/tests/oai/002-oai-operators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,39 @@ spec:
approval.nephio.org/policy: initial
injectors:
- name: edge

---
apiVersion: config.porch.kpt.dev/v1alpha1
kind: PackageVariant
metadata:
name: oai-ran-operator-edge
spec:
upstream:
repo: catalog-workloads-oai-ran
package: oai-ran-operator
revision: main
downstream:
repo: edge
package: oai-ran-operator
annotations:
approval.nephio.org/policy: initial
injectors:
- name: edge

---
apiVersion: config.porch.kpt.dev/v1alpha1
kind: PackageVariant
metadata:
name: oai-ran-operator-regional
spec:
upstream:
repo: catalog-workloads-oai-ran
package: oai-ran-operator
revision: main
downstream:
repo: regional
package: oai-ran-operator
annotations:
approval.nephio.org/policy: initial
injectors:
- name: regional
11 changes: 8 additions & 3 deletions e2e/tests/oai/002.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
##############################################################################

## TEST METADATA
## TEST-NAME: Deploy OAI Core Operators
## TEST-NAME: Deploy OAI RAN and Core Operators
##

set -o pipefail
Expand All @@ -29,16 +29,21 @@ source "${LIBDIR}/kpt.sh"

k8s_apply "$TESTDIR/002-oai-operators.yaml"

for pkgvar in common-core-database cp-operators up-operators; do
for pkgvar in common-core-database cp-operators up-operators ran-operator-edge ran-operator-regional; do
k8s_wait_ready "packagevariant" "oai-$pkgvar"
done
kpt_wait_pkg "core" "database"
kpt_wait_pkg "core" "oai-cp-operators"
kpt_wait_pkg "edge" "oai-up-operators"
kpt_wait_pkg "regional" "oai-ran-operator"
kpt_wait_pkg "edge" "oai-ran-operator"

_core_kubeconfig="$(k8s_get_capi_kubeconfig "core")"
_edge_kubeconfig="$(k8s_get_capi_kubeconfig "edge")"
k8s_wait_ready_replicas "deployment" "mysql" "$_core_kubeconfig" "oai-core"
for controller in amf ausf nrf smf udm udr; do
k8s_wait_ready_replicas "deployment" "oai-$controller-controller" "$_core_kubeconfig" "oai-operators"
done
k8s_wait_ready_replicas "deployment" "oai-upf-controller" "$(k8s_get_capi_kubeconfig "edge")" "oai-operators"
k8s_wait_ready_replicas "deployment" "oai-upf-controller" "$_edge_kubeconfig" "oai-operators"
k8s_wait_ready_replicas "deployment" "oai-ran-operator" "$(k8s_get_capi_kubeconfig "regional")" "oai-ran-operators"
k8s_wait_ready_replicas "deployment" "oai-ran-operator" "$_edge_kubeconfig" "oai-ran-operators"
26 changes: 26 additions & 0 deletions e2e/tests/oai/004-ran-cucp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2024 The Nephio Authors.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

apiVersion: config.porch.kpt.dev/v1alpha1
kind: PackageVariant
metadata:
name: oai-cucp
spec:
upstream:
repo: catalog-workloads-oai-ran
package: pkg-example-cucp-bp
revision: main
downstream:
repo: regional
package: oai-ran-cucp
annotations:
approval.nephio.org/policy: initial
injectors:
- name: regional
112 changes: 112 additions & 0 deletions e2e/tests/oai/004.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/bash
#!/usr/bin/env bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2024 The Nephio Authors.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

## TEST METADATA
## TEST-NAME: Deploy OAI E1 Split RAN Network Functions
##

set -o pipefail
set -o errexit
set -o nounset
[[ ${DEBUG:-false} != "true" ]] || set -o xtrace

# shellcheck source=e2e/defaults.env
source "$E2EDIR/defaults.env"

# shellcheck source=e2e/lib/k8s.sh
source "${LIBDIR}/k8s.sh"

# shellcheck source=e2e/lib/kpt.sh
source "${LIBDIR}/kpt.sh"

function _wait_for_ran {
kubeconfig=$1
wait_msg=$2
link_name=$3

info "waiting for $link_name link to be established"
timeout=600

temp_file=$(mktemp)
kubectl logs "$(kubectl get pods -n oai-ran-cucp --kubeconfig "$kubeconfig" -l app.kubernetes.io/name=oai-gnb-cu-cp -o jsonpath='{.items[*].metadata.name}')" -n oai-ran-cucp -c gnbcucp --kubeconfig "$kubeconfig" > temp_file
while grep -q "$wait_msg" temp_file;status=$?; [[ $status != 0 ]]
do
if [[ $timeout -lt 0 ]]; then
kubectl logs -l app.kubernetes.io/name=oai-gnb-cu-cp -n oai-ran-cucp -c gnbcucp --kubeconfig "$kubeconfig" --tail 50
error "Timed out waiting for $link_name link to be established"
fi
timeout=$((timeout - 5))
sleep 5
kubectl logs "$(kubectl get pods -n oai-ran-cucp --kubeconfig "$kubeconfig" -l app.kubernetes.io/name=oai-gnb-cu-cp -o jsonpath='{.items[*].metadata.name}')" -n oai-ran-cucp -c gnbcucp --kubeconfig "$kubeconfig" > temp_file
done
debug "timeout: $timeout"
rm "${temp_file}"
}

function _wait_for_n2_link {
_wait_for_ran "$1" "Received NGAP_REGISTER_GNB_CNF: associated AMF" "N2"
}

function _wait_for_e1_link {
# Connection between CU-CP and CU-UP
_wait_for_ran "$1" "e1ap_send_SETUP_RESPONSE" "E1"
}

function _wait_for_f1_link {
# Connection between DU and CU-CP
_wait_for_ran "$1" "Cell Configuration ok" "F1"
}

k8s_apply "$TESTDIR/004-ran-cucp.yaml"

for nf in du cuup; do
cat <<EOF | kubectl apply -f -
apiVersion: config.porch.kpt.dev/v1alpha1
kind: PackageVariant
metadata:
name: oai-$nf
spec:
upstream:
repo: catalog-workloads-oai-ran
package: pkg-example-$nf-bp
revision: main
downstream:
repo: edge
package: oai-ran-$nf
annotations:
approval.nephio.org/policy: initial
injectors:
- name: edge
EOF
done

for nf in du cuup cucp; do
k8s_wait_ready "packagevariant" "oai-$nf"
done

for nf in du cuup; do
kpt_wait_pkg "edge" "oai-ran-$nf" "nephio" "1800"
done
kpt_wait_pkg "regional" "oai-ran-cucp" "nephio" "1800"

_regional_kubeconfig="$(k8s_get_capi_kubeconfig "regional")"
_edge_kubeconfig="$(k8s_get_capi_kubeconfig "edge")"

k8s_wait_ready_replicas "deployment" "oai-gnb-cu-cp" "$_regional_kubeconfig" "oai-ran-cucp"
k8s_wait_ready_replicas "deployment" "oai-gnb-cu-up" "$_edge_kubeconfig" "oai-ran-cuup"
k8s_wait_ready_replicas "deployment" "oai-gnb-du" "$_edge_kubeconfig" "oai-ran-du"

# Check if the NGAPSetup Request Response is okay between AMF and CU-CP
_wait_for_n2_link "$_regional_kubeconfig"
# Check if the E1Setup Request Response is okay between AMF and CU-CP
_wait_for_e1_link "$_regional_kubeconfig"
# Check if the F1Setup Request Response is okay between AMF and CU-CP
_wait_for_f1_link "$_regional_kubeconfig"
89 changes: 89 additions & 0 deletions e2e/tests/oai/005.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash
#!/usr/bin/env bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2024 The Nephio Authors.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

## TEST METADATA
## TEST-NAME: Deploy OAI UE SIM
##

set -o pipefail
set -o errexit
set -o nounset
[[ ${DEBUG:-false} != "true" ]] || set -o xtrace

# shellcheck source=e2e/defaults.env
source "$E2EDIR/defaults.env"

# shellcheck source=e2e/lib/k8s.sh
source "${LIBDIR}/k8s.sh"

# shellcheck source=e2e/lib/kpt.sh
source "${LIBDIR}/kpt.sh"

function _wait_for_ue {
local kubeconfig=$1
local log_msg=$2
local msg=$3

info "waiting for $msg to be finished"
timeout=600
temp_file=$(mktemp)
kubectl logs "$(kubectl get pods -n oai-ue --kubeconfig "$kubeconfig" -l app.kubernetes.io/name=oai-nr-ue -o jsonpath='{.items[*].metadata.name}')" -n oai-ue -c nr-ue --kubeconfig "$kubeconfig" > temp_file
while grep -q "$log_msg" temp_file;status=$?; [ $status != 0 ]
do
if [[ $timeout -lt 0 ]]; then
kubectl logs -l app.kubernetes.io/name=oai-nr-ue -n oai-ue -c nr-ue --kubeconfig "$kubeconfig" --tail 50
error "Timed out waiting for $msg"
fi
timeout=$((timeout - 5))
sleep 5
kubectl logs "$(kubectl get pods -n oai-ue --kubeconfig "$kubeconfig" -l app.kubernetes.io/name=oai-nr-ue -o jsonpath='{.items[*].metadata.name}')" -n oai-ue -c nr-ue --kubeconfig "$kubeconfig" > temp_file
done
debug "timeout: $timeout"
rm "${temp_file}"
}

function _wait_for_ue_registration {
_wait_for_ue "$1" "REGISTRATION ACCEPT" "UE Registration"
}

function _wait_for_ue_pdu_session {
_wait_for_ue "$1" "Interface oaitun_ue1 successfully configured" "PDU session"
}

cat <<EOF | kubectl apply -f -
apiVersion: config.porch.kpt.dev/v1alpha1
kind: PackageVariant
metadata:
name: oai-ue
spec:
upstream:
repo: catalog-workloads-oai-ran
package: pkg-example-ue-bp
revision: main
downstream:
repo: edge
package: oai-ran-ue
annotations:
approval.nephio.org/policy: initial
injectors:
- name: edge
EOF

k8s_wait_ready "packagevariant" "oai-ue"
kpt_wait_pkg "edge" "oai-ran-ue" "nephio" "1800"

_edge_kubeconfig="$(k8s_get_capi_kubeconfig "edge")"
k8s_wait_ready_replicas "deployment" "oai-nr-ue" "$_edge_kubeconfig" "oai-ue"

# Check if the Registration is finished
_wait_for_ue_registration "$_edge_kubeconfig"
# Check if the PDU Session is setup
_wait_for_ue_pdu_session "$_edge_kubeconfig"

0 comments on commit c57d0f1

Please sign in to comment.