1from gi.repository 
import Gtk
 
   26        @param self this object
 
   27        @param visualizer visualizer object
 
   28        @param node_index the node index
 
   30        InformationWindow.__init__(self) 
   31        self.win = Gtk.Dialog(parent=visualizer.window, 
   32                              flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, 
   33                              buttons=("_Close", Gtk.ResponseType.CLOSE))
 
   35        self.
win.set_title(
"IPv4 routing table for node %i" % node_index)
 
   43        sw = Gtk.ScrolledWindow()
 
   44        sw.set_properties(hscrollbar_policy=Gtk.PolicyType.AUTOMATIC,
 
   45                          vscrollbar_policy=Gtk.PolicyType.AUTOMATIC)
 
   49        self.
win.set_default_size(600, 300)
 
   52        column = Gtk.TreeViewColumn(
'Destination', Gtk.CellRendererText(),
 
   53                                    text=self.COLUMN_DESTINATION)
 
   54        treeview.append_column(column)
 
   57        column = Gtk.TreeViewColumn(
'Next hop', Gtk.CellRendererText(),
 
   58                                    text=self.COLUMN_NEXT_HOP)
 
   59        treeview.append_column(column)
 
   62        column = Gtk.TreeViewColumn(
'Interface', Gtk.CellRendererText(),
 
   63                                    text=self.COLUMN_INTERFACE)
 
   64        treeview.append_column(column)
 
   67        column = Gtk.TreeViewColumn(
'Type', Gtk.CellRendererText(),
 
   68                                    text=self.COLUMN_TYPE)
 
   69        treeview.append_column(column)
 
   72        column = Gtk.TreeViewColumn(
'Prio', Gtk.CellRendererText(),
 
   73                                    text=self.COLUMN_PRIO)
 
   74        treeview.append_column(column)
 
   81        Response callback function 
   82        @param self this object
 
   84        @param response the response
 
   88        self.visualizer.remove_information_window(self) 
   93        @param self this object
 
   97        ipv4 = ns.cppyy.gbl.getNodeIpv4(node) 
   98        routing = ipv4.GetRoutingProtocol() 
  102        routing_protocols = [] 
 
  104        if isinstance(routing, ns.Ipv4StaticRouting):
 
  105            ipv4_routing = routing_protocols.append((routing, 
"static", 0))
 
  106        elif isinstance(routing, ns.Ipv4ListRouting):
 
  107            list_routing = routing
 
  108            for rI 
in range(list_routing.GetNRoutingProtocols()):
 
  109                routing, prio = list_routing.GetRoutingProtocol(rI)
 
  110                if isinstance(routing, ns.Ipv4StaticRouting):
 
  111                    routing_protocols.append((routing, 
"static", prio))
 
  112                elif isinstance(routing, ns.Ipv4GlobalRouting):
 
  113                    routing_protocols.append((routing, 
"global", prio))
 
  114        if not routing_protocols:
 
  118        for route_proto, type_string, prio 
in routing_protocols:
 
  119            for routeI 
in range(route_proto.GetNRoutes()):
 
  120                route = route_proto.GetRoute(routeI)
 
  122                netdevice = ipv4.GetNetDevice(route.GetInterface())
 
  123                if netdevice 
is None:
 
  124                    interface_name = 
'lo' 
  126                    interface_name = ns.Names.FindName(netdevice)
 
  127                    if not interface_name:
 
  128                        interface_name = 
"(interface %i)" % route.GetInterface()
 
  130                                     self.COLUMN_DESTINATION, str(route.GetDest()),
 
  131                                     self.COLUMN_NEXT_HOP, str(route.GetGateway()),
 
  132                                     self.COLUMN_INTERFACE, interface_name,
 
  133                                     self.COLUMN_TYPE, type_string,
 
  134                                     self.COLUMN_PRIO, prio)
 
  138    menu_item = Gtk.MenuItem(
"Show IPv4 Routing Table")
 
  141    def _show_ipv4_routing_table(dummy_menu_item):
 
  144    menu_item.connect(
"activate", _show_ipv4_routing_table)
 
  148    viz.connect(
"populate-node-menu", populate_node_menu)
 
ShowIpv4RoutingTable class.
def _response_cb(self, win, response)
Response callback function.
def __init__(self, visualizer, node_index)
Initializer.
def update(self)
Update function.
def populate_node_menu(viz, node, menu)