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
d2ed1e7e
Commit
d2ed1e7e
authored
1 year ago
by
Karel van Klink
Committed by
Neda Moeini
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
make all docstrings Sphinx-style
parent
3e66347d
No related branches found
No related tags found
1 merge request
!115
Feature/update docs
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gso/services/subscriptions.py
+2
-4
2 additions, 4 deletions
gso/services/subscriptions.py
gso/utils/helpers.py
+17
-19
17 additions, 19 deletions
gso/utils/helpers.py
gso/workflows/tasks/import_router.py
+2
-3
2 additions, 3 deletions
gso/workflows/tasks/import_router.py
with
21 additions
and
26 deletions
gso/services/subscriptions.py
+
2
−
4
View file @
d2ed1e7e
...
...
@@ -124,10 +124,8 @@ def get_active_subscriptions_by_field_and_value(field_name: str, field_value: st
def
count_incomplete_validate_products
()
->
int
:
"""
Count the number of incomplete validate_products processes.
Returns
-------
int
The count of incomplete
'
validate_products
'
processes.
:return: The count of incomplete
'
validate_products
'
processes.
:rtype: int
"""
return
ProcessTable
.
query
.
filter
(
ProcessTable
.
workflow_name
==
"
validate_products
"
,
...
...
This diff is collapsed.
Click to expand it.
gso/utils/helpers.py
+
17
−
19
View file @
d2ed1e7e
...
...
@@ -117,13 +117,11 @@ def available_lags_choices(router_id: UUID) -> Choice | None:
def
get_router_vendor
(
router_id
:
UUID
)
->
str
:
"""
Retrieve the vendor of a router.
Args:
----
router_id (UUID): The {term}`UUID` of the router.
:param router_id: The :term:`UUID` of the router.
:type router_id: :class:`uuid.UUID`
Returns:
-------
str: The vendor of the router.
:return: The vendor of the router.
:rtype: str:
"""
return
Router
.
from_subscription
(
router_id
).
router
.
router_vendor
...
...
@@ -140,16 +138,16 @@ def iso_from_ipv4(ipv4_address: IPv4Address) -> str:
return
f
"
49.51e5.0001.
{
re_split
}
.00
"
def
validate_router_in_netbox
(
subscription_id
:
UUIDstr
)
->
UUIDstr
|
None
:
def
validate_router_in_netbox
(
subscription_id
:
UUIDstr
)
->
UUIDstr
:
"""
Verify if a device exists in Netbox.
Args:
----
subscription_id (UUID): The {term}`UUID` of the router subscription.
Raises a :class:`ValueError` if the device is not found.
Returns:
-------
UUID: The {term}`UUID` of the router subscription or raises an error.
:param subscription_id: The :term:`UUID` of the router subscription.
:type subscription_id: :class:`UUIDstr`
:return: The :term:`UUID` of the router subscription.
:rtype: :class:`UUIDstr`
"""
router
=
Router
.
from_subscription
(
subscription_id
).
router
if
router
.
router_vendor
==
RouterVendor
.
NOKIA
:
...
...
@@ -163,13 +161,13 @@ def validate_router_in_netbox(subscription_id: UUIDstr) -> UUIDstr | None:
def
validate_iptrunk_unique_interface
(
interfaces
:
list
[
LAGMember
])
->
list
[
LAGMember
]:
"""
Verify if the interfaces are unique.
Args:
----
interfaces (list[LAGMember]): The list of interfaces.
Raises a :class:`ValueError` if the interfaces are not unique.
:param interfaces: The list of interfaces.
:type interfaces: list[:class:`LAGMember`]
Returns:
-------
list[LAGMember]: The list of interfaces or raises an error.
:return: The list of interfaces
:rtype: list[:class:`LAGMember`]
"""
interface_names
=
[
member
.
interface_name
for
member
in
interfaces
]
if
len
(
interface_names
)
!=
len
(
set
(
interface_names
)):
...
...
This diff is collapsed.
Click to expand it.
gso/workflows/tasks/import_router.py
+
2
−
3
View file @
d2ed1e7e
...
...
@@ -23,9 +23,8 @@ from gso.services.crm import get_customer_by_name
def
_get_site_by_name
(
site_name
:
str
)
->
Site
:
"""
Get a site by its name.
Args:
----
site_name (str): The name of the site.
:param site_name: The name of the site.
:type site_name: str
"""
subscription
=
subscriptions
.
get_active_subscriptions_by_field_and_value
(
"
site_name
"
,
site_name
)[
0
]
if
not
subscription
:
...
...
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