Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
f5235028
Commit
f5235028
authored
9 months ago
by
Karel van Klink
Committed by
Neda Moeini
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Update regex that validates interface names
parent
d94ff3df
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!219
Update regex that validates interface names
Pipeline
#87251
failed
9 months ago
Stage: tox
Stage: documentation
Stage: sonarqube
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/utils/helpers.py
+3
-3
3 additions, 3 deletions
gso/utils/helpers.py
with
3 additions
and
3 deletions
gso/utils/helpers.py
+
3
−
3
View file @
f5235028
...
...
@@ -252,8 +252,8 @@ def validate_interface_name_list(interface_name_list: list, vendor: str) -> list
"""
Validate that the provided interface name matches the expected pattern.
The expected pattern for the interface name is one of
'
ge
'
,
'
et
'
,
'
xe
'
followed by a dash
'
-
'
,
then a
digit
between 0 and 9, a forward slash
'
/
'
, another
digit
between 0 and 9,
another forward slash
'
/
'
, and ends with a
digit
between 0 and 9.
then a
number
between 0 and
1
9, a forward slash
'
/
'
, another
number
between 0 and
9
9,
another forward slash
'
/
'
, and ends with a
number
between 0 and
9
9.
For example:
'
xe-1/0/0
'
.
:param list interface_name_list: List of interface names to validate.
...
...
@@ -265,7 +265,7 @@ def validate_interface_name_list(interface_name_list: list, vendor: str) -> list
# For Nokia nothing to do
if
vendor
==
Vendor
.
NOKIA
:
return
interface_name_list
pattern
=
re
.
compile
(
r
"
^(ge|et|xe)-[0-9]/[0-9]/[0-9]$
"
)
pattern
=
re
.
compile
(
r
"
^(ge|et|xe)-
1?
[0-9]/[0-9]
{1,2}
/[0-9]
{1,2}
$
"
)
for
interface
in
interface_name_list
:
if
not
bool
(
pattern
.
match
(
interface
.
interface_name
)):
error_msg
=
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment