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
9df4b4c9
Commit
9df4b4c9
authored
1 year ago
by
Neda Moeini
Browse files
Options
Downloads
Patches
Plain Diff
Improved naming and removed some unnecessary part.
parent
669e8581
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!77
Netbox integration including intial CLI for populating base data and ...
Pipeline
#84163
passed
1 year ago
Stage: tox
Stage: documentation
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gso/cli/netbox.py
+1
-5
1 addition, 5 deletions
gso/cli/netbox.py
gso/services/netbox_client.py
+4
-4
4 additions, 4 deletions
gso/services/netbox_client.py
gso/utils/device_info.py
+1
-2
1 addition, 2 deletions
gso/utils/device_info.py
with
6 additions
and
11 deletions
gso/cli/netbox.py
+
1
−
5
View file @
9df4b4c9
...
...
@@ -17,11 +17,7 @@ def netbox_initial_setup() -> None:
typer
.
echo
(
"
Initial setup of NetBox ...
"
)
typer
.
echo
(
"
Connecting to NetBox ...
"
)
try
:
nbclient
=
NetBoxClient
()
except
RequestError
as
e
:
typer
.
echo
(
f
"
Error connecting to NetBox:
{
e
}
"
)
return
nbclient
=
NetBoxClient
()
typer
.
echo
(
"
Creating GEANT site ...
"
)
try
:
...
...
This diff is collapsed.
Click to expand it.
gso/services/netbox_client.py
+
4
−
4
View file @
9df4b4c9
...
...
@@ -7,7 +7,7 @@ from pynetbox.models.dcim import Devices, DeviceTypes, Interfaces
from
gso.products
import
Router
from
gso.settings
import
load_oss_params
from
gso.utils.device_info
import
FEASIBLE_LAG_RANGE
,
TierInfo
from
gso.utils.device_info
import
FEASIBLE_
IP_TRUNK_
LAG_RANGE
,
TierInfo
from
gso.utils.exceptions
import
NotFoundError
,
WorkflowStateError
...
...
@@ -49,8 +49,8 @@ class NetBoxClient:
"""
Implement all methods to communicate with the NetBox API.
"""
def
__init__
(
self
)
->
None
:
netbox_params
=
load_oss_params
().
NETBOX
self
.
netbox
=
pynetbox
.
api
(
netbox_params
.
api
,
netbox_params
.
token
)
self
.
netbox_params
=
load_oss_params
().
NETBOX
self
.
netbox
=
pynetbox
.
api
(
self
.
netbox_params
.
api
,
self
.
netbox_params
.
token
)
def
get_all_devices
(
self
)
->
list
[
Devices
]:
return
list
(
self
.
netbox
.
dcim
.
devices
.
all
())
...
...
@@ -207,7 +207,7 @@ class NetBoxClient:
]
# Generate all feasible lags
all_feasible_lags
=
[
f
"
LAG-
{
i
}
"
for
i
in
FEASIBLE_LAG_RANGE
]
all_feasible_lags
=
[
f
"
LAG-
{
i
}
"
for
i
in
FEASIBLE_
IP_TRUNK_
LAG_RANGE
]
# Return available lags not assigned to the device
return
[
lag
for
lag
in
all_feasible_lags
if
lag
not
in
lag_interface_names
]
This diff is collapsed.
Click to expand it.
gso/utils/device_info.py
+
1
−
2
View file @
9df4b4c9
...
...
@@ -30,5 +30,4 @@ class TierInfo:
return
getattr
(
self
,
name
)
# Ranges of LAGs that are feasible for a given device type.
FEASIBLE_LAG_RANGE
=
range
(
1
,
11
)
FEASIBLE_IP_TRUNK_LAG_RANGE
=
range
(
1
,
10
)
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