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