Skip to content

Calculate physical MTU and header overhead in device transformation code #3664

Description

@jbemmel

Problem

Several initial-configuration templates calculate device-facing physical MTU from the normalized IP MTU using inline arithmetic and magic constants:

{{ mtu + 14 }}
{{ [l.mtu + 14, 1500]|max }}
{{ l.mtu + 32 }}

The calculations currently appear in SR Linux, Dell OS10, and IOS XR templates. SR Linux also defines the same 14-byte overhead in Python for MTU validation, so rendering and validation duplicate one platform rule and could drift apart. Junos already provides a useful precedent by calculating _junos_mtu_with_headers in device quirk code.

Suggested enhancement

Move physical/frame MTU calculation into device transformation or quirk code, using named constants and producing render-ready node and interface attributes. Reuse those derived values for both validation and rendering.

Acceptance criteria

  • SR Linux, Dell OS10, and IOS XR physical MTU values are calculated in Python.
  • Named platform constants replace template magic numbers.
  • SR Linux validation and rendering use the same derived value or calculation helper.
  • Existing generated configurations remain unchanged.
  • Initial configuration templates no longer add MTU overhead inline.
  • Tests cover node-level, interface-level, minimum-frame-size, and platform-limit behavior.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions