adds capsman interface datasource

This commit is contained in:
Leon Morten Richter
2022-10-21 13:53:13 +02:00
parent f6c9778eda
commit d813138bd8
2 changed files with 24 additions and 3 deletions

View File

@@ -14,7 +14,6 @@
from mktxp.datasource.base_ds import BaseDSProcessor
class CapsmanCapsMetricsDataSource:
''' Caps Metrics data provider
'''
@@ -43,3 +42,19 @@ class CapsmanRegistrationsMetricsDataSource:
except Exception as exc:
print(f'Error getting caps-man registration table info from router{router_entry.router_name}@{router_entry.config_entry.hostname}: {exc}')
return None
class CapsmanInterfacesDatasource:
''' Data provider for CAPsMaN interfaces
'''
@staticmethod
def metric_records(router_entry, *, metric_labels = None):
if metric_labels is None:
metric_labels = []
try:
caps_interfaces = router_entry.api_connection.router_api().get_resource('/caps-man/interface').get()
return BaseDSProcessor.trimmed_records(router_entry, router_records = caps_interfaces, metric_labels = metric_labels)
except Exception as exc:
print(f'Error getting caps-man interfaces info from router{router_entry.router_name}@{router_entry.config_entry.hostname}: {exc}')
return None