You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[dhcp_relay]: sonic dhcp relay agent for IPv4 (sonic-net#4004)
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938).
What I did
Added dependency checks in SONiC config CLI to prevent deletion of interfaces, VRFs, and VLANs that are in use by DHCPv4 relay configurations.
Added/updated unit tests.
How I did it
Implemented a new function check_dhcpv4_relay_dependencies to check if an interface or VRF is referenced in the DHCPV4_RELAY table.
Called this function before allowing deletion of portchannels, loopbacks, VRFs, and VLANs.
Modified the VLAN deletion logic to block removal if the VLAN is present in the DHCPV4_RELAY table.
Extended the test suite to verify that deletion is blocked when dependencies exist and allowed after cleanup.
How to verify it
Run the updated unit tests: they now include cases where deletion of interfaces, VRFs, or VLANs in use by DHCPv4 relay is attempted and should fail.
Manually test by configuring DHCPv4 relay on an interface/VRF/VLAN, then attempt to delete it using the CLI; the command should fail with an appropriate error message.
After removing the DHCPv4 relay configuration, deletion should succeed.
0 commit comments