Skip to content

refactor: decompose _build_tcs_tree into structural and property-populating helpers - #182

Open
bhagathkrishnacdac wants to merge 1 commit into
omec-project:mainfrom
bhagathkrishnacdac:bess-complexity-fix-commands
Open

refactor: decompose _build_tcs_tree into structural and property-populating helpers#182
bhagathkrishnacdac wants to merge 1 commit into
omec-project:mainfrom
bhagathkrishnacdac:bess-complexity-fix-commands

Conversation

@bhagathkrishnacdac

Copy link
Copy Markdown

Description
This PR refactors _build_tcs_tree to address cognitive complexity and simplify scheduling hierarchy visualization. The original monolithic function, which managed tree node construction, relationship linking, policy checking, and string formatting in multiple redundant loops, has been divided into focused, single-responsibility helpers.

Key Changes

  • Separated Node Construction: Extracted _create_tc_node to construct standard dictionary nodes for individual traffic classes.
  • Isolated Topology Mapping: Extracted _build_parent_child_relationships to handle the recursive linking of parent and child traffic classes in the tree.
  • Decoupled Property Formatting: Extracted _populate_show_list to handle policy-specific formatting (e.g., parsing weighted_fair shares, priority values, and rate limits/burst metrics).
  • Streamlined Orchestrator: Simplified _build_tcs_tree into a linear, three-step execution pipeline.

…lating helpers

Signed-off-by: bhagathkrishnacdac <bhagath.krishna@cdac.in>
@bhagathkrishnacdac
bhagathkrishnacdac requested a review from a team August 2, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant