Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding OAI RAN and UE test deployment scripts #227

Merged
merged 18 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
13 changes: 13 additions & 0 deletions test-infra_18jan_v1.diff
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josephthaliath I don't think this file is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arora-sagar . Thanks. added by mistake. removed it.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/e2e/tests/oai/002.sh b/e2e/tests/oai/002.sh
index a334090..6e7f6e0 100755
--- a/e2e/tests/oai/002.sh
+++ b/e2e/tests/oai/002.sh
@@ -29,7 +29,7 @@ source "${LIBDIR}/kpt.sh"

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

-for pkgvar in common-core-database cp-operators up-operators ran-operator-edge-oai-ran-operator ran-operator-regional-oai-ran-operator; 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"