[Contents] [Prev] [Next] [Index] [Report an Error]

# Mapping Configuration Statements to SRC XML Tag Elements

The SRC XML API defines a tag element for every container and leaf statement in the configuration hierarchy. At the top levels of the configuration hierarchy, there is almost always a one-to-one mapping between tag elements and statements, and most tag names match the configuration statement name. At deeper levels of the hierarchy, the mapping is sometimes less direct, because some CLI notational conventions do not map directly to XML-compliant tagging syntax. The following sections describe the mapping between configuration statements and XML tag elements:

- Mapping for Hierarchy Levels and Container Statements
- Mapping for Objects That Have an Identifier
- Mapping for Single-Value and Fixed-Form Leaf Statements
- Mapping for Leaf Statements with Multiple Values

| Note: For some configuration statements, the notation used when you type the statement at the CLI configuration-mode prompt differs from the notation used in a configuration file. The same XML tag element maps to both notational styles.

## Mapping for Hierarchy Levels and Container Statements

The <configuration> tag element is the top-level XML container tag element for configuration statements. It corresponds to the [edit] hierarchy level in CLI configuration mode. Most statements at the next few levels of the configuration hierarchy are container statements. The XML container tag element that corresponds to a container statement almost always has the same name as the statement.

The following example shows the XML tag elements for a statement at the top level of the configuration hierarchy. Note that a closing brace in a CLI configuration statement corresponds to a closing XML tag.

CLI Configuration Statements | SRC XML Tags
--- | ---
system login { ...child statements... } | <configuration> <system> <login> <!-- tags for child statements --> </login> </system> </configuration>

## Mapping for Objects That Have an Identifier

At some hierarchy levels, the same kind of configuration object can occur multiple times. Each instance of the object has a unique identifier to distinguish it from the other instances. In the CLI notation, the parent statement for such an object consists of a keyword and identifier of the following form:

`

    keyword identifier {
        … configuration statements for individual characteristics …
    }

`

keyword is a fixed string that indicates the type of object being defined, and identifier is the unique name for this instance of the type. In the SRC XML API, the tag element corresponding to the keyword is a container tag element for child tag elements that represent the object’s characteristics. The container tag element’s name generally matches the keyword string.

The SRC XML API differs from the CLI in its treatment of the identifier. Because the SRC XML API does not allow container tag elements to contain both other tag elements and untagged character data such as an identifier name, the identifier must be enclosed in a tag element of its own. Most frequently, identifier tag elements for configuration objects are called <name>. Some objects have multiple identifiers, which usually have names other than <name>. To verify the name of each identifier tag element for a configuration object, consult the entry for the object in the SRC XML API Configuration Reference.

| Note: The SRC software reserves the prefix sdx- for the identifiers of configuration groups defined within the sdx-defaults configuration group. User-defined identifiers cannot start with the string sdx-.

Identifier tag elements also constitute an exception to the general XML convention that tag elements at the same level of hierarchy can appear in any order; the identifier tag element always occurs first within the container tag element.

The configuration for most objects that have identifiers includes additional leaf statements, which represent other characteristics of the object. For example, each SAE group configured at the [edit shared sae group] hierarchy level has an associated name (the identifier) and can have leaf statements for other characteristics, such as configuration, DHCP classification script, and subscriber classification script. For information about the XML mapping for leaf statements, see Mapping for Single-Value and Fixed-Form Leaf Statements, Mapping for Leaf Statements with Multiple Values, and Using the Same Configuration Tag Elements in Requests and Responses.

The following example shows the XML tag elements for configuration statements that define two users called U1 and U2. Notice that the XML <user-name> tag element that encloses the identifier of each user does not have a counterpart in the CLI statements. For complete information about changing C Series Controller configurations, see Changing Configuration Information.

CLI Configuration Statements | SRC XML Tags
--- | ---
system login { user U1 { class admin; } user U2 { class admin; } } | <configuration> <system> <login> <user> <user-name>U1</user-name> <!-- identifier --> <class>admin</class> </user> <user> <user-name>U2</user-name> <!-- identifier --> <class>admin</class> </user> </login> </system> </configuration>

## Mapping for Single-Value and Fixed-Form Leaf Statements

A leaf statement is a CLI configuration statement that does not contain any other statements. Most leaf statements define a value for one characteristic of a configuration object and have the following form:

`

keyword value ;

`

In general, the name of the XML tag element corresponding to a leaf statement is the same as the keyword string. The string between the opening and closing XML tags is the same as the value string.

The following example shows the XML tag elements for a leaf statement that has a keyword and a value: the announcement statement at the [edit system login] hierarchy level.

CLI Configuration Statements | SRC XML Tags
--- | ---
system login { announcement “ Authorized users only” ; } | <configuration> <system> <login> <announcement>Authorized users only </announcement> </login> </system> </configuration>

Some leaf statements consist of a fixed-form keyword only, without an associated variable-form value. The SRC XML API represents such statements with an empty tag. The following example shows the XML tag elements for the telnet statement at the [edit system services] hierarchy level.

CLI Configuration Statements | SRC XML Tags
--- | ---
system services { telnet; } | <configuration> <system> <services> <telnet/> </services> </system> </configuration>

## Mapping for Leaf Statements with Multiple Values

Some leaf statements accept multiple values, which can be either user-defined or drawn from a set of predefined values. CLI notation uses square brackets to enclose all values in a single statement, as in the following:

`

statement [ value1 value2 value3 ... ];

`

The SRC XML API instead encloses each value in its own tag element. The following example shows the XML tag elements for a CLI statement with multiple user-defined values. The domain-search statement specifies two domains defined elsewhere in the configuration. For complete information about changing C Series Controller configurations, see Changing Configuration Information.

CLI Configuration Statements | SRC XML Tags
--- | ---
system { domain-search [ jnpr.net juniper.net ]; } | <configuration> <system> <domain-search>jnpr.net</domain-search> <domain-search>juniper.net</domain-search> </system> </configuration>

The following example shows the XML tag elements for a CLI statement with multiple predefined values. The permissions statement grants three predefined permissions to members of the user-accounts login class.

CLI Configuration Statements | SRC XML Tags
--- | ---
system login class user-accounts { permissions [configure admin control]; } | <configuration> <system> <login> <class> <name>user-accounts</name> <permissions>configure</permissions> <permissions>admin</permissions> <permissions>control</permissions> </class> </login> </system> </configuration>

[Contents] [Prev] [Next] [Index] [Report an Error]