Hi,
I am newbie in JunOs Automation. I am now trying practice some script in the ebook but it cant run.
Could anyone help me correct this script?
Here are script
/* add-route.slax *
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
import "../import/junos.xsl";
match / {
<op-script-results> {
/* Ask for the static route */
var $static-route = jcs:get-input("Enter the static route: ");
/* Ask for the next-hop */
var $next-hop = jcs:get-input("Enter the next-hop: ");
/* Create the configuration change */
var $configuration = <configuration> {
<routing-options> {
<static> {
<route> {
<name> $static-route;
<next-hop> $next-hop;
}
}
}
}
/* Open a connection */
var $connection = jcs:open();
/* Call jcs:load-configuration and provide the connection and configuration change to make. */
var $results := { call jcs:load-configuration( $connection, $configuration ); }
/* Check for errors – report them if they occurred */
if( $results//xnm:error ) {
for-each( $results//xnm:error ) {
<output> message;
}
}
/* If there are no errors then report success */
if( jcs:empty( $results//xnm:error ) ) {
<output> "Committed without errors.";
}
/* Close the connection */
var $close-results = jcs:close($connection);
}
}
and here are the error message
DatNT@Olive12.1# run op add-route
error: ^
error: error: /var/db/scripts/op/add-route.slax: 1 error detected during parsing
error: error reading stylesheet: add-route.slax
error: /var/db/scripts/op/add-route.slax:4: error: /var/db/scripts/op/add-route.slax:3: parse error, unexpected T_BARE, expecting K_VERSION before 'junos':
error: ^
error: error: /var/db/scripts/op/add-route.slax: 1 error detected during parsing
error: error reading stylesheet: add-route.slax