Skip to content
dongreer edited this page May 7, 2014 · 6 revisions
  1. Adding Hardware Support for cfg_archive
This is the procedure used to create support for Extreme Switch gear (Manufacturer "Extreme Networks").

1. Pull the most recent copy of the cfg_archive plugin from git ("https://github.com/opennetadmin/cfg_archive"). 2. Follow the instructions for installing the plugin. 3. In ONA: A. Go to "Menu>Admin>Manage Manufacturers" and get the exact spelling of the manufacturer name. This name will be used in all lowercase, and spaces replaced by "_" for files created during this procedure. If you don't already have the manufacturer, add it, create the correct Device Types and assign the devices you want to backup to the correct device type before proceeding. B. Go to "Menu>Admin>Manage Config Types" and add a configuration type for THIS TYPE OF HARDWARE. You cannot use a generic "CONFIG" as this will fail, and it's important that you seperate config types in the database.

At this point, we have the following: Device Type: "Extreme Networks" Device Part of File Name: "extreme_networks" Config Type: "EX_CONFIG" and "EX_VERSION" (because I want to capture both the config AND verion XOS changes)

4. "cd $ONABASE/www/local/plugins/cfg_archive/sql" 5. "cp juniper_archive_hostlist.sql extreme_networks_hostlist.sql" 6. Edit extreme_networks_hostlist.sql and make the following changes (NOTE: all hardware manufacturers here are in lower case for consistancy): A. Modify the comments to refelect the hardware type being queried (from "juniper" to "extreme networks") B. Modify the "select" statement to the new manufacturer (from "juniper" to "extreme networks") C. Test changes with "$ONABASE/bin/dcm.pl -r ona_sql sql=extreme_networks_hostlist.sql" 7. "cd ../etc" 8. "cp cfg_archive.cisco.IOS_CONFIG.sed cfg_archive.extreme_networks.EX_CONFIG.sed" A. Note that we used the manufacturer's name in lowercase with "_" for the space, and we used the config type in all caps) B. You may also want to copy the "cfg_archive.cisco.GLOBAL.sed" and/or "cfg_archive.cisco.PASSWORD.sed". These two are run globally on ALL downloaded configs to strip away things like passwords, prompts, etc. I didn't do that here. 9. edit the sed script to accomodate what your config will dump. We will test this later and you can make changes as necessary. 10. Repeat 8 and 9 for "cfg_archive.extreme_networks.EX_VERSION.sed" 11. "cd ../bin" 12. "cp juniper_cmd cfg_archive_extreme_networks_cmd" (juniper is the simplest to modify) 13. Edit "cfg_archive_extreme_networks_cmd" and make the following changes: A. Change the comments to reflect the hardware and your name/contact info. B. Add any comments you need to to document your changes and any special conditions that need to be covered. C. Change all references to "juniper" to "extreme_networks" and other such changes to make things consistent in the comments. D. Change "set DEFAULT_LOGINMODE" to telnet (not necessary if you environment supports ssh connections to your gear). E. Change "set AUTHORNAME" and "set AUTHOREMAIL" to YOUR name and email. F. Change "set PROMPT" to reflect you equipments cli prompt. G. Change all occurences of "juniper" in the code to "extreme_networks" H. Change the "-re" entries for the login and password prompts to accomodate your equipment. I. Change the "send -h" and "expect -re" lines to reflect the commads to be sent and responses to be extected from your equipment. 14. Test your script by running it and making sure you get the desired results. A. For the config, I run "/opt/ona/bin/extreme_networks_cmd -c 'show config' -h 1.2.3.4 -u admin -t" Note: This assumes that "1.2.3.4" is a valid host on your network AND that you have properly configured getpw for this host/network and the user "admin". B. Examine the output and insure that you are getting the configuration of the device as part of the response (the .sed scripts in 8/9 above are used to clean up this output). C. Repeat A & B for the command "show version". 15. "cd ../etc" 16. Edit "cfg_archive.conf" and make the following changes: A. Uncomment "#DEBUGON=1" so you can see what's going on. B. Change "USERNAME" to match your environment. C. Change "CON_MODE" to match your environment ("ssh" or "telnet") D. Change "MAIL_SERVER" to match your environment ("localhost" or "mail.foo.com" or whatever). E. Change "MAIL_TO" to match the email address you want to send notification to about changes. F. Add "EXTREME_NETWORKS_DEV_COMMANDS=( "show config:EX_CONFIG" "show version:EX_VERSION") Notice that the name is the same as the device part of a filename, except here it's ALL CAPS. Notice that each of the listed commands is in the form of command to executed on the remote device followed by a colon followed by the Config Type from 3 above). 17. "cd .." 18. "./configure" to push changes into the running ONA config. 19. "$ONABASE/bin/cfg_archive -h 1.2.3.4 -d" to do a test run against the appropriate host. A. Fix any errors (there will be a "CHECKSUM: ERROR => No config text entries found!" message the first time you run this because there's no existing entries in the ONA database). B. Once you get all the errors fixed, look at the results in "https://yourserver.yourdomain.com/ona/?1.2.3.4" and clicking on the "EX_CONFIG". C. If you are missing parts or have "extra" parts in the config file (e.g. passwords that shouldn't be there, or spurious CLI prompts), adjust your .sed files, remove the config, and try again. 20. Unless you're the only one on the planet using the equipment, please roll up a patch and push it back to github (or contact Matt). 21. Create a script to be run by cron that will query all the devices of a specific type and run cfg_archive against each host. Here's the script for the Extreme Gear (just repeat for each type).

cfg_archive_extreme_networks_get_configs:

  1. !/bin/bash
DEBUG=0

[$DEBUG] && echo "Starting Run"

  1. Get the config info
[!] && echo "[$0] ERROR: Unable to read /etc/onabase." && exit 1 ONABASE=`cat /etc/onabase` . $ONABASE/etc/cfg_archive.conf

for i in `$ONABASE/bin/dcm.pl -r ona_sql sql=extreme_networks_hostlist.sql`; do

[$DEBUG] && echo "Next up: $i"

  if [ "x$i" != "x" -a "$i" != "fqdn" ] ; then

[$DEBUG] && echo "Processing: $i"

    $ONABASE/bin/cfg_archive -h $i 2>&1 >/dev/null
  fi

[$DEBUG] && echo "Completed: $i"

done

Clone this wiki locally