EasyManuals Logo

Juniper SYSTEM BASICS - CONFIGURATION GUIDE V 11.1.X User Manual

Juniper SYSTEM BASICS - CONFIGURATION GUIDE V 11.1.X
640 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #508 background imageLoading...
Page #508 background image
<#endtmpl#>
<# onError #>
<# c := env.getVar("interface") #>
<# setoutput console #>
<# "begin output\n" #>
<# "The interface value: ";c; "\n" #>
<# endsetoutput #>
end
<#endtmpl#>
When the macro runs, the global variable interface is set and the interface command
contains an invalid interface value. The CLI reports a syntax error and the macro
onError is called. Within the onError macro, the global variable interface is retrieved.
ERX-40-4a-cc#macro b.mac badInt
Macro 'badInt' in file 'b.mac' starting execution (Id: 18)
Enter configuration commands, one per line. End with ^Z.
The interface command contains a bad interface value.
ERX-40-4a-cc(config)#interface fast 9/0
^
% interface not found
The CLI reports a syntax error and the macro onError is called. Within the onError
macro, the global variable interface is retrieved.
The interface value: 9/0
The macro terminates.
Macro 'badInt' in file 'b.mac' ending execution (Id: 18)
Unique IDs for Macros
Each macro that is started has an associated macro ID. The ID is displayed when the
macro is started and when the macro ends. Log messages for macroSchedular also
display the unique ID.
For example, macro c in file bench.mac is started on a Telnet session and the unique
ID is 25. The following start and end messages are output to the CLI session:
Macro 'c' in file 'bench.mac' starting execution (Id: 25)
. . .
Macro 'c' in file 'bench.mac' ending execution (Id: 25)
Accurate Use of Error Status When Accessed Ourside of onError Macro
When the status is requested from a macro other than the onError macro, the error
status reported is unavailable and the error string is empty.
For example, the following macro gets the command error and status. The macro is
not an onError macro so the status is reported as unavailable.
<# errorStatusTest #>
<# setoutput console #>
478 â–  Writing Macros
JUNOSe 11.1.x System Basics Configuration Guide

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Juniper SYSTEM BASICS - CONFIGURATION GUIDE V 11.1.X and is the answer not in the manual?

Juniper SYSTEM BASICS - CONFIGURATION GUIDE V 11.1.X Specifications

General IconGeneral
BrandJuniper
ModelSYSTEM BASICS - CONFIGURATION GUIDE V 11.1.X
CategorySoftware
LanguageEnglish

Related product manuals