action validate

Mode: Configuration Mode


When the user input values cannot be validated using simple ddl syntax check (using flags or regular-expression check using match), a C function can be defined to allow additional validations. It also allow error messages to be issued just before values are assigned to attributes.



        /* mgd_validate_source_address:                              */
        /* Verifies that the IPv4 source address is not a multicast  */
        /* or broadcast address                                      */
            char *srcaddr = daap->daa_gram_data->gd_current;

            if (valid_ipv4_hostaddr(srcaddr))
                return 0;

            js_error("source address can not be a broadcast or multicast address");
            return EXPORT_ERROR;


        object newbie {
            help "Newbie settings";

            attribute source-address {
                help "Testing action validate source-address";
                type ipv4addr;
                action validate mgd mgd_validate_source_address;


        user@router# set example newbie source-address ?
        Possible completions:
          <source-address>     Testing action validate source-address
        user@router# set example newbie source-address
        error: invalid value:
        user@router# set example newbie source-address      

        user@router# show example
        newbie {


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