diff --git a/entrypoint.sh b/entrypoint.sh index 369c787c..6d49bcd4 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,10 +1,11 @@ #!/bin/bash echo "Simulating ns3 on file: $1" +rm -rf traces/ +mkdir traces cp user_src/* scratch/ export NS_LOG=FRRQueue=level_all -./ns3 build -./ns3 run "scratch/$1" > traces/output.log 2>&1 - +./ns3 build +./ns3 run "scratch/$1" >traces/output.log 2>&1 diff --git a/format.sh b/format.sh old mode 100644 new mode 100755 index d26dc5c8..704e3bce --- a/format.sh +++ b/format.sh @@ -1 +1,3 @@ +#!/bin/bash + find . -regex '.*\.\(cpp\|hpp\|cc\|cxx\|h\)' -exec clang-format -style=file -i {} \; diff --git a/src/lfa.cc b/src/lfa.cc index 392b8749..6057e5ac 100644 --- a/src/lfa.cc +++ b/src/lfa.cc @@ -8,11 +8,14 @@ #include "ns3/point-to-point-module.h" #include "ns3/traffic-control-module.h" + +#include "../libs/frr_queue.h" #include "../libs/dummy_congestion_policy.h" #include "../libs/frr_queue.h" #include "../libs/lfa_policy.h" #include "../libs/modulo_congestion_policy.h" + using namespace ns3; NS_LOG_COMPONENT_DEFINE("CongestionFastReRoute"); @@ -77,6 +80,7 @@ void InstallBulkSend(Ptr node, Ipv4Address address, uint16_t port, // nullptr); } + int main(int argc, char* argv[]) { // TCP Recovery Algorithm @@ -115,6 +119,7 @@ int main(int argc, char* argv[]) nodes.Create(3); Names::Add("Node0", nodes.Get(0)); + InternetStackHelper stack; stack.Install(nodes); @@ -183,6 +188,7 @@ int main(int argc, char* argv[]) // ApplicationContainer app = onoff.Install(nodes.Get(0)); // app.Start(Seconds(1.0)); // app.Stop(Seconds(10.0)); + // Set up an alternate forwarding target, assuming you have an alternate // path configured @@ -195,12 +201,14 @@ int main(int argc, char* argv[]) setAlternateTarget<1>(devices02, getDevice<1>(devices12)); setAlternateTarget<1>(devices12, getDevice<1>(devices02)); + p2p.EnablePcapAll("traces/"); /* Install BulkSend application */ InstallBulkSend(nodes.Get(0), interfaces01.GetAddress(1), 5000, "ns3::TcpSocketFactory", 2, 0, nullptr, 1000, Seconds(0.2)); + Simulator::Run(); Simulator::Destroy(); diff --git a/src/lfa_random.cc b/src/lfa_random.cc index 2d1fc742..6883fbfa 100644 --- a/src/lfa_random.cc +++ b/src/lfa_random.cc @@ -7,6 +7,8 @@ #include "ns3/network-module.h" #include "ns3/point-to-point-module.h" + +#include "../libs/frr_queue.h" #include "../libs/dummy_congestion_policy.h" #include "../libs/frr_queue.h" #include "../libs/lfa_policy.h"