Commit 98bfebd
authored
[YANG][Bugfix] Fix incorrect pattern of nexthop-vrf in sonic-static-route.yang (#21642)
#### Why I did it
Fix issue #21352
According to the Static Route HLD, the nexthop-vrf field should be optional:
<pre>
;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)
</pre>
However, in the sonic-static-route.yang the pattern of nexthop-vrf implies the nexthop-vrf is mandatory.
<pre>
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";
...
</pre>
#### How I did it
Correct the pattern of nexthop-vrf.
#### How to verify it
<pre>
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`.
</pre>1 parent a35e23c commit 98bfebd
File tree
3 files changed
+51
-1
lines changed- src/sonic-yang-models
- tests/yang_model_tests
- tests_config
- tests
- yang-models
3 files changed
+51
-1
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1021 | 1021 | | |
1022 | 1022 | | |
1023 | 1023 | | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1024 | 1071 | | |
1025 | 1072 | | |
1026 | 1073 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
0 commit comments