[rancid] New device type

Alan McKinnon alan.mckinnon at gmail.com
Thu Dec 17 09:32:00 UTC 2015


On 17/12/2015 10:06, Rod Hendricks wrote:
> Thanks for the help Alan.
>
> My perl module is based on the builtin ciscowlc module.
>
> The exit condition (if I've understood you correctly) is this:-
>
>      ProcessHistory("","","","\n!--WLC End Config Data--!\n");
>      print STDERR "    Exiting ShowConfig: $_" if ($debug);
>      # WLC lacks a definitive "end of config" marker.
>      if ($linecnt > 5) {
>
>          $found_end = 1;
>          return(1);
>      }
>
> It seems like the perl module is telling me the file is short, but the
> raw file is definitely the full show running-config output.
>
> I'm kinda lost now :/

No need to be lost. The comment that the WLC lacks an end of config 
marker is the clue - whatever code detects the end is not correct.

Can you do the following please:

- post the full script you are using
- a copy-paste of show run on a real device. The first and last 5 lines 
ought to be enough,
plus the prompt after the end. One of the things I want to see is if the 
device issues a
proper EOL at the end of show run. redact anything private from the 
output first of course


>
> Cheers,
> Rod.
>
>
> On Thu, Dec 17, 2015 at 2:16 PM, Alan McKinnon <alan.mckinnon at gmail.com
> <mailto:alan.mckinnon at gmail.com>> wrote:
>
>     That's a fairly common error, but it never has a common solution.
>
>     Basically, your script read the raw file, detected the start of "show
>     running-config" and started to process it in sub ShowConfig()
>
>     However, the script didn't find the end of that output for whatever
>     reason and processing fell all the way through to the very end with the
>     error "End of run not found". You will have to dig into the script and
>     find what it uses for that. There's a main loop in ShowConfig() and it
>     will have a regex exit condition (possibly "end" followed by a prompt or
>     something similar).
>
>     Carefully examine the raw file to see what your device put out, and make
>     ShowConfig() match.
>
>
>     On 17/12/2015 08:01, Rod Hendricks wrote:
>     > I'm getting closer.
>     >
>     > rancid.types.conf now looks like this:-
>     > hirschmann;script;rancid -t hirschmann
>     > hirschmann;login;hmlogin
>     > hirschmann;module;hirschmann
>     > hirschmann;inloop;hirschmann::inloop
>     > hirschmann;command;hirschmann::ShowConfig;show running-config
>     >
>     > Output now looks like this:-
>     > -bash-4.2$ rancid -d -thirschmann 192.168.254.103
>     > loadtype: device type hirschmann
>     > loadtype: found device type hirschmann in /etc/rancid/rancid.types.conf
>     > executing hmlogin -t 90 -c"show running-config" 192.168.254.103
>     > PROMPT MATCH:
>     > HIT COMMAND:(Hirschmann Railswitch) #show running-config
>     > HIT COMMAND:(Hirschmann Railswitch) #show running-config
>     >     In ShowConfig: (Hirschmann Railswitch) #show running-config
>     >     Exiting ShowConfig:
>      > 192.168.254.103 <http://192.168.254.103>: End of run not found
>      > 192.168.254.103 <http://192.168.254.103>: End of run not found
>     > !--WLC End Config Data--!
>     > -bash-4.2$
>     >
>     > .raw file still looks correct.
>     >
>     > .new file looks like:-
>     > !RANCID-CONTENT-TYPE: hirschmann
>     > !
>     >
>     > !--WLC Begin Config Data--!
>     >
>     > !--WLC End Config Data--!
>     >
>     > Ideas?
>     >
>     > Cheers,
>     > Rod.
>     >
>     >
>     >
>     > On Wed, Dec 16, 2015 at 11:57 PM, Dan Anderson <dan.w.anderson at gmail.com <mailto:dan.w.anderson at gmail.com>
>     > <mailto:dan.w.anderson at gmail.com <mailto:dan.w.anderson at gmail.com>>> wrote:
>     >
>     >     That field is basically a call to a subroutine within the module so
>      >     if you copied ciscowlc.pm <http://ciscowlc.pm>
>     <http://ciscowlc.pm>, you'd need to use
>     >     ShowConfig as WriteTerm doesn't exist in that module.
>     >
>     >     On Wed, Dec 16, 2015 at 10:26 AM, Rod Hendricks
>     >     <rod.hendricks at graduate.uwa.edu.au
>     <mailto:rod.hendricks at graduate.uwa.edu.au>
>     >     <mailto:rod.hendricks at graduate.uwa.edu.au
>     <mailto:rod.hendricks at graduate.uwa.edu.au>>> wrote:
>     >
>     >         I don't fully understand the purpose of WriteTerm.  But from
>     >         what you are saying above, is my rancid.types.conf in my
>     >         original post wrong?  Should
>     >
>     >         hirschmann;command;hirschmann::WriteTerm;show running-config
>     >
>     >         in fact look like
>     >
>     >         hirschmann;command;hirschmann::ShowConfig;show running-config
>     >
>     >         ?
>     >         If so, I guess I've messed that up by not understanding the
>     >         significance of that keyword.  Rancid server is on my work dev
>     >         box - will try this out in 12hrs when i get back to the office.
>     >
>     >         Thanks again.
>     >
>     >         Cheers,
>     >         Rod.
>     >
>     >         On Wed, Dec 16, 2015 at 11:07 PM, Dan Anderson
>      >         <dan.w.anderson at gmail.com
>     <mailto:dan.w.anderson at gmail.com> <mailto:dan.w.anderson at gmail.com
>     <mailto:dan.w.anderson at gmail.com>>> wrote:
>      >
>      >             ShowConfig in ciscowlc.pm <http://ciscowlc.pm>
>     <http://ciscowlc.pm> uses the line
>     >             counting method.
>     >
>     >                while (<$INPUT>) {
>     >              <---SNIP--->
>     >
>     >                     $linecnt++;
>     >              <---SNIP--->
>     >
>     >                 # WLC lacks a definitive "end of config" marker.
>     >                 if ($linecnt > 5) {
>     >                     $found_end = 1;
>     >                     return(1);
>     >                 }
>     >                 return(0);
>     >
>     >
>      >             WriteTerm in ios.pm <http://ios.pm> <http://ios.pm>
>     looks for the "end" keyword.
>     >
>     >             On Wed, Dec 16, 2015 at 9:50 AM, Rod Hendricks
>     >             <rod.hendricks at graduate.uwa.edu.au
>     <mailto:rod.hendricks at graduate.uwa.edu.au>
>      >             <mailto:rod.hendricks at graduate.uwa.edu.au
>     <mailto:rod.hendricks at graduate.uwa.edu.au>>> wrote:
>      >
>      >                 Thanks Dan.
>      >
>      >                 Your explanation makes sense.  Which script normally
>      >                 defines this delimiter?  I would be happy to
>     settle for
>      >                 the moment in just short-circuiting this
>     delimiter check
>      >                 so I can I can get the job running.  Have included
>      >                 device config below.  Don't worry about the
>     passwords -
>      >                 its a test unit with factory default config.
>      >
>      >                 Escape character is '^]'.
>      >
>      >
>      >
>      >                          Copyright (c) 2004-2015 Hirschmann
>     Automation
>      >                 and Control GmbH
>      >
>      >                                              All rights reserved
>      >
>      >                                        Railswitch Release L2E-08.0.09
>      >
>      >                                         (Build date 2015-04-06 21:32)
>      >
>      >
>      >
>      >                                        System Name:  RS-F602F7
>      >                                        Mgmt-IP    :  192.168.254.103
>      >                                        Base-MAC   :
>     00:80:63:F6:02:F7
>      >                                        System Time:  2015-01-02
>     10:11:52
>      >
>      >
>      >
>      >                 (Hirschmann Railswitch)
>      >                 User:admin
>      >                 Password:*******
>      >
>      >                 NOTE: Enter '?' for Command Help.  Command help
>     displays
>      >                 all options
>      >                       that are valid for the 'normal' command
>     forms of
>      >                 that particular mode.
>      >                       For a list of valid 'no' command forms for that
>      >                 mode, enter the help
>      >                       command 'no ?'.  For the syntax of a particular
>      >                 command form, please
>      >                       consult the documentation.
>      >
>      >
>      >                 (Hirschmann Railswitch) >enable
>      >
>      >                 (Hirschmann Railswitch) #
>      >                 (Hirschmann Railswitch) #show running-config
>      >
>      >                 !Current Configuration:
>      >                 !
>      >                 !Parameter string escape handling \, 1
>      >                 !Characters to be preceded with escape char (\):
>     \, !,
>      >                 ", ', ?
>      >
>      >                 !System Description "Hirschmann Railswitch"
>      >                 !System Version L2E-08.0.09 Build: 2015-04-06 21:32
>      >
>      >                 vlan database
>      >                 exit
>      >
>      >
>      >                 configure
>      >
>      >                 !
>      >
>      >
>      >                 interface  1/1
>      >                 no auto-negotiate
>      >
>      >                 exit
>      >
>      >
>      >                 interface  1/2
>      >                 no auto-negotiate
>      >
>      >                 exit
>      >
>      >
>      >                 interface  1/3
>      >
>      >                 exit
>      >
>      >
>      >                 interface  1/4
>      >
>      >                 exit
>      >
>      >
>      >                 interface  1/5
>      >
>      >                 exit
>      >
>      >
>      >                 interface  1/6
>      >
>      >                 exit
>      >
>      >
>      >                 interface  1/7
>      >
>      >                 exit
>      >
>      >
>      >                 interface  1/8
>      >
>      >                 exit
>      >
>      >
>      >                 !Address Conflict Detection
>      >
>      >                 !Bridge Address Learning
>      >
>      >                 !Bridge Fast Link Detection
>      >
>      >                 !Maximum size of frame (packet size)
>      >
>      >                 !Bridge Address Relearn Detection
>      >
>      >                 !Bridge Address Relearn Threshold
>      >
>      >                 !Bridge Duplex Mismatch Detection
>      >
>      >                 !Bridge Hash Optimizing
>      >
>      >                 !Service Mode
>      >
>      >                 !VLAN Learning
>      >
>      >
>      >                 !Hirschmann DHCP Relay
>      >
>      >                 !Hirschmann Device Status
>      >
>      >
>      >                 !DIP Switch Admin State
>      >
>      >
>      >                 !Ethernet/IP
>      >
>      >                 !Power over Ethernet (IEEE 802.3af)
>      >                 !Selftest
>      >
>      >                 !Skip ACA on boot
>      >
>      >
>      >                 !Hirschmann HIPER Ring
>      >                 ! configuration determined by DIP switch
>      >                 hiper-ring mode ring-switch
>      >                 hiper-ring port primary 1/1
>      >                 hiper-ring port secondary 1/2
>      >
>      >                 !LLDP (IEEE802.1AB Link Layer Discovery Protocol)
>      >
>      >                 !Media Redundancy Protocol (IEC 62439-2/Ed1.0, MRP)
>      >                 !No MRP domains exist.
>      >
>      >                 !MAC/IP Based Port Security
>      >
>      >
>      >                 !ProfinetIO
>      >
>      >
>      >                 !Hirschmann Precision Time Protocol (PTP, IEEE 1588)
>      >
>      >                 !Hirschmann Ring Coupling
>      >                 !Note: master/slave (also for single) part of
>      >                 configuration determined by
>      >                 !      DIP switch (cannot be overridden by
>     management)
>      >                 ring-coupling operation on
>      >
>      >                 !Hirschmann Signal Contacts
>      >
>      >
>      >                 !Hirschmann SNMP Access Control
>      >
>      >
>      >                 !SNTP
>      >
>      >
>      >                 !Hirschmann Broadcast Limiter
>      >
>      >
>      >                 !Hirschmann Temperature Limit Settings
>      >
>      >                 users passwd admin
>      >
>       :v1:81449548fb49a99be2d6411bdb9a10ea7e9c92c9510eb373a26176b48b934890:
>      >                 users snmpv3 authentication admin md5
>      >                 users passwd user
>      >
>       :v1:81439e52f35ecca73b21339156609d20cf630a65d0e92261cb29e58647ae54f4:
>      >                 users snmpv3 authentication user md5
>      >
>      >                 lineconfig
>      >                 exit
>      >
>      >                 no spanning-tree
>      >
>      >                 !IGMP Snooping
>      >                 exit
>      >
>      >
>      >                 (Hirschmann Railswitch) #logoutConnection closed by
>      >                 foreign host.
>      >                 -bash-4.2$
>      >
>      >                 Cheers,
>      >                 Rod.
>      >
>      >                 On Wed, Dec 16, 2015 at 10:21 PM, Dan Anderson
>      >                 <dan.w.anderson at gmail.com
>     <mailto:dan.w.anderson at gmail.com>
>     >                 <mailto:dan.w.anderson at gmail.com <mailto:dan.w.anderson at gmail.com>>> wrote:
>     >
>     >                     It sounds like it's not finding an
>     >                     end-of-configuration delimiter. I'm not familiar
>     >                     with the device type, but for Cisco devices, it
>     >                     usually looks for the keyword "end" by itself at the
>     >                     end of "show run" to determine whether or not it has
>     >                     successfully pulled the configuration. Other device
>     >                     types sometimes look for more than 5 lines of
>     >                     config, etc. Without knowing more about the
>     >                     configuration file format, I can't say which method
>     >                     (if either) would work for your situation.
>     >
>     >                     On Wed, Dec 16, 2015 at 5:49 AM, Rod Hendricks
>     >                     <rod.hendricks at graduate.uwa.edu.au
>     <mailto:rod.hendricks at graduate.uwa.edu.au>
>     >                     <mailto:rod.hendricks at graduate.uwa.edu.au
>     <mailto:rod.hendricks at graduate.uwa.edu.au>>> wrote:
>     >
>     >                         Hi.
>     >
>     >                         I am really struggling with getting a new device
>     >                         type up and running.
>     >
>     >                         Rancid v3.2, installed into Centos 7 with yum
>     >                         from EPEL repo.  I have an installation that is
>     >                         currently working against a test Cisco router,
>     >                         so I know the base install is all good.
>     >
>     >                         I have created a login script hmlogin (based off
>     >                         complogin, with session paginate commented out)
>     >                         I have created a perl scripthirschmann.pm <http://hirschmann.pm>
>     >                         <http://hirschmann.pm> (based on ciscowlc.om <http://ciscowlc.om>
>     >                         <http://ciscowlc.om>).
>     >
>     >                         rancid.types.conf:
>     >                         hirschmann;script;rancid -t hirschmann
>     >                         hirschmann;login;hmlogin
>     >                         hirschmann;module;hirschmann
>     >                         hirschmann;inloop;hirschmann::inloop
>     >                         hirschmann;command;hirschmann::WriteTerm;show
>     >                         running-config
>     >
>     >                         I can run it directly with hmlogin -c"show
>     >                         running-config" 192.168.254.103
>     >                         I get no errors running this, and I get the
>     >                         output expected.
>     >
>     >                         However, when I run the following: rancid -d
>     >                         -thirschmann 192.168.254.103
>     >                         I get:
>     >                         loadtype: device type hirschmann
>     >                         loadtype: found device type hirschmann in
>     >                         /etc/rancid/rancid.types.conf
>     >                         executing hmlogin -t 90 -c"show running-config"
>     >                         192.168.254.103
>     >                         PROMPT MATCH:
>     >                         HIT COMMAND:(Hirschmann Railswitch) #show
>     >                         running-config
>     >                         HIT COMMAND:(Hirschmann Railswitch) #show
>     >                         running-config
>      >                         192.168.254.103 <http://192.168.254.103>:
>     missed
>      >                         cmd(s): all commands
>      >                         192.168.254.103 <http://192.168.254.103>:
>     End of
>      >                         run not found
>      >                         192.168.254.103 <http://192.168.254.103>:
>     End of
>     >                         run not found
>     >                         !
>     >                         -bash-4.2$
>     >
>     >                         The .raw file has the full correct output of the
>     >                         show running-config.
>     >                         The .new file only has:
>     >                         !RANCID-CONTENT-TYPE: hirschmann
>     >                         !
>     >
>     >                         I feel oh so close to getting this running!
>     >                         Appreciate any help that can be offered.
>     >
>     >                         Cheers,
>     >                         Rod.
>     >
>     >                         _______________________________________________
>     >                         Rancid-discuss mailing list
>     >Rancid-discuss at shrubbery.net <mailto:Rancid-discuss at shrubbery.net>
>      >                         <mailto:Rancid-discuss at shrubbery.net
>     <mailto:Rancid-discuss at shrubbery.net>>
>     >http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>     >
>     >
>     >
>     >
>     >                     --
>     >                     Dan
>     >
>     >
>     >
>     >                 _______________________________________________
>     >                 Rancid-discuss mailing list
>     >Rancid-discuss at shrubbery.net <mailto:Rancid-discuss at shrubbery.net>
>      >                 <mailto:Rancid-discuss at shrubbery.net
>     <mailto:Rancid-discuss at shrubbery.net>>
>     >http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>     >
>     >
>     >
>     >
>     >             --
>     >             Dan
>     >
>     >
>     >
>     >         _______________________________________________
>     >         Rancid-discuss mailing list
>      > Rancid-discuss at shrubbery.net
>     <mailto:Rancid-discuss at shrubbery.net>
>     <mailto:Rancid-discuss at shrubbery.net
>     <mailto:Rancid-discuss at shrubbery.net>>
>     >http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>     >
>     >
>     >
>     >
>     >     --
>     >     Dan
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > Rancid-discuss mailing list
>     >Rancid-discuss at shrubbery.net <mailto:Rancid-discuss at shrubbery.net>
>     >http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>     >
>
>
>     --
>     Alan McKinnon
>     alan.mckinnon at gmail.com <mailto:alan.mckinnon at gmail.com>
>
>     _______________________________________________
>     Rancid-discuss mailing list
>     Rancid-discuss at shrubbery.net <mailto:Rancid-discuss at shrubbery.net>
>     http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>
>
>
>
> _______________________________________________
> 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