Skip to content

Add support for ospf auto cost configuration - #1693

Open
saba8814 wants to merge 4 commits into
mainfrom
add-support-for-ospf-auto-cost-configuration
Open

saba8814 wants to merge 4 commits into
mainfrom
add-support-for-ospf-auto-cost-configuration

Conversation

@saba8814

@saba8814 saba8814 commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Description

All OSPF routers in a domain need the same auto-cost reference bandwidth
to agree on link costs. Other vendors use other defaults than Frr, so
the value has to be configurable. Resolves #1576.

The auto-cost container from ietf-ospf is now supported, for OSPFv2
and OSPFv3:

  • reference-bandwidth defaults to 100000 Mbit/s, the Frr default used
    so far. Link costs do not change on upgrade, so no migration script
    is needed.
  • enabled is always true. Frr has no way to turn auto-cost off, so
    setting it to false is rejected. An explicit interface cost still
    overrides the calculated one.
  • The value in use can be read from the operational datastore and is
    shown by show ip ospf and show ipv6 ospf.

The new test ospf_auto_cost runs for both OSPF versions. It sets the
reference bandwidth on both routers and checks the interface cost. On
a 1 Gbit/s link, 100000, 10000 and 1000 Mbit/s give the costs 100, 10
and 1.

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@saba8814 saba8814 added the ci:main Build default defconfig, not minimal label Oct 7, 2026

@troglobit troglobit 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.

Minor comments, mostly for internal discussion.

Comment thread src/confd/yang/confd/infix-routing.yang Outdated
Comment on lines +444 to +447
deviation "/rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/ospf:auto-cost/ospf:reference-bandwidth" {
deviate add {
default "100000";
}

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.

This needs the eyes of an expert, @jovatn how will this affect existing Styx installations?

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.

Ah, I see now that the default is the same as the previous hard-coded value in Frr. So less critical, but maybe we should change the default? What do you think @jovatn ...

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.

I'm a bit in a hurry now, but lets discuss next week if you think we should change.
We have not discussed this, but my main intention was to use FRR defaults as Infix defaults (see initial description)

  • Then we should not need migration scripts
  • And I believe that 100Gbit/s is a better reference bandwidth for the future than 100Mbit/s (or whatever the standard may say).

Still, it is wise to lookup existing styx installations, although I believe/hope that adjustments (if needed) be done on appropriate repo than on mainline Infix.

@saba8814
saba8814 force-pushed the add-support-for-ospf-auto-cost-configuration branch 2 times, most recently from 5edf54b to 22355ea Compare October 8, 2026 15:57
All routers in an OSPF domain must use the same reference bandwidth to
agree on link costs, and other vendors default to other values than
Frr.  Until now the value was fixed at the Frr default.

Enable the ietf-ospf auto-cost feature for OSPFv2 and OSPFv3.  The
reference-bandwidth leaf defaults to 100000 Mbit/s, the value used so
far, so link costs do not change on upgrade and no migration is
needed.  Frr can not turn auto-cost off, so the enabled leaf defaults
to true and false is rejected.

Resolves: #1576
Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
To check that the reference bandwidth matches across the domain it has
to be readable.  Frr has no JSON for it, so read it from the daemon's
running-config, which lists it only when it differs from the default.

Report it for OSPFv2 and OSPFv3, and show it in 'show ip ospf' and
'show ipv6 ospf'.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
Verify that the interface cost follows the reference bandwidth, for
OSPFv2 and OSPFv3.  The expected cost is derived from the link speed,
so the test works on hardware and on virtual links of unknown speed.
On a 1 Gbit/s link the reference bandwidths 100000, 10000 and 1000
Mbit/s give the costs 100, 10 and 1.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
Explain why the reference bandwidth must match across the domain, how
the interface cost is calculated, and where to read the value.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
@saba8814
saba8814 force-pushed the add-support-for-ospf-auto-cost-configuration branch from 22355ea to a46aefa Compare October 8, 2026 16:06

This branch has not been deployed

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

Labels

ci:main Build default defconfig, not minimal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add configuration support for OSPF auto-cost reference bandwidth

3 participants