Skip to content
Snippets Groups Projects

Feature/DBOARD3-917 Add endpoint for error report interfaces list

Merged Pelle Koster requested to merge feature/DBOARD3-917-error-report-interfaces into develop
2 files
+ 12
23
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -227,6 +227,7 @@ ERROR_REPORT_INTERFACE_LIST_SCHEMA = {
'type': 'array',
'items': {'$ref': '#/definitions/interface'}
}
INTERFACE_SPEED_LIST_SCHEMA = {
'$schema': 'https://json-schema.org/draft-07/schema#',
@@ -902,11 +903,9 @@ def interfaces(hostname=None):
def load_error_report_interfaces(
config, hostname=None, no_lab=False, use_next_redis=False
config, hostname=None, use_next_redis=False
):
interfaces = _load_interfaces(
config, hostname, no_lab=no_lab, use_next_redis=use_next_redis
)
interfaces = _load_interfaces(config, hostname, use_next_redis=use_next_redis)
def filter_interface(interface: dict):
return all(
@@ -921,14 +920,14 @@ def load_error_report_interfaces(
)
)
def transform_interface(interfac: dict):
def transform_interface(interface: dict):
return {
"router": interfac["router"],
"name": interfac["name"],
"description": interfac["description"],
"router": interface["router"],
"name": interface["name"],
"description": interface["description"],
# TODO: This is a complete hack until we have a proper way to determine
# router vendor
"vendor": "nokia" if interfac["router"].startswith("rt0") else "juniper"
"vendor": "nokia" if interface["router"].startswith("rt0") else "juniper"
}
return sorted(
@@ -952,14 +951,10 @@ def error_report_interfaces(hostname=None):
The response is a list of information for all
interfaces that should be included in the neteng error report
plus additional vendor information (is it a juniper or nokia
router?)
and includes vendor information (either juniper or nokia)
.. asjson::
inventory_provider.routes.poller.INTERFACE_LIST_SCHEMA
:meth:`inventory_provider.routes.poller._get_services`
is where dashboard mappings is handled.
inventory_provider.routes.poller.ERROR_REPORT_INTERFACE_LIST_SCHEMA
:param hostname: optional, if present should be a router hostname
:return:
Loading