diff --git a/openr/py/openr/cli/clis/lm.py b/openr/py/openr/cli/clis/lm.py index 24a357eb6cf..ac9629a7f2d 100644 --- a/openr/py/openr/cli/clis/lm.py +++ b/openr/py/openr/cli/clis/lm.py @@ -18,7 +18,6 @@ class LMCli: def __init__(self): - # [Show Cmd] self.lm.add_command(LMLinksCli().links, name="links") self.lm.add_command(LMAdjCli().adj, name="adj") @@ -252,7 +251,12 @@ class OverrideAdjMetricCli: @click.option("--quiet", is_flag=True, help="Do not print out the links table") @click.pass_obj def override_adj_metric( - cli_opts, node, interface, metric, yes, quiet # noqa: B902 + cli_opts, + node, + interface, + metric, + yes, + quiet, # noqa: B902 ): """ Override the adjacency metric value. diff --git a/openr/py/openr/cli/clis/prefix_mgr.py b/openr/py/openr/cli/clis/prefix_mgr.py index 0c48f345e5f..bb4f213121a 100644 --- a/openr/py/openr/cli/clis/prefix_mgr.py +++ b/openr/py/openr/cli/clis/prefix_mgr.py @@ -90,7 +90,9 @@ def all(cli_opts: bunch.Bunch, prefix: list[str]) -> None: # noqa: B902 @click.argument("prefix", nargs=-1, type=str, required=False) @click.pass_obj def pre_area_policy( - cli_opts: bunch.Bunch, area: str, prefix: list[str] # noqa: B902 + cli_opts: bunch.Bunch, + area: str, + prefix: list[str], # noqa: B902 ) -> None: """ Show pre-policy routes for advertisment of specified area @@ -112,7 +114,9 @@ def pre_area_policy( @click.argument("prefix", nargs=-1, type=str, required=False) @click.pass_obj def post_area_policy( - cli_opts: bunch.Bunch, area: str, prefix: list[str] # noqa: B902 + cli_opts: bunch.Bunch, + area: str, + prefix: list[str], # noqa: B902 ) -> None: """ Show post-policy routes that are advertisment to specified area @@ -133,7 +137,9 @@ def post_area_policy( @click.argument("prefix", nargs=-1, type=str, required=False) @click.pass_obj def rejected_on_area( - cli_opts: bunch.Bunch, area: str, prefix: list[str] # noqa: B902 + cli_opts: bunch.Bunch, + area: str, + prefix: list[str], # noqa: B902 ) -> None: """ Show routes rejected by area policy on advertisement diff --git a/openr/py/openr/cli/commands/decision.py b/openr/py/openr/cli/commands/decision.py index c67f78c2558..18e57bc6467 100644 --- a/openr/py/openr/cli/commands/decision.py +++ b/openr/py/openr/cli/commands/decision.py @@ -106,7 +106,6 @@ async def _run( *args, **kwargs, ) -> None: - adj_dbs = await client.getDecisionAdjacenciesFiltered( ctrl_types.AdjacenciesFilter(selectAreas=areas) ) @@ -563,7 +562,9 @@ async def _run( return errors - async def get_dbs(self, client: OpenrCtrlCppClient.Async, area: str) -> tuple[ + async def get_dbs( + self, client: OpenrCtrlCppClient.Async, area: str + ) -> tuple[ Sequence[openr_types.AdjacencyDatabase], Sequence[ctrl_types.ReceivedRouteDetail], Mapping[str, kv_store_types.Value], diff --git a/openr/py/openr/cli/commands/fib.py b/openr/py/openr/cli/commands/fib.py index 4b6b83033b4..1a027368db6 100644 --- a/openr/py/openr/cli/commands/fib.py +++ b/openr/py/openr/cli/commands/fib.py @@ -274,7 +274,6 @@ async def _run( *args, **kwargs, ) -> int: - all_success = True # fetch openr config for comparison @@ -508,7 +507,6 @@ async def _run( *args, **kwargs, ) -> None: - initialDb, updates = await client.subscribeAndGetFib() # Print summary print(f" Routes for {initialDb.thisNodeName}.") @@ -575,7 +573,6 @@ async def _run( *args, **kwargs, ) -> None: - subscribers = await client.getSubscriberInfo(StreamSubscriberType.FIB) # Prepare the table diff --git a/openr/py/openr/cli/commands/kvstore.py b/openr/py/openr/cli/commands/kvstore.py index 822f6897bda..cb2abcc14b4 100644 --- a/openr/py/openr/cli/commands/kvstore.py +++ b/openr/py/openr/cli/commands/kvstore.py @@ -924,7 +924,6 @@ def print_delta( delta: bool, global_dbs: dict, ): - for key, value in msg.keyVals.items(): if value.value is None: print(f"Traversal List: {msg.nodeIds}") @@ -1221,7 +1220,6 @@ async def _run( *args, **kwargs, ) -> None: - subscribers = await client.getSubscriberInfo(StreamSubscriberType.KVSTORE) # Prepare the table @@ -1258,7 +1256,6 @@ async def _run( *args, **kwargs, ) -> bool: - is_pass = True # Get data diff --git a/openr/py/openr/cli/commands/lm.py b/openr/py/openr/cli/commands/lm.py index ad4670765e8..d5d32254718 100644 --- a/openr/py/openr/cli/commands/lm.py +++ b/openr/py/openr/cli/commands/lm.py @@ -548,7 +548,6 @@ async def _run( *args, **kwargs, ) -> bool: - is_pass = True # Get Data @@ -602,10 +601,14 @@ def _validate_interface_regex( redistr_regexes = area.redistribute_interface_regexes passes_incl_regexes = self.validate_regexes( - incl_regexes, [interface], True # expect at least one regex match + incl_regexes, + [interface], + True, # expect at least one regex match ) passes_excl_regexes = self.validate_regexes( - excl_regexes, [interface], False # expect no regex match + excl_regexes, + [interface], + False, # expect no regex match ) passes_redistr_regexes = self.validate_regexes( redistr_regexes, [interface], True @@ -631,7 +634,6 @@ def _print_interface_validation_info( self, invalid_interfaces: dict[str, Any], ) -> None: - click.echo( self.validation_result_str( "link monitor", "Interface Regex Check", (len(invalid_interfaces) == 0) diff --git a/openr/py/openr/cli/commands/openr.py b/openr/py/openr/cli/commands/openr.py index a79399d82dc..d40bfd2416c 100644 --- a/openr/py/openr/cli/commands/openr.py +++ b/openr/py/openr/cli/commands/openr.py @@ -81,7 +81,6 @@ def run( *args, **kwargs, ) -> int: - spark_pass = spark.ValidateCmd(self.cli_opts).run(detail=False) lm_pass = lm.LMValidateCmd(self.cli_opts).run() kvstore_pass = kvstore.ValidateCmd(self.cli_opts).run() diff --git a/openr/py/openr/cli/commands/prefix_mgr.py b/openr/py/openr/cli/commands/prefix_mgr.py index 62f96cb36b0..ef323be48e4 100644 --- a/openr/py/openr/cli/commands/prefix_mgr.py +++ b/openr/py/openr/cli/commands/prefix_mgr.py @@ -74,7 +74,6 @@ async def _run( *args, **kwargs, ) -> None: - # Get data routes = await self.fetch(client, prefixes, prefix_type) @@ -122,7 +121,6 @@ async def _run( *args, **kwargs, ) -> None: - # Get data await self._render(await client.getOriginatedPrefixes(), detailed, tag2name) @@ -266,7 +264,6 @@ async def _run( *args, **kwargs, ) -> None: - # Get data routes = await self.fetch(client, route_filter_type, prefixes, prefix_type) @@ -321,7 +318,6 @@ async def _run( *args, **kwargs, ) -> None: - # Deduce / Validate area area = await utils.deduce_area(client, area) @@ -375,7 +371,6 @@ async def _run( *args, **kwargs, ) -> bool: - is_pass = True # Get Data diff --git a/openr/py/openr/cli/commands/spark.py b/openr/py/openr/cli/commands/spark.py index 5de32da5037..99d8f47dc44 100644 --- a/openr/py/openr/cli/commands/spark.py +++ b/openr/py/openr/cli/commands/spark.py @@ -112,7 +112,6 @@ async def _run( *args, **kwargs, ) -> None: - # Get data neighbors = await client.getNeighbors() @@ -138,7 +137,6 @@ class ValidateCmd(SparkBaseCmd): async def _run( self, client: OpenrCtrlCppClient.Async, detail: bool, *args, **kwards ) -> bool: - is_pass = True # Get data @@ -262,7 +260,6 @@ def _print_neighbor_regex_info( regexes: dict[str, list[str]], detail: bool, ) -> None: - click.echo( self.validation_result_str( "spark", "neighbor regex matching check", (len(invalid_neighbors) == 0) diff --git a/openr/py/openr/cli/tests/fib/tests.py b/openr/py/openr/cli/tests/fib/tests.py index 77964aef6a2..b843b471338 100644 --- a/openr/py/openr/cli/tests/fib/tests.py +++ b/openr/py/openr/cli/tests/fib/tests.py @@ -92,7 +92,6 @@ def check_printed_routes( def check_dest_line( dest_line: str, ) -> Sequence[NextHopThrift] | None: - is_valid_route = False next_hops = None diff --git a/openr/py/openr/cli/tests/spark/tests.py b/openr/py/openr/cli/tests/spark/tests.py index 1b108d456eb..96856eaba2a 100644 --- a/openr/py/openr/cli/tests/spark/tests.py +++ b/openr/py/openr/cli/tests/spark/tests.py @@ -327,7 +327,6 @@ def test_spark_validate_regex_accept_all( def test_spark_validate_regex_diff_ids( self, mocked_openr_client: AsyncMock ) -> None: - # Checking if it passes with different ids and correct areas mocked_returned_connection = helpers.get_enter_thrift_asyncmock( mocked_openr_client @@ -385,7 +384,6 @@ def test_spark_validate_regex_diff_ids( def test_spark_validate_regex_accept_none( self, mocked_openr_client: AsyncMock ) -> None: - # Checking if it fails when no node is accepted # Also checks if it correclty prints out more than 1 failed neighbor mocked_returned_connection = helpers.get_enter_thrift_asyncmock( diff --git a/openr/py/openr/cli/utils/utils.py b/openr/py/openr/cli/utils/utils.py index 0e116407b32..627a5e898ee 100644 --- a/openr/py/openr/cli/utils/utils.py +++ b/openr/py/openr/cli/utils/utils.py @@ -306,7 +306,6 @@ def collate_prefix_keys( prefix_maps = {} for key, value in sorted(kvstore_keyvals.items()): if key.startswith(Consts.PREFIX_DB_MARKER): - node_name = key.split(":")[1] if value.value: prefix_db = deserialize(openr_types.PrefixDatabase, value.value) @@ -442,7 +441,9 @@ def build_global_prefix_db(resp): return global_prefix_db -def dump_adj_db_full(global_adj_db, adj_db, bidir) -> tuple[ +def dump_adj_db_full( + global_adj_db, adj_db, bidir +) -> tuple[ int, bool, list[openr_types_py.Adjacency] | Sequence[openr_types.Adjacency], @@ -1466,7 +1467,6 @@ def compare_route_db( sources: list[str], quiet: bool = False, ) -> tuple[bool, list[str]]: - extra_routes_in_a = routes_difference(routes_a, routes_b, route_type) extra_routes_in_b = routes_difference(routes_b, routes_a, route_type) diff_prefixes = prefixes_with_different_nexthops(routes_a, routes_b, route_type) @@ -1722,9 +1722,8 @@ def print_unicast_routes( def build_unicast_route( route: network_types.UnicastRoute | network_types_py.UnicastRoute, - filter_for_networks: None | ( - list[ipaddress.IPv4Network | ipaddress.IPv6Network] - ) = None, + filter_for_networks: None + | (list[ipaddress.IPv4Network | ipaddress.IPv6Network]) = None, filter_exact_match: bool = False, nexthops_to_neighbor_names: dict[bytes, str] | None = None, ) -> tuple[str, list[str]] | None: