diff --git a/5G_Core_Network/README.md b/5G_Core_Network/README.md index 2d29ef9..fe48bfc 100644 --- a/5G_Core_Network/README.md +++ b/5G_Core_Network/README.md @@ -73,10 +73,16 @@ By default, the configuration process automatically unregisters all subscribers, ...2 - netns - ue1 - ue2 - ue3 + Address + 10.45.0.101 + ...102 + ...103 + + + Namespace + ue1 + ue2 + ue3 10.45.0.1/16 -grab_first_ipv4_address() { - local IP=$1 - echo ${IP%.*}.1/${IP#*/} -} - -# Extract the first IPv6 address from a CIDR block by replacing the suffix with '::1'. -# For example, 2001:db8:cafe::/48 --> 2001:db8:cafe::1/48 -grab_first_ipv6_address() { - local IP=$1 - echo ${IP%::*}::1/${IP#*/} -} - -# Remove the CIDR suffix from an IP address -# For example, 10.45.0.1/16 --> 10.45.0.1 -remove_cidr_suffix() { - local IP=$1 - echo ${IP%/*} -} +if ! command -v python3 &>/dev/null; then + echo "Python is not installed. Installing Python..." + sudo apt-get update + sudo apt-get install -y python3 +fi # Extract the first IPv4 and IPv6 addresses from the CIDR blocks -OGSTUN_IPV4_1=$(grab_first_ipv4_address "$OGSTUN_IPV4") -OGSTUN_IPV6_1=$(grab_first_ipv6_address "$OGSTUN_IPV6") -OGSTUN_IPV4_1_NO_CIDR=$(remove_cidr_suffix "$OGSTUN_IPV4_1") -OGSTUN_IPV6_1_NO_CIDR=$(remove_cidr_suffix "$OGSTUN_IPV6_1") +OGSTUN_IPV4_1="$(python3 install_scripts/fetch_nth_ip.py "$OGSTUN_IPV4" 0)" +OGSTUN_IPV6_1="$(python3 install_scripts/fetch_nth_ip.py "$OGSTUN_IPV6" 0)" if [ "$EXPOSE_AMF_OVER_HOSTNAME" = true ]; then AMF_IP=$(hostname -I | awk '{print $1}') set_configuration_server_ips $AMF_IP # Need an address for the gNodeB to bind to that is not the host IP. if [ "$IS_OPEN5GS_ON_HOST" = true ]; then - AMF_IP_BIND=$OGSTUN_IPV4_1_NO_CIDR + AMF_IP_BIND=$OGSTUN_IPV4_1 else AMF_IP_BIND=$AMF_IP fi @@ -391,7 +366,7 @@ else AMF_IP_BIND="127.0.0.1" fi -set_configuration_session_gateways $OGSTUN_IPV4 $OGSTUN_IPV4_1_NO_CIDR $OGSTUN_IPV6 $OGSTUN_IPV6_1_NO_CIDR +set_configuration_session_gateways $OGSTUN_IPV4 $OGSTUN_IPV4_1 $OGSTUN_IPV6 $OGSTUN_IPV6_1 # Configure the Single Network Slice Selection Assistance Information (S-NSSAI) set_snssai "$SST" "$SD" @@ -413,6 +388,9 @@ configure_plmn_tac $MCC $MNC $TAC sudo ./install_scripts/network_config.sh +# Enable SCTP kernel module +sudo ./install_scripts/enable_sctp.sh + # Enable IPv4/IPv6 Forwarding sudo sysctl -w net.ipv4.ip_forward=1 sudo sysctl -w net.ipv6.conf.all.forwarding=1 @@ -433,11 +411,20 @@ echo "Unregistering all subscribers in Open5GS database..." # Register the subscribers for UE_NUMBER in "${UE_NUMBERS[@]}"; do + UE_INDEX=$((UE_NUMBER + 99)) + UE_IPV4=$(python3 install_scripts/fetch_nth_ip.py "$OGSTUN_IPV4" "$UE_INDEX") + if [ $? -eq 0 ]; then + IPV4_LINE="--ipv4 $UE_IPV4" + else + IPV4_LINE="" + fi + echo echo "Registering UE $UE_NUMBER..." + # Fetch the UE's OPc, IMEI, IMSI, KEY, and NAMESPACE read -r UE_OPC UE_IMEI UE_IMSI UE_KEY UE_NAMESPACE < <("$UE_CREDENTIAL_GENERATOR_SCRIPT" "$UE_NUMBER" "$PLMN") - ./install_scripts/register_subscriber.sh --imsi "$UE_IMSI" --key "$UE_KEY" --opc "$UE_OPC" --apn "$DNN" --sst "$SST" --sd "$SD" + ./install_scripts/register_subscriber.sh --imsi "$UE_IMSI" --key "$UE_KEY" --opc "$UE_OPC" --apn "$DNN" --sst "$SST" --sd "$SD" $IPV4_LINE done # Restart Open5GS services to apply changes diff --git a/5G_Core_Network/install_scripts/disable_firewall.sh b/5G_Core_Network/install_scripts/disable_firewall.sh index 5083833..7994973 100755 --- a/5G_Core_Network/install_scripts/disable_firewall.sh +++ b/5G_Core_Network/install_scripts/disable_firewall.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." ATTEMPTS=0 MAX_ATTEMPTS=10 diff --git a/User_Equipment/install_scripts/install_yq.sh b/5G_Core_Network/install_scripts/enable_sctp.sh similarity index 52% rename from User_Equipment/install_scripts/install_yq.sh rename to 5G_Core_Network/install_scripts/enable_sctp.sh index 2664512..560f23a 100755 --- a/User_Equipment/install_scripts/install_yq.sh +++ b/5G_Core_Network/install_scripts/enable_sctp.sh @@ -28,76 +28,47 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." -# Uninstall yq with: sudo rm -rf /usr/local/bin/yq; hash -r -if command -v yq &>/dev/null; then - echo "Already installed yq, skipping." - exit 0 -fi +# Exit immediately if a command fails +set -e -echo "Installing yq..." +APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" +if ! dpkg -s lksctp-tools >/dev/null 2>&1; then + sudo apt-get update + sudo env $APTVARS apt-get install -y lksctp-tools +fi +if ! dpkg -s libsctp1 >/dev/null 2>&1; then + sudo apt-get update + sudo env $APTVARS apt-get install -y libsctp1 +fi +if ! dpkg -s libsctp-dev >/dev/null 2>&1; then + sudo apt-get update + sudo env $APTVARS apt-get install -y libsctp-dev +fi -# Determine the processor architecture -ARCH_SUFFIX="" -case $(uname -m) in -"x86_64") - ARCH_SUFFIX="linux_amd64" - ;; -"aarch64") - ARCH_SUFFIX="linux_arm64" - ;; -"armv7l" | "armv6l") - ARCH_SUFFIX="linux_arm" - ;; -"i386" | "i686") - ARCH_SUFFIX="linux_386" - ;; -"ppc64le") - ARCH_SUFFIX="linux_ppc64le" - ;; -"s390x") - ARCH_SUFFIX="linux_s390x" - ;; -"mips") - ARCH_SUFFIX="linux_mips" - ;; -"mips64") - ARCH_SUFFIX="linux_mips64" - ;; -"mips64el" | "mips64le") - ARCH_SUFFIX="linux_mips64le" - ;; -"mipsel" | "mipsle") - ARCH_SUFFIX="linux_mipsle" - ;; -*) - echo "Unsupported architecture for yq: $(uname -m)" - exit 1 - ;; -esac +# Load necessary kernel modules +sudo modprobe overlay || true +sudo modprobe br_netfilter || true -YQ_URL="https://github.com/mikefarah/yq/releases/latest/download/yq_${ARCH_SUFFIX}.tar.gz" +# Load SCTP module +sudo modprobe sctp -# Create a temporary directory for the download -TEMP_DIR=$(mktemp -d) -TEMP_PATH="$TEMP_DIR/yq.tar.gz" +# Get the kernel major version +KERNEL_VERSION="$(uname -r | cut -d'-' -f1)" +MAJOR_VERSION="$(echo "$KERNEL_VERSION" | cut -d'.' -f1)" -echo "Downloading yq from $YQ_URL..." -HTTP_STATUS=$(curl -L -w "%{http_code}" -o "$TEMP_PATH" "$YQ_URL") -if [ "$HTTP_STATUS" -eq 200 ]; then - echo "Extracting yq..." - tar -xzf "$TEMP_PATH" -C "$TEMP_DIR" - if [ -f "$TEMP_DIR/./yq_$ARCH_SUFFIX" ]; then - sudo mv "$TEMP_DIR/./yq_$ARCH_SUFFIX" /usr/local/bin/yq - sudo chmod +x /usr/local/bin/yq - echo "Successfully installed yq." - else - echo "Failed to extract yq from the tar.gz." - exit 1 - fi +# Conditional loading of connection tracking modules based on kernel version +if [ "$MAJOR_VERSION" -lt 5 ]; then + # For older kernels (before version 5), load IPv4 and IPv6 specific modules + sudo modprobe nf_conntrack_ipv4 || true + sudo modprobe nf_conntrack_ipv6 || true + sudo modprobe nf_conntrack_proto_sctp || true else - sudo rm -rf "$TEMP_DIR" - echo "Failed to download yq for the architecture: ${ARCH_SUFFIX}, HTTP status was $HTTP_STATUS." - exit 1 + # For newer kernels (version 5 and later), use the unified nf_conntrack module + sudo modprobe nf_conntrack || true + sudo modprobe nf_conntrack_sctp || true fi + +echo "SCTP kernel module present:" +lsmod | grep -E '(^| )sctp( |$)' || echo "WARNING: sctp not loaded" diff --git a/5G_Core_Network/install_scripts/install_yq.sh b/5G_Core_Network/install_scripts/ensure_consistent_yq.sh similarity index 78% rename from 5G_Core_Network/install_scripts/install_yq.sh rename to 5G_Core_Network/install_scripts/ensure_consistent_yq.sh index 2f946f7..d3794d3 100755 --- a/5G_Core_Network/install_scripts/install_yq.sh +++ b/5G_Core_Network/install_scripts/ensure_consistent_yq.sh @@ -28,12 +28,26 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +# Exit immediately if a command fails +set -e + +YQ_VERSION="v4.47.2" -# Uninstall yq with: sudo rm -rf /usr/local/bin/yq; hash -r && hash -r if command -v yq &>/dev/null; then - echo "Already installed yq, skipping." - exit 0 + # Check that the correct version of yq is installed + if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then + echo "ERROR: Detected an incompatible yq installation." + echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." + exit 1 + fi + + if yq --version 2>/dev/null | grep -q "$YQ_VERSION"; then + exit 0 + fi + + echo "Removing incompatible yq..." + sudo rm -rf /usr/local/bin/yq + hash -r fi echo "Installing yq..." @@ -77,12 +91,18 @@ case $(uname -m) in ;; esac -YQ_URL="https://github.com/mikefarah/yq/releases/latest/download/yq_${ARCH_SUFFIX}.tar.gz" +YQ_URL="https://github.com/mikefarah/yq/releases/download/$YQ_VERSION/yq_${ARCH_SUFFIX}.tar.gz" # Create a temporary directory for the download TEMP_DIR=$(mktemp -d) TEMP_PATH="$TEMP_DIR/yq.tar.gz" +if ! command -v curl &>/dev/null; then + echo "Package \"curl\" not found, installing..." + APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" + sudo env $APTVARS apt-get install -y curl +fi + echo "Downloading yq from $YQ_URL..." HTTP_STATUS=$(curl -L -w "%{http_code}" -o "$TEMP_PATH" "$YQ_URL") if [ "$HTTP_STATUS" -eq 200 ]; then diff --git a/5G_Core_Network/install_scripts/fetch_nth_ip.py b/5G_Core_Network/install_scripts/fetch_nth_ip.py new file mode 100644 index 0000000..8eb2fa8 --- /dev/null +++ b/5G_Core_Network/install_scripts/fetch_nth_ip.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 + +# Usage: +# fetch_nth_ip.py + +# For example: +# fetch_nth_ip.py 192.168.1.0/24 0 returns 192.168.1.1 +# fetch_nth_ip.py 2001:db8::/64 0 returns 2001:db8::1 +# fetch_nth_ip.py 192.168.1.0/24 10 returns 192.168.1.11 +# fetch_nth_ip.py 2001:db8::/64 10 returns 2001:db8::b + +import sys +import argparse +import ipaddress + +def fetch_nth_address(network_str, offset): + net = ipaddress.ip_network(network_str, strict=False) + assert offset >= 0, "Offset must be non-negative" + + if isinstance(net, ipaddress.IPv4Network): + if net.prefixlen == 32: + assert offset == 0, "Offset out of range for single-address subnet." + return net.network_address + if net.prefixlen == 31: + assert offset < 2, "Offset out of range for two-address subnet." + return ipaddress.ip_address(int(net.network_address) + offset) + # Regular IPv4: skip network and broadcast + usable = net.num_addresses - 2 + assert offset < usable, f"Offset out of range. Usable range: 0 to {usable-1}" + return ipaddress.ip_address(int(net.network_address) + 1 + offset) + + if net.prefixlen == 128: # IPv6 + assert offset == 0, "Offset out of range for single-address subnet." + return net.network_address + + # Skip the base address by default + usable = net.num_addresses - 1 + assert offset < usable, f"Offset out of range. Usable range: 0 to {usable-1}" + return ipaddress.ip_address(int(net.network_address) + 1 + offset) + +if __name__ == "__main__": + ap = argparse.ArgumentParser(description="Return the Nth address from a network.") + ap.add_argument("subnet", help="Network in CIDR notation, e.g. 192.168.1.0/24 or 2001:db8::/64") + ap.add_argument("offset", type=int, help="Offset from the first address") + args = ap.parse_args() + try: + ip = fetch_nth_address(args.subnet, args.offset) + print(str(ip)) + except Exception as e: + print(f"ERROR: {e}", file=sys.stderr) + sys.exit(1) diff --git a/5G_Core_Network/install_scripts/git_clone.sh b/5G_Core_Network/install_scripts/git_clone.sh index 211e6bd..446e60f 100755 --- a/5G_Core_Network/install_scripts/git_clone.sh +++ b/5G_Core_Network/install_scripts/git_clone.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -53,7 +53,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -63,7 +63,7 @@ HOME_DIR=$(dirname "$(dirname "$SCRIPT_DIR")") if ! command -v jq &>/dev/null; then echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi # First check the directory containing install_scripts/, otherwise, use the home directory @@ -87,7 +87,7 @@ if [[ -d "$NAME" && ! -d "$NAME/.git" ]]; then fi # Verify that the repository is on the correct commit hash -if jq -e ".\"$URL\"[1]" $JSON_FILE &>/dev/null; then +if jq -e --arg url "$URL" '.[$url][1]' "$JSON_FILE" &>/dev/null; then BRANCH=$(jq -r ".\"$URL\"[0]" $JSON_FILE) TARGET_COMMIT_HASH=$(jq -r ".\"$URL\"[1]" $JSON_FILE) diff --git a/5G_Core_Network/install_scripts/install_mongodb.sh b/5G_Core_Network/install_scripts/install_mongodb.sh index 1fa5cef..8dffc1c 100755 --- a/5G_Core_Network/install_scripts/install_mongodb.sh +++ b/5G_Core_Network/install_scripts/install_mongodb.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -99,7 +99,7 @@ else fi echo "Installing gnupg and curl if not already installed..." - sudo $APTVARS apt-get install -y gnupg curl || { + sudo env $APTVARS apt-get install -y gnupg curl || { echo "Failed to install GnuPG or curl" exit 1 } @@ -128,13 +128,13 @@ else fi echo "Attempting to install MongoDB 4.4..." - if ! sudo $APTVARS apt-get install -y --allow-change-held-packages mongodb-org=4.4.* mongodb-org-server=4.4.* mongodb-org-shell=4.4.* mongodb-org-mongos=4.4.* mongodb-org-tools=4.4.*; then + if ! sudo env $APTVARS apt-get install -y --allow-change-held-packages mongodb-org=4.4.* mongodb-org-server=4.4.* mongodb-org-shell=4.4.* mongodb-org-mongos=4.4.* mongodb-org-tools=4.4.*; then echo "Initial MongoDB installation failed. Attempting to fix broken installations..." sudo apt-get --fix-broken install sudo apt-get autoremove -y sudo apt-get clean echo "Trying to install MongoDB 4.4 again..." - if ! sudo $APTVARS apt-get install -y --allow-change-held-packages mongodb-org=4.4.* mongodb-org-server=4.4.* mongodb-org-shell=4.4.* mongodb-org-mongos=4.4.* mongodb-org-tools=4.4.*; then + if ! sudo env $APTVARS apt-get install -y --allow-change-held-packages mongodb-org=4.4.* mongodb-org-server=4.4.* mongodb-org-shell=4.4.* mongodb-org-mongos=4.4.* mongodb-org-tools=4.4.*; then echo "Failed to install MongoDB 4.4 after attempting repairs. Exiting script." exit 1 fi @@ -142,7 +142,7 @@ else fi echo "Attempting to install mongosh..." -if ! sudo $APTVARS apt-get install -y --allow-change-held-packages mongosh; then +if ! sudo env $APTVARS apt-get install -y --allow-change-held-packages mongosh; then echo "Failed initial attempt to install mongosh. Adding MongoDB 5.0 repository for mongosh..." # Import the MongoDB 5.0 public key if ! curl -fsSL https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -; then @@ -159,13 +159,13 @@ if ! sudo $APTVARS apt-get install -y --allow-change-held-packages mongosh; then done sudo apt-get update - if ! sudo $APTVARS apt-get install -y --allow-change-held-packages mongodb-mongosh; then + if ! sudo env $APTVARS apt-get install -y --allow-change-held-packages mongodb-mongosh; then echo "Failed to install mongosh even from MongoDB 5.0 repository. Attempting to fix broken installations..." sudo apt-get --fix-broken install sudo apt-get autoremove -y sudo apt-get clean echo "Trying to install mongosh again..." - if ! sudo $APTVARS apt-get install -y --allow-change-held-packages mongodb-mongosh; then + if ! sudo env $APTVARS apt-get install -y --allow-change-held-packages mongodb-mongosh; then echo "An error occured. Running dpkg --configure -a to ensure all packages are properly configured..." sudo dpkg --configure -a || true echo "Failed to install mongosh after attempting repairs. Exiting script." diff --git a/5G_Core_Network/install_scripts/install_webui.sh b/5G_Core_Network/install_scripts/install_webui.sh index 71db227..f47ecf7 100755 --- a/5G_Core_Network/install_scripts/install_webui.sh +++ b/5G_Core_Network/install_scripts/install_webui.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -37,7 +37,7 @@ cd "$PARENT_DIR" sudo ./install_scripts/start_mongodb.sh APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" -sudo $APTVARS apt-get install -y ca-certificates curl gnupg +sudo env $APTVARS apt-get install -y ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor --yes -o /etc/apt/keyrings/nodesource.gpg @@ -54,6 +54,6 @@ fi sudo apt-get update -sudo $APTVARS apt-get install -y nodejs +sudo env $APTVARS apt-get install -y nodejs curl -fsSL https://open5gs.org/open5gs/assets/webui/install | sudo -E bash - diff --git a/5G_Core_Network/install_scripts/network_config.sh b/5G_Core_Network/install_scripts/network_config.sh index 283a135..d87ee39 100755 --- a/5G_Core_Network/install_scripts/network_config.sh +++ b/5G_Core_Network/install_scripts/network_config.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") diff --git a/5G_Core_Network/install_scripts/register_subscriber.sh b/5G_Core_Network/install_scripts/register_subscriber.sh index 24145f8..e6462a5 100755 --- a/5G_Core_Network/install_scripts/register_subscriber.sh +++ b/5G_Core_Network/install_scripts/register_subscriber.sh @@ -31,10 +31,10 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -49,6 +49,8 @@ DEFAULT_OPC="63BFA50EE6523365FF14C1F45F88737D" DEFAULT_APN="internet" DEFAULT_SST="" DEFAULT_SD="" +DEFAULT_IPV4="" +DEFAULT_IPV6="" ./start_webui.sh no-browser @@ -62,6 +64,8 @@ usage() { echo " --apn [APN] Set the APN value (default: $DEFAULT_APN)" echo " --sst [SST] Set the SST value (optional)" echo " --sd [SD] Set the SD value (optional)" + echo " --ipv4 [IPv4] Set the IPv4 address (optional)" + echo " --ipv6 [IPv6] Set the IPv6 address (optional)" echo " -h, --help Display this help message and exit" exit 1 } @@ -99,6 +103,14 @@ while [[ "$#" -gt 0 ]]; do SD="${2}" shift ;; + --ipv4) + IPV4="${2}" + shift + ;; + --ipv6) + IPV6="${2}" + shift + ;; -h | --help) usage ;; *) echo "Unknown parameter passed: $1" @@ -115,6 +127,8 @@ OPC="${OPC:-$DEFAULT_OPC}" APN="${APN:-$DEFAULT_APN}" SST="${SST:-$DEFAULT_SST}" SD="${SD:-$DEFAULT_SD}" +IPV4="${IPV4:-$DEFAULT_IPV4}" +IPV6="${IPV6:-$DEFAULT_IPV6}" # Check if the subscriber already exists if $DBCTL_DIR showpretty | grep -q "imsi: '$IMSI'"; then @@ -132,6 +146,28 @@ fi echo "Running command: $CMD" $CMD +# Support for IPv4 and IPv6 +if [[ -n "$IPV4" ]]; then + echo "Assigning static IPv4 $IPV4 to subscriber $IMSI" + $DBCTL_DIR static_ip $IMSI $IPV4 +fi +if [[ -n "$IPV6" ]]; then + echo "Assigning static IPv6 $IPV6 to subscriber $IMSI" + $DBCTL_DIR static_ip6 $IMSI $IPV6 +fi +TYPE="" +if [[ -n "$IPV4" && -n "$IPV6" ]]; then # IPv4v6 + TYPE="3" +elif [[ -n "$IPV4" ]]; then # IPv4 + TYPE="1" +elif [[ -n "$IPV6" ]]; then # IPv6 + TYPE="2" +fi +if [[ -n "$TYPE" ]]; then + echo "Assigning PDN-Type $TYPE to subscriber $IMSI" + $DBCTL_DIR type $IMSI $TYPE +fi + # Check exit status of the command if [ $? -eq 0 ]; then echo "Subscriber successfully added to the database." diff --git a/5G_Core_Network/install_scripts/remove_expired_apt_keys.sh b/5G_Core_Network/install_scripts/remove_expired_apt_keys.sh index 241a8db..42b8b19 100755 --- a/5G_Core_Network/install_scripts/remove_expired_apt_keys.sh +++ b/5G_Core_Network/install_scripts/remove_expired_apt_keys.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." OUTPUT=$(sudo apt-get update 2>&1 | tee /dev/tty) diff --git a/5G_Core_Network/install_scripts/start_mongodb.sh b/5G_Core_Network/install_scripts/start_mongodb.sh index aad4392..7b867b8 100755 --- a/5G_Core_Network/install_scripts/start_mongodb.sh +++ b/5G_Core_Network/install_scripts/start_mongodb.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") diff --git a/5G_Core_Network/install_scripts/start_sudo_refresh.sh b/5G_Core_Network/install_scripts/start_sudo_refresh.sh index f06150c..6ede8a1 100755 --- a/5G_Core_Network/install_scripts/start_sudo_refresh.sh +++ b/5G_Core_Network/install_scripts/start_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." sudo ls &>/dev/null SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/5G_Core_Network/install_scripts/stop_sudo_refresh.sh b/5G_Core_Network/install_scripts/stop_sudo_refresh.sh index 94af8a2..0ca89f1 100755 --- a/5G_Core_Network/install_scripts/stop_sudo_refresh.sh +++ b/5G_Core_Network/install_scripts/stop_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Attempt to kill the process pkill -f "sudo_stay_validated.sh" || echo "No process found to stop." diff --git a/5G_Core_Network/install_scripts/sudo_stay_validated.sh b/5G_Core_Network/install_scripts/sudo_stay_validated.sh index f237b1b..826b5ee 100755 --- a/5G_Core_Network/install_scripts/sudo_stay_validated.sh +++ b/5G_Core_Network/install_scripts/sudo_stay_validated.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Simple script to keep sudo active by refreshing it every minute while true; do diff --git a/5G_Core_Network/install_scripts/uninstall_mongodb.sh b/5G_Core_Network/install_scripts/uninstall_mongodb.sh index 0f5df0d..dc4e07b 100755 --- a/5G_Core_Network/install_scripts/uninstall_mongodb.sh +++ b/5G_Core_Network/install_scripts/uninstall_mongodb.sh @@ -31,7 +31,7 @@ # Do not exit immediately if a command fails set +e -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Stop and disable the MongoDB service if systemctl is-active --quiet mongod; then diff --git a/5G_Core_Network/install_scripts/unregister_all_subscribers.sh b/5G_Core_Network/install_scripts/unregister_all_subscribers.sh index 7d236ab..15e9da3 100755 --- a/5G_Core_Network/install_scripts/unregister_all_subscribers.sh +++ b/5G_Core_Network/install_scripts/unregister_all_subscribers.sh @@ -31,10 +31,10 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") diff --git a/5G_Core_Network/is_amf_ready.sh b/5G_Core_Network/is_amf_ready.sh index d64c667..201a794 100755 --- a/5G_Core_Network/is_amf_ready.sh +++ b/5G_Core_Network/is_amf_ready.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/5G_Core_Network/is_running.sh b/5G_Core_Network/is_running.sh index 45ede9a..e2ebf45 100755 --- a/5G_Core_Network/is_running.sh +++ b/5G_Core_Network/is_running.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -79,4 +79,3 @@ for APP in "${APPS[@]}"; do check_service "$APP" "$APP" fi done - diff --git a/5G_Core_Network/list_subscribers.sh b/5G_Core_Network/list_subscribers.sh index ccfba53..a4763ef 100755 --- a/5G_Core_Network/list_subscribers.sh +++ b/5G_Core_Network/list_subscribers.sh @@ -31,10 +31,10 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") cd "$SCRIPT_DIR" diff --git a/5G_Core_Network/run.sh b/5G_Core_Network/run.sh index 2d67b8b..1aa45ed 100755 --- a/5G_Core_Network/run.sh +++ b/5G_Core_Network/run.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/5G_Core_Network/stop.sh b/5G_Core_Network/stop.sh index 7f73207..1abd47f 100755 --- a/5G_Core_Network/stop.sh +++ b/5G_Core_Network/stop.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/Additional_Scripts/download_dependency_repositories.bat b/Additional_Scripts/download_dependency_repositories.bat index a82f150..30e51d7 100644 --- a/Additional_Scripts/download_dependency_repositories.bat +++ b/Additional_Scripts/download_dependency_repositories.bat @@ -216,7 +216,7 @@ if exist "RAN_Intelligent_Controllers\Non-Real-Time-RIC\nonrtric-controlpanel" r cd RAN_Intelligent_Controllers\Non-Real-Time-RIC git clone https://gerrit.o-ran-sc.org/r/portal/nonrtric-controlpanel.git cd nonrtric-controlpanel -git checkout fe9051bb91b524ff9cef5023a95dea7161d75388 +git checkout f337177ece41c036967ece8513e9f29b07deca34 cd ..\..\.. cd %~dp0.. @@ -243,7 +243,7 @@ if exist "OpenAirInterface_Testbed\User_Equipment\openairinterface5g" rmdir /s / cd OpenAirInterface_Testbed\User_Equipment git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git cd openairinterface5g -git checkout 8bf6d5d7da8c0a8384e4022fd4872e6d3d550921 +git checkout fc1c762cf2d1390a1e21f4360c05a3d5fa5a090e cd ..\..\.. cd OpenAirInterface_Testbed\Next_Generation_Node_B diff --git a/Additional_Scripts/download_dependency_repositories.sh b/Additional_Scripts/download_dependency_repositories.sh index bbd9f9a..0984b0a 100755 --- a/Additional_Scripts/download_dependency_repositories.sh +++ b/Additional_Scripts/download_dependency_repositories.sh @@ -33,10 +33,10 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") cd "$(dirname "$SCRIPT_DIR")" diff --git a/Additional_Scripts/generate_download_dependency_repositories.bat.sh b/Additional_Scripts/generate_download_dependency_repositories.bat.sh index 8410f63..d7e2267 100755 --- a/Additional_Scripts/generate_download_dependency_repositories.bat.sh +++ b/Additional_Scripts/generate_download_dependency_repositories.bat.sh @@ -33,10 +33,10 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") cd "$SCRIPT_DIR" @@ -83,7 +83,7 @@ echo "" >>download_dependency_repositories.bat if ! command -v jq >/dev/null 2>&1; then echo "Installing jq to process JSON files..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi # Function to generate the git clone and git checkout commands diff --git a/Additional_Scripts/install_and_configure_wireshark.sh b/Additional_Scripts/install_and_configure_wireshark.sh index 86a2ff2..38aa9a0 100755 --- a/Additional_Scripts/install_and_configure_wireshark.sh +++ b/Additional_Scripts/install_and_configure_wireshark.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Install Wireshark if not already installed if ! dpkg -s "wireshark" &>/dev/null; then @@ -36,7 +36,7 @@ if ! dpkg -s "wireshark" &>/dev/null; then sudo add-apt-repository ppa:wireshark-dev/stable -y sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y wireshark + sudo env $APTVARS apt-get install -y wireshark fi # Add user to the Wireshark group if not already a member diff --git a/Additional_Scripts/migrate_to_new_version.sh b/Additional_Scripts/migrate_to_new_version.sh index 9844142..34180aa 100755 --- a/Additional_Scripts/migrate_to_new_version.sh +++ b/Additional_Scripts/migrate_to_new_version.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/Additional_Scripts/remove_expired_apt_keys.sh b/Additional_Scripts/remove_expired_apt_keys.sh index 241a8db..42b8b19 100755 --- a/Additional_Scripts/remove_expired_apt_keys.sh +++ b/Additional_Scripts/remove_expired_apt_keys.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." OUTPUT=$(sudo apt-get update 2>&1 | tee /dev/tty) diff --git a/Additional_Scripts/update_commit_hashes.sh b/Additional_Scripts/update_commit_hashes.sh index bf826f2..e126d99 100755 --- a/Additional_Scripts/update_commit_hashes.sh +++ b/Additional_Scripts/update_commit_hashes.sh @@ -45,7 +45,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -56,7 +56,7 @@ if ! command -v jq &>/dev/null; then sudo apt-get update echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi JSON_FILE="commit_hashes.json" diff --git a/Next_Generation_Node_B/full_install.sh b/Next_Generation_Node_B/full_install.sh index 080125a..d8bb280 100755 --- a/Next_Generation_Node_B/full_install.sh +++ b/Next_Generation_Node_B/full_install.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -97,30 +97,18 @@ EOF fi # Code from (https://docs.srsran.com/projects/project/en/latest/user_manuals/source/installation.html#manual-installation-dependencies): -sudo $APTVARS apt-get install -y build-essential cmake cmake-data make gcc g++ pkg-config libfftw3-dev libmbedtls-dev libsctp-dev libyaml-cpp-dev libgtest-dev - -sudo $APTVARS apt-get install -y autoconf automake libtool -sudo $APTVARS apt-get install -y libuhd-dev -sudo $APTVARS apt-get install -y uhd-host -sudo $APTVARS apt-get install -y libdw-dev libbfd-dev libdwarf-dev -sudo $APTVARS apt-get install -y libgtest-dev -sudo $APTVARS apt-get install -y libyaml-cpp-dev -sudo $APTVARS apt-get install -y timelimit - -# Enable SCTP -sudo $APTVARS apt-get install -y libsctp-dev -# Check if SCTP is available and load it if necessary -if ! lsmod | grep -q sctp; then - echo "Loading SCTP module..." - sudo modprobe sctp -fi -# Verify if SCTP is successfully loaded -if ! lsmod | grep -q sctp; then - echo "SCTP module could not be loaded. Exiting." - exit 1 -else - echo "SCTP module loaded successfully." -fi +sudo env $APTVARS apt-get install -y build-essential cmake cmake-data make gcc g++ pkg-config libfftw3-dev libmbedtls-dev libsctp-dev libyaml-cpp-dev libgtest-dev + +sudo env $APTVARS apt-get install -y autoconf automake libtool +sudo env $APTVARS apt-get install -y libuhd-dev +sudo env $APTVARS apt-get install -y uhd-host +sudo env $APTVARS apt-get install -y libdw-dev libbfd-dev libdwarf-dev +sudo env $APTVARS apt-get install -y libgtest-dev +sudo env $APTVARS apt-get install -y libyaml-cpp-dev +sudo env $APTVARS apt-get install -y timelimit + +echo "Ensuring that SCTP is enabled..." +sudo ./install_scripts/enable_sctp.sh # Check if GCC 13 is installed, if not, install it and set it as the default GCC_VERSION=$(gcc -v 2>&1 | grep "gcc version" | awk '{print $3}') @@ -128,7 +116,7 @@ if [[ -z "$GCC_VERSION" || ! "$GCC_VERSION" == 13.* ]]; then echo "Installing GCC 13..." sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update - sudo $APTVARS apt-get install -y gcc-13 g++-13 + sudo env $APTVARS apt-get install -y gcc-13 g++-13 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 fi diff --git a/Next_Generation_Node_B/full_uninstall.sh b/Next_Generation_Node_B/full_uninstall.sh index b011f02..f326b74 100755 --- a/Next_Generation_Node_B/full_uninstall.sh +++ b/Next_Generation_Node_B/full_uninstall.sh @@ -34,7 +34,7 @@ set +e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/Next_Generation_Node_B/generate_configurations.sh b/Next_Generation_Node_B/generate_configurations.sh index da65999..b9a258c 100755 --- a/Next_Generation_Node_B/generate_configurations.sh +++ b/Next_Generation_Node_B/generate_configurations.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -76,16 +76,8 @@ if [[ -z "$SST" || -z "$SD" || "$SST" == "null" || "$SD" == "null" ]]; then exit 1 fi -# Check if the YAML editor is installed, and install it if not -if ! command -v yq &>/dev/null; then - sudo "$SCRIPT_DIR/install_scripts/./install_yq.sh" -fi -# Check that the correct version of yq is installed -if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then - echo "ERROR: Detected an incompatible yq installation." - echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." - exit 1 -fi +# Ensure the correct YAML editor is installed +sudo "$SCRIPT_DIR/install_scripts/./ensure_consistent_yq.sh" echo "Restoring gNodeB configuration file..." rm -rf configs @@ -172,7 +164,8 @@ prompt_for_addresses() { echo "Please enter the AMF address and the AMF binding address manually." >&2 echo "You can find this information in the 5G_Core_Network/configs/get_amf_addresses.txt file in the first two lines, respectively." >&2 read -p "Enter AMF Address: " AMF_ADDR - read -p "Enter AMF Binding Address: " AMF_ADDR_BIND + read -p "Enter AMF Binding Address: " N3_ADDR_BIND + N2_ADDR_BIND=$N3_ADDR_BIND } # Check if AMF_ADDRESSES has at least two non-empty lines @@ -183,9 +176,14 @@ if [[ -n "$AMF_ADDRESSES" ]]; then [[ -z "$line" ]] && continue # skip blank lines ADDRESSES+=("$line") done <<<"$AMF_ADDRESSES" - if [[ ${#ADDRESSES[@]} -ge 2 ]] && [[ -n ${ADDRESSES[0]} ]] && [[ -n ${ADDRESSES[1]} ]]; then + if [[ ${#ADDRESSES[@]} -ge 3 ]] && [[ -n ${ADDRESSES[0]} ]] && [[ -n ${ADDRESSES[1]} ]] && [[ -n ${ADDRESSES[2]} ]]; then + AMF_ADDR="${ADDRESSES[0]}" + N3_ADDR_BIND="${ADDRESSES[1]}" + N2_ADDR_BIND="${ADDRESSES[2]}" + elif [[ ${#ADDRESSES[@]} -ge 2 ]] && [[ -n ${ADDRESSES[0]} ]] && [[ -n ${ADDRESSES[1]} ]]; then AMF_ADDR="${ADDRESSES[0]}" - AMF_ADDR_BIND="${ADDRESSES[1]}" + N3_ADDR_BIND="${ADDRESSES[1]}" + N2_ADDR_BIND="${ADDRESSES[1]}" else echo echo "AMF address script did not return valid data." @@ -198,7 +196,7 @@ else fi echo "AMF Address: $AMF_ADDR" -echo "AMF Binding Address: $AMF_ADDR_BIND" +echo "NGAP Binding Address: $N2_ADDR_BIND" # Function to update or add YAML configuration properties using yq update_yaml() { @@ -250,7 +248,7 @@ DEVICE_ARGS="tx_port0=tcp://127.0.0.1:2000,rx_port0=tcp://127.0.0.1:2001,base_sr # Update configuration values for AMF connection update_yaml "configs/gnb.yaml" "cu_cp.amf" "addr" "$AMF_ADDR" -update_yaml "configs/gnb.yaml" "cu_cp.amf" "bind_addr" "$AMF_ADDR_BIND" +update_yaml "configs/gnb.yaml" "cu_cp.amf" "bind_addr" "$N2_ADDR_BIND" update_yaml "configs/gnb.yaml" "cu_cp.amf.supported_tracking_areas[0]" "tac" $TAC update_yaml "configs/gnb.yaml" "cu_cp.amf.supported_tracking_areas[0].plmn_list[0]" "plmn" $PLMN update_yaml "configs/gnb.yaml" "cu_cp.request_pdu_session_timeout" "60" diff --git a/Next_Generation_Node_B/install_scripts/enable_sctp.sh b/Next_Generation_Node_B/install_scripts/enable_sctp.sh new file mode 100755 index 0000000..560f23a --- /dev/null +++ b/Next_Generation_Node_B/install_scripts/enable_sctp.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +# NIST-developed software is provided by NIST as a public service. You may use, +# copy, and distribute copies of the software in any medium, provided that you +# keep intact this entire notice. You may improve, modify, and create derivative +# works of the software or any portion of the software, and you may copy and +# distribute such modifications or works. Modified works should carry a notice +# stating that you changed the software and should note the date and nature of +# any such change. Please explicitly acknowledge the National Institute of +# Standards and Technology as the source of the software. +# +# NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY +# OF ANY KIND, EXPRESS, IMPLIED, IN FACT, OR ARISING BY OPERATION OF LAW, +# INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND DATA ACCURACY. NIST +# NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE +# UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES +# NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR +# THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, +# RELIABILITY, OR USEFULNESS OF THE SOFTWARE. +# +# You are solely responsible for determining the appropriateness of using and +# distributing the software and you assume all risks associated with its use, +# including but not limited to the risks and costs of program errors, compliance +# with applicable laws, damage to or loss of data, programs or equipment, and +# the unavailability or interruption of operation. This software is not intended +# to be used in any situation where a failure could cause risk of injury or +# damage to property. The software developed by NIST employees is not subject to +# copyright protection within the United States. + +echo "# Script: $(realpath "$0")..." + +# Exit immediately if a command fails +set -e + +APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" +if ! dpkg -s lksctp-tools >/dev/null 2>&1; then + sudo apt-get update + sudo env $APTVARS apt-get install -y lksctp-tools +fi +if ! dpkg -s libsctp1 >/dev/null 2>&1; then + sudo apt-get update + sudo env $APTVARS apt-get install -y libsctp1 +fi +if ! dpkg -s libsctp-dev >/dev/null 2>&1; then + sudo apt-get update + sudo env $APTVARS apt-get install -y libsctp-dev +fi + +# Load necessary kernel modules +sudo modprobe overlay || true +sudo modprobe br_netfilter || true + +# Load SCTP module +sudo modprobe sctp + +# Get the kernel major version +KERNEL_VERSION="$(uname -r | cut -d'-' -f1)" +MAJOR_VERSION="$(echo "$KERNEL_VERSION" | cut -d'.' -f1)" + +# Conditional loading of connection tracking modules based on kernel version +if [ "$MAJOR_VERSION" -lt 5 ]; then + # For older kernels (before version 5), load IPv4 and IPv6 specific modules + sudo modprobe nf_conntrack_ipv4 || true + sudo modprobe nf_conntrack_ipv6 || true + sudo modprobe nf_conntrack_proto_sctp || true +else + # For newer kernels (version 5 and later), use the unified nf_conntrack module + sudo modprobe nf_conntrack || true + sudo modprobe nf_conntrack_sctp || true +fi + +echo "SCTP kernel module present:" +lsmod | grep -E '(^| )sctp( |$)' || echo "WARNING: sctp not loaded" diff --git a/Next_Generation_Node_B/install_scripts/install_yq.sh b/Next_Generation_Node_B/install_scripts/ensure_consistent_yq.sh similarity index 78% rename from Next_Generation_Node_B/install_scripts/install_yq.sh rename to Next_Generation_Node_B/install_scripts/ensure_consistent_yq.sh index 2664512..d3794d3 100755 --- a/Next_Generation_Node_B/install_scripts/install_yq.sh +++ b/Next_Generation_Node_B/install_scripts/ensure_consistent_yq.sh @@ -28,12 +28,26 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +# Exit immediately if a command fails +set -e + +YQ_VERSION="v4.47.2" -# Uninstall yq with: sudo rm -rf /usr/local/bin/yq; hash -r if command -v yq &>/dev/null; then - echo "Already installed yq, skipping." - exit 0 + # Check that the correct version of yq is installed + if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then + echo "ERROR: Detected an incompatible yq installation." + echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." + exit 1 + fi + + if yq --version 2>/dev/null | grep -q "$YQ_VERSION"; then + exit 0 + fi + + echo "Removing incompatible yq..." + sudo rm -rf /usr/local/bin/yq + hash -r fi echo "Installing yq..." @@ -77,12 +91,18 @@ case $(uname -m) in ;; esac -YQ_URL="https://github.com/mikefarah/yq/releases/latest/download/yq_${ARCH_SUFFIX}.tar.gz" +YQ_URL="https://github.com/mikefarah/yq/releases/download/$YQ_VERSION/yq_${ARCH_SUFFIX}.tar.gz" # Create a temporary directory for the download TEMP_DIR=$(mktemp -d) TEMP_PATH="$TEMP_DIR/yq.tar.gz" +if ! command -v curl &>/dev/null; then + echo "Package \"curl\" not found, installing..." + APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" + sudo env $APTVARS apt-get install -y curl +fi + echo "Downloading yq from $YQ_URL..." HTTP_STATUS=$(curl -L -w "%{http_code}" -o "$TEMP_PATH" "$YQ_URL") if [ "$HTTP_STATUS" -eq 200 ]; then diff --git a/Next_Generation_Node_B/install_scripts/git_clone.sh b/Next_Generation_Node_B/install_scripts/git_clone.sh index 211e6bd..446e60f 100755 --- a/Next_Generation_Node_B/install_scripts/git_clone.sh +++ b/Next_Generation_Node_B/install_scripts/git_clone.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -53,7 +53,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -63,7 +63,7 @@ HOME_DIR=$(dirname "$(dirname "$SCRIPT_DIR")") if ! command -v jq &>/dev/null; then echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi # First check the directory containing install_scripts/, otherwise, use the home directory @@ -87,7 +87,7 @@ if [[ -d "$NAME" && ! -d "$NAME/.git" ]]; then fi # Verify that the repository is on the correct commit hash -if jq -e ".\"$URL\"[1]" $JSON_FILE &>/dev/null; then +if jq -e --arg url "$URL" '.[$url][1]' "$JSON_FILE" &>/dev/null; then BRANCH=$(jq -r ".\"$URL\"[0]" $JSON_FILE) TARGET_COMMIT_HASH=$(jq -r ".\"$URL\"[1]" $JSON_FILE) diff --git a/Next_Generation_Node_B/install_scripts/remove_expired_apt_keys.sh b/Next_Generation_Node_B/install_scripts/remove_expired_apt_keys.sh index 241a8db..42b8b19 100755 --- a/Next_Generation_Node_B/install_scripts/remove_expired_apt_keys.sh +++ b/Next_Generation_Node_B/install_scripts/remove_expired_apt_keys.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." OUTPUT=$(sudo apt-get update 2>&1 | tee /dev/tty) diff --git a/Next_Generation_Node_B/install_scripts/start_sudo_refresh.sh b/Next_Generation_Node_B/install_scripts/start_sudo_refresh.sh index f06150c..6ede8a1 100755 --- a/Next_Generation_Node_B/install_scripts/start_sudo_refresh.sh +++ b/Next_Generation_Node_B/install_scripts/start_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." sudo ls &>/dev/null SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/Next_Generation_Node_B/install_scripts/stop_sudo_refresh.sh b/Next_Generation_Node_B/install_scripts/stop_sudo_refresh.sh index 94af8a2..0ca89f1 100755 --- a/Next_Generation_Node_B/install_scripts/stop_sudo_refresh.sh +++ b/Next_Generation_Node_B/install_scripts/stop_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Attempt to kill the process pkill -f "sudo_stay_validated.sh" || echo "No process found to stop." diff --git a/Next_Generation_Node_B/install_scripts/sudo_stay_validated.sh b/Next_Generation_Node_B/install_scripts/sudo_stay_validated.sh index f237b1b..826b5ee 100755 --- a/Next_Generation_Node_B/install_scripts/sudo_stay_validated.sh +++ b/Next_Generation_Node_B/install_scripts/sudo_stay_validated.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Simple script to keep sudo active by refreshing it every minute while true; do diff --git a/Next_Generation_Node_B/is_running.sh b/Next_Generation_Node_B/is_running.sh index b4885cd..fb10165 100755 --- a/Next_Generation_Node_B/is_running.sh +++ b/Next_Generation_Node_B/is_running.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/Next_Generation_Node_B/run.sh b/Next_Generation_Node_B/run.sh index b1b4606..cedd16d 100755 --- a/Next_Generation_Node_B/run.sh +++ b/Next_Generation_Node_B/run.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/Next_Generation_Node_B/run_background.sh b/Next_Generation_Node_B/run_background.sh index 8ee18e7..6e5ade3 100755 --- a/Next_Generation_Node_B/run_background.sh +++ b/Next_Generation_Node_B/run_background.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/Next_Generation_Node_B/stop.sh b/Next_Generation_Node_B/stop.sh index c386438..e8f2dfd 100755 --- a/Next_Generation_Node_B/stop.sh +++ b/Next_Generation_Node_B/stop.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/Additional_Scripts/update_commit_hashes.sh b/OpenAirInterface_Testbed/Additional_Scripts/update_commit_hashes.sh index 901cf92..f8e73f1 100755 --- a/OpenAirInterface_Testbed/Additional_Scripts/update_commit_hashes.sh +++ b/OpenAirInterface_Testbed/Additional_Scripts/update_commit_hashes.sh @@ -45,7 +45,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -56,7 +56,7 @@ if ! command -v jq &>/dev/null; then sudo apt-get update echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi JSON_FILE="commit_hashes.json" diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/apply_changes_to_patch_files.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/apply_changes_to_patch_files.sh index 7d69d3a..77ff937 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/apply_changes_to_patch_files.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/apply_changes_to_patch_files.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -52,7 +52,6 @@ git diff openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c >../install_patch_files git diff openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm_subs.c >../install_patch_files/openairinterface/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm_subs.c.patch git diff openair2/LAYER2/NR_MAC_gNB/main.c >../install_patch_files/openairinterface/openair2/LAYER2/NR_MAC_gNB/main.c.patch git diff openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h >../install_patch_files/openairinterface/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h.patch -git diff openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c >../install_patch_files/openairinterface/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c.patch git diff openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c >../install_patch_files/openairinterface/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c.patch cd .. diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/start_lazydocker.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/start_lazydocker.sh index eb59827..c3cbaf6 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/start_lazydocker.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/start_lazydocker.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/uninstall_o1_adapter.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/uninstall_o1_adapter.sh index 318082f..748f125 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/uninstall_o1_adapter.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/additional_scripts/uninstall_o1_adapter.sh @@ -34,7 +34,7 @@ set +e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/full_install.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/full_install.sh index dcc976a..bab274e 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/full_install.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/full_install.sh @@ -36,7 +36,7 @@ DEBUG_SYMBOLS=false APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -87,13 +87,16 @@ EOF echo "Configured needrestart to list-only (no service restarts)." fi +echo "Ensuring that SCTP is enabled..." +sudo ./install_scripts/enable_sctp.sh + # Check if GCC 13 is installed, if not, install it and set it as the default GCC_VERSION=$(gcc -v 2>&1 | grep "gcc version" | awk '{print $3}') if [[ -z "$GCC_VERSION" || ! "$GCC_VERSION" == 13.* ]]; then echo "Installing GCC 13..." sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update - sudo $APTVARS apt-get install -y gcc-13 g++-13 + sudo env $APTVARS apt-get install -y gcc-13 g++-13 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 fi @@ -101,7 +104,7 @@ fi if ! command -v cmake &>/dev/null; then echo "Installing CMake..." sudo apt-get update - sudo $APTVARS apt-get install -y cmake + sudo env $APTVARS apt-get install -y cmake fi CMAKE_VERSION=$(cmake --version | head -n1 | awk '{print $3}') if [[ "$CMAKE_VERSION" == 3.16.* ]]; then @@ -110,7 +113,7 @@ if [[ "$CMAKE_VERSION" == 3.16.* ]]; then wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | sudo apt-key add - sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' sudo apt-get update - sudo $APTVARS apt-get install -y cmake + sudo env $APTVARS apt-get install -y cmake fi ADDITIONAL_FLAGS="" diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/full_uninstall.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/full_uninstall.sh index f0e9e52..356fcc5 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/full_uninstall.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/full_uninstall.sh @@ -34,7 +34,7 @@ set +e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/generate_configurations.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/generate_configurations.sh index 5ae1deb..d4eb121 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/generate_configurations.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/generate_configurations.sh @@ -36,7 +36,7 @@ USE_RFSIM_CHANNELMOD=true APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -117,16 +117,8 @@ if [[ -z "$SST" || -z "$SD" || "$SST" == "null" || "$SD" == "null" ]]; then exit 1 fi -# Check if the YAML editor is installed, and install it if not -if ! command -v yq &>/dev/null; then - sudo "$SCRIPT_DIR/install_scripts/./install_yq.sh" -fi -# Check that the correct version of yq is installed -if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then - echo "ERROR: Detected an incompatible yq installation." - echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." - exit 1 -fi +# Ensure the correct YAML editor is installed +sudo "$SCRIPT_DIR/install_scripts/./ensure_consistent_yq.sh" echo "Saving configuration file example..." rm -rf configs @@ -148,7 +140,8 @@ prompt_for_addresses() { echo "Please enter the AMF address and the AMF binding address manually." >&2 echo "You can find this information in the 5G_Core_Network/configs/get_amf_addresses.txt file in the first two lines, respectively." >&2 read -p "Enter AMF Address: " AMF_ADDR - read -p "Enter AMF Binding Address: " AMF_ADDR_BIND + read -p "Enter AMF Binding Address: " N3_ADDR_BIND + N2_ADDR_BIND=$N3_ADDR_BIND } # Check if AMF_ADDRESSES has at least two non-empty lines @@ -159,9 +152,14 @@ if [[ -n "$AMF_ADDRESSES" ]]; then [[ -z "$line" ]] && continue # skip blank lines ADDRESSES+=("$line") done <<<"$AMF_ADDRESSES" - if [[ ${#ADDRESSES[@]} -ge 2 ]] && [[ -n ${ADDRESSES[0]} ]] && [[ -n ${ADDRESSES[1]} ]]; then + if [[ ${#ADDRESSES[@]} -ge 3 ]] && [[ -n ${ADDRESSES[0]} ]] && [[ -n ${ADDRESSES[1]} ]] && [[ -n ${ADDRESSES[2]} ]]; then + AMF_ADDR="${ADDRESSES[0]}" + N3_ADDR_BIND="${ADDRESSES[1]}" + N2_ADDR_BIND="${ADDRESSES[2]}" + elif [[ ${#ADDRESSES[@]} -ge 2 ]] && [[ -n ${ADDRESSES[0]} ]] && [[ -n ${ADDRESSES[1]} ]]; then AMF_ADDR="${ADDRESSES[0]}" - AMF_ADDR_BIND="${ADDRESSES[1]}" + N3_ADDR_BIND="${ADDRESSES[1]}" + N2_ADDR_BIND="${ADDRESSES[1]}" else echo echo "AMF address script did not return valid data." @@ -174,12 +172,13 @@ else fi echo "AMF Address: $AMF_ADDR" -echo "AMF Binding Address: $AMF_ADDR_BIND" +echo "AMF Binding Address: $N3_ADDR_BIND" +echo "NGAP Binding Address: $N2_ADDR_BIND/24" # Update configuration values for RF front-end device update_conf "configs/gnb.conf" "amf_ip_address" "({ ipv4 = \"$AMF_ADDR\"; })" -update_conf "configs/gnb.conf" "GNB_IPV4_ADDRESS_FOR_NG_AMF" "\"$AMF_ADDR_BIND/24\"" -update_conf "configs/gnb.conf" "GNB_IPV4_ADDRESS_FOR_NGU" "\"$AMF_ADDR_BIND/24\"" +update_conf "configs/gnb.conf" "GNB_IPV4_ADDRESS_FOR_NG_AMF" "\"$N2_ADDR_BIND/24\"" +update_conf "configs/gnb.conf" "GNB_IPV4_ADDRESS_FOR_NGU" "\"$N3_ADDR_BIND/24\"" update_conf "configs/gnb.conf" "tracking_area_code" "$TAC" # Configure the Single Network Slice Selection Assistance Information (S-NSSAI) diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/enable_sctp.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/enable_sctp.sh new file mode 100755 index 0000000..560f23a --- /dev/null +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/enable_sctp.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +# NIST-developed software is provided by NIST as a public service. You may use, +# copy, and distribute copies of the software in any medium, provided that you +# keep intact this entire notice. You may improve, modify, and create derivative +# works of the software or any portion of the software, and you may copy and +# distribute such modifications or works. Modified works should carry a notice +# stating that you changed the software and should note the date and nature of +# any such change. Please explicitly acknowledge the National Institute of +# Standards and Technology as the source of the software. +# +# NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY +# OF ANY KIND, EXPRESS, IMPLIED, IN FACT, OR ARISING BY OPERATION OF LAW, +# INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND DATA ACCURACY. NIST +# NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE +# UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES +# NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR +# THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, +# RELIABILITY, OR USEFULNESS OF THE SOFTWARE. +# +# You are solely responsible for determining the appropriateness of using and +# distributing the software and you assume all risks associated with its use, +# including but not limited to the risks and costs of program errors, compliance +# with applicable laws, damage to or loss of data, programs or equipment, and +# the unavailability or interruption of operation. This software is not intended +# to be used in any situation where a failure could cause risk of injury or +# damage to property. The software developed by NIST employees is not subject to +# copyright protection within the United States. + +echo "# Script: $(realpath "$0")..." + +# Exit immediately if a command fails +set -e + +APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" +if ! dpkg -s lksctp-tools >/dev/null 2>&1; then + sudo apt-get update + sudo env $APTVARS apt-get install -y lksctp-tools +fi +if ! dpkg -s libsctp1 >/dev/null 2>&1; then + sudo apt-get update + sudo env $APTVARS apt-get install -y libsctp1 +fi +if ! dpkg -s libsctp-dev >/dev/null 2>&1; then + sudo apt-get update + sudo env $APTVARS apt-get install -y libsctp-dev +fi + +# Load necessary kernel modules +sudo modprobe overlay || true +sudo modprobe br_netfilter || true + +# Load SCTP module +sudo modprobe sctp + +# Get the kernel major version +KERNEL_VERSION="$(uname -r | cut -d'-' -f1)" +MAJOR_VERSION="$(echo "$KERNEL_VERSION" | cut -d'.' -f1)" + +# Conditional loading of connection tracking modules based on kernel version +if [ "$MAJOR_VERSION" -lt 5 ]; then + # For older kernels (before version 5), load IPv4 and IPv6 specific modules + sudo modprobe nf_conntrack_ipv4 || true + sudo modprobe nf_conntrack_ipv6 || true + sudo modprobe nf_conntrack_proto_sctp || true +else + # For newer kernels (version 5 and later), use the unified nf_conntrack module + sudo modprobe nf_conntrack || true + sudo modprobe nf_conntrack_sctp || true +fi + +echo "SCTP kernel module present:" +lsmod | grep -E '(^| )sctp( |$)' || echo "WARNING: sctp not loaded" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_yq.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/ensure_consistent_yq.sh similarity index 78% rename from RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_yq.sh rename to OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/ensure_consistent_yq.sh index 2664512..d3794d3 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_yq.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/ensure_consistent_yq.sh @@ -28,12 +28,26 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +# Exit immediately if a command fails +set -e + +YQ_VERSION="v4.47.2" -# Uninstall yq with: sudo rm -rf /usr/local/bin/yq; hash -r if command -v yq &>/dev/null; then - echo "Already installed yq, skipping." - exit 0 + # Check that the correct version of yq is installed + if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then + echo "ERROR: Detected an incompatible yq installation." + echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." + exit 1 + fi + + if yq --version 2>/dev/null | grep -q "$YQ_VERSION"; then + exit 0 + fi + + echo "Removing incompatible yq..." + sudo rm -rf /usr/local/bin/yq + hash -r fi echo "Installing yq..." @@ -77,12 +91,18 @@ case $(uname -m) in ;; esac -YQ_URL="https://github.com/mikefarah/yq/releases/latest/download/yq_${ARCH_SUFFIX}.tar.gz" +YQ_URL="https://github.com/mikefarah/yq/releases/download/$YQ_VERSION/yq_${ARCH_SUFFIX}.tar.gz" # Create a temporary directory for the download TEMP_DIR=$(mktemp -d) TEMP_PATH="$TEMP_DIR/yq.tar.gz" +if ! command -v curl &>/dev/null; then + echo "Package \"curl\" not found, installing..." + APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" + sudo env $APTVARS apt-get install -y curl +fi + echo "Downloading yq from $YQ_URL..." HTTP_STATUS=$(curl -L -w "%{http_code}" -o "$TEMP_PATH" "$YQ_URL") if [ "$HTTP_STATUS" -eq 200 ]; then diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/git_clone.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/git_clone.sh index 211e6bd..446e60f 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/git_clone.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/git_clone.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -53,7 +53,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -63,7 +63,7 @@ HOME_DIR=$(dirname "$(dirname "$SCRIPT_DIR")") if ! command -v jq &>/dev/null; then echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi # First check the directory containing install_scripts/, otherwise, use the home directory @@ -87,7 +87,7 @@ if [[ -d "$NAME" && ! -d "$NAME/.git" ]]; then fi # Verify that the repository is on the correct commit hash -if jq -e ".\"$URL\"[1]" $JSON_FILE &>/dev/null; then +if jq -e --arg url "$URL" '.[$url][1]' "$JSON_FILE" &>/dev/null; then BRANCH=$(jq -r ".\"$URL\"[0]" $JSON_FILE) TARGET_COMMIT_HASH=$(jq -r ".\"$URL\"[1]" $JSON_FILE) diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/install_docker.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/install_docker.sh index d9e1b6c..08d1858 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/install_docker.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/install_docker.sh @@ -85,7 +85,7 @@ else # Use docker.ce # Code from (https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository): sudo apt-get update - sudo $APTVARS apt-get install -y ca-certificates curl + sudo env $APTVARS apt-get install -y ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc @@ -140,9 +140,9 @@ fi echo "Installing Docker..." if ! command -v docker &>/dev/null; then if [ "$USE_DOCKER_CE" -eq 0 ]; then - sudo $APTVARS apt-get install -y $APTOPTS "docker.io=$DOCKERVERSION" + sudo env $APTVARS apt-get install -y $APTOPTS "docker.io=$DOCKERVERSION" else - sudo $APTVARS apt-get install -y $APTOPTS "docker-ce=$DOCKERVERSION" + sudo env $APTVARS apt-get install -y $APTOPTS "docker-ce=$DOCKERVERSION" fi fi diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/start_sudo_refresh.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/start_sudo_refresh.sh index f06150c..6ede8a1 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/start_sudo_refresh.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/start_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." sudo ls &>/dev/null SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/stop_sudo_refresh.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/stop_sudo_refresh.sh index 94af8a2..0ca89f1 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/stop_sudo_refresh.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/stop_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Attempt to kill the process pkill -f "sudo_stay_validated.sh" || echo "No process found to stop." diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/sudo_stay_validated.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/sudo_stay_validated.sh index f237b1b..826b5ee 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/sudo_stay_validated.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/install_scripts/sudo_stay_validated.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Simple script to keep sudo active by refreshing it every minute while true; do diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/is_running.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/is_running.sh index 8f54920..82bdb53 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/is_running.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/is_running.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/run.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/run.sh index 7d292df..2243584 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/run.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/run.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/run_background.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/run_background.sh index 3881f52..b03cac9 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/run_background.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/run_background.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/run_gdb.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/run_gdb.sh index 5de856e..29db4c8 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/run_gdb.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/run_gdb.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -39,7 +39,7 @@ SCRIPT_DIR=$(dirname "$(realpath "$0")") if ! command -v gdb &>/dev/null; then echo "Installing GNU Debugger..." sudo apt-get update - sudo $APTVARS apt-get install -y gdb + sudo env $APTVARS apt-get install -y gdb fi cd "$SCRIPT_DIR" diff --git a/OpenAirInterface_Testbed/Next_Generation_Node_B/stop.sh b/OpenAirInterface_Testbed/Next_Generation_Node_B/stop.sh index 8165101..9c7a854 100755 --- a/OpenAirInterface_Testbed/Next_Generation_Node_B/stop.sh +++ b/OpenAirInterface_Testbed/Next_Generation_Node_B/stop.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/README.md b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/README.md index ec46506..0f2cd1f 100644 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/README.md +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/README.md @@ -19,7 +19,7 @@ This installation of the Near-RT RIC supports six xApps. - **KPM Monitor xApp (xapp_kpm_moni, revised xApp)**: - Run with `./run_xapp_kpm_moni.sh`. - - Sets `XAPP_DURATION=-1` to run indefinitely and include several new metrics (see below). + - Sets `XAPP_DURATION=-1` to run indefinitely and include new metrics (see below). - Pre-existing metrics from OpenAirInterface: ```console DRB.PdcpSduVolumeDL (kb) - Downlink volume of the UE since the last sample @@ -36,6 +36,7 @@ This installation of the Near-RT RIC supports six xApps. RSRP.Mean (dBm) - Averaged SSB/CSI-RS Reference Signal Received Power in the sample RSRP.Count (count) - Number of RSRP measurements in the sample, used to calculate RSRP ``` + - Note that this xApp uses REPORT Style 4 (O-RAN E2SM-KPM clause 7.4.5) with the condition being that the UE must have Slice/Service Type (SST): 001 and Slice Differentiator (SD): 0xFFFFFF. - **KPM Monitor to CSV xApp (xapp_kpm_moni_write_to_csv, new xApp)**: - Retains all functionality from xapp_kpm_moni, but rather than outputting to stdout, writes to `logs/KPI_Metrics.csv`. - **KPM Monitor to InfluxDB v2 xApp (xapp_kpm_moni_write_to_influxdb, new xApp)**: diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/_start_grafana_with_influxdb_only.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/_start_grafana_with_influxdb_only.sh index 4edf95b..240d2a2 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/_start_grafana_with_influxdb_only.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/_start_grafana_with_influxdb_only.sh @@ -34,10 +34,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -46,14 +46,14 @@ cd "$PARENT_DIR" if ! command -v grafana-server &>/dev/null; then echo "Grafana not found, installing..." # Code from (https://grafana.com/docs/grafana/latest/setup-grafana/installation/debian): - sudo $APTVARS apt-get install -y apt-transport-https software-properties-common wget + sudo env $APTVARS apt-get install -y apt-transport-https software-properties-common wget sudo mkdir -p /etc/apt/keyrings/ wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg >/dev/null echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list # Updates the list of available packages sudo apt-get update # Installs the latest OSS release: - sudo $APTVARS apt-get install -y grafana + sudo env $APTVARS apt-get install -y grafana fi # # Installing and configuring Grafana to use the CSV data source plugin diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/_start_grafana_with_influxdb_xapp_kpm_moni.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/_start_grafana_with_influxdb_xapp_kpm_moni.sh index 79e15da..9ab6920 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/_start_grafana_with_influxdb_xapp_kpm_moni.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/_start_grafana_with_influxdb_xapp_kpm_moni.sh @@ -34,10 +34,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -46,14 +46,14 @@ cd "$PARENT_DIR" if ! command -v grafana-server &>/dev/null; then echo "Grafana not found, installing..." # Code from (https://grafana.com/docs/grafana/latest/setup-grafana/installation/debian): - sudo $APTVARS apt-get install -y apt-transport-https software-properties-common wget + sudo env $APTVARS apt-get install -y apt-transport-https software-properties-common wget sudo mkdir -p /etc/apt/keyrings/ wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg >/dev/null echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list # Updates the list of available packages sudo apt-get update # Installs the latest OSS release: - sudo $APTVARS apt-get install -y grafana + sudo env $APTVARS apt-get install -y grafana fi # # Installing and configuring Grafana to use the CSV data source plugin @@ -64,7 +64,7 @@ fi if ! command -v python3 &>/dev/null; then echo "Python3 not found, installing..." - sudo $APTVARS apt-get install -y python3 + sudo env $APTVARS apt-get install -y python3 fi cd additional_scripts diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/apply_changes_to_patch_files.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/apply_changes_to_patch_files.sh index e20de07..3329f35 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/apply_changes_to_patch_files.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/apply_changes_to_patch_files.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_gtp_mac_rlc_pdcp_moni.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_gtp_mac_rlc_pdcp_moni.sh index c3094c4..0a7f321 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_gtp_mac_rlc_pdcp_moni.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_gtp_mac_rlc_pdcp_moni.sh @@ -34,10 +34,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni.sh index ff79af6..a619316 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -47,4 +47,6 @@ if [ -f "../configs/flexric.conf" ]; then CONFIG_PATH="-c ../configs/flexric.conf" fi +echo "Starting xApp KPM monitor..." +set -x XAPP_DURATION=-1 ./build/examples/xApp/c/monitor/xapp_kpm_moni $CONFIG_PATH diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni_write_to_csv.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni_write_to_csv.sh index c40afcb..fbb400d 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni_write_to_csv.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni_write_to_csv.sh @@ -37,10 +37,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -64,5 +64,6 @@ echo echo "Output CSV path: $OUTPUT_CSV_PATH" echo +echo "Starting xApp KPM monitor to CSV..." set -x XAPP_DURATION=-1 ./build/examples/xApp/c/monitor/xapp_kpm_moni_write_to_csv "$OUTPUT_CSV_PATH" "$XAPP_PERIODICITY_MS" $CONFIG_PATH diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni_write_to_influxdb.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni_write_to_influxdb.sh index f1beedc..97aff31 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni_write_to_influxdb.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_moni_write_to_influxdb.sh @@ -34,10 +34,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -93,5 +93,6 @@ if [ -f "../configs/flexric.conf" ]; then CONFIG_PATH="-c ../configs/flexric.conf" fi -echo "Starting xApp KPM monitor..." +echo "Starting xApp KPM monitor to InfluxDB..." +set -x XAPP_DURATION=-1 ./build/examples/xApp/c/monitor/xapp_kpm_moni_write_to_influxdb "$INFLUXDB_TOKEN" $CONFIG_PATH diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_rc.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_rc.sh index 6493d7c..2babaaa 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_rc.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_kpm_rc.sh @@ -34,10 +34,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_rc_moni.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_rc_moni.sh index be464bd..f40102d 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_rc_moni.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/run_xapp_rc_moni.sh @@ -34,10 +34,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/start_grafana_with_csv_only.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/start_grafana_with_csv_only.sh index bd04287..d0a712b 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/start_grafana_with_csv_only.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/start_grafana_with_csv_only.sh @@ -34,10 +34,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -48,14 +48,14 @@ GRAFANA_LOG_FILE="$PARENT_DIR/logs/KPI_Metrics.csv" if ! command -v grafana-server &>/dev/null; then echo "Grafana not found, installing..." # Code from (https://grafana.com/docs/grafana/latest/setup-grafana/installation/debian): - sudo $APTVARS apt-get install -y apt-transport-https software-properties-common wget + sudo env $APTVARS apt-get install -y apt-transport-https software-properties-common wget sudo mkdir -p /etc/apt/keyrings/ wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg >/dev/null echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list # Updates the list of available packages sudo apt-get update # Installs the latest OSS release: - sudo $APTVARS apt-get install -y grafana + sudo env $APTVARS apt-get install -y grafana fi # Installing and configuring Grafana to use the CSV data source plugin @@ -73,7 +73,7 @@ fi if ! command -v python3 &>/dev/null; then echo "Python3 not found, installing..." - sudo $APTVARS apt-get install -y python3 + sudo env $APTVARS apt-get install -y python3 fi cd additional_scripts diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/start_grafana_with_csv_xapp_kpm_moni.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/start_grafana_with_csv_xapp_kpm_moni.sh index c3bf615..c06a6d8 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/start_grafana_with_csv_xapp_kpm_moni.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/start_grafana_with_csv_xapp_kpm_moni.sh @@ -34,10 +34,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -46,14 +46,14 @@ cd "$PARENT_DIR" if ! command -v grafana-server &>/dev/null; then echo "Grafana not found, installing..." # Code from (https://grafana.com/docs/grafana/latest/setup-grafana/installation/debian): - sudo $APTVARS apt-get install -y apt-transport-https software-properties-common wget + sudo env $APTVARS apt-get install -y apt-transport-https software-properties-common wget sudo mkdir -p /etc/apt/keyrings/ wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg >/dev/null echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list # Updates the list of available packages sudo apt-get update # Installs the latest OSS release: - sudo $APTVARS apt-get install -y grafana + sudo env $APTVARS apt-get install -y grafana fi # Installing and configuring Grafana to use the CSV data source plugin @@ -64,7 +64,7 @@ fi if ! command -v python3 &>/dev/null; then echo "Python3 not found, installing..." - sudo $APTVARS apt-get install -y python3 + sudo env $APTVARS apt-get install -y python3 fi cd additional_scripts diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/stop_grafana_and_python_server.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/stop_grafana_and_python_server.sh index e56d76f..7dbc429 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/stop_grafana_and_python_server.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/stop_grafana_and_python_server.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/stop_python_server.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/stop_python_server.sh index 6ecaa3e..8168532 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/stop_python_server.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/additional_scripts/stop_python_server.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/full_install.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/full_install.sh index d75fdcd..a1545e9 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/full_install.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/full_install.sh @@ -37,7 +37,7 @@ DEBUG_SYMBOLS=false APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -62,9 +62,9 @@ INSTALL_START_TIME=$(date +%s) echo "Installing dependencies..." if ! command -v gcc-10 &>/dev/null || ! command -v g++-10 &>/dev/null || ! command -v swig &>/dev/null; then sudo apt-get update || true - sudo $APTVARS apt-get install -y build-essential automake - sudo $APTVARS apt-get install -y gcc-10 g++-10 - sudo $APTVARS apt-get install -y libsctp-dev python3 cmake-curses-gui libpcre2-dev python3-dev + sudo env $APTVARS apt-get install -y build-essential automake + sudo env $APTVARS apt-get install -y gcc-10 g++-10 + sudo env $APTVARS apt-get install -y libsctp-dev python3 cmake-curses-gui libpcre2-dev python3-dev fi if [ ! -d "swig" ]; then diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/full_uninstall.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/full_uninstall.sh index f99e4b8..855db64 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/full_uninstall.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/full_uninstall.sh @@ -34,7 +34,7 @@ set +e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/generate_configurations.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/generate_configurations.sh index 2aa036a..6483869 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/generate_configurations.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/generate_configurations.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/apply_patches.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/apply_patches.sh index a697668..1f937b8 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/apply_patches.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/apply_patches.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/git_clone.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/git_clone.sh index ea416bb..d3354dc 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/git_clone.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/git_clone.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -53,7 +53,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -63,7 +63,7 @@ HOME_DIR=$(dirname "$(dirname "$(dirname "$SCRIPT_DIR")")") if ! command -v jq &>/dev/null; then echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi # First check the directory containing install_scripts/, otherwise, use the home directory @@ -87,7 +87,7 @@ if [[ -d "$NAME" && ! -d "$NAME/.git" ]]; then fi # Verify that the repository is on the correct commit hash -if jq -e ".\"$URL\"[1]" $JSON_FILE &>/dev/null; then +if jq -e --arg url "$URL" '.[$url][1]' "$JSON_FILE" &>/dev/null; then BRANCH=$(jq -r ".\"$URL\"[0]" $JSON_FILE) TARGET_COMMIT_HASH=$(jq -r ".\"$URL\"[1]" $JSON_FILE) diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/install_influxdb.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/install_influxdb.sh index c3980c4..f08e61b 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/install_influxdb.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/install_influxdb.sh @@ -42,10 +42,10 @@ INFLUXDB_ROOT_TOKEN="A684h862N3b01j3KJC04Ssf2K1H95L2" # Randomly generated APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -64,7 +64,7 @@ echo "943666881a1b8d9b849b74caebf02d3465d6beb716510d86a39f6c8e8dac7515 influxda sudo tee /etc/apt/sources.list.d/influxdata.list # Install influxdb sudo apt-get update -sudo $APTVARS apt-get install -y influxdb2 +sudo env $APTVARS apt-get install -y influxdb2 # Make sure InfluxDB does not start on boot (manual start only) sudo systemctl disable influxdb diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/start_influxdb_service.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/start_influxdb_service.sh index 2fc654d..2493734 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/start_influxdb_service.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/start_influxdb_service.sh @@ -34,10 +34,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." if systemctl is-active --quiet influxdb; then echo "InfluxDB is already running." diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/start_sudo_refresh.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/start_sudo_refresh.sh index f06150c..6ede8a1 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/start_sudo_refresh.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/start_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." sudo ls &>/dev/null SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/stop_influxdb_service.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/stop_influxdb_service.sh index 0f8912a..1bf2586 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/stop_influxdb_service.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/stop_influxdb_service.sh @@ -36,10 +36,10 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Stop the InfluxDB service if it is running sudo systemctl stop influxdb diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/stop_sudo_refresh.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/stop_sudo_refresh.sh index 94af8a2..0ca89f1 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/stop_sudo_refresh.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/stop_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Attempt to kill the process pkill -f "sudo_stay_validated.sh" || echo "No process found to stop." diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/sudo_stay_validated.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/sudo_stay_validated.sh index f237b1b..826b5ee 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/sudo_stay_validated.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/sudo_stay_validated.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Simple script to keep sudo active by refreshing it every minute while true; do diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/uninstall_influxdb.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/uninstall_influxdb.sh index 144fdea..8b52f73 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/uninstall_influxdb.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/install_scripts/uninstall_influxdb.sh @@ -34,10 +34,10 @@ set +e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/is_running.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/is_running.sh index ff2a339..5ebbdc5 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/is_running.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/is_running.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run.sh index e6633b8..ac33080 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_background.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_background.sh index b37c8c4..f27ea27 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_background.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_background.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_gdb.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_gdb.sh index b8499de..8870e65 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_gdb.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_gdb.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_gdb_xapp_kpm_moni.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_gdb_xapp_kpm_moni.sh index f49c9eb..3ecdfb4 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_gdb_xapp_kpm_moni.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_gdb_xapp_kpm_moni.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_xapp_kpm_moni.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_xapp_kpm_moni.sh index 032cb02..59d0445 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_xapp_kpm_moni.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/run_xapp_kpm_moni.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -46,4 +46,6 @@ if [ -f "../configs/flexric.conf" ]; then CONFIG_PATH="-c ../configs/flexric.conf" fi +echo "Starting xApp KPM monitor..." +set -x XAPP_DURATION=-1 ./build/examples/xApp/c/monitor/xapp_kpm_moni $CONFIG_PATH diff --git a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/stop.sh b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/stop.sh index d4d294f..9f0ac3b 100755 --- a/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/stop.sh +++ b/OpenAirInterface_Testbed/RAN_Intelligent_Controllers/Flexible-RIC/stop.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/User_Equipment/additional_scripts/apply_changes_to_patch_files.sh b/OpenAirInterface_Testbed/User_Equipment/additional_scripts/apply_changes_to_patch_files.sh index bc8c7b2..a166e88 100755 --- a/OpenAirInterface_Testbed/User_Equipment/additional_scripts/apply_changes_to_patch_files.sh +++ b/OpenAirInterface_Testbed/User_Equipment/additional_scripts/apply_changes_to_patch_files.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARSapt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/User_Equipment/additional_scripts/open_ue_shell.sh b/OpenAirInterface_Testbed/User_Equipment/additional_scripts/open_ue_shell.sh index cbab273..409196a 100755 --- a/OpenAirInterface_Testbed/User_Equipment/additional_scripts/open_ue_shell.sh +++ b/OpenAirInterface_Testbed/User_Equipment/additional_scripts/open_ue_shell.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/User_Equipment/additional_scripts/simulate_core_traffic_to_ue.sh b/OpenAirInterface_Testbed/User_Equipment/additional_scripts/simulate_core_traffic_to_ue.sh index fa61f07..98e1d89 100755 --- a/OpenAirInterface_Testbed/User_Equipment/additional_scripts/simulate_core_traffic_to_ue.sh +++ b/OpenAirInterface_Testbed/User_Equipment/additional_scripts/simulate_core_traffic_to_ue.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -90,9 +90,10 @@ fi echo "Successfully found PDU Session IP: $PDU_SESSION_IP" + if ! command -v iperf &>/dev/null; then echo "Package \"iperf\" not found, installing..." - sudo $APTVARS apt-get install -y iperf + sudo env $APTVARS apt-get install -y iperf fi iperf -c $PDU_SESSION_IP -u -i 1 -b $BANDWIDTH -t $DURATION diff --git a/OpenAirInterface_Testbed/User_Equipment/additional_scripts/simulate_ue_traffic_to_core.sh b/OpenAirInterface_Testbed/User_Equipment/additional_scripts/simulate_ue_traffic_to_core.sh index 7b5e8d8..438327e 100755 --- a/OpenAirInterface_Testbed/User_Equipment/additional_scripts/simulate_ue_traffic_to_core.sh +++ b/OpenAirInterface_Testbed/User_Equipment/additional_scripts/simulate_ue_traffic_to_core.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -80,6 +80,13 @@ if [ ! -f "configs/ue1.conf" ]; then exit 1 fi +# Remove the CIDR suffix from an IP address +# For example, 10.45.0.1/16 --> 10.45.0.1 +remove_cidr_suffix() { + local IP=$1 + echo ${IP%/*} +} + UE_NAMESPACE="ue$UE_NUMBER" # If the namespace doesn't exist @@ -114,7 +121,7 @@ fi if ! command -v iperf &>/dev/null; then echo "Package \"iperf\" not found, installing..." - sudo $APTVARS apt-get install -y iperf + sudo env $APTVARS apt-get install -y iperf fi sudo ip netns exec ue$UE_NUMBER iperf -c $CORE_IP -u -i 1 -b $BANDWIDTH -t $DURATION diff --git a/OpenAirInterface_Testbed/User_Equipment/full_install.sh b/OpenAirInterface_Testbed/User_Equipment/full_install.sh index 1d61ea1..652a200 100755 --- a/OpenAirInterface_Testbed/User_Equipment/full_install.sh +++ b/OpenAirInterface_Testbed/User_Equipment/full_install.sh @@ -37,7 +37,7 @@ DEBUG_SYMBOLS=false APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -99,7 +99,7 @@ if [[ -z "$GCC_VERSION" || ! "$GCC_VERSION" == 13.* ]]; then echo "Installing GCC 13..." sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update - sudo $APTVARS apt-get install -y gcc-13 g++-13 + sudo env $APTVARS apt-get install -y gcc-13 g++-13 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 fi @@ -107,7 +107,7 @@ fi if ! command -v cmake &>/dev/null; then echo "Installing CMake..." sudo apt-get update - sudo $APTVARS apt-get install -y cmake + sudo env $APTVARS apt-get install -y cmake fi CMAKE_VERSION=$(cmake --version | head -n1 | awk '{print $3}') if [[ "$CMAKE_VERSION" == 3.16.* ]]; then @@ -116,7 +116,18 @@ if [[ "$CMAKE_VERSION" == 3.16.* ]]; then wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | sudo apt-key add - sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' sudo apt-get update - sudo $APTVARS apt-get install -y cmake + sudo env $APTVARS apt-get install -y cmake +fi + +if ! dpkg -s libsimde-dev &>/dev/null; then + echo "Attempting to install libsimde-dev..." + sudo apt-get update + sudo env $APTVARS apt-get install -y libsimde-dev || true +fi +if [ -d /usr/include/simde ]; then + sudo chown -R root:root /usr/include/simde + sudo find /usr/include/simde -type d -exec chmod 755 {} + + sudo find /usr/include/simde -type f -exec chmod 644 {} + fi ADDITIONAL_FLAGS="" diff --git a/OpenAirInterface_Testbed/User_Equipment/full_uninstall.sh b/OpenAirInterface_Testbed/User_Equipment/full_uninstall.sh index 3917d14..bb3bf1e 100755 --- a/OpenAirInterface_Testbed/User_Equipment/full_uninstall.sh +++ b/OpenAirInterface_Testbed/User_Equipment/full_uninstall.sh @@ -34,7 +34,7 @@ set +e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/User_Equipment/generate_configurations.sh b/OpenAirInterface_Testbed/User_Equipment/generate_configurations.sh index ecadd9d..600ffbc 100755 --- a/OpenAirInterface_Testbed/User_Equipment/generate_configurations.sh +++ b/OpenAirInterface_Testbed/User_Equipment/generate_configurations.sh @@ -36,7 +36,7 @@ USE_RFSIM_CHANNELMOD=true APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -66,6 +66,9 @@ for i in "${UE_NUMBERS[@]}"; do echo "UE $i will be configured." done +# Ensure the correct YAML editor is installed +sudo "$SCRIPT_DIR/install_scripts/./ensure_consistent_yq.sh" + # Function to update or add configuration properties in .conf files, considering sections and uncommenting if needed update_conf() { echo "update_conf($1, $2, $3)" @@ -137,17 +140,6 @@ if [[ -z "$SST" || -z "$SD" || "$SST" == "null" || "$SD" == "null" ]]; then exit 1 fi -# Check if the YAML editor is installed, and install it if not -if ! command -v yq &>/dev/null; then - sudo "$SCRIPT_DIR/install_scripts/./install_yq.sh" -fi -# Check that the correct version of yq is installed -if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then - echo "ERROR: Detected an incompatible yq installation." - echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." - exit 1 -fi - echo "Saving configuration file example..." if [ "$CLEAR_CONFIGS" = true ]; then sudo rm -rf configs diff --git a/OpenAirInterface_Testbed/User_Equipment/install_scripts/apply_patches.sh b/OpenAirInterface_Testbed/User_Equipment/install_scripts/apply_patches.sh index 5c71f3f..3526e22 100755 --- a/OpenAirInterface_Testbed/User_Equipment/install_scripts/apply_patches.sh +++ b/OpenAirInterface_Testbed/User_Equipment/install_scripts/apply_patches.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_yq.sh b/OpenAirInterface_Testbed/User_Equipment/install_scripts/ensure_consistent_yq.sh similarity index 78% rename from RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_yq.sh rename to OpenAirInterface_Testbed/User_Equipment/install_scripts/ensure_consistent_yq.sh index 2664512..d3794d3 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_yq.sh +++ b/OpenAirInterface_Testbed/User_Equipment/install_scripts/ensure_consistent_yq.sh @@ -28,12 +28,26 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +# Exit immediately if a command fails +set -e + +YQ_VERSION="v4.47.2" -# Uninstall yq with: sudo rm -rf /usr/local/bin/yq; hash -r if command -v yq &>/dev/null; then - echo "Already installed yq, skipping." - exit 0 + # Check that the correct version of yq is installed + if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then + echo "ERROR: Detected an incompatible yq installation." + echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." + exit 1 + fi + + if yq --version 2>/dev/null | grep -q "$YQ_VERSION"; then + exit 0 + fi + + echo "Removing incompatible yq..." + sudo rm -rf /usr/local/bin/yq + hash -r fi echo "Installing yq..." @@ -77,12 +91,18 @@ case $(uname -m) in ;; esac -YQ_URL="https://github.com/mikefarah/yq/releases/latest/download/yq_${ARCH_SUFFIX}.tar.gz" +YQ_URL="https://github.com/mikefarah/yq/releases/download/$YQ_VERSION/yq_${ARCH_SUFFIX}.tar.gz" # Create a temporary directory for the download TEMP_DIR=$(mktemp -d) TEMP_PATH="$TEMP_DIR/yq.tar.gz" +if ! command -v curl &>/dev/null; then + echo "Package \"curl\" not found, installing..." + APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" + sudo env $APTVARS apt-get install -y curl +fi + echo "Downloading yq from $YQ_URL..." HTTP_STATUS=$(curl -L -w "%{http_code}" -o "$TEMP_PATH" "$YQ_URL") if [ "$HTTP_STATUS" -eq 200 ]; then diff --git a/OpenAirInterface_Testbed/User_Equipment/install_scripts/git_clone.sh b/OpenAirInterface_Testbed/User_Equipment/install_scripts/git_clone.sh index 211e6bd..446e60f 100755 --- a/OpenAirInterface_Testbed/User_Equipment/install_scripts/git_clone.sh +++ b/OpenAirInterface_Testbed/User_Equipment/install_scripts/git_clone.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -53,7 +53,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -63,7 +63,7 @@ HOME_DIR=$(dirname "$(dirname "$SCRIPT_DIR")") if ! command -v jq &>/dev/null; then echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi # First check the directory containing install_scripts/, otherwise, use the home directory @@ -87,7 +87,7 @@ if [[ -d "$NAME" && ! -d "$NAME/.git" ]]; then fi # Verify that the repository is on the correct commit hash -if jq -e ".\"$URL\"[1]" $JSON_FILE &>/dev/null; then +if jq -e --arg url "$URL" '.[$url][1]' "$JSON_FILE" &>/dev/null; then BRANCH=$(jq -r ".\"$URL\"[0]" $JSON_FILE) TARGET_COMMIT_HASH=$(jq -r ".\"$URL\"[1]" $JSON_FILE) diff --git a/OpenAirInterface_Testbed/User_Equipment/install_scripts/revert_ue_namespace.sh b/OpenAirInterface_Testbed/User_Equipment/install_scripts/revert_ue_namespace.sh index 74d8a27..d092741 100755 --- a/OpenAirInterface_Testbed/User_Equipment/install_scripts/revert_ue_namespace.sh +++ b/OpenAirInterface_Testbed/User_Equipment/install_scripts/revert_ue_namespace.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Do not exit immediately if a command fails set +e diff --git a/OpenAirInterface_Testbed/User_Equipment/install_scripts/setup_ue_namespace.sh b/OpenAirInterface_Testbed/User_Equipment/install_scripts/setup_ue_namespace.sh index 3a503b0..53fc2f8 100755 --- a/OpenAirInterface_Testbed/User_Equipment/install_scripts/setup_ue_namespace.sh +++ b/OpenAirInterface_Testbed/User_Equipment/install_scripts/setup_ue_namespace.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/OpenAirInterface_Testbed/User_Equipment/install_scripts/start_sudo_refresh.sh b/OpenAirInterface_Testbed/User_Equipment/install_scripts/start_sudo_refresh.sh index f06150c..6ede8a1 100755 --- a/OpenAirInterface_Testbed/User_Equipment/install_scripts/start_sudo_refresh.sh +++ b/OpenAirInterface_Testbed/User_Equipment/install_scripts/start_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." sudo ls &>/dev/null SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/User_Equipment/install_scripts/stop_sudo_refresh.sh b/OpenAirInterface_Testbed/User_Equipment/install_scripts/stop_sudo_refresh.sh index 94af8a2..0ca89f1 100755 --- a/OpenAirInterface_Testbed/User_Equipment/install_scripts/stop_sudo_refresh.sh +++ b/OpenAirInterface_Testbed/User_Equipment/install_scripts/stop_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Attempt to kill the process pkill -f "sudo_stay_validated.sh" || echo "No process found to stop." diff --git a/OpenAirInterface_Testbed/User_Equipment/install_scripts/sudo_stay_validated.sh b/OpenAirInterface_Testbed/User_Equipment/install_scripts/sudo_stay_validated.sh index f237b1b..826b5ee 100755 --- a/OpenAirInterface_Testbed/User_Equipment/install_scripts/sudo_stay_validated.sh +++ b/OpenAirInterface_Testbed/User_Equipment/install_scripts/sudo_stay_validated.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Simple script to keep sudo active by refreshing it every minute while true; do diff --git a/OpenAirInterface_Testbed/User_Equipment/is_running.sh b/OpenAirInterface_Testbed/User_Equipment/is_running.sh index 6f187a3..7f7b36e 100755 --- a/OpenAirInterface_Testbed/User_Equipment/is_running.sh +++ b/OpenAirInterface_Testbed/User_Equipment/is_running.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/User_Equipment/run.sh b/OpenAirInterface_Testbed/User_Equipment/run.sh index 3d5d3b6..2321243 100755 --- a/OpenAirInterface_Testbed/User_Equipment/run.sh +++ b/OpenAirInterface_Testbed/User_Equipment/run.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/User_Equipment/run_background.sh b/OpenAirInterface_Testbed/User_Equipment/run_background.sh index f3ff537..1e60f7e 100755 --- a/OpenAirInterface_Testbed/User_Equipment/run_background.sh +++ b/OpenAirInterface_Testbed/User_Equipment/run_background.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/User_Equipment/run_gdb.sh b/OpenAirInterface_Testbed/User_Equipment/run_gdb.sh index 8c791c6..4013c5e 100755 --- a/OpenAirInterface_Testbed/User_Equipment/run_gdb.sh +++ b/OpenAirInterface_Testbed/User_Equipment/run_gdb.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -106,7 +106,7 @@ else if ! command -v gdb &>/dev/null; then echo "Installing GNU Debugger..." sudo apt-get update - sudo $APTVARS apt-get install -y gdb + sudo env $APTVARS apt-get install -y gdb fi echo "Starting nr-uesoftmodem (ue$UE_NUMBER)..." diff --git a/OpenAirInterface_Testbed/User_Equipment/stop.sh b/OpenAirInterface_Testbed/User_Equipment/stop.sh index cb16d3e..1b4f99c 100755 --- a/OpenAirInterface_Testbed/User_Equipment/stop.sh +++ b/OpenAirInterface_Testbed/User_Equipment/stop.sh @@ -34,7 +34,7 @@ trap 'stty sane; exit' EXIT SIGINT SIGTERM APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/full_install.sh b/OpenAirInterface_Testbed/full_install.sh index 04ebb54..b4c1cd0 100755 --- a/OpenAirInterface_Testbed/full_install.sh +++ b/OpenAirInterface_Testbed/full_install.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/full_uninstall.sh b/OpenAirInterface_Testbed/full_uninstall.sh index 2f3d83a..94c0668 100755 --- a/OpenAirInterface_Testbed/full_uninstall.sh +++ b/OpenAirInterface_Testbed/full_uninstall.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/generate_configurations.sh b/OpenAirInterface_Testbed/generate_configurations.sh index e51a9e0..8ba9c93 100755 --- a/OpenAirInterface_Testbed/generate_configurations.sh +++ b/OpenAirInterface_Testbed/generate_configurations.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/is_running.sh b/OpenAirInterface_Testbed/is_running.sh index 853d95a..3a01e50 100755 --- a/OpenAirInterface_Testbed/is_running.sh +++ b/OpenAirInterface_Testbed/is_running.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/run.sh b/OpenAirInterface_Testbed/run.sh index d262726..6c4de60 100755 --- a/OpenAirInterface_Testbed/run.sh +++ b/OpenAirInterface_Testbed/run.sh @@ -28,10 +28,13 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. +# Exit immediately if a command fails +set -e + APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/run_with_grafana_dashboard.sh b/OpenAirInterface_Testbed/run_with_grafana_dashboard.sh index 9df3d39..94b7f72 100755 --- a/OpenAirInterface_Testbed/run_with_grafana_dashboard.sh +++ b/OpenAirInterface_Testbed/run_with_grafana_dashboard.sh @@ -28,10 +28,13 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. +# Exit immediately if a command fails +set -e + APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/OpenAirInterface_Testbed/stop.sh b/OpenAirInterface_Testbed/stop.sh index 84190ee..c178225 100755 --- a/OpenAirInterface_Testbed/stop.sh +++ b/OpenAirInterface_Testbed/stop.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_check_enforcement.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_check_enforcement.sh index 04a52ad..043507a 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_check_enforcement.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_check_enforcement.sh @@ -31,6 +31,6 @@ set -e set -x -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." kubectl exec -n kube-system -it $(kubectl get pods -n kube-system -l k8s-app=cilium -o jsonpath='{.items[0].metadata.name}') -- cilium endpoint list diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_disable_policies.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_disable_policies.sh index 28f9f50..59d47a6 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_disable_policies.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_disable_policies.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Read policy names and namespaces into arrays read -a POLICY_NAMES <<<$(kubectl get cnp --all-namespaces -o jsonpath='{.items[*].metadata.name}') diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_enable_policies.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_enable_policies.sh index 6d493c8..7662ab7 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_enable_policies.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_enable_policies.sh @@ -30,7 +30,7 @@ set -e -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." CILIUM_POLICY_FILE="$HOME/.kube/cilium-policy.yaml" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_list_policies.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_list_policies.sh index 75bdd5f..f8ceeac 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_list_policies.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_list_policies.sh @@ -30,6 +30,6 @@ set -e -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." kubectl get cnp --all-namespaces diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_status.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_status.sh index fb319f0..20ae5af 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_status.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/cilium_status.sh @@ -30,6 +30,6 @@ set -e -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." kubectl exec -n kube-system -it $(kubectl get pods -n kube-system -l k8s-app=cilium -o jsonpath='{.items[0].metadata.name}') -- cilium status diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/hubble_capture.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/hubble_capture.sh index 6984b62..b977129 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/hubble_capture.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/hubble_capture.sh @@ -30,7 +30,7 @@ set -e -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/hubble_visualize.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/hubble_visualize.sh index 8b42f99..955385f 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/hubble_visualize.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/hubble_visualize.sh @@ -30,7 +30,7 @@ set -e -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_all_additional_xapps.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_all_additional_xapps.sh index 539e0ac..80a4884 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_all_additional_xapps.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_all_additional_xapps.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_and_configure_wireshark.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_and_configure_wireshark.sh index 86a2ff2..38aa9a0 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_and_configure_wireshark.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_and_configure_wireshark.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Install Wireshark if not already installed if ! dpkg -s "wireshark" &>/dev/null; then @@ -36,7 +36,7 @@ if ! dpkg -s "wireshark" &>/dev/null; then sudo add-apt-repository ppa:wireshark-dev/stable -y sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y wireshark + sudo env $APTVARS apt-get install -y wireshark fi # Add user to the Wireshark group if not already a member diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_cilium_and_migrate_nodes.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_cilium_and_migrate_nodes.sh index 8815669..00f8b68 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_cilium_and_migrate_nodes.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_cilium_and_migrate_nodes.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." ENABLE_HUBBLE_LOGGING="true" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_5g_cell_anomaly_detection.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_5g_cell_anomaly_detection.sh index 0dfba83..2f2ca11 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_5g_cell_anomaly_detection.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_5g_cell_anomaly_detection.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Run this script to build and deploy the 5G Cell Anamoly Detection xApp (ad-cell) in the Near-Real-Time RIC. # More information can be found at: https://github.com/o-ran-sc/ric-app-ad-cell and https://docs.o-ran-sc.org/projects/o-ran-sc-ric-app-ad/en/latest/overview.html @@ -122,7 +122,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi FILE="init/config-file_updated.json" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_anomaly_detection.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_anomaly_detection.sh index f96550c..3e2e344 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_anomaly_detection.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_anomaly_detection.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Run this script to build and deploy the Anamoly Detection xApp (ad) in the Near-Real-Time RIC. # More information can be found at: https://github.com/o-ran-sc/ric-app-ad and https://docs.o-ran-sc.org/projects/o-ran-sc-ric-app-ad/en/latest/overview.html @@ -115,7 +115,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi FILE="xapp-descriptor/config_updated.json" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_hw-python.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_hw-python.sh index 4bfcb78..cc085c8 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_hw-python.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_hw-python.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Run this script to build and deploy the Hello World Python xApp (hw-python) in the Near-Real-Time RIC. # More information can be found at: https://github.com/o-ran-sc/ric-app-hw-python @@ -67,7 +67,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi FILE="init/config-file_updated.json" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_hw-rust.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_hw-rust.sh index 5726a26..79e3f31 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_hw-rust.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_hw-rust.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Run this script to build and deploy the Hello World Rust xApp (hw-rust) in the Near-Real-Time RIC. # More information can be found at: https://github.com/o-ran-sc/ric-app-hw-rust @@ -67,7 +67,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi FILE="config/config-file_updated.json" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_kpi_monitor.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_kpi_monitor.sh index a717606..521d975 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_kpi_monitor.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_kpi_monitor.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Run this script to build and deploy the Key Performance Indicator (KPI) Monitor xApp (kpimon-go) in the Near-Real-Time RIC. # More information can be found at: https://github.com/o-ran-sc/ric-app-kpimon-go and https://docs.o-ran-sc.org/projects/o-ran-sc-ric-app-kpimon/en/latest/overview.html @@ -155,7 +155,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi FILE="deploy/config_updated.json" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_qoe_predictor.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_qoe_predictor.sh index 5d5e5dd..490b33c 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_qoe_predictor.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_qoe_predictor.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Run this script to build and deploy the QoE Predictor xApp (qp) in the Near-Real-Time RIC. # More information can be found at: https://github.com/o-ran-sc/ric-app-qp and https://docs.o-ran-sc.org/projects/o-ran-sc-ric-app-qp/en/latest/overview.html @@ -118,7 +118,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi FILE="xapp-descriptor/config_updated.json" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_ric_control.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_ric_control.sh index 01cf25d..7bf5b44 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_ric_control.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_ric_control.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Run this script to build and deploy the RIC Control xApp (rc) in the Near-Real-Time RIC. # More information can be found at: https://github.com/o-ran-sc/ric-app-rc and https://docs.o-ran-sc.org/projects/o-ran-sc-ric-app-rc/en/latest/overview.html @@ -72,7 +72,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi FILE="xapp-descriptor/config_updated.json" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_traffic_steering.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_traffic_steering.sh index 8f1f14f..84f719c 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_traffic_steering.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/install_xapp_traffic_steering.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Run this script to build and deploy the Traffic Steering xApp (trafficxapp) in the Near-Real-Time RIC. # More information can be found at: https://github.com/o-ran-sc/ric-app-ts and https://docs.o-ran-sc.org/projects/o-ran-sc-ric-app-ts/en/latest/user-guide.html @@ -72,7 +72,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi FILE="xapp-descriptor/config-file_updated.json" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/purge_unready_pods.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/purge_unready_pods.sh index c8b1ca0..40dd243 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/purge_unready_pods.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/purge_unready_pods.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." if [ "$EUID" -ne 0 ]; then echo "Please run this script as root or use sudo." diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/refresh_pod_certificates.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/refresh_pod_certificates.sh index 8336377..b33a54b 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/refresh_pod_certificates.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/refresh_pod_certificates.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." sudo kubeadm init phase certs all --config=/root/config.yaml sudo systemctl restart kubelet diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/run_e2sim_foreground.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/run_e2sim_foreground.sh index 5bba557..58cc6ad 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/run_e2sim_foreground.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/run_e2sim_foreground.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/start_lazydocker.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/start_lazydocker.sh index eb59827..c3cbaf6 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/start_lazydocker.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/start_lazydocker.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/uninstall_an_xapp.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/uninstall_an_xapp.sh index 0c0d67d..427900c 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/uninstall_an_xapp.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/uninstall_an_xapp.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/wireshark_packet_capture_pod.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/wireshark_packet_capture_pod.sh index 8c1ad5f..ceceb0b 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/wireshark_packet_capture_pod.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/additional_scripts/wireshark_packet_capture_pod.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Install Wireshark if not already installed SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/full_install.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/full_install.sh index e588540..a8d3154 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/full_install.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/full_install.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -78,7 +78,7 @@ fi if ! dpkg -s chrony &>/dev/null; then echo "Chrony is not installed, installing..." sudo apt-get update - sudo $APTVARS apt-get install -y chrony || true + sudo env $APTVARS apt-get install -y chrony || true fi if ! systemctl is-enabled --quiet chrony; then echo "Enabling Chrony service..." @@ -144,16 +144,8 @@ else exit 1 fi - # Check if the YAML editor is installed, and install it if not - if ! command -v yq &>/dev/null; then - sudo "$SCRIPT_DIR/install_scripts/./install_yq.sh" - fi - # Check that the correct version of yq is installed - if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then - echo "ERROR: Detected an incompatible yq installation." - echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." - exit 1 - fi + # Ensure the correct YAML editor is installed + sudo "$SCRIPT_DIR/install_scripts/./ensure_consistent_yq.sh" # If kong gives troubles in Release I or Release J then it can be disabled with the following code. # cd "$SCRIPT_DIR/ric-dep" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/full_uninstall.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/full_uninstall.sh index 6f8ce56..13170f1 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/full_uninstall.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/full_uninstall.sh @@ -34,7 +34,7 @@ set +e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -86,7 +86,7 @@ fi if ! dpkg -s chrony &>/dev/null; then echo "Chrony is not installed, installing..." sudo apt-get update - sudo $APTVARS apt-get install -y chrony || true + sudo env $APTVARS apt-get install -y chrony || true fi if ! systemctl is-enabled --quiet chrony; then echo "Enabling Chrony service..." diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_patch_files/ric-dep/bin/install_k8s_and_helm.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_patch_files/ric-dep/bin/install_k8s_and_helm.sh index 701ee87..116479b 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_patch_files/ric-dep/bin/install_k8s_and_helm.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_patch_files/ric-dep/bin/install_k8s_and_helm.sh @@ -116,13 +116,14 @@ done echo "Installing prerequisites..." sudo apt-get update || true -sudo $APTVARS apt-get install -y curl wget gnupg2 software-properties-common lsb-release net-tools iproute2 iputils-ping -sudo $APTVARS apt-get install -y kmod -sudo $APTVARS apt-get install -y gawk sed -sudo $APTVARS apt-get install -y iptables -sudo $APTVARS apt-get install -y ipvsadm -sudo $APTVARS apt-get install -y socat -sudo $APTVARS apt-get install -y libsctp1 lksctp-tools +sudo env $APTVARS apt-get install -y curl wget gnupg2 software-properties-common lsb-release net-tools iproute2 iputils-ping +sudo env $APTVARS apt-get install -y kmod +sudo env $APTVARS apt-get install -y gawk sed +sudo env $APTVARS apt-get install -y iptables +sudo env $APTVARS apt-get install -y ipvsadm +sudo env $APTVARS apt-get install -y socat +sudo env $APTVARS apt-get install -y libsctp1 lksctp-tools +sudo env $APTVARS apt-get install -y jq netcat-openbsd make ipset moreutils # Previous versions from original script (HELMV 3.14.X causes continuous APIServer crashing on Ubuntu 22): # KUBEV="1.28" #.11" @@ -165,7 +166,7 @@ else # Use docker-ce # Code from (https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository): sudo apt-get update - sudo $APTVARS apt-get install -y ca-certificates curl + sudo env $APTVARS apt-get install -y curl gnupg ca-certificates sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc @@ -235,14 +236,16 @@ echo "### k8s cni version = "${KUBECNIV} echo echo "Updating Kubernetes keyring..." sudo mkdir -p /etc/apt/keyrings -sudo curl -fsSL https://pkgs.k8s.io/core:/stable:/v${KUBEV}/deb/Release.key | gpg --dearmor --yes | sudo tee /etc/apt/keyrings/kubernetes-apt-keyring.gpg >/dev/null -sudo echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${KUBEV}/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list +sudo curl -fsSL "https://pkgs.k8s.io/core:/stable:/v${KUBEV}/deb/Release.key" | gpg --dearmor --yes | sudo tee /etc/apt/keyrings/kubernetes-apt-keyring.gpg >/dev/null +echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${KUBEV}/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list >/dev/null echo echo "Updating Helm keyring..." -sudo mkdir -p /etc/apt/keyrings -sudo curl -fsSL https://baltocdn.com/helm/signing.asc | gpg --dearmor --yes | sudo tee /etc/apt/keyrings/helm-apt-keyring.gpg >/dev/null -sudo echo "deb [signed-by=/etc/apt/keyrings/helm-apt-keyring.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list +sudo rm -f /etc/apt/sources.list.d/helm-stable-debian.list +sudo rm -f /etc/apt/keyrings/helm-apt-keyring.gpg +sudo install -d -m 0755 /usr/share/keyrings +curl -fsSL https://packages.buildkite.com/helm-linux/helm-debian/gpgkey | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg >/dev/null +echo "deb [signed-by=/usr/share/keyrings/helm.gpg] https://packages.buildkite.com/helm-linux/helm-debian/any/ any main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list >/dev/null # If this errors you can remove Kubernetes with `sudo rm /etc/apt/sources.list.d/kubernetes.list` or remove Helm with `sudo rm /etc/apt/sources.list.d/helm-stable-debian.list` sudo apt-get update @@ -332,8 +335,8 @@ if [[ $(cat /opt/config/stack_name.txt) == *aux* ]]; then fi # Load necessary kernel modules -sudo modprobe overlay -sudo modprobe br_netfilter +sudo modprobe overlay || true +sudo modprobe br_netfilter || true # Load IP Virtual Server (IPVS) modules sudo modprobe ip_vs @@ -345,18 +348,19 @@ sudo modprobe ip_vs_sh sudo modprobe sctp # Get the kernel major version -KERNEL_VERSION=$(uname -r | cut -d'-' -f1) -MAJOR_VERSION=$(echo $KERNEL_VERSION | cut -d'.' -f1) +KERNEL_VERSION="$(uname -r | cut -d'-' -f1)" +MAJOR_VERSION="$(echo "$KERNEL_VERSION" | cut -d'.' -f1)" # Conditional loading of connection tracking modules based on kernel version if [ "$MAJOR_VERSION" -lt 5 ]; then # For older kernels (before version 5), load IPv4 and IPv6 specific modules - sudo modprobe nf_conntrack_ipv4 - sudo modprobe nf_conntrack_ipv6 - sudo modprobe nf_conntrack_proto_sctp + sudo modprobe nf_conntrack_ipv4 || true + sudo modprobe nf_conntrack_ipv6 || true + sudo modprobe nf_conntrack_proto_sctp || true else # For newer kernels (version 5 and later), use the unified nf_conntrack module - sudo modprobe nf_conntrack + sudo modprobe nf_conntrack || true + sudo modprobe nf_conntrack_sctp || true fi # Ensure modules are loaded on boot @@ -451,9 +455,6 @@ else echo "All swap has been successfully disabled." fi -sudo apt-get update -sudo $APTVARS apt-get install -y curl jq netcat-openbsd make ipset moreutils - # ----------------------------------------------------------------------------- # Docker uninstallation then clean installation # ----------------------------------------------------------------------------- @@ -483,9 +484,9 @@ sudo apt-get autoremove -y echo "Installing Docker..." if ! command -v docker &>/dev/null; then if [ "$USE_DOCKER_CE" -eq 0 ]; then - sudo $APTVARS apt-get install -y $APTOPTS "docker.io=$DOCKERVERSION" + sudo env $APTVARS apt-get install -y $APTOPTS "docker.io=$DOCKERVERSION" else - sudo $APTVARS apt-get install -y $APTOPTS "docker-ce=$DOCKERVERSION" + sudo env $APTVARS apt-get install -y $APTOPTS "docker-ce=$DOCKERVERSION" fi fi @@ -697,21 +698,21 @@ echo "Kubernetes version without suffix: $KUBEVERSIONWITHOUTSUFFIX" # Install Kubernetes components if [ -z "${CNIVERSION}" ]; then - sudo $APTVARS apt-get install -y kubernetes-cni + sudo env $APTVARS apt-get install -y kubernetes-cni else - sudo $APTVARS apt-get install -y $APTOPTS kubernetes-cni=${CNIVERSION} + sudo env $APTVARS apt-get install -y $APTOPTS kubernetes-cni=${CNIVERSION} fi if [ -z "${KUBEVERSION}" ]; then - sudo $APTVARS apt-get install -y kubeadm kubelet kubectl + sudo env $APTVARS apt-get install -y kubeadm kubelet kubectl else - sudo $APTVARS apt-get install -y $APTOPTS kubeadm=${KUBEVERSION} kubelet=${KUBEVERSION} kubectl=${KUBEVERSION} + sudo env $APTVARS apt-get install -y $APTOPTS kubeadm=${KUBEVERSION} kubelet=${KUBEVERSION} kubectl=${KUBEVERSION} fi # If kubectl command is not found after install, reinstall if ! command -v kubectl >/dev/null 2>&1; then echo "kubectl not found after install, retrying with --reinstall..." - sudo $APTVARS apt-get install -y --reinstall kubectl=${KUBEVERSION} + sudo env $APTVARS apt-get install -y --reinstall kubectl=${KUBEVERSION} if ! command -v kubectl >/dev/null 2>&1; then echo "ERROR: /usr/bin/kubectl still not found after reinstall. Aborting." exit 1 diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/check_xapp_deployment_status.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/check_xapp_deployment_status.sh index b749bfe..897b2cc 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/check_xapp_deployment_status.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/check_xapp_deployment_status.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." kubectl get services -n ricplt | grep service-ricplt-appmgr diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/delete_namespace.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/delete_namespace.sh index f7507ea..6f3e9c3 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/delete_namespace.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/delete_namespace.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." if [ $# -lt 1 ]; then echo "Usage: $0 [ ...]" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/disable_swap.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/disable_swap.sh index da4e18e..2d17e22 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/disable_swap.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/disable_swap.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." echo "Checking for traditional swap in /etc/fstab..." SWAPFILES=$(grep swap /etc/fstab | sed '/^[ \t]*#/ d' | sed 's/[\t ]/ /g' | tr -s " " | cut -f1 -d' ') diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/enable_docker_build_kit.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/enable_docker_build_kit.sh index bc5fcb2..c7e5810 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/enable_docker_build_kit.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/enable_docker_build_kit.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." CONFIG_FILE="/etc/docker/daemon.json" TEMP_FILE="/tmp/daemon.json.tmp" @@ -38,7 +38,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi echo "Enabling Docker build kit..." diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/ensure_consistent_yq.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/ensure_consistent_yq.sh new file mode 100755 index 0000000..d3794d3 --- /dev/null +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/ensure_consistent_yq.sh @@ -0,0 +1,123 @@ +#!/bin/bash +# +# NIST-developed software is provided by NIST as a public service. You may use, +# copy, and distribute copies of the software in any medium, provided that you +# keep intact this entire notice. You may improve, modify, and create derivative +# works of the software or any portion of the software, and you may copy and +# distribute such modifications or works. Modified works should carry a notice +# stating that you changed the software and should note the date and nature of +# any such change. Please explicitly acknowledge the National Institute of +# Standards and Technology as the source of the software. +# +# NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY +# OF ANY KIND, EXPRESS, IMPLIED, IN FACT, OR ARISING BY OPERATION OF LAW, +# INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND DATA ACCURACY. NIST +# NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE +# UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES +# NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR +# THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, +# RELIABILITY, OR USEFULNESS OF THE SOFTWARE. +# +# You are solely responsible for determining the appropriateness of using and +# distributing the software and you assume all risks associated with its use, +# including but not limited to the risks and costs of program errors, compliance +# with applicable laws, damage to or loss of data, programs or equipment, and +# the unavailability or interruption of operation. This software is not intended +# to be used in any situation where a failure could cause risk of injury or +# damage to property. The software developed by NIST employees is not subject to +# copyright protection within the United States. + +# Exit immediately if a command fails +set -e + +YQ_VERSION="v4.47.2" + +if command -v yq &>/dev/null; then + # Check that the correct version of yq is installed + if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then + echo "ERROR: Detected an incompatible yq installation." + echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." + exit 1 + fi + + if yq --version 2>/dev/null | grep -q "$YQ_VERSION"; then + exit 0 + fi + + echo "Removing incompatible yq..." + sudo rm -rf /usr/local/bin/yq + hash -r +fi + +echo "Installing yq..." + +# Determine the processor architecture +ARCH_SUFFIX="" +case $(uname -m) in +"x86_64") + ARCH_SUFFIX="linux_amd64" + ;; +"aarch64") + ARCH_SUFFIX="linux_arm64" + ;; +"armv7l" | "armv6l") + ARCH_SUFFIX="linux_arm" + ;; +"i386" | "i686") + ARCH_SUFFIX="linux_386" + ;; +"ppc64le") + ARCH_SUFFIX="linux_ppc64le" + ;; +"s390x") + ARCH_SUFFIX="linux_s390x" + ;; +"mips") + ARCH_SUFFIX="linux_mips" + ;; +"mips64") + ARCH_SUFFIX="linux_mips64" + ;; +"mips64el" | "mips64le") + ARCH_SUFFIX="linux_mips64le" + ;; +"mipsel" | "mipsle") + ARCH_SUFFIX="linux_mipsle" + ;; +*) + echo "Unsupported architecture for yq: $(uname -m)" + exit 1 + ;; +esac + +YQ_URL="https://github.com/mikefarah/yq/releases/download/$YQ_VERSION/yq_${ARCH_SUFFIX}.tar.gz" + +# Create a temporary directory for the download +TEMP_DIR=$(mktemp -d) +TEMP_PATH="$TEMP_DIR/yq.tar.gz" + +if ! command -v curl &>/dev/null; then + echo "Package \"curl\" not found, installing..." + APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" + sudo env $APTVARS apt-get install -y curl +fi + +echo "Downloading yq from $YQ_URL..." +HTTP_STATUS=$(curl -L -w "%{http_code}" -o "$TEMP_PATH" "$YQ_URL") +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "Extracting yq..." + tar -xzf "$TEMP_PATH" -C "$TEMP_DIR" + if [ -f "$TEMP_DIR/./yq_$ARCH_SUFFIX" ]; then + sudo mv "$TEMP_DIR/./yq_$ARCH_SUFFIX" /usr/local/bin/yq + sudo chmod +x /usr/local/bin/yq + echo "Successfully installed yq." + else + echo "Failed to extract yq from the tar.gz." + exit 1 + fi +else + sudo rm -rf "$TEMP_DIR" + echo "Failed to download yq for the architecture: ${ARCH_SUFFIX}, HTTP status was $HTTP_STATUS." + exit 1 +fi diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/git_clone.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/git_clone.sh index ea416bb..d3354dc 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/git_clone.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/git_clone.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -53,7 +53,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -63,7 +63,7 @@ HOME_DIR=$(dirname "$(dirname "$(dirname "$SCRIPT_DIR")")") if ! command -v jq &>/dev/null; then echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi # First check the directory containing install_scripts/, otherwise, use the home directory @@ -87,7 +87,7 @@ if [[ -d "$NAME" && ! -d "$NAME/.git" ]]; then fi # Verify that the repository is on the correct commit hash -if jq -e ".\"$URL\"[1]" $JSON_FILE &>/dev/null; then +if jq -e --arg url "$URL" '.[$url][1]' "$JSON_FILE" &>/dev/null; then BRANCH=$(jq -r ".\"$URL\"[0]" $JSON_FILE) TARGET_COMMIT_HASH=$(jq -r ".\"$URL\"[1]" $JSON_FILE) diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/handle_disk_pressure_taint.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/handle_disk_pressure_taint.sh index 30571d7..1268ac8 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/handle_disk_pressure_taint.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/handle_disk_pressure_taint.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # If the disk-pressure taint is not present then skip if ! kubectl describe nodes | grep Taints | grep -q "disk-pressure"; then diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_e2sim.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_e2sim.sh index f05c28f..04a8c29 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_e2sim.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_e2sim.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -45,7 +45,7 @@ fi sudo ./install_scripts/update_docker_dns.sh APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" -sudo $APTVARS apt-get install -y cmake g++ libsctp-dev +sudo env $APTVARS apt-get install -y cmake g++ libsctp-dev DOCKER_FILE_PATH="e2-interface/e2sim/Dockerfile_kpm_updated" cp e2-interface/e2sim/Dockerfile_kpm $DOCKER_FILE_PATH sudo ./install_scripts/revise_e2sim_dockerfile.sh $DOCKER_FILE_PATH diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_influxdb_pod.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_influxdb_pod.sh index 309274d..7617889 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_influxdb_pod.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_influxdb_pod.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -36,7 +36,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_k9s.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_k9s.sh index b4eb580..8e8eafa 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_k9s.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_k9s.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_xapp_hw-go.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_xapp_hw-go.sh index f6a8f18..ae3b626 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_xapp_hw-go.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/install_xapp_hw-go.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -44,7 +44,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi FILE="config/config-file_updated.json" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/parse_ric_installation_output.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/parse_ric_installation_output.sh index 001d25e..2901185 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/parse_ric_installation_output.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/parse_ric_installation_output.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") cd "$(dirname "$SCRIPT_DIR")" @@ -41,7 +41,7 @@ RIC_INSTALLATION_LOG_JSON="logs/ric_installation_stdout_parsed.json" if ! command -v jq >/dev/null 2>&1; then echo "Installing jq to process JSON files..." APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi # Initialize the JSON log file if it doesn't exist diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/purge_unready_pods.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/purge_unready_pods.sh index 838b70c..b297e40 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/purge_unready_pods.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/purge_unready_pods.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." if [ "$EUID" -ne 0 ]; then echo "Please run this script as root or use sudo." diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/register_chart_museum_url.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/register_chart_museum_url.sh index b7967eb..1d522ea 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/register_chart_museum_url.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/register_chart_museum_url.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." export CHART_REPO_URL=http://0.0.0.0:8090 sudo sed -i '/CHART_REPO_URL/d' /etc/environment diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/remove_expired_apt_keys.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/remove_expired_apt_keys.sh index 241a8db..42b8b19 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/remove_expired_apt_keys.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/remove_expired_apt_keys.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." OUTPUT=$(sudo apt-get update 2>&1 | tee /dev/tty) diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_e2sim_dockerfile.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_e2sim_dockerfile.sh index 3af255d..9914581 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_e2sim_dockerfile.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_e2sim_dockerfile.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Get the file path from the command line argument FILE=$1 diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_example_recipe_yaml.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_example_recipe_yaml.sh index 9c7b418..5e0a2c2 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_example_recipe_yaml.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_example_recipe_yaml.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") cd "$(dirname "$SCRIPT_DIR")" @@ -57,16 +57,8 @@ if [[ ! -r "$RECIPE_PATH" ]]; then exit 1 fi -# Check if the YAML editor is installed, and install it if not -if ! command -v yq &>/dev/null; then - sudo ./install_scripts/install_yq.sh -fi -# Check that the correct version of yq is installed -if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then - echo "ERROR: Detected an incompatible yq installation." - echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." - exit 1 -fi +# Ensure the correct YAML editor is installed +sudo ./install_scripts/ensure_consistent_yq.sh # Update IP addresses using yq yq e -i ".extsvcplt.ricip = \"${IP_ADDRESS}\"" "$RECIPE_PATH" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_influxdb_values_yaml.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_influxdb_values_yaml.sh index 879030c..f258b6f 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_influxdb_values_yaml.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/revise_influxdb_values_yaml.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -116,16 +116,8 @@ volumeBindingMode: WaitForFirstConsumer EOF kubectl apply -f "$HOME/.kube/influxdb-nfs.yaml" -# Check if the YAML editor is installed, and install it if not -if ! command -v yq &>/dev/null; then - sudo ./install_scripts/install_yq.sh -fi -# Check that the correct version of yq is installed -if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then - echo "ERROR: Detected an incompatible yq installation." - echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." - exit 1 -fi +# Ensure the correct YAML editor is installed +sudo ./install_scripts/ensure_consistent_yq.sh INFLUXDB_VALUES_PATH="$PARENT_DIR/ric-dep/helm/influxdb/values.yaml" INFLUXDB_VALUES_PATH2="$PARENT_DIR/ric-dep/helm/3rdparty/influxdb/values.yaml" diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_chart_museum.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_chart_museum.sh index da7fca8..0052284 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_chart_museum.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_chart_museum.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_e2sim_and_connect_to_ric.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_e2sim_and_connect_to_ric.sh index 12ede4e..e3e2ca6 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_e2sim_and_connect_to_ric.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_e2sim_and_connect_to_ric.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_xapp_onboarder.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_xapp_onboarder.sh index d5adc1d..2400035 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_xapp_onboarder.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/run_xapp_onboarder.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -42,13 +42,13 @@ cd appmgr/xapp_orchestrater/dev/xapp_onboarder # Install prerequisites APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v python3 &>/dev/null; then - sudo $APTVARS apt-get install -y python3 + sudo env $APTVARS apt-get install -y python3 fi if ! command -v pip &>/dev/null; then - sudo $APTVARS apt-get install -y python3-pip + sudo env $APTVARS apt-get install -y python3-pip fi if ! dpkg -l | grep -q python3-venv; then - sudo $APTVARS apt-get install -y python3-venv + sudo env $APTVARS apt-get install -y python3-venv fi # Check if the dmi_cli binary is already installed diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/set_file_descriptor_limits.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/set_file_descriptor_limits.sh index 37f79ca..4a30d62 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/set_file_descriptor_limits.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/set_file_descriptor_limits.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." echo "Updating file descriptor limits..." sudo sysctl -w fs.file-max=1000000 diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/start_sudo_refresh.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/start_sudo_refresh.sh index f06150c..6ede8a1 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/start_sudo_refresh.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/start_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." sudo ls &>/dev/null SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/stop_e2sim.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/stop_e2sim.sh index 9df9df0..225ffbc 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/stop_e2sim.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/stop_e2sim.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/stop_sudo_refresh.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/stop_sudo_refresh.sh index 94af8a2..0ca89f1 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/stop_sudo_refresh.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/stop_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Attempt to kill the process pkill -f "sudo_stay_validated.sh" || echo "No process found to stop." diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/sudo_stay_validated.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/sudo_stay_validated.sh index f237b1b..826b5ee 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/sudo_stay_validated.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/sudo_stay_validated.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Simple script to keep sudo active by refreshing it every minute while true; do diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/update_docker_dns.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/update_docker_dns.sh index b3b9dd8..23cbfde 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/update_docker_dns.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/update_docker_dns.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/update_host_address.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/update_host_address.sh index 86ad136..939a5ff 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/update_host_address.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/update_host_address.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/wait_for_ricplt_pods.sh b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/wait_for_ricplt_pods.sh index 6db37a1..aaa5cec 100755 --- a/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/wait_for_ricplt_pods.sh +++ b/RAN_Intelligent_Controllers/Near-Real-Time-RIC/install_scripts/wait_for_ricplt_pods.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") cd "$(dirname "$SCRIPT_DIR")" diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/install_cilium_and_migrate_nodes.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/install_cilium_and_migrate_nodes.sh index 03a7092..f6606b0 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/install_cilium_and_migrate_nodes.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/install_cilium_and_migrate_nodes.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." ENABLE_HUBBLE_LOGGING="true" diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/install_only_nearrtric_simulators.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/install_only_nearrtric_simulators.sh index a8c34aa..b4935bf 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/install_only_nearrtric_simulators.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/install_only_nearrtric_simulators.sh @@ -36,7 +36,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -76,7 +76,7 @@ fi if ! dpkg -s chrony &>/dev/null; then echo "Chrony is not installed, installing..." sudo apt-get update - sudo $APTVARS apt-get install -y chrony || true + sudo env $APTVARS apt-get install -y chrony || true fi if ! systemctl is-enabled --quiet chrony; then echo "Enabling Chrony service..." @@ -205,7 +205,7 @@ fi if ! command -v jq >/dev/null 2>&1; then echo "Installing jq to process JSON files..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi echo diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/update_commit_hashes.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/update_commit_hashes.sh index 901cf92..f8e73f1 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/update_commit_hashes.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/additional_scripts/update_commit_hashes.sh @@ -45,7 +45,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -56,7 +56,7 @@ if ! command -v jq &>/dev/null; then sudo apt-get update echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi JSON_FILE="commit_hashes.json" diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/commit_hashes.json b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/commit_hashes.json index b7c4ca6..2d5fa20 100644 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/commit_hashes.json +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/commit_hashes.json @@ -5,6 +5,6 @@ "https://gerrit.o-ran-sc.org/r/nonrtric/plt/ranpm.git": ["l-release", "b5f4f8698217ce70d3c2e6a454146fbcd2111d35"], "https://github.com/onap/multicloud-k8s.git": ["", "8bea0a13c223aff43f98f0cb6426379bb23e8894"], "https://gerrit.onap.org/r/oom.git": ["", "2f38164c1dfecae72b2632e2f1dee82454bd522c"], - "https://gerrit.o-ran-sc.org/r/portal/nonrtric-controlpanel.git": ["i-release", "fe9051bb91b524ff9cef5023a95dea7161d75388"], - "https://gerrit.o-ran-sc.org/r/nonrtric/plt/rappmanager.git": ["l-release", "67b12d9980ca0c14b9c054bba3aa6a9ee58bcbd3"], + "https://gerrit.o-ran-sc.org/r/portal/nonrtric-controlpanel.git": ["master", "f337177ece41c036967ece8513e9f29b07deca34"], + "https://gerrit.o-ran-sc.org/r/nonrtric/plt/rappmanager.git": ["l-release", "67b12d9980ca0c14b9c054bba3aa6a9ee58bcbd3"] } diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/full_install.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/full_install.sh index b55cd75..ebeac62 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/full_install.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/full_install.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -78,7 +78,7 @@ fi if ! dpkg -s chrony &>/dev/null; then echo "Chrony is not installed, installing..." sudo apt-get update - sudo $APTVARS apt-get install -y chrony || true + sudo env $APTVARS apt-get install -y chrony || true fi if ! systemctl is-enabled --quiet chrony; then echo "Enabling Chrony service..." @@ -291,7 +291,7 @@ fi if ! command -v jq >/dev/null 2>&1; then echo "Installing jq to process JSON files..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi if ! command -v envsubst &>/dev/null; then @@ -306,7 +306,7 @@ if ! command -v keytool &>/dev/null; then echo "Installing openjdk-11-jre-headless..." sudo add-apt-repository -y ppa:openjdk-r/ppa sudo apt-get update - sudo $APTVARS apt-get install -y openjdk-11-jre-headless + sudo env $APTVARS apt-get install -y openjdk-11-jre-headless fi echo diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/full_uninstall.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/full_uninstall.sh index e11efef..b0987f1 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/full_uninstall.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/full_uninstall.sh @@ -34,7 +34,7 @@ set +e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -86,7 +86,7 @@ fi if ! dpkg -s chrony &>/dev/null; then sudo apt-get update echo "Chrony is not installed, installing..." - sudo $APTVARS apt-get install -y chrony || true + sudo env $APTVARS apt-get install -y chrony || true fi if ! systemctl is-enabled --quiet chrony; then echo "Enabling Chrony service..." diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_patch_files/dep/ric-dep/bin/install_k8s_and_helm.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_patch_files/dep/ric-dep/bin/install_k8s_and_helm.sh index 701ee87..116479b 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_patch_files/dep/ric-dep/bin/install_k8s_and_helm.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_patch_files/dep/ric-dep/bin/install_k8s_and_helm.sh @@ -116,13 +116,14 @@ done echo "Installing prerequisites..." sudo apt-get update || true -sudo $APTVARS apt-get install -y curl wget gnupg2 software-properties-common lsb-release net-tools iproute2 iputils-ping -sudo $APTVARS apt-get install -y kmod -sudo $APTVARS apt-get install -y gawk sed -sudo $APTVARS apt-get install -y iptables -sudo $APTVARS apt-get install -y ipvsadm -sudo $APTVARS apt-get install -y socat -sudo $APTVARS apt-get install -y libsctp1 lksctp-tools +sudo env $APTVARS apt-get install -y curl wget gnupg2 software-properties-common lsb-release net-tools iproute2 iputils-ping +sudo env $APTVARS apt-get install -y kmod +sudo env $APTVARS apt-get install -y gawk sed +sudo env $APTVARS apt-get install -y iptables +sudo env $APTVARS apt-get install -y ipvsadm +sudo env $APTVARS apt-get install -y socat +sudo env $APTVARS apt-get install -y libsctp1 lksctp-tools +sudo env $APTVARS apt-get install -y jq netcat-openbsd make ipset moreutils # Previous versions from original script (HELMV 3.14.X causes continuous APIServer crashing on Ubuntu 22): # KUBEV="1.28" #.11" @@ -165,7 +166,7 @@ else # Use docker-ce # Code from (https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository): sudo apt-get update - sudo $APTVARS apt-get install -y ca-certificates curl + sudo env $APTVARS apt-get install -y curl gnupg ca-certificates sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc @@ -235,14 +236,16 @@ echo "### k8s cni version = "${KUBECNIV} echo echo "Updating Kubernetes keyring..." sudo mkdir -p /etc/apt/keyrings -sudo curl -fsSL https://pkgs.k8s.io/core:/stable:/v${KUBEV}/deb/Release.key | gpg --dearmor --yes | sudo tee /etc/apt/keyrings/kubernetes-apt-keyring.gpg >/dev/null -sudo echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${KUBEV}/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list +sudo curl -fsSL "https://pkgs.k8s.io/core:/stable:/v${KUBEV}/deb/Release.key" | gpg --dearmor --yes | sudo tee /etc/apt/keyrings/kubernetes-apt-keyring.gpg >/dev/null +echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${KUBEV}/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list >/dev/null echo echo "Updating Helm keyring..." -sudo mkdir -p /etc/apt/keyrings -sudo curl -fsSL https://baltocdn.com/helm/signing.asc | gpg --dearmor --yes | sudo tee /etc/apt/keyrings/helm-apt-keyring.gpg >/dev/null -sudo echo "deb [signed-by=/etc/apt/keyrings/helm-apt-keyring.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list +sudo rm -f /etc/apt/sources.list.d/helm-stable-debian.list +sudo rm -f /etc/apt/keyrings/helm-apt-keyring.gpg +sudo install -d -m 0755 /usr/share/keyrings +curl -fsSL https://packages.buildkite.com/helm-linux/helm-debian/gpgkey | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg >/dev/null +echo "deb [signed-by=/usr/share/keyrings/helm.gpg] https://packages.buildkite.com/helm-linux/helm-debian/any/ any main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list >/dev/null # If this errors you can remove Kubernetes with `sudo rm /etc/apt/sources.list.d/kubernetes.list` or remove Helm with `sudo rm /etc/apt/sources.list.d/helm-stable-debian.list` sudo apt-get update @@ -332,8 +335,8 @@ if [[ $(cat /opt/config/stack_name.txt) == *aux* ]]; then fi # Load necessary kernel modules -sudo modprobe overlay -sudo modprobe br_netfilter +sudo modprobe overlay || true +sudo modprobe br_netfilter || true # Load IP Virtual Server (IPVS) modules sudo modprobe ip_vs @@ -345,18 +348,19 @@ sudo modprobe ip_vs_sh sudo modprobe sctp # Get the kernel major version -KERNEL_VERSION=$(uname -r | cut -d'-' -f1) -MAJOR_VERSION=$(echo $KERNEL_VERSION | cut -d'.' -f1) +KERNEL_VERSION="$(uname -r | cut -d'-' -f1)" +MAJOR_VERSION="$(echo "$KERNEL_VERSION" | cut -d'.' -f1)" # Conditional loading of connection tracking modules based on kernel version if [ "$MAJOR_VERSION" -lt 5 ]; then # For older kernels (before version 5), load IPv4 and IPv6 specific modules - sudo modprobe nf_conntrack_ipv4 - sudo modprobe nf_conntrack_ipv6 - sudo modprobe nf_conntrack_proto_sctp + sudo modprobe nf_conntrack_ipv4 || true + sudo modprobe nf_conntrack_ipv6 || true + sudo modprobe nf_conntrack_proto_sctp || true else # For newer kernels (version 5 and later), use the unified nf_conntrack module - sudo modprobe nf_conntrack + sudo modprobe nf_conntrack || true + sudo modprobe nf_conntrack_sctp || true fi # Ensure modules are loaded on boot @@ -451,9 +455,6 @@ else echo "All swap has been successfully disabled." fi -sudo apt-get update -sudo $APTVARS apt-get install -y curl jq netcat-openbsd make ipset moreutils - # ----------------------------------------------------------------------------- # Docker uninstallation then clean installation # ----------------------------------------------------------------------------- @@ -483,9 +484,9 @@ sudo apt-get autoremove -y echo "Installing Docker..." if ! command -v docker &>/dev/null; then if [ "$USE_DOCKER_CE" -eq 0 ]; then - sudo $APTVARS apt-get install -y $APTOPTS "docker.io=$DOCKERVERSION" + sudo env $APTVARS apt-get install -y $APTOPTS "docker.io=$DOCKERVERSION" else - sudo $APTVARS apt-get install -y $APTOPTS "docker-ce=$DOCKERVERSION" + sudo env $APTVARS apt-get install -y $APTOPTS "docker-ce=$DOCKERVERSION" fi fi @@ -697,21 +698,21 @@ echo "Kubernetes version without suffix: $KUBEVERSIONWITHOUTSUFFIX" # Install Kubernetes components if [ -z "${CNIVERSION}" ]; then - sudo $APTVARS apt-get install -y kubernetes-cni + sudo env $APTVARS apt-get install -y kubernetes-cni else - sudo $APTVARS apt-get install -y $APTOPTS kubernetes-cni=${CNIVERSION} + sudo env $APTVARS apt-get install -y $APTOPTS kubernetes-cni=${CNIVERSION} fi if [ -z "${KUBEVERSION}" ]; then - sudo $APTVARS apt-get install -y kubeadm kubelet kubectl + sudo env $APTVARS apt-get install -y kubeadm kubelet kubectl else - sudo $APTVARS apt-get install -y $APTOPTS kubeadm=${KUBEVERSION} kubelet=${KUBEVERSION} kubectl=${KUBEVERSION} + sudo env $APTVARS apt-get install -y $APTOPTS kubeadm=${KUBEVERSION} kubelet=${KUBEVERSION} kubectl=${KUBEVERSION} fi # If kubectl command is not found after install, reinstall if ! command -v kubectl >/dev/null 2>&1; then echo "kubectl not found after install, retrying with --reinstall..." - sudo $APTVARS apt-get install -y --reinstall kubectl=${KUBEVERSION} + sudo env $APTVARS apt-get install -y --reinstall kubectl=${KUBEVERSION} if ! command -v kubectl >/dev/null 2>&1; then echo "ERROR: /usr/bin/kubectl still not found after reinstall. Aborting." exit 1 diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/enable_docker_build_kit.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/enable_docker_build_kit.sh index bc5fcb2..c7e5810 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/enable_docker_build_kit.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/enable_docker_build_kit.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." CONFIG_FILE="/etc/docker/daemon.json" TEMP_FILE="/tmp/daemon.json.tmp" @@ -38,7 +38,7 @@ if ! command -v jq &>/dev/null; then echo "Installing jq..." sudo apt-get update APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi echo "Enabling Docker build kit..." diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/ensure_consistent_yq.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/ensure_consistent_yq.sh new file mode 100755 index 0000000..d3794d3 --- /dev/null +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/ensure_consistent_yq.sh @@ -0,0 +1,123 @@ +#!/bin/bash +# +# NIST-developed software is provided by NIST as a public service. You may use, +# copy, and distribute copies of the software in any medium, provided that you +# keep intact this entire notice. You may improve, modify, and create derivative +# works of the software or any portion of the software, and you may copy and +# distribute such modifications or works. Modified works should carry a notice +# stating that you changed the software and should note the date and nature of +# any such change. Please explicitly acknowledge the National Institute of +# Standards and Technology as the source of the software. +# +# NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY +# OF ANY KIND, EXPRESS, IMPLIED, IN FACT, OR ARISING BY OPERATION OF LAW, +# INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND DATA ACCURACY. NIST +# NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE +# UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES +# NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR +# THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, +# RELIABILITY, OR USEFULNESS OF THE SOFTWARE. +# +# You are solely responsible for determining the appropriateness of using and +# distributing the software and you assume all risks associated with its use, +# including but not limited to the risks and costs of program errors, compliance +# with applicable laws, damage to or loss of data, programs or equipment, and +# the unavailability or interruption of operation. This software is not intended +# to be used in any situation where a failure could cause risk of injury or +# damage to property. The software developed by NIST employees is not subject to +# copyright protection within the United States. + +# Exit immediately if a command fails +set -e + +YQ_VERSION="v4.47.2" + +if command -v yq &>/dev/null; then + # Check that the correct version of yq is installed + if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then + echo "ERROR: Detected an incompatible yq installation." + echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." + exit 1 + fi + + if yq --version 2>/dev/null | grep -q "$YQ_VERSION"; then + exit 0 + fi + + echo "Removing incompatible yq..." + sudo rm -rf /usr/local/bin/yq + hash -r +fi + +echo "Installing yq..." + +# Determine the processor architecture +ARCH_SUFFIX="" +case $(uname -m) in +"x86_64") + ARCH_SUFFIX="linux_amd64" + ;; +"aarch64") + ARCH_SUFFIX="linux_arm64" + ;; +"armv7l" | "armv6l") + ARCH_SUFFIX="linux_arm" + ;; +"i386" | "i686") + ARCH_SUFFIX="linux_386" + ;; +"ppc64le") + ARCH_SUFFIX="linux_ppc64le" + ;; +"s390x") + ARCH_SUFFIX="linux_s390x" + ;; +"mips") + ARCH_SUFFIX="linux_mips" + ;; +"mips64") + ARCH_SUFFIX="linux_mips64" + ;; +"mips64el" | "mips64le") + ARCH_SUFFIX="linux_mips64le" + ;; +"mipsel" | "mipsle") + ARCH_SUFFIX="linux_mipsle" + ;; +*) + echo "Unsupported architecture for yq: $(uname -m)" + exit 1 + ;; +esac + +YQ_URL="https://github.com/mikefarah/yq/releases/download/$YQ_VERSION/yq_${ARCH_SUFFIX}.tar.gz" + +# Create a temporary directory for the download +TEMP_DIR=$(mktemp -d) +TEMP_PATH="$TEMP_DIR/yq.tar.gz" + +if ! command -v curl &>/dev/null; then + echo "Package \"curl\" not found, installing..." + APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" + sudo env $APTVARS apt-get install -y curl +fi + +echo "Downloading yq from $YQ_URL..." +HTTP_STATUS=$(curl -L -w "%{http_code}" -o "$TEMP_PATH" "$YQ_URL") +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "Extracting yq..." + tar -xzf "$TEMP_PATH" -C "$TEMP_DIR" + if [ -f "$TEMP_DIR/./yq_$ARCH_SUFFIX" ]; then + sudo mv "$TEMP_DIR/./yq_$ARCH_SUFFIX" /usr/local/bin/yq + sudo chmod +x /usr/local/bin/yq + echo "Successfully installed yq." + else + echo "Failed to extract yq from the tar.gz." + exit 1 + fi +else + sudo rm -rf "$TEMP_DIR" + echo "Failed to download yq for the architecture: ${ARCH_SUFFIX}, HTTP status was $HTTP_STATUS." + exit 1 +fi diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/ensure_kong_storage_class_set_yaml.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/ensure_kong_storage_class_set_yaml.sh index 6c6ff39..e7f58fc 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/ensure_kong_storage_class_set_yaml.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/ensure_kong_storage_class_set_yaml.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") @@ -55,16 +55,8 @@ if [[ ! -r "$KONG_CONFIG_PATH" ]]; then exit 1 fi -# Check if the YAML editor is installed, and install it if not -if ! command -v yq &>/dev/null; then - sudo ./install_scripts/install_yq.sh -fi -# Check that the correct version of yq is installed -if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then - echo "ERROR: Detected an incompatible yq installation." - echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." - exit 1 -fi +# Ensure the correct YAML editor is installed +sudo ./install_scripts/ensure_consistent_yq.sh # The following snippet is from https://lf-o-ran-sc.atlassian.net/wiki/spaces/RICNR/pages/86802787/Release+K+-+Run+in+Kubernetes: # sed -i '/persistence:/,/existingClaim:/s/existingClaim: .*/enabled: false/' ./dep/nonrtric/helm/kongstorage/kongvalues.yaml && rm -rf ./dep/nonrtric/helm/kongstorage/templates diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/generate_sample_rapps.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/generate_sample_rapps.sh index 6151bdb..071bbfc 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/generate_sample_rapps.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/generate_sample_rapps.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") PARENT_DIR=$(dirname "$SCRIPT_DIR") diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/git_clone.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/git_clone.sh index ea416bb..d3354dc 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/git_clone.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/git_clone.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -53,7 +53,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -63,7 +63,7 @@ HOME_DIR=$(dirname "$(dirname "$(dirname "$SCRIPT_DIR")")") if ! command -v jq &>/dev/null; then echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi # First check the directory containing install_scripts/, otherwise, use the home directory @@ -87,7 +87,7 @@ if [[ -d "$NAME" && ! -d "$NAME/.git" ]]; then fi # Verify that the repository is on the correct commit hash -if jq -e ".\"$URL\"[1]" $JSON_FILE &>/dev/null; then +if jq -e --arg url "$URL" '.[$url][1]' "$JSON_FILE" &>/dev/null; then BRANCH=$(jq -r ".\"$URL\"[0]" $JSON_FILE) TARGET_COMMIT_HASH=$(jq -r ".\"$URL\"[1]" $JSON_FILE) diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/handle_disk_pressure_taint.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/handle_disk_pressure_taint.sh index 30571d7..1268ac8 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/handle_disk_pressure_taint.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/handle_disk_pressure_taint.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # If the disk-pressure taint is not present then skip if ! kubectl describe nodes | grep Taints | grep -q "disk-pressure"; then diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_docker_compose.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_docker_compose.sh index 93df2e1..07fcc54 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_docker_compose.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_docker_compose.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." CURRENT_DIR=$(pwd) diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_k9s.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_k9s.sh index b4eb580..8e8eafa 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_k9s.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/install_k9s.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/remove_expired_apt_keys.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/remove_expired_apt_keys.sh index 241a8db..42b8b19 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/remove_expired_apt_keys.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/remove_expired_apt_keys.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." OUTPUT=$(sudo apt-get update 2>&1 | tee /dev/tty) diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/revise_example_recipe_yaml.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/revise_example_recipe_yaml.sh index 50d2356..b3d16bd 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/revise_example_recipe_yaml.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/revise_example_recipe_yaml.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") cd "$(dirname "$SCRIPT_DIR")" @@ -54,16 +54,8 @@ if [[ ! -r "$RECIPE_PATH" ]]; then exit 1 fi -# Check if the YAML editor is installed, and install it if not -if ! command -v yq &>/dev/null; then - sudo ./install_scripts/install_yq.sh -fi -# Check that the correct version of yq is installed -if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then - echo "ERROR: Detected an incompatible yq installation." - echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." - exit 1 -fi +# Ensure the correct YAML editor is installed +sudo ./install_scripts/ensure_consistent_yq.sh # Function to update YAML configuration files update_yaml() { diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/set_file_descriptor_limits.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/set_file_descriptor_limits.sh index 37f79ca..4a30d62 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/set_file_descriptor_limits.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/set_file_descriptor_limits.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." echo "Updating file descriptor limits..." sudo sysctl -w fs.file-max=1000000 diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/start_sudo_refresh.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/start_sudo_refresh.sh index f06150c..6ede8a1 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/start_sudo_refresh.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/start_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." sudo ls &>/dev/null SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/stop_sudo_refresh.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/stop_sudo_refresh.sh index 94af8a2..0ca89f1 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/stop_sudo_refresh.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/stop_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Attempt to kill the process pkill -f "sudo_stay_validated.sh" || echo "No process found to stop." diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/sudo_stay_validated.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/sudo_stay_validated.sh index f237b1b..826b5ee 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/sudo_stay_validated.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/sudo_stay_validated.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Simple script to keep sudo active by refreshing it every minute while true; do diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/wait_for_nonrtric_pods.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/wait_for_nonrtric_pods.sh index 40b6e8d..65e04c3 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/wait_for_nonrtric_pods.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/install_scripts/wait_for_nonrtric_pods.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." SCRIPT_DIR=$(dirname "$(realpath "$0")") cd "$(dirname "$SCRIPT_DIR")" diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/run_control_panel.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/run_control_panel.sh index 95375f5..42eba2e 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/run_control_panel.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/run_control_panel.sh @@ -40,7 +40,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -50,7 +50,7 @@ cd "$SCRIPT_DIR" if ! command -v docker &>/dev/null; then echo "Docker not found, installing..." sudo apt-get update - sudo $APTVARS apt-get install -y docker.io + sudo env $APTVARS apt-get install -y docker.io sudo systemctl start docker sudo systemctl enable docker sudo usermod -aG docker "$USER" @@ -88,16 +88,8 @@ if [ ! -d nonrtric-controlpanel ]; then ./install_scripts/git_clone.sh https://gerrit.o-ran-sc.org/r/portal/nonrtric-controlpanel.git nonrtric-controlpanel fi -# Check if the YAML editor is installed, and install it if not -if ! command -v yq &>/dev/null; then - sudo "$SCRIPT_DIR/install_scripts/./install_yq.sh" -fi -# Check that the correct version of yq is installed -if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then - echo "ERROR: Detected an incompatible yq installation." - echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." - exit 1 -fi +# Ensure the correct YAML editor is installed +sudo "$SCRIPT_DIR/install_scripts/./ensure_consistent_yq.sh" # Fetch the addresses of the policy management service and information service SERVICE_INFO_PMS=$(kubectl get service -n nonrtric | grep policymanagementservice || echo "") diff --git a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/run_tests.sh b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/run_tests.sh index 3018bf1..ff5d2cf 100755 --- a/RAN_Intelligent_Controllers/Non-Real-Time-RIC/run_tests.sh +++ b/RAN_Intelligent_Controllers/Non-Real-Time-RIC/run_tests.sh @@ -35,7 +35,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -48,13 +48,13 @@ cd "$SCRIPT_DIR" if ! command -v python3 &>/dev/null; then echo "Python is not installed. Installing Python..." sudo apt-get update - sudo $APTVARS apt-get install -y python3 + sudo env $APTVARS apt-get install -y python3 fi if ! command -v pip &>/dev/null; then - sudo $APTVARS apt-get install -y python3-pip + sudo env $APTVARS apt-get install -y python3-pip fi if ! dpkg -l | grep -q python3-venv; then - sudo $APTVARS apt-get install -y python3-venv + sudo env $APTVARS apt-get install -y python3-venv fi mkdir -p "$SCRIPT_DIR/tests" diff --git a/README.md b/README.md index 47b673e..7ffa1b2 100644 --- a/README.md +++ b/README.md @@ -63,8 +63,8 @@ Before beginning the installation and setup of the testbed, verify that the syst - **Operating System**: Linux distributions based on Ubuntu 20.04 LTS, Ubuntu 22.04 LTS, and Ubuntu 24.04 LTS are supported. - _Recommendation: Ubuntu 22.04._ -- **Hard Drive Storage**: Must be `≥ 35` GB. -- **Base Memory/RAM**: Must be `≥ 6144` MB. +- **Hard Drive Storage**: Must be `≥ 57` GB. +- **Base Memory/RAM**: Must be `≥ 6000` MB. - **Number of Processors**: Must be `≥ 2` processors. - _Recommendation: `≥ 6` processors._ - **Internet Connectivity**: A stable internet connection must be maintained during the installation otherwise the process may fail and require restarting. diff --git a/User_Equipment/additional_scripts/open_ue_shell.sh b/User_Equipment/additional_scripts/open_ue_shell.sh index cbab273..409196a 100755 --- a/User_Equipment/additional_scripts/open_ue_shell.sh +++ b/User_Equipment/additional_scripts/open_ue_shell.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/User_Equipment/additional_scripts/simulate_core_traffic_to_ue.sh b/User_Equipment/additional_scripts/simulate_core_traffic_to_ue.sh index 343d46e..b09eefa 100755 --- a/User_Equipment/additional_scripts/simulate_core_traffic_to_ue.sh +++ b/User_Equipment/additional_scripts/simulate_core_traffic_to_ue.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -92,8 +92,7 @@ echo "Successfully found PDU Session IP: $PDU_SESSION_IP" if ! command -v iperf &>/dev/null; then echo "Package \"iperf\" not found, installing..." - sudo $APTVARS apt-get install -y iperf + sudo env $APTVARS apt-get install -y iperf fi iperf -c $PDU_SESSION_IP -u -i 1 -b $BANDWIDTH -t $DURATION - diff --git a/User_Equipment/additional_scripts/simulate_ue_traffic_to_core.sh b/User_Equipment/additional_scripts/simulate_ue_traffic_to_core.sh index b1da988..cb0663a 100755 --- a/User_Equipment/additional_scripts/simulate_ue_traffic_to_core.sh +++ b/User_Equipment/additional_scripts/simulate_ue_traffic_to_core.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -80,6 +80,13 @@ if [ ! -f "configs/ue1.conf" ]; then exit 1 fi +# Remove the CIDR suffix from an IP address +# For example, 10.45.0.1/16 --> 10.45.0.1 +remove_cidr_suffix() { + local IP=$1 + echo ${IP%/*} +} + UE_NAMESPACE="ue$UE_NUMBER" # If the namespace doesn't exist @@ -114,7 +121,7 @@ fi if ! command -v iperf &>/dev/null; then echo "Package \"iperf\" not found, installing..." - sudo $APTVARS apt-get install -y iperf + sudo env $APTVARS apt-get install -y iperf fi sudo ip netns exec ue$UE_NUMBER iperf -c $CORE_IP -u -i 1 -b $BANDWIDTH -t $DURATION diff --git a/User_Equipment/full_install.sh b/User_Equipment/full_install.sh index 1ace54f..de6751c 100755 --- a/User_Equipment/full_install.sh +++ b/User_Equipment/full_install.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -90,17 +90,17 @@ EOF fi # Code from (https://docs.srsran.com/projects/4g/en/latest/general/source/1_installation.html#installation-from-source): -sudo $APTVARS apt-get install -y build-essential cmake cmake-data libfftw3-dev libmbedtls-dev libboost-program-options-dev libconfig++-dev libsctp-dev - -sudo $APTVARS apt-get install -y libboost-all-dev -sudo $APTVARS apt-get install -y libuhd-dev -sudo $APTVARS apt-get install -y uhd-host -sudo $APTVARS apt-get install -y libdw-dev libbfd-dev libdwarf-dev -sudo $APTVARS apt-get install -y libyaml-cpp-dev -sudo $APTVARS apt-get install -y libgtest-dev -sudo $APTVARS apt-get install -y libtool +sudo env $APTVARS apt-get install -y build-essential cmake cmake-data libfftw3-dev libmbedtls-dev libboost-program-options-dev libconfig++-dev libsctp-dev + +sudo env $APTVARS apt-get install -y libboost-all-dev +sudo env $APTVARS apt-get install -y libuhd-dev +sudo env $APTVARS apt-get install -y uhd-host +sudo env $APTVARS apt-get install -y libdw-dev libbfd-dev libdwarf-dev +sudo env $APTVARS apt-get install -y libyaml-cpp-dev +sudo env $APTVARS apt-get install -y libgtest-dev +sudo env $APTVARS apt-get install -y libtool # Enable SCTP -sudo $APTVARS apt-get install -y libsctp-dev +sudo env $APTVARS apt-get install -y libsctp-dev # Check if SCTP is available and load it if necessary if ! lsmod | grep -q sctp; then echo "Loading SCTP module..." @@ -120,7 +120,7 @@ if [[ -z "$GCC_VERSION" || ! "$GCC_VERSION" == 13.* ]]; then echo "Installing GCC 13..." sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update - sudo $APTVARS apt-get install -y gcc-13 g++-13 + sudo env $APTVARS apt-get install -y gcc-13 g++-13 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 fi diff --git a/User_Equipment/full_uninstall.sh b/User_Equipment/full_uninstall.sh index 27bd13a..0be2683 100755 --- a/User_Equipment/full_uninstall.sh +++ b/User_Equipment/full_uninstall.sh @@ -34,7 +34,7 @@ set +e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/User_Equipment/generate_configurations.sh b/User_Equipment/generate_configurations.sh index 47a5098..ef2af9f 100755 --- a/User_Equipment/generate_configurations.sh +++ b/User_Equipment/generate_configurations.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -65,16 +65,8 @@ for i in "${UE_NUMBERS[@]}"; do echo "UE $i will be configured." done -# Check if the YAML editor is installed, and install it if not -if ! command -v yq &>/dev/null; then - sudo "$SCRIPT_DIR/install_scripts/./install_yq.sh" -fi -# Check that the correct version of yq is installed -if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then - echo "ERROR: Detected an incompatible yq installation." - echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." - exit 1 -fi +# Ensure the correct YAML editor is installed +sudo "$SCRIPT_DIR/install_scripts/./ensure_consistent_yq.sh" echo "Saving configuration file example..." if [ "$CLEAR_CONFIGS" = true ]; then diff --git a/User_Equipment/install_scripts/ensure_consistent_yq.sh b/User_Equipment/install_scripts/ensure_consistent_yq.sh new file mode 100755 index 0000000..d3794d3 --- /dev/null +++ b/User_Equipment/install_scripts/ensure_consistent_yq.sh @@ -0,0 +1,123 @@ +#!/bin/bash +# +# NIST-developed software is provided by NIST as a public service. You may use, +# copy, and distribute copies of the software in any medium, provided that you +# keep intact this entire notice. You may improve, modify, and create derivative +# works of the software or any portion of the software, and you may copy and +# distribute such modifications or works. Modified works should carry a notice +# stating that you changed the software and should note the date and nature of +# any such change. Please explicitly acknowledge the National Institute of +# Standards and Technology as the source of the software. +# +# NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY +# OF ANY KIND, EXPRESS, IMPLIED, IN FACT, OR ARISING BY OPERATION OF LAW, +# INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND DATA ACCURACY. NIST +# NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE +# UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES +# NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR +# THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, +# RELIABILITY, OR USEFULNESS OF THE SOFTWARE. +# +# You are solely responsible for determining the appropriateness of using and +# distributing the software and you assume all risks associated with its use, +# including but not limited to the risks and costs of program errors, compliance +# with applicable laws, damage to or loss of data, programs or equipment, and +# the unavailability or interruption of operation. This software is not intended +# to be used in any situation where a failure could cause risk of injury or +# damage to property. The software developed by NIST employees is not subject to +# copyright protection within the United States. + +# Exit immediately if a command fails +set -e + +YQ_VERSION="v4.47.2" + +if command -v yq &>/dev/null; then + # Check that the correct version of yq is installed + if ! yq --version 2>/dev/null | grep -q 'https://github\.com/mikefarah/yq'; then + echo "ERROR: Detected an incompatible yq installation." + echo "Please ensure the Python yq is uninstalled with \"pip uninstall -y yq\", then re-run this script." + exit 1 + fi + + if yq --version 2>/dev/null | grep -q "$YQ_VERSION"; then + exit 0 + fi + + echo "Removing incompatible yq..." + sudo rm -rf /usr/local/bin/yq + hash -r +fi + +echo "Installing yq..." + +# Determine the processor architecture +ARCH_SUFFIX="" +case $(uname -m) in +"x86_64") + ARCH_SUFFIX="linux_amd64" + ;; +"aarch64") + ARCH_SUFFIX="linux_arm64" + ;; +"armv7l" | "armv6l") + ARCH_SUFFIX="linux_arm" + ;; +"i386" | "i686") + ARCH_SUFFIX="linux_386" + ;; +"ppc64le") + ARCH_SUFFIX="linux_ppc64le" + ;; +"s390x") + ARCH_SUFFIX="linux_s390x" + ;; +"mips") + ARCH_SUFFIX="linux_mips" + ;; +"mips64") + ARCH_SUFFIX="linux_mips64" + ;; +"mips64el" | "mips64le") + ARCH_SUFFIX="linux_mips64le" + ;; +"mipsel" | "mipsle") + ARCH_SUFFIX="linux_mipsle" + ;; +*) + echo "Unsupported architecture for yq: $(uname -m)" + exit 1 + ;; +esac + +YQ_URL="https://github.com/mikefarah/yq/releases/download/$YQ_VERSION/yq_${ARCH_SUFFIX}.tar.gz" + +# Create a temporary directory for the download +TEMP_DIR=$(mktemp -d) +TEMP_PATH="$TEMP_DIR/yq.tar.gz" + +if ! command -v curl &>/dev/null; then + echo "Package \"curl\" not found, installing..." + APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" + sudo env $APTVARS apt-get install -y curl +fi + +echo "Downloading yq from $YQ_URL..." +HTTP_STATUS=$(curl -L -w "%{http_code}" -o "$TEMP_PATH" "$YQ_URL") +if [ "$HTTP_STATUS" -eq 200 ]; then + echo "Extracting yq..." + tar -xzf "$TEMP_PATH" -C "$TEMP_DIR" + if [ -f "$TEMP_DIR/./yq_$ARCH_SUFFIX" ]; then + sudo mv "$TEMP_DIR/./yq_$ARCH_SUFFIX" /usr/local/bin/yq + sudo chmod +x /usr/local/bin/yq + echo "Successfully installed yq." + else + echo "Failed to extract yq from the tar.gz." + exit 1 + fi +else + sudo rm -rf "$TEMP_DIR" + echo "Failed to download yq for the architecture: ${ARCH_SUFFIX}, HTTP status was $HTTP_STATUS." + exit 1 +fi diff --git a/User_Equipment/install_scripts/git_clone.sh b/User_Equipment/install_scripts/git_clone.sh index 211e6bd..446e60f 100755 --- a/User_Equipment/install_scripts/git_clone.sh +++ b/User_Equipment/install_scripts/git_clone.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e @@ -53,7 +53,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi CURRENT_DIR=$(pwd) @@ -63,7 +63,7 @@ HOME_DIR=$(dirname "$(dirname "$SCRIPT_DIR")") if ! command -v jq &>/dev/null; then echo "Installing jq..." - sudo $APTVARS apt-get install -y jq + sudo env $APTVARS apt-get install -y jq fi # First check the directory containing install_scripts/, otherwise, use the home directory @@ -87,7 +87,7 @@ if [[ -d "$NAME" && ! -d "$NAME/.git" ]]; then fi # Verify that the repository is on the correct commit hash -if jq -e ".\"$URL\"[1]" $JSON_FILE &>/dev/null; then +if jq -e --arg url "$URL" '.[$url][1]' "$JSON_FILE" &>/dev/null; then BRANCH=$(jq -r ".\"$URL\"[0]" $JSON_FILE) TARGET_COMMIT_HASH=$(jq -r ".\"$URL\"[1]" $JSON_FILE) diff --git a/User_Equipment/install_scripts/remove_expired_apt_keys.sh b/User_Equipment/install_scripts/remove_expired_apt_keys.sh index 241a8db..42b8b19 100755 --- a/User_Equipment/install_scripts/remove_expired_apt_keys.sh +++ b/User_Equipment/install_scripts/remove_expired_apt_keys.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." OUTPUT=$(sudo apt-get update 2>&1 | tee /dev/tty) diff --git a/User_Equipment/install_scripts/revert_ue_namespace.sh b/User_Equipment/install_scripts/revert_ue_namespace.sh index 7ada6a6..925b85f 100755 --- a/User_Equipment/install_scripts/revert_ue_namespace.sh +++ b/User_Equipment/install_scripts/revert_ue_namespace.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Do not exit immediately if a command fails set +e diff --git a/User_Equipment/install_scripts/setup_ue_namespace.sh b/User_Equipment/install_scripts/setup_ue_namespace.sh index e81a583..b46be18 100755 --- a/User_Equipment/install_scripts/setup_ue_namespace.sh +++ b/User_Equipment/install_scripts/setup_ue_namespace.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Exit immediately if a command fails set -e diff --git a/User_Equipment/install_scripts/start_sudo_refresh.sh b/User_Equipment/install_scripts/start_sudo_refresh.sh index f06150c..6ede8a1 100755 --- a/User_Equipment/install_scripts/start_sudo_refresh.sh +++ b/User_Equipment/install_scripts/start_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." sudo ls &>/dev/null SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/User_Equipment/install_scripts/stop_sudo_refresh.sh b/User_Equipment/install_scripts/stop_sudo_refresh.sh index 94af8a2..0ca89f1 100755 --- a/User_Equipment/install_scripts/stop_sudo_refresh.sh +++ b/User_Equipment/install_scripts/stop_sudo_refresh.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Attempt to kill the process pkill -f "sudo_stay_validated.sh" || echo "No process found to stop." diff --git a/User_Equipment/install_scripts/sudo_stay_validated.sh b/User_Equipment/install_scripts/sudo_stay_validated.sh index f237b1b..826b5ee 100755 --- a/User_Equipment/install_scripts/sudo_stay_validated.sh +++ b/User_Equipment/install_scripts/sudo_stay_validated.sh @@ -28,7 +28,7 @@ # damage to property. The software developed by NIST employees is not subject to # copyright protection within the United States. -echo "# Script: $(realpath $0)..." +echo "# Script: $(realpath "$0")..." # Simple script to keep sudo active by refreshing it every minute while true; do diff --git a/User_Equipment/is_running.sh b/User_Equipment/is_running.sh index 82b466e..f6ca9fd 100755 --- a/User_Equipment/is_running.sh +++ b/User_Equipment/is_running.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/User_Equipment/run.sh b/User_Equipment/run.sh index 6023c0e..1e85912 100755 --- a/User_Equipment/run.sh +++ b/User_Equipment/run.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/User_Equipment/run_background.sh b/User_Equipment/run_background.sh index 61977db..05f5fc9 100755 --- a/User_Equipment/run_background.sh +++ b/User_Equipment/run_background.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -68,7 +68,7 @@ while ! ./is_running.sh | grep -q "ue$UE_NUMBER"; do sleep 0.5 ATTEMPT=$((ATTEMPT + 1)) if [ $ATTEMPT -ge 120 ]; then - echo "gNodeB did not start after 60 seconds, exiting..." + echo "UE did not start after 60 seconds, exiting..." exit 1 fi done diff --git a/User_Equipment/stop.sh b/User_Equipment/stop.sh index 811f023..362cdaf 100755 --- a/User_Equipment/stop.sh +++ b/User_Equipment/stop.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/commit_hashes.json b/commit_hashes.json index 1377481..8148ffe 100644 --- a/commit_hashes.json +++ b/commit_hashes.json @@ -20,7 +20,7 @@ "https://gerrit.o-ran-sc.org/r/nonrtric/plt/ranpm.git": ["l-release", "b5f4f8698217ce70d3c2e6a454146fbcd2111d35"], "https://github.com/onap/multicloud-k8s.git": ["", "8bea0a13c223aff43f98f0cb6426379bb23e8894"], "https://gerrit.onap.org/r/oom.git": ["", "2f38164c1dfecae72b2632e2f1dee82454bd522c"], - "https://gerrit.o-ran-sc.org/r/portal/nonrtric-controlpanel.git": ["i-release", "fe9051bb91b524ff9cef5023a95dea7161d75388"], + "https://gerrit.o-ran-sc.org/r/portal/nonrtric-controlpanel.git": ["master", "f337177ece41c036967ece8513e9f29b07deca34"], "https://gerrit.o-ran-sc.org/r/nonrtric/plt/rappmanager.git": ["l-release", "67b12d9980ca0c14b9c054bba3aa6a9ee58bcbd3"], "https://gitlab.eurecom.fr/oai/openairinterface5g.git": ["develop", "fc1c762cf2d1390a1e21f4360c05a3d5fa5a090e"], "https://gitlab.eurecom.fr/oai/o1-adapter.git": ["main", "ce1399277ce04ac16c2021268233dc47a830656c"], diff --git a/full_install.sh b/full_install.sh index 4758b53..fe7f393 100755 --- a/full_install.sh +++ b/full_install.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") @@ -123,6 +123,9 @@ fi # Ensure backward compatibility with previous installations sudo ./Additional_Scripts/migrate_to_new_version.sh +# Ensure the correct YAML editor is installed +sudo "$SCRIPT_DIR/5G_Core_Network/install_scripts/./ensure_consistent_yq.sh" + echo echo echo "################################################################################" diff --git a/full_uninstall.sh b/full_uninstall.sh index 79121af..7fdf87d 100755 --- a/full_uninstall.sh +++ b/full_uninstall.sh @@ -51,7 +51,7 @@ fi APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi echo "Stopping 5G Core Network, srsRAN_Project, and srsRAN_4G..." diff --git a/generate_configurations.sh b/generate_configurations.sh index 12d5d73..d68489a 100755 --- a/generate_configurations.sh +++ b/generate_configurations.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/is_running.sh b/is_running.sh index d4603ce..7b584af 100755 --- a/is_running.sh +++ b/is_running.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/run.sh b/run.sh index 670af86..5255e3b 100755 --- a/run.sh +++ b/run.sh @@ -34,7 +34,7 @@ set -e APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")") diff --git a/stop.sh b/stop.sh index a6af7c1..5080dc1 100755 --- a/stop.sh +++ b/stop.sh @@ -31,7 +31,7 @@ APTVARS="NEEDRESTART_MODE=l NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive" if ! command -v realpath &>/dev/null; then echo "Package \"coreutils\" not found, installing..." - sudo $APTVARS apt-get install -y coreutils + sudo env $APTVARS apt-get install -y coreutils fi SCRIPT_DIR=$(dirname "$(realpath "$0")")