IPv4 routing table call function in pythoh bindings

99 views
Skip to first unread message

yang li

unread,
Apr 18, 2024, 6:30:07 AM4/18/24
to ns-3-users
Hello, dear all experts

It seems like the method to utilise IPv4 route helper to print out routing table can be :

   // Trace routing tables
    Ptr<OutputStreamWrapper> routingStream =
        Create<OutputStreamWrapper>("dynamic-global-routing.routes", std::ios::out);
    Ipv4RoutingHelper::PrintRoutingTableAllAt(Seconds(10), routingStream);
or
   Ipv4RoutingHelper::PrintRoutingTableAllEvery(Seconds(0.5), routingStream);


According to example from the source code, however, I tried to use python bindings to generate the routing table also, but I can not convert them based on my experience:

routingStream =ueNodes.GetObject[ns.core.OutputStreamWrapper]().__deref__()

ipv4RoutingHelper.PrintRoutingTableAllAt(ns.core.Seconds(10), routingStream)



Any instructions or advice would be grateful since routing table is a really good method to identify the transmission flow here.

yang li

unread,
Apr 19, 2024, 7:30:39 AM4/19/24
to ns-3-users
Hi, I bring some update


It seems like the outsreamwrapper should be correct, but somehow the time can not be converted to acceptable format in python bindings, which I do have clue what the type of time format
is this printingroutingtableallat() expecting from the program:

AsciiTraceHelper=ns.CreateObject("AsciiTraceHelper")

routingStream = AsciiTraceHelper.CreateFileStream("ttttttt.routes")

# Create a Time object for printing the routing table at 10 seconds
print_time = ns.core.Time(ns.core.Seconds(10.0))

# Print the routing table at the specified time
ipv4RoutingHelper.PrintRoutingTableAllAt(print_time, routingStream)

#####
ns.core.Simulator.Run()



flowresults()

ns.core.Simulator.Destroy()


Gabriel Ferreira

unread,
Apr 20, 2024, 5:47:58 AM4/20/24
to ns-3-users
Can you attach the entire script code? Makes my life easier

yang li

unread,
Apr 22, 2024, 3:41:20 AM4/22/24
to ns-3-users
Hello, drear Gabriel

I apologise for incomplete information here, I will attach my major program file (draft 44) and dataset to generate the mobility for nodes (full-data-set.csv)

I am actually also trying to get Netanim file, it seems like it could generate a XML file with my simulation, but basically the output file does not have many measurements, it seems like I need to set the position of nodes also, but trying to work on how my nodes with racing car dataset can be done by Netanim.
full-data-set.csv
draft44LTE-EX2-visu2-routing.py

yang li

unread,
Apr 29, 2024, 6:08:32 AM4/29/24
to ns-3-users
Hello, dear experts

I wonder if there are some methods to understand the routing flows by reading the flowmonitor output file,

I also tried to use Netanim to figure out how the data flows from one UE to another one.

I attached the measure file so you could check what it is going on in my project traffic

yang li

unread,
Apr 29, 2024, 6:54:55 AM4/29/24
to ns-3-users
measure-public.xml
Reply all
Reply to author
Forward
0 new messages