Avaya Writing Technician Interface Scripts User manual

  • Hello! I am an AI chatbot trained to assist you with the Avaya Writing Technician Interface Scripts User manual. I’ve already reviewed the document and can help you find the information you need or explain it in simple terms. Just ask your questions, and providing more details will help me assist you more effectively!
Part No. 117382-A Rev. A
September 1997
BayRS Version 12.00
Site Manager Software Version 6.00
Writing Technician
Interface Scripts
ii
117382-A Rev. A
4401 Great America Parkway 8 Federal Street
Santa Clara, CA 95054 Billerica, MA 01821
Copyright © 1997 Bay Networks, Inc.
All rights reserved. Printed in the USA. September 1997.
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.
Trademarks
ACE, AFN, AN, BCN, BLN, BN, BNX, CN, FN, FRE, GAME, LN, Optivity, PPX, Bay Networks, SynOptics,
SynOptics Communications, Wellfleet and the Wellfleet logo are registered trademarks and Advanced Remote Node,
ANH, ARN, ASN, Bay•SIS, BayStack, BayStream, BCNX, BLNX, EZ Install, EZ Internetwork, EZ LAN,
IP AutoLearn, PathMan, PhonePlus, Quick2Config, RouterMan, SN, SPEX, Switch Node, Bay Networks Press,
the Bay Networks logo and the SynOptics logo are trademarks of Bay Networks, Inc.
All other trademarks and registered trademarks are the property of their respective owners.
Restricted Rights Legend
Use, duplication, or disclosure by the United States Government is subject to restrictions as set forth in subparagraph
(c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013.
Notwithstanding any other license agreement that may pertain to, or accompany the delivery of, this computer
software, 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.
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 © 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,
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).
117382-A Rev. A
iii
Bay Networks, Inc. Software License Agreement
NOTICE:
Please carefully read this license agreement before copying or using the accompanying software or
installing the hardware unit with pre-enabled software (each of which is referred to as “Software” in this Agreement).
BY COPYING OR USING THE SOFTWARE, YOU ACCEPT ALL OF THE TERMS AND CONDITIONS OF THIS
LICENSE AGREEMENT. THE TERMS EXPRESSED IN THIS AGREEMENT ARE THE ONLY TERMS UNDER
WHICH BAY NETWORKS WILL PERMIT YOU TO USE THE SOFTWARE. If you do not accept these terms and
conditions, return the product, unused and in the original shipping container, within 30 days of purchase to obtain a
credit for the full purchase price
1. License Grant.
Bay Networks, Inc. (“Bay Networks”) grants the end user of the Software (“Licensee”) a personal,
nonexclusive, nontransferable license: a) to use the Software either on a single computer or, if applicable, on a single
authorized device identified by host ID, for which it was originally acquired; b) to copy the Software solely for backup
purposes in support of authorized use of the Software; and c) to use and copy the associated user manual solely in
support of authorized use of the Software by Licensee. This license applies to the Software only and does not extend
to Bay Networks Agent software or other Bay Networks software products. Bay Networks Agent software or other
Bay Networks software products are licensed for use under the terms of the applicable Bay Networks, Inc. Software
License Agreement that accompanies such software and upon payment by the end user of the applicable license fees
for such software.
2. Restrictions on use; reservation of rights.
The Software and user manuals are protected under copyright laws.
Bay Networks and/or its licensors retain all title and ownership in both the Software and user manuals, including any
revisions made by Bay Networks or its licensors. The copyright notice must be reproduced and included with any
copy of any portion of the Software or user manuals. Licensee may not modify, translate, decompile, disassemble, use
for any competitive analysis, reverse engineer, distribute, or create derivative works from the Software or user
manuals or any copy, in whole or in part. Except as expressly provided in this Agreement, Licensee may not copy or
transfer the Software or user manuals, in whole or in part. The Software and user manuals embody Bay Networks’ and
its licensors’ confidential and proprietary intellectual property. Licensee shall not sublicense, assign, or otherwise
disclose to any third party the Software, or any information about the operation, design, performance, or
implementation of the Software and user manuals that is confidential to Bay Networks and its licensors; however,
Licensee may grant permission to its consultants, subcontractors, and agents to use the Software at Licensee’s facility,
provided they have agreed to use the Software only in accordance with the terms of this license.
3. Limited warranty.
Bay Networks warrants each item of Software, as delivered by Bay Networks and properly
installed and operated on Bay Networks hardware or other equipment it is originally licensed for, to function
substantially as described in its accompanying user manual during its warranty period, which begins on the date
Software is first shipped to Licensee. If any item of Software fails to so function during its warranty period, as the sole
remedy Bay Networks will at its discretion provide a suitable fix, patch, or workaround for the problem that may be
included in a future Software release. Bay Networks further warrants to Licensee that the media on which the
Software is provided will be free from defects in materials and workmanship under normal use for a period of 90 days
from the date Software is first shipped to Licensee. Bay Networks will replace defective media at no charge if it is
returned to Bay Networks during the warranty period along with proof of the date of shipment. This warranty does not
apply if the media has been damaged as a result of accident, misuse, or abuse. The Licensee assumes all responsibility
for selection of the Software to achieve Licensee’s intended results and for the installation, use, and results obtained
from the Software. Bay Networks does not warrant a) that the functions contained in the software will meet the
Licensee’s requirements, b) that the Software will operate in the hardware or software combinations that the Licensee
may select, c) that the operation of the Software will be uninterrupted or error free, or d) that all defects in the
operation of the Software will be corrected. Bay Networks is not obligated to remedy any Software defect that cannot
be reproduced with the latest Software release. These warranties do not apply to the Software if it has been (i) altered,
except by Bay Networks or in accordance with its instructions; (ii) used in conjunction with another vendor’s product,
resulting in the defect; or (iii) damaged by improper environment, abuse, misuse, accident, or negligence. THE
FOREGOING WARRANTIES AND LIMITATIONS ARE EXCLUSIVE REMEDIES AND ARE IN LIEU OF ALL
OTHER WARRANTIES EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTY OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Licensee is responsible for the security of
iv
117382-A Rev. A
its own data and information and for maintaining adequate procedures apart from the Software to reconstruct lost or
altered files, data, or programs.
4. Limitation of liability.
IN NO EVENT WILL BAY NETWORKS OR ITS LICENSORS BE LIABLE FOR ANY
COST OF SUBSTITUTE PROCUREMENT; SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES; OR ANY DAMAGES RESULTING FROM INACCURATE OR LOST DATA OR LOSS OF USE OR
PROFITS ARISING OUT OF OR IN CONNECTION WITH THE PERFORMANCE OF THE SOFTWARE, EVEN
IF BAY NETWORKS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT
SHALL THE LIABILITY OF BAY NETWORKS RELATING TO THE SOFTWARE OR THIS AGREEMENT
EXCEED THE PRICE PAID TO BAY NETWORKS FOR THE SOFTWARE LICENSE.
5. Government Licensees.
This provision applies to all Software and documentation acquired directly or indirectly
by or on behalf of the United States Government. The Software and documentation are commercial products, licensed
on the open market at market prices, and were developed entirely at private expense and without the use of any U.S.
Government funds. The license to the U.S. Government is granted only with restricted rights, and use, duplication, or
disclosure by the U.S. Government is subject to the restrictions set forth in subparagraph (c)(1) of the Commercial
Computer Software––Restricted Rights clause of FAR 52.227-19 and the limitations set out in this license for civilian
agencies, and subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause of DFARS
252.227-7013, for agencies of the Department of Defense or their successors, whichever is applicable.
6. Use of Software in the European Community.
This provision applies to all Software acquired for use within the
European Community. If Licensee uses the Software within a country in the European Community, the Software
Directive enacted by the Council of European Communities Directive dated 14 May, 1991, will apply to the
examination of the Software to facilitate interoperability. Licensee agrees to notify Bay Networks of any such
intended examination of the Software and may procure support and assistance from Bay Networks.
7. Term and termination.
This license is effective until terminated; however, all of the restrictions with respect to
Bay Networks’ copyright in the Software and user manuals will cease being effective at the date of expiration of the
Bay Networks copyright; those restrictions relating to use and disclosure of Bay Networks’ confidential information
shall continue in effect. Licensee may terminate this license at any time. The license will automatically terminate if
Licensee fails to comply with any of the terms and conditions of the license. Upon termination for any reason,
Licensee will immediately destroy or return to Bay Networks the Software, user manuals, and all copies. Bay
Networks is not liable to Licensee for damages in any form solely by reason of the termination of this license.
8. Export and Re-export.
Licensee agrees not to export, directly or indirectly, the Software or related technical data
or information without first obtaining any required export licenses or other governmental approvals. Without limiting
the foregoing, Licensee, on behalf of itself and its subsidiaries and affiliates, agrees that it will not, without first
obtaining all export licenses and approvals required by the U.S. Government: (i) export, re-export, transfer, or divert
any such Software or technical data, or any direct product thereof, to any country to which such exports or re-exports
are restricted or embargoed under United States export control laws and regulations, or to any national or resident of
such restricted or embargoed countries; or (ii) provide the Software or related technical data or information to any
military end user or for any military end use, including the design, development, or production of any chemical,
nuclear, or biological weapons.
9. General.
If any provision of this Agreement is held to be invalid or unenforceable by a court of competent
jurisdiction, the remainder of the provisions of this Agreement shall remain in full force and effect. This Agreement
will be governed by the laws of the state of California.
Should you have any questions concerning this Agreement, contact Bay Networks, Inc., 4401 Great America Parkway,
P.O. Box 58185, Santa Clara, California 95054-8185.
LICENSEE ACKNOWLEDGES THAT LICENSEE HAS READ THIS AGREEMENT, UNDERSTANDS IT, AND
AGREES TO BE BOUND BY ITS TERMS AND CONDITIONS. LICENSEE FURTHER AGREES THAT THIS
AGREEMENT IS THE ENTIRE AND EXCLUSIVE AGREEMENT BETWEEN BAY NETWORKS AND
LICENSEE, WHICH SUPERSEDES ALL PRIOR ORAL AND WRITTEN AGREEMENTS AND
COMMUNICATIONS BETWEEN THE PARTIES PERTAINING TO THE SUBJECT MATTER OF THIS
AGREEMENT. NO DIFFERENT OR ADDITIONAL TERMS WILL BE ENFORCEABLE AGAINST BAY
NETWORKS UNLESS BAY NETWORKS GIVES ITS EXPRESS WRITTEN CONSENT, INCLUDING AN
EXPRESS WAIVER OF THE TERMS OF THIS AGREEMENT.
117382-A Rev. A
v
Contents
About This Guide
Audience ........................................................................................................................... xi
Before You Begin .............................................................................................................. xi
Conventions ......................................................................................................................xii
Acronyms .........................................................................................................................xiii
Ordering Bay Networks Publications ...............................................................................xiii
Bay Networks Customer Service .....................................................................................xiv
How to Get Help ..............................................................................................................xiv
Chapter 1
Creating a Script File
About Variables ...............................................................................................................1-2
Local, Global, and System Variables ........................................................................1-4
Special Variables ............................................................................................................1-4
Input Parameters ......................................................................................................1-4
Prompting for Input ...................................................................................................1-5
Polling the Console for Input ..............................................................................1-5
Accessing MIB Information ......................................................................................1-6
Formatting a MIB Entry ............................................................................................1-7
Defining a Pseudo-Variable Array ...................................................................................1-8
Creating and Using Variables .........................................................................................1-8
Viewing Variables .....................................................................................................1-8
Setting Variables ......................................................................................................1-9
Deleting Variables ..................................................................................................1-10
Setting the Current Volume or Directory .......................................................................1-11
Controlling Program Flow .............................................................................................1-11
Writing Messages to the Console .................................................................................1-12
Saving Console Messages to a File .............................................................................1-12
Performing Error Recovery ...........................................................................................1-12
vi
117382-A Rev. A
Inserting Comments .....................................................................................................1-13
Debugging a Script File ................................................................................................1-13
Saving and Restoring Variables ....................................................................................1-13
Running a Script File ....................................................................................................1-14
Creating Menus ............................................................................................................1-14
Chapter 2
Command Reference
arrayenv ..........................................................................................................................2-3
cutenv .............................................................................................................................2-4
echo ................................................................................................................................2-6
enumenv .........................................................................................................................2-7
export ..............................................................................................................................2-8
getenv .............................................................................................................................2-9
gosub ............................................................................................................................2-10
goto ...............................................................................................................................2-11
if ....................................................................................................................................2-12
instenv ..........................................................................................................................2-16
let ..................................................................................................................................2-18
mibget ...........................................................................................................................2-23
octetfmt .........................................................................................................................2-26
on error .........................................................................................................................2-28
pause ............................................................................................................................2-29
printf ..............................................................................................................................2-30
record ...........................................................................................................................2-33
return ............................................................................................................................2-35
run ................................................................................................................................2-36
save env .......................................................................................................................2-38
setenv ...........................................................................................................................2-39
source env ....................................................................................................................2-40
sprintf ............................................................................................................................2-41
unsetenv .......................................................................................................................2-42
verbose .........................................................................................................................2-44
117382-A Rev. A
vii
Appendix A
Sample Scripts
Menu Script ................................................................................................................... A-1
FDDI.MNU Script ........................................................................................................... A-2
FDDI.BAT Script ............................................................................................................ A-3
Index
117382-A Rev. A
ix
Tables
Table 2-1. Script Commands ....................................................................................2-1
Table 2-2. Arithmetical Operators ...........................................................................2-19
Table 2-3. Logical Operators ...................................................................................2-19
Table 2-4. Special Characters .................................................................................2-31
117382-A Rev. A
xi
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
Audience
This manual is for network administrators with the following background:
Knowledge of the UNIX operating system and the C programming language
A general understanding of local area and wide area networking fundamentals
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
.
Writing Technician Interface Scripts
xii
117382-A Rev. A
Conventions
angle brackets (< >) 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
<ip_address>
,
you enter
ping 192.32.10.12
bold text
Indicates text that you need to enter, command names,
and buttons in menu paths.
Example: Enter
wfsm &
Example: Use the
dinfo
command.
Example: ATM DXI > Interfaces >
PVCs
identifies the
PVCs button in the window that appears when you
select the Interfaces option from the ATM DXI menu.
brackets ([ ]) Indicate optional elements. You can choose none, one,
or all of the options.
ellipsis points Horizontal (. . .) and vertical ellipsis points indicate
omitted information.
italic text
Indicates variable values in command syntax
descriptions, new terms, file and directory names, and
book titles.
quotation marks (“ ”) Indicate the title of a chapter or section within a book.
screen text
Indicates data that appears on the screen.
Example:
Set Bay Networks Trap Monitor Filters
separator ( > ) Separates menu and option names in instructions and
internal pin-to-pin wire connections.
Example: Protocols > AppleTalk identifies the
AppleTalk option in the Protocols menu.
Example: Pin 7 > 19 > 20
vertical line (
|
) Indicates that you enter only one of the parts of the
command. The vertical line separates choices. Do not
type the vertical 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.
.
.
.
()
About This Guide
117382-A Rev. A
xiii
Acronyms
ANSI American National Standards Institute
ARP Address Resolution Protocol
ASCII American Standard Code for Information Interchange
ATM asynchronous transfer mode
FDDI Fiber Distributed Data Interface
MAC media access control
MIB management information base
OSI Open Systems Interconnection
OSPF Open Shortest Path First
RIP Routing Information Protocol
SNMP Simple Network Management Protocol
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:
Phone--U.S./Canada: 888-422-9773
Phone--International: 510-490-4752
FAX--U.S./Canada and International: 510-498-2609
The Bay Networks Press catalog is available on the World Wide Web at
support.baynetworks.com/Library/GenMisc
. Bay Networks publications are
available on the World Wide Web at
support.baynetworks.com/Library/tpubs
.
Writing Technician Interface Scripts
xiv
117382-A Rev. A
Bay Networks Customer Service
You can purchase a support contract from your Bay Networks distributor or
authorized reseller, or directly from Bay Networks Services. For information
about, or to purchase a Bay Networks service contract, either call your local Bay
Networks field sales office or one of the following numbers:
Information about customer service is also available on the World Wide Web at
support.baynetworks.com
.
How to Get Help
If you purchased a service contract for your Bay Networks product from a
distributor or authorized reseller, contact the technical support staff for that
distributor or reseller for assistance.
If you purchased a Bay Networks service program, call one of the following Bay
Networks Technical Solutions Centers:
Region Telephone number Fax number
United States and
Canada
800-2LANWAN; then enter Express
Routing Code (ERC) 290, when prompted,
to purchase or renew a service contract
508-916-8880 (direct)
508-916-3514
Europe 33-4-92-96-69-66 33-4-92-96-69-96
Asia/Pacific 61-2-9927-8888 61-2-9927-8899
Latin America 561-988-7661 561-988-7550
Technical Solutions Center Telephone number Fax number
Billerica, MA 800-2LANWAN 508-916-3514
Santa Clara, CA 800-2LANWAN 408-495-1188
Valbonne, France 33-4-92-96-69-68 33-4-92-96-69-98
Sydney, Australia 61-2-9927-8800 61-2-9927-8811
Tokyo, Japan 81-3-5402-0180 81-3-5402-0173
117382-A Rev. A
1-1
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 information 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:
Prompting the user for input, using the special variable
$
<prompt>
Referencing and using MIB information, using the special variable
$
<object.attribute.instance>
, the
mibget
and
instenv
commands, and
formatting MIB entries using the
octetfmt
command
Creating, using, and deleting variables, using the
arrayenv
,
cutenv
,
enumenv
,
getenv
,
instenv,
let
,
setenv
,
sprintf
, and
unsetenv
commands
Changing a local variable into a global variable, using the
export
command
Evaluating an arithmetic or logical expression, using the
let
command
Parsing a text string, using the
cutenv
command
Controlling the execution of the script, using the
if
,
goto
,
pause
,
gosub
, and
return
commands
Writing Technician Interface Scripts
1-2
117382-A Rev. A
Writing messages to the console, using the
echo
and the
printf
commands
Recording console messages to a file, using the
record
command
Handling and recovering from errors, using the
on error
command
Inserting comments into a script file, using the pound sign (#)
Debugging a script file, using the
verbose
command
Saving or restoring variables to or from a file, using the
save env
and
source
env
commands
Running a script file with command line arguments, using the
run
command
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 (\) 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 when b is executed.
setenv a blue
setenv b “My color is \$a”
echo $b
My color is blue appears on the user’s console.
Creating a Script File
117382-A Rev. A 1-3
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 braces ({ }) to
separate the variable names from other data within the string.
echo “The sum of ${a}+1=${b}”
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_10 dynamically on the command line
using the following syntax:
${array_[$index]}. Notice the use of the brackets ([ ])
within the variable name. Any literal text or variable name specified within the
brackets is first expanded to replace any variables with their values and then
concatenated onto the preceding characters of the variable name. To use brackets,
you must enclose the entire variable name being built within braces (
{ }).
Note: If the variable name is followed by a space or an end-of-line character
(carriage return), the brackets are optional.
Writing Technician Interface Scripts
1-4 117382-A Rev. A
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, enumenv, instenv, let, mibget, setenv, or
sprintf). For more information about these commands, see Chapter 2.
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 file name. It is set to zero if no parameters are entered. For more
information about input parameters, see “
run” in 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.
Creating a Script File
117382-A Rev. A 1-5
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 (< >). In the following script,
setenv ans “$<Enter your name: >”
echo “Your name is $ans”
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 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
<value_in_seconds>
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
1-6 117382-A Rev. A
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: >”
echo “Your name is $ans”
if “$ans” = “” then; \
echo “nothing entered”
To change the timeout back to an indefinite waiting period, use the following
command:
unsetenv 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:
Counter variables, which keep track of how many times an event occurs.
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.
Integer variables, which specify information in the form of a simple integer.
/