frr icon indicating copy to clipboard operation
frr copied to clipboard

tools: fix reload interface deletion

Open jklaiber opened this issue 1 year ago • 5 comments

Current Behavior

  • When reloading the configuration in FRR, the frr-reload.py script does not allow removing an entire interface context in one step. Instead, it attempts to delete each configuration line individually under the interface context.
  • This line-by-line deletion can cause issues when the interface is already removed from the system.

Specific Issue:

  • If an interface has been removed from the system, trying to delete specific configurations (such as IP addresses) under that interface context fails.
  • For example, if an IP address was configured on an interface that no longer exists, trying to remove that IP address will result in an error because the interface itself is not present.

Impact of the Issue:

  • This behavior leads to errors during the configuration reload process, making it difficult to cleanly manage and synchronize the FRR configuration with the actual state of the network interfaces on the system.
  • Such errors can prevent successful application of configuration changes, disrupt network operations, and require manual intervention to resolve.

Example: When the interface was removed from the frr.conf and then the reload script is executed the following error is triggered:

~$ frr-reload.py --reload --confdir frrouting/etc frrouting/etc/frr.conf --log-level warning
Failed to execute interface t4_1  no ip address 10.0.0.5 peer 10.0.0.6/32 exit
"interface t4_1 --  no ip address 10.0.0.5 peer 10.0.0.6/32 -- exit" we failed to remove this command

Proposed Solution

  • The proposed change allows the configuration to remove an interface using a single command (no interface <interface-name>).
    • The change affects only the whole removal of interfaces. If there are single lines removed under the interface context the script behaves like before.
  • This command effectively removes all configurations related to the interface in one step, bypassing the need to delete each line individually.

Advantages of the Solution:

  • By allowing the removal of the entire interface context, the solution makes the reloading process more straightforward and reduces the potential for errors.
  • When an interface is already deleted, removing its configuration with a single command avoids errors related to non-existent interface elements like IP addresses.

jklaiber avatar Sep 02 '24 13:09 jklaiber

Could you please drop the merge commit?

ton31337 avatar Sep 02 '24 14:09 ton31337

Could you show how it looks when doing --test --debug in your case?

ton31337 avatar Sep 04 '24 06:09 ton31337

Could you show how it looks when doing --test --debug in your case?

Sure here is the output of the lines that should be deleted before the change. The line with no IP address 10.0.0.5 peer 10.0.0.6/32 is especially important. Because when executing this line and the interface is already deleted frr will return an error.

Lines To Delete
===============
interface t4_1
 no ip address 10.0.0.5 peer 10.0.0.6/32
exit
interface t4_1
 no ip ospf area 0.0.0.0
exit
interface t4_1
 no ip ospf cost 190
exit
interface t4_1
 no ip ospf dead-interval 90
exit
interface t4_1
 no ip ospf hello-interval 15
exit
interface t4_1
 no ipv6 ospf6 area 0.0.0.0
exit
interface t4_1
 no ipv6 ospf6 passive
exit

And here it is with the change:

Lines To Delete
===============
no interface t4_1

You see before it was removing line by line under interface context. Now it just deletes the interface as a whole which allows deleting the interface out of frr even if the interface is already deleted on the system.

jklaiber avatar Sep 04 '24 09:09 jklaiber

Closes #15081

jklaiber avatar Sep 04 '24 09:09 jklaiber

Could you fix the styling?

ton31337 avatar Sep 05 '24 06:09 ton31337

@ton31337 any updates on this PR? Please let me know if you need some changes or information from me.

jklaiber avatar Sep 17 '24 11:09 jklaiber

@donaldsharp any objections here?

ton31337 avatar Nov 28 '24 15:11 ton31337

the merge commit should be removed before we can take this change

donaldsharp avatar Jan 15 '25 15:01 donaldsharp

the merge commit should be removed before we can take this change

I corrected the PR just to include the actual commit. Merge from master branch into this branch is removed.

jklaiber avatar Jan 16 '25 06:01 jklaiber