Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YANG][Bugfix] Fix incorrect pattern of nexthop-vrf in sonic-static-route.yang #21642

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

puffc
Copy link
Contributor

@puffc puffc commented Feb 6, 2025

Why I did it

Fix issue #21352
According to the Static Route HLD, the nexthop-vrf field should be optional:

;Defines IP static route  table
;
;Status: stable

key                 = STATIC_ROUTE|vrf-name|prefix ;
vrf-name            = 1\*15VCHAR ; VRF name
prefix              = IPv4Prefix / IPv6prefix
nexthop             = string; List of gateway addresses;
ifname              = string; List of interfaces
distance            = string; {0..255};List of distances.
                      Its a Metric used to specify preference of next-hop
                      if this distance is not set, default value 0 will be set when this field is not configured for nexthop(s)
nexthop-vrf         = string; list of next-hop VRFs. It should be set only if ifname or nexthop IP  is not
                      in the current VRF . The value is set to VRF name
                      to which the interface or nexthop IP  belongs for route leaks.
blackhole           = string; List of boolean; true if the next-hop route is blackholed.
                      Default value false will be set when this field is not configured for nexthop(s)

However, in the sonic-static-route.yang the pattern of nexthop-vrf implies the nexthop-vrf is mandatory.

sonic-static-route.yang:
...
...
        leaf nexthop-vrf {
          type string {
            pattern "(((Vrf[a-zA-Z0-9_-]+)|(default)|(mgmt)),)*((Vrf[a-zA-Z0-9_-]+)|(default)|(mgmt))";
          }
          description
            "VRF name of the nexthop. This is for vrf leaking";
...
Work item tracking
  • Microsoft ADO (number only):

How I did it

Correct the pattern of nexthop-vrf.

How to verify it

admin@sonic:~$ sudo config route add prefix 0.0.0.0/0 nexthop 172.16.0.3
admin@sonic:~$ redis-cli -n 4
127.0.0.1:6379[4]> key *STATIC*
(error) ERR unknown command 'key', with args beginning with: '*STATIC*'
127.0.0.1:6379[4]> keys *STATIC*
1) "STATIC_ROUTE|default|0.0.0.0/0"
127.0.0.1:6379[4]> hgetall "STATIC_ROUTE|default|0.0.0.0/0"
 1) "blackhole"
 2) "false"
 3) "distance"
 4) "0"
 5) "ifname"
 6) ""
 7) "nexthop"
 8) "172.16.0.3"
 9) "nexthop-vrf"
10) ""
127.0.0.1:6379[4]> exit
admin@sonic:~$ sudo config interface breakout Ethernet8 4x100G -yf

Running Breakout Mode : 1x400G
Target Breakout Mode : 4x100G

Ports to be deleted :
 {
    "Ethernet8": "400000"
}
Ports to be added :
 {
    "Ethernet8": "100000",
    "Ethernet10": "100000",
    "Ethernet12": "100000",
    "Ethernet14": "100000"
}
Breakout process got successfully completed.
Please note loaded setting will be lost after system reboot. To preserve setting, run `config save`.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305
  • 202405
  • 202411

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@puffc puffc requested a review from qiluo-msft as a code owner February 6, 2025 08:27
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Julian Chang - TW <[email protected]>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Julian Chang - TW <[email protected]>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@puffc
Copy link
Contributor Author

puffc commented Feb 7, 2025

@UmaMaven @dgsudharsan @qiluo-msft Please review, Thanks.

@dgsudharsan
Copy link
Collaborator

@qiluo-msft @prsunny Can you please review?

@qiluo-msft qiluo-msft merged commit 98bfebd into sonic-net:master Feb 7, 2025
21 checks passed
@puffc puffc deleted the fix_static_route_yang branch February 10, 2025 08:47
@dprital
Copy link
Collaborator

dprital commented Feb 11, 2025

@kperumalbfn , Can you please cherry pick to 202411 ?

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202411: #21705

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.

6 participants