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 #523 background imageLoading...
Page #523 background image
error
NOTICE 01/07/2006 09:46:57 macroData: (Id: 402) commandError is interface fastEthernet 500
NOTICE 01/07/2006 09:46:57 macroData: (Id: 402) commandErrorStatus is Command execution error
NOTICE 01/07/2006 09:46:57 macroData: (Id: 402) runStatus is Loop:500
NOTICE 01/07/2006 09:46:57 macroData: Macro 'badInterfaceCommandMacro' in file 'testInterfaceCommand.mac'
ending execution (Id: 402) on vty, 0
â–  See show log data.
onError Macro Examples
The following examples provide an indication of how the onError macro can assist
in using and troubleshooting macro files. The examples purposely contain errors and
show the result when using the onError macro.
Detecting Invalid Command Formats
In this example, the following macro file (badInterfaceCommand.mac) performs a
loop. Within each loop, the CLI executes the interface fastEthernet command using
an invalid interface format:
<# badInterfaceCommandMacro #>
<# env.setResult("runStatus","start" ) #>
<# theLoopCount := 500 #>
conf t
<# while theLoopCount > 0 #>
<# env.setResult("runStatus", "Loop:" $ theLoopCount ) #>
interface fastEthernet <# theLoopCount; '\n' #>
<# --theLoopCount #>
<# endwhile #>
<# env.setResult("runStatus","complete" ) #>
<#endtmpl#>
<# onError #>
<# env.setResult("commandError", env.getErrorCommand) #>
<# env.setResult("commandErrorStatus", env.getErrorStatus) #>
<#endtmpl#>
If the macro were to run to completion, the CLI would execute the commands as
follows:
interface fastEthernet 500
interface fastEthernet 499
.
.
.
interface fastEthernet 1
Because the macro uses invalid interface formats, executing the macro without the
embedded onError macro would result in error output for each loop. However, the
onError macro detects the error and stops the macro. Using the onError macro, the
output appears as follows:
host1(config)# macro testInterfaceCommand.mac badInterfaceCommandMacro
Macro 'badInterfaceCommandMacro' in file 'testInterfaceCommand.mac' starting execution (Id: 402)
Detecting and Recording Macro Errors â–  493
Chapter 8: Writing CLI Macros

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