Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inventory-provider
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
geant-swd
dashboardv3
inventory-provider
Commits
4a40739f
Commit
4a40739f
authored
3 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
added a docstring
parent
30dcd1f5
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
inventory_provider/routes/poller.py
+26
-1
26 additions, 1 deletion
inventory_provider/routes/poller.py
with
26 additions
and
1 deletion
inventory_provider/routes/poller.py
+
26
−
1
View file @
4a40739f
...
...
@@ -48,6 +48,11 @@ These endpoints are intended for use by BRIAN.
.. autofunction:: inventory_provider.routes.poller.get_service_types
support method: _get_dashboards
---------------------------------
.. autofunction:: inventory_provider.routes.poller._get_dashboards
"""
from
enum
import
Enum
,
auto
import
json
...
...
@@ -95,6 +100,9 @@ class BRIAN_DASHBOARDS(Enum):
CAE1
=
auto
()
# only used in INTERFACE_LIST_SCHEMA and sphinx docs
_DASHBOARD_IDS
=
[
d
.
name
for
d
in
list
(
BRIAN_DASHBOARDS
)]
INTERFACE_LIST_SCHEMA
=
{
'
$schema
'
:
'
http://json-schema.org/draft-07/schema#
'
,
...
...
@@ -134,7 +142,7 @@ INTERFACE_LIST_SCHEMA = {
},
'
dashboards
'
:
{
'
type
'
:
'
array
'
,
'
items
'
:
{
'
enum
'
:
[
d
.
name
for
d
in
list
(
BRIAN
_DASHBOARD
S
)]
}
'
items
'
:
{
'
enum
'
:
_DASHBOARD
_IDS
}
}
},
'
required
'
:
[
...
...
@@ -328,6 +336,20 @@ def after_request(resp):
def
_get_dashboards
(
interface
):
"""
Yield enums from BRIAN_DASHBOARDS to indicate which dashboards
this interface should be included in.
cf. POL1-482
Possible dashboard id
'
s are:
.. asjson::
inventory_provider.routes.poller._DASHBOARD_IDS
:param interface: a dict with keys like router, name, description
:return: generator that yields enums from BRIAN_DASHBOARDS
"""
router
=
interface
.
get
(
'
router
'
,
''
).
lower
()
ifc_name
=
interface
.
get
(
'
name
'
,
''
)
...
...
@@ -607,6 +629,9 @@ def interfaces(hostname=None):
.. asjson::
inventory_provider.routes.poller.INTERFACE_LIST_SCHEMA
:meth:`inventory_provider.routes.poller._get_services`
is where dashboard mappings is handled.
:param hostname: optional, if present should be a router hostname
:return:
"""
...
...
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