Skip to content

Commit 1ecb5c9

Browse files
committed
Add subheaders to scripts
1 parent fef3996 commit 1ecb5c9

File tree

4 files changed

+58
-45
lines changed

4 files changed

+58
-45
lines changed

deploy-core.sh

+24-22
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@ print_error() {
1313
echo -e "\e[1;31mERROR: $1\e[0m"
1414
}
1515

16+
print_subheader() {
17+
echo -e "\e[1;36m--- $1 ---\e[0m"
18+
}
19+
1620
# Set the namespace for Open5GS
1721
NAMESPACE="open5gs"
1822

19-
# Check if the namespace exists and create it if not
20-
print_header "Checking if namespace '$NAMESPACE' exists"
23+
print_header "Preparing cluster for 5G network deployment"
24+
25+
print_subheader "Checking if namespace '$NAMESPACE' exists"
2126
kubectl get namespace $NAMESPACE 2>/dev/null || {
2227
print_error "Namespace '$NAMESPACE' not found. Creating it now..."
2328
kubectl create namespace $NAMESPACE
2429
print_success "Namespace '$NAMESPACE' created."
2530
}
2631

27-
# Apply MongoDB configurations
28-
print_header "Applying MongoDB configurations"
32+
print_header "Adding Persistent Storage (Core Deployment [1/4])"
33+
print_subheader "Applying MongoDB configurations"
2934
kubectl apply -k mongodb -n $NAMESPACE
3035
print_success "MongoDB configurations applied."
3136

