Conversation
d1798b3 to
20b760d
Compare
27e4149 to
3b445c9
Compare
|
@prsunny, I have fixed the unit tests. Could you review the PR? |
config/main.py
Outdated
There was a problem hiding this comment.
why all? why not just show ip route static. Lets optimize this as best as possible since this could potentially introduce further delays in this command.
There was a problem hiding this comment.
vrf all is required to check scopes of all the VRFs present in the system, because command show ip route shows routes only in scope of default VRF.
Good point regarding static prefix, I have updated and retested the changes. Thank you.
Please, take a look on the difference between outputs of commands show ip route static and show ip route vrf all static. That's why I have added vrf all:
admin@sonic:~$ show ip route vrf all static
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
VRF Vrf11:
S 20.0.0.144/32 [1/0] is directly connected, Ethernet68 inactive, weight 1, 00:00:18
VRF default:
S>* 0.0.0.0/0 [200/0] via 192.168.111.3, eth0, weight 1, 23:09:50
S 20.0.0.1/32 [1/0] is directly connected, Ethernet64 inactive, weight 1, 00:01:14
is directly connected, Ethernet68 (vrf Vrf11) inactive, weight 1, 00:01:14
admin@sonic:~$ show ip route static
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
S>* 0.0.0.0/0 [200/0] via 192.168.111.3, eth0, weight 1, 23:10:01
S 20.0.0.1/32 [1/0] is directly connected, Ethernet64 inactive, weight 1, 00:01:25
is directly connected, Ethernet68 (vrf Vrf11) inactive, weight 1, 00:01:25
* Check whether a static route present, which is related to the RIF of the interface for which we want to delete the last IP entry. This is required to prevent deleting of RIFs, if there are static routes in the system. Signed-off-by: Maksym Belei <[email protected]>
* Update unit tests according to the changes. Signed-off-by: Maksym Belei <[email protected]>
3b445c9 to
37a2e87
Compare
|
@maksymbelei95, @prsunny. Should we add a check to disallow configuring of static route with nexthop as ifname if the interface has no ip address? |
|
@prsunny, if there is no active questions regarding this PR, could you merge it? |
*Added checking of static routes, related to the interface, before deleting of the last IP entry to prevent deleting the RIF if a static route is present in the system. Signed-off-by: Maksym Belei <[email protected]>
What I did
Resolves sonic-net/sonic-buildimage#7028
Added checking of static routes, related to the interface, before deleting of the last IP entry to prevent deleting the RIF if a static route is present in the system.
The related unit tests has added.
How I did it
By checking IPv4 and IPv6 routes, received from Zebra.
How to verify it
sudo config int ip add Ethernet2 10.0.0.18/31sudo config route add prefix 20.0.0.1/32 nexthop Ethernet2sudo config int ip rem Ethernet2 10.0.0.18/31If
10.0.0.18/31is the last IP entry, you will receive the next error:Error: Cannot remove the last IP entry of interface Ethernet2. A static ip route is still bound to the RIF.The similar situation is for IPv6:
Error: Cannot remove the last IP entry of interface Ethernet2. A static ipv6 route is still bound to the RIF.