42 @param self this object
43 @param visualizer visualizer object
44 @param node_index the node index
46 InformationWindow.__init__(self)
47 self.
win = Gtk.Dialog(
48 parent=visualizer.window,
49 flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
50 buttons=(
"_Close", Gtk.ResponseType.CLOSE),
53 self.
win.set_title(
"IPv4 routing table for node %i" % node_index)
61 sw = Gtk.ScrolledWindow()
63 hscrollbar_policy=Gtk.PolicyType.AUTOMATIC, vscrollbar_policy=Gtk.PolicyType.AUTOMATIC
68 self.
win.set_default_size(600, 300)
71 column = Gtk.TreeViewColumn(
74 treeview.append_column(column)
77 column = Gtk.TreeViewColumn(
"Next hop", Gtk.CellRendererText(), text=self.
COLUMN_NEXT_HOP)
78 treeview.append_column(column)
81 column = Gtk.TreeViewColumn(
"Interface", Gtk.CellRendererText(), text=self.
COLUMN_INTERFACE)
82 treeview.append_column(column)
85 column = Gtk.TreeViewColumn(
"Type", Gtk.CellRendererText(), text=self.
COLUMN_TYPE)
86 treeview.append_column(column)
89 column = Gtk.TreeViewColumn(
"Prio", Gtk.CellRendererText(), text=self.
COLUMN_PRIO)
90 treeview.append_column(column)
109 @param self this object
113 ipv4 = node.GetObject[ns.Ipv4]().__deref__()
114 routing = ipv4.GetRoutingProtocol()
118 routing_protocols = []
120 if isinstance(routing, ns.Ipv4StaticRouting):
121 ipv4_routing = routing_protocols.append((routing,
"static", 0))
122 elif isinstance(routing, ns.Ipv4ListRouting):
123 list_routing = routing
124 for rI
in range(list_routing.GetNRoutingProtocols()):
125 routing, prio = list_routing.GetRoutingProtocol(rI)
126 if isinstance(routing, ns.Ipv4StaticRouting):
127 routing_protocols.append((routing,
"static", prio))
128 elif isinstance(routing, ns.Ipv4GlobalRouting):
129 routing_protocols.append((routing,
"global", prio))
130 if not routing_protocols:
134 for route_proto, type_string, prio
in routing_protocols:
135 for routeI
in range(route_proto.GetNRoutes()):
136 route = route_proto.GetRoute(routeI)
138 netdevice = ipv4.GetNetDevice(route.GetInterface())
139 if netdevice
is None:
140 interface_name =
"lo"
142 interface_name = ns.Names.FindName(netdevice)
143 if not interface_name:
144 interface_name =
"(interface %i)" % route.GetInterface()
148 str(route.GetDest()),
150 str(route.GetGateway()),