Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

To enable QoS-OLSR in MS2.0 #347

Merged
merged 4 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions common/scripts/mesh-11s_nats.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

source ./qos_olsrd_conf.sh
is_interface() {
# arguments:
# $1 = interface name
Expand Down Expand Up @@ -343,7 +343,8 @@ EOF
modprobe batman-adv
fi
elif [ "$routing_algo" == "olsr" ]; then
mesh_kill "[o]lsrd -i $wifidev -d 0"
#mesh_kill "[o]lsrd -i $wifidev -d 0"
stop_olsrd "$id0_MESH_VIF"
fi

echo "$wifidev down.."
Expand Down Expand Up @@ -393,7 +394,8 @@ EOF
elif [ "$routing_algo" == "olsr" ]; then
ifconfig "$wifidev" "$ipaddr" netmask "$nmask"
# Enable debug level as necessary
(olsrd -i "$wifidev" -d 0)&
#(olsrd -i "$wifidev" -d 0)&
start_olsrd "$id0_MESH_VIF"
fi

#SLAAC immediately after basic setup
Expand Down Expand Up @@ -683,7 +685,7 @@ main () {
bridge_ip=$bridge_ip
calculate_network_address "$bridge_ip" "$nmask"
fi
if [ $mptcp == "enable" ]; then
if [ "$mptcp" == "enable" ]; then
echo "MPTCP enabled"
if ! [ -f /var/run/mptcp.conf ]; then
echo "SUBFLOWS=0" > /var/run/mptcp.conf
Expand Down
61 changes: 61 additions & 0 deletions common/scripts/qos_olsrd_conf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

get_ipv6_address() {
local interface="$1"

# Use ifconfig to get the IPv6 address of the specified interface
local ipv6_address=$(ifconfig "$interface" | grep 'inet6' | awk '{print $2}')

# Print the IPv6 address
echo "IPv6 address of $interface: $ipv6_address"


# Example usage
desired_interface=$1
get_ipv6_address "$desired_interface"
}



start_olsrd() {
INTERFACE="$1"
PID_FILE="/run/olsrd-$INTERFACE.pid"
CONFIG_FILE="/etc/olsrd/$INTERFACE.conf"

echo "Testing in OLSR"

cat > "$CONFIG_FILE" <<- EOF
LinkQualityFishEye 0

Interface "$INTERFACE"
{
}

IpVersion 6
LinkQualityFishEye 0
LinkQualityAlgorithm "etx_ffeth_nl80211"

LoadPlugin "/usr/lib/olsrd_arprefresh.so.0.1"
{
}
EOF

# Use start-stop-daemon to start the OLSR daemon
start-stop-daemon --start --background --make-pidfile --pidfile "$PID_FILE" \
--exec /usr/sbin/qos-olsrd -- -i "$INTERFACE" -d 0 -f "$CONFIG_FILE"
}


stop_olsrd() {
INTERFACE="$1"
PID_FILE="/run/olsrd-$INTERFACE.pid"

if [ -e "$PID_FILE" ]; then
echo "Stopping OLSR daemon for $INTERFACE using start-stop-daemon"
start-stop-daemon --stop --pidfile "$PID_FILE"
rm -f "$PID_FILE" # Remove the PID file after stopping the daemon
else
echo "PID file $PID_FILE not found. OLSR daemon may not be running."
fi
}

80 changes: 80 additions & 0 deletions common/tests/functional/Test-throughput.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash
#Francis
if ! [ -x "$(type -P iperf3)" ]; then
echo "ERROR: script requires iperf3"
echo "For Debian and friends get it with 'apt-get install iperf3'"
echo "If you have it, perhaps you don't have permissions to run it, try 'sudo $(basename $0)'"
exit 1
fi

if [ "$#" -ne "2" ]; then
echo "ERROR: script needs four arguments, where:"
echo
echo "1. Number of times to repeat test (e.g. 10)"
echo "2. Host running 'iperf3 -s' (e.g. somehost)"
echo
echo "Example:"
echo " $(basename $0) 10 somehost"
echo
echo "The above will run 'iperf3 -c' 10 times on the client and report totals and average."
exit 1
else
runs=$1
host=$2
fi

log=qos_olsr.txt

if [ -f "$log" ]; then
echo removing $log
rm $log
francislin12 marked this conversation as resolved.
Show resolved Hide resolved
fi

echo "=================================================================="
echo " Results"
echo "=================================================================="
echo " target host .... $host"
echo "------------------------------------------------------------------"

for run in $(seq 1 $runs); do
iperf3 -c $host -f m >> $log
echo -e " run $run: \t $(awk '/Bitrate/ {getline}; END{print $7, $8}' $log)"
done


echo
echo "see $log for details"

#######################################################################
# Define the file path
file_path="$log"

# Check if the file exists
if [ -f "$file_path" ]; then
# Use grep and awk to extract Bitrate from the receiver line in the file
average_bitrate=$(awk '/receiver/ {sum += $7; count++} END {if (count > 0) print sum/count}' "$file_path")

# Check if the value was found
if [ -n "$average_bitrate" ]; then
echo "average_bitrate: $average_bitrate Mbits/sec"
else
echo "average_bitrate receiver not found in the file."
fi
else
echo "File not found: $file_path"
fi



########################################################################
if [ -n "$average_bitrate" ]; then
# Compare the Bitrate value with 25
if (( $(echo "$average_bitrate > 25" | bc -l) )); then
echo "Average Bitrate receiver: $average_bitrate Mbits/sec - Pass"
else
echo "Bitrate receiver: $average_bitrate Mbits/sec - Fail"
fi
fi



2 changes: 1 addition & 1 deletion modules/utils/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ MCC_SETTINGS="$MESH_FOLDER/modules/utils/docker/mcc_settings.sh" # script to set
MESH_CONF="/opt/mesh.conf"


QOS_OLSR_CONF="$MESH_FOLDER/modules/utils/docker/qos_olsrd_conf.sh" # script to setup qos_olsrd_cochmod +x $BRIDGE_SETTINGS
QOS_OLSR_CONF="$MESH_FOLDER/qos_olsrd_conf.sh" # script to setup qos_olsrd_cochmod +x $BRIDGE_SETTINGS
chmod +x $BRIDGE_SETTINGS
chmod +x $MCC_SETTINGS
chmod +x $QOS_OLSR_CONF
Expand Down
Loading