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
6e82c388
Verified
Commit
6e82c388
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
add typing to services
parent
6bba6d1d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!36
Add linter tools, and resolve all linting errors
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gso/services/ipam.py
+6
-6
6 additions, 6 deletions
gso/services/ipam.py
gso/services/resource_manager.py
+3
-3
3 additions, 3 deletions
gso/services/resource_manager.py
pyproject.toml
+1
-0
1 addition, 0 deletions
pyproject.toml
with
10 additions
and
9 deletions
gso/services/ipam.py
+
6
−
6
View file @
6e82c388
import
ipaddress
from
typing
import
Union
from
typing
import
Union
,
Optional
from
pydantic
import
BaseSettings
...
...
@@ -25,7 +25,7 @@ class HostAddresses(BaseSettings):
v6
:
ipaddress
.
IPv6Address
def
new_service_networks
(
service_type
:
str
=
""
,
comment
:
str
=
""
,
extattrs
=
None
)
->
ServiceNetworks
:
def
new_service_networks
(
service_type
:
str
=
""
,
comment
:
str
=
""
,
extattrs
:
dict
=
None
)
->
ServiceNetworks
:
if
extattrs
is
None
:
extattrs
=
{}
v4_service_network
=
_ipam
.
allocate_service_ipv4_network
(
...
...
@@ -40,10 +40,10 @@ def new_service_networks(service_type: str = "", comment: str = "", extattrs=Non
def
new_service_host
(
hostname
:
str
,
service_type
:
str
=
""
,
service_networks
:
ServiceNetworks
=
None
,
host_addresses
:
HostAddresses
=
None
,
cname_aliases
=
None
,
extattrs
=
None
,
service_networks
:
Optional
[
ServiceNetworks
]
=
None
,
host_addresses
:
Optional
[
HostAddresses
]
=
None
,
cname_aliases
:
list
=
None
,
extattrs
:
dict
=
None
,
)
->
HostAddresses
:
if
extattrs
is
None
:
extattrs
=
{}
...
...
This diff is collapsed.
Click to expand it.
gso/services/resource_manager.py
+
3
−
3
View file @
6e82c388
...
...
@@ -3,14 +3,14 @@ import requests
from
gso
import
settings
def
import_new_router
(
router_name
,
oss_params
=
settings
.
OSSParams
)
->
None
:
def
import_new_router
(
router_name
:
str
,
oss_params
=
settings
.
OSSParams
)
->
None
:
r
=
requests
.
post
(
f
"
{
oss_params
.
RESOURCE_MANAGER_API_PREFIX
}
"
f
"
/api/interfaces/initialize-router/
{
router_name
}
"
,
timeout
=
10000
)
r
.
raise_for_status
()
def
next_lag
(
router_name
,
oss_params
=
settings
.
OSSParams
)
->
dict
:
def
next_lag
(
router_name
:
str
,
oss_params
=
settings
.
OSSParams
)
->
dict
:
r
=
requests
.
post
(
f
"
{
oss_params
.
RESOURCE_MANAGER_API_PREFIX
}
"
f
"
/api/interfaces/next-lag/
{
router_name
}
"
,
timeout
=
10000
)
...
...
@@ -19,7 +19,7 @@ def next_lag(router_name, oss_params=settings.OSSParams) -> dict:
return
response
[
"
name
"
]
def
next_physical
(
router_name
,
lag_name
,
oss_params
=
settings
.
OSSParams
)
->
dict
:
def
next_physical
(
router_name
:
str
,
lag_name
:
str
,
oss_params
=
settings
.
OSSParams
)
->
dict
:
# TODO: speed needed (if first interface)
r
=
requests
.
post
(
f
"
{
oss_params
.
RESOURCE_MANAGER_API_PREFIX
}
"
f
"
/api/interfaces/next-physical/
{
router_name
}
/
{
lag_name
}
"
,
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
0
View file @
6e82c388
...
...
@@ -25,6 +25,7 @@ exclude = '''
[tool.mypy]
exclude
=
[
"venv"
,
"test/*"
,
"gso/services/_ipam.py"
# TODO: remove
]
ignore_missing_imports
=
true
...
...
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