Skip to content
dongreer edited this page May 13, 2014 · 6 revisions

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")|https://github.com/opennetadmin/cfg_archive].
  2. Follow the instructions for installing the plugin.
  3. In ONA:
    1. 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.
    2. 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 separate 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 consistency):
    1. Modify the comments to refelect the hardware type being queried (from "juniper" to "extreme networks")
    2. Modify the "select" statement to the new manufacturer (from "juniper" to "extreme networks")
    3. 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
    1. Note that we used the manufacturer's name in lowercase with "_" for the space, and we used the config type in all caps)
    2. 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 last two steps 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:
    1. Change the comments to reflect the hardware and your name/contact info.
    2. Add any comments you need to to document your changes and any special conditions that need to be covered.
    3. Change all references to "juniper" to "extreme_networks" and other such changes to make things consistent in the comments.
    4. Change
      set DEFAULT_LOGINMODE
      to telnet (not necessary if you environment supports ssh connections to your gear).
    5. Change "set AUTHORNAME</pre> and "set AUTHOREMAIL</pre> to YOUR name and email.
    6. Change
      set PROMPT
      to reflect you equipment's cli prompt.
    7. Change all occurrences of "juniper" in the code to "extreme_networks"
    8. Change the
      -re
      entries for the login and password prompts to accommodate your equipment.
    9. Change the
      send -h
      and
      expect -re
      lines to reflect the commands to be sent and responses to be expected from your equipment.
  14. Test your script by running it and making sure you get the desired results.
    1. 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".
    2. Examine the output and insure that you are getting the configuration of the device as part of the response (the .sed scripts above are used to clean up this output).
    3. Repeat last two substeps for the command "show version".
  15. cd ../etc
  16. Edit "cfg_archive.conf" and make the following changes:
    1. Uncomment
      #DEBUGON=1
      so you can see what's going on.
    2. Change
      USERNAME
      to match your environment.
    3. Change
      CON_MODE
      to match your environment ("ssh" or "telnet")
    4. Change
      MAIL_SERVER
      to match your environment ("localhost" or "mail.foo.com" or whatever).
    5. Change
      MAIL_TO
      to match the email address you want to send notification to about changes.
    6. 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.
  20. 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).
  21. 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".
  22. 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.
  23. 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).
  24. To run cfg_archive on all Extreme Networks hosts, use the following command (can be stuck into cron):
    $ONABASE/bin/dcm.pl -r ona_sql sql=extreme_networks_hostlist.sql header=no | $ONABASE/bin/cfg_archive -f -
    

Note: Matt also created an SNMP Trap handler ($ONABASE/bin/cfg_archive_cisco_trapscript) which will catch SNMP Traps from Cisco gear and touch a file in $SPOOL_DIR (defined in cfg_archive.conf) with the device name. Another script ($ONABASE/bin/cfg_archive_procspool) can then be called via cron to go grab those configs ONLY when they change. Since I already have SNMP Traps pointed elsewhere and managed by other software on the Extremes, and because I'm worried about inconsistencies across other hardware, I've elected to do it by the above method. Matt reports that his Cisco scripts work hands-off in his environment, so either option should work. Configuring the traps on the Cisco and in Linux is documented in the cfg_archive_cisco_trapscript.

Clone this wiki locally