From 604628bcca6921d415ffc552b788f0c535d66f3b Mon Sep 17 00:00:00 2001 From: YousefEZ <45167695+YousefEZ@users.noreply.github.com> Date: Sun, 7 Apr 2024 23:45:40 +0300 Subject: [PATCH] :sparkles: experimenting things --- run_ns3.sh | 16 ++++++++-------- src/combined-baseline-udp.cc | 24 +++++++++++++++++------- src/combined-frr.cc | 31 +++++++++++++++++++++++-------- 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/run_ns3.sh b/run_ns3.sh index c3e399b6..61fffddd 100755 --- a/run_ns3.sh +++ b/run_ns3.sh @@ -38,8 +38,8 @@ echo "Delay Primary experiments" delay_vals=("0ms" "10ms" "20ms" "30ms" "40ms" "60ms" "80ms" "100ms") for delay_val in "${delay_vals[@]}"; do # echo "Delay Primary value: $delay_val" - for policy_number in 20 40 60 80 99; do - run_experiment "delay_primary" "$delay_val" "$policy_number" & + for policy_number in 20 40 60 80; do + false && run_experiment "delay_primary" "$delay_val" "$policy_number" & done done @@ -50,8 +50,8 @@ echo "Delay Alternate experiments" delay_vals=("0ms" "10ms" "20ms" "30ms" "40ms" "60ms" "80ms" "100ms") for delay_val in "${delay_vals[@]}"; do # echo "Delay Alternate value: $delay_val" - for policy_number in 20 40 60 80 99; do - run_experiment "delay_alternate" "$delay_val" "$policy_number" & + for policy_number in 20 40 60 80; do + false && run_experiment "delay_alternate" "$delay_val" "$policy_number" & done done @@ -59,10 +59,10 @@ wait # Bandwidth primary experiments echo "Bandwidth Primary experiments" -bandwidth_vals=("200Kbps" "225Kbps" "250Kbps" "275Kbps" "300Kbps" "325Kbps" "350Kbps" "375Kbps" "400Kbps") +bandwidth_vals=("1.5Mbps" "1.6Mbps" "1.7Mbps" "1.8Mbps" "1.9Mbps" "2.0Mbps" "2.1Mbps" "2.2Mbps" "2.3Mbps" "2.4Mbps" "2.5Mbps") for bandwidth_val in "${bandwidth_vals[@]}"; do # echo "Bandwidth Primary value: $bandwidth_vals" - for policy_number in 20 40 60 80 99; do + for policy_number in 20 40 60 80; do run_experiment "bandwidth_primary" "$bandwidth_val" "$policy_number" & done done @@ -74,8 +74,8 @@ echo "Bandwidth alternate experiments" bandwidth_vals=("200Kbps" "225Kbps" "250Kbps" "275Kbps" "300Kbps" "325Kbps" "350Kbps" "375Kbps" "400Kbps") for bandwidth_val in "${bandwidth_vals[@]}"; do # echo "Bandwidth Alternate value: $bandwidth_vals" - for policy_number in 20 40 60 80 99; do - run_experiment "bandwidth_alternate" "$bandwidth_val" "$policy_number" & + for policy_number in 20 40 60 80; do + false && run_experiment "bandwidth_alternate" "$bandwidth_val" "$policy_number" & done done diff --git a/src/combined-baseline-udp.cc b/src/combined-baseline-udp.cc index 65b5bc1e..43d1d715 100644 --- a/src/combined-baseline-udp.cc +++ b/src/combined-baseline-udp.cc @@ -70,7 +70,7 @@ uint32_t MTU_bytes = segmentSize + 54; // Topology parameters std::string bandwidth_primary = "2Mbps"; -std::string bandwidth_access = "1Mbps"; +std::string bandwidth_access = "1.5Mbps"; std::string bandwidth_udp_access = "1.5Mbps"; std::string delay_bottleneck = "20ms"; @@ -207,7 +207,17 @@ int main(int argc, char* argv[]) p2p_traffic.SetChannelAttribute("Delay", StringValue(delay_access)); // Set the custom queue for the device p2p_traffic.SetQueue("ns3::DropTailQueue"); - // Install devices and channels between nodes + // Install devices and channels + + ns3::DataRate rate(bandwidth_access); + ns3::DataRate splitRate(rate.GetBitRate() / number_of_tcp_senders); + + PointToPointHelper p2p_traffic_generator; + p2p_traffic_generator.SetDeviceAttribute("DataRate", StringValue(std::to_string(splitRate.GetBitRate()) + "bps")); + p2p_traffic_generator.SetChannelAttribute("Delay", StringValue(delay_access)); + // Set the custom queue for the device + p2p_traffic_generator.SetQueue("ns3::DropTailQueue"); + // PointToPointFRRHelper p2p_congested_link; PointToPointHelper p2p_congested_link; @@ -233,7 +243,7 @@ int main(int argc, char* argv[]) for (int i = 0; i < number_of_tcp_senders; i++) { tcp_senders.push_back( - p2p_traffic.Install(tcp_devices.Get(i), nodes.Get(1))); + p2p_traffic_generator.Install(tcp_devices.Get(i), nodes.Get(1))); } NetDeviceContainer devices_2_3 = @@ -313,7 +323,7 @@ int main(int argc, char* argv[]) BulkSendHelper tcp_source("ns3::TcpSocketFactory", InetSocketAddress(receiver_addr, tcp_port)); tcp_source.SetAttribute("MaxBytes", - UintegerValue(100000)); // 0 for unlimited data + UintegerValue(1000000)); // 0 for unlimited data tcp_source.SetAttribute("SendSize", UintegerValue(1024)); // Packet size in bytes @@ -321,7 +331,7 @@ int main(int argc, char* argv[]) tcp_apps.push_back(tcp_source.Install(tcp_devices.Get(i))); tcp_apps.back().Start(Seconds(0.0)); - tcp_apps.back().Stop(Seconds(10.0)); + tcp_apps.back().Stop(Seconds(60.0)); } // Packet sink setup (Receiver node) @@ -329,14 +339,14 @@ int main(int argc, char* argv[]) InetSocketAddress(Ipv4Address::GetAny(), tcp_port)); ApplicationContainer sink_app = sink.Install(nodes.Get(4)); sink_app.Start(Seconds(0.0)); - sink_app.Stop(Seconds(20.0)); + sink_app.Stop(Seconds(60.0)); PacketSinkHelper udp_sink( "ns3::UdpSocketFactory", InetSocketAddress(Ipv4Address::GetAny(), udp_port)); ApplicationContainer udp_sink_app = udp_sink.Install(nodes.Get(4)); udp_sink_app.Start(Seconds(0.0)); - udp_sink_app.Stop(Seconds(20.0)); + udp_sink_app.Stop(Seconds(60.0)); // p2p_traffic.EnablePcapAll(dir); // p2p_congestion.EnablePcapAll(dir); diff --git a/src/combined-frr.cc b/src/combined-frr.cc index a992a75b..7a5d140c 100644 --- a/src/combined-frr.cc +++ b/src/combined-frr.cc @@ -1,4 +1,6 @@ #include +#include + #include "ns3/core-module.h" #include "ns3/network-module.h" @@ -70,7 +72,7 @@ uint32_t MTU_bytes = segmentSize + 54; // Topology parameters std::string bandwidth_primary = "2Mbps"; -std::string bandwidth_access = "1Mbps"; +std::string bandwidth_access = "1.5Mbps"; std::string bandwidth_udp_access = "1.5Mbps"; std::string delay_bottleneck = "20ms"; @@ -181,7 +183,20 @@ int main(int argc, char* argv[]) p2p_traffic.SetChannelAttribute("Delay", StringValue(delay_access)); // Set the custom queue for the device p2p_traffic.SetQueue("ns3::DropTailQueue"); - // Install devices and channels between nodes + // Install devices and channels between nodes + + + ns3::DataRate rate(bandwidth_access); + ns3::DataRate splitRate(rate.GetBitRate() / number_of_tcp_senders); + + std::cout << "rate is: " << splitRate.GetBitRate() << std::endl; + + PointToPointHelper p2p_traffic_generator; + p2p_traffic_generator.SetDeviceAttribute("DataRate", StringValue(std::to_string(splitRate.GetBitRate()) + "bps")); + p2p_traffic_generator.SetChannelAttribute("Delay", StringValue(delay_access)); + // Set the custom queue for the device + p2p_traffic_generator.SetQueue("ns3::DropTailQueue"); + PointToPointFRRHelper p2p_congested_link; // PointToPointHelper p2p_congested_link; @@ -193,7 +208,7 @@ int main(int argc, char* argv[]) // p2p_congested_link.SetQueue("ns3::DropTailQueue"); Config::SetDefault("ns3::DropTailQueue::MaxSize", - StringValue("10p")); + StringValue("1000p")); Config::SetDefault(SimulationQueue::getQueueString() + "::MaxSize", StringValue("10p")); @@ -207,7 +222,7 @@ int main(int argc, char* argv[]) for (int i = 0; i < number_of_tcp_senders; i++) { tcp_senders.push_back( - p2p_traffic.Install(tcp_devices.Get(i), nodes.Get(1))); + p2p_traffic_generator.Install(tcp_devices.Get(i), nodes.Get(1))); } NetDeviceContainer devices_2_3 = @@ -288,7 +303,7 @@ int main(int argc, char* argv[]) BulkSendHelper tcp_source("ns3::TcpSocketFactory", InetSocketAddress(receiver_addr, tcp_port)); tcp_source.SetAttribute("MaxBytes", - UintegerValue(100000)); // 0 for unlimited data + UintegerValue(1000000)); // 0 for unlimited data tcp_source.SetAttribute("SendSize", UintegerValue(1024)); // Packet size in bytes @@ -296,7 +311,7 @@ int main(int argc, char* argv[]) tcp_apps.push_back(tcp_source.Install(tcp_devices.Get(i))); tcp_apps.back().Start(Seconds(0.0)); - tcp_apps.back().Stop(Seconds(10.0)); + tcp_apps.back().Stop(Seconds(60.0)); } // Packet sink setup (Receiver node) @@ -304,14 +319,14 @@ int main(int argc, char* argv[]) InetSocketAddress(Ipv4Address::GetAny(), tcp_port)); ApplicationContainer sink_app = sink.Install(nodes.Get(4)); sink_app.Start(Seconds(0.0)); - sink_app.Stop(Seconds(20.0)); + sink_app.Stop(Seconds(60.0)); PacketSinkHelper udp_sink( "ns3::UdpSocketFactory", InetSocketAddress(Ipv4Address::GetAny(), udp_port)); ApplicationContainer udp_sink_app = udp_sink.Install(nodes.Get(4)); udp_sink_app.Start(Seconds(0.0)); - udp_sink_app.Stop(Seconds(20.0)); + udp_sink_app.Stop(Seconds(60.0)); // LFA Alternate Path setup // Set up an alternate forwarding target, assuming you have an alternate