mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-19 03:22:53 +00:00
feat: Add deployment verification and testing scripts
- Add test-free5gc.sh script to verify free5GC configuration files and Docker Compose services - Add verify-deployment.sh script for comprehensive platform deployment verification - Include checks for Docker service status, port availability, and configuration files - Add network connectivity tests for MongoDB and Redis - Provide color-coded output and helpful command suggestions - Exit with appropriate status codes for CI/CD integration
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Test script for free5GC deployment
|
||||
echo "=== Testing free5GC Configuration ==="
|
||||
|
||||
# Check if configuration files exist
|
||||
echo "Checking configuration files..."
|
||||
config_files=(
|
||||
"deployments/free5gc/config/nrfcfg.yaml"
|
||||
"deployments/free5gc/config/amfcfg.yaml"
|
||||
"deployments/free5gc/config/smfcfg.yaml"
|
||||
"deployments/free5gc/config/upfcfg.yaml"
|
||||
"deployments/free5gc/config/udrcfg.yaml"
|
||||
"deployments/free5gc/config/udmcfg.yaml"
|
||||
"deployments/free5gc/config/ausfcfg.yaml"
|
||||
"deployments/free5gc/config/nssfcfg.yaml"
|
||||
"deployments/free5gc/config/pcfcfg.yaml"
|
||||
)
|
||||
|
||||
missing_files=0
|
||||
for file in "${config_files[@]}"; do
|
||||
if [[ -f "$file" ]]; then
|
||||
echo " [OK] $file"
|
||||
else
|
||||
echo " [MISSING] $file"
|
||||
missing_files=$((missing_files + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
# Check docker-compose configuration
|
||||
echo "Checking docker-compose services..."
|
||||
services=(
|
||||
"db"
|
||||
"free5gc-nrf"
|
||||
"free5gc-amf"
|
||||
"free5gc-smf"
|
||||
"free5gc-upf"
|
||||
"free5gc-udr"
|
||||
"free5gc-udm"
|
||||
"free5gc-ausf"
|
||||
"free5gc-nssf"
|
||||
"free5gc-pcf"
|
||||
)
|
||||
|
||||
missing_services=0
|
||||
for service in "${services[@]}"; do
|
||||
if docker-compose config | grep -q "$service:"; then
|
||||
echo " [OK] $service service defined"
|
||||
else
|
||||
echo " [MISSING] $service service"
|
||||
missing_services=$((missing_services + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
# Summary
|
||||
echo ""
|
||||
echo "=== Test Summary ==="
|
||||
if [[ $missing_files -eq 0 && $missing_services -eq 0 ]]; then
|
||||
echo " [SUCCESS] All free5GC configuration is ready!"
|
||||
echo " To start: make free5gc-start"
|
||||
exit 0
|
||||
else
|
||||
echo " [ERROR] Found $missing_files missing files and $missing_services missing services"
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,125 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Comprehensive deployment verification script
|
||||
echo "=== Telecom Platform Deployment Verification ==="
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Function to check service status
|
||||
check_service() {
|
||||
local service=$1
|
||||
local container=$2
|
||||
echo -n "Checking $service... "
|
||||
|
||||
if docker ps --format "table {{.Names}}" | grep -q "$container"; then
|
||||
echo -e "${GREEN}RUNNING${NC}"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}NOT RUNNING${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to check port availability
|
||||
check_port() {
|
||||
local port=$1
|
||||
local service=$2
|
||||
echo -n "Checking $service port $port... "
|
||||
|
||||
if netstat -tuln 2>/dev/null | grep -q ":$port "; then
|
||||
echo -e "${GREEN}OPEN${NC}"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}CLOSED${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to check configuration files
|
||||
check_config() {
|
||||
local file=$1
|
||||
local service=$2
|
||||
echo -n "Checking $service config... "
|
||||
|
||||
if [[ -f "$file" ]]; then
|
||||
echo -e "${GREEN}EXISTS${NC}"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}MISSING${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo ""
|
||||
echo "=== Docker Services Status ==="
|
||||
check_service "MongoDB (App)" "taas-mongodb"
|
||||
check_service "Redis" "taas-redis"
|
||||
check_service "MongoDB (free5GC)" "free5gc-mongo"
|
||||
check_service "NRF" "nrf"
|
||||
check_service "AMF" "amf"
|
||||
check_service "SMF" "smf"
|
||||
check_service "UPF" "upf"
|
||||
check_service "UDR" "udr"
|
||||
check_service "UDM" "udm"
|
||||
check_service "AUSF" "ausf"
|
||||
check_service "NSSF" "nssf"
|
||||
check_service "PCF" "pcf"
|
||||
check_service "API Server" "taas-api-server"
|
||||
check_service "Carrier Connector" "taas-carrier-connector"
|
||||
check_service "Charging Engine" "taas-charging-engine"
|
||||
check_service "Web Dashboard" "taas-web-dashboard"
|
||||
|
||||
echo ""
|
||||
echo "=== Port Availability ==="
|
||||
check_port "27017" "MongoDB (App)"
|
||||
check_port "6379" "Redis"
|
||||
check_port "8000" "API Server"
|
||||
check_port "8080" "Charging Engine"
|
||||
check_port "3000" "Web Dashboard"
|
||||
|
||||
echo ""
|
||||
echo "=== Configuration Files ==="
|
||||
check_config "deployments/free5gc/config/nrfcfg.yaml" "NRF"
|
||||
check_config "deployments/free5gc/config/amfcfg.yaml" "AMF"
|
||||
check_config "deployments/free5gc/config/smfcfg.yaml" "SMF"
|
||||
check_config "deployments/free5gc/config/upfcfg.yaml" "UPF"
|
||||
check_config "deployments/free5gc/config/udrcfg.yaml" "UDR"
|
||||
check_config "deployments/free5gc/config/udmcfg.yaml" "UDM"
|
||||
check_config "deployments/free5gc/config/ausfcfg.yaml" "AUSF"
|
||||
check_config "deployments/free5gc/config/nssfcfg.yaml" "NSSF"
|
||||
check_config "deployments/free5gc/config/pcfcfg.yaml" "PCF"
|
||||
|
||||
echo ""
|
||||
echo "=== Network Connectivity ==="
|
||||
echo -n "Testing MongoDB connection... "
|
||||
if docker exec taas-mongo mongosh --eval "db.adminCommand('ping')" >/dev/null 2>&1; then
|
||||
echo -e "${GREEN}OK${NC}"
|
||||
else
|
||||
echo -e "${RED}FAILED${NC}"
|
||||
fi
|
||||
|
||||
echo -n "Testing Redis connection... "
|
||||
if docker exec taas-redis redis-cli ping >/dev/null 2>&1; then
|
||||
echo -e "${GREEN}OK${NC}"
|
||||
else
|
||||
echo -e "${RED}FAILED${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Summary ==="
|
||||
echo "To start all services: docker-compose up -d"
|
||||
echo "To start free5GC only: make free5gc-start"
|
||||
echo "To view logs: make free5gc-logs"
|
||||
echo "To stop all services: docker-compose down"
|
||||
echo ""
|
||||
echo "For detailed service logs:"
|
||||
echo " docker-compose logs -f [service-name]"
|
||||
echo ""
|
||||
echo "Web interfaces:"
|
||||
echo " - Web Dashboard: http://localhost:3000"
|
||||
echo " - API Server: http://localhost:8000"
|
||||
echo " - Charging Engine: http://localhost:8080"
|
||||
Reference in New Issue
Block a user