Skip to content

Commit

Permalink
Merge pull request #27 from YousefEZ/param-changes
Browse files Browse the repository at this point in the history
Param changes combined with multiple flow cmds
  • Loading branch information
charliebarber authored Apr 6, 2024
2 parents 8bfe467 + 24895e0 commit e976be9
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 261 deletions.
95 changes: 0 additions & 95 deletions run_experiments.sh

This file was deleted.

4 changes: 2 additions & 2 deletions run_ns3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ done

# Bandwidth primary experiments
echo "Bandwidth Primary experiments"
bandwidth_vals=("75Kbps" "100Kbps" "125Kbps" "150Kbps" "175Kbps" "200Kbps" "225Kbps" "250Kbps" "275Kbps" "300Kbps")
bandwidth_vals=("200Kbps" "225Kbps" "250Kbps" "275Kbps" "300Kbps" "325Kbps" "350Kbps" "375Kbps" "400Kbps")
for bandwidth_val in "${bandwidth_vals[@]}"; do
echo "Bandwidth Primary value: $bandwidth_vals"
for policy_number in 20 40 60 80 99; do
Expand All @@ -54,7 +54,7 @@ done

# Bandwidth alternate experiments
echo "Bandwidth alternate experiments"
bandwidth_vals=("75Kbps" "100Kbps" "125Kbps" "150Kbps" "175Kbps" "200Kbps" "225Kbps" "250Kbps" "275Kbps" "300Kbps")
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
Expand Down
47 changes: 20 additions & 27 deletions src/combined-baseline-no-udp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ uint32_t segmentSize = 1024;
uint32_t MTU_bytes = segmentSize + 54;

// Topology parameters
std::string bandwidth_bottleneck = "150Kbps";
std::string bandwidth_access = "600kbps";
std::string bandwidth_primary = "300Kbps";
std::string bandwidth_access = "200kbps";
std::string bandwidth_udp_access = "100kbps";
std::string delay_bottleneck = "20ms";
std::string delay_access = "20ms";
std::string delay_alternate = "100ms";
std::string bandwidth_alternate = "600kbps";
std::string delay_alternate = "20ms";
std::string bandwidth_alternate = "300kbps";

void SetupTCPConfig()
{
Expand All @@ -59,22 +59,21 @@ void SetupTCPConfig()

void CalculateExpectedPackets(uint32_t tcp_max_bytes, DataRate udp_data_rate)
{
DataRate bandwidth_bottleneck_dr(bandwidth_bottleneck);
DataRate bandwidth_primary_dr(bandwidth_primary);
DataRate bandwidth_access_dr(bandwidth_access);
Time bottleneck_delay_t(delay_bottleneck);
Time access_delay_t(delay_access);

// Serialization delay ~2ms
Time serialization_delay_t(
(1024 + 54) /
(std::min(bandwidth_bottleneck_dr, bandwidth_access_dr).GetBitRate()));
(std::min(bandwidth_primary_dr, bandwidth_access_dr).GetBitRate()));

uint32_t max_bottleneck_tcp_bytes = static_cast<uint32_t>(
((std::min(bandwidth_access_dr, bandwidth_bottleneck_dr).GetBitRate() /
8) *
(((access_delay_t * 2) + bottleneck_delay_t) * 2 +
serialization_delay_t)
.GetSeconds()));
uint32_t max_bottleneck_tcp_bytes = static_cast<uint32_t>((
(std::min(bandwidth_access_dr, bandwidth_primary_dr).GetBitRate() / 8) *
(((access_delay_t * 2) + bottleneck_delay_t) * 2 +
serialization_delay_t)
.GetSeconds()));

uint32_t expected_tcp_packets =
std::ceil(max_bottleneck_tcp_bytes / (1024 + 54));
Expand All @@ -89,8 +88,7 @@ int main(int argc, char* argv[])
int number_of_tcp_senders = 1;
std::string dir = "";
CommandLine cmd;
cmd.AddValue("bandwidth_primary", "Bandwidth primary",
bandwidth_bottleneck);
cmd.AddValue("bandwidth_primary", "Bandwidth primary", bandwidth_primary);
cmd.AddValue("bandwidth_access", "Bandwidth Access", bandwidth_access);
cmd.AddValue("bandwidth_udp_access", "Bandwidth UDP Access",
bandwidth_udp_access);
Expand Down Expand Up @@ -167,7 +165,7 @@ int main(int argc, char* argv[])
// PointToPointFRRHelper<FRRPolicy> p2p_congested_link;
PointToPointHelper p2p_congested_link;
p2p_congested_link.SetDeviceAttribute("DataRate",
StringValue(bandwidth_bottleneck));
StringValue(bandwidth_primary));
p2p_congested_link.SetChannelAttribute("Delay",
StringValue(delay_bottleneck));
p2p_congested_link.SetQueue("ns3::DropTailQueue<Packet>");
Expand Down Expand Up @@ -232,7 +230,7 @@ int main(int argc, char* argv[])
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
// Receiver address
Ipv4Address receiver_addr = interfaces_3_5.GetAddress(1);
std::cout << receiver_addr << std::endl;

