r2 - 2008-11-04 - 21:07:23 - MartinBjoerklundYou are here: TWiki >  Main Web > YangExamples > YangExamplesExecdRoutes
submodule execd-routes {

    belongs-to execd { prefix execd; }

    import inet-types { prefix inet; }

    include execd-types;

    description
        "The 'routes' component provides support for configuring static routes
         (IPv4 and IPv6).

         The data model is loosely based on (a subset of) Juniper's, there
         is support for two 'conceptual' routing tables named 'inet' and
         'inet6' (in the actual Linux implementation, these both map to
         the 'main' routing table).";
    
    revision "2008-11-04" {
        description "draft-ietf-netmod-yang-02 compatible.";
    }

    grouping routes {
        container inet {
            list route {
                key "name prefix-length";
                leaf name {
                    type inet:ipv4-address;
                }
                leaf prefix-length {
                    type prefixLengthIPv4;
                }
                leaf description {
                    type string;
                }
                leaf enabled {
                    type boolean;
                    default true;
                }
                leaf type {
                    type enumeration {
                        enum "next-hop";
                        enum "reject";
                        enum "discard";
                        enum "prohibit";
                    }
                    must "$this != 'next-hop' or ../next-hop" {
                        error-message "No next-hop specified for type " +
                                      "'next-hop'";
                    }
                    default next-hop;
                }
                list next-hop {
                    key name;
                    unique metric;
                    max-elements 16;
                    leaf name {
                        type inet:ipv4-address;
                        description "must not be a multicast address";
                    }
                    leaf metric {
                        type int32;
                        default 0;
                    }
                }
            }
        }
        container inet6 {
            list route {
                key "name prefix-length";
                leaf name {
                    type inet:ipv6-address;
                }
                leaf prefix-length {
                    type prefixLengthIPv6;
                }
                leaf description {
                    type string;
                }
                leaf enabled {
                    type boolean;
                    default true;
                }
                leaf type {
                    type enumeration {
                        enum "next-hop";
                        enum "reject";
                    }
                    must "$this != 'next-hop' or ../next-hop" {
                        error-message "No next-hop specified for type " +
                                      "'next-hop'";
                    }
                    must "$this == 'next-hop' or not(../next-hop)" {
                        error-message "Must not specify next-hop with " +
                                      "type '$value'";
                    }
                    default "next-hop";
                }
                list next-hop {
                    key name;
                    unique metric;
                    max-elements 16;
                    leaf name {
                        type inet:ipv6-address;
                        description "must not be a multicast address";
                    }
                    leaf metric {
                        type int32;
                        default 1024;
                    }
                    leaf interface {
                        type interfaceName;
                    }
                    leaf unit {
                        type interfaceLogicalUnit;
                    }
                }
            }
        }
    }
}
  
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