package eod_templates; use strict; use warnings; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 1.01; @ISA = qw(Exporter); @EXPORT = (); @EXPORT_OK = qw(printversion printtmpl); %EXPORT_TAGS = ( ALL => [qw(&printversion &printtmpl)], ); ###################################################################################################################### ## TEMPLATES ####################################################################################################### ###################################################################################################################### sub printversion { my $HEADER= ' ################# HEADER ################################ #Does: Perform any amount of tasks in any mode on any # # amount of devices of any OS by logging in to # # them via SSH or telnet # # Optionally perform pattern matching on results # Requires: # # r/w-permisson on Logfile, csvfile, lockfile, # # tempdb and inputfile # # eod_templates.pm and eod_functions.pm need # # to be in the same dir as the script itself # #To DOs: # # clean up namespace and sub scopes # # make connections more abstract and put into # # eod_functions package # # complete CLASS PRESETS # # throroughly test escaping # # excessive telnet/ssh testing # # excessive character/behavior testing # # excessive error/exception handling testing # # assess PERM requirement. # #Exit states: # # 0 = all tasks done, no errors encountered # # 0 = invoked with -v/-h or unsupported args # # 1 = defined error (e.g. file handle error) # # 1 = undefined error $? # #Version: 0.7.1 ALPHA # #last change: # #Author: # ################# /HEADER ############################### '; $HEADER .= "\n"; return $HEADER; } sub printtmpl { my $TEMPLATE= "\n ################################################################################################################### #---CONFIG FILE FOR EXECUTE ON DEVICE SCRIPT----------------------------------------------------------------------# ################################################################################################################### ################################################################################################################### #---HELP----------------------------------------------------------------------------------------------------------# ################################################################################################################### #Remove leading >#< to enable lines or add # to have script ignore them. #Remember that this file is reset to its default during script execution. #Make a copy if you may need it again. #STATIC CLASS PRESETS SETTING DEFINITIONS ##select the actions the script needs to perform automatically (enable CLI, enter config mode, write when configuration was applied) #DEFINE MODE_EN= #DEFINE MODE_CFG= #DEFINE MODE_WR= ## set the last character of the device's prompt in disabled, enabled and configure mode. (e.g. >,\$,#) #DEFINE CHAR_DIS= #DEFINE CHAR_EN= #DEFINE CHAR_CFG= ## set the command to disable paging (e.g. terminal length 0) #DEFINE CMD_SET_NO_PAGE= ## set the device specific message, that is displayed when paging occurs (e.g. PRESS ANY KEY TO CONTINUE, --more--) #DEFINE CHAR_PAGE= ## set the command to jump to the end of paged output (e.g. NL,SPACE,skip) #DEFINE CMD_SKIP= ## set the command to log off the device (e.g. exit, logout) #DEFINE CMD_QUIT= ## set the Newline/Carriage Return character(s) this device expects (e.g. NL = \n, CR = \r, CRLF=\r\l) #DEFINE CHAR_NL= ## set the message the device displays when a command violates the input syntax (e.g. INVALID COMAND, Bad Command) #DEFINE CHAR_INVALID= ## set the enable command this device expects (e.g. enable) #DEFINE CMD_EN= ## set the configure mode command (e.g. conf t, conf priv) #DEFINE CMD_CFG= ## set the command to save configuration changes (e.g. wr, commit) #DEFINE CMD_WR= ##set the command to return to the root path (e.g. end, cd) #DEFINE CMD_ROOTDIR= ##set the prompt the device displays when it requires confirmation (e.g. [yes/no]:) #DEFINE CHAR_CONFIRM= ##set the command the device expects to confirm/negate decisions #DEFINE CMD_CONFIRM= ##If none of the existing class presets apply you can use a customized class. #If you do not need a specific definition in your customized CLASS set it to ?. ################################################################################################################### #---BEGIN CONFIG--------------------------------------------------------------------------------------------------# ################################################################################################################### ################################################################################################################### #-<-SECTION LOGIN->-----------------------------------------------------------------------------------------------# ################################################################################################################### YOUR-USERNAME= YOUR-PASSWORD= ################################################################################################################### #-<-SECTION STATIC CLASSES->--------------------------------------------------------------------------------------# ################################################################################################################### #--<-STATIC CLASS PRESET CISCO 19xx->-----------------------------------------------------------------------------# ################################################################################################################### DEFINE MODE_EN=yes DEFINE MODE_CFG=yes DEFINE MODE_WR=no DEFINE CHAR_DIS=> DEFINE CHAR_EN=# DEFINE CHAR_CFG=# DEFINE CMD_EN=en DEFINE CMD_CFG=conf t DEFINE CMD_WR=wr DEFINE CMD_SET_NO_PAGE=terminal length 0 DEFINE CHAR_PAGE=--more-- DEFINE CMD_SKIP=NL DEFINE CMD_QUIT=exit DEFINE CHAR_NL=NL DEFINE CHAR_INVALID=INVALID COMMAND DEFINE CHAR_CONFIRM=[yes/no]: DEFINE CMD_CONFIRM=yes DEFINE CMD_ROOTDIR=end ################################################################################################################### #--<-STATIC CLASS PRESET ASPEN-->---------------------------------------------------------------------------------# ################################################################################################################### #DEFINE MODE_EN=no #DEFINE MODE_CFG=no #DEFINE MODE_WR=no #DEFINE CHAR_DIS=> #DEFINE CHAR_EN=> #DEFINE CHAR_CFG=? #DEFINE CMD_EN=? #DEFINE CMD_CFG=? #DEFINE CMD_WR=? #DEFINE CMD_SET_NO_PAGE=? #DEFINE CHAR_PAGE=Press #DEFINE CMD_SKIP=SPACE #DEFINE CMD_QUIT=logout #DEFINE CHAR_NL=CR #DEFINE CHAR_INVALID=Bad Command #DEFINE CHAR_CONFIRM=? #DEFINE CMD_CONFIRM=? ################################################################################################################### #--<-STATIC CLASS CUSTOMIZED->------------------------------------------------------------------------------------# ################################################################################################################### #DEFINE MODE_EN= #DEFINE MODE_CFG= #DEFINE MODE_WR= #DEFINE CHAR_DIS= #DEFINE CHAR_EN= #DEFINE CHAR_CFG= #DEFINE CMD_EN= #DEFINE CMD_CFG= #DEFINE CMD_WR= #DEFINE CMD_SET_NO_PAGE= #DEFINE CHAR_PAGE= #DEFINE CMD_SKIP= #DEFINE CMD_QUIT= #DEFINE CHAR_NL= #DEFINE CHAR_INVALID= #DEFINE CHAR_CONFIRM= #DEFINE CMD_CONFIRM= ################################################################################################################### #---SECTION COMMAND SETS------------------------------------------------------------------------------------------# ################################################################################################################### #IP:COMMAND1=MATCH1=MATCH2=MATCH...N,COMMAND2=MATCH2 # LIST OF METACHARACTERS!!!DO NOT USE ANY OF THESE EXCEPT FOR THEIR INTENTED PURPOSE!!! # : <= separates the device IP from the COMMAND INSTANCES # , <= separates all COMMAND Instances from each other (optionally these instances may include pattern matching instructions) # = <= separates patterns. Matching is performed on the OUTPUT of the COMMAND. Applies ONLY to scope of the COMMAND instance. # ! <= makes this pattern matching instance an inverse matching instruction. i.e. output does NOT contain pattern. # # <= escapes any of the above Metacharacters. This needs to be put infront of Metacharacters that you do NOT want the script to interprete as such. (e.g. #= will escape the =) #IP:COMMAND=MATCH=!DONTMATCH ################################################################################################################### #---END CONFIG----------------------------------------------------------------------------------------------------# ################################################################################################################### "; return $TEMPLATE; } ###################################################################################################################### ## / TEMPLATES ##################################################################################################### ###################################################################################################################### 1;