From 13f211f27a88bc750bd5ca0835e0a3ac6b3d6613 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Mon, 14 Mar 2022 00:17:33 +0000 Subject: [PATCH] Make clearer that 'is not allowed' actually means that the address conflicts with another --- unittest/error-address1.yaml | 8 ++++---- validator/bridgedomain.py | 2 +- validator/interface.py | 4 ++-- validator/loopback.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/unittest/error-address1.yaml b/unittest/error-address1.yaml index b7538a5..56918c6 100644 --- a/unittest/error-address1.yaml +++ b/unittest/error-address1.yaml @@ -2,10 +2,10 @@ test: description: "IP interfaces cannot be more- or less-specific of any other interface" errors: expected: - - "interface .* IP address .* is not allowed" - - "sub-interface .* IP address .* is not allowed" - - "loopback .* IP address .* is not allowed" - - "bridgedomain .* IP address .* is not allowed" + - "interface .* IP address .* conflicts with another" + - "sub-interface .* IP address .* conflicts with another" + - "loopback .* IP address .* conflicts with another" + - "bridgedomain .* IP address .* conflicts with another" count: 18 --- interfaces: diff --git a/validator/bridgedomain.py b/validator/bridgedomain.py index 6d24196..47ddd80 100644 --- a/validator/bridgedomain.py +++ b/validator/bridgedomain.py @@ -56,7 +56,7 @@ def validate_bridgedomains(yaml): if 'addresses' in iface: for a in iface['addresses']: if not address.is_allowed(yaml, ifname, iface['addresses'], a): - msgs.append("bridgedomain %s IP address %s is not allowed" % (ifname, a)) + msgs.append("bridgedomain %s IP address %s conflicts with another" % (ifname, a)) result = False if 'interfaces' in iface: diff --git a/validator/interface.py b/validator/interface.py index 2827c46..756dc3c 100644 --- a/validator/interface.py +++ b/validator/interface.py @@ -287,7 +287,7 @@ def validate_interfaces(yaml): if 'addresses' in iface: for a in iface['addresses']: if not address.is_allowed(yaml, ifname, iface['addresses'], a): - msgs.append("interface %s IP address %s is not allowed" % (ifname, a)) + msgs.append("interface %s IP address %s conflicts with another" % (ifname, a)) result = False if has_sub(yaml, ifname): @@ -321,7 +321,7 @@ def validate_interfaces(yaml): result = False for a in sub_iface['addresses']: if not address.is_allowed(yaml, sub_ifname, sub_iface['addresses'], a): - msgs.append("sub-interface %s IP address %s is not allowed" % (sub_ifname, a)) + msgs.append("sub-interface %s IP address %s conflicts with another" % (sub_ifname, a)) result = False if not valid_encapsulation(yaml, sub_ifname): msgs.append("sub-interface %s has invalid encapsulation" % (sub_ifname)) diff --git a/validator/loopback.py b/validator/loopback.py index fbfe285..978edf5 100644 --- a/validator/loopback.py +++ b/validator/loopback.py @@ -50,7 +50,7 @@ def validate_loopbacks(yaml): if 'addresses' in iface: for a in iface['addresses']: if not address.is_allowed(yaml, ifname, iface['addresses'], a): - msgs.append("loopback %s IP address %s is not allowed" % (ifname, a)) + msgs.append("loopback %s IP address %s conflicts with another" % (ifname, a)) result = False return result, msgs