diff --git a/brian_polling_manager/interface_stats/cli.py b/brian_polling_manager/interface_stats/cli.py index 7c8035d43bea3af3ee3a9499ffa14926fc4c68ca..ac18cfda2e81fc16b0e810b4dee3f4c21a718827 100644 --- a/brian_polling_manager/interface_stats/cli.py +++ b/brian_polling_manager/interface_stats/cli.py @@ -176,7 +176,7 @@ def process_juniper_router( ) ) - _log_interface_points_sorted(points, point_kind='error') + _log_interface_points_sorted(points, point_kind="error") write_points(points, influx_params=influx_params) @@ -184,10 +184,8 @@ def _log_interface_points_sorted(points: Sequence[dict], point_kind=""): N_COLUMNS = 5 num_points = len(points) point_kind = point_kind + " " if point_kind else "" - semicolon = ':' if num_points else '' - logger.info( - f"Found {point_kind}points for {num_points} interfaces{semicolon}" - ) + semicolon = ":" if num_points else "" + logger.info(f"Found {point_kind}points for {num_points} interfaces{semicolon}") if not points: return diff --git a/brian_polling_manager/interface_stats/vendors/juniper.py b/brian_polling_manager/interface_stats/vendors/juniper.py index 7102b3a9932e79b64dbaa025a43470f7cea84533..bd1b14997cc65fb6e0dd42af1bb4952cb8ea2303 100644 --- a/brian_polling_manager/interface_stats/vendors/juniper.py +++ b/brian_polling_manager/interface_stats/vendors/juniper.py @@ -138,8 +138,8 @@ def _physical_interface_counters(ifc_doc): ' or name[(starts-with(normalize-space(), "ae"))]' ' or name[(starts-with(normalize-space(), "irb"))]' ' or name[(starts-with(normalize-space(), "gr"))])' - ' and normalize-space(admin-status)="up"' - ' and normalize-space(oper-status)="up"' + # ' and normalize-space(admin-status)="up"' + # ' and normalize-space(oper-status)="up"' "]" ): result = parse_interface_xml(phy, PHYSICAL_INTERFACE_COUNTERS) @@ -156,8 +156,8 @@ def _logical_interface_counters(ifc_doc): ' or name[(starts-with(normalize-space(), "ae"))]' ' or name[(starts-with(normalize-space(), "irb"))]' ' or name[(starts-with(normalize-space(), "gr"))])' - ' and normalize-space(admin-status)="up"' - ' and normalize-space(oper-status)="up"' + # ' and normalize-space(admin-status)="up"' + # ' and normalize-space(oper-status)="up"' "]/logical-interface" ): result = parse_interface_xml(logical, LOGICAL_INTERFACE_COUNTERS) diff --git a/test/interface_stats/test_interface_stats.py b/test/interface_stats/test_interface_stats.py index 421417f8af80f9f24be4c84fc4782478cd446a4e..40ff6ae004d78063a6e8bcbf96170b03e29a48bb 100644 --- a/test/interface_stats/test_interface_stats.py +++ b/test/interface_stats/test_interface_stats.py @@ -43,6 +43,7 @@ def test_verify_all_interfaces_present(single_router_fqdn, polled_interfaces): over all test data sets ... the point of the test is a sanity check of our test data """ + def _is_enabled(ifc_name, ifc_doc): m = re.match(r"^([^\.]+)\.?.*", ifc_name) assert m # sanity: should never fail @@ -386,8 +387,8 @@ def test_main_for_all_juniper_routers(write_points, all_juniper_routers): @pelle: this is not a maintainable pattern (e.g. POL1-799 or similar things) ... please do something nicer (actually > a few calls/points is enough) """ - assert calls == 104 - assert total_points == 6819 + assert calls > 0 + assert total_points > 0 class TestGetJuniperNetConnf: @@ -400,9 +401,7 @@ class TestGetJuniperNetConnf: @pytest.fixture(autouse=True) def mocked_rpc(self, data_dir): raw_response = data_dir.joinpath(self.RAW_RESPONSE_FILE).read_text() - with patch.object( - juniper, "_rpc", return_value=RPCReply(raw_response) - ) as mock: + with patch.object(juniper, "_rpc", return_value=RPCReply(raw_response)) as mock: yield mock def test_calls_rpc_with_params(self, mocked_rpc): @@ -522,8 +521,7 @@ def test_prepare_influx_params(input_params, expected): @pytest.mark.parametrize( - "hostname", - ['rt0.lon.uk.lab.office.geant.net', 'rt0.ams.nl.lab.office.geant.net'] + "hostname", ["rt0.lon.uk.lab.office.geant.net", "rt0.ams.nl.lab.office.geant.net"] ) def test_nokia_counters(hostname): """ diff --git a/tox.ini b/tox.ini index d71b8bb5f34e142209e1e43cd14fd8f12902fa64..a0c8412c0f808e4c1744b4a40c2b9cee8e33e762 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ envlist = py36 [flake8] max-line-length = 120 +extend-ignore = E203,E701,W605 [testenv] passenv = USE_COMPOSE