Description

This article describes the issue of the usage of a script, which leads to commit errors when unsupported commands are typed and committed.


Symptoms

  • When entering unsupported commands via the command line and committing them on EX switches, no commit error or warning is displayed; so the user does not know that the unsupported configuration is committed.
  • You can see only the Unsupported Platform error, when the show configuration command is used.
  • This leads to a sense of missing what exactly occurred, as the commit goes through.

Solution


Using a commit script to throw an error, when unsupported commands are used.

For example:

root@switch# set firewall family inet filter x term x from prefix-list x

root@switch2# commit
configuration check succeeds
commit complete
But you can see the error, when viewing the configuration:
root@switch2# show firewall
    family inet {
        filter x {
            term x {
                from {
                    ##
                    ## Warning: configuration block ignored: unsupported platform (ex3200-48t)
                    ##
                    prefix-list {
                        x; ## 'x' is not defined
                }
            }
        }
    }
}

Here, the unsupported.slax commit script is used. The script is in the following location. You can use methods, such as FTP, to get the script on the switch or use vi editor in the switch.
root@switch2:RE:0% cd /var/db/scripts/commit/
root@switch2:RE:0% ls
unsupported.slax
Contents of the script:
root@switch2:RE:0% cat unsupported.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 configuration {
    var $rpc = <get-configuration database="candidate" unsupported="unsupported"> ;
    var $config = jcs:invoke($rpc);

    if ($config//@unsupported) {
        <xnm:error> {
            <message> "Please Remove Unsupported or Hidden Configuration";
        }
    }
}

Install the script, by using the following command :
[edit]
# set system scripts commit file unsupported.slax

The same commit is performed again and the following commit error is noticed:
[edit]
root@switch2# commit
error: Please Remove Unsupported or Hidden Configuration
error: 1 error reported by commit scripts
error: commit script failure