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
Commits
0f5b13ca
Commit
0f5b13ca
authored
1 year ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
added template site param handling
parent
2d4a4a47
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/services/resource_manager.py
+27
-9
27 additions, 9 deletions
gso/services/resource_manager.py
with
27 additions
and
9 deletions
gso/services/resource_manager.py
+
27
−
9
View file @
0f5b13ca
# mypy: ignore-errors
from
enum
import
Enum
,
auto
from
typing
import
List
from
typing
import
List
,
Set
from
gso
import
settings
...
...
@@ -16,27 +16,45 @@ class InterfaceAllocationState(Enum):
ALLOCATED
=
auto
()
def
_dummy_router_interfaces
(
)
:
def
_dummy_router_interfaces
(
site_name
)
->
dict
:
return
{
"
site
"
:
site_name
,
"
lags
"
:
[],
"
physical
"
:
[{
"
name
"
:
f
"
ifc-
{
x
}
"
,
"
state
"
:
InterfaceAllocationState
.
AVAILABLE
}
for
x
in
range
(
250
)],
}
_DUMMY_SITES
=
{
"
site-a
"
,
"
site-b
"
,
"
site-c
"
}
_DUMMY_INVENTORY
=
{
"
fqdn-a
"
:
_dummy_router_interfaces
(),
"
fqdn-b
"
:
_dummy_router_interfaces
(),
"
fqdn-c
"
:
_dummy_router_interfaces
(),
"
fqdn-d
"
:
_dummy_router_interfaces
(),
"
fqdn-a
"
:
_dummy_router_interfaces
(
"
site-a
"
),
"
fqdn-b
"
:
_dummy_router_interfaces
(
"
site-a
"
),
"
fqdn-c
"
:
_dummy_router_interfaces
(
"
site-b
"
),
"
fqdn-d
"
:
_dummy_router_interfaces
(
"
site-b
"
),
"
fqdn-e
"
:
_dummy_router_interfaces
(
"
site-c
"
),
"
fqdn-f
"
:
_dummy_router_interfaces
(
"
site-c
"
)
}
def
import_new_router
(
new_router_fqdn
:
str
,
oss_params
=
settings
.
OSSParams
):
def
import_new_site
(
new_site_name
:
str
,
oss_params
=
settings
.
OSSParams
):
# TODO: this is a dummy implementation
assert
new_site_name
not
in
_DUMMY_SITES
_DUMMY_SITES
.
add
(
new_site_name
)
def
import_new_router
(
new_router_fqdn
:
str
,
site_name
:
str
,
oss_params
=
settings
.
OSSParams
):
# TODO: this is a dummy implementation
# TODO: specifiy if this should be an error (and if now, what it means)
# TODO: specify if this should be an error (and if not, what it means)
assert
site_name
in
_DUMMY_SITES
assert
new_router_fqdn
not
in
_DUMMY_INVENTORY
_DUMMY_INVENTORY
[
new_router_fqdn
]
=
_dummy_router_interfaces
()
_DUMMY_INVENTORY
[
new_router_fqdn
]
=
_dummy_router_interfaces
(
site_name
)
def
next_lag
(
router_fqdn
:
str
,
oss_params
=
settings
.
OSSParams
)
->
str
:
...
...
This diff is collapsed.
Click to expand it.
Erik Reid
@erik.reid
mentioned in commit
7671453a
·
1 year ago
mentioned in commit
7671453a
mentioned in commit 7671453a70011e8edd507bdc68b988b0e4608892
Toggle commit list
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