must (unique "... <*> ...")

Mode: Configuration Mode

Description:

For element objects (flag setof list), each element is identified by the user-defined name. Many times, it is necessary to examine ddl contents inside these element objects. 'unique' is used to ensure that all the instances of the element objects are unique.

Example 1:

        object newbie {
            help "Newbie section";
            flag setof list;
            product olive;

            attribute name {
                help "Name of the newbie user";
                xml-name newbie-name;
                flag identifier nokeyword;
                type string;
            }
            attribute uid {
                help "Newbie user ID";
                type uint;
                must (unique "newbie <*> uid $$");
                must-message "User ID has to be unique among all users";
            }
        }

Display 1:

        user@router# set newbie fred uid 3;

        [edit]
        user@router@ set newbie felix uid 5

        [edit]
        user@router# show
        version "9.1I0 [user]";
        newbie fred {
            uid 3;
        }
        newbie felix {
            uid 5;
        }
        
        [edit]
        user@router# commit check
        commit check succeeds

        [edit]
        user@router# set newbie felix uid 3

        [edit]
        user@router# show
        version "9.1I0 [user]";
        newbie fred {
        ##
        ## Warning: User ID has to be unique among all users
        ##
            uid 3;
        }
        newbie felix {
        ##
        ## Warning: User ID has to be unique among all users
        ##
            uid 3;
        }

        [edit]
        user@router# commit check
        [edit newbie fred]
           'uid'
              User ID has to be unique among all users
        [edit newbie felix]
           'uid'
              User ID has to be unique among all users
        error: configuration check-out failed

        [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