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
9251b4c9
Commit
9251b4c9
authored
1 year ago
by
Hakan Calim
Committed by
Neda Moeini
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
NAT-328: moved the validator for site name to correct class
parent
9b396ae7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!97
Feature/nat 328 site names should be validated
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/api/v1/imports.py
+9
-9
9 additions, 9 deletions
gso/api/v1/imports.py
with
9 additions
and
9 deletions
gso/api/v1/imports.py
+
9
−
9
View file @
9251b4c9
...
...
@@ -39,6 +39,15 @@ class SiteImportModel(BaseModel):
site_ts_address
:
str
customer
:
str
@validator
(
"
site_name
"
,
allow_reuse
=
True
)
def
site_name_must_be_valid
(
cls
,
site_name
:
str
)
->
str
:
# Accept 3 chapital letters and only one ditigt after capital letters.
pattern
=
re
.
compile
(
r
"
^[A-Z]{3}[0-9]?$
"
)
if
not
bool
(
pattern
.
match
(
site_name
)):
raise
ValueError
(
f
"
Enter a valid site name similar looks like AMS, AMS1or LON9. Get:
{
site_name
}
"
)
return
site_name
class
RouterImportModel
(
BaseModel
):
customer
:
str
...
...
@@ -105,15 +114,6 @@ class IptrunkImportModel(BaseModel):
return
value
@validator
(
"
site_name
"
,
allow_reuse
=
True
)
def
site_name_must_be_valid
(
cls
,
site_name
:
str
)
->
str
:
# Accept 3 chapital letters and only one ditigt after capital letters.
pattern
=
re
.
compile
(
r
"
^[A-Z]{3}[0-9]?$
"
)
if
not
bool
(
pattern
.
match
(
site_name
)):
raise
ValueError
(
f
"
Enter a valid site name similar looks like AMS, AMS1or LON9. Get:
{
site_name
}
"
)
return
site_name
@root_validator
def
check_members
(
cls
,
values
:
dict
[
str
,
Any
])
->
dict
[
str
,
Any
]:
min_links
=
values
[
"
iptrunk_minimum_links
"
]
...
...
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