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

Mapping for Comments About Configuration Statements

A JUNOS configuration can include comments that describe statements in the configuration. In CLI configuration mode, the annotate command specifies the comment to associate with a statement at the current hierarchy level. You can also use a text editor to insert comments directly into a configuration file. For more information, see the JUNOS CLI User Guide.

The JUNOS XML API encloses comments about configuration statements in the <junos:comment> tag element. (These comments are different from those described in XML Comments , which are enclosed in the strings <!- - and - -> and are automatically discarded by the NETCONF server.)

In the JUNOS XML API, the <junos:comment> tag element immediately precedes the tag element for the associated configuration statement. (If the tag element for the associated statement is omitted, the comment is not recorded in the configuration database.) The comment text string can include one of the two delimiters that indicate a comment in the configuration database: either the # character before the comment or the paired strings /* before the comment and */ after it. If the client application does not include the delimiter, the NETCONF server adds the appropriate one when it adds the comment to the configuration. The NETCONF server also preserves any white space included in the comment.

The following example shows the JUNOS XML tag elements that associate comments with two statements in a sample configuration statement. The first comment illustrates how including newline characters in the contents of the <junos:comment> tag element (/* New backbone area */) results in the comment appearing on its own line in the configuration file. There are no newline characters in the contents of the second <junos:comment> tag element, so in the configuration file the comment directly follows the associated statement on the same line.

Image t1510.gif
[Contents] [Prev] [Next] [Index] [Report an Error]