Home

Avaya Writing Technician Interface Scripts User's Manual

image

Contents

1. General variable initialization setenv match_entries 0 setenv matchcct Ya Writing Technician Interface Scripts HE aE RH EEE EH EE HE EEE EEE RE EE EE EE EE EE EE EEE ERE EERE Sub command vectoring HHPEEEERHEEEEEEEEE EE HEHE EEE E PEER REET HERE EERE FE FE AE AE FE EEE REE EHH if S 0 then goto FI_HELP setenv cmd 1 let cmdlen strlen cmd un let i strindex show cmd if Scmdlen lt 3 then goto FI HELP if i 1 then goto FI SHOW let i strindex enable cmd if i 1 then goto FI ENBL let i strindex disable cmd if i 1 then goto FI DSB Help screen FI_ HELP Lis else fall through to the Help screen ARE HE RE AE AE RE HE EEE FE E AE REE HE RE EE RE HE REE ERE FE FE EEE EE RAE EEE PARE HR RTE E AE EE HE RE E AE REE HE REE EH ERE ERE EE EEE EEE EE RAE EHH echo FDDI Command Script eno ecno M echo This script is not intended to be run directly echo Please run setpath and then use the following echo commands echo echo disable fddi echo enable fddi echo show fddi echo goto FI END A 4 Sample Scripts THETHECEREREREHEREREREHEAEREEHEREREREHEREHEEHEREREEHEREHEEHEREHEE AHH EEE SHH Parse for show command HR RRA EER E EB E E FI SHOW if 1 then goto FI HELP SHOW setenv cmd 2 let len strlen cmd if Sl
2. TMO MTU Filter printf 4 4s 4 4s 8 8s 8 8s 17 17s 4 4s 4 4s 8 8s n tee SY vo ty PUN oN v now now now return HR HH aE a a a EH Ea a a HEE aE Print one line for base alerts disabled enabled screens HR HE aE HE HE HE aE TE E AE a aE aE HE HE aE AE a a aE HEHE aE a a aH HEE a a E EEE a a a EE FI ONELINE printf 4d 4d S value Slot S value SNode printf 8 8s Scctname if value Enable 2 then printf 8s Disabled goto FI STATE ESC if value State 4 then printf 8s Not Pres goto FI_STATE_ESC if value State 3 then printf 8s Init goto FI STATE ESC if S value State 2 then printf 8s Down goto FI STATE ESC if wfFddiSmtEntry wfFddiSmtCfState S nextid 1 then printf 8s Down goto FI STATE ESC if S wfFddiMacExtEntry wfFddiMacMaUnitDataEnable nextid 2 then printf 8s LLC Off goto FI STATE ESC printf 8s Up Writing Technician Interface Scripts FI_ STATE ESC printf 17 17s value Madr if value Bofl 2 then printf 4s Off goto FI BOFL ESC printf 4d value S BoflTmo FI BOFL ESC printf 4d S value SMtu let mode v
3. FAE SKIP if tbl_ entries 1 then printf 5d entry in table n tbl entries goto FAE DONE printf 5d entries in table Wn tbl entries FAE DONE 3k Exit branch point FI END A 39 Symbols f inserting comments using 1 13 referencing variable using 1 2 A arrayenv command 1 10 2 3 arrays 1 8 C commands arrayenv 1 10 2 3 cutenv 1 9 2 4 echo 1 8 1 12 2 6 enumenv 1 10 2 7 export 1 4 2 8 getenv 1 8 2 9 gosub 1 11 2 10 goto 1 11 2 11 if 1 11 2 12 to 2 15 instenv 1 9 2 16 let 1 10 2 18 to 2 23 mibget 2 24 to 2 26 octetfmt 1 7 2 27 on error 1 12 2 29 pause 1 11 2 30 printf 1 12 2 31 to 2 33 record 1 12 return 1 11 2 36 run 1 14 2 37 save env 2 39 setenv 1 9 2 40 source env 1 13 2 41 Index sprintf 1 10 2 42 unsetenv 1 10 2 43 verbose 1 13 2 45 comments inserting 1 13 controlling program flow 1 11 cutenv command 1 9 2 4 D debugging script files 2 45 deleting variables 1 10 2 43 E echo command 1 8 1 12 2 6 enumenv command 1 10 2 7 error messages from printf command 2 33 from sprintf command 2 42 error recovery performing 1 12 2 29 evaluating expressions 2 12 2 18 export command 1 4 2 8 F formatting output 2 31 functions 2 20 2 21 Index 1 G getenv command 1 8 2 9 global variables overview of 1 4 PWD 1 11 gosub comm
4. HR EER EEEPEEEREEER EERE AH Add FI_ENBL if 1 then goto FI HELP ENBL setenv cmd 2 let len strlen cmd if Slen 3 then goto FI HELP ENBL let i strindex circuit cmd if i 1 then goto FI ENBLC let i strindex connector cmd if i 1 then goto FI ENBLI FI HELP ENBL echo FDDI Enable Command Help cho M m echo echo enable fddi option echo Where option is one of the following echo et echo circuit circuit name echo connector slot connector goto FI END A 33 Writing Technician Interface Scripts 3k Enable circuit FI ENBLC if S 3 then instenv list wfFddil if list_0 0 the setenv matchcct goto FI HELP ENBL Entry n goto FI_ENBLNF 3 if Smatchect then goto let i l FI_END Search for circuit with matching name FI ENBLLP on error FI ENBLNXT if i gt S list 0 then let cctnum wfF gosub GETCCTNAME pr if ic matchcct Found it set wfFddiEntry wfFDDII echo FDDI circuit commit goto FI END FI ENBLNXT let i i 1 goto FI ENBLLP FI ENBLNFE echo FDDI circuit 3 not found 3k goto FI END Enable connector goto FI ENBLNF ddiEntry wfFD DICct list i l cctnam
5. Do next circuit FI BASE NXT let i i 1 goto FI_LOOP match entries 1 Entry attr nextid value nextid 1 goto FOOTER_AND_END then goto FI_PRNTB Scctname then goto FI BASE NXT Writing Technician Interface Scripts HEE HE AE RE EE EEE EEE EEE EE EAE EE RE EAE EEE EE EERE EAE ERE ERE Show Alerts screen HARTA EERE EE E E FI ALERTS setenv matchcct xxx setenv nextflag setenv pattern setenv nextid Noon array array array enum enum enum echo za a 1 i i attr wfFDDICct wfFDDIState wfFDDIEnable wfFDDISlot attr wfFDDINode wfFDDIMadr MAC ADDRESS wfFDDIBofl attr wfFDDIBoflTmo wfFDDIMtu wfFDDIHardwareFilter Cct State Enable Slot i Node Madr Bofl i BoflTmo Mtu HwFilter echo FDDI Modules on Alert v cho gosub FI BASEHDR let i FI ALOOP mibget n wfFddil if Snex 0 let cctnum value Cct Entry attr nextid value nextid tid END then let i i 1 goto FOOTER AND END gosub GETCCTNAME if S value SEnable 1 then goto FI SKIPA if S value S State 1 then goto FI_BASE10 if wfFddiSmtEntry wfFddiSmtCfState nextid 1 then goto FI BASE10 if wfFddiMacExtEntry wfFddiMacMaUnitDataEnable nextid 2 then goto FI SKIPA FI_BASE10 let match entries matc
6. For specific instructions on using the unsetenv command see Chapter 2 Creating a Script File Setting the Current Volume or Directory When you set the current working volume or directory using the cd change directory command you are setting the global variable PWD to the value you specify in the command as shown in the following script cd 3 echo SPWD 3 getenv PWD PWD 3 Controlling Program Flow The Technician Interface provides several commands to control program flow in your script For details on each of the following commands see Chapter 2 To specify the next line to be executed from the script file use the goto command Within the script file use the goto command with a label A label begins and ends with a colon consists of up to 15 alphanumeric characters and the underscore character _ and must be on its own line beginning in column 1 To evaluate whether an expression is true use the if command The expression can compare two numerical values or two ASCII strings If the expression is true the script interpreter executes any additional commands that are on the same command line as the if command If the expression is false the script interpreter does not execute the if command You use a semicolon to end an if command The semicolon separates the if command from the commands you want executed if the if command is true To suspend the Technician Interface s operation for
7. 1 then goto if 5 then goto setenv matchcct 5 FI RCV NM wr setenv nextflag setenv pattern setenv nextid wr wx rnm array attr wfFDDICct wfFDDISlot wfFDDINode wfFDDICrcErrRx array a attr wfFDDIOverrunRx wfFDDIInvalidFrameStatusRx array a attr wfFDDIMacErrRx wfFDDIRxOversizedFrames enum 1 Cct Slot Node CrcErrRx OverrunRx InvalidFrame MacErrRx i enum i RxOversized echo echo FDDI Module Receive M Errors cho echo A 15 Writing Technician Interface Scripts printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s n 7 NS CRC Overrun Invalid Frames printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s n Slot Conn Circuit Errors Errors Frames Too Long printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s n v v M m v m u m N let i 0 FI_RXLOOP mibget n wfFddiEntry attr nextid value nextid if nextid END then let i i 1 goto FOOTER_AND_END let cctnum value Cct gosub GETCCTNAME if matchcct then goto FI PRNTR if ic matchcct Scctname then goto FI RCV NXT let match entries match entries 1 FI PRNTR printf 4d 4d value S10t value Node printf 8 8s 10u 10u cctname value CrcErrRx value
8. 6 6s n Slot Conn Serreuitt ow LAA Neg EP ds dq deu ASS State State secs printf 4 4s 4 4s 8 8s 31 31s 8 8s 8 8s 6 6s n instenv list wfFddiSmtl v now now ow v How now Entry EON A 21 Writing Technician Interface Scripts FI SMT LP on error FI SMT NXT if i gt list_0 then goto FOOTER AND END let cctnum wfFddiEntry wfFDDICct list_ i gosub GETCCTNAME if matchcct then goto FI_PRNTSMT if ic matchcct Scctname then goto FI SMT NXT let match entries match entries 1 FI_PRNTSMT printf 4d 4d wfFddiEntry wfFDDISlot list_ i wfFddiEntry wfFDDINode list i printf 8 8s Scctname Print the connection policy matrix let bit 12 setenv flags setenv bit0x0 setenv bitOxl R setenv bit0x2 R setenv bit0x3 RR setenv bit0x4 R setenv bitO0x5 R R setenv bit0x6 RR setenv bit0x7 RRR setenv bit0x8 R d setenv bit0x9 R e RT setenv bit0xA R Bo setenv bitOxB R RR setenv bit0xC RR setenv bitOxD RR R setenv bitOxE RRR setenv bitOxF RR RR let policy wfFddiEntry wfFDDISmtConnectionPolicy list_ i FI_BIT_LP let h result policy 0xF lt lt Sbit gt gt bit
9. 10u Sparity Sring S value SPortOpErr value InternOpErr value SHostErr echo cutenv c9 15 name2 cctname if name2 0 1 then printf 4s 4s 7 7sNn S name2 1 FI SYS NXT let i i 1 goto FI_SyLOOP A 20 Sample Scripts HEE aE RE EEE HEE HE EEE ERE EE AEE EE EEE ER EEE ERE EERE SMT screen HEE aE RE aE EEE HE EE HE EEE EE RA EAE EE EE ER EE ERE ERE FI_SMT let i l check for circuit name to match on if 2 then goto FI SMT NM setenv cmd 3 let len strlen cmd 1f len lt 3 then goto FI_HELP_SHOW let j strindex circuit cmd if j 1 then goto FI HELP SHOW if Sf 4 then goto FI HELP SHOW setenv matchcct 4 FI SMT NM echo echo FDDI Modules SMT Parameters cho 4 echo printf 4 4s 4 4s 8 8s 31 31s 8 8s 8 8s 6 6s n Connection Policy R Reject w w printf 4 4s 4 4s 8 8s 31 31s 8 8s 8 8s 6 6s n printf 18 18s 31 31s 8 8s 8 8s 6 6s n Local IMMMMSSSSBBBBAA A A VW wr wr printf 18 18s 31 31s 8 8s 8 8s 6 6s n Neighbor MS BAMSBAMSBAMSB A wwrw cr printf 4 4s 4 4s 8 8s 31 31s 8 8s 8 8s 6 6s n Ao ow esr pa ad EC due EPI ub dad to ep e ECM Connect Notify printf 4 4s 4 4s 8 8s 31 31s 8 8s 8 8s
10. FI PRNTT printf 4d 4d 8 8s 10u 10u n value S1ot value S Node Scctname value SAbortTx value UnderrunTx cutenv c9 15 name2 Scctname if name2 0 1 then printf 4s 4s 7 7sNn S name2 1 FEI XMIT NXT let i i 1 goto FI_TXLOOP Sample Scripts ErrRx ErrRx Err HostErr HERE E HE EE HEH HEE EE EH EEE EE HEHE EEE EH HEE EH E E E E EEE EEE HH System Errors screen HERE E EEE HEH HEE EH EEE EE EE HEE EEE EH EEE E E E E E EERE EH HEE FI_SYSTEM if lt 3 then goto FI Syl let cmdlen strlen 3 let i strindex errors 3 if i 1 then if cmdlen gt 3 then goto FI Syl goto FI HELP FI Syl check for circuit name to match on if 4 lt 3 then goto FI SYS NM setenv cmd 4 let len strlen cmd if len lt 3 then goto FI_HELP_SHOW let j strindex circuit cmd if j 1 then goto FI HELP SHOW if Sf 5 then goto FI HELP SHOW setenv matchcct 5 FI SYS NM setenv nextflag setenv pattern setenv nextid d array attr wfFDDICct wfFDDISlot wfFDDINode wfFDDIParity wfFDDIParityErrTx array a attr wfFDDIRingErrRx wfFDDIRingErrTx wfFDDISmtRing wfFDDIPortOpErr array a attr wfFDDIInternOpErr wfFDDIHostErr enum 1 Cct Slot Node ParityErrRx ParityErrTx i enum i RingErrRx RingErrTx SmtRingErrRx PortOpErr In
11. and other materials related to such distribution and use acknowledge that such portions of the software were developed by the University of California Berkeley The name of the University may not be used to endorse or promote products derived from such portions of the software without specific prior written permission SUCH PORTIONS OF THE SOFTWARE ARE PROVIDED AS IS AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE In addition the program and information contained herein are licensed only pursuant to a license agreement that contains restrictions on use and disclosure that may incorporate by reference certain limitations and notices imposed by third parties Bay Networks Software License Note 7his is Bay Networks basic license document In the absence of a software license agreement specifying varying terms this license or the license included with the particular product shall govern licensee s use of Bay Networks software This Software License shall govern the licensing of all software provided to licensee by Bay Networks Software Bay Networks will provide licensee with Software in machine readable form and related documentation Documentation The Software provided under this license is proprietary to Bay Networks and to third parties from whom Bay Networks has acquired license rights Bay Netwo
12. OverrunRx let invalid S value SInvalidFrame value SMacErrRx gosub MAC_EXTRACT let invalid Sinvalid mac_sum printf 10u 10u Sinvalid value RxOversized echo cutenv c9 15 name2 cctname if name2 0 1 then printf 4s 4s 7 7s n S name2 1 FI RCV NXT let i i 1 goto FI_RXLOOP Gosub to extract errors in the MAC object from the octet strings returns sum in mac sum He de dE ou MAC EXTRACT setenv mac sum 0 if 7 wfFddiMacEntry wfFddiMa return array mac attr wfFddiMacErro EX BYTES enum 1 errorcts lostcts Sample Scripts 0 then cErrorCts nextid rCts H ES wfFddiMacLostCts EX BYT mibget wfFddiMacEntry mac attr nextid mac value mac next cutenv d f1 mac err mac_value Serrorcts cutenv d f1 mac lost mac_value Slostcts let mac sum mac sum Ox mac err 8 let mac sum mac sum 256 Ox mac_err 7 let mac sum mac sum 65536 OxS mac_err 6 let mac sum mac sum 16777216 Ox mac err 5 et mac sum mac sum 0x mac_lost 8 let mac sum mac sum 256 Ox mac lost 7 let mac sum mac sum 65536 Ox mac_lost 6 et mac sum mac sum 16777216 Ox mac lost 5 return THETHEHEREREREHEREREREHE HERE ERE AHH E EB E E Transmit Errors screen HARE AHH FI_XMIT if 4 lt 3 then goto FI_
13. a comma separated list of integer field numbers in increasing order with an optional hyphen to indicate ranges Separate variables are created for each noncontiguous set of characters For example 2 4 6 represent characters 2 4 and 6 1 5 9 represent characters 1 through 5 inclusive and 9 5 10 represent the first character in the list through 5 inclusive and 10 5 represent the character 5 through the last character in the list inclusive Numbers and number ranges may be repeated overlapping and in any order You can select fields or columns not present in the text string variable name is the prefix or name representing the pseudo variable array text string with no field delimiters is normally passed through in its entirety 2 4 Command Reference The following sample script shows how you use the cutenv command to assign portions of 192 32 100 55 to a pseudo variable array cutenv d f 1 3 addr_ 192 32 100 55 echo addr 0 addr 1 addr 2 2 192 100 2 5 Writing Technician Interface Scripts echo The echo command allows you to display its command line arguments to the user s terminal The echo command has the following syntax echo text string Or echo variable name text string is any literal text variable name 1s the name of a variable For example when you execute the script echo Good Morning the system displays Good Morning on the user s console
14. circuit name gt echo sample lt period in seconds gt circuit circuit name echo smt circuit circuit name echo stats circuit circuit name gt echo system errors circuit circuit name echo transmit errors circuit circuit name echo version goto FI END rr Base or Module screen HH a aE E FI BASE check for circuit name to match on if 2 then goto FI BASE NM setenv cmd 3 let len strlen cmd if len lt 3 then goto FI_HELP_SHOW let j strindex circuit cmd if j 1 then goto FI HELP SHOW if Sf 4 then goto FI HELP SHOW setenv matchcct 4 zl FI BASE NM setenv nextfla setenv pattern setenv nextid array attr array a attr array a attr enum 1 Cct wr g wr worm Sample Scripts wfFDDICct wfFDDIState wfFDDIEnable wfFDDISlot wfFDDI ode wfFDDIMadr MAC ADDRESS wfFDDIBof1l wfFDDIBoflTmo wfFDDIMtu wfFDDIHardwareFilter State Enable Slot i enum i Node Madr Bofl i enum i BoflTmo Mtu HwFilter HDR echo echo FDDI Modules cho gosub FI BASE let i 0 FI_LOOP mibget n wfFddil if Snextid END then let i i 4 let cctnum S value Cct gosub GETCCTNAME T if Smatchcct if ic matchcct let match entr FI_PRNTB pr les INE gosub FI_ONEL
15. e To evaluate a simple arithmetical or logical expression and assign the result to a given variable use the let command The let command evaluates an expression from left to right default You can use parentheses to change the order of the evaluation e To write a list of command line arguments into a pseudo variable array use the arrayenv command You can append arguments to the end of an existing variable array with the a around it for 6699 option If an argument contains spaces place double quotes example enclose this one e To assign a sequence of values to a list of variable names use the enumenv command You must indicate a starting number and optionally you can specify a value by which to increment the values in the series You can use the sequence you have created as named indices of an array variable Primarily you use this command with the arrayenv command to index the values created by that command Deleting Variables To delete one or more variables from the local or global environment variable table use the unsetenv command For example if you enter unsetenv a the system deletes variable a from the table You cannot delete a variable from the system environment variable table You can delete all variables that are part of a pseudo variable array by using the wildcard character For example to delete all variables that begin with array enter the following command unsetenv array
16. enumenv instenv let mibget setenv or sprintf For more information about these commands see Chapter 2 Note The value of a variable in the local or global table takes precedence over a variable with the same name in the system variable table Special Variables This section describes how to use input variables how to prompt for user entry from the console and how to access and format information from the MIB Input Parameters The Technician Interface reserves the following variables as input parameters for a script file 1 2 3 4 5 6 7 8 9 and The special variable contains the number of parameters entered on the command line following the script filename It is set to zero if no parameters are entered For more information about input parameters see run in Chapter 2 1 4 Creating a Script File Prompting for Input The input prompt variable allows you to create a prompt that accepts user input from the Technician Interface console The syntax of the input prompt variable is prompt string The Technician Interface prompts the user with the message you entered between the brackets lt gt In the following script setenv ans S Enter your name gt echo Your name is Sans Enter your name appears on the user s console After the user enters a value the Technician Interface substitutes the value for ans and displays the message Your name is followed by the name entered
17. env test To read and execute the commands in a Technician Interface script file and to ensure that the router saves restores all local variables when the script ends use the source env command For example to run the script file test on volume 2 and to restore upon completion all local variables saved previously to test enter the following command source env 2 test To locate script errors use the verbose on command and then use the source env command The Technician Interface displays each line from the file before it executes the line enabling you to easily locate errors For more information about the save env and source env commands see Chapter 2 Writing Technician Interface Scripts Running a Script File To read and execute the commands in a Technician Interface script file and to ensure that the router deletes all local variables when the script ends use the run command For example to run the script file test on volume 2 deleting upon script completion all local variables saved previously to test enter the following command run 2 test To locate script errors use the verbose on command and then use the run command The Technician Interface displays each line from the file before it executes the line enabling you to locate errors easily You can use the run command with the s flag to prevent the system from returning an error message if the run command cannot locate the specified script file The f
18. number Ox serialnoV 2 28 on error Command Reference The on error command allows you to specify an error handler label within a script file If a command returns an error or if the user attempts to abort the script file the script interpreter goes to the error handler label defined in the file If you press Ctrl c to abort the script the Technician Interface displays the following prompt Terminate script file y n The on error command has the following syntax on error s lt abel gt s allows the script to recover without returning an error message if the on error command cannot locate a specified file label is the name of the error handler label In the following script the script interpreter goes to the label ERROR HANDLER when an error occurs on error ERROR HANDLER echo what echo this line is skipped due to the above echo syntax error Missing quote ERROR_HANDLER echo The error handler is called because of the echo deliberate syntax error in the previous command The error handler is automatically canceled after an error is found or if you issue the on error command without a label 2 29 Writing Technician Interface Scripts pause The pause command allows you to suspend operation of the Technician Interface for a given interval During this time the router is still running The pause command has the following syntax pause no of second
19. or in pattern A matches any character or no character and a matches any character in that position in the string A character must exist in that position for to match strmatch lt string gt lt pattern gt 2 20 Command Reference You can also get the ASCII code for a given character indicated as one character within single quotes such as c The let command also provides the following date and time functions date time timezone The function date used with no arguments returns the current date in seconds If you enter a date string in the format MM DD YY for example date 10 7 95 the function returns the number of seconds from January 1 1900 to that date Dates may range from 1 1 00 January 1 1900 to 12 31 99 December 31 1999 If you omit the year the function uses the current year The function time used with no arguments returns the current local time in seconds If you enter a time string in the format HH MM SS for example time 7 04 32 HH MM or MM the function returns the number of seconds from 12 00 midnight to that time HH must be a value between 0 and 23 inclusive MM must be a value between 0 and 59 inclusive SS must be a value between O and 59 inclusive The function timezone used with no arguments returns the current time zone in seconds If you enter a time zone string in the format l 4H MM for example timezone 08 00 th
20. special characters you can use in the format and input arguments 2 31 Writing Technician Interface Scripts Table 2 4 Special Characters Character Meaning a audible bell b backspace f form feed n newline r carriage return t tab xhh hex code 1000 octal code A summary of the flags and conversion codes follows format 9e flag width precision conversion specification flag represents one of the following symbols e minus sign left justifies data default is right justified e plus sign prints a number e space prints a minus sign in front of a negative number or prints a space in front of a positive number e Zero 0 pads numeric conversions with zeros e pound sign specifies an alternate output form if the conversion specifier is X or O lt width gt is a number that specifies the minimum field width If lt width gt is specified as an asterisk then use the next argument as lt width gt period separates lt width gt and lt precision gt lt precision gt specifies the maximum number of characters to be printed from a string or the minimum number of digits for an integer If lt precision gt is an asterisk then use the next argument as lt precision gt 2 32 Command Reference conversion specification can be one of the following e doriindicates signed decimal notation e Oindicates unsig
21. tcmd show fddi version FDDI bat version tcmd show fddi hwfilters Hardware Filters tcmd show fddi mac MAC Parameters tcmd show fddi port Port Parameters tcmd show fddi receive errors Receive Errors tcmd show fddi sat SMT Parameters tcmd show fddi stats Stats tcmd show fddi system errors System Errors tcmd show fddi transmit errors Transmit Errors unalias setcmd A 2 Sample Scripts FDDI BAT Script The following example shows a protocol script for a Bay Networks router You view output from the script by entering script commands for example show fddi at the Technician Interface command line or by using the menu utility See Using Technician Interface Scripts for instructions on entering script commands The following script allows you to display information from FDDI MIB objects and to enable or disable FDDI Q WSCCS k scripts fddi bat 1 11 10 31 95 PARE HE RE AE AE RE HE EEE E AE RE EE RAE EH REE REE EE EE EEE AE FE FE FE EFE H Copyright Bay Networks Inc 1995 Display FDDI Driver Information PARE HE REE HEE EE FE AE AE EB RE EE RAE EH ERE EH REE EE EEE EEE EE RAE EHH PARE HE RE AE AE EE EE FE AE AE EE RE AE FE RAE EERE HERE EE ER AE AE FE EEE EE REE EEE Set up for either using the builtin octetfmt function 7 80 or newer or the gosub 7 70 PEE HE REE HE RE EH ETH EH REE EH REE ER REE EERE RH AE AE AE AE AE AE REE HE HERE
22. vii Tables Table 2 1 Script Commands EE 2 1 Table 2 2 Arithmetical Operators sse 2 19 Table 2 3 Logical Operators ee DR eee d ec ee di eee 2 19 Table 2 4 Special Characters 2 eter ia Horse a Certe des bra Hester Ru 2 32 About This Guide If you are interested in creating and editing Technician Interface scripts refer to this guide for An overview of variables Instructions on creating using and saving variables using the Technician Interface script commands The function and syntax of each Technician Interface script command Software Suites Routing and Switching software is available in the following suites The System Suite includes IP routing 802 1 Transparent Bridge Source Route Bridge Translation Bridge SNMP Agent Bay Networks HDLC PPP OSPF EGP BGP and basic DLSw The LAN Suite includes DECnet Phase 4 AppleTalk Phase 2 OSI VINES IPX and ATM DXI in addition to the System Suite The WAN Suite includes ATM DXI Frame Relay LAPB and X 25 in addition to the System Suite The Corporate Suite includes the System LAN and WAN suites in their entirety The ARE ATM Suite provides RFC 1483 and 1577 compliance ATM UNI 3 0 signaling in addition to the LAN Suite The ARE VNR Corporate Suite provides ATM Forum LAN Emulation in addition to the ARE ATM Suite and Corporate Suite xi Writing Technician Interface Scripts Audience The BNX Suite includes IP R
23. LED setenv setenv setenv setenv array array array enum enum enum echo matchcct xxx next flag pattern wr wr nextid NE a a i i attr wfFDDICct wfFDDIState wfFDDIEnable wfFDDISlot attr wfFDDINode wfFDDIMadr MAC ADDRESS wfFDDIBofl attr wfFDDIBoflTmo wfFDDIMtu wfFDDIHardwareFilter Cct State Enable Slot i Node Madr Bofl i BoflTmo Mtu HwFilter echo FDDI Modules Enabled v cho gosub FI BASEHDR let i FI ELOOP mibget n wfFddiEntry attr nextid value nextid if Snex 0 tid END then let i i 1 goto FOOTER AND END let cctnum S value Cct gosub G ETCCTNAME if value SEnable 1 then let match entries match entries 1 gosub FI ONELINE let i Sate goto FI_ELOOP A 10 Sample Scripts Heat aE aE aE aE aE aE aE aE aE HE aE HE aE HE aE a E AE E aE HE HE HE HE AE a a aE HE aE HE a aE EEE HE E E EE aE HEE a AA AA Print header for base alerts disabled enabled screens Heat aE aE aE aE aE aE aE aE aE HE aE HE aE HE aE A EAE FE aE HE HE HE aE a a a aE HEHE a a a EEE aE E EEE E HEE aa EE FI_BASEHDR echo printf 4 4s 4 4s 8 8s 8 8s 17 17s 4 4s 4 4s 8 BS MA VI MEI NOME BOE OMS NENA printf 4 4s 4 4s 8 8s 8 8s 17 17s 4 4s 4 4s 8 8s1n Slot Conn Circuit State MAC Address
24. LLP on error FI_DSBLNXT if i gt Slist 0 then goto FI_DSBLNF Sample Scripts let cctnum wfFddiEntry wfFDDICct list_ 1 gosub GETCCTNAME if ic matchcct cctname then Found it goto FI DSBLNXT set wfFddiEntry wfFDDIEnable list_ i 2 echo FDDI circuit cctname disabled commit goto FI END FI DSBLNXT let i i 1 goto FI DSBLLP FI DSBLNFE echo FDDI circuit 3 not found goto FI END Disable connector A 37 Writing Technician Interface Scripts FI DSBLI if Sf l 3 then goto FI HELP DSBL Sanity check lt slot connector gt parameter if Sver lt x7 80 then goto SKIP_STRPBRK2 setenv teststr ABCDEFGHIJKLMNOPORSTUVWXY Steststr FIDS MSGl1 HELP let invalch strpbr if Sinvalch setenv teststr l 0 then M k 39 3 7 goto abcdefghijklmnopqrs let invalch strpbrk 3 if Sinvalch 0 then goto FIDS_MSG1_HELP setenv teststr S amp _ gt 72 lt gt let invalch strpbrk 3 if Sinvalch l 0 then SKIP_STRPBRK2 goto Steststr teststr FIDS MSGl1 HELP tuvwxyz let firstdot strindex 3 if Sfirstdot 0 then let lastdot strrindex 3 if Sfirstdot lastdot then if wfFddiEntry wfFD u goto u DIEn
25. Networks Technical Response Center in your area United States 1 800 2LAN WAN Valbonne France 33 92 966 968 Sydney Australia 61 2 903 5800 Tokyo Japan 81 3 328 005 Conventions This section describes the conventions used in this guide angle brackets lt gt Indicate that you choose the text to enter based on the description inside the brackets Do not type the brackets when entering the command Example if command syntax is ping jp address you enter ping 192 32 10 12 Xiv arrow character gt bold text brackets italic text quotation marks screen test ellipsis points vertical line l About This Guide Separates menu and option names in instructions Example Protocols AppleTalk identifies the AppleTalk option in the Protocols menu Indicates text that you need to enter and command names in text Example Use the dinfo command Indicate optional elements You can choose none one or all of the options Indicates variable values in command syntax descriptions new terms file and directory names and book titles Indicate the title of a chapter or section within a book Indicates data that appears on the screen Example set Bay Networks Trap Monitor Filters Horizontal and vertical ellipsis points indicate omitted information Indicates that you enter only one of the parts of the command The vertical line separates choices Do not type the verti
26. R Symbol name is greater than 15 characters You specified a variable name longer than 15 characters ERROR Invalid character lt invalid_character gt in lt symbol gt You entered an invalid character in the variable name bd ERROR Symbol text is greater than 255 characters The value assigned to the variable is longer than 255 characters 2 42 Command Reference unsetenv The unsetenv command allows you to delete one or more variables from the local or global environment variable table You cannot delete a variable from the system environment variable table The unsetenv command uses the following syntax unsetenv variable name unsetenv variable name variable name unsetenv unsetenv l unsetenv g unsetenv lt text gt unsetenv lt text gt lt variable_name gt is the name of the variable you want to delete deletes variables from the local table only g deletes variables from the global table only deletes all variables from the table you specify If you do not specify a table it deletes all variables matches a single character in the given string position text deletes all variables that begin with the specified text string 2 43 Writing Technician Interface Scripts Examples If you enter unsetenv slot unsetenv slot value unsetenv unsetenv l unsetenv g unsetenv ip The system Deletes the variable slo
27. Tx1 let cmdlen strlen 3 let i strindex errors 3 if i 1 then if cmdlen gt 3 then goto FI TIxl goto FI HELP SET Tel check for circuit name to match on if 4 lt 3 then goto FI XMIT NM setenv cmd 4 let len strlen cmd if len lt 3 then goto FI_HELP_SHOW let j strindex circuit cmd if j 1 then goto FI HELP SHOW if Sf 5 then goto FI HELP SHOW setenv matchcct 5 A 17 Writing Technician Interface Scripts FI XMIT NM setenv nextflag setenv pattern setenv nextid Malt array attr wfFDDICct wfFDDISlot wfFDDINode wfFDDIAbortTx wfFDDIUnderrunTx enum 1 Cct Slot Node AbortTx UnderrunTx wr echo echo FDDI Module Transmit Errors cho M n echo printf 4 4s 4 4s 8 8s 10 10s 10 10s n x ian A Aborted Underrun printf 4 4s 4 4s 8 8s 10 10s 10 10s n Slot Conn Circuit Frames Errors printf 4 4s 4 4s 8 8s 10 10s 10 10s n M now now How How let i 0 FI_TXLOOP on error FI_XMIT_NXT mibget n wfFddiEntry attr nextid value nextid if nextid END then let i i 1 goto FOOTER AND END let cctnum value Cct gosub GETCCTNAME if matchcct then goto FI PRNTT if ic matchcct Scctname then goto FI XMIT NXT let match entries match entries 1
28. When you execute the script setenv b blue echo b the system displays blue on the user s console 2 6 enumenv Command Reference The enumenv command lets you assign a sequence of values to a list of variables You assign a starting number starting and can optionally specify a value by which to increment the enumeration increment Most commonly you use this command with the arrayenv command to create named indices to use with a value array That way you can refer to the elements of the array with meaningful names rather than index numbers For an example see the mibget command The enumenv command has the following syntax enumenv starting lt increment gt variable name variable names starting Y is the starting number of the enumeration increment is the value by which to increment the enumeration variable name is the pseudo variable array The following example creates indices for attributes in a value array In the result is the starting number and the values increment by 1 Therefore the variable named proto is 1 the variable named dest is 2 and so on enumenv 1 proto dest next hop mask metric as 2 7 Writing Technician Interface Scripts export The export command allows you to move one or more local variables to the global environment variable table When you first define a variable it is stored in the local environment variable table Global variables
29. Writing Technician Interface Scripts Router Software Version 10 0 Site Manager Software Version 4 0 Software Version BNX 6 0 Site Manager Software Version BNX 6 0 Part No 112946 Rev A January 1996 ES Bay Networks CES Bay Networks 4401 Great America Parkway 8 Federal Street Santa Clara CA 95054 Billerica MA 01821 Copyright 1988 1996 Bay Networks Inc All rights reserved Printed in the USA January 1996 The information in this document is subject to change without notice The statements configurations technical data and recommendations in this document are believed to be accurate and reliable but are presented without express or implied warranty Users must take full responsibility for their applications of any products specified in this document The information in this document is proprietary to Bay Networks Inc The software described in this document is furnished under a license agreement and may only be used in accordance with the terms of that license A summary of the Software License is included in this document Restricted Rights Legend Use duplication or disclosure by the United States Government is subject to restrictions as set forth in subparagraph c 1 Gi of the Rights in Technical Data and Computer Software clause at DFARS 252 227 7013 Notice for All Other Executive Agencies Notwithstanding any other license agreement that may pertain to or accompany the delivery of this computer softw
30. _ 1 gosub GETCCTNAME if ic matchcct FI_SAMP1_NOW le let m match entrie setenv slinstid m setenv slrxfrms m setenv sltxfrms m setenv slrxlors m setenv sltxlors_ m FI_SAMP1_SKP let i i 1 goto FI_SAMP1_LP Scctname then goto FI_SAMP1_SKP match entries match entries 1 S list i wfFddiEntry wfFDDIFramesRxOk list_ i wfFddiEntry wfFDDIFramesTxOk list_ i w FddiEntry wfFDDIRingOverrunRx list_ i w FddiEntry wfFDDITxClipFrames list i Nr then goto FOOTER AND END ch entries Wait the proscribed period of time FI_SAMP_WT printf r if match entries 0 let slinstid O0 mat printf Waiting 2u seconds period pause Speriod Take the second sample before calculating output is preferred because the variance in sample times between instances of the MIB object should be reduced printf Nr printf Taking second Collecting the second sample in its entirety Np sample instenv list wfFddiEntry let i l let match entries 0 if list_0 0 then printf Nf Nr N goto FOOTER AND END A 30 FI SAMP2 IP on error FI SAMP2 Sample Scripts SKP if i gt list_0 then goto FI SAMP PRT if matchcct then goto FI SAMP2 NOW let cctnum wfFddiEntry wfFDDICct list
31. _ 1 gosub GETCCTNAME if ic matchcct rm FI SAMP2 NOW le le se se se se se match entries Scctname then goto FI SAMP2 SKP match entries 1 m match entries env s2instid m env s2rxfrms m env s2txfrms m env s2rxlors m env s2txlors m FI SAMP2 SKP le go i i3 1 to FI SAMP2 LP list i wfFddiEntry wfFDDIFramesRxOk list_ i wfFddiEntry wfFDDIFramesTxOk list_ i wfFddiEntry wfFDDIRingOverrunRx list i wfFddiEntry wfFDDITxClipFrames list i Compare the two samples and generate the output FI SAMP PRT Nr S match entries 0 then goto FOOTER AND END s2instid 0 S match entries let table size i printf Nr rf let let i l let j 21 let jlow 1 let matches 0 A 31 Writing Technician Interface Scripts FI SAMP MATCH on error FI NEXT TRY if slinstid i s2instid j then goto FI NEXT TRY if j jlow then if jlow lt s2instid 0 then let jlow jlow 1 let delta rxfrms s2rxfrms_ 3 slrxfrms_ i if delta_rxfrms lt 0 then goto FI NEXT TRY let delta txfrms s2txfrms_ j sltxfrms_ i if delta txfrms lt 0 then goto FI NEXT TRY let delta rxlors s2rxlors j S slrxlors_ i if delta_rxlors 0
32. a Prec a CER EC DR ds 1 11 Writing Messages to the Console ssssssssseeeeeeeeeeen nennen nnns 1 12 Saving Console Messages to a File sssssssssseeeeeneeeeeen nns 1 12 Performing Error Recovery aac teh he eate e ded 1 12 Inserting Comments thee oe iere s tede n a eee a at a eu na eias 1 13 Debugging a Script Elle a dee esee de dk decre 1 13 Saving and Restoring Variables sess 1 13 Running a Script A 1 14 Creating Merius coded ette tee dence ien e Lee gate dette 1 14 Chapter 2 Command Reference clcv pu 2 3 elTc 2 3 ceo Et 2 6 enumoefv ida ELEC Boe tes 2 7 dore p EET 2 8 einge E 2 9 QOSUD E 2 10 gOlO rial Sa Cadden e Ada aacra DERE Nae o ARR SHE SE CREAR RR DERE ME ea RR Qd 2 11 IT aede A me Ht tav A n E Cea t d e ave 2 12 ISTO MV treaties e e Re etie tdt etu be td a tke os 2 16 2 EE TER DTE CERE EDEN ODDO ID 2 18 ng 2 24 eig n 2 27 ON Tyro diarii EI 2 29 PASO iria A A A A AA 2 30 o IEEE 2 31 Kio c 2 34 Kl ne pL E ERE 2 36 meg PR ELI A Abele ea teh 2 37 CNRC 2 39 SelallVa a a 2 40 SUECO CNV e PS 2 41 ON 2 42 Li setenv A OA 2 43 vi MINORI UTERE OE ET RT SOR TEES 2 45 Appendix A Sample Scripts Menu SGripL iie tine ati tape de bee ancien A 1 FDDIMNUJ Script ctr ceo eme ter pe a A ne aie Pea Aus ripe A 2 EDDI BAT Script icit eot aida A 3 Index
33. a given interval use the pause command During this time the router is still running To call a subroutine inside the same script file use the gosub command It must be the last command on a line You can nest subroutines up to 10 deep You use the return command in a subroutine to return to the calling routine When the return command executes the script interpreter begins executing the instructions on the line following the line containing the gosub command Writing Technician Interface Scripts Writing Messages to the Console The Technician Interface provides two commands to display messages on the console For details on each of the following commands see Chapter 2 e To display command line arguments to the user s terminal use the echo command e To convert format and print input arguments on the Technician Interface s console use the printf command Saving Console Messages to a File To save to a file all messages that are written to the console terminal use the record command The record file must be opened before recording and the file must be closed when recording is completed The file will be lost if it is not closed before the file system is unmounted or the router is reset For specific instructions on using the record command see Chapter 2 Performing Error Recovery To specify an error handler label within a script file use the on error command If a command returns an error or if you attempt to abort
34. able 3 set wfFddiEntry wfFDDIEnable 3 2 echo FDDI commit goto FI END FI DSBLIE echo FDDI connector 3 not found goto FIDS_MSG1_H gosub goto FIDS_MSG2_H gosub goto FIDS_MSG3_H gosub goto P FI END i iE ERR_MSG1 FI HELP DSBL el E ERR MSG2 FI HELP DSBL a Ps ERR_MSG3 FI_HELP_DSBL connector 3 disabled goto FIDS_MSG2_HELP FIDS_MSG3_HELP El 0 then goto FI DSBLIE A 38 Sample Scripts Heat aE aE aE aE aE aE TE aE HH aE a a a aaa HEE a a E HEE AA AA Version command Heat aE aE aE aE aE aE a aE aE HE aE HE aE HE aE A E AE HE aE aE HE HE aE AE a a a HE aE HEHE aE a aH EE E EE HEHE aE a a a EE FI VER echo fddi bat Version 1 11 Date 10 31 94 goto FI END Circuit Name fetching Gosub GETCCTNAME if wfCircuitNameEntry wfCircuitName cctnum 0 then setenv cctname return setenv cctname wfCircuitNameEntry wfCircuitName cctnum return f Branch point to print footer of table then fall through to end of script FOOTER_AND_END echo let tbl entries i 1 if matchcct then goto FAE SKIP if match entries 1 then printf Found 5d match out of match entries goto FAE SKIP printf Found 5d matches out of S match entries
35. able whose value is a valid label in the script file This allows for dynamic branching within the script file setenv vector LABEL 2 goto Svector echo This line is skipped LABEL_2 Writing Technician Interface Scripts if The if command allows you to evaluate whether an expression is true The expression can be a comparison of two numerical values or two ASCII strings If the expression is true the script interpreter executes any additional commands that are on the same command line as the if command If the expression is false the script interpreter does not execute the if command You use a semicolon to end an if command The semicolon separates the if command from the additional commands you want executed if the if command is true The syntax for the if command is shown below if lt option gt string1 lt operand gt lt string2 gt then command command xil option is one of the following arguments u tests whether string is an unsigned number num tests whether lt string1 gt is a number ip tests whether string is an IP address ipx tests whether string is an IPX address ic means ignore case when comparing strings file tests whether filename is present dir tests whether directory name is present vines tests whether string1 is a VINES address date tests whether string uses the date format MM DD YY time tests whether string
36. all CompuServe at 1 800 524 3388 and ask for Representative No 591 e Inthe United Kingdom call Freephone 0800 289378 In Germany call 0130 37 32 In Europe except for the United Kingdom and Germany call 44 272 760681 e Outside the U S Canada and Europe call 614 529 1349 and ask for Representative No 591 or consult your listings for an office near you Once you are online you can reach our forum by typing the command GO BAYNETWORKS at any prompt xiii Writing Technician Interface Scripts InfoFACTS InfoFACTS is the Bay Networks free 24 hour fax on demand service This automated system contains libraries of technical and product documents designed to help you manage and troubleshoot your Bay Networks products The system can return a fax copy to the caller or to a third party within minutes of being accessed World Wide Web The World Wide Web WWW is a global information system for file distribution and online document viewing via the Internet You need a direct connection to the Internet and a Web Browser such as Mosaic or Netscape Bay Networks maintains a WWW Home Page that you can access at http www baynetworks com One of the menu items on the Home Page is the Customer Support Web Server which offers technical documents software agents and an E mail capability for communicating with our technical support engineers How to Get Help For additional information or advice contact the Bay
37. alue SHwFilter if Smode 1 then printf 8s Enabled if mode 2 then printf 8s Disabled echo cutenv c9 15 name2 Scctname if name2 0 1 then printf 4s 4s 7 7s n name2 1 return RARA RR AH td Statistics screen PARE HE RE AE AE EE HET FE E AE RE HE RE EER EE RE EEE EEE ER FE FE FE EFE H FI_STATS check for circuit name to match on if 2 then goto FI STAT NM setenv cmd 3 let len strlen cmd 1f len lt 3 then goto FI_HELP_SHOW let j strindex circuit cmd if j 1 then goto FI HELP SHOW if Sf 4 then goto FI HELP SHOW setenv matchcct 4 A 12 Sample Scripts FI STAT NM setenv nextflag setenv pattern setenv nextid Net wr array attr wfFDDICct wfFDDICrcErrRx wfFDDIOverrunRx array a attr wfFDDIInvalidFrameStatusRx wfFDDIMacErrRx array a attr wfFDDIRxOversizedFrames wfFDDIAbortTx wfFDDIUnderrunTx array a attr wfFDDIParityErrRx wfFDDIParityErrTx wfFDDIRingErrRx array a attr wfFDDIRingErrTx wfFDDISmtRingErrRx wfFDDIPortOpErr array a attr wfFDDIInternOpErr wfFDDIHostErr array a attr wfFDDISlot wfFDDINode wfFDDIOctetsRxOk wfFDDIFramesRxOk array a attr wfFDDIOctetsTxOk wfFDDIFramesTxOk enum 1 Cct CrcErrRx OverrunRx i enum i InvalidFrame MacErrRx i enum i RxOversized AbortTx UnderrunTx i enum i ParityErrRx ParityErrTx RingErrRx i enum
38. and 1 11 2 10 goto command 1 11 2 11 if command 1 11 2 12 to 2 15 instenv command 1 9 2 16 L let command 1 10 2 18 to 2 23 local variables 1 4 menus 1 14 messages saving to a file 1 12 2 34 writing to the console 1 12 2 6 MIB accessing information about 1 6 formatting entries 1 7 2 27 retrieving attributes from 2 24 variable types 1 6 mibget command 2 24 to 2 26 moving variables 2 8 O octet string data 1 7 2 27 octetfmt command 1 7 2 27 on error command 1 12 2 29 opaque string data 1 7 2 27 P pause command 1 11 2 30 polling console for input 1 5 printf command 1 12 2 31 to 2 33 prompting user for input 1 5 pseudo variable arrays defining 1 8 2 16 description of 1 8 writing arguments to 2 3 writing text to 2 4 PWD global variable 1 11 R record command 1 12 2 34 recording console messages 1 12 2 34 return command 1 11 2 36 run command 1 14 2 37 S save env command 2 39 saving console messages 1 12 2 34 script files creating 1 1 to 1 13 debugging 1 13 2 45 examples of A 1 to A 68 loading variables from 2 41 running 1 14 2 37 saving variables to 1 13 2 39 transferring to router 1 1 setenv command 1 9 2 40 setting timeout values 1 5 setting variables 1 9 2 3 2 4 2 7 2 16 2 18 2 40 2 42 source env command 1 13 2 41 sprintf command 1 10 2 42 suspending Technician Interface operation 2 30 system variab
39. are the rights of the United States Government regarding its use reproduction and disclosure are as set forth in the Commercial Computer Software Restricted Rights clause at FAR 52 227 19 Trademarks of Bay Networks Inc ACE AEN BCN BLN BN CN FRE LN Optivity SynOptics SynOptics Communications Wellfleet and the Wellfleet logo are registered trademarks and AN ANH ASN BaySIS BayStack BCNX BLNX BNX EZ Internetwork EZ LAN EN PathMan PhonePlus PPX Quick2Config RouterMan SPEX Bay Networks Bay Networks Press the Bay Networks logo and the SynOptics logo are trademarks of Bay Networks Inc Third Party Trademarks All other trademarks and registered trademarks are the property of their respective owners Statement of Conditions In the interest of improving internal design operational function and or reliability Bay Networks Inc reserves the right to make changes to the products described in this document without notice Bay Networks Inc does not assume any liability that may occur due to the use or application of the product s or circuit layout s described herein Portions of the code in this software product are Copyright O 1988 Regents of the University of California All rights reserved Redistribution and use in source and binary forms of such portions are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation advertising materials
40. by the user For instructions on using the setenv command and the echo command see Chapter 2 Polling the Console for Input You can specify how much time a user has to respond to a prompt that is to press Return before the system times out If you do not specify a timeout value the system prompts the user for input until the user responds To specify a timeout value enter the following command where lt value_in_seconds gt is the length of time in seconds that the system will wait for a response before timing out let SYS IO TIMEOUT value in seconds The timeout value cannot exceed the timeout specified by one of the following MIB objects wfSerialPort wfSerialPortTimeOut 0 or wfTelnet wfTelnetSerialPortTimeOut 0 For example if you specify a timeout of 600 seconds and the timeout specified by wfSerialPort wfSerialPortTimeOut 0 5 minutes the system uses the timeout value given by wfSerialPort wfSerialPortTimeOut 0 For instructions on using the let command see Chapter 2 Writing Technician Interface Scripts In the following script if the user does not press Return before the time specified for SYS IO TIMEOUT has elapsed nothing entered appears on the user s console let SYS IO TIMEOUT 10 setenv ans Enter your name gt echo Your name is Sans if Sans then N echo nothing entered To change the timeout back to an indefinite waiting period use the following command un
41. cal line when entering the command Example If the command syntax is show at routes nets you enter either show at routes or show at nets but not both Ordering Bay Networks Publications To purchase additional copies of this document or other Bay Networks publications order by part number from Bay Networks Press at the following numbers You may also request a free catalog of Bay Networks Press product publications Phone FAX U S Canada FAX International 1 800 845 9523 1 800 582 8000 1 916 939 1010 XV Writing Technician Interface Scripts Acronyms ANSI ARP ASCII ATM FDDI MAC OSI OSPF RIP SNMP American National Standards Institute Address Resolution Protocol American Standard Code for Information Interchange Asynchronous Transfer Mode Fiber Distributed Data Interface Media Access Control Open Systems Interconnection Open Shortest Path First Routing Information Protocol Simple Network Management Protocol xvi Chapter 1 Creating a Script File The Technician Interface script facility allows you to read and execute Technician Interface commands from a script file You create and edit script files on a remote workstation and transfer the files to the router via TFTP or XMODEM For instructions on using TFTP or XMODEM see Using Technician Interface Software We provide several script programs that let you manage the router using information stored in the Management Informatio
42. can be accessed from other script files You cannot move global variables to the local environment variable table The export command has the following syntax export variable name or export variable name variable name For example setenv A string let B 1 export A B 2 8 getenv Command Reference The getenv command allows you to view the current list of variables stored in the local and global environment variable tables If you access the Technician Interface via Telnet the Technician Interface also displays the variables in the system environment variable table Variables in this table are read only from the Technician Interface If your Telnet client supports the environment variable option you can use Telnet to send your UNIX environment variables to the Technician Interface s system list See your Telnet client documentation for instructions The getenv command has the following syntax getenv variable name variable name is the name of the variable whose value you want to display To display the current list of variables in all tables enter the getenv command with no arguments Note f two variables one in the system table and one in the local table have the same name the one in the local table is displayed 2 9 Writing Technician Interface Scripts gosub The gosub command calls a subroutine inside the same script file It must be the last command on a line A subroutine be
43. diPortEntry wfFddiPor let port wfEddiPortEntr if port 1 then printf if port 2 then printf if port 3 then printf if port 4 then printf if Sport 5 then printf let port wfFddiPortEntr if Sport 1 then printf if Sport 2 then printf if port 3 then printf if port 4 then printf if port 5 then printf let port wfEddiPortEntr if Sport 1 then printf if Sport 2 then printf if Sport 3 then printf if Sport 4 then printf if Sport 5 then printf if Sport 6 then printf if Sport 7 then printf if Sport 8 then printf if Sport 9 then printf if Sport 10 then printf Sample Scripts FOOTER AND END ortEntry wfFddiPortSlot list_ i tNode list_ i y wfFddiPortPcType list_ i m MAY 5s B m ns 5s M 5s None 4 2 oe oe E oe oe al o al o 4 2 4 2 y wfFddiPortPcNeighbor list_ i S 95 NA Np 4 2 o 4 2 oe oe a o o Ko 0 o o 4 2 wg E Ho wr 9s M 9s Unknown 4 2 4 2 y wfFddiPortPomState list_ i Yag A OEE 9s Break 9s Trace 9s Connect 9s Next Signal 9s Join 9s Verify 9s Active 9s Maint o printf 10u S wfFddiPort ExtEntry wfFddiPortLemCts list i printf 10u wfFddiPortExtEntry wfFddiPo
44. e enter record pause on off on disables recording off re enables recording To display the pause state enter record pause To close and save the contents of your designated snapshot file enter record close By checking the global variable RECORD STATE you can determine whether e The router is actively saving messages to your snapshot file RECORD_STATE ON e The router has temporarily stopped saving messages to your snapshot file RECORD_STATE PAUSED e The router has unconditionally stopped saving messages to your snapshot file RECORD STATE OFF 2 35 Writing Technician Interface Scripts return You use the return command in a subroutine to return to the calling routine When the return command executes the script interpreter begins executing the instructions on the line following the line containing the gosub command The return command has the following syntax return The following example shows a script using the gosub and return commands main let arg 1 gosub SUBROUTINE echo Return value return goto EXIT SUBROUTINE let return Sarg Sarg Sarg 1 return EXIT 2 36 run Command Reference The run command allows you to read and execute the Technician Interface commands in a Technician Interface script file The run command deletes all local variables when a script ends The run command has the following syntax run s lt vol gt lt file
45. e then goto FI ENBLNXT cc Enable list_ i 1 tname enabled A 34 ET Sample Scripts _ENBLI if Sf 3 then goto FI HELP ENBL Sanity check lt slot connector gt parameter if ver lt x7 80 then goto SKIP_STRPBRKL setenv teststr ABCDEFGHIJKLMNOPORSTUVWXYZ let invalch strpbrk 3 Steststr if Sinvalch 0 then goto FIEN MSGl1 HELP M setenv teststr abcdefghijklmnopqrstuvwxyz let invalch strpbrk 3 Steststr if Sinvalch 0 then goto FIEN MSGl HELP setenv teststr Q4 amp tN 7 72 let invalch strpbrk 3 Steststr if Sinvalch 0 then goto FIEN MSG1 HELP SKIP_STRPBRK1 let firstdot strindex 3 if Sfirstdot 0 then goto FIEN MSG2 HELP let lastdot strrindex 3 if firstdot Slastdot then goto FIEN MSG3 HELP I if wfFddiEntry wfFDDIEnable 3 0 then goto FI ENBLIE set wfFddiEntry wfFDDIEnable 3 1 echo FDDI connector 3 enabled commit goto FI END SEI SEI ZELI SELI ENBLIE echo FDDI connector 3 not found goto FI END i EN_MSG1_HELP gosub ERR_MSG1 goto FI_HELP_ENBL Tj FU EN MSG2 HI gosub ERR MSG2 goto FI HELP ENBL EN MSG3 HELP g
46. e using the verbose command e Saving or restoring variables to or from a file using the save env and source env commands e Running a script file with command line arguments using the run command e Documenting a script file with command lines About Variables A variable is a location in the computer s memory for storing a value A variable name identifies the location Variable names can consist of up to 15 alphanumeric characters and the underscore character _ The first character of a variable name must be an alphabetical character The Technician Interface stores the value of a variable as a string of ASCII characters The maximum string length is 255 characters You can assign a value to a variable using one of the set variable commands arrayenv cutenv enumenv instenv let setenv mibget or sprintf For instructions on using these commands see Chapter 2 After you have assigned a value to a variable you can refer to the variable on a command line within the script file by entering a dollar sign before the variable name for example a When you refer to a variable the Technician Interface substitutes the value set for the variable itself If you want to prevent or delay the substitution of the variable enter the backslash character 1 before the The backslash character also called the escape character indicates that special characters follow In the following script the value of a is substituted for a whe
47. e Technician Interface provides several ways to set variables depending on what you want to accomplish in your script This section lists the ways you can set variables For details on each of the following commands see Chapter 2 e To assign an ASCII string or numeric value to a variable in the local environment variable table use the setenv command When you assign a value to a variable you do not type the before the variable If the value contains spaces or tabs place double quotes around the value string In the following command you assign the value Statistics Menu to the variable a setenv a Statistics Menu e To define a pseudo variable array that contains the list of MIB instance IDs for a given MIB object name use the instenv command The instenv command builds a pseudo variable array by appending an index number to the variable name specified on the command line Each member of the pseudo variable array contains a single instance ID The size of the pseudo array is stored at index 0 Note We recommend that you use the mibget command instead of the instenv command The mibget command accesses MIB tables approximately 50 faster than the instenv command e To select parts of a text string and write them to a pseudo variable array use the cutenv command Writing Technician Interface Scripts e To convert and format text and save the result in a specified variable for later use use the sprintf command
48. e array Do not type before this variable name since the input is passed by reference not by value 2 24 Command Reference next instance variable is the name of the variable that stores the instance ID of the record currently read If the routine reaches the end of the table it sets this variable to the string END In this case the mibget command has not read any record information Do not type before this variable name since the input is passed by reference not by value The following example searches through the IP routing table to retrieve a series of attributes and prints the result on the Technician Interface console The object from which to retrieve information is wflpForwardEntry The script uses the arrayenv command to create the attribute array variable attr that lists the attributes from which to retrieve values Then it uses the enumenv command to establish meaningful names for the indices for attr The script reads the first record with the nextflag turned off In the loop CIP RT LOOP nextid is the instance id option value is the name of the value array where the script places the values it retrieves nextflag is set to n to read through the records The script prints the values as it retrieves them and loops again until it has retrieved the desired attributes from the entire set of records The following examples show how to retrieve attribute values from the IP routing table using the mibge
49. e function returns the number of seconds for that time zone from the International Date Line You enter the time zone string relative to GMT which is 43200 seconds offset from the International Date Line The string must begin with either a plus or a minus sign followed immediately by HH MM HH must be a value between 0 and 11 inclusive and MM must be a value between 0 and 59 inclusive Note n the previous examples the date variables MM DD and YY represent the numeric values of month day and year respectively The time variables HH MM and SS represent the numeric values of hours minutes and seconds respectively Example The following example shows how to use the date time and days flags and the date time and timezone functions of the let command 2 21 Writing Technician Interface Scripts let date time localtime date time echo localtime 10 11 95 15 24 05 let date time london date 10 7 95 time 7 04 timezone echo london 10 07 95 12 04 00 o timezone 00 00 let dat time newyork date 10 7 95 time 7 04 N timezone let dat time la date 10 7 95 time 7 04 timezone 05 00 timezone echo S Stime_left 74 days 08 34 58 timezone 08 00 let days time time left date 12 25 date time 2 22 Command Reference Example The following example s
50. e the use of the square brackets within the variable name Any literal text or variable name specified within the square brackets is expanded first to replace any variables with their values and then concatenated onto the preceding characters of the variable name To use square brackets you must enclose the entire variable name being built in brackets Writing Technician Interface Scripts Local Global and System Variables When you first define a variable the computer stores it in the local environment variable table Local variables are only accessible from within the script in which they were created You cannot access them from another script file When a script routine ends any local variables that you defined are automatically deleted Global variables are stored in the global environment variable table and may be accessed by any script file You create global variables by using the export command to change a local variable to a global variable For more information about the export command see Chapter 2 Global variables are not automatically deleted when a script file ends System variables which are read only are created only during a Telnet session You cannot have the same variable name in the local and the global variable tables You can delete local and global variables by using the unsetenv command You can also change the value of a global variable by using any of the set variable commands arrayenv cutenv
51. en 3 then goto FI HELP SHOW let i strindex base cmd if i 1 then goto FI BASE let i strindex alerts cmd if i 1 then goto FI ALERTS let i strindex disabled cmd if i 1 then goto FI DSBLED let i strindex enabled cmd if i 1 then goto FI ENBLED Mw let i strindex stats cmd if i 1 then goto FI STATS let i strindex receive cmd if i 1 then goto FI RCV let i strindex transmit cmd if i 1 then goto FI XMIT let i strindex system cmd if i 1 then goto FI SYSTEM let i strindex smt cmd if i 1 then goto FI SMT let i strindex mac cmd if i 1 then goto FI MAC let i strindex port cmd if i 1 then goto FI PORT let i strindex sample cmd if i 1 then goto FI SAMP A 5 Writing Technician Interface Scripts let i strindex hwfilters cmd if i 1 then goto FI HWF let i strindex version cmd if i 1 then goto FI VER FI HELP SHOW echo FDDI Show Command Help C ho M m echo echo show fddi lt option gt echo Where option is one of the following echo echo alerts echo base circuit circuit name echo disabled echo enabled echo hwfilters echo mac circuit circuit name echo port echo receive errors circuit
52. gins and ends with a colon You can nest subroutines up to 10 deep You use the return command in a subroutine to return to the calling routine When the return command executes the script interpreter begins executing the instructions on the line following the line containing the gosub command The gosub command has the following syntax gosub subroutine name subroutine name is the name of the subroutine The following example shows a script using the gosub and return commands main let arg 1 gosub SUBROUTINE echo Return value return goto EXIT SUBROUTINE let return Sarg Sarg Sarg 1 return EXITO 2 10 goto Command Reference The goto command lets you specify the next line to be executed from the script file Within the script file the goto command is used with a label A label begins and ends with a colon consists of up to 15 alphanumeric characters and the underscore character _ and must be on its own line beginning in column 1 The goto command has the following syntax goto abel name label name is the name of the label In the following script you instruct the script file to go to the LABEL label Note The following examples only work from a script file the examples will not work from an interactive Technician Interface console goto LABEL echo This line is not executed LABEL The argument to the goto command can be a vari
53. gt 72 let invalch strpbrk 3 teststr if Sinvalch 0 then goto FI SAMP HELP A 28 FI SAMP CKVAL if Speriod lt 0 then PON echo Period of period seconds is too low Sample Scripts goto FI HELP SHOW Check for circuit to match on if 4 lt 3 then goto FI Sampl setenv cmd 4 let len strlen cmd if len lt 3 then goto FI_HELP_SHOW let j strindex circuit cmd if j 1 then goto FI HELP SHOW if Sf 5 then goto FI HELP SHOW setenv matchcct 5 Take the first sample FI_Samp1 echo printf FDDI Sampled Data over 3u seconds n Speriod echo S d echo printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s n BOSSES QNID OMS Rx Tx Rx Lack of Tx Lack of printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s n Slot Conn Circuit Frames Frames Resources N Resources printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s n M m AAJ m AAJ m M m M m M m N printf Taking first sample instenv list wfFddiEntry let i 1 if list_O 0 then printf Nr Nr goto FOOTER AND END A 29 Writing Technician Interface Scripts FI_SAMP1_LP on error FI_SAMP1_SKE if i gt list 0 then if matchcct t D goto FI SAMP WT hen goto FI SAMP1 NOW let cctnum wfFddiEntry wfFDDICct list
54. h entries 1 gosub FI ONELINE Sample Scripts Do next circuit FI_SKIPA let i i 1 goto FI_ALOOP Heat aE aE aE aE aE aE aE aE aE HE aE HE aE HE aE TE E AE HE aE aE HE HE E AE a a a EH aE aE a a a aa HEE a a a E EE HEE a E E E EEEE Show Disabled screen Heat aE aE aE aE aE aE a aE aE HE aE HE aE HE aE AE a a HEHEHE E a a a a aE HE HE aE a a Ha HE a a E EEE a FI_DSBLED setenv matchcct w XXX setenv nextflag setenv pattern setenv nextid Moo wr array attr wfFDDICct wfFDDIState wfFDDIEnable wfFDDISlot array a attr wfFDDINode wfFDDIMadr MAC ADDRESS wfFDDIBofl array a attr wfFDDIBoflTmo wfFDDIMtu wfFDDIHardwareFilter enum 1 Cct State Enable Slot i enum i Node Madr Bofl i enum i BoflTmo Mtu HwFilter echo echo FDDI Modules Disabled cho M n gosub FI BASEHDR let i 0 FI DLOOP mibget n wfFddiEntry attr nextid value nextid if Snextid END then let i i 1 goto FOOTER AND END let cctnum value Cct gosub GETCCTNAI T if value Enable 2 then let match entries match entries 1 gosub FI ONELINE let i i 1 goto FI_DLOOP A 9 Writing Technician Interface Scripts HEE aR RE EEE EH EE EE AEE EE REE AE EE EEE RARA GE E Show Enabled screen HEE ER HE EEE EH EE HE EE EH RE HE AE EEE EE RE EAE RAE EERE FI_ENB
55. hows how to use the let command to set up a slotmask let slot lt Enter Slot Number let H slotmask 0x80000000 gt gt Sslot 1 echo slot slot slotmask Sslotmask Examples Additional examples using the let command are shown below let b 5 10 2 let capA A set env letter A capA Sletter len strlen abcdef let setenv string answer 1 len strlen string index strindex string wer index strpbrk string if Sindex 0 then echo Missing Delimiter let index strmatch string pat if Sindex 0 then echo No match found 2 23 Writing Technician Interface Scripts mibget The mibget command lets you search a MIB object table one record at a time and retrieve a set of attributes from each record For example you can use this command in a script to retrieve information from a routing table and print the information immediately on the console When you are searching a larger MIB table this method is faster and more efficient than using the instenv command The mibget command has the following syntax mibget n p lt pattern gt lt object gt attribute variable array instance id value variable array next instance variable n retrieves the information from the next record in the MIB table You can use it in a loop to read the next instance following the identity of the instance instance id just read For exam
56. i RingErrTx SmtRingErrRx PortOpErr i enum i InternOpErr HostErr i enum i Slot Node OctetsRxOk FramesRxOk i enum Si OctetsTxOk FramesTxOk echo echo FDDI Module I O Statistics cho M m echo printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s 10 10sWn w Receive Receive Transmit Transmit Total printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s 10 10s n Slot Conn Circuit Bytes Frames Bytes Frames Errors printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s S 1 0 SX 0 S Mn uw m M m M n M m N M ow now now let i 0 Writing Technician Interface Scripts ET STLOOP mibget n wfFddiEntry attr nextid value nextid if Snextid END then let i i 1 goto FOOTER AND END let i i 1 let cctnum value Cct gosub GETCCTNAME if matchcct then goto FI PRNTS if ic Smatchcct Scctname then goto FI STAT NXT let match entries match entries 1 Sum up total errors for display FI_PRNTS let tlerrs value CrcErrRx value OverrunRx S value SInvalidFrame value MacErrRx gosub MAC_EXTRACT let tlerrs tlerrs Smac_sum let
57. iables stored in the local and global environment variable tables gosub Calls a subroutine inside the same script file goto Specifies the next line to be executed from the script file if Evaluates whether an expression is true instenv Defines a pseudo variable array that contains the list of MIB instance IDs for a given MIB object name let Evaluates a simple arithmetical or logical expression and assigns the result to a given variable mibget Searches a MIB object table one record at a time and retrieves a set of attributes from each record octetfmt Formats a MIB entry with an Octet or Opaque data type on error Specifies an error handler label within a script file continued 2 1 Writing Technician Interface Scripts Table 2 4 Script Commands continued Command Function pause Suspends the Technician Interface s operation for a given interval printf Converts formats and prints the input arguments on the Technician Interface s console record Saves to a file all messages written to the console terminal return Returns control to the calling routine run Reads and executes the Technician Interface commands in a script file deletes local variables when the script ends save env Saves the current list of local and global variables to a script file setenv Assigns an ASCII string value or a numeric value to a variable in a local environment variable table Source env Reads and executes
58. les 1 4 Index 2 T X TFTP 1 1 XMODEM 1 1 timeout values setting 1 5 transferring script files 1 1 true variable array 1 8 U unsetenv command 1 10 2 43 V variable array 1 8 variables assigning a sequence of values to 2 7 assigning a value to 2 40 assigning value of MIB attribute to 1 6 deleting 1 10 2 43 global 1 4 local 1 4 moving between tables 2 8 overview of 1 2 preventing expansion of 1 3 referencing 1 2 restoring 1 13 saving 1 13 setting 1 9 2 3 2 4 2 7 2 16 2 18 2 40 2 42 special input parameters 1 4 input prompt 1 5 system 1 4 viewing 1 8 2 9 verbose command 1 13 2 45 W writing messages to the console 1 12 2 6 Index 3
59. lowing script tests whether variable a has been defined setenv a 5 c a 1 then echo Defined To test whether a file is present use the if command with the following syntax 2 14 Command Reference if file lt filename gt 1 For example the following script tests whether the install bat file is present if file install bat 1 then echo File present To test whether a directory is present use the if command with the following syntax if dir directory name z1 For example the following script tests whether volume 2 is present if dir 2 1 then echo Volume 2 present 2 15 Writing Technician Interface Scripts instenv The instenv command allows you to define a pseudo variable array that contains the list of MIB instance IDs for a given MIB object name The instenv command builds a pseudo variable array by appending an index number to the variable name specified on the command line Each member of the pseudo variable array contains a single instance ID The size of the pseudo array is stored at index 0 The instenv command has the following syntax instenv array name lt object gt array name is the name you assign the pseudo variable array object is the name of the MIB object table from which to retrieve the information Note We recommend that you use the new mibget command instead of the instenv command The mibget command accesses MIB tables approximately 50 percen
60. n printf 8s C Wrap B 13 then printf 8s Unknown w fFddiEntry wfFDDISmtTNotify list i cutenv c9 15 name2 if S name2 0 1 then print FI SMT NXT let i goto Si E FI SMI I LP cctname BOX 4s 4s 8 7 7s n name2 1 A 23 Writing Technician Interface Scripts Heat aE aE aE aE aE aE a aE aE HE aE aE aE HE aE a E AE FE AE HE HE HE HE AE a a a HE aE HE aE a a aE a a E EE a a E E A EEEE MAC screen Heat aE aE aE aE aE aE aE aE aE HE aE HE aE HE HE A AE AE FE aE HE HE HE aE a a a a aE HEHE aE a Ea HEE a a a E aE HEE a a a EE FI MAC let i 1 check for circuit name to match on if 2 then goto FI MAC NM setenv cmd 3 let len strlen cmd 1f len lt 3 then goto FI_HELP_SHOW let j strindex circuit cmd if j 1 then goto FI HELP SHOW if Sf 4 then goto FI HELP SHOW setenv matchcct 4 FI MAC NM echo echo FDDI Modules MAC Parameters cho echo printf 4 4s 4 4s 8 8s 17 17s 17 17s 4 4s 9 9s ELO LOSA nr owe WS WOW Upstream Downstream TNeg N Ring Mgmt Ring Op printf 4 4s 4 4s 8 8s 17 17s 17 17s 4 4s 9 9s 10 10s n Slot Conn Circuit Neighbor N Neighbor ms State Count printf 4 4s 4 4s 8 8s 17 17s 17 17s 4 4s 9 9s 10 10s n pn EN MES ON M now no
61. n Base MIB You can use the scripts to display information about protocols and network services and to enable and disable protocols circuits lines and services You may also choose to write your own scripts using this manual as a guide Technician Interface scripts are very similar to UNIX shell scripts This chapter describes how to perform the following tasks using the Technician Interface script commands e Prompting the user for input using the special variable lt prompt gt e Referencing and using MIB information using the special variable lt object attribute instance gt the mibget and instenv commands and formatting MIB entries using the octetfmt command e Creating using and deleting variables using the arrayenv cutenv enumenv getenv instenv let setenv sprintf and unsetenv commands e Changing a local variable into a global variable using the export command Evaluating an arithmetic or logical expression using the let command e Parsing a text string using the cutenv command e Controlling the execution of the script using the if goto pause gosub and return commands Writing Technician Interface Scripts Writing messages to the console using the echo and the printf commands e Recording console messages to a file using the record command e Handling and recovering from errors using the on error command e Inserting comments into a script file using the pound sign Debugging a script fil
62. n b is executed setenv a blue setenv b My color is Sa echo Sb My color is blue appears on the user s console Creating a Script File To prevent a variable from being expanded enter two dollar signs before the variable name as shown in the following example setenv a blue setenv b My color is a echo b My color is a appears on the user s console You may embed variables in quoted strings as shown in the previous example The following command line encloses the variable names a and b in curly brackets to separate the variable names from other data within the string echo The sum of S a 1 S b Note f the variable name is followed by a space or an end of line character carriage return the brackets are optional A variable name is usually a literal string of characters preceded by a dollar sign The variable name can also be built dynamically when the script is executed by using a combination of literal text and the text stored in other variables For example if you have a variable named array 10 you can reference this variable by entering array_10 on a command line You can build this same variable name by concatenating the text strings array_ and 10 For example if you assign the variable index the value 10 using the command let index 10 then you can build the variable name array 70 dynamically on the command line using the following syntax array_ index Notic
63. name gt lt p1 gt p2 lt p9 gt S prevents the system from returning an error message if the run command cannot locate the specified script file vol is the volume number of the script you want to execute filename is the name of the script file you want to execute lt p1 gt lt p2 gt p3 p4 lt p5 gt p6 p7 p8 lt p9 gt are optional input parameters to the script file They may be referred to within the script file as follows lt p1 gt gt 1 lt p2 gt gt 2 lt p3 gt gt 3 lt p4 gt gt 4 lt p5 gt gt 5 lt p6 gt gt 6 lt p7 gt gt 7 lt p8 gt gt 8 lt p9 gt gt 9 To locate script errors use the verbose on command and then use the run command The Technician Interface displays each line from the file before it executes the line enabling you to locate errors easily 2 37 Writing Technician Interface Scripts Note The run command automatically appends the bat suffix to the end of the script filename you specify If you issue the command run install the system first looks for a file named install If it cannot find this file it looks for a file named install bat The special variable contains the number of parameters entered on the command line following the script filename It is set to zero if no parameters are entered 2 38 save env Command Reference The save env command allows you to save the current list of l
64. nctions e strlen e strindex e Sstrrindex e strpbrk e strmatch e single character The arguments for each function can be a literal character string a set of characters enclosed in double quotes or the name of an environment variable When you specify an environment variable do not precede the name with If a function returns an offset within a string an index of 1 refers to the first character position The function strlen returns the number of characters in the parameter lt string gt strlen lt string gt The function strindex finds the first occurrence of a string in another string The function strrindex finds the last occurrence of a string in another string Both functions return the offset within string of lt substring gt s position or O if substring is not found strindex string substring strrindex string substring The function strpbrk searches string for the first character that matches any of the characters given in the character string set The function returns the offset to the first matching character s position in lt string gt or O if no character of set appears in string strpbrk string lt set gt The function strmatch lt string gt lt pattern gt compares string to pattern If lt string gt matches the pattern the function returns a 1 otherwise it returns a 0 You may use wildcards
65. ned octal notation no leading zero e xor X indicates unsigned hexadecimal notation no Ox prefix e ul indicates unsigned decimal e Cindicates a single unsigned character e Sindicates a character string e A percent sign means to print a 96 If you enter the printf command incorrectly the console returns one of the following error messages printf Expected numeric argument invalid string argument found The lt conversion_specification gt expected numeric data in the input argument which contained a text string hello there instead of a number 123 printf Format string has more format codes than there are arguments The format string has more conversion specifications than there are input arguments lt p1 gt pN e printf Invalid format code You entered an invalid conversion specification in the format string 96z Example The following example shows a sample printf command let slot 2 printf Slot 5din slot 2 33 Writing Technician Interface Scripts record The record command saves to an open file all messages written to the console terminal Use this command when you need to capture a snapshot of Technician Interface output for analysis by Bay Networks Technical Response Center personnel You must open a snapshot file before attempting to capture any Technician Interface output to that file You must close the file e After capturing the desired outp
66. o MENU if Sans 1 then date echo N goto MENU if Sans 2 then let vol wfTftp wfTftpDefaultVolume 0 echo Tftp Default Volume vol N goto MENU if Sans 3 then let vol lt Enter new TFTP Default Value 4 gt A 1 Writing Technician Interface Scripts set wfTf go Eb if Sans echo Y goto echo pause goto EXIT M 2 tp wfTftpDefaultVolume 0 vol ENU 4 then JENU Exiting EXIT Bad choice try again SYN If you place a label at the end of the script file you can terminate the script file at any time by executing a goto EXIT command FDDI MNU Script The following example shows a menu script for a Bay Networks router WSCCS j scripts fddi mnu 1 1 4 8 95 Heat aE aE aE aE aE aE aE aE aE HE AHH AAA Copyright 1995 Bay Networks Inc Heat aE aE aE aE aE aE aE aE aE HE aE HE aE HE aE A E AE FE EE HEHE aE a a a aE HE HE a a a a aH a aa E EEE a a E E EE alias setcmd let cmd 0 M cmd 0 1 setenv cmd_ cmd_0 1 le se se se se se se se se se se se se se se se se t title 0 M title_0 1 setenv title 1 title_0 2 tenv maintitle FDDI Menu tenv cmd O NS tenv title O0 0 tcmd show fddi alerts Alerts tcmd show fddi base Base Info tcmd show fddi disabled Disabled Circuits tcmd show fddi enabled Enabled Circuits
67. ocal and global variables to a script file Use the following syntax to save the variables to a file saveenv filename filename is the name of the file in which you want to store the variables For example the following script saves the current list of variables to the install bat file save env install bat 2 39 Writing Technician Interface Scripts setenv The setenv command allows you to assign an ASCII string value or a numeric value to a variable in the local environment variable table When you assign a value to a variable you do not type the before the variable If the value contains spaces or tabs place double quotes around the value string The setenv command uses the following syntax setenv variable name variable value variable name is the name of the variable variable value is the value assigned to the variable For example the following script assigns the value Good Morning to the variable a setenv a Good Morning 2 40 Command Reference Source env The source env command allows you to read and execute the Technician Interface commands in a Technician Interface script file The source env command saves restores all local variables when a script ends The source env command uses the following syntax to load the variables from a script file source env lt vol gt lt filename gt vol is the volume storing the script file filename is the name
68. of the script file that contains the variables To locate script errors use the verbose on command and then use the source env command The Technician Interface displays each line from the file before it executes the line enabling you to easily locate errors 2 41 Writing Technician Interface Scripts sprintf The sprintf command converts and formats text and saves the result in a specified variable for later use The sprintf command uses the following syntax sprintf variable name format lt p1 gt p2 pN variable name is the name of the environment variable where the formatted string is saved format is the conversion specification See printf for information about conversion specifications p2 pN is the list of arguments to be formatted If you enter the sprintf command incorrectly the console returns one of the following error messages xd sprintf Expected numeric argument invalid string argument found The 9 e conversion specification expected numeric data in the input argument which contained a text string hello there instead of a number 123 sprintf Format string has more format codes than there are arguments The lt format gt string has more conversion specifications than there are input arguments lt p1 gt pN sprintf Invalid format code You entered an invalid conversion specification in the format string 9ez ERRO
69. oftware Directive dated 14 May 1991 as may be amended from time to time shall apply for interoperability purposes Licensee must notify Bay Networks in writing of any such intended examination of the Software and Bay Networks may provide review and assistance Notwithstanding any foregoing terms to the contrary if licensee licenses the Bay Networks product Site Manager licensee may duplicate and install the Site Manager product as specified in the Documentation This right is granted solely as necessary for use of Site Manager on hardware installed with licensee s network This license will automatically terminate upon improper handling of Software such as by disclosure or Bay Networks may terminate this license by written notice to licensee if licensee fails to comply with any of the material provisions of this license and fails to cure such failure within thirty 30 days after the receipt of written notice from Bay Networks Upon termination of this license licensee shall discontinue all use of the Software and return the Software and Documentation including all copies to Bay Networks Licensee s obligations under this license shall survive expiration or termination of this license Bay Networks Inc 4401 Great America Parkway Santa Clara CA 95054 8 Federal Street Billerica MA 01821 Contents About This Guide Software Suites MM xiii Pea UTI xiv Before You Begin rtt Eb bed e etae tre Pee te ied v ener xiv Bay Network
70. ollowing example shows the run command with the s flag run s install bat Note The run command automatically appends the bat suffix to the end of the script filename you specify If you issue the command run install the system first looks for a file named install If it cannot find this file it looks for a file named install bat For more information about the run command see Chapter 2 Creating Menus The menu utility allows you to edit existing script menus and to create your own menus For instructions on using the menu utility refer to Using Technician Interface Scripts You can also edit a script menu by directly editing the appropriate mnu file Appendix A shows examples of a script menu and a script Chapter 2 Command Reference In the following pages you can find the function syntax and examples of all the script commands you need to write edit and execute your script files Table 2 1 lists the script commands and their functions Table 2 1 Script Commands Command Function arrayenv Writes list of command line arguments to a pseudo variable array cutenv Selects part of a text string and writes it to a pseudo variable array echo Displays command line arguments to a user s terminal enumenv Assigns a sequence of values to a list of variables export Moves one or more local variables to the global environment variable table getenv Displays the current list of var
71. ons of this license Licensee shall not make the resulting software available for use by any third party Neither title nor ownership to Software passes to licensee Licensee shall not provide or otherwise make available any Software in whole or in part in any form to any third party Third parties do not include consultants subcontractors or agents of licensee who have licensee s permission to use the Software at licensee s facility and who have agreed in writing to use the Software only in accordance with the restrictions of this license Third party owners from whom Bay Networks has acquired license rights to software that is incorporated into Bay Networks products shall have the right to enforce the provisions of this license against licensee Licensee shall not remove or obscure any copyright patent trademark trade secret or similar intellectual property or restricted rights notice within or affixed to any Software and shall reproduce and affix such notice on any backup copy of Software or copies of software resulting from modification or combination performed by licensee as permitted by this license Bay Networks Inc 4401 Great America Parkway Santa Clara CA 95054 8 Federal Street Billerica MA 01821 Bay Networks Software License continued 10 11 12 Licensee shall not reverse assemble reverse compile or in any way reverse engineer the Software Note For licensees in the European Community the S
72. osub ERR MSG3 goto FI HELP ENBL A 35 Writing Technician Interface Scripts Gosubs shared by enable and disable z re SG1 tenv c Sinvalch ugly 3 ho Inappropriate character ugly 1 in parameter ho only digits and allowed ho turn SG2 ho Parameter must contain a character ho turn MSG3 ho Too many characters in parameter enter one only ho curn FEE TE FEE AE RH RAE HE EE EEE RE EE EEE ERE EAE ARE EERE Parse for disable command HEE AE RE HH EEE HEE HE ERE EE RA HERE GE E EFI TET DSBL if 1 then goto FI HELP DSBL setenv cmd 2 let len strlen cmd if len 3 then goto FI HELP DSBL let i strindex circuit cmd if i 1 then goto FI DSBLC let i strindex connector cmd if i 1 then goto FI DSBLI _ HELP DSBL echo FDDI Disable Command Help cho echo echo disable fddi option echo Where option is one of the following echo RR echo circuit circuit name echo connector lt slot connector gt goto FI END A 36 Disable circuit FI DSBLC if 3 then goto FI HELP DSBL instenv list wfFddiEntry if Slist 0 0 then goto FI DSBLNF setenv matchcct 3 if matchcct then goto FI END let i 1 Search for circuit with matching name FI_DSB
73. ours tz as HH MM Modulo 12 00 The following flags may be used together Flag combinations other than those listed below are invalid date time as MM DD YY HH MM SS days time as DD days HH MM SS The flags must immediately precede the variable name that represents the result as shown in the following example let h a 1 2 In the following script variable name b is assigned the sum of variable name a plus 1 setenv a 1 let b a 1 The let command evaluates an expression from left to right You can use parentheses to change the order of the evaluation 2 18 Command Reference Use the arithmetical and logical operators listed in Table 2 2 and Table 2 3 with the let command Table 2 2 Arithmetical Operators Operation Symbol Addition Subtraction Multiplication Division Exponent Remainder Table 2 3 Logical Operators Operation Symbol Definition 1 s complement S Bit negation operator that provides the bitwise complement of an integer AND amp Arithmetic AND Inclusive OR Arithmetic inclusive OR Exclusive OR i Arithmetic exclusive OR Logical shift left Bit shift to the left far right bit set to zero Logical shift right gt gt Bit shift to the right far left bit set to zero 2 19 Writing Technician Interface Scripts The let command provides the following string fu
74. outing SNMP Agent Bay Networks HDLC PPP OSPF EGP BGP File Based Performance Statistics Frame Relay switching and Frame Relay billing and selected components from the Corporate ARE ATM and ARE VNR Corporate suites Availability of features and functionality described in this guide depends on the suites you are using This manual is for network administrators with the following background Knowledge of the UNIX operating system and the C programming language e A general understanding of local and wide area networking fundamentals e An understanding of the transmission and management protocols used on your network Before You Begin Before using this guide you must load the router software from the release medium This guide assumes that you are familiar with the Technician Interface For information on this interface refer to Using Technician Interface Software Bay Networks Customer Support Bay Networks provides live telephone technical support to our distributors resellers and service contracted customers from two U S and three international support centers If you have purchased your Bay Networks product from a distributor or authorized reseller contact the technical support staff of that distributor or reseller for assistance with installation configuration troubleshooting or integration issues Customers also have the option of purchasing direct support from Bay Networks through a variety of service programs The
75. owing script shows how to access a member of an array using an index setenv al one setenv a2 two setenv a3 three let index 2 echo a Sindex S a Sindex a 2 two is displayed on the user s console For specific instructions on using the commands in the previous example see Chapter 2 Creating and Using Variables This section explains how to view local and global variables how to set variables and how to delete them Viewing Variables You view the current list of variables stored in the local and global environment variable tables using the getenv command For example if you enter getenv a the system responds a blue You can also use the echo lt variable_name gt command to view a variable For specific instructions on using the getenv and echo commands see Chapter 2 1 8 Creating a Script File If you access the Technician Interface via Telnet the Technician Interface also displays the variables in the system environment variable table Variables in this table are read only from the Technician Interface If your Telnet client supports the environment variable option you can use Telnet to send your UNIX environment variables to the Technician Interface s system list See your Telnet client documentation for instructions Note f two variables one in the system table and one in the local or global table have the same name the one in the local or global table is used Setting Variables Th
76. ple the current ID is 192 32 0 1 and the next ID is 192 32 0 2 If you enter the n option with the current ID the mibget command returns information for the instance ID 192 32 0 2 p pattern specifies an instance ID pattern string The script returns only instance IDs that match the pattern For example p 192 32 returns all instances whose address starts with 192 32 such as 192 32 0 0 192 32 1 1 and so on object is the name of the MIB object table from which to retrieve the information for example wfIPForwardEntry lt attribute variable array is an environmental array variable that contains the list of attributes to be retrieved To create this array variable you use the arrayenv command Do not type before this variable name since the input is passed by reference not by value If the attribute is an OCTET string you can use an optional format specifier format for each array entry For information on this format specifier see the octetfmt command If the attribute is not an OCTET string the mibget command ignores the format specifier instance id 1s the first instance to reference in the MIB table You can use the wildcard If you use the n option this option identifies the instance ID most recently retrieved value variable array is the name of an environmental array variable that stores the values retrieved The values are in the same order as listed in the attribute array attribute variabl
77. programs include priority access telephone support on site engineering assistance software subscription hardware replacement and other programs designed to protect your investment Xii About This Guide To purchase any of these support programs including PhonePlus M for 24 hour telephone technical support call 1 800 2LANWAN Outside the U S and Canada call 408 764 1000 You can also receive information on support programs from your local Bay Networks field sales office or purchase Bay Networks support directly from your reseller Bay Networks provides several methods of receiving support and information on a nonpriority basis through the following automated systems CompuServe Bay Networks maintains an active forum on CompuServe All you need to join us online is a computer a modem and a CompuServe account We also recommend using the CompuServe Information Manager software available from CompuServe The Bay Networks forum contains libraries of technical and product documents designed to help you manage and troubleshoot your Bay Networks products Software agents and patches are available and the message boards are monitored by technical staff and can be a source for problem solving and shared experiences Customers and resellers holding Bay Networks service contracts can visit the special libraries to acquire advanced levels of support documentation and software To open an account and receive a local dial up number c
78. ribute one two three amp four five six amp seven arrayenv a attribute Router One echo Size S attribute 0 echo First element attribute 1 echo Last element S attribute S attribute 0 The output from this script is as follows Size 6 First element one Last element Router One The cutenv command allows you to select portions of a text string as specified by lt list gt and write them to a pseudo variable array beginning with the prefix lt variable_name gt The items specified by lt ist gt can represent column position or fields delimited by a special character Column and field numbering start at 1 Writing Technician Interface Scripts The cutenv command has the following syntax cutenv s d lt delimiter gt f list c lt list gt variable name text string S suppresses text string with no delimiter characters d lt delimiter gt sets the field delimiter to lt delimiter gt The default is a tab Characters with a special meaning to the Technician Interface interpreter such as a tab or space character must be set in quotes f list is field position Instead of character positions list specifies fields that are separated by a delimiter for example a tab Separate variables are created for each noncontiguous field of characters selected For example 1 4 7 represent fields 1 4 and 7 c list is character position lt list gt is
79. rks will not grant any Software license whatsoever either explicitly or implicitly except by acceptance of an order for either Software or for a Bay Networks product Equipment that is packaged with Software Each such license is subject to the following restrictions 1 Upon delivery of the Software Bay Networks grants to licensee a personal nontransferable nonexclusive license to use the Software with the Equipment with which or for which it was originally acquired including use at any of licensee s facilities to which the Equipment may be transferred for the useful life of the Equipment unless earlier terminated by default or cancellation Use of the Software shall be limited to such Equipment and to such facility Software which is licensed for use on hardware not offered by Bay Networks is not subject to restricted use on any Equipment however unless otherwise specified on the Documentation each licensed copy of such Software may only be installed on one hardware item at any time Licensee may use the Software with backup Equipment only if the Equipment with which or for which it was acquired is inoperative Licensee may make a single copy of the Software but not firmware for safekeeping archives or backup purposes Licensee may modify Software but not firmware or combine it with other software subject to the provision that those portions of the resulting software which incorporate Software are subject to the restricti
80. rtEbErrorCts list_ i printf 10u wfFddiPortExtEntry wfFddiPortLctFailCts list_ i Next line echo FI_PORT_NXT let i i 1 goto FI PORT LP A 27 Writing Technician Interface Scripts FE TE TE HE E HE FE FE FE TE TE E HE FE FE FE TE TE E HE HE AE FE TE TE E HE HE AE FE TE TE TE HE AE AE TE TE E E EE EE ERE Sample screen samples parameters twice prints deltas FE TE TE AE E HE FE FE FE TE TE E HE FE FE FE TE EH HE FE FE TE TE EE AE FE TE TE TE E EEE EE HEE E E EE E E E E EEEE E E E EEEH FI_SAMP let period 10 if lt 3 then goto FI Sampl check for circuit to match without period given setenv cmd 3 let j strindex circuit cmd if j 1 then goto FI ITSPERIOD let len strlen cmd if Slen lt 3 then goto FI HELP SHOW if 4 then goto FI HELP SHOW setenv matchcct 4 goto FI Sampl FI ITSPERIOD setenv period 3 Check period parameter for invalid characters 0 value if Sver lt x7 80 then goto FI SAMP CKVAL setenv teststr ABCDEFGHIJKLMNOPORSTUVWXYZ let invalch strpbrk 3 Steststr if Sinvalch 0 then goto FI SAI HELP setenv teststr abcdefghijklmnopqrstuvwxyz let invalch strpbrk 3 teststr if Sinvalch 0 then goto FI SAMP HELP setenv teststr Q4 amp tN
81. s no of seconds is the length of the pause in the operation of the Technician Interface The following command suspends operation of the Technician Interface for 10 seconds pause 10 2 30 printf Command Reference The printf command converts formats and prints the input arguments p1 pN on the Technician Interface console under the control of format The printf command has the following syntax printf format p1 p2 lt pN gt format is the string describing what to print lt p1 gt lt p2 gt lt pN gt represent input arguments format contains text to be printed and conversion specifications Everything inside the format string is printed except for the conversion specifications When the printf command locates a conversion specification it formats and prints the value of the next input argument that follows the format string You must have the same number of input arguments as conversion specifications The syntax rules for format are described later in this section The printf command does not automatically output a newline at the end of each line You must explicitly output a newline as part of either the format string or in the argument strings This feature lets you use multiple printf commands to output a single line or you can use a single printf command to output multiple lines The special character n represents a new line Table 2 4 lists the
82. s Customer Support cncccicoccconoccccnncccnononcnnnnc ccoo nn nano cnn nennen nne nnne xiv GCOMpUSerVe p E XV use c E xvi World Wide Web erg t P e o EP agenda see ete deu Re xvi How to Get Help ironi at dt eee to ques e eade e ee Y Rav utt e deae E te xvi CONVENTIONS A exe err a E VR bc a ed ar A se a xvi Ordering Bay Networks Publications sse xvii A pares e tete nde ol s o e e oe RS xviii Chapter 1 Creating a Script File About Variables iii foedo ene Rena Pk Ro dra d a dun ak 1 2 Local Global and System Variables sssssssseseseeneeennnns 1 4 Special Variables ad 1 4 Input Parameters ehe e e deis e oa bene 1 4 Prompting fOr Input oett eu cete etie 1 5 Polling the Console for Input oooconcccnnnccconncccncnonnnonccnononcna nono con nn canon cnn nnne 1 5 Accessing MIB Information esses areenat re e aE EE E RE EEEE EEEN EEEE cnn nnne 1 6 Formatting a MIB Entry serorek kaa E A ENEE AA E EE ERENER 1 7 Defining a Pseudo Variable Array ssssessseeeeneeeeeneeeen nennen 1 8 Creating and Using Variables sse enne nnns 1 8 Viewing Variables oooommccccnnnnncccccnnnnnoncccnnnnnnnncnnnnnn reno nnnnnr EEEE rre 1 8 Setting Variables inn rire ete e sn Rd eru d et c dep teda 1 9 Deleting Variables snie ae a ra ra ANRO A ANE A EENE AAA 1 10 Setting the Current Volume or Directory sss 1 11 Gontrolling ProgramF OW iii rr Rer xta ri ete Pape
83. s that start with Ox The variable value index is the byte offset into the opaque or octet string data An offset of O returns the length of the data in bytes Each byte is accessed one byte at a time using the index number For example to access the value of a byte in an octet string use the following procedure 1 Enter lt object attribute instance 0 gt for example wfHwBase wfHwBpRev 0 0 to get the length of the data in bytes The system returns the number of bytes in the octet string for example 4 2 Enter lt object attribute instance n gt for example wfHwBase wfHwBpRev 0 3 to get the value of the selected byte for example the third byte Formatting a MIB Entry The octetfmt command formats a MIB entry with an Octet or Opaque data type using the specified format type For more information about using the octetfmt command see Chapter 2 Writing Technician Interface Scripts Defining a Pseudo Variable Array The Technician Interface script facility allows you to define a pseudo variable array A true array is a set of consecutive memory locations used to store data Each item in the array is called an element An element is a variable To reference an element of an array you use a number called the index In a pseudo variable array the elements variables are not in consecutive memory locations To create a pseudo array use variable names that end in numbers for example a1 a2 and a3 The foll
84. setenv SYS IO TIMEOUT For more information about using the commands in the preceding examples see Chapter 2 Accessing MIB Information The Technician Interface script facility allows you to assign the value of a MIB attribute to a variable Using the syntax object attribute instance you can refer to the following types of MIB variables e Counter variables which keep track of how many times an event occurs e Display string variables which specify a piece of information stored in ASCII characters and which the system can display for the user to read The string must be shorter than 255 characters Gauge variables which keep track of values that fluctuate nteger variables which specify information in the form of a simple integer 1 6 Creating a Script File The variable values object attribute and instance are defined as follows object is the name or identifier of the object for example wfSnmp attribute is the name or identifier of the attribute for example wfSnmpbDisable instance is the identifier of a nontabular object or the index value of a tabular object for example 1 For more information about object attribute instance see Using Technician Interface Software Using the syntax object attribute instance index you can refer to the following types of data e Opaque string data e Octet string data Opaque and octet string data are hexadecimal number
85. setenv flags S flags bit result FI_NEXT_BIT t bit Sbit 4 if Sbit gt 0 then goto FI_BIT_LP A 22 Sample Scripts Note field size is 32 because flags contains the trailing space printf 32s Sflags let s 1f s if s if s if s if s if s if s 1f s let s 1f s 1f s if s if s if s if s if s if s 1f s if s if s 1f s 1f s Late Gate Lace Lace Cate tate Lace Late Late Cate Gate tate Lacey Cate Gate Lace gt Late Late Late Late Late printf 6d Next line echo wfFddiSmtEntry wfFddiSmtEcmState list_ i 1 then printf 8s ByPassed 2 then printf 8s In 3 then printf 8s Trace 4 then printf 8s Leave 5 then printf 8s Pathtest 6 then printf 8s Insert 7 then printf 8s By Check 8 then printf 8s Deinsert wfFddiSmtEntry wfFddiSmtCfState list_ i 1 then printf 8s Isolated 2 then printf 8s Unknown 3 then printf 8s Wrap A 4 then printf 8s Wrap B 5 then printf 8s Wrap AB 6 then printf 8s Thru 7 then printf 8s Local A 8 then printf 8s Local B 9 then printf 8s Local AB 10 then printf 8s Unknown 11 then printf 8s C Wrap A 12 the
86. t command The comments explain what is happening in the script Purpose Retrieve attribute values from the IP routing table Retrieve values from the following attributes arrayenv attr fIpForwardProto wflpForwardDest wflpForwardNextHop wflpForwardAge wflpForwardMask wflpForwardMetricl wflpForwardNextHopAS Indices for attributes in value array where values are placed enumenv 1 proto dest next age mask metric as Read the first record with nextflag turned off setenv nextflag First instance ID to read wildcard setenv nextid 2 25 Writing Technician Interface Scripts Begin loop to read entire set of records IP RT LOOP mibget nextflag wflpForwardEntry attr nextid value nextid if nextid END then goto IP RT END Set get next record flag setenv nextflag n printf 15s 15s 5d 8d 8d 15s S value S dest S value mask value proto value Sage S value Smetric value next goto IP_RT_LOOP IP RT END 2 26 octetfmt Command Reference The octetfmt command formats a MIB entry with an Octet or Opaque data type using the specified format type The syntax for the octetfmt command is shown below octetfmt variable name format type MIB object variable name is the name of the variable format lype is one of the following values ASCII STRING returns the data as a printable display string Any data
87. t faster than the instenv command The first four lines in the following example show how you list the instance IDs for wflpInterfaceEntry to the console the last nine lines show how you use the instenv command to assign these instance IDs to a pseudo variable array list f wfIpInterfaceEntry inst ids 192 32 23 5 1 192 32 7 8 2 192 32 2213 3 Sinstenv ip wflpInterfaceEntry Secho Size ip 0 Size 3 Secho Vis Sp pt Te 192 92 23 5 1 Secho 2i Sep 1214 2 192 32 7 8 2 Secho S32 Sap 31h 3 192 92 2 9 3 2 16 Command Reference The following example is an excerpt from a script file showing how to use the instenv command instenv ip wfIpInterfaceEntry echo Size of array ip_ 0 let i 1 LOOP if i gt S ip 0 then goto DONE setenv ipstate wflpInterfaceEntry wflpInterfaceState S ip i setenv ipaddr wflpInterfaceEntry wflpInterfaceAddr ip 1i echo i IP Address Sipaddr State S ipstate let i i 1 goto LOOP DONE 2 17 Writing Technician Interface Scripts let The let command allows you to evaluate a simple arithmetical or logical expression and assign the result to a given variable The let command has the following syntax let flag flag formats the result as follows S in signed decimal default u in unsigned decimal h in hexadecimal date as MM DD YY days as DD days time as HH MM SS Modulo 24 h
88. t from either the local or the global table depending on the table in which the variable resides Deletes the variables slot and value from either the local or global table depending on the table in which the variables reside Deletes all variables in both the local and global environment variable tables Deletes all variables in the local environment variable table Deletes all variables in the global environment variable table Deletes all symbols that begin with ip 2 44 verbose Command Reference The verbose command allows you to enable the debug trace facility When you enable the trace facility the Technician Interface displays each command read from the script file before and after its variables have been expanded The verbose command uses the following syntax verbose onloff onloff is on to enable the debug trace facility or off to disable it 2 45 Appendix A Sample Scripts To help you create your own scripts this appendix contains three sample scripts e Menu script FDDlI mnu script FDDlI bat script Menu Script The following example shows a menu script for a Bay Networks router ENU on error MENU echo echo Simple Menu Example echo echo 1 Display Time and Date echo 2 Display TFTP default volume echo 3 Set TFTP default volume echo 4 Quit echo setenv ans Enter selection gt if Sans then got
89. ternOp echo echo FDDI Module System Errors cho a echo A 19 Writing Technician Interface Scripts printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s 10 10s n wi wir wir war wir Mw Port Ww Internal printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s TOS TOS AE MEM Parity d Ring Operation Operation Ww Host printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s 10 10sWMn Slot Conn Circuit Errors Errors oe mown How Errors Errors Errors printf 4 4s 4 4s 8 8s 10 10s 10 10s 10 10s 10 10s 2 10 Os n M m yN m AAJ m i HE N AAJ m M n yN LA M m let i20 FI SyLOOP mibget n wfFddiEntry attr nextid value nextid if nextid END then let i i 1 goto FOOTER AND END let cctnum value Cct gosub GETCCTNAME if matchcct then goto FI PRNTSE if ic matchcct Scctname then goto FI SYS NXT let match entries match entries 1 td FI PRNTSE LH let parity S value SParityErrRx let parity parity value ParityErrTx let ring value RingErrRx let ring ring value RingErrTx let ring ring value SmtRingErrRx printf 4d 4d 8 8s value Slot value Node cctname printf 10u 10u 10u 10u
90. test for valid date time and timezone offset syntax if date 10 10 94 1 then echo Good if time 10 10 44 1 then echo Good oz 5 007 1 then echo Good 2 13 Writing Technician Interface Scripts The backslash character Y allows you to continue a command line on the following physical line When used in this way the backslash is referred to as a line continuation character The line continuation character makes it easier for you to read the script file The maximum command line size is still restricted to 255 characters The following example shows an if command using the backslash character if num 1 then echo The number is 1 We recommend that you indent the additional commands to make the script file easier to read Also if there is a large amount of code following the if command use a goto command to branch around the conditional code as shown in the following example UE num 1 then goto IF 10 echo the number is 1 CIF DOS The following script shows how the if command is used to pass parameters into the script file echo Number of parameters entered on run line 4 let index 1 LOOP if Sindex gt then goto LOOP END echo Parameter Sindex Sindex let index Sindex 1 goto LOOP LOOP END To test whether a variable is defined use the if command with the following syntax if variable name 1 where 1 defined For example the fol
91. tf 9s RingOpDup printf 9s Directed printf 9s Trace A 25 Writing Technician Interface Scripts printf 10u n wfFddiMacExtEntry wfFddiMacRingOpCts list i cutenv c9 15 name2 cctname if name2 0 1 then printf 4s 4s 7 7sNn S name2 1 Next line FI_MAC_NXT let i i 1 goto FI_MAC_IP FE AE aE aE aE aE aE aE TE TE TE HE aE HE aE HE TE TE a HE AE FE TE TE aE AE a aE FE TE TE TE HE HE a a AE TE TE EE AE TE TE a EE E HEHE aE a a E E E EEEE Port screen ARRANCAR FI_PORT let i l echo echo FDDI Modules Port Parameters cho M n echo oe printf 4 4s 4 4s 5 5s 9 9s 9 9s 10 10s 10 10s 10 10sXn w w w ve Link Error Elasticity Link printf 4 4s 4 4s 5 5s 9 9s 9 9s 10 10s 10 10s 10 10sWn v Local Neighbor Physical Monitor Buffer Confidence printf 4 4s 4 4s 5 5s 9 9s 9 9s 10 10s 10 10s 10 10s n Slot Conn Port Port Type State MY Count Errors Count printf 4 4s 4 4s 5 5s 9 9s 9 9s 10 10s 10 10s 10 10s1n S bs EN ow IN IN SN now now instenv list wfFddiPortEntry A 26 LED PORT LPS on error FI PORT NXT if i gt list_0 then goto printf 4d 4d wfFddiP w Fd
92. that is not printable is returned as its hex value in the form 00 DEC BYTES formats the data as an unsigned decimal number with each byte separated by a dot DEC WORDS formats the data as an unsigned decimal number with a dot separating every 2 bytes DEC LONGS formats the data as an unsigned decimal number with a dot separating every 4 bytes HEX BYTES formats the data as a hexadecimal string with each byte separated by a dot HEX WORDS formats the data as a hexadecimal string with a dot separating every 2 bytes HEX LONGS formats the data as a hexadecimal string with a dot separating every 4 bytes HEX USTRING or HEX STRING formats the data as a hexadecimal string using uppercase digits for A F HEX LSTRING formats the data as a hexadecimal string using lowercase digits for a f MAC1_ADDRESS or MAC_ADDRESS formats the data as a canonical MAC address MAC2_ADDRESS formats the data as a noncanonical MAC address SIGNED_INTEGER or INTEGER formats the data as a 4 byte signed integer 2 27 Writing Technician Interface Scripts UNSIGNED INTEGER formats the data as a 4 byte unsigned integer MIB object represents the variable values lt object attribute instance gt The following example shows a script using the octetfmt command The command formats the MIB object as a hexadecimal string using uppercase digits octetfmt serialno HEX_USTRING wfHwBase wfHwBpSerialNumber 0 echo Backplane serial
93. the Technician Interface commands in a script file saves restores local variables when the script ends sprintf Converts and formats text and saves the result in a specified variable unsetenv Deletes one or more variables from the local or global environment variable table verbose Enables the debug trace facility 2 2 arrayenv cutenv Command Reference The arrayenv command allows you to write a list of command line arguments text string to a pseudo variable array beginning with the prefix variable name You can also append arguments to the end of an existing variable array using the a option The arrayenv command has the following syntax arrayenv a variable name text string text string a appends the new arguments to the end of a variable array variable name is the name of the variable that holds the array text string contains the command line arguments If the text for the arguments contains blanks or special characters enclose it in double quotes as shown in syntax For example to pass the argument Router One specify Router One in the statement The following example sets up an array named attribute specifies a series of values for the array appends a value to the list and then prints the number of elements in the array the value of the first element and the value of the last element The size of the pseudo variable array is stored at index 0 arrayenv att
94. the script file the script interpreter goes to the error handler label defined in the file If you press Ctrl c to abort the script the Technician Interface displays the following prompt Terminate script file y n You can use the on error command with the s flag to allow the script to recover without returning an error message if the on error command cannot locate a specified script file The following example shows the on error command with the s flag on error s ERROR_HANDLER For more information about the on error command see Chapter 2 in this manual Creating a Script File Inserting Comments You can insert comments into the script file Comments begin with a pound sign in column 1 as shown in the following example The echo command is used to output messages to the user s console When a script file is executed the system does not display comments to the user s console Debugging a Script File To enable the debug trace facility use the verbose command When you enable the trace facility the Technician Interface displays each command read from the script file before and after its variables have been expanded For instructions on using the verbose command see Chapter 2 Saving and Restoring Variables To save the current list of local and global variables to a file use the save env command For example to save the variables to a file named test enter the following command save
95. then goto FI NEXT TRY let delta txlors s2txlors_ j sltxlors_ i if delta_txlors lt 0 then goto FI NEXT TRY let matches matches 1 let cctnum wfFddiEntry wfFDDICct slinstid_ i gosub GETCCTNAME printf 4d 4d wfFddiEntry wfFDDISlot slinstid_ i wfFddiEntry wfFDDINode slinstid_ i printf 8 8s Scctname printf 10u 10u 10u 10u n delta_rxfrms delta txfrms Sdelta_rxlors delta_txlors cutenv c9 15 name2 Scctname if name2 0 1 then printf 4s 4s 7 7sNn S name2 1 FI NEXT TRY let j j 1 if j lt s2instid_0 then goto FI_SAMP_MATCH let i i 1 if i lt slinstid 0 then let j jlow goto FI_SAMP_MATCH let i table_siz goto FOOTER_AND_END FI_SAMP_HELP cutenv c invalch ugly_ 3 echo Inappropriate character ugly_1 in parameter echo only digits allowed echo goto FI_HELP_SHOW A 32 Sample Scripts HARTA EB E E Hardware Filter screen HEE aE RH aE EEE HE EE EE EEE EEE EAE EE EE EE EER ERA EERE FI HWE setenv RUN SILENT 1 on error FI HANDLER run hwfilter show fddi goto FI END FI HANDLER echo Script hwfilter bat not found echo goto FI END THETHEEREREEHEREREREHEREREHEHEREREREHEREHEHEHEREHEEHEREHREHEREHEE AH Hdi Parse for enable command
96. tlerrs Stlerrs value RxOversized value AbortTx let tlerrs tlerrs value UnderrunTx S value ParityErrRx let tlerrs tlerrs value ParityErrTx value RingErrRx let tlerrs tlerrs value RingErrTx TN value SmtRingErrRx let tlerrs tlerrs value PortOpErr TON S value SInternOpErr let tlerrs tlerrs value SHostErr Display the line printf 4d 4d 8 8s value Slot value Node cctname printf 10u 10u 10u 10u 10u value OctetsRx0k S value FramesRxOk value SOctetsTxOk S value S FramesTxOk Stlerrs echo cutenv c9 15 name2 Scctname if name2 0 1 then printf 4s 4s 7 7sNn Y S name2 1 FI_STAT_NXT let i i 1 goto FI_STLOOP E Receive Errors screen Hi E ERE E E E E E FI_RCV Sample Scripts PARE HERE AE AE RAE EE RT EH REE HR FE FE AE FE EERE PARE HERE ERE EE RT AAA if 4 3 then goto FI_Rx1 let cmdlen strlen 3 let i strindex errors 3 if i 1 then if cmdlen gt 3 then goto FI Rxl goto FI HELP EFI RCV NM FI HELP SHOW qs E FI HI FI HI md P SHOW P SHOW mi 1 ET REL let i l check for circuit name to match on if S lt 3 then goto setenv cmd 4 let len strlen cmd 1f len lt 3 then goto let j strindex circu if j
97. uses the time format HH MM SS tz tests whether lt string1 gt uses the GMT offset format HH MM 2 12 Command Reference lt string1 gt lt string2 gt are ASCII character strings or numbers lt operand gt is one of the following comparison operations 2 equal not equal gt greater than gt greater than or equal lt less than lt less than or equal then is an optional word used for ease of reading lt command gt is a Technician Interface command If both lt string1 gt and lt string2 gt are numbers the test expression for the if command is a numeric comparison If lt string1 gt and lt string2 gt are not numbers a case sensitive string comparison is done You specify a case insensitive comparison using the ic argument The syntax for certain data types may also be tested using the u num ip or ipx argument If the test on string 1 gt is valid a 1 is substituted for string If the test on string is invalid a O is substituted for string The following example shows a script using the if command The comments explain what is happening in the script setenv A YES setenv B 1993 string comparison au sa YES then echo TRUE date numeric comparison if SB t 2001 then echo FALSE date test for valid IP address syntax TE ip 192 88 22 33 1 then echo TRUE case insensitive string comparison if 16 ABC abc then echo TRUE
98. ut from the Technician Interface e Before unmounting the router file system e Before resetting the router If you do not follow these instructions you can lose the contents of your snapshot file Enter the following command to open a file and to save console messages to that file record open fileonly pause vol filename open creates and opens a snapshot file The system sends command output and messages to both the console terminal and the file fileonly writes messages only to the file not to the terminal This option is used only within a script and is otherwise ignored This option allows a script to write output to a file The default is for messages to be written to both the file and the terminal pause immediately places the system in pause mode You can use this option with the fileonly option vol is the slot number containing the volume used to store the file filename is the name of the file used to store output from the router s Technician Interface 2 34 Command Reference Note When you designate a snapshot file on an NVES flash file system remember that only one snapshot file can be open at a time If you use other Technician Interface commands to write to another file when the snapshot file is open on the same file system the commands fail You can stop saving messages to a snapshot file temporarily by using the pause option with the record command To change the pause stat
99. w now instenv list wfFddiMacEntry A 24 FI MAC LP on error FI MAC NXT if i gt list_0 then let cctnum wfFddil gosub GETCCTNAME if matchcct W t pr if ic matchcct Sample Scripts goto FOOTER AND END Entry wfFDDICct list i hen goto FI PRNTMAC cctname then goto FI MAC NXT let match entries match entries 1 FI PRNTMAC printf 4d 4d wfFddiMacEntry wfFddiMacSlot list_ i wfFddiMacEntry wfFddiMacNode list_ i printf 8 8s Scctname f Print Upstream Neighbor s MAC address octetfmt mac MAC_ADDRI wfFddiMacEntry wfFddiMacU ESS pstreamNbr list_ i printf 17s mac Print Downstream Neighbor s MAC address octetfmt mac MAC_ADDRI ESS wfFddiMacEntry wfFddiMacDownstreamNbr list_ i printf 17s Smac Print remainder of line let tneg wfFddiMacEntry wfFddiMacTNeg list_ i 1000000 printf 4d Stneg let state if state 1 then if state 2 then if state 4 then if state 8 then if state 16 then if state 32 then if state 64 then if state 128 then wfFddiMacEntry wfFddiMacRmtState list i printf 9s Isolated printf 9s NonOp printf 9s RingOp printf 9s Detect printf 9s NonOpDup prin

Download Pdf Manuals

image

Related Search

Related Contents

Dawson DAM110B  「就任に当たって」  LaCie Little Big Disk 200GB  PDF:1.7MB  ISOBE5600 Isolated Probe System  Amana Home Laundry Automatic Washer Washer User Manual  ASSMANN Electronic SNMP CS 121B SK  IC-Q7  Philips Power multiplier SPS1520A  BEDIENUNGSANLEITUNG CO2-Messgerät mit Datenlogger  

Copyright © All rights reserved.
Failed to retrieve file