r2 - 2008-11-04 - 21:09:20 - MartinBjoerklundYou are here: TWiki >  Main Web > YangExamples > YangExamplesExecdNtp
submodule execd-ntp {

    belongs-to execd { prefix execd; }

    import inet-types { prefix inet; }

    include execd-types;
  
    description
        "The 'ntp' component provides support for configuring
         the ntpd daemon from the reference NTP implementation. It
         also provides status information pertaining to the configured
         servers.

         The set of configurable parameters has been limited to
         those that may be generally useful on a network device,
         including

             - remote servers/peers
             - local-clock server
             - access control
             - symmetric-key based authentication";

    revision "2008-11-04" {
        description "draft-ietf-netmod-yang-02 compatible.";
    }
    revision "2007-08-29" {
        description "Syntax fixes after pyang validation.";
    }
    revision "2007-06-08" {
        description "Initial revision.";
    }
    
    grouping ntp {

        // types local to this grouping
        typedef ntpState {
            type enumeration {
                enum "reject";
                enum "falsetick";
                enum "excess";
                enum "outlyer";
                enum "candidate";
                enum "selected";
                enum "syspeer";
                enum "ppspeer";
                enum "unknown";
            }
        }
    
        typedef ntpStratum {
            type uint8 {
                range "0..15";
            }
        }
    
        typedef ntpInvalidStratum {
            type uint8 {
                range "16";
            }
        }
    
        typedef ntpStatusStratum {
            type union {
                type ntpStratum;
                type ntpInvalidStratum;
            }
        }

        typedef ntpDecimal {
            type int32;
            units "milliseconds";
        }

        typedef ntpRestrictName {
            type union {
                type enumeration {
                    enum "default";
                }
                type inet:host;
            }
        }

        typedef ntpRestrictMask {
            type union {
                type enumeration {
                    enum "default";
                }
                type inet:ip-address;
            }
        }

        typedef ntpRestrictFlag {
            type enumeration {
                enum "ignore";
                enum "kod";
                enum "limited";
                enum "lowpriotrap";
                enum "nomodify";
                enum "nopeer";
                enum "noquery";
                enum "noserve";
                enum "notrap";
                enum "notrust";
                enum "ntpport";
                enum "version";
            }
        }            

        typedef ntpKeyValue {
            type string {
                pattern "[!-~]{1,32}";
            }
        }

        grouping ntpStatus {
            leaf state   { type ntpState; }
            leaf stratum { type ntpStratum; }
            leaf reach   { type string; }
            leaf delay   { type ntpDecimal; }
            leaf offset  { type ntpDecimal; }
            leaf jitter  { type ntpDecimal; }
        }
    
        list server {
            key name;
            max-elements 16;
            leaf name     { type inet:host; }
            leaf enabled  { type boolean; default true; }
            leaf peer     { type boolean; default false; }
            leaf iburst   { type empty; }
            leaf version  { type int8 { range "1..4"; } default 4; }
            leaf key      { type keyref { path "../../key/name"; } }
            container status {
                config false;
                uses ntpStatus;
            }
        }
        container local-clock {
            leaf enabled { type boolean; default true; }
            leaf stratum { type ntpStratum; default 10; }
            container status { uses ntpStatus; }
        }
        list restrict { 
            key "name mask";
            max-elements 64;
            leaf name      { type ntpRestrictName; }
            leaf mask      { type ntpRestrictMask; }
            leaf-list flag { type ntpRestrictFlag; }
        }
        list key {
            key name;
            max-elements 64;
            leaf name     { type uint8 { range "1..max"; } }
            leaf value    { type ntpKeyValue; }
            leaf trusted  { type boolean; default true; }
        }
        leaf requestkey { type keyref { path "../key/name"; } }
        leaf controlkey { type keyref { path "../key/name"; } }
    }
}
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
 
YANG
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback