Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Additional Details About Specifying Junos Statements and Identifiers

This topic provides more detailed information about CLI container and leaf statements so that you can better understand how you must specify them when creating ASCII configuration files. It also describes how the CLI performs type checking to verify that the data you entered is in the correct format.

Specifying Statements

Statements are shown one of two ways, either with braces or without:

  • Statement name and identifier, with one or more lower level statements enclosed in braces:
    statement-name1 identifier-name {statement-name2; additional-statements; }
  • Statement name, identifier, and a single identifier:
    statement-name identifier-name1 identifier-name2;

The statement-name is the name of the statement.

The identifier-name is a name or other string that uniquely identifies an instance of a statement. An identifier is used when a statement can be specified more than once in a configuration.

When specifying a statement, you must specify either a statement name or an identifier name, or both, depending on the statement hierarchy.

You specify identifiers in one of the following ways:

  • identifier-name—The identifier-name is a keyword used to uniquely identify a statement when a statement can be specified more than once in a statement.
  • identifier-name value—The identifier-name is a keyword, and the value is a required option variable.
  • identifier-name [value1 value2 value3 ...]—The identifier-name is a keyword that accepts multiple values. The brackets are required when you specify a set of values; however, they are optional when you specify only one value.

The following examples illustrate how statements and identifiers are specified in the configuration:

protocol {						# Top-level statement (statement-name).
	ospf {										# Statement under "protocol" (statement-name).
		area 0.0.0.0 {					# OSPF area "0.0.0.0" (statement-name identifier-name),
			interface so-0/0/0 {	# which contains an interface named "so-0/0/0."
				hello-interval 25;	# Identifier and value (identifier-name value). 
				priority 2;					# Identifier and value (identifier-name value).
				disable;						# Flag identifier (identifier-name).
			}
			interface so-0/0/1;	  # Another instance of "interface," named so-0/0/1,
		}									    # this instance contains no data, so no braces
	}										     # are displayed.
}
policy-options {				# Top-level statement (statement-name).
	term term1 {					# Statement under "policy-options" 
											# (statement-name value).
		from {							# Statement under "term" (statement-name).
			route-filter 10.0.0.0/8 orlonger reject;			# One identifier ("route-filter") with
			route-filter 127.0.0.0/8 orlonger reject;			# multiple values.
			route-filter 128.0.0.0/16 orlonger reject;
			route-filter 149.20.64.0/24 orlonger reject;
			route-filter 172.16.0.0/12 orlonger reject;
			route-filter 191.255.0.0/16 orlonger reject;
		}
		then {							# Statement under "term" (statement-name).
			next term;				# Identifier (identifier-name).
		}
	}
}

When you create an ASCII configuration file, you can specify statements and identifiers in one of the following ways. However, each statement has a preferred style, and the CLI uses that style when displaying the configuration in response to a configuration mode show command.

  • Statement followed by identifiers:
    statement-name identifier-name [...] identifier-name value [...];
  • Statement followed by identifiers enclosed in braces:
    statement-name {identifier-name; [...] identifier-name value;[...]}
  • For some repeating identifiers, you can use one set of braces for all the statements:
    statement-name {identifier-name value1; identifier-name value2; }

Performing CLI Type-Checking

When you specify identifiers and values, the CLI performs type checking to verify that the data you entered is in the correct format. For example, for a statement in which you must specify an IP address, the CLI requires you to enter an address in a valid format. If you have not, an error message indicates what you need to type. Table 1 lists the data types the CLI checks.

Table 1: CLI Configuration Input Types

Data Type

Format

Examples

Physical interface name (used in the [edit interfaces] hierarchy)

type-fpc/pic/port

Correct: so-0/0/1

Incorrect: so-0

Full interface name

type-fpc/pic/port<:channel>.logical

Correct: so-0/0/1.0

Incorrect: so-0/0/1

Full or abbreviated interface name (used in places other than the [edit interfaces] hierarchy)

type-<fpc</pic/port>><<: channel>.logical>

Correct: so, so-1, so-1/2/3:4.5

IP address

0xhex-bytesoctet<.octet<.octet.<octet>>>

Correct: 1.2.3.4, 0x01020304, 128.8.1, 128.8

Sample translations:

1.2.3 becomes 1.2.3.0
0x01020304 becomes 1.2.3.4
0x010203 becomes 0.1.2.3

IP address (destination prefix) and prefix length

0xhex-bytes</length>octet<octet <octet.<octet>>></length>

Correct: 10/8, 128.8/16, 1.2.3.4/32, 1.2.3.4

Sample translations:

1.2.3 becomes 1.2.3.0/32
0x01020304 becomes 1.2.3.4/32
0x010203 becomes 0.1.2.3/32
default becomes 0.0.0.0/0

International Organization for Standardization (ISO) address

hex-nibble<hex-nibble ...>

Correct: 47.1234.2345.3456.00, 47123423453456.00, 47.12.34.23.45.34.56.00

Sample translations:

47123456 becomes 47.1234.56
47.12.34.56 becomes 47.1234.56
4712.3456 becomes 47.1234.56

OSPF area identifier (ID)

0xhex-bytesoctet<.octet<.octet.< octet >>> decimal-number

Correct: 54, 0.0.0.54, 0x01020304, 1.2.3.4

Sample translations:

54 becomes 0.0.0.54

257 becomes 0.0.1.1
128.8 becomes 128.8.0.0
0x010203 becomes 0.1.2.3

Published: 2012-11-27