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
This commit is contained in:
@@ -267,7 +267,7 @@ class NetlinkManagerWithListener(NetlinkManager):
|
||||
(msg.get_prefix_string(), msg.get_nexthops_string(self.ifname_by_index)))
|
||||
|
||||
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)))
|
||||
|
||||
# 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 select import select
|
||||
from struct import pack, unpack
|
||||
from tabulate import tabulate
|
||||
import logging
|
||||
import os
|
||||
import socket
|
||||
@@ -391,21 +390,20 @@ class NetlinkManager(object):
|
||||
|
||||
def routes_print(self, routes):
|
||||
"""
|
||||
Use tabulate to print a table of 'routes'
|
||||
Print a table of 'routes'
|
||||
"""
|
||||
header = ['Prefix', 'nexthop', 'ifindex']
|
||||
table = []
|
||||
print "Prefix Nexthop ifindex"
|
||||
|
||||
for x in routes:
|
||||
if Route.RTA_DST not in x.attributes:
|
||||
log.warning("Route is missing RTA_DST")
|
||||
continue
|
||||
|
||||
table.append(('%s/%d' % (x.attributes[Route.RTA_DST].value, x.src_len),
|
||||
str(x.attributes[Route.RTA_GATEWAY].value) if Route.RTA_GATEWAY in x.attributes else None,
|
||||
x.attributes[Route.RTA_OIF].value))
|
||||
|
||||
print tabulate(table, header, tablefmt='simple') + '\n'
|
||||
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,
|
||||
x.attributes[Route.RTA_OIF].value)
|
||||
|
||||
# =====
|
||||
# Links
|
||||
|
Reference in New Issue
Block a user