[rancid] Dell EMC OS10 switch

Howard Jones howie at thingy.com
Mon Nov 4 16:51:23 UTC 2019


I made a slightly-tweaked version of the Force10 type for our Dell 
S3048-ON switches.

In etc/rancid.types.conf:

dell10;script;dell10rancid
dell10;login;clogin

And then these are the differences from f10rancid:

A few commands don't exist - removed those. The switch likes to beep 
(send ctrl-G) in responses, so I strip control chars out. It also 
doesn't have 'end' at the end of the config, so the default 'saw all 
commands' stuff didn't work.

Patch is for RANCID 3.7, but hopefully the gist is clear.


$ diff -Nau f10rancid dell10rancid
--- f10rancid   2018-04-25 08:10:28.907312760 +0000
+++ dell10rancid        2019-10-22 09:50:31.871744282 +0000
@@ -1,6 +1,6 @@
  #! /usr/bin/perl
  ##
-## $Id: f10rancid.in 3613 2017-02-22 21:37:22Z heas $
+## $Id: dell10rancid.in 3613 2017-02-22 21:37:22Z heas $
  ##
  ## rancid 3.7
  ## Copyright (c) 1997-2017 by Henry Kilmer and John Heasley
@@ -183,7 +183,7 @@
         next if(/^(\s*|\s*$cmd\s*)$/);
         return(-1) if (/command authorization failed/i);

-       / Type: / && chop && chop &&
+       / Type: / && chop &&
             ProcessHistory("COMMENTS","keysort","A1", "!$_\n");

         /^.* Version.*$/ &&
@@ -608,15 +608,16 @@

  # Main
  @commandtable = (
-       {'show version'                 => 'ShowVersion'},
-       {'show bootvar'                 => 'ShowBoot'},
-       {'dir flash:'                   => 'DirSlotN'},
-       {'dir slot0:'                   => 'DirSlotN'},
-       {'show chassis'                 => 'ShowChassis'},
-       {'show system'                  => 'ShowChassis'},
-       {'show inventory'               => 'ShowInventory'},
-       {'show vlan'                    => 'ShowVLAN'},
-       {'show running'                 => 'WriteTerm'}
+       {'show version'                 => 'ShowVersion'},
+#        {'show bootvar'                 => 'ShowBoot'},
+#        {'dir flash:'                   => 'DirSlotN'},
+#        {'dir slot0:'                   => 'DirSlotN'},
+#        {'show chassis'                 => 'ShowChassis'},
+        {'show system'                  => 'ShowChassis'},
+        {'show inventory'               => 'ShowInventory'},
+        {'show vlan'                    => 'ShowVLAN'},
+        {'show running-configuration'                 => 'WriteTerm'}
+
  );
  # Use an array to preserve the order of the commands and a hash for 
mapping
  # commands to the subroutine and track commands that have been completed.
@@ -684,13 +685,23 @@
      $filter_pwds = 1;
  }

-ProcessHistory("","","","!RANCID-CONTENT-TYPE: force10\n!\n");
+ProcessHistory("","","","!RANCID-CONTENT-TYPE: dell10\n!\n");
  ProcessHistory("COMMENTS","keysort","B0","!\n");
  ProcessHistory("COMMENTS","keysort","F0","!\n");
  ProcessHistory("COMMENTS","keysort","G0","!\n");
  TOP: while(<INPUT>) {
      tr/\015//d;
-    if (/\#\s?exit$/) {
+
+    print STDERR "LINE: $_\n" if ($debug);
+
+    if (/^Session\sterminated\s*/) {
+        print STDERR "SAW SESSION TERMINATED\n" if ($debug);
+       $clean_run=1;
+        $found_end=1;
+       last;
+    }
+    if (/\#\s?exit\s*$/) {
+        print STDERR "SAW EXIT\n" if ($debug);
         $clean_run=1;
         last;
      }
@@ -702,9 +713,11 @@
      }
      while (/#\s*($cmds_regexp)\s*$/) {
         $cmd = $1;
+        print STDERR "Looking for $cmd\n" if ($debug);
         if (!defined($prompt)) {
             $prompt = ($_ =~ /^([^#]+#)/)[0];
             $prompt =~ s/([][}{)(\\])/\\$1/g;
+            $prompt =~ tr/\040-\176//cd;
             print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
         }
         print STDERR ("HIT COMMAND:$_") if ($debug);
@@ -714,8 +727,10 @@
             last TOP;
         }
         $rval = &{$commands{$cmd}}(*INPUT, *OUTPUT, $cmd);
+        print STDERR "LEFT $cmd\n" if ($debug);
         delete($commands{$cmd});
         if ($rval == -1) {
+            print STDERR "$host: $cmd did not return cleanly\n" if 
($debug);
             $clean_run = 0;
             last TOP;
         }


On 04/11/2019 16:25, Chris Boyd wrote:
> Howdy,
>
> I see that questions came up about using RANCID with a Dell EMC switch
> running OS10 back in July, and the potential answer was to use the
> "onefinity" router type.  Never saw any followup on if it actually
> worked.
>
> So if anyone is using a Dell EMC switch with RANCID successfuly, please
> let me know....
>
> Thanks!
>
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss



More information about the Rancid-discuss mailing list