mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-09 13:19:54 +00:00
topotests: bmp_collector, fix display peer distinguisher IP:AS2B
The peer distinguisher format was badly displayed when a per peer
header is sent with an IP:AS2B format.
> {"peer_type": "loc-rib instance", "is_filtered": false, "policy": "loc-rib",
> "peer_distinguisher": "None:2", ...
The IP header is incorrectly read. Fix it.
> {"peer_type": "loc-rib instance", "is_filtered": false, "policy": "loc-rib",
> "peer_distinguisher": "3.3.3.5:2", ...
Fixes: 875511c466
("topotests: add basic bmp collector")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
69c6a41fd2
commit
7da91a8fb9
@ -4,6 +4,7 @@
|
||||
# Authored by Farid Mihoub <farid.mihoub@6wind.com>
|
||||
#
|
||||
import ipaddress
|
||||
import socket
|
||||
import struct
|
||||
|
||||
|
||||
@ -45,9 +46,11 @@ class RouteDistinguisher:
|
||||
self.repr_str = f"{self.as_number}:{self.assigned_sp}"
|
||||
|
||||
elif rd_type == 1:
|
||||
(self.admin_ipv4, self.assigned_sp) = struct.unpack_from("!IH", self.rd[2:])
|
||||
ipv4 = str(ipaddress.IPv4Address(self.admin_ipv4))
|
||||
self.repr_str = f"{self.as_number}:{self.assigned_sp}"
|
||||
(self.admin_ipv4, self.assigned_sp) = struct.unpack_from(
|
||||
"!4sH", self.rd[2:]
|
||||
)
|
||||
ipv4_str = socket.inet_ntoa(self.admin_ipv4)
|
||||
self.repr_str = f"{ipv4_str}:{self.assigned_sp}"
|
||||
|
||||
elif rd_type == 2:
|
||||
(self.four_bytes_as, self.assigned_sp) = struct.unpack_from(
|
||||
|
Loading…
Reference in New Issue
Block a user