action parse

Mode: Configuration Mode

Description:

The action parse statement parses the user supplied value and pass it to the parsing function for verification and validation or manipulation during commit time. Usually when users use a value that is predefined in JUNOS, JUNOS does not allow redefining such values, and renamed the user-defined value to a different value, so that the characteristics of the predefined value is preserved.

Example:

src/junos/lib/ddl/junos-actions/junos_foreign.c

        /* mgd_parse_login_class_object()                                 */
        /*                                                                */
        /* There are 5 predefined classes in the /etc/login.conf.sys      */
        /* file, these classes are not allowed to be redefined by the user*/ 
        /* When they are redefined, the user-defined version will         */
        /* be ignored.  In order to avoid the confusion, the predefined   */
        /* class set by the user will be renamed to <classname>-local.    */
        /*                                                                */
        /* This parse action is invoked after the login class object is   */
        /* created. If the target class object contains a predefined class*/
        /* name, the object will be replaced by another class object      */
        /* with the class name <classname>-local.                         */
        /*                                                                */
        /* This action does not get invoked for the copy and rename       */
        /* command.                                                       */
        /*                                                                */

src/junos/lib/ddl/input/system.cnf.dd

        object login-class-object {
            require admin;
            cname ddc_class;
            cprefix dc;
            define DDLAID_DC;
            action parse mgd mgd_parse_login_class_object;
            flag autosort;

            attribute class-name {
                flag nokeyword identifier;
                help "Login class name";
                type string;
                cname dc_identifier;
                match "^[[:alnum:]_-]+$";
                action validate mgd mgd_validate_login_class_name;
            }
        }

Display:

        user@router# show system
        login {
            class readonly {
                permissions all;
            }
            user newbie {
                uid 2000;
                class read-only;
                authentication {
                    encrypted-password "$1$5v2Rn33btoAsOw."; ## SECRET-DATA
                }
            }
        }
        user@router# exit
        $ssh router -l newbie
        Password:
        
        newbie@router> configure
                       ^
        unknown command.

        newbie@router> show configuration system
                            ^
        syntax error.

Topics for further reading:

See also:

Reference (to programmers guide/style guide):


2007-2008 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are trademarks of Juniper Networks, Inc.
Generated on Sun May 30 20:23:12 2010 for DDL Reference Guide by doxygen 1.4.5