def node_bgppeer_show(version): """ Print a list of the BGP Peers for this node. """ assert version in (4, 6) peers = client.get_bgp_peers(version, hostname=hostname) if peers: heading = "Node specific IPv%s BGP Peer" % version x = PrettyTable([heading, "AS Num"], sortby=heading) for peer in peers: x.add_row([peer.ip, peer.as_num]) x.align = "l" print x.get_string(sortby=heading) else: print "No IPv%s BGP Peers defined for this node.\n" % version
def bgp_peer_show(version): """ Print a list of the global BGP Peers. """ assert version in (4, 6) peers = client.get_bgp_peers(version) if peers: heading = "Global IPv%s BGP Peer" % version x = PrettyTable([heading, "AS Num"], sortby=heading) for peer in peers: x.add_row([peer.ip, peer.as_num]) x.align = "l" print x.get_string(sortby=heading) else: print "No global IPv%s BGP Peers defined.\n" % version