+ @handler(u'Adds a route to : ip route add <net_addr> <prefix> <gateway> [device]')
+ def add(self, net_addr, prefix, gateway, dev=None):
+ if dev is not None:
+ ListComposedSubHandler.add(self, dev, net_addr, prefix, gateway)
+ else:
+ r = Route(net_addr, prefix, gateway)
+ if not r in self.parent.no_device_routes:
+ self.parent.no_device_routes.append(r)
+
+ @handler("Deletes a route : ip route delete <route_number_in_show> [dev]")
+ def delete(self, index, dev=None):
+ if dev is not None:
+ ListComposedSubHandler.delete(self, dev, index)
+ else:
+ i = int(index)
+ del self.parent.no_device_routes[i]
+
+ @handler("Shows routes : ip route show [dev]")
+ def show(self, dev=None):
+ if dev is not None:
+ return ListComposedSubHandler.show(self, dev)
+ else:
+ return self.parent.no_device_routes