FortiManager
FortiManager supports network operations use cases for centralized management, best practices compliance, and workflow automation to provide better protection against breaches.
farhanahmed
Staff
Staff
Article Id 367439
Description This article describes how to clear FortiGate BGP sessions using FortiManager TCL Scripts.
Scope FortiManager, FortiGate.
Solution

Follow the initial steps from this article on how to enable and run TCL scripts in FortiManager:

Technical Tip: How to use TCL script...existing route. 

 

Go to Device Manager -> Scripts, select type TCL Script and select 'Create new'.

 

Create the following TCL script:

 

#!
proc do_cmd {cmd} {
puts [exec "$cmd\n" "# "]
}
#
# Execute command to get system status
#
set status [exec "get system status\n" "# " 15]
#
# Check if VDOM is disabled
#
if {[regexp {Virtual domain configuration: disable} $status]} {
set vdom_enabled false
} else {
set vdom_enabled true
}
#
# Enter VDOM Mode if VDOM enabled
#
if {$vdom_enabled} {
do_cmd "config vdom"
do_cmd "edit root"
}
#
# Performaing BGP route reset
#
do_cmd "execute router clear bgp all soft"
#
return
#

 

  • The script can be run on multiple FortiGates at once.
  • In case VDOMs are enabled on the FortiGate(s), on line #22 set the desired VDOM.
  • Line #27 will send that execute command to the FortiGate(s) to perform a soft reset on both the received and the advertised BGP routes.
  • For detailed information about other reset options, refer to the article: Technical Tip: How to clear BGP Sessions, and change the command in line #27 per requirement.


Related articles:
Tcl scripts.
Technical Tip: How to troubleshoot TCL Scripts failed in FortiManager.
Technical Tip: BGP soft reset to refresh BGP routing table without tearing down existing peering ses...