Tuesday, November 2, 2010

Additional Details about Specifying Statements and Identifiers

This section provides more detailed information about specifying statements and identifiers in configuration mode:

How to Specify Statements

This section provides more detailed information about CLI container and leaf statements so that you can better understand how the CLI displays them in a configuration and how you must specify them when creating ASCII configuration files.
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-name > < identifier > {
    statement; 
    additional-statements; 
}

  • Statement name, identifier, and a single identifier:
< statement-name > < identifier > identifier; 

The statement-name is the name of the statement. In the configuration example shown in the previous section, ospf and area are statement names.
The identifier is a name or other string that uniquely identifies an instance of a statement. The identifier is used when a statement can be specified more than once in a configuration. In the configuration example shown in the previous section, the identifier for the area statement is 0 and the identifier for the interface statement is so-0/0/0.
When specifying a statement, you must specify either a statement name or an identifier, or both, depending on the statement hierarchy.
You specify identifiers in one of the following ways:
  • identifier—The identifier is a flag, which is a single keyword.
  • identifier value—The identifier is a keyword, and the value is a required option variable.
  • identifier [value1 value 2 value3 ...]—The identifier is a set that accepts multiple values. The brackets are required when you specify a set of identifiers; however, they are optional when you specify only one identifier.
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),
            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; 
}

No comments: