must-message

Mode: Configuration Mode

Description:

When specifying the must constraint, a must-message should also be specified so that when the contraint is not message, the warning message informs users what the constraints are.

If the must-message is missing, the input file will compile, but the warning message will say "(null)" which won't be helpful for users to fix the problem.

Example 1:

        object newbo {
            help "Testing dependencies";
            must ("gid" && !"newbie description");
            must-message "To configure newbo, newbie gid but not description must be set";
        }

        object newbie {
            help "Newbie section";

            object "description" {
                help "Description";
                type string;
            }

            object gid {
                help "Group ID";
                attribute gname {
                     help "Group Name";
                     type string;
                }
                attribute id {
                    type enum int {
                    choice apg {
                        help "APG user";
                        value 1;
                    }
                    choice ipg {
                        help "IPG user";
                        value 2;
                    }
                }
            }
        }

Display 1:

        user@router# set newbo

        [edit]
        user@router# show 
        version "8.1I0 [user]";
        ##
        ## Warning: To configure newbo, newbie gid but not description must be set
        ##
        newbo;

        [edit]
        user@router# set newbie gid 

        [edit]
        user@router# show 
        version "8.1I0 [user]";
        newbie {
            gid;
        }
        newbo;

        [edit]
        user@router# commit check 
        configuration check succeeds

        [edit]

Example 2:

        object newbo {
            help "Testing dependencies";
            must ("newbie gid" && !"newbie description");
        }

        object newbie {
            help "Newbie section";

            object "description" {
                help "Description";
                type string;
            }

            object gid {
                help "Group ID";
                attribute gname {
                    help "Group Name";
                    type string;
                }
                attribute id {
                    type enum int {
                        choice apg {
                            help "APG user";
                            value 1;
                        }
                        choice ipg {
                            help "IPG user";
                            value 2;
                        }
                    }
                }
            }
        }

Display 2:

        user@router# set newbo
        version "8.1I0 [user]";
        ##
        ## Warning: (null)
        ##
        newbo;

        [edit]

See also:
must

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