Bugzilla – Bug 809
Missing Python binding for Ipv4GlobalRouting::GetRoute
Last modified: 2010-02-10 10:14:12 UTC
Created attachment 757 [details] Modified from the tutorial Python bindings for some functions are not generated. An example is: Ipv4GlobalRouting:: Ipv4RoutingTableEntry *GetRoute (uint32_t i); Running the attached first.py (modified from the tutorial) gives the following error: <ns3.Ipv4GlobalRouting object at 0x8aca4ec> Traceback (most recent call last): File "first.py", line 68, in <module> rtentry = rtproto.GetRoute(i) AttributeError: 'ns3.Ipv4GlobalRouting' object has no attribute 'GetRoute' Doing a dir() on the object reveals that it indeed does not have GetRoute() dir(ns3.Ipv4GlobalRouting) ['AddASExternalRouteTo', 'AddHostRouteTo', 'AddNetworkRouteTo', 'AggregateIterator', 'AggregateObject', 'Cleanup', 'Dispose', 'GetAggregateIterator', 'GetAttribute', 'GetAttributeFailSafe', 'GetInstanceTypeId', 'GetNRoutes', 'GetObject', 'GetTypeId', 'NotifyAddAddress', 'NotifyInterfaceDown', 'NotifyInterfaceUp', 'NotifyRemoveAddress', 'RemoveRoute', 'RouteOutput', 'SetAttribute', 'SetAttributeFailSafe', 'SetIpv4', 'Start', 'TraceConnect', 'TraceConnectWithoutContext', 'TraceDisconnect', 'TraceDisconnectWithoutContext', '_DoDispose', '_DoStart', '_GetInstanceTypeId', '_NotifyConstructionCompleted', '_NotifyNewAggregate', '__class__', '__copy__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__'] Digging around further, I found ns-3.7/build/debug/bindings/python/ns3modulegen.log which has several hundred errors, including one for the GetRoute() method, which is a blocker for me. The build should not silently fail. Rescanning python bindings made no difference to the outcome.
Python bindings will always be a bit incomplete due to lack of manpower. Re-titling. The problem is due to the lack of annotation specifying caller_owns_return=True/False.
Fixed in ns-3-dev: http://code.nsnam.org/ns-3-dev/rev/7929ba7d13bd
(In reply to comment #2) > Fixed in ns-3-dev: http://code.nsnam.org/ns-3-dev/rev/7929ba7d13bd Thanks for fixing this. There are many other errors though as can be seen in ns-3.7/build/debug/bindings/python/ns3modulegen.log. Thats why my title was more general. If the python bindings will always be a little incomplete, it would be helpful to put this caveat out in some easy to find place. I did not come across it in the manual/tutorial/wiki/an_open_bug_report. thanks
I'm sorry, but it takes a huge amount of effort to get 100% coverage and so it is not even a goal of the project. But I've now mentioned this in the Caveats section of the python bindings wiki page.