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
c14d32d6
Commit
c14d32d6
authored
1 year ago
by
Neda Moeini
Committed by
Neda Moeini
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Update netbox_initial_setup based on the latest changes.
parent
f2faa18c
No related branches found
No related tags found
1 merge request
!77
Netbox integration including intial CLI for populating base data and ...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/cli/netbox.py
+4
-4
4 additions, 4 deletions
gso/cli/netbox.py
with
4 additions
and
4 deletions
gso/cli/netbox.py
+
4
−
4
View file @
c14d32d6
import
typer
from
pynetbox
import
RequestError
from
gso.services.netbox_client
import
NetBoxClient
,
create_device_role
,
create_device_site
from
gso.services.netbox_client
import
NetBoxClient
app
:
typer
.
Typer
=
typer
.
Typer
()
...
...
@@ -18,21 +18,21 @@ def netbox_initial_setup() -> None:
typer
.
echo
(
"
Connecting to NetBox ...
"
)
try
:
nbclient
=
NetBoxClient
()
.
connect
()
nbclient
=
NetBoxClient
()
except
RequestError
as
e
:
typer
.
echo
(
f
"
Error connecting to NetBox:
{
e
}
"
)
return
typer
.
echo
(
"
Creating GEANT site ...
"
)
try
:
create_device_site
(
nbclient
,
"
GEANT
"
,
"
geant
"
)
nbclient
.
create_device_site
(
"
GEANT
"
,
"
geant
"
)
typer
.
echo
(
"
Site created successfully.
"
)
except
RequestError
as
e
:
typer
.
echo
(
f
"
Error creating site:
{
e
}
"
)
typer
.
echo
(
"
Creating Router device role ...
"
)
try
:
create_device_role
(
nbclient
,
"
router
"
,
"
router
"
)
nbclient
.
create_device_role
(
"
router
"
,
"
router
"
)
typer
.
echo
(
"
Device role created successfully.
"
)
except
RequestError
as
e
:
typer
.
echo
(
f
"
Error creating device role:
{
e
}
"
)
...
...
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