Skip to content

Add ospf auto cost reference bandwidth - #1545

Draft
ky-teramae wants to merge 3 commits into
openconfig:masterfrom
ky-teramae:add_ospf-auto-cost-reference-bandwidth
Draft

ky-teramae wants to merge 3 commits into
openconfig:masterfrom
ky-teramae:add_ospf-auto-cost-reference-bandwidth

Conversation

@ky-teramae

@ky-teramae ky-teramae commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Change Scope

  • Add reference-bandwidth container to OSPF global structure,
    equivalent to that of ISIS global config.
  • Backward compatible: Yes (new optional container only).

Platform Implementations

router ospf <process-id>
 auto-cost reference-bandwidth <mbps>

router ospfv3 <process-id>
 auto-cost reference-bandwidth <mbps>
  • Implementation B: DriveNets DNOS — auto-cost reference-bandwidth
protocols ospf auto-cost reference-bandwidth <mbps>

protocols ospfv3 auto-cost reference-bandwidth <mbps>

Tree 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?   uint32
 module: 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

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +223 to +230
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.";
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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
  1. OpenConfig Style Guide recommends that any leaf representing a physical or logical quantity with a unit must have a units statement. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

leaf reference-bandwidth {
type uint32;
description
"ISIS Reference Bandwidth value";
}

Comment on lines +347 to +354
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.";
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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
  1. OpenConfig Style Guide recommends that any leaf representing a physical or logical quantity with a unit must have a units statement. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

leaf reference-bandwidth {
type uint32;
description
"ISIS Reference Bandwidth value";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant