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
Jira
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
Merge requests
!97
Feature/nat 328 site names should be validated
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feature/nat 328 site names should be validated
feature/NAT-328-Site-names-should-be-validated
into
develop
Overview
0
Commits
19
Pipelines
8
Changes
5
Merged
Hakan Calim
requested to merge
feature/NAT-328-Site-names-should-be-validated
into
develop
1 year ago
Overview
0
Commits
19
Pipelines
8
Changes
5
Expand
0
0
Merge request reports
Compare
develop
version 7
0e75e466
1 year ago
version 6
b8c08435
1 year ago
version 5
e67744b3
1 year ago
version 4
d67e1d6d
1 year ago
version 3
9649cfb2
1 year ago
version 2
99fcc99b
1 year ago
version 1
0eda1167
1 year ago
develop (base)
and
version 2
latest version
08e9f966
19 commits,
1 year ago
version 7
0e75e466
18 commits,
1 year ago
version 6
b8c08435
17 commits,
1 year ago
version 5
e67744b3
21 commits,
1 year ago
version 4
d67e1d6d
18 commits,
1 year ago
version 3
9649cfb2
17 commits,
1 year ago
version 2
99fcc99b
16 commits,
1 year ago
version 1
0eda1167
13 commits,
1 year ago
5 files
+
184
−
115
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
gso/api/v1/imports.py
+
10
−
0
Options
import
ipaddress
from
typing
import
Any
from
uuid
import
UUID
import
re
from
fastapi
import
Depends
,
HTTPException
,
status
from
fastapi.routing
import
APIRouter
@@ -38,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
Loading