TWSD-1350 Not displaying the list of interfaces when the interface name is modified with special characters especially like this format port1(data_
Review Request #1257 — Created Dec. 23, 2025 and updated
| Information | |
|---|---|
| lucille | |
| APV10 | |
| rel_apv_10_7 | |
| TWSD-1350 | |
| Reviewers | |
| austin, shuinvy, weikai | |
The WebUI list page fails to display interface names that contain special characters
Root Cause
When SystemInterface or BondInterface interface names contain regular expression special characters (such as parentheses
(, periods., etc.), it causes 500 errors during DelayedQuery processing.Specific Cause:
1. In the_get_managementmethod, interface names are directly inserted into regular expressions
2. When interface name is"port1(Data_", the generated regular expression becomes:
interface management "port1(Data_" (?P<gateway_ip_str>[0-9|a-f|A-F|:|\.]+)
3. The parenthesis(is a special character for grouping syntax in regular expressions, causing regex syntax errors
4. The error occurs during the DelayedQuery processing phase of GET requests, not during UPDATE operationsSolution
Use the
re.escape()function to escape interface names for regular expressions in both_get_managementmethods.Modified Locations:
1. SystemInterface._get_management (Line 537)
@QueryingFields(['manage_port','gateway_ipv4', 'gateway_ipv6']) def _get_management(self, pk_dict): self.cli.set_enable() result = self.cli.cmd('show management', RegexParser('interface management "%s" (?P<gateway_ip_str>[0-9|a-f|A-F|:|\.]+)' % re.escape(pk_dict['name']), MATCHALL) ) # ... rest of the code remains unchanged2. BondInterface._get_management (Line 707)
@QueryingFields(['manage_port','gateway_ipv4', 'gateway_ipv6']) def _get_management(self, pk_dict): self.cli.set_enable() result = self.cli.cmd('show management', RegexParser('interface management "%s" (?P<gateway_ip_str>[0-9|a-f|A-F|:|\.]+)' % re.escape(pk_dict['name']), MATCHALL) ) # ... rest of the code remains unchangedModification Effect:
- Original:"port1(Data_"→ Regular expression:"port1(Data_"
- After escaping:"port1(Data_"→ Regular expression:"port1\\(Data_"Verification
Test Steps:
1. Create interface names containing special characters, such as:"port1(Data_"
2. Access SystemInterface or BondInterface list pages via Web UI or REST API
3. Confirm that 500 errors no longer occur
4. Verify that interface names with special characters properly display management interface related fieldsExpected Results:
- ✅ No more 500 Internal Server Error
- ✅ Interface names with special characters are handled properly
- ✅manage_port,gateway_ipv4,gateway_ipv6fields display correctly
- ✅ Interface names without special characters remain unaffectedTest Coverage:
- Interface names containing:()[]{}.*+?^$|and other regex special characters
- Both SystemInterface and BondInterface classes
- GET request DelayedQuery processing flow
Testing Done: |
|
|---|