// UDP Congestion traffic setup
uint16_t udp_port = 50001;
OnOffHelper udp_source("ns3::UdpSocketFactory",
Expand All @@ -246,11 +244,11 @@ int main(int argc, char* argv[])
udp_source.SetAttribute("PacketSize", UintegerValue(1024));

// ApplicationContainer udp_app = udp_source.Install(nodes.Get(0));
// udp_app.Start(Seconds(0.0));
// udp_app.Stop(Seconds(5.0));
// udp_app.Start(Seconds(2.0));
// udp_app.Stop(Seconds(10.0));

DataRate b_access(bandwidth_access);
DataRate b_bottleneck(bandwidth_bottleneck);
DataRate b_bottleneck(bandwidth_primary);
Time d_access(delay_access);
Time d_bottleneck(delay_bottleneck);
Time d_serialization("1.9ms");
Expand All @@ -270,27 +268,22 @@ 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(5.0));
tcp_apps.back().Stop(Seconds(10.0));
}

// Packet sink setup (Receiver node)
PacketSinkHelper sink("ns3::TcpSocketFactory",
InetSocketAddress(Ipv4Address::GetAny(), tcp_port));
ApplicationContainer sink_app = sink.Install(nodes.Get(4));
sink_app.Start(Seconds(0.0));
sink_app.Stop(Seconds(10.0));
sink_app.Stop(Seconds(20.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(10.0));
// SimulationQueue::sinkAddress =
// Mac48Address::ConvertFrom(getDevice<1>(devices_3_5)->GetAddress());
// NOTE: Is TrafficControlHelper needed here?

// CalculateExpectedPackets(10000, DataRate("1Mbps"));
udp_sink_app.Stop(Seconds(20.0));

p2p_traffic.EnablePcapAll(dir);
p2p_congestion.EnablePcapAll(dir);
Expand Down
64 changes: 19 additions & 45 deletions src/combined-baseline-udp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ uint32_t segmentSize = 1024;
uint32_t MTU_bytes = segmentSize + 54;

// Topology parameters
std::string bandwidth_bottleneck = "150Kbps";
std::string bandwidth_access = "600kbps";
std::string bandwidth_primary = "300Kbps";
std::string bandwidth_access = "200kbps";
std::string bandwidth_udp_access = "100kbps";
std::string delay_bottleneck = "20ms";
std::string delay_access = "20ms";
std::string delay_alternate = "100ms";
std::string bandwidth_alternate = "600kbps";
std::string delay_alternate = "20ms";
std::string bandwidth_alternate = "300kbps";

void SetupTCPConfig()
{
Expand All @@ -102,22 +102,21 @@ void SetupTCPConfig()

void CalculateExpectedPackets(uint32_t tcp_max_bytes, DataRate udp_data_rate)
{
DataRate bandwidth_bottleneck_dr(bandwidth_bottleneck);
DataRate bandwidth_primary_dr(bandwidth_primary);
DataRate bandwidth_access_dr(bandwidth_access);
Time bottleneck_delay_t(delay_bottleneck);
Time access_delay_t(delay_access);

// Serialization delay ~2ms
Time serialization_delay_t(
(1024 + 54) /
(std::min(bandwidth_bottleneck_dr, bandwidth_access_dr).GetBitRate()));
(std::min(bandwidth_primary_dr, bandwidth_access_dr).GetBitRate()));

uint32_t max_bottleneck_tcp_bytes = static_cast<uint32_t>(
((std::min(bandwidth_access_dr, bandwidth_bottleneck_dr).GetBitRate() /
8) *
(((access_delay_t * 2) + bottleneck_delay_t) * 2 +
serialization_delay_t)
.GetSeconds()));
uint32_t max_bottleneck_tcp_bytes = static_cast<uint32_t>((
(std::min(bandwidth_access_dr, bandwidth_primary_dr).GetBitRate() / 8) *
(((access_delay_t * 2) + bottleneck_delay_t) * 2 +
serialization_delay_t)
.GetSeconds()));

uint32_t expected_tcp_packets =
std::ceil(max_bottleneck_tcp_bytes / (1024 + 54));
Expand All @@ -132,8 +131,7 @@ int main(int argc, char* argv[])
int number_of_tcp_senders = 1;
std::string dir = "";
CommandLine cmd;
cmd.AddValue("bandwidth_primary", "Bandwidth primary",
bandwidth_bottleneck);
cmd.AddValue("bandwidth_primary", "Bandwidth primary", bandwidth_primary);
cmd.AddValue("bandwidth_access", "Bandwidth Access", bandwidth_access);
cmd.AddValue("bandwidth_udp_access", "Bandwidth UDP Access",
bandwidth_udp_access);
Expand Down Expand Up @@ -211,7 +209,7 @@ int main(int argc, char* argv[])
// PointToPointFRRHelper<FRRPolicy> p2p_congested_link;
PointToPointHelper p2p_congested_link;
p2p_congested_link.SetDeviceAttribute("DataRate",
StringValue(bandwidth_bottleneck));
StringValue(bandwidth_primary));
p2p_congested_link.SetChannelAttribute("Delay",
StringValue(delay_bottleneck));
// p2p_congested_link.SetQueue(SimulationQueue::getQueueString());
Expand Down Expand Up @@ -294,11 +292,11 @@ int main(int argc, char* argv[])
udp_source.SetAttribute("PacketSize", UintegerValue(1024));

ApplicationContainer udp_app = udp_source.Install(nodes.Get(0));
udp_app.Start(Seconds(0.0));
udp_app.Stop(Seconds(5.0));
udp_app.Start(Seconds(2.0));
udp_app.Stop(Seconds(10.0));

DataRate b_access(bandwidth_access);
DataRate b_bottleneck(bandwidth_bottleneck);
DataRate b_bottleneck(bandwidth_primary);
Time d_access(delay_access);
Time d_bottleneck(delay_bottleneck);
Time d_serialization("1.9ms");
Expand All @@ -318,47 +316,23 @@ 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(5.0));
tcp_apps.back().Stop(Seconds(10.0));
}

// Packet sink setup (Receiver node)
PacketSinkHelper sink("ns3::TcpSocketFactory",
InetSocketAddress(Ipv4Address::GetAny(), tcp_port));
ApplicationContainer sink_app = sink.Install(nodes.Get(4));
sink_app.Start(Seconds(0.0));
sink_app.Stop(Seconds(10.0));
sink_app.Stop(Seconds(20.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(10.0));
// SimulationQueue::sinkAddress =
// Mac48Address::ConvertFrom(getDevice<1>(devices_3_5)->GetAddress());
// NOTE: Is TrafficControlHelper needed here?
udp_sink_app.Stop(Seconds(20.0));

// CalculateExpectedPackets(10000, DataRate("1Mbps"));

// LFA Alternate Path setup
// Set up an alternate forwarding target, assuming you have an alternate
// path configured

// TODO: Need some help with setting alternate target
// setAlternateTarget<0>(
// devices_2_3, getDevice<0, ns3::PointToPointNetDevice>(devices_2_4));
// setAlternateTarget<1>(
// devices_2_3, getDevice<1, ns3::PointToPointNetDevice>(devices_4_3));
// setAlternateTarget<0>(devices01, getDevice<0>(devices02));
// setAlternateTarget<0>(devices02, getDevice<0>(devices01));

// setAlternateTarget<0>(devices12, getDevice<1>(devices01));
// setAlternateTarget<1>(devices01, getDevice<0>(devices12));

// setAlternateTarget<1>(devices02, getDevice<1>(devices12));
// setAlternateTarget<1>(devices12, getDevice<1>(devices02));

// enableRerouting(getQueue<0>(devices_2_3));
p2p_traffic.EnablePcapAll(dir);
p2p_congestion.EnablePcapAll(dir);

Expand Down
Loading

0 comments on commit e976be9

Please sign in to comment.