[rancid] adding a "new" type for axos

Jon Lewis jlewis at lewis.org
Sun Dec 10 03:47:11 UTC 2023


I'm trying to get rancid to backup Calix AXOS E7-2's.  I've run into a 
snag with the end of run being properly recognized.

I'm running rancid-3.13-1 on Ubuntu 22.04.03.  I decided to try re-using 
the ios module for axos.  I added this to rancid.types.conf:

axos;script;rancid -t axos
axos;login;clogin
axos;module;ios
axos;inloop;ios::inloop
axos;command;ios::ShowVersion;show version
axos;command;ios::WriteTerm;show running-config | nomore

Since the axos "show running-config" output has no "end tag" to it; the 
output simply ends and you're returned to a prompt, I made the change 
below so that $found_end will be set to 1 for axos device types if some 
config was printed.  I've verified this works and sets $found_end = 1.

--- ios.pm.orig 2020-10-15 11:26:17.000000000 -0400
+++ ios.pm      2023-12-09 22:21:50.408683973 -0500
@@ -2787,7 +2794,7 @@
      # The ContentEngine lacks a definitive "end of config" marker.  If we
      # know that it is a CE, SAN, or NXOS and we have seen at least 5 lines
      # of write term output, we can be reasonably sure that we have the config.
-    if (($type eq "CE" || $type eq "SAN" || $type eq "NXOS") && $linecnt > 5) {
+    if (($type eq "CE" || $type eq "SAN" || $type eq "NXOS" || $devtype eq "axos") && $linecnt > 5) {
         $found_end = 1;
         return(0);
      }

The problem I think I've run into is, the final exit isn't being 
recognized and $clean_run doesn't get set to 1, resulting in "End of run 
not found".

Near the top of inloop in ios.pm, there's this bit of code:

         if (/[>#]\s?exit$/) {
             $clean_run = 1;
             last;
         }

which seems like it should be matching, but is not.  The last few lines of 
the raw file left by running rancid -d -t axos <some-device> are:

  no shutdown
!
some-device#exit
Shared connection to X.X.X.X closed.

In the raw file, exit is followed CRLF.

----------------------------------------------------------------------
  Jon Lewis, MCP :)              |  I route
  Blue Stream Fiber, Sr. Neteng  |  therefore you are
_________ http://www.lewis.org/~jlewis/pgp for PGP public key_________



More information about the Rancid-discuss mailing list