@@ -46,9 +51,10 @@ wait_for_pod_ready() {
4651
wait_for_pod_ready "app.kubernetes.io/name" "mongodb"
4752

4853
# Apply 5G network configurations
49-
print_header "Applying 5G Network Configurations"
54+
print_header "Applying 5G Network Configuration (Core Deployment [2/4])"
55+
print_subheader "Applying OVS-CNI NADs"
5056
kubectl apply -k networks5g -n $NAMESPACE
51-
print_success "5G network configurations applied."
57+
print_success "OVS-CNI NADs applied."
5258

5359
# Function to check Network Attachment Definition (NAD)
5460
check_nad() {
@@ -63,40 +69,36 @@ check_nad() {
6369
print_success "NAD '$network_name' found in $NAMESPACE."
6470
}
6571

66-
# Check all required NADs
67-
print_header "Checking required NADs"
72+
print_subheader "Checking required NADs"
6873
check_nad "n2network"
6974
check_nad "n3network"
7075
check_nad "n4network"
7176

72-
# Apply Open5GS metrics
73-
print_header "Applying Open5GS Metrics Configurations"
77+
print_header "Deploying Open5GS core (Core Deployment [3/4])"
78+
print_subheader "Applying Open5GS deployment option with support for Monarch"
7479
kubectl apply -k msd/overlays/open5gs-metrics -n open5gs
75-
print_success "Open5GS metrics configurations applied."
80+
print_success "Open5GS deployed."
7681

77-
# Wait for network function pods to be ready
78-
print_header "Waiting for Network Function Pods"
82+
print_subheader "Waiting for Core pods to be ready"
7983
wait_for_pod_ready "nf" "nrf"
8084
wait_for_pod_ready "nf" "scp"
8185
wait_for_pod_ready "nf" "amf"
8286
wait_for_pod_ready "nf" "udr"
8387
wait_for_pod_ready "nf" "bsf"
88+
print_success "Core pods ready."
8489

85-
# Install Python dependencies
86-
print_header "Installing Python dependencies"
90+
print_header "Preparing core for adding subscribers (Core Deployment [4/4])"
91+
print_subheader "Installing Python dependencies"
8792
pip3 install -r requirements.txt
8893
print_success "Python dependencies installed."
8994

90-
# Apply Open5GS web UI
91-
print_header "Applying Open5GS Web UI Configurations"
92-
kubectl apply -k open5gs-webui -n open5gs
93-
print_success "Open5GS web UI configurations applied."
9495

95-
# Wait for the web UI pod to be ready
96+
print_subheader "Deploying Open5GS Web UI"
97+
kubectl apply -k open5gs-webui -n open5gs
9698
wait_for_pod_ready "nf" "webui"
99+
print_success "Open5GS web UI deployed."
97100

98-
# Set up admin account for MongoDB
99-
print_header "Setting Up MongoDB Admin Account"
101+
print_subheader "Setting Up MongoDB Admin Account"
100102
python3 mongo-tools/add-admin-account.py
101103
print_success "MongoDB admin account created successfully."
102104

deploy-ran.sh

+11-7
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ print_error() {
1313
echo -e "\e[1;31mERROR: $1\e[0m"
1414
}
1515

16+
print_subheader() {
17+
echo -e "\e[1;36m--- $1 ---\e[0m"
18+
}
19+
1620
# Set the namespace for Open5GS
1721
NAMESPACE="open5gs"
1822
TIMEOUT_DURATION=10 # Set the timeout duration in seconds
1923

20-
# Check if the namespace exists and create it if not
21-
print_header "Checking if namespace '$NAMESPACE' exists"
24+
print_header "Preparing cluster for RAN deployment"
25+
print_subheader "Checking if namespace '$NAMESPACE' exists"
2226
kubectl get namespace $NAMESPACE 2>/dev/null || {
2327
print_error "Namespace '$NAMESPACE' not found. Creating it now..."
2428
kubectl create namespace $NAMESPACE
@@ -68,8 +72,8 @@ wait_for_pod_running() {
6872
done
6973
}
7074

71-
# Check if subscribers have been added before proceeding with deployment
72-
print_header "Checking if subscribers have been added"
75+
76+
print_subheader "Checking if subscribers have been added"
7377
output=$(timeout $TIMEOUT_DURATION python3 mongo-tools/check-subscribers.py)
7478

7579
# Check if the Python script completed successfully or timed out
@@ -84,14 +88,14 @@ else
8488
echo "$output" # Print the list of subscribers if found
8589
fi
8690

87-
# Deploy the gNodeB
88-
print_header "Deploying the UERANSIM gNodeB"
91+
92+
print_header "Deploying the UERANSIM gNodeB (RAN Deployment [1/2])"
8993
kubectl apply -k ueransim/ueransim-gnb -n $NAMESPACE
9094
wait_for_pod_ready "component" "gnb"
9195
print_success "UERANSIM gNodeB deployed successfully."
9296

9397
# Deploy the UEs
94-
print_header "Deploying UERANSIM UEs"
98+
print_header "Deploying UERANSIM UEs (RAN Deployment [2/2])"
9599
kubectl apply -k ueransim/ueransim-ue -n $NAMESPACE
96100
wait_for_pod_running "component" "ue"
97101
print_success "UERANSIM UEs deployed successfully."

remove-core.sh

+17-14
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,41 @@ print_error() {
1313
echo -e "\e[1;31mERROR: $1\e[0m"
1414
}
1515

16+
print_subheader() {
17+
echo -e "\e[1;36m--- $1 ---\e[0m"
18+
}
19+
1620
NAMESPACE="open5gs"
1721

18-
# Check if the namespace exists
19-
print_header "Checking if namespace '$NAMESPACE' exists"
22+
print_header "Checking cluster for existing Core Deployment"
23+
print_subheader "Checking if namespace '$NAMESPACE' exists"
2024
kubectl get namespace $NAMESPACE 2>/dev/null
2125
if [ $? -ne 0 ]; then
2226
print_error "Namespace '$NAMESPACE' not found. Exiting removal process."
2327
exit 1
2428
fi
2529

26-
# Delete MongoDB configurations
27-
print_header "Deleting MongoDB configurations"
30+
print_header "Removing persistent storage (Core Deployment [1/4])"
31+
print_subheader "Deleting MongoDB configurations"
2832
kubectl delete -k mongodb -n $NAMESPACE
29-
print_success "MongoDB configurations deleted."
33+
print_success "MongoDB configurations deleted. Note that PV is not cleared automatically."
3034

31-
# Delete 5G network configurations
32-
print_header "Deleting 5G Network Configurations"
35+
print_header "Deleting 5G Network Configuration (Core Deployment [2/4])"
3336
kubectl delete -k networks5g -n $NAMESPACE
34-
print_success "5G network configurations deleted."
37+
print_success "5G network configuration deleted."
3538

36-
# Delete Open5GS configurations (including all its components)
37-
print_header "Deleting Open5GS Configurations"
39+
40+
print_header "Deleting Open5GS (Core Deployment [3/4])"
3841
kubectl delete --wait=true -k open5gs -n $NAMESPACE
39-
print_success "Open5GS configurations deleted."
42+
print_success "Open5GS deleted."
43+
4044

41-
# Remove Open5GS webui
42-
print_header "Deleting Open5GS WebUI"
45+
print_header "Deleting Open5GS WebUI (Core Deployment [4/4])"
4346
kubectl delete --wait=true -k open5gs-webui -n $NAMESPACE
4447
print_success "Open5GS webui deleted."
4548

4649
# Wait until all Open5GS pods are deleted
47-
print_header "Waiting for all Open5GS pods to be deleted"
50+
print_subheader "Waiting for all Open5GS pods to be deleted"
4851
while [ "$(kubectl get pods -n "$NAMESPACE" -l="app=open5gs" -o jsonpath='{.items[*].metadata.name}')" != "" ]; do
4952
sleep 5
5053
echo "Waiting for all pods to be deleted in namespace $NAMESPACE..."

remove-ran.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,21 @@ print_error() {
1313
echo -e "\e[1;31mERROR: $1\e[0m"
1414
}
1515

16+
print_subheader() {
17+
echo -e "\e[1;36m--- $1 ---\e[0m"
18+
}
19+
1620
# Set the namespace for Open5GS
1721
NAMESPACE="open5gs"
1822

1923
# Delete the UERANSIM UEs
20-
print_header "Removing UERANSIM UEs"
24+
print_header "Removing UERANSIM UEs (RAN Deployment [1/2])"
2125
kubectl delete --wait=true -k ueransim/ueransim-ue -n $NAMESPACE
2226
print_success "UERANSIM UEs removed."
2327

2428

2529
# Delete the UERANSIM gNodeB
26-
print_header "Removing UERANSIM gNodeB"
30+
print_header "Removing UERANSIM gNodeB (RAN Deployment [2/2])"
2731
kubectl delete --wait=true -k ueransim/ueransim-gnb -n $NAMESPACE
2832
print_success "UERANSIM gNodeB removed."
2933

0 commit comments

Comments
 (0)