Skip to content

yang: metric-type identity declared but never used in an augment in f…#22617

Open
y-bharath14 wants to merge 1 commit into
FRRouting:masterfrom
y-bharath14:srib-yang-Ver23
Open

yang: metric-type identity declared but never used in an augment in f…#22617
y-bharath14 wants to merge 1 commit into
FRRouting:masterfrom
y-bharath14:srib-yang-Ver23

Conversation

@y-bharath14

Copy link
Copy Markdown
Contributor

metric-type identity declared but never used in an augment
Added a case metric-type augment, similar to frr-ospf-route-map.yang

identity metric-type {
base frr-route-map:rmap-set-type;
description
"Set the type of metric";
}

...
...

@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR completes the OSPFv6 route-map metric-type set-action by wiring together three layers that were previously mismatched: the YANG model, the northbound registration, and the VTY CLI.

  • YANG (frr-ospf6-route-map.yang): Adds the missing case metric-type augment with a when derived-from-or-self(../frr-route-map:action, 'metric-type') guard (mirroring frr-ospf-route-map.yang) and a new revision 2026-07-09 statement.
  • NB registration (ospf6_routemap_nb.c): Registers modify/destroy callbacks on the new frr-ospf6-route-map:metric-type XPath in frr_ospf6_route_map_info, reusing the existing OSPFv2 callback implementations.
  • CLI (ospf6_asbr.c): Updates both set metric-type and no set metric-type DEFUN handlers to use the OSPFv6 identity (frr-ospf6-route-map:metric-type) instead of the OSPFv2 one, so the when guard in the new YANG case evaluates correctly.

Confidence Score: 5/5

All three layers (YANG, NB registration, CLI) are updated consistently; the change is self-contained and low-risk.

The YANG when guard, the NB XPath registration, and the CLI identity string are all coherently updated to use frr-ospf6-route-map:metric-type, matching the pattern already established by the OSPFv2 counterpart. No functional regressions are introduced.

The ospf6_routemap_nb_config.c XPath comment is now stale (references only the OSPFv2 path), but this is a documentation-only issue in an unchanged file.

Important Files Changed

Filename Overview
yang/frr-ospf6-route-map.yang Adds case metric-type augment with correct when guard and an OSPFv6-specific metric-type identity; also adds a YANG revision statement for the change.
ospf6d/ospf6_routemap_nb.c Registers NB modify/destroy callbacks for the new frr-ospf6-route-map:metric-type XPath in frr_ospf6_route_map_info; reuses the existing OSPFv2 callback implementations.
ospf6d/ospf6_asbr.c Updates both set metric-type CLI handlers to use frr-ospf6-route-map:metric-type instead of the OSPFv2 frr-ospf-route-map:metric-type identity, fixing the previously unreachable NB path.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant CLI as VTY CLI (ospf6_asbr.c)
    participant NB as Northbound (ospf6_routemap_nb.c)
    participant YANG as YANG (frr-ospf6-route-map.yang)
    participant CB as NB Callbacks (ospf6_routemap_nb_config.c)

    CLI->>NB: "nb_cli_enqueue_change set-action[action='frr-ospf6-route-map:metric-type']"
    CLI->>NB: "nb_cli_enqueue_change rmap-set-action/frr-ospf6-route-map:metric-type = type-1|type-2"
    NB->>YANG: Validate against case metric-type (when derived-from-or-self)
    YANG-->>NB: Guard passes for frr-ospf6-route-map:metric-type
    NB->>CB: lib_route_map_entry_set_action_rmap_set_action_metric_type_modify
    CB-->>NB: generic_set_add(metric-type, type)
    NB-->>CLI: NB_OK
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant CLI as VTY CLI (ospf6_asbr.c)
    participant NB as Northbound (ospf6_routemap_nb.c)
    participant YANG as YANG (frr-ospf6-route-map.yang)
    participant CB as NB Callbacks (ospf6_routemap_nb_config.c)

    CLI->>NB: "nb_cli_enqueue_change set-action[action='frr-ospf6-route-map:metric-type']"
    CLI->>NB: "nb_cli_enqueue_change rmap-set-action/frr-ospf6-route-map:metric-type = type-1|type-2"
    NB->>YANG: Validate against case metric-type (when derived-from-or-self)
    YANG-->>NB: Guard passes for frr-ospf6-route-map:metric-type
    NB->>CB: lib_route_map_entry_set_action_rmap_set_action_metric_type_modify
    CB-->>NB: generic_set_add(metric-type, type)
    NB-->>CLI: NB_OK
Loading

Reviews (5): Last reviewed commit: "yang: metric-type identity declared but ..." | Re-trigger Greptile

@y-bharath14

Copy link
Copy Markdown
Contributor Author

@greptileai review

@y-bharath14

Copy link
Copy Markdown
Contributor Author

@greptileai review

@y-bharath14

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread ospf6d/ospf6_routemap_nb.c
@y-bharath14

Copy link
Copy Markdown
Contributor Author

@greptileai review

…rr-ospf6-route-map.yang

Added a case metric-type augment, similar to frr-ospf-route-map.yang

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant