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
5683f63c
Verified
Commit
5683f63c
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
resolve linting errors in netboxcli
parent
891cf643
No related branches found
No related tags found
1 merge request
!111
Feature/ruff everything party hat emoji
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
utils/__init__.py
+1
-0
1 addition, 0 deletions
utils/__init__.py
utils/netboxcli.py
+5
-7
5 additions, 7 deletions
utils/netboxcli.py
with
6 additions
and
7 deletions
utils/__init__.py
0 → 100644
+
1
−
0
View file @
5683f63c
"""
Utilities that can be used alongside :term:`GSO`.
"""
This diff is collapsed.
Click to expand it.
utils/netboxcli.py
+
5
−
7
View file @
5683f63c
...
...
@@ -22,12 +22,12 @@ def convert_to_table(data: list[dict[str, Any]], fields: list[str]) -> pd.DataFr
@click.group
()
def
cli
()
->
None
:
pass
"""
Instantiate a new :term:`CLI`.
"""
@cli.group
()
def
create
()
->
None
:
pass
"""
Start defining creation commands below.
"""
@create.command
()
...
...
@@ -45,7 +45,7 @@ def device(fqdn: str, model: str) -> None:
@click.option
(
"
--type
"
,
default
=
"
10gbase-t
"
,
help
=
"
Interface type, default is 10GBASE-T
"
)
@click.option
(
"
--speed
"
,
default
=
"
1000
"
,
help
=
"
Interface speed , default is 1000
"
)
@click.option
(
"
--fqdn
"
,
help
=
"
Device where to create interface
"
)
def
interface
(
name
:
str
,
type
:
str
,
speed
:
str
,
fqdn
:
str
)
->
None
:
def
interface
(
name
:
str
,
type
:
str
,
speed
:
str
,
fqdn
:
str
)
->
None
:
# noqa: A002
"""
Create a new interface in Netbox.
"""
click
.
echo
(
f
"
Creating interface: name=
{
name
}
, speed=
{
speed
}
, fqdn=
{
fqdn
}
"
)
new_interface
=
NetboxClient
().
create_interface
(
name
,
type
,
speed
,
fqdn
)
...
...
@@ -103,7 +103,7 @@ create.add_command(device_site)
# Define list commands here
@cli.group
()
def
list
()
->
None
:
def
list
()
->
None
:
# noqa: A001
"""
Definitions of all listing commands.
"""
...
...
@@ -126,9 +126,7 @@ def interfaces(fqdn: str, speed: str) -> None:
"
lag
"
,
"
speed
"
,
]
iface_list
=
[]
for
iface
in
interface_list
:
iface_list
.
append
(
dict
(
iface
))
iface_list
=
[
dict
(
iface
)
for
iface
in
interface_list
]
table
=
convert_to_table
(
iface_list
,
display_fields
)
click
.
echo
(
table
)
...
...
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