Verify Configuration Syntax Using the Junos XML Protocol
In a Junos XML protocol session with a device running Junos OS, during the process of committing the candidate configuration or a private copy, the Junos XML protocol server first confirms that the candidate configuration is syntactically correct. If the syntax check fails, the server does not commit the configuration. To avoid the potential complications of such a failure, it often makes sense to confirm the correctness of the candidate configuration before actually committing it.
To verify the syntax of the candidate configuration prior
to committing it, a client application encloses an empty <check/>
tag in the <commit-configuration>
and <rpc>
tag elements.
<rpc> <commit-configuration> <check/> </commit-configuration> </rpc>
The Junos XML protocol server encloses its response in <rpc-reply>
, <commit-results>
, and <routing-engine>
tag elements.
If the candidate configuration syntax is valid, the <routing-engine>
tag element encloses the <commit-check-success/>
tag and the <name>
tag element, which
reports the name of the Routing Engine on which the check succeeded
(re0 on routing platforms that use a single Routing Engine, and either
re0 or re1 on routing platforms that can have two Routing Engines).
<rpc-reply xmlns:junos="URL"> <commit-results> <routing-engine> <name>(re0 | re1)</name> <commit-check-success/> </routing-engine> </commit-results> </rpc-reply>
If the candidate configuration syntax is not valid, the server
returns an <xnm:error>
element, which
encloses child tag elements that describe the error.
The <check/>
tag can be combined
with the <synchronize/>
tag to verify
the check the syntactic correctness of a local configuration on both
Routing Engines.