Juniper SYSTEM BASICS - CONFIGURATION GUIDE V 11.1.X Configuration Manual page 504

System basics configuration guide software for e series broadband services routers
Table of Contents

Advertisement

JUNOSe 11.1.x System Basics Configuration Guide
name and macro end statements, and while loops. A control expression can include
multiple operation statements if you separate the statements with semicolons (;).
For example:
<# i:=0; while i++ < 3 #>
All macros must have names consisting only of letters, numbers, and the underline
character (_). The first character of a macro name cannot be a number. If you include
more than one macro within a macro file, each macro must have a unique name.
The first line of a macro defines the macro's name:
<# macroName #>
Noncontrol expressions are not enclosed by control brackets and simply become
part of the generated CLI command text.
You must end all macros with the following control expression:
<# endtmpl #>
You can add comments to your control expressions to clarify the code by prefacing
the comment with forward slashes (//) inside the control brackets:
<# endtmpl //A comment in the macro end expression #>
Text after the // is ignored when the macro is run and is not displayed by the CLI.
You can also add comments outside the control expressions by prefacing the comment
with an exclamation point (!). The CLI displays these comments if you use the test
or verbose keywords with the macro command; the CLI never interprets these
comments as commands.
!This is a comment outside any control expression
You can improve the readability of a macro by using tabs to indent expressions.
Leading and trailing tabs have no effect on the macro output, because they are
removed when the macro is run.
The following is a simple macro that you can use to configure the IP interface on the
Example
Fast Ethernet port of the SRP module after you have restored the factory defaults:
<# ipInit #>
<# ipAddress := env.getline (" IP Address of System?" ) #>
ena
conf t
int f0/0
ip addr <# ipAddress; '\n' #>
ip route 10.0.0.0 255.0.0.0 192.168.1.1
host pk 10.10.0.166 ftp
<# endtmpl #>
474
Writing Macros

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Junose 11.1

Table of Contents