[rancid] New device type

Alan McKinnon alan.mckinnon at gmail.com
Wed Dec 16 16:28:00 UTC 2015


On 16/12/2015 17:26, Rod Hendricks 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

In ancient times, Cisco stuff had a command "write term" which, I
believe, outputted the config. A bizarre name, but that's what it was.
The name persists to this day and you'll still find rancid scripts that
run write term and/or show run. And you will find perl subs called
WriteTerm() used by both commands for processing.

The name of the sub can be changed if you also change all of it's
callers. Cisco kit made anytime this millenium likely uses show run to
dump the config, so use the command that is valid for your equipment.
> 
> ?
> 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>> wrote:
> 
>     ShowConfig in 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> 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>> 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>> 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>> 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 script hirschmann.pm
>                 <http://hirschmann.pm> (based on 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>
>                 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
> 
> 
> 
> 
>     -- 
>     Dan
> 
> 
> 
> 
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
> 


-- 
Alan McKinnon
alan.mckinnon at gmail.com



More information about the Rancid-discuss mailing list