mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Remove dependancy on tabulate
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: roopa@cumulusnetworks.com Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -267,7 +267,7 @@ class NetlinkManagerWithListener(NetlinkManager):
|
|||||||
(msg.get_prefix_string(), msg.get_nexthops_string(self.ifname_by_index)))
|
(msg.get_prefix_string(), msg.get_nexthops_string(self.ifname_by_index)))
|
||||||
|
|
||||||
def rx_rtm_delroute(self, msg):
|
def rx_rtm_delroute(self, msg):
|
||||||
log.info("RX RTM_NEWROUTE for %s%s" %
|
log.info("RX RTM_DELROUTE for %s%s" %
|
||||||
(msg.get_prefix_string(), msg.get_nexthops_string(self.ifname_by_index)))
|
(msg.get_prefix_string(), msg.get_nexthops_string(self.ifname_by_index)))
|
||||||
|
|
||||||
# Note that tx_nlpacket_ack_on_listener will block until NetlinkListener has RXed
|
# Note that tx_nlpacket_ack_on_listener will block until NetlinkListener has RXed
|
||||||
|
@@ -4,7 +4,6 @@ from ipaddr import IPv4Address, IPv6Address
|
|||||||
from nlpacket import *
|
from nlpacket import *
|
||||||
from select import select
|
from select import select
|
||||||
from struct import pack, unpack
|
from struct import pack, unpack
|
||||||
from tabulate import tabulate
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
@@ -391,21 +390,20 @@ class NetlinkManager(object):
|
|||||||
|
|
||||||
def routes_print(self, routes):
|
def routes_print(self, routes):
|
||||||
"""
|
"""
|
||||||
Use tabulate to print a table of 'routes'
|
Print a table of 'routes'
|
||||||
"""
|
"""
|
||||||
header = ['Prefix', 'nexthop', 'ifindex']
|
print "Prefix Nexthop ifindex"
|
||||||
table = []
|
|
||||||
|
|
||||||
for x in routes:
|
for x in routes:
|
||||||
if Route.RTA_DST not in x.attributes:
|
if Route.RTA_DST not in x.attributes:
|
||||||
log.warning("Route is missing RTA_DST")
|
log.warning("Route is missing RTA_DST")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
table.append(('%s/%d' % (x.attributes[Route.RTA_DST].value, x.src_len),
|
ip = "%s/%d" % (x.attributes[Route.RTA_DST].value, x.src_len)
|
||||||
|
print "%-15s %-15s %s" %\
|
||||||
|
(ip,
|
||||||
str(x.attributes[Route.RTA_GATEWAY].value) if Route.RTA_GATEWAY in x.attributes else None,
|
str(x.attributes[Route.RTA_GATEWAY].value) if Route.RTA_GATEWAY in x.attributes else None,
|
||||||
x.attributes[Route.RTA_OIF].value))
|
x.attributes[Route.RTA_OIF].value)
|
||||||
|
|
||||||
print tabulate(table, header, tablefmt='simple') + '\n'
|
|
||||||
|
|
||||||
# =====
|
# =====
|
||||||
# Links
|
# Links
|
||||||
|
Reference in New Issue
Block a user