[Nexthop][fboss2-dev] Add delete qos policy subcommands - #1497
Open
vybhav-nexthop wants to merge 1 commit into
Open
[Nexthop][fboss2-dev] Add delete qos policy subcommands#1497vybhav-nexthop wants to merge 1 commit into
vybhav-nexthop wants to merge 1 commit into
Conversation
vybhav-nexthop
force-pushed
the
delete-qos-policy
branch
from
August 13, 2026 12:42
00833f3 to
3b12032
Compare
Adds the delete counterpart to the existing `config qos policy` family: fboss2-dev delete qos policy <name> fboss2-dev delete qos policy <name> map dscp <dscp-value> fboss2-dev delete qos policy <name> map tc-to-queue <tc> Whole-policy delete refuses when the policy is still named by dataPlaneTrafficPolicy or cpuTrafficPolicy.trafficPolicy, via either defaultQosPolicy or portIdToQosPolicy. The error reports the referring field so the operator knows what to unset first. Cascading instead would change forwarding on ports the user did not name. dscpMaps groups codepoints under an internalTrafficClass, so removing a DSCP value erases it from the group that lists it. A group left with no ingress codepoints and no fromTrafficClassToDscp rewrite carries no information and is dropped; one that still has the egress rewrite is kept. tc-to-queue is a plain map erase. Only dscp and tc-to-queue are removable; the other map types the config command writes are rejected by name. The policy-by-name scan and the DSCP bounds are shared with the config side via QosPolicyUtils, so both agree on what "the policy called X" means and on the valid DSCP range.
vybhav-nexthop
force-pushed
the
delete-qos-policy
branch
from
August 13, 2026 13:08
3b12032 to
b0c361d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit runSummary
What. Adds the delete counterpart to the existing
config qos policyfamily:Why. The QoS
policy object itself, its DSCP-to-traffic-class mappings, and its
traffic-class-to-queue mappings needs the delete operation. You could add them and never take them away.
How.
Whole-policy delete refuses when the policy is still named by
dataPlaneTrafficPolicyorcpuTrafficPolicy.trafficPolicy, through eitherdefaultQosPolicyorportIdToQosPolicy, and reports the exact referringfield. These are plain strings in thrift, so nothing else stops a delete from
leaving a dangling reference. Refusing rather than cascading is deliberate->
clearing the referrer would change forwarding on ports the user did not name.
dscpMapsis a list of groups keyed byinternalTrafficClass, not a flat map,so removing a DSCP value erases it from the group that lists it. A group left
with no ingress codepoints and no
fromTrafficClassToDscprewrite carries noinformation and is dropped; a group that still has the egress rewrite is kept —
the two halves are independent.
tc-to-queueis a plain map erase.Only
dscpandtc-to-queueare removable. The other map typesCmdConfigQosPolicyMapcan write are rejected by name with the supported listrather than silently accepted
The policy-by-name scan moves into a shared
utils::findQosPolicy(
commands/config/qos/QosPolicyUtils.h, alongside the existingPortQueueConfigUtils), replacing three separate copies — one in each newdelete command and the hand-rolled loop in
CmdConfigQosPolicyMap. The nameargument reuses
QosPolicyNamefrom the config side for the same reason, theway
delete qos queuing-policyreusesQueuingPolicyName.Test Plan
15 unit tests in
CmdDeleteQosPolicyTest.cpp, seeded with one deletablepolicy and one referenced by
dataPlaneTrafficPolicy.defaultQosPolicy:Full
cmd_config_testsuite, unfiltered, no regressions:Integration test —
test/integration_test/DeleteQosPolicyTest.cpp, one test,self-cleaning: create a scratch policy carrying a dscp mapping and a
tc-to-queue mapping, delete the dscp entry and assert
trafficClassToQueueIdis untouched, assert the repeat delete errors, delete the tc-to-queue entry,
delete the policy, assert the repeat delete errors.
Review Findings
Pre-publication review (fboss-review) is clean after fixes: the three refusal
branches (portIdToQosPolicy, cpuTrafficPolicy, and the no-qosMap guard) gained
unit coverage, and the DSCP bounds and find-policy-or-throw were de-duplicated
into QosPolicyUtils.