Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

fallback

Syntax

fallback {
   /* body to execute if extension function  
      or element is unavailable */
}

Release Information

Statement introduced in version 1.1 of the SLAX language, which is supported in Junos OS Release 12.2 and later releases.

Description

Specify statements to use when an extension function or element is not available in the current implementation. The fallback statement is enclosed within another instruction element to indicate what fallback code should be run if the script processor does not recognize the enclosing instruction element. The script executes the body of the fallback statement to handle this error condition.

A script might utilize this statement when it is run in environments that support different extension elements.

SLAX Example

The following example op script declares the namespace binding test with a URI of "test". The code attempts to reference the nonexistent extension element <test:fake>, which is not supported, and the code instead executes the fallback instructions.

version 1.1;
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";
ns test extension = "test";


match / {
    <op-script-results> {
        /* Fake extension element */
        <test:fake> {
            expr slax:output( "<test:fake> exists!" );
            fallback {
                expr slax:output( "<test:fake> does not exist." );
            }
        }
    }
}

Published: 2013-07-26

Published: 2013-07-26