Blob Blame History Raw
module mod5 {

    prefix abc;
    namespace "urn:cesnet:mod5";

    import ietf-yang-library {
        prefix lib;
    }

    rpc rpc_test {
        input {
            container user {
                leaf username {
                    type string {
                        pattern '[a-zA-Z]+';
                    }
                }

                leaf password {
                    type string {
                        length "6..max";
                    }
                }
            }

            container login {
                leaf is_admin {
                    type boolean;
                    default false;
                }

                must "../user/username = 'admin' and " +
                     "../user/password";
            }

            container test {
                leaf test {
                    type empty;
                }

                must "../user/username = 'admin' and " +
                     "/rpc_test/user/password";
            }
        }

        output {
            container login1 {
                leaf is_admin {
                    type boolean;
                    default false;
                }

                must "../user/username = 'admin' and " +
                     "/rpc_test/user/password";
            }

            container user {
                leaf username {
                    type string {
                        pattern '[a-zA-Z]+';
                    }
                }

                leaf password {
                    type string {
                        length "6..max";
                    }
                }
            }
        }
    }

    container interface {

        must "ifType != 'atm' or " +
             "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
            error-message "An atm MTU must be  64 .. 17966";
            reference "Test reference.";
            description "Test description";
            error-app-tag "Error 750";
        }

        leaf ifType {
            type enumeration {
                enum ethernet;
                enum atm;
            }
        }

        leaf ifMTU {
            type uint32;
        }

        must "ifType != 'ethernet' or " +
             "(ifType = 'ethernet' and ifMTU = 1500)" {
            description "Test description";
            reference "Test refrence";
            error-app-tag "Error 750";
            error-message "An ethernet MTU must be 1500";
        }

        container login {
            leaf is_admin {
                type boolean;
                default false;
            }

            must "../../user/username = 'admin' and " +
                 "/user/password  ";
        }
    }

    container user {
        leaf username {
            type string {
                pattern '[a-zA-Z]+';
            }
        }

        leaf password {
            type string {
                length "6..max";
            }
        }

    }

    container state {
        config false;

        leaf error-flag {
            type uint8;
        }

        leaf year {
            type uint16;
            default 1000;
        }

        must "year >=1900 and year <=2150";

        must "../user/username = 'admin' and " +
                 "/user/password  ";

        must "/lib:modules-state/lib:module-set-id = 1";
    }

    notification notif {
        container user {
            leaf username {
                type string {
                    pattern '[a-zA-Z]+';
                }
            }

            leaf password {
                type string {
                    length "6..max";
                }
            }
        }

        container login {
            leaf is_admin {
                type boolean;
                default false;
            }

            must "../user/username = 'admin' and " +
                 "../user/password";
        }

        container test {
            leaf test {
                type empty;
            }

            must "../user/username = 'admin' and " +
                 "/notif/user/password";
        }
    }
}