Add ospf auto cost reference bandwidth - #1545
ky-teramae wants to merge 3 commits into
Conversation
Neither OSPF (v3) nor OSPFv2 has a way to configure the reference bandwidth used to calculate interface-bandwidth-derived metrics (auto-cost reference-bandwidth), unlike ISIS which has a reference-bandwidth leaf under isis/global/reference-bandwidth. Add the equivalent reference-bandwidth container (with a reference-bandwidth leaf) under the OSPF and OSPFv2 global structure.
Simplify the revision wording. Move the new reference-bandwidth-config grouping to after the existing inter-areapp-config grouping, and the new reference-bandwidth container to after inter-area-propagation-policies, so the diff appends rather than inserting into the middle of the existing grouping/container order. No schema change. Also replace the placeholder "Align revisions across modules." text on unmodified sibling submodules with the same revision description used on the files that actually changed, per reviewer request.
There was a problem hiding this comment.
Code Review
This pull request introduces a reference-bandwidth container to the global structures of both OSPF and OSPFv2, aligning them with the ISIS global configuration. Feedback on these changes suggests adding a units statement ('Megabits per second') to the reference-bandwidth leaf in both models to comply with OpenConfig style guidelines, as well as restricting the leaf's range to 1..max to prevent potential division-by-zero errors.
| leaf reference-bandwidth { | ||
| type uint32; | ||
| description | ||
| "The reference bandwidth, in Mbit/s, used by the local | ||
| system to calculate the default metric for an interface | ||
| based on its bandwidth. Equivalent to the | ||
| reference-bandwidth leaf on the ISIS global config."; | ||
| } |
There was a problem hiding this comment.
The reference-bandwidth leaf represents a physical quantity (bandwidth in Megabits per second) and should include a units statement to adhere to OpenConfig style guidelines. Additionally, a reference bandwidth of 0 is semantically invalid as it would lead to division-by-zero errors when calculating interface metrics. Restricting the type to range "1..max" ensures robust data validation.
| leaf reference-bandwidth { | |
| type uint32; | |
| description | |
| "The reference bandwidth, in Mbit/s, used by the local | |
| system to calculate the default metric for an interface | |
| based on its bandwidth. Equivalent to the | |
| reference-bandwidth leaf on the ISIS global config."; | |
| } | |
| leaf reference-bandwidth { | |
| type uint32 { | |
| range "1..max"; | |
| } | |
| units "Megabits per second"; | |
| description | |
| "The reference bandwidth, in Mbit/s, used by the local | |
| system to calculate the default metric for an interface | |
| based on its bandwidth. Equivalent to the | |
| reference-bandwidth leaf on the ISIS global config."; | |
| } |
References
- OpenConfig Style Guide recommends that any leaf representing a physical or logical quantity with a unit must have a units statement. (link)
There was a problem hiding this comment.
Thanks. Added units, but as Mbps to match the existing convention:
Left the type unconstrained — the equivalent IS-IS leaf is a plain uint32, valid ranges differ per platform, and a constraint would be backward-incompatible to remove later.
public/release/models/isis/openconfig-isis.yang
Lines 550 to 554 in 2198811
| leaf reference-bandwidth { | ||
| type uint32; | ||
| description | ||
| "The reference bandwidth, in Mbit/s, used by the local | ||
| system to calculate the default metric for an interface | ||
| based on its bandwidth. Equivalent to the | ||
| reference-bandwidth leaf on the ISIS global config."; | ||
| } |
There was a problem hiding this comment.
The reference-bandwidth leaf represents a physical quantity (bandwidth in Megabits per second) and should include a units statement to adhere to OpenConfig style guidelines. Additionally, a reference bandwidth of 0 is semantically invalid as it would lead to division-by-zero errors when calculating interface metrics. Restricting the type to range "1..max" ensures robust data validation.
| leaf reference-bandwidth { | |
| type uint32; | |
| description | |
| "The reference bandwidth, in Mbit/s, used by the local | |
| system to calculate the default metric for an interface | |
| based on its bandwidth. Equivalent to the | |
| reference-bandwidth leaf on the ISIS global config."; | |
| } | |
| leaf reference-bandwidth { | |
| type uint32 { | |
| range "1..max"; | |
| } | |
| units "Megabits per second"; | |
| description | |
| "The reference bandwidth, in Mbit/s, used by the local | |
| system to calculate the default metric for an interface | |
| based on its bandwidth. Equivalent to the | |
| reference-bandwidth leaf on the ISIS global config."; | |
| } |
References
- OpenConfig Style Guide recommends that any leaf representing a physical or logical quantity with a unit must have a units statement. (link)
There was a problem hiding this comment.
Thanks. Added units, but as Mbps to match the existing convention:
Left the type unconstrained — the equivalent IS-IS leaf is a plain uint32, valid ranges differ per platform, and a constraint would be backward-incompatible to remove later.
public/release/models/isis/openconfig-isis.yang
Lines 550 to 554 in 2198811
Change Scope
equivalent to that of ISIS global config.
Platform Implementations
auto-cost reference-bandwidth(OSPFv3: same command underrouter ospfv3)auto-cost reference-bandwidthTree View
module: openconfig-ospfv2 +--rw network-instances +--rw network-instance* [name] +--rw protocols +--rw protocol* [identifier name] +--rw ospfv2 +--rw global +--rw inter-area-propagation-policies ... + +--rw reference-bandwidth + +--rw config + +--rw reference-bandwidth? uint32module: openconfig-ospf (OSPFv3, shares the ospf-global submodule) +--rw network-instances +--rw network-instance* [name] +--rw protocols +--rw protocol* [identifier name] +--rw ospfv3 +--rw global +--rw inter-area-propagation-policies ... + +--rw reference-bandwidth + +--rw config + +--rw reference-bandwidth? uint32