summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface-definitions/include/generic-description.xml.i4
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py16
2 files changed, 18 insertions, 2 deletions
diff --git a/interface-definitions/include/generic-description.xml.i b/interface-definitions/include/generic-description.xml.i
index 63e5e174e..ffe037a01 100644
--- a/interface-definitions/include/generic-description.xml.i
+++ b/interface-definitions/include/generic-description.xml.i
@@ -7,9 +7,9 @@
<description>Description</description>
</valueHelp>
<constraint>
- <regex>[[:ascii:]]{0,256}</regex>
+ <regex>[[:ascii:]]{1,255}</regex>
</constraint>
- <constraintErrorMessage>Description too long (limit 256 characters)</constraintErrorMessage>
+ <constraintErrorMessage>Description too long (limit 255 characters)</constraintErrorMessage>
</properties>
</leafNode>
<!-- include end -->
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index a40b762a8..9b705c801 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -318,6 +318,22 @@ class BasicInterfaceTest:
self.assertEqual(tmp, str())
self.assertEqual(Interface(intf).get_alias(), str())
+ # Test maximum interface description lengt (255 characters)
+ test_string='abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789___'
+ for intf in self._interfaces:
+
+ self.cli_set(self._base_path + [intf, 'description', test_string])
+ for option in self._options.get(intf, []):
+ self.cli_set(self._base_path + [intf] + option.split())
+
+ self.cli_commit()
+
+ # Validate interface description
+ for intf in self._interfaces:
+ tmp = read_file(f'/sys/class/net/{intf}/ifalias')
+ self.assertEqual(tmp, test_string)
+ self.assertEqual(Interface(intf).get_alias(), test_string)
+
def test_add_single_ip_address(self):
addr = '192.0.2.0/31'
for intf in self._interfaces: