validators: Allow uppercase iface names 48/2248/2 master
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Fri, 21 Feb 2020 09:37:01 +0000 (10:37 +0100)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 24 Feb 2020 12:25:58 +0000 (13:25 +0100)
Predictable interface names for PCI devices on non-zero PCI
domains get assigned (by systemd-udev) names like
enP<bus-number>p<port-number>s<slot-number>f<function-number>,
e.g. enP2p1s0f0, which are currently rejected by our validators.
For PCI domain 0000, the "P<bus-number>" is omitted, resulting
in all lowercase iface names.

Allow uppercase iface names by making the re.match test
case-insensitive.

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Change-Id: I2bda550c95737fba57b5916a71a3c3b9df66e22d

validators.spec
validators/src/NetworkProfilesValidation.py

index 8627308..bd59e73 100644 (file)
@@ -14,7 +14,7 @@
 
 Name:          validators
 Version:       %{_version}
-Release:       1%{?dist}
+Release:       2%{?dist}
 Summary:       Configuration validators
 License:        %{_platform_licence}
 Source0:        %{name}-%{version}.tar.gz
index ae8ad1a..d43c1c3 100644 (file)
@@ -763,7 +763,7 @@ class NetworkProfilesValidation(cmvalidator.CMValidator):
         return self.DEFAULT_MTU
 
     def validate_iface_name(self, context, iface):
-        if not isinstance(iface, basestring) or not re.match(self.IFACE_NAME_MATCH, iface):
+        if not isinstance(iface, basestring) or not re.match(self.IFACE_NAME_MATCH, iface, re.IGNORECASE):
             self.err_invalid_iface_name(context)
         if len(iface) > self.MAX_IFACE_NAME_LEN:
             self.err_iface_name_len(context)