--- /dev/null
+# FRR Support Bundle Command List
+# Do Not modify the lines that start with
+# PROC_NAME, CMD_LIST_START and CMD_LIST_END
+# Add the new command for each process between
+# CMD_LIST_START and CMD_LIST_END lines
+
+# BGP Support Bundle Command List
+PROC_NAME:bgp
+CMD_LIST_START
+show bgp summary
+show ip bgp
+show ip bgp neighbors
+show ip bgp summary
+show ip bgp statistics
+
+show ip bgp update-groups advertise-queue
+show ip bgp update-groups advertised-routes
+show ip bgp update-groups packet-queue
+show ip bgp update-groups statistics
+show ip bgp peer-group
+show ip bgp memory
+
+show bgp ipv6
+show bgp ipv6 neighbors
+show bgp ipv6 summary
+show bgp ipv6 update-groups advertise-queue
+show bgp ipv6 update-groups advertised-routes
+show bgp ipv6 update-groups packet-queue
+show bgp ipv6 update-groups statistics
+show ip bgp statistics
+
+show bgp evpn route
+CMD_LIST_END
+
+# Zebra Support Bundle Command List
+PROC_NAME:zebra
+CMD_LIST_START
+show zebra
+show zebra client summary
+show ip route
+
+show route-map
+show memory
+show interface
+show vrf
+show error all
+show work-queues
+show running-config
+show thread cpu
+show thread poll
+show daemons
+show version
+CMD_LIST_END
+
+# OSPF Support Bundle Command List
+# PROC_NAME:ospf
+# CMD_LIST_START
+# CMD_LIST_END
+
+# RIP Support Bundle Command List
+# PROC_NAME:rip
+# CMD_LIST_START
+# CMD_LIST_END
+
+# ISIS Support Bundle Command List
+# PROC_NAME:isis
+# CMD_LIST_START
+# CMD_LIST_END
+
+# BFD Support Bundle Command List
+# PROC_NAME:bfd
+# CMD_LIST_START
+# CMD_LIST_END
+
+# STATIC Support Bundle Command List
+# PROC_NAME:static
+# CMD_LIST_START
+# CMD_LIST_END
+
+# PIM Support Bundle Command List
+# PROC_NAME:pim
+# CMD_LIST_START
+# CMD_LIST_END
--- /dev/null
+########################################################
+### Python Script to generate the FRR support bundle ###
+########################################################
+import os
+import subprocess
+import datetime
+
+TOOLS_DIR="tools/"
+ETC_DIR="/etc/frr/"
+LOG_DIR="/var/log/frr/"
+SUCCESS = 1
+FAIL = 0
+
+inputFile = ETC_DIR + "support_bundle_commands.conf"
+
+# Open support bundle configuration file
+def openConfFile(i_file):
+ try:
+ with open(i_file) as supportBundleConfFile:
+ lines = filter(None, (line.rstrip() for line in supportBundleConfFile))
+ return lines
+ except IOError:
+ return ([])
+
+# Create the output file name
+def createOutputFile(procName):
+ fileName = procName + "_support_bundle.log"
+ oldFile = LOG_DIR + fileName
+ cpFileCmd = "cp " + oldFile + " " + oldFile + ".prev"
+ rmFileCmd = "rm -rf " + oldFile
+ print "Making backup of " + oldFile
+ os.system(cpFileCmd)
+ print "Removing " + oldFile
+ os.system(rmFileCmd)
+ return fileName
+
+# Open the output file for this process
+def openOutputFile(fileName):
+ crt_file_cmd = LOG_DIR + fileName
+ print crt_file_cmd
+ try:
+ outputFile = open(crt_file_cmd, "w")
+ return outputFile
+ except IOError:
+ return ()
+
+# Close the output file for this process
+def closeOutputFile(file):
+ try:
+ file.close()
+ return SUCCESS
+ except IOError:
+ return FAIL
+
+# Execute the command over vtysh and store in the
+# output file
+def executeCommand(cmd, outputFile):
+ cmd_exec_str = "vtysh -c \"" + cmd + "\" "
+ try:
+ cmd_output = subprocess.check_output(cmd_exec_str, shell=True)
+ try:
+ dateTime = datetime.datetime.now()
+ outputFile.write(">>[" + str(dateTime) + "]" + cmd + "\n")
+ outputFile.write(cmd_output)
+ outputFile.write("########################################################\n")
+ outputFile.write('\n')
+ except:
+ print "Writing to ouptut file Failed"
+ except subprocess.CalledProcessError as e:
+ dateTime = datetime.datetime.now()
+ outputFile.write(">>[" + str(dateTime) + "]" + cmd + "\n")
+ outputFile.write(e.output)
+ outputFile.write("########################################################\n")
+ outputFile.write('\n')
+ print "Error:" + e.output
+
+
+# Process the support bundle configuration file
+# and call appropriate functions
+def processConfFile(lines):
+ for line in lines:
+ if line[0][0] == '#':
+ continue
+ cmd_line = line.split(':')
+ if cmd_line[0] == "PROC_NAME":
+ outputFileName = createOutputFile(cmd_line[1])
+ if outputFileName:
+ print outputFileName, "created for", cmd_line[1]
+ elif cmd_line[0] == "CMD_LIST_START":
+ outputFile = openOutputFile(outputFileName)
+ if outputFile:
+ print outputFileName, "opened"
+ else:
+ print outputFileName, "open failed"
+ return FAIL
+ elif cmd_line[0] == "CMD_LIST_END":
+ if closeOutputFile(outputFile):
+ print outputFileName, "closed"
+ else:
+ print outputFileName, "close failed"
+ else:
+ print "Execute:" , cmd_line[0]
+ executeCommand(cmd_line[0], outputFile)
+
+# Main Function
+lines = openConfFile(inputFile)
+if not lines:
+ print "File support_bundle_commands.conf not present in /etc/frr/ directory"
+else:
+ processConfFile(lines)