Skip to content

Commit 591f80d

Browse files
committed
Network check MTU report: improve log messages
And set the access interface errors as failures Change-Id: I867bf853a0a1f1f63ee8886c000f1d9ad657aa8b
1 parent 1c1e936 commit 591f80d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

reports/network.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,11 @@ def test_mtu(self):
122122
# Eg. transit
123123
if not hasattr(interface.connected_endpoint, 'device'):
124124
continue
125-
125+
z_device_name = interface.connected_endpoint.device.name
126126
# If connected to a server, report it
127127
if interface.connected_endpoint.device.device_role.slug == "server":
128-
self.log_warning(interface, f"Server facing interface with MTU != 9192 on {interface.device.name}")
128+
self.log_failure(interface, f"[{interface.device.site.slug}] {z_device_name} switch interface "
129+
"MTU invalid (should be 9192)")
129130

130131
# Core links, connected to a network device
131132
elif interface.connected_endpoint.device.device_role.slug in NETWORK_ROLES:
@@ -134,11 +135,14 @@ def test_mtu(self):
134135
continue
135136
# Report core links with different MTU on each side:
136137
elif interface.connected_endpoint.mtu != interface.mtu:
137-
self.log_warning(interface, "Core link with MTU missmatch")
138+
self.log_warning(interface, f"[{interface.device.site.slug}] MTU mismatch on link between "
139+
f"{interface.device.name} ({interface.mtu}) and "
140+
f"{z_device_name} ({interface.connected_endpoint.mtu})")
138141
continue
139142

140143
# Report any other non-standard MTU
141-
self.log_warning(interface, f"Core link with invalid MTU on {interface.device.name}")
144+
self.log_warning(interface, f"[{interface.device.site.slug}] {interface.device.name} core link with "
145+
f"invalid MTU ({interface.mtu})")
142146

143147
def test_primary_ipv6(self):
144148
"""Report servers that either have a missing primary_ip6 or have a primary_ip6 without a DNS name set.
@@ -203,7 +207,7 @@ def test_primary_ip_dns_match(self):
203207
if not device.primary_ip4.dns_name or not device.primary_ip6.dns_name:
204208
continue
205209
if device.primary_ip4.dns_name != device.primary_ip6.dns_name:
206-
self.log_failure(device, "Primary IPv4 and IPv6 DNS name missmatch ({} vs. {})"
210+
self.log_failure(device, "Primary IPv4 and IPv6 DNS name mismatch ({} vs. {})"
207211
.format(device.primary_ip4.dns_name, device.primary_ip6.dns_name))
208212
continue
209213
else:

0 commit comments

Comments
 (0)