Saturday, October 2, 2010

Configuration Statement Hierarchy

The JUNOS software configuration consists of a hierarchy of statements. There are two types of statements: container statements, which are statements that contain other statements, and leaf statements, which do not contain other statements. All the container and leaf statements together form the configuration hierarchy.
Each statement at the top level of the configuration hierarchy resides at the trunk (or root level) of a hierarchy tree. The top-level statements are container statements, containing other statements that form the tree branches. The leaf statements are the leaves of the hierarchy tree. An individual hierarchy of statements, which starts at the trunk of the hierarchy tree, is called a statement path. Figure 3 illustrates the hierarchy tree, showing a statement path for the portion of the protocol configuration hierarchy that configures the hello interval on an interface in an OSPF area. The protocols statement is a top-level statement at the trunk of the configuration tree. The ospf, area, and interface statements are all subordinate container statements of a higher statement (they are branches of the hierarchy tree), and the hello-interval statement is a leaf on the tree, which, in this case, contains a data value, the length of the hello interval in seconds.

Figure 3: Configuration Mode Hierarchy of Statements
The CLI represents the statement path shown in Figure 3 as [protocols ospf area area-number interface interface-name], and it displays the configuration as follows:
protocols {
    ospf {
        area 0.0.0.0 {
            interface so-0/0/0 {
                hello-interval 5; 
            }
            interface so-0/0/1 {
                hello-interval 5;
            }
        }
    }
}

The CLI indents each level in the hierarchy to indicate each statement's relative position in the hierarchy and generally sets off each level with braces, using an open brace at the beginning of each hierarchy level and a closing brace at the end. If the statement at a hierarchy level is empty, the braces are not printed. Each leaf statement ends with a semicolon. If the hierarchy does not extend as far as a leaf statement, the last statement in the hierarchy ends with a semicolon.
The CLI uses this indented representation when it displays the current system configuration, and you use this format when creating ASCII files that contain the software configuration. However, the format of ASCII configuration files is not as strict as the CLI output of the configuration. Although the braces and semicolons are required, the indention and use of new lines, as shown above, are not required in ASCII configuration files.

No comments: