Skip to content
Snippets Groups Projects
Commit e70a869d authored by geant-release-service's avatar geant-release-service
Browse files

Finished release 0.10.

parents 5534c2c5 c44119f5
Branches
Tags 0.10
No related merge requests found
# Changelog
All notable changes to this project will be documented in this file.
## [0.10] - 2024-05-07
- Poll netconf only once for both brian and error counters
## [0.9] - 2024-05-06
- DBOARD3-900: Add report-interface-errors script
......
......@@ -24,7 +24,7 @@ DEFAULT_INTERFACES_URL = "/poller/interfaces/"
class PointGroup(enum.Enum):
BRIAN = ("brian", "brian-counters", vendors.brian_points)
ERRORS = ("errors", "error-counters", vendors.error_points)
ERRORS = ("error", "error-counters", vendors.error_points)
def config_params(self, app_params: dict):
return app_params[self.value[1]]
......@@ -154,16 +154,15 @@ def _get_interfaces_for_router(
def process_router(
router_fqdn: str,
vendor: Vendor,
document: Any,
timestamp: datetime,
interfaces: Optional[List[str]],
app_config_params: dict,
output: OutputMethod,
point_group: PointGroup,
):
ssh_params = vendor.config_params(app_config_params)
document = vendor.get_netconf(router_name=router_fqdn, ssh_params=ssh_params)
timestamp = datetime.now()
influx_params = point_group.config_params(app_config_params)["influx"]
points = list(
_points(
router_fqdn=router_fqdn,
......@@ -176,7 +175,7 @@ def process_router(
)
)
_log_interface_points_sorted(points, point_kind="error")
_log_interface_points_sorted(points, point_kind=str(point_group))
output.write_points(points, influx_params=influx_params)
......@@ -226,6 +225,9 @@ def main(
if not app_config_params.get(vendor_str):
raise ValueError(f"'{vendor_str}' ssh params are required")
ssh_params = vendor.config_params(app_config_params)
netconf = vendor.get_netconf(router_name=router_fqdn, ssh_params=ssh_params)
timestamp = datetime.now()
for point_group in PointGroup:
logger.info(f"Processing {str(point_group).capitalize()} points...")
......@@ -240,6 +242,8 @@ def main(
process_router(
router_fqdn=router_fqdn,
vendor=vendor,
document=netconf,
timestamp=timestamp,
interfaces=check_interfaces,
app_config_params=app_config_params,
output=output,
......
......@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name='brian-polling-manager',
version="0.9",
version="0.10",
author='GEANT',
author_email='swd@geant.org',
description='service for managing BRIAN polling checks',
......
......@@ -208,15 +208,17 @@ def test_main_for_all_juniper_routers(
def mocked_load_inventory():
with patch.object(cli, "load_inventory_json") as mock:
mock.return_value = [
{"router": "router1", "name": "ifc1"},
{"router": "router1", "name": "ifc2"},
{"router": "router2", "name": "ifc3"},
{"router": "mx1.ams.nl.geant.net", "name": "ifc1"},
{"router": "mx1.ams.nl.geant.net", "name": "ifc2"},
{"router": "mx1.lon.uk.geant.net", "name": "ifc3"},
]
yield mock
@patch.object(cli, "process_router")
def test_main_with_some_interfaces(process_router, mocked_load_inventory):
def test_main_with_some_interfaces(
process_router, mocked_load_inventory, mocked_get_netconf
):
config = {
"juniper": {"some": "params"},
"inventory": ["some-inprov"],
......@@ -225,7 +227,7 @@ def test_main_with_some_interfaces(process_router, mocked_load_inventory):
}
cli.main(
config,
"router1",
"mx1.ams.nl.geant.net",
Vendor.JUNIPER,
interfaces=["ifc1"],
)
......@@ -234,7 +236,7 @@ def test_main_with_some_interfaces(process_router, mocked_load_inventory):
@patch.object(cli, "process_router")
def test_main_with_all_interfaces_and_inprov_hosts(
process_router, mocked_load_inventory
process_router, mocked_load_inventory, mocked_get_netconf
):
config = {
"juniper": {"some": "params"},
......@@ -242,20 +244,20 @@ def test_main_with_all_interfaces_and_inprov_hosts(
"brian-counters": {},
"error-counters": {},
}
cli.main(config, "router1", Vendor.JUNIPER)
cli.main(config, "mx1.ams.nl.geant.net", Vendor.JUNIPER)
assert process_router.call_args[1]["interfaces"] == ["ifc1", "ifc2"]
@patch.object(cli, "process_router")
def test_main_with_all_interfaces_no_inprov_hosts(
process_router, mocked_load_inventory
process_router, mocked_load_inventory, mocked_get_netconf
):
config = {
"juniper": {"some": "params"},
"brian-counters": {},
"error-counters": {},
"brian-counters": {"influx": None},
"error-counters": {"influx": None},
}
cli.main(config, "router1", Vendor.JUNIPER)
cli.main(config, "mx1.ams.nl.geant.net", Vendor.JUNIPER)
assert process_router.call_args[1]["interfaces"] is None
......@@ -274,7 +276,7 @@ def test_loads_interfaces_from_endpoint(point_group, url, mocked_load_inventory)
"error-counters": {"inventory-url": "/error/endpoint"},
}
cli.load_interfaces(
"router1",
"mx1.ams.nl.geant.net",
interfaces=cli.ALL_,
app_config_params=config,
point_group=point_group,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment