Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Automation Scripting User Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

fallback

date_range 13-Jan-21

Syntax

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

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.

content_copy zoom_out_map
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." );
            }
        }
    }
}

Release Information

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

footer-navigation