Inital commit
This commit is contained in:
parent
edc5e091bb
commit
d6e393ea58
145 changed files with 58117 additions and 0 deletions
114
example/Makefile.in
Normal file
114
example/Makefile.in
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
#
|
||||
# Makefile
|
||||
#
|
||||
# Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
|
||||
#
|
||||
# This file is part of CLICON.
|
||||
#
|
||||
# CLICON is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# CLICON is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with CLICON; see the file COPYING. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
prefix = @prefix@
|
||||
bindir = @bindir@
|
||||
includedir = @includedir@
|
||||
datarootdir = @datarootdir@
|
||||
|
||||
APPNAME = routing
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@ -rdynamic -fPIC
|
||||
|
||||
INCLUDES = -I$(includedir) @INCLUDES@
|
||||
|
||||
BE_PLUGIN = $(APPNAME)_backend.so
|
||||
CLI_PLUGIN = $(APPNAME)_cli.so
|
||||
NETCONF_PLUGIN = $(APPNAME)_netconf.so
|
||||
|
||||
PLUGINS = $(BE_PLUGIN) $(CLI_PLUGIN) $(NETCONF_PLUGIN)
|
||||
|
||||
all: $(PLUGINS) $(APPNAME).conf
|
||||
|
||||
# Note: clicon.mk has a rule for:
|
||||
# $(APPNAME.conf)
|
||||
-include $(DESTDIR)$(datarootdir)/clicon/clicon.mk
|
||||
|
||||
CLISPECS = routing_cli.cli
|
||||
|
||||
YANGSPECS = $(APPNAME).yang
|
||||
YANGSPECS += ietf-yang-types@2013-07-15.yang
|
||||
YANGSPECS += ietf-inet-types@2013-07-15.yang
|
||||
YANGSPECS += ietf-interfaces@2014-05-08.yang
|
||||
YANGSPECS += ietf-ip@2014-06-16.yang
|
||||
YANGSPECS += ietf-routing@2014-10-26.yang
|
||||
YANGSPECS += ietf-ipv4-unicast-routing@2014-10-26.yang
|
||||
YANGSPECS += ietf-ipv6-unicast-routing@2014-10-26.yang
|
||||
|
||||
# Backend plugin
|
||||
BE_SRC = routing_backend.c
|
||||
BE_OBJ = $(BE_SRC:%.c=%.o)
|
||||
$(BE_PLUGIN): $(BE_OBJ)
|
||||
$(CC) -shared -o $@ -lc $<
|
||||
|
||||
# CLI frontend plugin
|
||||
CLI_SRC = routing_cli.c
|
||||
CLI_OBJ = $(CLI_SRC:%.c=%.o)
|
||||
$(CLI_PLUGIN): $(CLI_OBJ)
|
||||
$(CC) -shared -o $@ -lc $^
|
||||
|
||||
# NETCONF frontend plugin
|
||||
NETCONF_SRC = routing_netconf.c
|
||||
NETCONF_OBJ = $(NETCONF_SRC:%.c=%.o)
|
||||
$(NETCONF_PLUGIN): $(NETCONF_OBJ)
|
||||
$(CC) -shared -o $@ -lc $^
|
||||
|
||||
SRC = $(BE_SRC) $(CLI_SRC) $(NETCONF_SRC)
|
||||
OBJS = $(BE_OBJ) $(CLI_OBJ) $(NETCONF_OBJ)
|
||||
|
||||
clean:
|
||||
rm -f $(PLUGINS) $(OBJS) $(APPNAME).conf
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile *~ .depend
|
||||
|
||||
install: $(YANGSPECS) $(CLISPECS) $(BE_PLUGIN) $(CLI_PLUGIN) $(NETCONF_PLUGIN) $(APPNAME).conf
|
||||
install -d $(DESTDIR)$(clicon_SYSCONFDIR)
|
||||
install $(APPNAME).conf $(DESTDIR)$(clicon_SYSCONFDIR)
|
||||
install -d $(DESTDIR)$(clicon_DBSPECDIR)/yang
|
||||
install $(YANGSPECS) $(DESTDIR)$(clicon_DBSPECDIR)/yang
|
||||
install -d $(DESTDIR)$(clicon_LIBDIR)/cli
|
||||
install $(CLI_PLUGIN) $(DESTDIR)$(clicon_LIBDIR)/cli;
|
||||
install -d $(DESTDIR)$(clicon_LIBDIR)/backend
|
||||
install $(BE_PLUGIN) $(DESTDIR)$(clicon_LIBDIR)/backend;
|
||||
install -d $(DESTDIR)$(clicon_LIBDIR)/netconf
|
||||
install $(NETCONF_PLUGIN) $(DESTDIR)$(clicon_LIBDIR)/netconf;
|
||||
install -d $(DESTDIR)$(clicon_LIBDIR)/clispec
|
||||
install $(CLISPECS) $(DESTDIR)$(clicon_LIBDIR)/clispec;
|
||||
install -d $(DESTDIR)$(clicon_LOCALSTATEDIR)
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(clicon_SYSCONFDIR)/$(APPNAME).conf
|
||||
rm -rf $(DESTDIR)$(clicon_DBSPECDIR)
|
||||
rm -rf $(DESTDIR)$(clicon_LOCALSTATEDIR)
|
||||
rm -rf $(DESTDIR)$(clicon_LIBDIR)
|
||||
|
||||
install-include:
|
||||
|
||||
depend:
|
||||
$(CC) $(DEPENDFLAGS) $(INCLUDES) $(CFLAGS) -MM $(SRC) > .depend
|
||||
|
||||
#include .depend
|
||||
|
||||
27
example/README
Normal file
27
example/README
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
Examples using netconf
|
||||
|
||||
<rpc><edit-config><target><candidate/></target><config>
|
||||
<interfaces>
|
||||
<interface>
|
||||
<name>eth1</name>
|
||||
<enabled>true</enabled>
|
||||
<ipv4>
|
||||
<address>
|
||||
<ip>9.2.3.4</ip>
|
||||
<prefix-length>24</prefix-length>
|
||||
</address>
|
||||
</ipv4>
|
||||
</interface>
|
||||
</interfaces>
|
||||
</config></edit-config></rpc>]]>]]>
|
||||
|
||||
* no filter + no config
|
||||
<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>
|
||||
* filter subnet + no config:
|
||||
<rpc><get-config><source><candidate/></source><filter/></get-config></rpc>]]>]]>
|
||||
* filter xpath + no select:
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath"/></get-config></rpc>]]>]]>
|
||||
* filter subnet + config:
|
||||
<rpc><get-config><source><candidate/></source><filter type="subtree"><configuration><interfaces><interface><ipv4/></interface></interfaces></configuration></filter></get-config></rpc>]]>]]>
|
||||
* filter xpath + select:
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface/ipv4"/></get-config></rpc>]]>]]>
|
||||
457
example/ietf-inet-types@2013-07-15.yang
Normal file
457
example/ietf-inet-types@2013-07-15.yang
Normal file
|
|
@ -0,0 +1,457 @@
|
|||
module ietf-inet-types {
|
||||
|
||||
namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";
|
||||
prefix "inet";
|
||||
|
||||
organization
|
||||
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
|
||||
|
||||
contact
|
||||
"WG Web: <http://tools.ietf.org/wg/netmod/>
|
||||
WG List: <mailto:netmod@ietf.org>
|
||||
|
||||
WG Chair: David Kessens
|
||||
<mailto:david.kessens@nsn.com>
|
||||
|
||||
WG Chair: Juergen Schoenwaelder
|
||||
<mailto:j.schoenwaelder@jacobs-university.de>
|
||||
|
||||
Editor: Juergen Schoenwaelder
|
||||
<mailto:j.schoenwaelder@jacobs-university.de>";
|
||||
|
||||
description
|
||||
"This module contains a collection of generally useful derived
|
||||
YANG data types for Internet addresses and related things.
|
||||
|
||||
Copyright (c) 2013 IETF Trust and the persons identified as
|
||||
authors of the code. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, is permitted pursuant to, and subject
|
||||
to the license terms contained in, the Simplified BSD License
|
||||
set forth in Section 4.c of the IETF Trust's Legal Provisions
|
||||
Relating to IETF Documents
|
||||
(http://trustee.ietf.org/license-info).
|
||||
|
||||
This version of this YANG module is part of RFC 6991; see
|
||||
the RFC itself for full legal notices.";
|
||||
|
||||
revision 2013-07-15 {
|
||||
description
|
||||
"This revision adds the following new data types:
|
||||
- ip-address-no-zone
|
||||
- ipv4-address-no-zone
|
||||
- ipv6-address-no-zone";
|
||||
reference
|
||||
"RFC 6991: Common YANG Data Types";
|
||||
}
|
||||
|
||||
revision 2010-09-24 {
|
||||
description
|
||||
"Initial revision.";
|
||||
reference
|
||||
"RFC 6021: Common YANG Data Types";
|
||||
}
|
||||
|
||||
/*** collection of types related to protocol fields ***/
|
||||
|
||||
typedef ip-version {
|
||||
type enumeration {
|
||||
enum unknown {
|
||||
value "0";
|
||||
description
|
||||
"An unknown or unspecified version of the Internet
|
||||
protocol.";
|
||||
}
|
||||
enum ipv4 {
|
||||
value "1";
|
||||
description
|
||||
"The IPv4 protocol as defined in RFC 791.";
|
||||
}
|
||||
enum ipv6 {
|
||||
value "2";
|
||||
description
|
||||
"The IPv6 protocol as defined in RFC 2460.";
|
||||
}
|
||||
}
|
||||
description
|
||||
"This value represents the version of the IP protocol.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the InetVersion textual convention of the SMIv2.";
|
||||
reference
|
||||
"RFC 791: Internet Protocol
|
||||
RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
|
||||
RFC 4001: Textual Conventions for Internet Network Addresses";
|
||||
}
|
||||
|
||||
typedef dscp {
|
||||
type uint8 {
|
||||
range "0..63";
|
||||
}
|
||||
description
|
||||
"The dscp type represents a Differentiated Services Code Point
|
||||
that may be used for marking packets in a traffic stream.
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the Dscp textual convention of the SMIv2.";
|
||||
reference
|
||||
"RFC 3289: Management Information Base for the Differentiated
|
||||
Services Architecture
|
||||
RFC 2474: Definition of the Differentiated Services Field
|
||||
(DS Field) in the IPv4 and IPv6 Headers
|
||||
RFC 2780: IANA Allocation Guidelines For Values In
|
||||
the Internet Protocol and Related Headers";
|
||||
}
|
||||
|
||||
typedef ipv6-flow-label {
|
||||
type uint32 {
|
||||
range "0..1048575";
|
||||
}
|
||||
description
|
||||
"The ipv6-flow-label type represents the flow identifier or Flow
|
||||
Label in an IPv6 packet header that may be used to
|
||||
discriminate traffic flows.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the IPv6FlowLabel textual convention of the SMIv2.";
|
||||
reference
|
||||
"RFC 3595: Textual Conventions for IPv6 Flow Label
|
||||
RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
|
||||
}
|
||||
|
||||
typedef port-number {
|
||||
type uint16 {
|
||||
range "0..65535";
|
||||
}
|
||||
description
|
||||
"The port-number type represents a 16-bit port number of an
|
||||
Internet transport-layer protocol such as UDP, TCP, DCCP, or
|
||||
SCTP. Port numbers are assigned by IANA. A current list of
|
||||
all assignments is available from <http://www.iana.org/>.
|
||||
|
||||
Note that the port number value zero is reserved by IANA. In
|
||||
situations where the value zero does not make sense, it can
|
||||
be excluded by subtyping the port-number type.
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the InetPortNumber textual convention of the SMIv2.";
|
||||
reference
|
||||
"RFC 768: User Datagram Protocol
|
||||
RFC 793: Transmission Control Protocol
|
||||
RFC 4960: Stream Control Transmission Protocol
|
||||
RFC 4340: Datagram Congestion Control Protocol (DCCP)
|
||||
RFC 4001: Textual Conventions for Internet Network Addresses";
|
||||
}
|
||||
|
||||
/*** collection of types related to autonomous systems ***/
|
||||
|
||||
typedef as-number {
|
||||
type uint32;
|
||||
description
|
||||
"The as-number type represents autonomous system numbers
|
||||
which identify an Autonomous System (AS). An AS is a set
|
||||
of routers under a single technical administration, using
|
||||
an interior gateway protocol and common metrics to route
|
||||
packets within the AS, and using an exterior gateway
|
||||
protocol to route packets to other ASes. IANA maintains
|
||||
the AS number space and has delegated large parts to the
|
||||
regional registries.
|
||||
|
||||
Autonomous system numbers were originally limited to 16
|
||||
bits. BGP extensions have enlarged the autonomous system
|
||||
number space to 32 bits. This type therefore uses an uint32
|
||||
base type without a range restriction in order to support
|
||||
a larger autonomous system number space.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the InetAutonomousSystemNumber textual convention of
|
||||
the SMIv2.";
|
||||
reference
|
||||
"RFC 1930: Guidelines for creation, selection, and registration
|
||||
of an Autonomous System (AS)
|
||||
RFC 4271: A Border Gateway Protocol 4 (BGP-4)
|
||||
RFC 4001: Textual Conventions for Internet Network Addresses
|
||||
RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
|
||||
Number Space";
|
||||
}
|
||||
|
||||
/*** collection of types related to IP addresses and hostnames ***/
|
||||
|
||||
typedef ip-address {
|
||||
type union {
|
||||
type inet:ipv4-address;
|
||||
type inet:ipv6-address;
|
||||
}
|
||||
description
|
||||
"The ip-address type represents an IP address and is IP
|
||||
version neutral. The format of the textual representation
|
||||
implies the IP version. This type supports scoped addresses
|
||||
by allowing zone identifiers in the address format.";
|
||||
reference
|
||||
"RFC 4007: IPv6 Scoped Address Architecture";
|
||||
}
|
||||
|
||||
typedef ipv4-address {
|
||||
type string {
|
||||
pattern
|
||||
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
|
||||
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
|
||||
+ '(%[\p{N}\p{L}]+)?';
|
||||
}
|
||||
description
|
||||
"The ipv4-address type represents an IPv4 address in
|
||||
dotted-quad notation. The IPv4 address may include a zone
|
||||
index, separated by a % sign.
|
||||
|
||||
The zone index is used to disambiguate identical address
|
||||
values. For link-local addresses, the zone index will
|
||||
typically be the interface index number or the name of an
|
||||
interface. If the zone index is not present, the default
|
||||
zone of the device will be used.
|
||||
|
||||
The canonical format for the zone index is the numerical
|
||||
format";
|
||||
}
|
||||
|
||||
typedef ipv6-address {
|
||||
type string {
|
||||
pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
|
||||
+ '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
|
||||
+ '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
|
||||
+ '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
|
||||
+ '(%[\p{N}\p{L}]+)?';
|
||||
pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
|
||||
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
|
||||
+ '(%.+)?';
|
||||
}
|
||||
description
|
||||
"The ipv6-address type represents an IPv6 address in full,
|
||||
mixed, shortened, and shortened-mixed notation. The IPv6
|
||||
address may include a zone index, separated by a % sign.
|
||||
|
||||
The zone index is used to disambiguate identical address
|
||||
values. For link-local addresses, the zone index will
|
||||
typically be the interface index number or the name of an
|
||||
interface. If the zone index is not present, the default
|
||||
zone of the device will be used.
|
||||
|
||||
The canonical format of IPv6 addresses uses the textual
|
||||
representation defined in Section 4 of RFC 5952. The
|
||||
canonical format for the zone index is the numerical
|
||||
format as described in Section 11.2 of RFC 4007.";
|
||||
reference
|
||||
"RFC 4291: IP Version 6 Addressing Architecture
|
||||
RFC 4007: IPv6 Scoped Address Architecture
|
||||
RFC 5952: A Recommendation for IPv6 Address Text
|
||||
Representation";
|
||||
}
|
||||
|
||||
typedef ip-address-no-zone {
|
||||
type union {
|
||||
type inet:ipv4-address-no-zone;
|
||||
type inet:ipv6-address-no-zone;
|
||||
}
|
||||
description
|
||||
"The ip-address-no-zone type represents an IP address and is
|
||||
IP version neutral. The format of the textual representation
|
||||
implies the IP version. This type does not support scoped
|
||||
addresses since it does not allow zone identifiers in the
|
||||
address format.";
|
||||
reference
|
||||
"RFC 4007: IPv6 Scoped Address Architecture";
|
||||
}
|
||||
|
||||
typedef ipv4-address-no-zone {
|
||||
type inet:ipv4-address {
|
||||
pattern '[0-9\.]*';
|
||||
}
|
||||
description
|
||||
"An IPv4 address without a zone index. This type, derived from
|
||||
ipv4-address, may be used in situations where the zone is
|
||||
known from the context and hence no zone index is needed.";
|
||||
}
|
||||
|
||||
typedef ipv6-address-no-zone {
|
||||
type inet:ipv6-address {
|
||||
pattern '[0-9a-fA-F:\.]*';
|
||||
}
|
||||
description
|
||||
"An IPv6 address without a zone index. This type, derived from
|
||||
ipv6-address, may be used in situations where the zone is
|
||||
known from the context and hence no zone index is needed.";
|
||||
reference
|
||||
"RFC 4291: IP Version 6 Addressing Architecture
|
||||
RFC 4007: IPv6 Scoped Address Architecture
|
||||
RFC 5952: A Recommendation for IPv6 Address Text
|
||||
Representation";
|
||||
}
|
||||
|
||||
typedef ip-prefix {
|
||||
type union {
|
||||
type inet:ipv4-prefix;
|
||||
type inet:ipv6-prefix;
|
||||
}
|
||||
description
|
||||
"The ip-prefix type represents an IP prefix and is IP
|
||||
version neutral. The format of the textual representations
|
||||
implies the IP version.";
|
||||
}
|
||||
|
||||
typedef ipv4-prefix {
|
||||
type string {
|
||||
pattern
|
||||
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
|
||||
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
|
||||
+ '/(([0-9])|([1-2][0-9])|(3[0-2]))';
|
||||
}
|
||||
description
|
||||
"The ipv4-prefix type represents an IPv4 address prefix.
|
||||
The prefix length is given by the number following the
|
||||
slash character and must be less than or equal to 32.
|
||||
|
||||
A prefix length value of n corresponds to an IP address
|
||||
mask that has n contiguous 1-bits from the most
|
||||
significant bit (MSB) and all other bits set to 0.
|
||||
|
||||
The canonical format of an IPv4 prefix has all bits of
|
||||
the IPv4 address set to zero that are not part of the
|
||||
IPv4 prefix.";
|
||||
}
|
||||
|
||||
typedef ipv6-prefix {
|
||||
type string {
|
||||
pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
|
||||
+ '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
|
||||
+ '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
|
||||
+ '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
|
||||
+ '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
|
||||
pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
|
||||
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
|
||||
+ '(/.+)';
|
||||
}
|
||||
description
|
||||
"The ipv6-prefix type represents an IPv6 address prefix.
|
||||
The prefix length is given by the number following the
|
||||
slash character and must be less than or equal to 128.
|
||||
|
||||
A prefix length value of n corresponds to an IP address
|
||||
mask that has n contiguous 1-bits from the most
|
||||
significant bit (MSB) and all other bits set to 0.
|
||||
|
||||
The IPv6 address should have all bits that do not belong
|
||||
to the prefix set to zero.
|
||||
|
||||
The canonical format of an IPv6 prefix has all bits of
|
||||
the IPv6 address set to zero that are not part of the
|
||||
IPv6 prefix. Furthermore, the IPv6 address is represented
|
||||
as defined in Section 4 of RFC 5952.";
|
||||
reference
|
||||
"RFC 5952: A Recommendation for IPv6 Address Text
|
||||
Representation";
|
||||
}
|
||||
|
||||
/*** collection of domain name and URI types ***/
|
||||
|
||||
typedef domain-name {
|
||||
type string {
|
||||
pattern
|
||||
'((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
|
||||
+ '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
|
||||
+ '|\.';
|
||||
length "1..253";
|
||||
}
|
||||
description
|
||||
"The domain-name type represents a DNS domain name. The
|
||||
name SHOULD be fully qualified whenever possible.
|
||||
|
||||
Internet domain names are only loosely specified. Section
|
||||
3.5 of RFC 1034 recommends a syntax (modified in Section
|
||||
2.1 of RFC 1123). The pattern above is intended to allow
|
||||
for current practice in domain name use, and some possible
|
||||
future expansion. It is designed to hold various types of
|
||||
domain names, including names used for A or AAAA records
|
||||
(host names) and other records, such as SRV records. Note
|
||||
that Internet host names have a stricter syntax (described
|
||||
in RFC 952) than the DNS recommendations in RFCs 1034 and
|
||||
1123, and that systems that want to store host names in
|
||||
schema nodes using the domain-name type are recommended to
|
||||
adhere to this stricter standard to ensure interoperability.
|
||||
|
||||
The encoding of DNS names in the DNS protocol is limited
|
||||
to 255 characters. Since the encoding consists of labels
|
||||
prefixed by a length bytes and there is a trailing NULL
|
||||
byte, only 253 characters can appear in the textual dotted
|
||||
notation.
|
||||
|
||||
The description clause of schema nodes using the domain-name
|
||||
type MUST describe when and how these names are resolved to
|
||||
IP addresses. Note that the resolution of a domain-name value
|
||||
may require to query multiple DNS records (e.g., A for IPv4
|
||||
and AAAA for IPv6). The order of the resolution process and
|
||||
which DNS record takes precedence can either be defined
|
||||
explicitly or may depend on the configuration of the
|
||||
resolver.
|
||||
|
||||
Domain-name values use the US-ASCII encoding. Their canonical
|
||||
format uses lowercase US-ASCII characters. Internationalized
|
||||
domain names MUST be A-labels as per RFC 5890.";
|
||||
reference
|
||||
"RFC 952: DoD Internet Host Table Specification
|
||||
RFC 1034: Domain Names - Concepts and Facilities
|
||||
RFC 1123: Requirements for Internet Hosts -- Application
|
||||
and Support
|
||||
RFC 2782: A DNS RR for specifying the location of services
|
||||
(DNS SRV)
|
||||
RFC 5890: Internationalized Domain Names in Applications
|
||||
(IDNA): Definitions and Document Framework";
|
||||
}
|
||||
|
||||
typedef host {
|
||||
type union {
|
||||
type inet:ip-address;
|
||||
type inet:domain-name;
|
||||
}
|
||||
description
|
||||
"The host type represents either an IP address or a DNS
|
||||
domain name.";
|
||||
}
|
||||
|
||||
typedef uri {
|
||||
type string;
|
||||
description
|
||||
"The uri type represents a Uniform Resource Identifier
|
||||
(URI) as defined by STD 66.
|
||||
|
||||
Objects using the uri type MUST be in US-ASCII encoding,
|
||||
and MUST be normalized as described by RFC 3986 Sections
|
||||
6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary
|
||||
percent-encoding is removed, and all case-insensitive
|
||||
characters are set to lowercase except for hexadecimal
|
||||
digits, which are normalized to uppercase as described in
|
||||
Section 6.2.2.1.
|
||||
|
||||
The purpose of this normalization is to help provide
|
||||
unique URIs. Note that this normalization is not
|
||||
sufficient to provide uniqueness. Two URIs that are
|
||||
textually distinct after this normalization may still be
|
||||
equivalent.
|
||||
|
||||
Objects using the uri type may restrict the schemes that
|
||||
they permit. For example, 'data:' and 'urn:' schemes
|
||||
might not be appropriate.
|
||||
|
||||
A zero-length URI is not a valid URI. This can be used to
|
||||
express 'URI absent' where required.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the Uri SMIv2 textual convention defined in RFC 5017.";
|
||||
reference
|
||||
"RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
|
||||
RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
|
||||
Group: Uniform Resource Identifiers (URIs), URLs,
|
||||
and Uniform Resource Names (URNs): Clarifications
|
||||
and Recommendations
|
||||
RFC 5017: MIB Textual Conventions for Uniform Resource
|
||||
Identifiers (URIs)";
|
||||
}
|
||||
|
||||
}
|
||||
698
example/ietf-interfaces@2014-05-08.yang
Normal file
698
example/ietf-interfaces@2014-05-08.yang
Normal file
|
|
@ -0,0 +1,698 @@
|
|||
module ietf-interfaces {
|
||||
|
||||
namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces";
|
||||
prefix if;
|
||||
|
||||
import ietf-yang-types {
|
||||
prefix yang;
|
||||
}
|
||||
|
||||
organization
|
||||
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
|
||||
|
||||
contact
|
||||
"WG Web: <http://tools.ietf.org/wg/netmod/>
|
||||
WG List: <mailto:netmod@ietf.org>
|
||||
|
||||
WG Chair: Thomas Nadeau
|
||||
<mailto:tnadeau@lucidvision.com>
|
||||
|
||||
WG Chair: Juergen Schoenwaelder
|
||||
<mailto:j.schoenwaelder@jacobs-university.de>
|
||||
|
||||
Editor: Martin Bjorklund
|
||||
<mailto:mbj@tail-f.com>";
|
||||
|
||||
description
|
||||
"This module contains a collection of YANG definitions for
|
||||
managing network interfaces.
|
||||
|
||||
Copyright (c) 2014 IETF Trust and the persons identified as
|
||||
authors of the code. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, is permitted pursuant to, and subject
|
||||
to the license terms contained in, the Simplified BSD License
|
||||
set forth in Section 4.c of the IETF Trust's Legal Provisions
|
||||
Relating to IETF Documents
|
||||
(http://trustee.ietf.org/license-info).
|
||||
|
||||
This version of this YANG module is part of RFC 7223; see
|
||||
the RFC itself for full legal notices.";
|
||||
|
||||
revision 2014-05-08 {
|
||||
description
|
||||
"Initial revision.";
|
||||
reference
|
||||
"RFC 7223: A YANG Data Model for Interface Management";
|
||||
}
|
||||
|
||||
/*
|
||||
* Typedefs
|
||||
*/
|
||||
|
||||
typedef interface-ref {
|
||||
type leafref {
|
||||
path "/if:interfaces/if:interface/if:name";
|
||||
}
|
||||
description
|
||||
"This type is used by data models that need to reference
|
||||
configured interfaces.";
|
||||
}
|
||||
|
||||
typedef interface-state-ref {
|
||||
type leafref {
|
||||
path "/if:interfaces-state/if:interface/if:name";
|
||||
}
|
||||
description
|
||||
"This type is used by data models that need to reference
|
||||
the operationally present interfaces.";
|
||||
}
|
||||
|
||||
/*
|
||||
* Identities
|
||||
*/
|
||||
|
||||
identity interface-type {
|
||||
description
|
||||
"Base identity from which specific interface types are
|
||||
derived.";
|
||||
}
|
||||
|
||||
/*
|
||||
* Features
|
||||
*/
|
||||
|
||||
feature arbitrary-names {
|
||||
description
|
||||
"This feature indicates that the device allows user-controlled
|
||||
interfaces to be named arbitrarily.";
|
||||
}
|
||||
|
||||
feature pre-provisioning {
|
||||
description
|
||||
"This feature indicates that the device supports
|
||||
pre-provisioning of interface configuration, i.e., it is
|
||||
possible to configure an interface whose physical interface
|
||||
hardware is not present on the device.";
|
||||
}
|
||||
|
||||
feature if-mib {
|
||||
description
|
||||
"This feature indicates that the device implements
|
||||
the IF-MIB.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB";
|
||||
}
|
||||
|
||||
/*
|
||||
* Configuration data nodes
|
||||
*/
|
||||
|
||||
container interfaces {
|
||||
description
|
||||
"Interface configuration parameters.";
|
||||
|
||||
list interface {
|
||||
key "name";
|
||||
|
||||
description
|
||||
"The list of configured interfaces on the device.
|
||||
|
||||
The operational state of an interface is available in the
|
||||
/interfaces-state/interface list. If the configuration of a
|
||||
system-controlled interface cannot be used by the system
|
||||
(e.g., the interface hardware present does not match the
|
||||
interface type), then the configuration is not applied to
|
||||
the system-controlled interface shown in the
|
||||
/interfaces-state/interface list. If the configuration
|
||||
of a user-controlled interface cannot be used by the system,
|
||||
the configured interface is not instantiated in the
|
||||
/interfaces-state/interface list.";
|
||||
|
||||
leaf name {
|
||||
type string;
|
||||
description
|
||||
"The name of the interface.
|
||||
|
||||
A device MAY restrict the allowed values for this leaf,
|
||||
possibly depending on the type of the interface.
|
||||
|
||||
For system-controlled interfaces, this leaf is the
|
||||
device-specific name of the interface. The 'config false'
|
||||
list /interfaces-state/interface contains the currently
|
||||
existing interfaces on the device.
|
||||
|
||||
If a client tries to create configuration for a
|
||||
system-controlled interface that is not present in the
|
||||
/interfaces-state/interface list, the server MAY reject
|
||||
the request if the implementation does not support
|
||||
pre-provisioning of interfaces or if the name refers to
|
||||
an interface that can never exist in the system. A
|
||||
NETCONF server MUST reply with an rpc-error with the
|
||||
error-tag 'invalid-value' in this case.
|
||||
|
||||
If the device supports pre-provisioning of interface
|
||||
configuration, the 'pre-provisioning' feature is
|
||||
advertised.
|
||||
|
||||
If the device allows arbitrarily named user-controlled
|
||||
interfaces, the 'arbitrary-names' feature is advertised.
|
||||
|
||||
When a configured user-controlled interface is created by
|
||||
the system, it is instantiated with the same name in the
|
||||
/interface-state/interface list.";
|
||||
}
|
||||
|
||||
leaf description {
|
||||
type string;
|
||||
description
|
||||
"A textual description of the interface.
|
||||
|
||||
A server implementation MAY map this leaf to the ifAlias
|
||||
MIB object. Such an implementation needs to use some
|
||||
mechanism to handle the differences in size and characters
|
||||
allowed between this leaf and ifAlias. The definition of
|
||||
such a mechanism is outside the scope of this document.
|
||||
|
||||
Since ifAlias is defined to be stored in non-volatile
|
||||
storage, the MIB implementation MUST map ifAlias to the
|
||||
value of 'description' in the persistently stored
|
||||
datastore.
|
||||
|
||||
Specifically, if the device supports ':startup', when
|
||||
ifAlias is read the device MUST return the value of
|
||||
'description' in the 'startup' datastore, and when it is
|
||||
written, it MUST be written to the 'running' and 'startup'
|
||||
datastores. Note that it is up to the implementation to
|
||||
|
||||
decide whether to modify this single leaf in 'startup' or
|
||||
perform an implicit copy-config from 'running' to
|
||||
'startup'.
|
||||
|
||||
If the device does not support ':startup', ifAlias MUST
|
||||
be mapped to the 'description' leaf in the 'running'
|
||||
datastore.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifAlias";
|
||||
}
|
||||
|
||||
leaf type {
|
||||
type identityref {
|
||||
base interface-type;
|
||||
}
|
||||
mandatory true;
|
||||
description
|
||||
"The type of the interface.
|
||||
|
||||
When an interface entry is created, a server MAY
|
||||
initialize the type leaf with a valid value, e.g., if it
|
||||
is possible to derive the type from the name of the
|
||||
interface.
|
||||
|
||||
If a client tries to set the type of an interface to a
|
||||
value that can never be used by the system, e.g., if the
|
||||
type is not supported or if the type does not match the
|
||||
name of the interface, the server MUST reject the request.
|
||||
A NETCONF server MUST reply with an rpc-error with the
|
||||
error-tag 'invalid-value' in this case.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifType";
|
||||
}
|
||||
|
||||
leaf enabled {
|
||||
type boolean;
|
||||
default "true";
|
||||
description
|
||||
"This leaf contains the configured, desired state of the
|
||||
interface.
|
||||
|
||||
Systems that implement the IF-MIB use the value of this
|
||||
leaf in the 'running' datastore to set
|
||||
IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry
|
||||
has been initialized, as described in RFC 2863.
|
||||
|
||||
Changes in this leaf in the 'running' datastore are
|
||||
reflected in ifAdminStatus, but if ifAdminStatus is
|
||||
changed over SNMP, this leaf is not affected.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifAdminStatus";
|
||||
}
|
||||
|
||||
leaf link-up-down-trap-enable {
|
||||
if-feature if-mib;
|
||||
type enumeration {
|
||||
enum enabled {
|
||||
value 1;
|
||||
}
|
||||
enum disabled {
|
||||
value 2;
|
||||
}
|
||||
}
|
||||
description
|
||||
"Controls whether linkUp/linkDown SNMP notifications
|
||||
should be generated for this interface.
|
||||
|
||||
If this node is not configured, the value 'enabled' is
|
||||
operationally used by the server for interfaces that do
|
||||
not operate on top of any other interface (i.e., there are
|
||||
no 'lower-layer-if' entries), and 'disabled' otherwise.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB -
|
||||
ifLinkUpDownTrapEnable";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Operational state data nodes
|
||||
*/
|
||||
|
||||
container interfaces-state {
|
||||
config false;
|
||||
description
|
||||
"Data nodes for the operational state of interfaces.";
|
||||
|
||||
list interface {
|
||||
key "name";
|
||||
|
||||
description
|
||||
"The list of interfaces on the device.
|
||||
|
||||
System-controlled interfaces created by the system are
|
||||
always present in this list, whether they are configured or
|
||||
not.";
|
||||
|
||||
leaf name {
|
||||
type string;
|
||||
description
|
||||
"The name of the interface.
|
||||
|
||||
A server implementation MAY map this leaf to the ifName
|
||||
MIB object. Such an implementation needs to use some
|
||||
mechanism to handle the differences in size and characters
|
||||
allowed between this leaf and ifName. The definition of
|
||||
such a mechanism is outside the scope of this document.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifName";
|
||||
}
|
||||
|
||||
leaf type {
|
||||
type identityref {
|
||||
base interface-type;
|
||||
}
|
||||
mandatory true;
|
||||
description
|
||||
"The type of the interface.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifType";
|
||||
}
|
||||
|
||||
leaf admin-status {
|
||||
if-feature if-mib;
|
||||
type enumeration {
|
||||
enum up {
|
||||
value 1;
|
||||
description
|
||||
"Ready to pass packets.";
|
||||
}
|
||||
enum down {
|
||||
value 2;
|
||||
description
|
||||
"Not ready to pass packets and not in some test mode.";
|
||||
}
|
||||
|
||||
enum testing {
|
||||
value 3;
|
||||
description
|
||||
"In some test mode.";
|
||||
}
|
||||
}
|
||||
mandatory true;
|
||||
description
|
||||
"The desired state of the interface.
|
||||
|
||||
This leaf has the same read semantics as ifAdminStatus.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifAdminStatus";
|
||||
}
|
||||
|
||||
leaf oper-status {
|
||||
type enumeration {
|
||||
enum up {
|
||||
value 1;
|
||||
description
|
||||
"Ready to pass packets.";
|
||||
}
|
||||
enum down {
|
||||
value 2;
|
||||
description
|
||||
"The interface does not pass any packets.";
|
||||
}
|
||||
enum testing {
|
||||
value 3;
|
||||
description
|
||||
"In some test mode. No operational packets can
|
||||
be passed.";
|
||||
}
|
||||
enum unknown {
|
||||
value 4;
|
||||
description
|
||||
"Status cannot be determined for some reason.";
|
||||
}
|
||||
enum dormant {
|
||||
value 5;
|
||||
description
|
||||
"Waiting for some external event.";
|
||||
}
|
||||
enum not-present {
|
||||
value 6;
|
||||
description
|
||||
"Some component (typically hardware) is missing.";
|
||||
}
|
||||
|
||||
enum lower-layer-down {
|
||||
value 7;
|
||||
description
|
||||
"Down due to state of lower-layer interface(s).";
|
||||
}
|
||||
}
|
||||
mandatory true;
|
||||
description
|
||||
"The current operational state of the interface.
|
||||
|
||||
This leaf has the same semantics as ifOperStatus.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifOperStatus";
|
||||
}
|
||||
|
||||
leaf last-change {
|
||||
type yang:date-and-time;
|
||||
description
|
||||
"The time the interface entered its current operational
|
||||
state. If the current state was entered prior to the
|
||||
last re-initialization of the local network management
|
||||
subsystem, then this node is not present.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifLastChange";
|
||||
}
|
||||
|
||||
leaf if-index {
|
||||
if-feature if-mib;
|
||||
type int32 {
|
||||
range "1..2147483647";
|
||||
}
|
||||
mandatory true;
|
||||
description
|
||||
"The ifIndex value for the ifEntry represented by this
|
||||
interface.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifIndex";
|
||||
}
|
||||
|
||||
leaf phys-address {
|
||||
type yang:phys-address;
|
||||
description
|
||||
"The interface's address at its protocol sub-layer. For
|
||||
example, for an 802.x interface, this object normally
|
||||
contains a Media Access Control (MAC) address. The
|
||||
interface's media-specific modules must define the bit
|
||||
and byte ordering and the format of the value of this
|
||||
object. For interfaces that do not have such an address
|
||||
(e.g., a serial line), this node is not present.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifPhysAddress";
|
||||
}
|
||||
|
||||
leaf-list higher-layer-if {
|
||||
type interface-state-ref;
|
||||
description
|
||||
"A list of references to interfaces layered on top of this
|
||||
interface.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifStackTable";
|
||||
}
|
||||
|
||||
leaf-list lower-layer-if {
|
||||
type interface-state-ref;
|
||||
description
|
||||
"A list of references to interfaces layered underneath this
|
||||
interface.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifStackTable";
|
||||
}
|
||||
|
||||
leaf speed {
|
||||
type yang:gauge64;
|
||||
units "bits/second";
|
||||
description
|
||||
"An estimate of the interface's current bandwidth in bits
|
||||
per second. For interfaces that do not vary in
|
||||
bandwidth or for those where no accurate estimation can
|
||||
be made, this node should contain the nominal bandwidth.
|
||||
For interfaces that have no concept of bandwidth, this
|
||||
node is not present.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB -
|
||||
ifSpeed, ifHighSpeed";
|
||||
}
|
||||
|
||||
container statistics {
|
||||
description
|
||||
"A collection of interface-related statistics objects.";
|
||||
|
||||
leaf discontinuity-time {
|
||||
type yang:date-and-time;
|
||||
mandatory true;
|
||||
description
|
||||
"The time on the most recent occasion at which any one or
|
||||
more of this interface's counters suffered a
|
||||
discontinuity. If no such discontinuities have occurred
|
||||
since the last re-initialization of the local management
|
||||
subsystem, then this node contains the time the local
|
||||
management subsystem re-initialized itself.";
|
||||
}
|
||||
|
||||
leaf in-octets {
|
||||
type yang:counter64;
|
||||
description
|
||||
"The total number of octets received on the interface,
|
||||
including framing characters.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifHCInOctets";
|
||||
}
|
||||
|
||||
leaf in-unicast-pkts {
|
||||
type yang:counter64;
|
||||
description
|
||||
"The number of packets, delivered by this sub-layer to a
|
||||
higher (sub-)layer, that were not addressed to a
|
||||
multicast or broadcast address at this sub-layer.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts";
|
||||
}
|
||||
|
||||
leaf in-broadcast-pkts {
|
||||
type yang:counter64;
|
||||
description
|
||||
"The number of packets, delivered by this sub-layer to a
|
||||
higher (sub-)layer, that were addressed to a broadcast
|
||||
address at this sub-layer.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB -
|
||||
ifHCInBroadcastPkts";
|
||||
}
|
||||
|
||||
leaf in-multicast-pkts {
|
||||
type yang:counter64;
|
||||
description
|
||||
"The number of packets, delivered by this sub-layer to a
|
||||
higher (sub-)layer, that were addressed to a multicast
|
||||
address at this sub-layer. For a MAC-layer protocol,
|
||||
this includes both Group and Functional addresses.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB -
|
||||
ifHCInMulticastPkts";
|
||||
}
|
||||
|
||||
leaf in-discards {
|
||||
type yang:counter32;
|
||||
description
|
||||
"The number of inbound packets that were chosen to be
|
||||
discarded even though no errors had been detected to
|
||||
prevent their being deliverable to a higher-layer
|
||||
protocol. One possible reason for discarding such a
|
||||
packet could be to free up buffer space.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifInDiscards";
|
||||
}
|
||||
|
||||
leaf in-errors {
|
||||
type yang:counter32;
|
||||
description
|
||||
"For packet-oriented interfaces, the number of inbound
|
||||
packets that contained errors preventing them from being
|
||||
deliverable to a higher-layer protocol. For character-
|
||||
oriented or fixed-length interfaces, the number of
|
||||
inbound transmission units that contained errors
|
||||
preventing them from being deliverable to a higher-layer
|
||||
protocol.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifInErrors";
|
||||
}
|
||||
|
||||
leaf in-unknown-protos {
|
||||
type yang:counter32;
|
||||
description
|
||||
"For packet-oriented interfaces, the number of packets
|
||||
received via the interface that were discarded because
|
||||
of an unknown or unsupported protocol. For
|
||||
character-oriented or fixed-length interfaces that
|
||||
support protocol multiplexing, the number of
|
||||
transmission units received via the interface that were
|
||||
discarded because of an unknown or unsupported protocol.
|
||||
For any interface that does not support protocol
|
||||
multiplexing, this counter is not present.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifInUnknownProtos";
|
||||
}
|
||||
leaf out-octets {
|
||||
type yang:counter64;
|
||||
description
|
||||
"The total number of octets transmitted out of the
|
||||
interface, including framing characters.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifHCOutOctets";
|
||||
}
|
||||
|
||||
leaf out-unicast-pkts {
|
||||
type yang:counter64;
|
||||
description
|
||||
"The total number of packets that higher-level protocols
|
||||
requested be transmitted, and that were not addressed
|
||||
to a multicast or broadcast address at this sub-layer,
|
||||
including those that were discarded or not sent.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts";
|
||||
}
|
||||
|
||||
leaf out-broadcast-pkts {
|
||||
type yang:counter64;
|
||||
description
|
||||
"The total number of packets that higher-level protocols
|
||||
requested be transmitted, and that were addressed to a
|
||||
broadcast address at this sub-layer, including those
|
||||
that were discarded or not sent.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB -
|
||||
ifHCOutBroadcastPkts";
|
||||
}
|
||||
|
||||
leaf out-multicast-pkts {
|
||||
type yang:counter64;
|
||||
description
|
||||
"The total number of packets that higher-level protocols
|
||||
requested be transmitted, and that were addressed to a
|
||||
multicast address at this sub-layer, including those
|
||||
that were discarded or not sent. For a MAC-layer
|
||||
protocol, this includes both Group and Functional
|
||||
addresses.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB -
|
||||
ifHCOutMulticastPkts";
|
||||
}
|
||||
|
||||
leaf out-discards {
|
||||
type yang:counter32;
|
||||
description
|
||||
"The number of outbound packets that were chosen to be
|
||||
discarded even though no errors had been detected to
|
||||
prevent their being transmitted. One possible reason
|
||||
for discarding such a packet could be to free up buffer
|
||||
space.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifOutDiscards";
|
||||
}
|
||||
|
||||
leaf out-errors {
|
||||
type yang:counter32;
|
||||
description
|
||||
"For packet-oriented interfaces, the number of outbound
|
||||
packets that could not be transmitted because of errors.
|
||||
For character-oriented or fixed-length interfaces, the
|
||||
number of outbound transmission units that could not be
|
||||
transmitted because of errors.
|
||||
|
||||
Discontinuities in the value of this counter can occur
|
||||
at re-initialization of the management system, and at
|
||||
other times as indicated by the value of
|
||||
'discontinuity-time'.";
|
||||
reference
|
||||
"RFC 2863: The Interfaces Group MIB - ifOutErrors";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
701
example/ietf-ip@2014-06-16.yang
Normal file
701
example/ietf-ip@2014-06-16.yang
Normal file
|
|
@ -0,0 +1,701 @@
|
|||
module ietf-ip {
|
||||
|
||||
namespace "urn:ietf:params:xml:ns:yang:ietf-ip";
|
||||
prefix ip;
|
||||
|
||||
import ietf-interfaces {
|
||||
prefix if;
|
||||
}
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
import ietf-yang-types {
|
||||
prefix yang;
|
||||
}
|
||||
|
||||
organization
|
||||
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
|
||||
|
||||
contact
|
||||
"WG Web: <http://tools.ietf.org/wg/netmod/>
|
||||
WG List: <mailto:netmod@ietf.org>
|
||||
|
||||
WG Chair: Thomas Nadeau
|
||||
<mailto:tnadeau@lucidvision.com>
|
||||
|
||||
WG Chair: Juergen Schoenwaelder
|
||||
<mailto:j.schoenwaelder@jacobs-university.de>
|
||||
|
||||
Editor: Martin Bjorklund
|
||||
<mailto:mbj@tail-f.com>";
|
||||
|
||||
|
||||
description
|
||||
"This module contains a collection of YANG definitions for
|
||||
configuring IP implementations.
|
||||
|
||||
Copyright (c) 2014 IETF Trust and the persons identified as
|
||||
authors of the code. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, is permitted pursuant to, and subject
|
||||
to the license terms contained in, the Simplified BSD License
|
||||
set forth in Section 4.c of the IETF Trust's Legal Provisions
|
||||
Relating to IETF Documents
|
||||
(http://trustee.ietf.org/license-info).
|
||||
|
||||
This version of this YANG module is part of RFC 7277; see
|
||||
the RFC itself for full legal notices.";
|
||||
|
||||
revision 2014-06-16 {
|
||||
description
|
||||
"Initial revision.";
|
||||
reference
|
||||
"RFC 7277: A YANG Data Model for IP Management";
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
* Features
|
||||
*/
|
||||
|
||||
feature ipv4-non-contiguous-netmasks {
|
||||
description
|
||||
"Indicates support for configuring non-contiguous
|
||||
subnet masks.";
|
||||
}
|
||||
|
||||
feature ipv6-privacy-autoconf {
|
||||
description
|
||||
"Indicates support for Privacy Extensions for Stateless Address
|
||||
Autoconfiguration in IPv6.";
|
||||
reference
|
||||
"RFC 4941: Privacy Extensions for Stateless Address
|
||||
Autoconfiguration in IPv6";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Typedefs
|
||||
*/
|
||||
|
||||
typedef ip-address-origin {
|
||||
type enumeration {
|
||||
enum other {
|
||||
description
|
||||
"None of the following.";
|
||||
}
|
||||
enum static {
|
||||
description
|
||||
"Indicates that the address has been statically
|
||||
configured - for example, using NETCONF or a Command Line
|
||||
Interface.";
|
||||
}
|
||||
enum dhcp {
|
||||
description
|
||||
"Indicates an address that has been assigned to this
|
||||
system by a DHCP server.";
|
||||
}
|
||||
enum link-layer {
|
||||
description
|
||||
"Indicates an address created by IPv6 stateless
|
||||
autoconfiguration that embeds a link-layer address in its
|
||||
interface identifier.";
|
||||
}
|
||||
enum random {
|
||||
description
|
||||
"Indicates an address chosen by the system at
|
||||
|
||||
random, e.g., an IPv4 address within 169.254/16, an
|
||||
RFC 4941 temporary address, or an RFC 7217 semantically
|
||||
opaque address.";
|
||||
reference
|
||||
"RFC 4941: Privacy Extensions for Stateless Address
|
||||
Autoconfiguration in IPv6
|
||||
RFC 7217: A Method for Generating Semantically Opaque
|
||||
Interface Identifiers with IPv6 Stateless
|
||||
Address Autoconfiguration (SLAAC)";
|
||||
}
|
||||
}
|
||||
description
|
||||
"The origin of an address.";
|
||||
}
|
||||
|
||||
typedef neighbor-origin {
|
||||
type enumeration {
|
||||
enum other {
|
||||
description
|
||||
"None of the following.";
|
||||
}
|
||||
enum static {
|
||||
description
|
||||
"Indicates that the mapping has been statically
|
||||
configured - for example, using NETCONF or a Command Line
|
||||
Interface.";
|
||||
}
|
||||
enum dynamic {
|
||||
description
|
||||
"Indicates that the mapping has been dynamically resolved
|
||||
using, e.g., IPv4 ARP or the IPv6 Neighbor Discovery
|
||||
protocol.";
|
||||
}
|
||||
}
|
||||
description
|
||||
"The origin of a neighbor entry.";
|
||||
}
|
||||
|
||||
/*
|
||||
* Configuration data nodes
|
||||
*/
|
||||
|
||||
augment "/if:interfaces/if:interface" {
|
||||
description
|
||||
"Parameters for configuring IP on interfaces.
|
||||
|
||||
If an interface is not capable of running IP, the server
|
||||
must not allow the client to configure these parameters.";
|
||||
|
||||
container ipv4 {
|
||||
presence
|
||||
"Enables IPv4 unless the 'enabled' leaf
|
||||
(which defaults to 'true') is set to 'false'";
|
||||
description
|
||||
"Parameters for the IPv4 address family.";
|
||||
|
||||
leaf enabled {
|
||||
type boolean;
|
||||
default true;
|
||||
description
|
||||
"Controls whether IPv4 is enabled or disabled on this
|
||||
interface. When IPv4 is enabled, this interface is
|
||||
connected to an IPv4 stack, and the interface can send
|
||||
and receive IPv4 packets.";
|
||||
}
|
||||
leaf forwarding {
|
||||
type boolean;
|
||||
default false;
|
||||
description
|
||||
"Controls IPv4 packet forwarding of datagrams received by,
|
||||
but not addressed to, this interface. IPv4 routers
|
||||
forward datagrams. IPv4 hosts do not (except those
|
||||
source-routed via the host).";
|
||||
}
|
||||
leaf mtu {
|
||||
type uint16 {
|
||||
range "68..max";
|
||||
}
|
||||
units octets;
|
||||
description
|
||||
"The size, in octets, of the largest IPv4 packet that the
|
||||
interface will send and receive.
|
||||
|
||||
The server may restrict the allowed values for this leaf,
|
||||
depending on the interface's type.
|
||||
|
||||
If this leaf is not configured, the operationally used MTU
|
||||
depends on the interface's type.";
|
||||
reference
|
||||
"RFC 791: Internet Protocol";
|
||||
}
|
||||
list address {
|
||||
key "ip";
|
||||
description
|
||||
"The list of configured IPv4 addresses on the interface.";
|
||||
|
||||
leaf ip {
|
||||
type inet:ipv4-address-no-zone;
|
||||
description
|
||||
"The IPv4 address on the interface.";
|
||||
}
|
||||
|
||||
choice subnet {
|
||||
mandatory true;
|
||||
description
|
||||
"The subnet can be specified as a prefix-length, or,
|
||||
if the server supports non-contiguous netmasks, as
|
||||
a netmask.";
|
||||
leaf prefix-length {
|
||||
type uint8 {
|
||||
range "0..32";
|
||||
}
|
||||
description
|
||||
"The length of the subnet prefix.";
|
||||
}
|
||||
leaf netmask {
|
||||
if-feature ipv4-non-contiguous-netmasks;
|
||||
type yang:dotted-quad;
|
||||
description
|
||||
"The subnet specified as a netmask.";
|
||||
}
|
||||
}
|
||||
}
|
||||
list neighbor {
|
||||
key "ip";
|
||||
description
|
||||
"A list of mappings from IPv4 addresses to
|
||||
link-layer addresses.
|
||||
|
||||
Entries in this list are used as static entries in the
|
||||
ARP Cache.";
|
||||
reference
|
||||
"RFC 826: An Ethernet Address Resolution Protocol";
|
||||
|
||||
leaf ip {
|
||||
type inet:ipv4-address-no-zone;
|
||||
description
|
||||
"The IPv4 address of the neighbor node.";
|
||||
}
|
||||
leaf link-layer-address {
|
||||
type yang:phys-address;
|
||||
mandatory true;
|
||||
description
|
||||
"The link-layer address of the neighbor node.";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
container ipv6 {
|
||||
presence
|
||||
"Enables IPv6 unless the 'enabled' leaf
|
||||
(which defaults to 'true') is set to 'false'";
|
||||
description
|
||||
"Parameters for the IPv6 address family.";
|
||||
|
||||
leaf enabled {
|
||||
type boolean;
|
||||
default true;
|
||||
description
|
||||
"Controls whether IPv6 is enabled or disabled on this
|
||||
interface. When IPv6 is enabled, this interface is
|
||||
connected to an IPv6 stack, and the interface can send
|
||||
and receive IPv6 packets.";
|
||||
}
|
||||
leaf forwarding {
|
||||
type boolean;
|
||||
default false;
|
||||
description
|
||||
"Controls IPv6 packet forwarding of datagrams received by,
|
||||
but not addressed to, this interface. IPv6 routers
|
||||
forward datagrams. IPv6 hosts do not (except those
|
||||
source-routed via the host).";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
|
||||
Section 6.2.1, IsRouter";
|
||||
}
|
||||
leaf mtu {
|
||||
type uint32 {
|
||||
range "1280..max";
|
||||
}
|
||||
units octets;
|
||||
description
|
||||
"The size, in octets, of the largest IPv6 packet that the
|
||||
interface will send and receive.
|
||||
|
||||
The server may restrict the allowed values for this leaf,
|
||||
depending on the interface's type.
|
||||
|
||||
If this leaf is not configured, the operationally used MTU
|
||||
depends on the interface's type.";
|
||||
reference
|
||||
"RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
|
||||
Section 5";
|
||||
}
|
||||
|
||||
list address {
|
||||
key "ip";
|
||||
description
|
||||
"The list of configured IPv6 addresses on the interface.";
|
||||
|
||||
leaf ip {
|
||||
type inet:ipv6-address-no-zone;
|
||||
description
|
||||
"The IPv6 address on the interface.";
|
||||
}
|
||||
leaf prefix-length {
|
||||
type uint8 {
|
||||
range "0..128";
|
||||
}
|
||||
mandatory true;
|
||||
description
|
||||
"The length of the subnet prefix.";
|
||||
}
|
||||
}
|
||||
list neighbor {
|
||||
key "ip";
|
||||
description
|
||||
"A list of mappings from IPv6 addresses to
|
||||
link-layer addresses.
|
||||
|
||||
Entries in this list are used as static entries in the
|
||||
Neighbor Cache.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
|
||||
|
||||
leaf ip {
|
||||
type inet:ipv6-address-no-zone;
|
||||
description
|
||||
"The IPv6 address of the neighbor node.";
|
||||
}
|
||||
leaf link-layer-address {
|
||||
type yang:phys-address;
|
||||
mandatory true;
|
||||
description
|
||||
"The link-layer address of the neighbor node.";
|
||||
}
|
||||
}
|
||||
|
||||
leaf dup-addr-detect-transmits {
|
||||
type uint32;
|
||||
default 1;
|
||||
description
|
||||
"The number of consecutive Neighbor Solicitation messages
|
||||
sent while performing Duplicate Address Detection on a
|
||||
tentative address. A value of zero indicates that
|
||||
Duplicate Address Detection is not performed on
|
||||
tentative addresses. A value of one indicates a single
|
||||
transmission with no follow-up retransmissions.";
|
||||
reference
|
||||
"RFC 4862: IPv6 Stateless Address Autoconfiguration";
|
||||
}
|
||||
container autoconf {
|
||||
description
|
||||
"Parameters to control the autoconfiguration of IPv6
|
||||
addresses, as described in RFC 4862.";
|
||||
reference
|
||||
"RFC 4862: IPv6 Stateless Address Autoconfiguration";
|
||||
|
||||
leaf create-global-addresses {
|
||||
type boolean;
|
||||
default true;
|
||||
description
|
||||
"If enabled, the host creates global addresses as
|
||||
described in RFC 4862.";
|
||||
reference
|
||||
"RFC 4862: IPv6 Stateless Address Autoconfiguration
|
||||
Section 5.5";
|
||||
}
|
||||
leaf create-temporary-addresses {
|
||||
if-feature ipv6-privacy-autoconf;
|
||||
type boolean;
|
||||
default false;
|
||||
description
|
||||
"If enabled, the host creates temporary addresses as
|
||||
described in RFC 4941.";
|
||||
reference
|
||||
"RFC 4941: Privacy Extensions for Stateless Address
|
||||
Autoconfiguration in IPv6";
|
||||
}
|
||||
|
||||
leaf temporary-valid-lifetime {
|
||||
if-feature ipv6-privacy-autoconf;
|
||||
type uint32;
|
||||
units "seconds";
|
||||
default 604800;
|
||||
description
|
||||
"The time period during which the temporary address
|
||||
is valid.";
|
||||
reference
|
||||
"RFC 4941: Privacy Extensions for Stateless Address
|
||||
Autoconfiguration in IPv6
|
||||
- TEMP_VALID_LIFETIME";
|
||||
}
|
||||
leaf temporary-preferred-lifetime {
|
||||
if-feature ipv6-privacy-autoconf;
|
||||
type uint32;
|
||||
units "seconds";
|
||||
default 86400;
|
||||
description
|
||||
"The time period during which the temporary address is
|
||||
preferred.";
|
||||
reference
|
||||
"RFC 4941: Privacy Extensions for Stateless Address
|
||||
Autoconfiguration in IPv6
|
||||
- TEMP_PREFERRED_LIFETIME";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Operational state data nodes
|
||||
*/
|
||||
|
||||
augment "/if:interfaces-state/if:interface" {
|
||||
description
|
||||
"Data nodes for the operational state of IP on interfaces.";
|
||||
|
||||
container ipv4 {
|
||||
presence "Present if IPv4 is enabled on this interface";
|
||||
config false;
|
||||
description
|
||||
"Interface-specific parameters for the IPv4 address family.";
|
||||
|
||||
leaf forwarding {
|
||||
type boolean;
|
||||
description
|
||||
"Indicates whether IPv4 packet forwarding is enabled or
|
||||
disabled on this interface.";
|
||||
}
|
||||
leaf mtu {
|
||||
type uint16 {
|
||||
range "68..max";
|
||||
}
|
||||
units octets;
|
||||
description
|
||||
"The size, in octets, of the largest IPv4 packet that the
|
||||
interface will send and receive.";
|
||||
reference
|
||||
"RFC 791: Internet Protocol";
|
||||
}
|
||||
list address {
|
||||
key "ip";
|
||||
description
|
||||
"The list of IPv4 addresses on the interface.";
|
||||
|
||||
leaf ip {
|
||||
type inet:ipv4-address-no-zone;
|
||||
description
|
||||
"The IPv4 address on the interface.";
|
||||
}
|
||||
choice subnet {
|
||||
description
|
||||
"The subnet can be specified as a prefix-length, or,
|
||||
if the server supports non-contiguous netmasks, as
|
||||
a netmask.";
|
||||
leaf prefix-length {
|
||||
type uint8 {
|
||||
range "0..32";
|
||||
}
|
||||
description
|
||||
"The length of the subnet prefix.";
|
||||
}
|
||||
leaf netmask {
|
||||
if-feature ipv4-non-contiguous-netmasks;
|
||||
type yang:dotted-quad;
|
||||
description
|
||||
"The subnet specified as a netmask.";
|
||||
}
|
||||
}
|
||||
|
||||
leaf origin {
|
||||
type ip-address-origin;
|
||||
description
|
||||
"The origin of this address.";
|
||||
}
|
||||
}
|
||||
list neighbor {
|
||||
key "ip";
|
||||
description
|
||||
"A list of mappings from IPv4 addresses to
|
||||
link-layer addresses.
|
||||
|
||||
This list represents the ARP Cache.";
|
||||
reference
|
||||
"RFC 826: An Ethernet Address Resolution Protocol";
|
||||
|
||||
leaf ip {
|
||||
type inet:ipv4-address-no-zone;
|
||||
description
|
||||
"The IPv4 address of the neighbor node.";
|
||||
}
|
||||
leaf link-layer-address {
|
||||
type yang:phys-address;
|
||||
description
|
||||
"The link-layer address of the neighbor node.";
|
||||
}
|
||||
leaf origin {
|
||||
type neighbor-origin;
|
||||
description
|
||||
"The origin of this neighbor entry.";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
container ipv6 {
|
||||
presence "Present if IPv6 is enabled on this interface";
|
||||
config false;
|
||||
description
|
||||
"Parameters for the IPv6 address family.";
|
||||
|
||||
leaf forwarding {
|
||||
type boolean;
|
||||
default false;
|
||||
description
|
||||
"Indicates whether IPv6 packet forwarding is enabled or
|
||||
disabled on this interface.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
|
||||
Section 6.2.1, IsRouter";
|
||||
}
|
||||
leaf mtu {
|
||||
type uint32 {
|
||||
range "1280..max";
|
||||
}
|
||||
units octets;
|
||||
description
|
||||
"The size, in octets, of the largest IPv6 packet that the
|
||||
interface will send and receive.";
|
||||
reference
|
||||
"RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
|
||||
Section 5";
|
||||
}
|
||||
list address {
|
||||
key "ip";
|
||||
description
|
||||
"The list of IPv6 addresses on the interface.";
|
||||
|
||||
leaf ip {
|
||||
type inet:ipv6-address-no-zone;
|
||||
description
|
||||
"The IPv6 address on the interface.";
|
||||
}
|
||||
leaf prefix-length {
|
||||
type uint8 {
|
||||
range "0..128";
|
||||
}
|
||||
mandatory true;
|
||||
description
|
||||
"The length of the subnet prefix.";
|
||||
}
|
||||
leaf origin {
|
||||
type ip-address-origin;
|
||||
description
|
||||
"The origin of this address.";
|
||||
}
|
||||
leaf status {
|
||||
type enumeration {
|
||||
enum preferred {
|
||||
description
|
||||
"This is a valid address that can appear as the
|
||||
destination or source address of a packet.";
|
||||
}
|
||||
enum deprecated {
|
||||
description
|
||||
"This is a valid but deprecated address that should
|
||||
no longer be used as a source address in new
|
||||
communications, but packets addressed to such an
|
||||
address are processed as expected.";
|
||||
}
|
||||
enum invalid {
|
||||
description
|
||||
"This isn't a valid address, and it shouldn't appear
|
||||
as the destination or source address of a packet.";
|
||||
}
|
||||
enum inaccessible {
|
||||
description
|
||||
"The address is not accessible because the interface
|
||||
to which this address is assigned is not
|
||||
operational.";
|
||||
}
|
||||
enum unknown {
|
||||
description
|
||||
"The status cannot be determined for some reason.";
|
||||
}
|
||||
enum tentative {
|
||||
description
|
||||
"The uniqueness of the address on the link is being
|
||||
verified. Addresses in this state should not be
|
||||
used for general communication and should only be
|
||||
used to determine the uniqueness of the address.";
|
||||
}
|
||||
enum duplicate {
|
||||
description
|
||||
"The address has been determined to be non-unique on
|
||||
the link and so must not be used.";
|
||||
}
|
||||
enum optimistic {
|
||||
description
|
||||
"The address is available for use, subject to
|
||||
restrictions, while its uniqueness on a link is
|
||||
being verified.";
|
||||
}
|
||||
}
|
||||
description
|
||||
"The status of an address. Most of the states correspond
|
||||
to states from the IPv6 Stateless Address
|
||||
Autoconfiguration protocol.";
|
||||
reference
|
||||
"RFC 4293: Management Information Base for the
|
||||
Internet Protocol (IP)
|
||||
- IpAddressStatusTC
|
||||
RFC 4862: IPv6 Stateless Address Autoconfiguration";
|
||||
}
|
||||
}
|
||||
list neighbor {
|
||||
key "ip";
|
||||
description
|
||||
"A list of mappings from IPv6 addresses to
|
||||
link-layer addresses.
|
||||
|
||||
This list represents the Neighbor Cache.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
|
||||
|
||||
leaf ip {
|
||||
type inet:ipv6-address-no-zone;
|
||||
description
|
||||
"The IPv6 address of the neighbor node.";
|
||||
}
|
||||
leaf link-layer-address {
|
||||
type yang:phys-address;
|
||||
description
|
||||
"The link-layer address of the neighbor node.";
|
||||
}
|
||||
leaf origin {
|
||||
type neighbor-origin;
|
||||
description
|
||||
"The origin of this neighbor entry.";
|
||||
}
|
||||
leaf is-router {
|
||||
type empty;
|
||||
description
|
||||
"Indicates that the neighbor node acts as a router.";
|
||||
}
|
||||
leaf state {
|
||||
type enumeration {
|
||||
enum incomplete {
|
||||
description
|
||||
"Address resolution is in progress, and the link-layer
|
||||
address of the neighbor has not yet been
|
||||
determined.";
|
||||
}
|
||||
enum reachable {
|
||||
description
|
||||
"Roughly speaking, the neighbor is known to have been
|
||||
reachable recently (within tens of seconds ago).";
|
||||
}
|
||||
enum stale {
|
||||
description
|
||||
"The neighbor is no longer known to be reachable, but
|
||||
until traffic is sent to the neighbor no attempt
|
||||
should be made to verify its reachability.";
|
||||
}
|
||||
enum delay {
|
||||
description
|
||||
"The neighbor is no longer known to be reachable, and
|
||||
traffic has recently been sent to the neighbor.
|
||||
Rather than probe the neighbor immediately, however,
|
||||
delay sending probes for a short while in order to
|
||||
give upper-layer protocols a chance to provide
|
||||
reachability confirmation.";
|
||||
}
|
||||
enum probe {
|
||||
description
|
||||
"The neighbor is no longer known to be reachable, and
|
||||
unicast Neighbor Solicitation probes are being sent
|
||||
to verify reachability.";
|
||||
}
|
||||
}
|
||||
description
|
||||
"The Neighbor Unreachability Detection state of this
|
||||
entry.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
|
||||
Section 7.3.2";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
232
example/ietf-ipv4-unicast-routing@2014-10-26.yang
Normal file
232
example/ietf-ipv4-unicast-routing@2014-10-26.yang
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
module ietf-ipv4-unicast-routing {
|
||||
|
||||
namespace "urn:ietf:params:xml:ns:yang:ietf-ipv4-unicast-routing";
|
||||
|
||||
prefix "v4ur";
|
||||
|
||||
import ietf-routing {
|
||||
prefix "rt";
|
||||
revision-date "2014-10-26";
|
||||
}
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix "inet";
|
||||
revision-date "2013-07-15";
|
||||
}
|
||||
|
||||
organization
|
||||
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
|
||||
|
||||
contact
|
||||
"WG Web: <http://tools.ietf.org/wg/netmod/>
|
||||
WG List: <mailto:netmod@ietf.org>
|
||||
|
||||
WG Chair: Thomas Nadeau
|
||||
<mailto:tnadeau@lucidvision.com>
|
||||
|
||||
WG Chair: Juergen Schoenwaelder
|
||||
<mailto:j.schoenwaelder@jacobs-university.de>
|
||||
|
||||
Editor: Ladislav Lhotka
|
||||
<mailto:lhotka@nic.cz>";
|
||||
|
||||
description
|
||||
"This YANG module augments the 'ietf-routing' module with basic
|
||||
configuration and operational state data for IPv4 unicast
|
||||
routing.
|
||||
|
||||
Copyright (c) 2014 IETF Trust and the persons identified as
|
||||
authors of the code. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, is permitted pursuant to, and subject to
|
||||
the license terms contained in, the Simplified BSD License set
|
||||
forth in Section 4.c of the IETF Trust's Legal Provisions
|
||||
Relating to IETF Documents
|
||||
(http://trustee.ietf.org/license-info).
|
||||
|
||||
This version of this YANG module is part of RFC XXXX; see the
|
||||
RFC itself for full legal notices.";
|
||||
|
||||
revision 2014-10-26 {
|
||||
description
|
||||
"Initial revision.";
|
||||
reference
|
||||
"RFC XXXX: A YANG Data Model for Routing Management";
|
||||
}
|
||||
|
||||
/* Identities */
|
||||
|
||||
identity ipv4-unicast {
|
||||
base rt:ipv4;
|
||||
description
|
||||
"This identity represents the IPv4 unicast address family.";
|
||||
}
|
||||
|
||||
/* Operational state data */
|
||||
|
||||
augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route" {
|
||||
when "../../rt:address-family = 'v4ur:ipv4-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv4 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments an IPv4 unicast route.";
|
||||
leaf destination-prefix {
|
||||
type inet:ipv4-prefix;
|
||||
description
|
||||
"IPv4 destination prefix.";
|
||||
}
|
||||
}
|
||||
|
||||
augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
|
||||
+ "rt:next-hop/rt:next-hop-options/rt:simple-next-hop" {
|
||||
when "../../../rt:address-family = 'v4ur:ipv4-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv4 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments the 'simple-next-hop' case of IPv4 unicast
|
||||
routes.";
|
||||
leaf next-hop-address {
|
||||
type inet:ipv4-address;
|
||||
description
|
||||
"IPv4 address of the next-hop.";
|
||||
}
|
||||
}
|
||||
|
||||
augment "/rt:routing-state/rt:next-hop-lists/rt:next-hop-list/"
|
||||
+ "rt:next-hop/rt:next-hop-options/rt:simple-next-hop" {
|
||||
when "../rt:address-family = 'v4ur:ipv4-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv4 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments next-hop list with IPv4 next-hop address.
|
||||
routes.";
|
||||
leaf next-hop-address {
|
||||
type inet:ipv4-address;
|
||||
description
|
||||
"IPv4 address of the next-hop.";
|
||||
}
|
||||
}
|
||||
|
||||
/* Configuration data */
|
||||
|
||||
augment "/rt:routing/rt:routing-instance/rt:routing-protocols/"
|
||||
+ "rt:routing-protocol/rt:static-routes" {
|
||||
description
|
||||
"This augment defines the configuration of the 'static'
|
||||
pseudo-protocol with data specific to IPv4 unicast.";
|
||||
container ipv4 {
|
||||
description
|
||||
"Configuration of a 'static' pseudo-protocol instance
|
||||
consists of a list of routes.";
|
||||
list route {
|
||||
key "destination-prefix";
|
||||
ordered-by "user";
|
||||
description
|
||||
"A user-ordered list of static routes.";
|
||||
leaf destination-prefix {
|
||||
type inet:ipv4-prefix;
|
||||
mandatory "true";
|
||||
description
|
||||
"IPv4 destination prefix.";
|
||||
}
|
||||
leaf description {
|
||||
type string;
|
||||
description
|
||||
"Textual description of the route.";
|
||||
}
|
||||
container next-hop {
|
||||
description
|
||||
"Configuration of next-hop.";
|
||||
grouping next-hop-content {
|
||||
description
|
||||
"Next-hop content for IPv4 unicast static routes.";
|
||||
uses rt:next-hop-content {
|
||||
augment "next-hop-options" {
|
||||
description
|
||||
"Add next-hop address case.";
|
||||
leaf next-hop-address {
|
||||
type inet:ipv4-address;
|
||||
description
|
||||
"IPv4 address of the next-hop.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
choice simple-or-list {
|
||||
description
|
||||
"Options for next-hops.";
|
||||
list multipath-entry {
|
||||
if-feature rt:multipath-routes;
|
||||
key "name";
|
||||
description
|
||||
"List of alternative next-hops.";
|
||||
leaf name {
|
||||
type string;
|
||||
description
|
||||
"A unique identifier of the next-hop entry.";
|
||||
}
|
||||
uses next-hop-content;
|
||||
uses rt:next-hop-classifiers;
|
||||
}
|
||||
case simple-next-hop {
|
||||
uses next-hop-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* RPC methods */
|
||||
|
||||
augment "/rt:fib-route/rt:input/rt:destination-address" {
|
||||
when "rt:address-family='v4ur:ipv4-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv4 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments the 'rt:destination-address' parameter of
|
||||
the 'rt:fib-route' operation.";
|
||||
leaf address {
|
||||
type inet:ipv4-address;
|
||||
description
|
||||
"IPv4 destination address.";
|
||||
}
|
||||
}
|
||||
|
||||
augment "/rt:fib-route/rt:output/rt:route" {
|
||||
when "rt:address-family='v4ur:ipv4-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv4 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments the reply to the 'rt:fib-route'
|
||||
operation.";
|
||||
leaf destination-prefix {
|
||||
type inet:ipv4-prefix;
|
||||
description
|
||||
"IPv4 destination prefix.";
|
||||
}
|
||||
}
|
||||
|
||||
augment "/rt:fib-route/rt:output/rt:route/rt:next-hop/"
|
||||
+ "rt:next-hop-options/rt:simple-next-hop" {
|
||||
when "../rt:address-family='v4ur:ipv4-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv4 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments the 'simple-next-hop' case in the reply to
|
||||
the 'rt:fib-route' operation.";
|
||||
leaf next-hop-address {
|
||||
type inet:ipv4-address;
|
||||
description
|
||||
"IPv4 address of the next-hop.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
636
example/ietf-ipv6-unicast-routing@2014-10-26.yang
Normal file
636
example/ietf-ipv6-unicast-routing@2014-10-26.yang
Normal file
|
|
@ -0,0 +1,636 @@
|
|||
|
||||
module ietf-ipv6-unicast-routing {
|
||||
|
||||
namespace "urn:ietf:params:xml:ns:yang:ietf-ipv6-unicast-routing";
|
||||
|
||||
prefix "v6ur";
|
||||
|
||||
import ietf-routing {
|
||||
prefix "rt";
|
||||
revision-date "2014-10-26";
|
||||
}
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix "inet";
|
||||
revision-date "2013-07-15";
|
||||
}
|
||||
|
||||
import ietf-interfaces {
|
||||
prefix "if";
|
||||
revision-date "2013-07-15";
|
||||
}
|
||||
|
||||
import ietf-ip {
|
||||
prefix "ip";
|
||||
revision-date "2014-06-16";
|
||||
}
|
||||
|
||||
organization
|
||||
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
|
||||
|
||||
contact
|
||||
"WG Web: <http://tools.ietf.org/wg/netmod/>
|
||||
WG List: <mailto:netmod@ietf.org>
|
||||
|
||||
WG Chair: Thomas Nadeau
|
||||
<mailto:tnadeau@lucidvision.com>
|
||||
|
||||
WG Chair: Juergen Schoenwaelder
|
||||
<mailto:j.schoenwaelder@jacobs-university.de>
|
||||
|
||||
Editor: Ladislav Lhotka
|
||||
<mailto:lhotka@nic.cz>";
|
||||
|
||||
description
|
||||
"This YANG module augments the 'ietf-routing' module with basic
|
||||
configuration and operational state data for IPv6 unicast
|
||||
routing.
|
||||
|
||||
Copyright (c) 2014 IETF Trust and the persons identified as
|
||||
authors of the code. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, is permitted pursuant to, and subject to
|
||||
the license terms contained in, the Simplified BSD License set
|
||||
forth in Section 4.c of the IETF Trust's Legal Provisions
|
||||
Relating to IETF Documents
|
||||
(http://trustee.ietf.org/license-info).
|
||||
|
||||
This version of this YANG module is part of RFC XXXX; see the
|
||||
RFC itself for full legal notices.";
|
||||
|
||||
revision 2014-10-26 {
|
||||
description
|
||||
"Initial revision.";
|
||||
reference
|
||||
"RFC XXXX: A YANG Data Model for Routing Management";
|
||||
}
|
||||
|
||||
/* Identities */
|
||||
|
||||
identity ipv6-unicast {
|
||||
base rt:ipv6;
|
||||
description
|
||||
"This identity represents the IPv6 unicast address family.";
|
||||
}
|
||||
|
||||
/* Operational state data */
|
||||
|
||||
augment "/rt:routing-state/rt:routing-instance/rt:interfaces/"
|
||||
+ "rt:interface" {
|
||||
description
|
||||
"IPv6-specific parameters of router interfaces.";
|
||||
container ipv6-router-advertisements {
|
||||
description
|
||||
"Parameters of IPv6 Router Advertisements.";
|
||||
leaf send-advertisements {
|
||||
type boolean;
|
||||
description
|
||||
"A flag indicating whether or not the router sends periodic
|
||||
Router Advertisements and responds to Router
|
||||
Solicitations.";
|
||||
}
|
||||
leaf max-rtr-adv-interval {
|
||||
type uint16 {
|
||||
range "4..1800";
|
||||
}
|
||||
units "seconds";
|
||||
description
|
||||
"The maximum time allowed between sending unsolicited
|
||||
multicast Router Advertisements from the interface.";
|
||||
}
|
||||
leaf min-rtr-adv-interval {
|
||||
type uint16 {
|
||||
range "3..1350";
|
||||
}
|
||||
units "seconds";
|
||||
description
|
||||
"The minimum time allowed between sending unsolicited
|
||||
multicast Router Advertisements from the interface.";
|
||||
}
|
||||
leaf managed-flag {
|
||||
type boolean;
|
||||
description
|
||||
"The value that is placed in the 'Managed address
|
||||
configuration' flag field in the Router Advertisement.";
|
||||
}
|
||||
leaf other-config-flag {
|
||||
type boolean;
|
||||
description
|
||||
"The value that is placed in the 'Other configuration' flag
|
||||
field in the Router Advertisement.";
|
||||
}
|
||||
leaf link-mtu {
|
||||
type uint32;
|
||||
description
|
||||
"The value that is placed in MTU options sent by the
|
||||
router. A value of zero indicates that no MTU options are
|
||||
sent.";
|
||||
}
|
||||
leaf reachable-time {
|
||||
type uint32 {
|
||||
range "0..3600000";
|
||||
}
|
||||
units "milliseconds";
|
||||
description
|
||||
"The value that is placed in the Reachable Time field in
|
||||
the Router Advertisement messages sent by the router. A
|
||||
value of zero means unspecified (by this router).";
|
||||
}
|
||||
leaf retrans-timer {
|
||||
type uint32;
|
||||
units "milliseconds";
|
||||
description
|
||||
"The value that is placed in the Retrans Timer field in the
|
||||
Router Advertisement messages sent by the router. A value
|
||||
of zero means unspecified (by this router).";
|
||||
}
|
||||
leaf cur-hop-limit {
|
||||
type uint8;
|
||||
description
|
||||
"The value that is placed in the Cur Hop Limit field in the
|
||||
Router Advertisement messages sent by the router. A value
|
||||
of zero means unspecified (by this router).";
|
||||
}
|
||||
leaf default-lifetime {
|
||||
type uint16 {
|
||||
range "0..9000";
|
||||
}
|
||||
units "seconds";
|
||||
description
|
||||
"The value that is placed in the Router Lifetime field of
|
||||
Router Advertisements sent from the interface, in seconds.
|
||||
A value of zero indicates that the router is not to be
|
||||
used as a default router.";
|
||||
}
|
||||
container prefix-list {
|
||||
description
|
||||
"A list of prefixes that are placed in Prefix Information
|
||||
options in Router Advertisement messages sent from the
|
||||
interface.
|
||||
|
||||
By default, these are all prefixes that the router
|
||||
advertises via routing protocols as being on-link for the
|
||||
interface from which the advertisement is sent.";
|
||||
list prefix {
|
||||
key "prefix-spec";
|
||||
description
|
||||
"Advertised prefix entry and its parameters.";
|
||||
leaf prefix-spec {
|
||||
type inet:ipv6-prefix;
|
||||
description
|
||||
"IPv6 address prefix.";
|
||||
}
|
||||
leaf valid-lifetime {
|
||||
type uint32;
|
||||
units "seconds";
|
||||
description
|
||||
"The value that is placed in the Valid Lifetime in the
|
||||
Prefix Information option. The designated value of all
|
||||
1's (0xffffffff) represents infinity.";
|
||||
}
|
||||
leaf on-link-flag {
|
||||
type boolean;
|
||||
description
|
||||
"The value that is placed in the on-link flag ('L-bit')
|
||||
field in the Prefix Information option.";
|
||||
}
|
||||
leaf preferred-lifetime {
|
||||
type uint32;
|
||||
units "seconds";
|
||||
description
|
||||
"The value that is placed in the Preferred Lifetime in
|
||||
the Prefix Information option, in seconds. The
|
||||
designated value of all 1's (0xffffffff) represents
|
||||
infinity.";
|
||||
}
|
||||
leaf autonomous-flag {
|
||||
type boolean;
|
||||
description
|
||||
"The value that is placed in the Autonomous Flag field
|
||||
in the Prefix Information option.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route" {
|
||||
when "../../rt:address-family = 'v6ur:ipv6-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv6 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments an IPv6 unicast route.";
|
||||
leaf destination-prefix {
|
||||
type inet:ipv6-prefix;
|
||||
description
|
||||
"IPv6 destination prefix.";
|
||||
}
|
||||
}
|
||||
|
||||
augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
|
||||
+ "rt:next-hop/rt:next-hop-options/rt:simple-next-hop" {
|
||||
when "../../../rt:address-family = 'v6ur:ipv6-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv6 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments the 'simple-next-hop' case of IPv6 unicast
|
||||
routes.";
|
||||
leaf next-hop {
|
||||
type inet:ipv6-address;
|
||||
description
|
||||
"IPv6 address of the next-hop.";
|
||||
}
|
||||
}
|
||||
|
||||
augment "/rt:routing-state/rt:next-hop-lists/rt:next-hop-list/"
|
||||
+ "rt:next-hop/rt:next-hop-options/rt:simple-next-hop" {
|
||||
when "../rt:address-family = 'v6ur:ipv6-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv6 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments next-hop list with IPv6 next-hop address.
|
||||
routes.";
|
||||
leaf next-hop-address {
|
||||
type inet:ipv6-address;
|
||||
description
|
||||
"IPv6 address of the next-hop.";
|
||||
}
|
||||
}
|
||||
|
||||
/* Configuration data */
|
||||
|
||||
augment
|
||||
"/rt:routing/rt:routing-instance/rt:interfaces/rt:interface" {
|
||||
when "/if:interfaces/if:interface[if:name=current()/rt:name]/"
|
||||
+ "ip:ipv6/ip:enabled='true'" {
|
||||
description
|
||||
"This augment is only valid for router interfaces with
|
||||
enabled IPv6.";
|
||||
}
|
||||
description
|
||||
"Configuration of IPv6-specific parameters of router
|
||||
interfaces.";
|
||||
container ipv6-router-advertisements {
|
||||
description
|
||||
"Configuration of IPv6 Router Advertisements.";
|
||||
leaf send-advertisements {
|
||||
type boolean;
|
||||
default "false";
|
||||
description
|
||||
"A flag indicating whether or not the router sends periodic
|
||||
Router Advertisements and responds to Router
|
||||
Solicitations.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
AdvSendAdvertisements.";
|
||||
}
|
||||
leaf max-rtr-adv-interval {
|
||||
type uint16 {
|
||||
range "4..1800";
|
||||
}
|
||||
units "seconds";
|
||||
default "600";
|
||||
description
|
||||
"The maximum time allowed between sending unsolicited
|
||||
multicast Router Advertisements from the interface.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
MaxRtrAdvInterval.";
|
||||
}
|
||||
leaf min-rtr-adv-interval {
|
||||
type uint16 {
|
||||
range "3..1350";
|
||||
}
|
||||
units "seconds";
|
||||
must ". <= 0.75 * ../max-rtr-adv-interval" {
|
||||
description
|
||||
"The value MUST NOT be greater than 75 % of
|
||||
'max-rtr-adv-interval'.";
|
||||
}
|
||||
description
|
||||
"The minimum time allowed between sending unsolicited
|
||||
multicast Router Advertisements from the interface.
|
||||
|
||||
The default value to be used operationally if this leaf is
|
||||
not configured is determined as follows:
|
||||
|
||||
- if max-rtr-adv-interval >= 9 seconds, the default value
|
||||
is 0.33 * max-rtr-adv-interval;
|
||||
|
||||
- otherwise it is 0.75 * max-rtr-adv-interval.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
MinRtrAdvInterval.";
|
||||
}
|
||||
leaf managed-flag {
|
||||
type boolean;
|
||||
default "false";
|
||||
description
|
||||
"The value to be placed in the 'Managed address
|
||||
configuration' flag field in the Router Advertisement.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
AdvManagedFlag.";
|
||||
}
|
||||
leaf other-config-flag {
|
||||
type boolean;
|
||||
default "false";
|
||||
description
|
||||
"The value to be placed in the 'Other configuration' flag
|
||||
field in the Router Advertisement.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
AdvOtherConfigFlag.";
|
||||
}
|
||||
leaf link-mtu {
|
||||
type uint32;
|
||||
default "0";
|
||||
description
|
||||
"The value to be placed in MTU options sent by the router.
|
||||
A value of zero indicates that no MTU options are sent.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
AdvLinkMTU.";
|
||||
}
|
||||
leaf reachable-time {
|
||||
type uint32 {
|
||||
range "0..3600000";
|
||||
}
|
||||
units "milliseconds";
|
||||
default "0";
|
||||
description
|
||||
"The value to be placed in the Reachable Time field in the
|
||||
Router Advertisement messages sent by the router. A value
|
||||
of zero means unspecified (by this router).";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
AdvReachableTime.";
|
||||
}
|
||||
leaf retrans-timer {
|
||||
type uint32;
|
||||
units "milliseconds";
|
||||
default "0";
|
||||
description
|
||||
"The value to be placed in the Retrans Timer field in the
|
||||
Router Advertisement messages sent by the router. A value
|
||||
of zero means unspecified (by this router).";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
AdvRetransTimer.";
|
||||
}
|
||||
leaf cur-hop-limit {
|
||||
type uint8;
|
||||
description
|
||||
"The value to be placed in the Cur Hop Limit field in the
|
||||
Router Advertisement messages sent by the router. A value
|
||||
of zero means unspecified (by this router).
|
||||
|
||||
If this parameter is not configured, the device SHOULD use
|
||||
the value specified in IANA Assigned Numbers that was in
|
||||
effect at the time of implementation.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
AdvCurHopLimit.
|
||||
|
||||
IANA: IP Parameters,
|
||||
http://www.iana.org/assignments/ip-parameters";
|
||||
}
|
||||
leaf default-lifetime {
|
||||
type uint16 {
|
||||
range "0..9000";
|
||||
}
|
||||
units "seconds";
|
||||
description
|
||||
"The value to be placed in the Router Lifetime field of
|
||||
Router Advertisements sent from the interface, in seconds.
|
||||
It MUST be either zero or between max-rtr-adv-interval and
|
||||
9000 seconds. A value of zero indicates that the router is
|
||||
not to be used as a default router. These limits may be
|
||||
overridden by specific documents that describe how IPv6
|
||||
operates over different link layers.
|
||||
|
||||
If this parameter is not configured, the device SHOULD use
|
||||
a value of 3 * max-rtr-adv-interval.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
AdvDefaultLifeTime.";
|
||||
}
|
||||
container prefix-list {
|
||||
description
|
||||
"Configuration of prefixes to be placed in Prefix
|
||||
Information options in Router Advertisement messages sent
|
||||
from the interface.
|
||||
|
||||
Prefixes that are advertised by default but do not have
|
||||
their entries in the child 'prefix' list are advertised
|
||||
with the default values of all parameters.
|
||||
|
||||
The link-local prefix SHOULD NOT be included in the list
|
||||
of advertised prefixes.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
|
||||
AdvPrefixList.";
|
||||
list prefix {
|
||||
key "prefix-spec";
|
||||
description
|
||||
"Configuration of an advertised prefix entry.";
|
||||
leaf prefix-spec {
|
||||
type inet:ipv6-prefix;
|
||||
description
|
||||
"IPv6 address prefix.";
|
||||
}
|
||||
choice control-adv-prefixes {
|
||||
default "advertise";
|
||||
description
|
||||
"The prefix either may be explicitly removed from the
|
||||
set of advertised prefixes, or parameters with which
|
||||
it is advertised may be specified (default case).";
|
||||
leaf no-advertise {
|
||||
type empty;
|
||||
description
|
||||
"The prefix will not be advertised.
|
||||
|
||||
This can be used for removing the prefix from the
|
||||
default set of advertised prefixes.";
|
||||
}
|
||||
case advertise {
|
||||
leaf valid-lifetime {
|
||||
type uint32;
|
||||
units "seconds";
|
||||
default "2592000";
|
||||
description
|
||||
"The value to be placed in the Valid Lifetime in
|
||||
the Prefix Information option. The designated
|
||||
value of all 1's (0xffffffff) represents
|
||||
infinity.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6
|
||||
(IPv6) - AdvValidLifetime.";
|
||||
}
|
||||
leaf on-link-flag {
|
||||
type boolean;
|
||||
default "true";
|
||||
description
|
||||
"The value to be placed in the on-link flag
|
||||
('L-bit') field in the Prefix Information
|
||||
option.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6
|
||||
(IPv6) - AdvOnLinkFlag.";
|
||||
}
|
||||
leaf preferred-lifetime {
|
||||
type uint32;
|
||||
units "seconds";
|
||||
must ". <= ../valid-lifetime" {
|
||||
description
|
||||
"This value MUST NOT be greater than
|
||||
valid-lifetime.";
|
||||
}
|
||||
default "604800";
|
||||
description
|
||||
"The value to be placed in the Preferred Lifetime
|
||||
in the Prefix Information option. The designated
|
||||
value of all 1's (0xffffffff) represents
|
||||
infinity.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6
|
||||
(IPv6) - AdvPreferredLifetime.";
|
||||
}
|
||||
leaf autonomous-flag {
|
||||
type boolean;
|
||||
default "true";
|
||||
description
|
||||
"The value to be placed in the Autonomous Flag
|
||||
field in the Prefix Information option.";
|
||||
reference
|
||||
"RFC 4861: Neighbor Discovery for IP version 6
|
||||
(IPv6) - AdvAutonomousFlag.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
augment "/rt:routing/rt:routing-instance/rt:routing-protocols/"
|
||||
+ "rt:routing-protocol/rt:static-routes" {
|
||||
description
|
||||
"This augment defines the configuration of the 'static'
|
||||
pseudo-protocol with data specific to IPv6 unicast.";
|
||||
container ipv6 {
|
||||
description
|
||||
"Configuration of a 'static' pseudo-protocol instance
|
||||
consists of a list of routes.";
|
||||
list route {
|
||||
key "destination-prefix";
|
||||
ordered-by "user";
|
||||
description
|
||||
"A user-ordered list of static routes.";
|
||||
leaf destination-prefix {
|
||||
type inet:ipv6-prefix;
|
||||
mandatory "true";
|
||||
description
|
||||
"IPv6 destination prefix.";
|
||||
}
|
||||
leaf description {
|
||||
type string;
|
||||
description
|
||||
"Textual description of the route.";
|
||||
}
|
||||
container next-hop {
|
||||
description
|
||||
"Configuration of next-hop.";
|
||||
grouping next-hop-content {
|
||||
description
|
||||
"Next-hop content for IPv6 unicast static routes.";
|
||||
uses rt:next-hop-content {
|
||||
augment "next-hop-options" {
|
||||
description
|
||||
"Add next-hop address case.";
|
||||
leaf next-hop-address {
|
||||
type inet:ipv6-address;
|
||||
description
|
||||
"IPv6 address of the next-hop.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
choice simple-or-list {
|
||||
description
|
||||
"Options for next-hops.";
|
||||
list multipath-entry {
|
||||
if-feature rt:multipath-routes;
|
||||
key "name";
|
||||
description
|
||||
"List of alternative next-hops.";
|
||||
leaf name {
|
||||
type string;
|
||||
description
|
||||
"A unique identifier of the next-hop entry.";
|
||||
}
|
||||
uses next-hop-content;
|
||||
uses rt:next-hop-classifiers;
|
||||
}
|
||||
case simple-next-hop {
|
||||
uses next-hop-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* RPC methods */
|
||||
|
||||
augment "/rt:fib-route/rt:input/rt:destination-address" {
|
||||
when "rt:address-family='v6ur:ipv6-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv6 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments the 'rt:destination-address' parameter of
|
||||
the 'rt:fib-route' operation.";
|
||||
leaf address {
|
||||
type inet:ipv6-address;
|
||||
description
|
||||
"IPv6 destination address.";
|
||||
}
|
||||
}
|
||||
|
||||
augment "/rt:fib-route/rt:output/rt:route" {
|
||||
when "rt:address-family='v6ur:ipv6-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv6 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments the reply to the 'rt:fib-route'
|
||||
operation.";
|
||||
leaf destination-prefix {
|
||||
type inet:ipv6-prefix;
|
||||
description
|
||||
"IPv6 destination prefix.";
|
||||
}
|
||||
}
|
||||
|
||||
augment "/rt:fib-route/rt:output/rt:route/rt:next-hop/"
|
||||
+ "rt:next-hop-options/rt:simple-next-hop" {
|
||||
when "../rt:address-family='v4ur:ipv6-unicast'" {
|
||||
description
|
||||
"This augment is valid only for IPv6 unicast.";
|
||||
}
|
||||
description
|
||||
"This leaf augments the 'simple-next-hop' case in the reply to
|
||||
the 'rt:fib-route' operation.";
|
||||
leaf next-hop-address {
|
||||
type inet:ipv6-address;
|
||||
description
|
||||
"IPv6 address of the next-hop.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1112
example/ietf-routing@2014-10-26.yang
Normal file
1112
example/ietf-routing@2014-10-26.yang
Normal file
File diff suppressed because it is too large
Load diff
481
example/ietf-yang-types@2013-07-15.yang
Normal file
481
example/ietf-yang-types@2013-07-15.yang
Normal file
|
|
@ -0,0 +1,481 @@
|
|||
module ietf-yang-types {
|
||||
|
||||
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types";
|
||||
prefix "yang";
|
||||
|
||||
organization
|
||||
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
|
||||
|
||||
contact
|
||||
"WG Web: <http://tools.ietf.org/wg/netmod/>
|
||||
WG List: <mailto:netmod@ietf.org>
|
||||
|
||||
WG Chair: David Kessens
|
||||
<mailto:david.kessens@nsn.com>
|
||||
|
||||
WG Chair: Juergen Schoenwaelder
|
||||
<mailto:j.schoenwaelder@jacobs-university.de>
|
||||
|
||||
Editor: Juergen Schoenwaelder
|
||||
<mailto:j.schoenwaelder@jacobs-university.de>";
|
||||
|
||||
description
|
||||
"This module contains a collection of generally useful derived
|
||||
YANG data types.
|
||||
|
||||
Copyright (c) 2013 IETF Trust and the persons identified as
|
||||
authors of the code. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, is permitted pursuant to, and subject
|
||||
to the license terms contained in, the Simplified BSD License
|
||||
set forth in Section 4.c of the IETF Trust's Legal Provisions
|
||||
Relating to IETF Documents
|
||||
(http://trustee.ietf.org/license-info).
|
||||
|
||||
This version of this YANG module is part of RFC 6991; see
|
||||
the RFC itself for full legal notices.";
|
||||
|
||||
revision 2013-07-15 {
|
||||
description
|
||||
"This revision adds the following new data types:
|
||||
- yang-identifier
|
||||
- hex-string
|
||||
- uuid
|
||||
- dotted-quad";
|
||||
reference
|
||||
"RFC 6991: Common YANG Data Types";
|
||||
}
|
||||
|
||||
revision 2010-09-24 {
|
||||
description
|
||||
"Initial revision.";
|
||||
reference
|
||||
"RFC 6021: Common YANG Data Types";
|
||||
}
|
||||
|
||||
/*** collection of counter and gauge types ***/
|
||||
|
||||
typedef counter32 {
|
||||
type uint32;
|
||||
description
|
||||
"The counter32 type represents a non-negative integer
|
||||
that monotonically increases until it reaches a
|
||||
maximum value of 2^32-1 (4294967295 decimal), when it
|
||||
wraps around and starts increasing again from zero.
|
||||
|
||||
Counters have no defined 'initial' value, and thus, a
|
||||
single value of a counter has (in general) no information
|
||||
content. Discontinuities in the monotonically increasing
|
||||
value normally occur at re-initialization of the
|
||||
management system, and at other times as specified in the
|
||||
description of a schema node using this type. If such
|
||||
other times can occur, for example, the creation of
|
||||
a schema node of type counter32 at times other than
|
||||
re-initialization, then a corresponding schema node
|
||||
should be defined, with an appropriate type, to indicate
|
||||
the last discontinuity.
|
||||
|
||||
The counter32 type should not be used for configuration
|
||||
schema nodes. A default statement SHOULD NOT be used in
|
||||
combination with the type counter32.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the Counter32 type of the SMIv2.";
|
||||
reference
|
||||
"RFC 2578: Structure of Management Information Version 2
|
||||
(SMIv2)";
|
||||
}
|
||||
|
||||
typedef zero-based-counter32 {
|
||||
type yang:counter32;
|
||||
default "0";
|
||||
description
|
||||
"The zero-based-counter32 type represents a counter32
|
||||
that has the defined 'initial' value zero.
|
||||
|
||||
A schema node of this type will be set to zero (0) on creation
|
||||
and will thereafter increase monotonically until it reaches
|
||||
a maximum value of 2^32-1 (4294967295 decimal), when it
|
||||
wraps around and starts increasing again from zero.
|
||||
|
||||
Provided that an application discovers a new schema node
|
||||
of this type within the minimum time to wrap, it can use the
|
||||
'initial' value as a delta. It is important for a management
|
||||
station to be aware of this minimum time and the actual time
|
||||
between polls, and to discard data if the actual time is too
|
||||
long or there is no defined minimum time.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the ZeroBasedCounter32 textual convention of the SMIv2.";
|
||||
reference
|
||||
"RFC 4502: Remote Network Monitoring Management Information
|
||||
Base Version 2";
|
||||
}
|
||||
|
||||
typedef counter64 {
|
||||
type uint64;
|
||||
description
|
||||
"The counter64 type represents a non-negative integer
|
||||
that monotonically increases until it reaches a
|
||||
maximum value of 2^64-1 (18446744073709551615 decimal),
|
||||
when it wraps around and starts increasing again from zero.
|
||||
|
||||
Counters have no defined 'initial' value, and thus, a
|
||||
single value of a counter has (in general) no information
|
||||
content. Discontinuities in the monotonically increasing
|
||||
value normally occur at re-initialization of the
|
||||
management system, and at other times as specified in the
|
||||
description of a schema node using this type. If such
|
||||
other times can occur, for example, the creation of
|
||||
a schema node of type counter64 at times other than
|
||||
re-initialization, then a corresponding schema node
|
||||
should be defined, with an appropriate type, to indicate
|
||||
the last discontinuity.
|
||||
|
||||
The counter64 type should not be used for configuration
|
||||
schema nodes. A default statement SHOULD NOT be used in
|
||||
combination with the type counter64.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the Counter64 type of the SMIv2.";
|
||||
reference
|
||||
"RFC 2578: Structure of Management Information Version 2
|
||||
(SMIv2)";
|
||||
}
|
||||
|
||||
typedef zero-based-counter64 {
|
||||
type yang:counter64;
|
||||
default "0";
|
||||
description
|
||||
"The zero-based-counter64 type represents a counter64 that
|
||||
has the defined 'initial' value zero.
|
||||
|
||||
|
||||
|
||||
|
||||
A schema node of this type will be set to zero (0) on creation
|
||||
and will thereafter increase monotonically until it reaches
|
||||
a maximum value of 2^64-1 (18446744073709551615 decimal),
|
||||
when it wraps around and starts increasing again from zero.
|
||||
|
||||
Provided that an application discovers a new schema node
|
||||
of this type within the minimum time to wrap, it can use the
|
||||
'initial' value as a delta. It is important for a management
|
||||
station to be aware of this minimum time and the actual time
|
||||
between polls, and to discard data if the actual time is too
|
||||
long or there is no defined minimum time.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the ZeroBasedCounter64 textual convention of the SMIv2.";
|
||||
reference
|
||||
"RFC 2856: Textual Conventions for Additional High Capacity
|
||||
Data Types";
|
||||
}
|
||||
|
||||
typedef gauge32 {
|
||||
type uint32;
|
||||
description
|
||||
"The gauge32 type represents a non-negative integer, which
|
||||
may increase or decrease, but shall never exceed a maximum
|
||||
value, nor fall below a minimum value. The maximum value
|
||||
cannot be greater than 2^32-1 (4294967295 decimal), and
|
||||
the minimum value cannot be smaller than 0. The value of
|
||||
a gauge32 has its maximum value whenever the information
|
||||
being modeled is greater than or equal to its maximum
|
||||
value, and has its minimum value whenever the information
|
||||
being modeled is smaller than or equal to its minimum value.
|
||||
If the information being modeled subsequently decreases
|
||||
below (increases above) the maximum (minimum) value, the
|
||||
gauge32 also decreases (increases).
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the Gauge32 type of the SMIv2.";
|
||||
reference
|
||||
"RFC 2578: Structure of Management Information Version 2
|
||||
(SMIv2)";
|
||||
}
|
||||
|
||||
typedef gauge64 {
|
||||
type uint64;
|
||||
description
|
||||
"The gauge64 type represents a non-negative integer, which
|
||||
may increase or decrease, but shall never exceed a maximum
|
||||
value, nor fall below a minimum value. The maximum value
|
||||
cannot be greater than 2^64-1 (18446744073709551615), and
|
||||
the minimum value cannot be smaller than 0. The value of
|
||||
a gauge64 has its maximum value whenever the information
|
||||
being modeled is greater than or equal to its maximum
|
||||
value, and has its minimum value whenever the information
|
||||
being modeled is smaller than or equal to its minimum value.
|
||||
If the information being modeled subsequently decreases
|
||||
below (increases above) the maximum (minimum) value, the
|
||||
gauge64 also decreases (increases).
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the CounterBasedGauge64 SMIv2 textual convention defined
|
||||
in RFC 2856";
|
||||
reference
|
||||
"RFC 2856: Textual Conventions for Additional High Capacity
|
||||
Data Types";
|
||||
}
|
||||
|
||||
/*** collection of identifier-related types ***/
|
||||
|
||||
typedef object-identifier {
|
||||
type string {
|
||||
pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))'
|
||||
+ '(\.(0|([1-9]\d*)))*';
|
||||
}
|
||||
description
|
||||
"The object-identifier type represents administratively
|
||||
assigned names in a registration-hierarchical-name tree.
|
||||
|
||||
Values of this type are denoted as a sequence of numerical
|
||||
non-negative sub-identifier values. Each sub-identifier
|
||||
value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
|
||||
are separated by single dots and without any intermediate
|
||||
whitespace.
|
||||
|
||||
The ASN.1 standard restricts the value space of the first
|
||||
sub-identifier to 0, 1, or 2. Furthermore, the value space
|
||||
of the second sub-identifier is restricted to the range
|
||||
0 to 39 if the first sub-identifier is 0 or 1. Finally,
|
||||
the ASN.1 standard requires that an object identifier
|
||||
has always at least two sub-identifiers. The pattern
|
||||
captures these restrictions.
|
||||
|
||||
Although the number of sub-identifiers is not limited,
|
||||
module designers should realize that there may be
|
||||
implementations that stick with the SMIv2 limit of 128
|
||||
sub-identifiers.
|
||||
|
||||
This type is a superset of the SMIv2 OBJECT IDENTIFIER type
|
||||
since it is not restricted to 128 sub-identifiers. Hence,
|
||||
this type SHOULD NOT be used to represent the SMIv2 OBJECT
|
||||
IDENTIFIER type; the object-identifier-128 type SHOULD be
|
||||
used instead.";
|
||||
reference
|
||||
"ISO9834-1: Information technology -- Open Systems
|
||||
Interconnection -- Procedures for the operation of OSI
|
||||
Registration Authorities: General procedures and top
|
||||
arcs of the ASN.1 Object Identifier tree";
|
||||
}
|
||||
|
||||
typedef object-identifier-128 {
|
||||
type object-identifier {
|
||||
pattern '\d*(\.\d*){1,127}';
|
||||
}
|
||||
description
|
||||
"This type represents object-identifiers restricted to 128
|
||||
sub-identifiers.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the OBJECT IDENTIFIER type of the SMIv2.";
|
||||
reference
|
||||
"RFC 2578: Structure of Management Information Version 2
|
||||
(SMIv2)";
|
||||
}
|
||||
|
||||
typedef yang-identifier {
|
||||
type string {
|
||||
length "1..max";
|
||||
pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
|
||||
pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*';
|
||||
}
|
||||
description
|
||||
"A YANG identifier string as defined by the 'identifier'
|
||||
rule in Section 12 of RFC 6020. An identifier must
|
||||
start with an alphabetic character or an underscore
|
||||
followed by an arbitrary sequence of alphabetic or
|
||||
numeric characters, underscores, hyphens, or dots.
|
||||
|
||||
A YANG identifier MUST NOT start with any possible
|
||||
combination of the lowercase or uppercase character
|
||||
sequence 'xml'.";
|
||||
reference
|
||||
"RFC 6020: YANG - A Data Modeling Language for the Network
|
||||
Configuration Protocol (NETCONF)";
|
||||
}
|
||||
|
||||
/*** collection of types related to date and time***/
|
||||
|
||||
typedef date-and-time {
|
||||
type string {
|
||||
pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'
|
||||
+ '(Z|[\+\-]\d{2}:\d{2})';
|
||||
}
|
||||
description
|
||||
"The date-and-time type is a profile of the ISO 8601
|
||||
standard for representation of dates and times using the
|
||||
Gregorian calendar. The profile is defined by the
|
||||
date-time production in Section 5.6 of RFC 3339.
|
||||
|
||||
The date-and-time type is compatible with the dateTime XML
|
||||
schema type with the following notable exceptions:
|
||||
|
||||
(a) The date-and-time type does not allow negative years.
|
||||
|
||||
(b) The date-and-time time-offset -00:00 indicates an unknown
|
||||
time zone (see RFC 3339) while -00:00 and +00:00 and Z
|
||||
all represent the same time zone in dateTime.
|
||||
|
||||
(c) The canonical format (see below) of data-and-time values
|
||||
differs from the canonical format used by the dateTime XML
|
||||
schema type, which requires all times to be in UTC using
|
||||
the time-offset 'Z'.
|
||||
|
||||
This type is not equivalent to the DateAndTime textual
|
||||
convention of the SMIv2 since RFC 3339 uses a different
|
||||
separator between full-date and full-time and provides
|
||||
higher resolution of time-secfrac.
|
||||
|
||||
The canonical format for date-and-time values with a known time
|
||||
zone uses a numeric time zone offset that is calculated using
|
||||
the device's configured known offset to UTC time. A change of
|
||||
the device's offset to UTC time will cause date-and-time values
|
||||
to change accordingly. Such changes might happen periodically
|
||||
in case a server follows automatically daylight saving time
|
||||
(DST) time zone offset changes. The canonical format for
|
||||
date-and-time values with an unknown time zone (usually
|
||||
referring to the notion of local time) uses the time-offset
|
||||
-00:00.";
|
||||
reference
|
||||
"RFC 3339: Date and Time on the Internet: Timestamps
|
||||
RFC 2579: Textual Conventions for SMIv2
|
||||
XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
|
||||
}
|
||||
|
||||
typedef timeticks {
|
||||
type uint32;
|
||||
description
|
||||
"The timeticks type represents a non-negative integer that
|
||||
represents the time, modulo 2^32 (4294967296 decimal), in
|
||||
hundredths of a second between two epochs. When a schema
|
||||
node is defined that uses this type, the description of
|
||||
the schema node identifies both of the reference epochs.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the TimeTicks type of the SMIv2.";
|
||||
reference
|
||||
"RFC 2578: Structure of Management Information Version 2
|
||||
(SMIv2)";
|
||||
}
|
||||
|
||||
typedef timestamp {
|
||||
type yang:timeticks;
|
||||
description
|
||||
"The timestamp type represents the value of an associated
|
||||
timeticks schema node at which a specific occurrence
|
||||
happened. The specific occurrence must be defined in the
|
||||
description of any schema node defined using this type. When
|
||||
the specific occurrence occurred prior to the last time the
|
||||
associated timeticks attribute was zero, then the timestamp
|
||||
value is zero. Note that this requires all timestamp values
|
||||
to be reset to zero when the value of the associated timeticks
|
||||
attribute reaches 497+ days and wraps around to zero.
|
||||
|
||||
The associated timeticks schema node must be specified
|
||||
in the description of any schema node using this type.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the TimeStamp textual convention of the SMIv2.";
|
||||
reference
|
||||
"RFC 2579: Textual Conventions for SMIv2";
|
||||
}
|
||||
|
||||
/*** collection of generic address types ***/
|
||||
|
||||
typedef phys-address {
|
||||
type string {
|
||||
pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
description
|
||||
"Represents media- or physical-level addresses represented
|
||||
as a sequence octets, each octet represented by two hexadecimal
|
||||
numbers. Octets are separated by colons. The canonical
|
||||
representation uses lowercase characters.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the PhysAddress textual convention of the SMIv2.";
|
||||
reference
|
||||
"RFC 2579: Textual Conventions for SMIv2";
|
||||
}
|
||||
|
||||
typedef mac-address {
|
||||
type string {
|
||||
pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
|
||||
}
|
||||
description
|
||||
"The mac-address type represents an IEEE 802 MAC address.
|
||||
The canonical representation uses lowercase characters.
|
||||
|
||||
In the value set and its semantics, this type is equivalent
|
||||
to the MacAddress textual convention of the SMIv2.";
|
||||
reference
|
||||
"IEEE 802: IEEE Standard for Local and Metropolitan Area
|
||||
Networks: Overview and Architecture
|
||||
RFC 2579: Textual Conventions for SMIv2";
|
||||
}
|
||||
|
||||
/*** collection of XML-specific types ***/
|
||||
|
||||
typedef xpath1.0 {
|
||||
type string;
|
||||
description
|
||||
"This type represents an XPATH 1.0 expression.
|
||||
|
||||
When a schema node is defined that uses this type, the
|
||||
description of the schema node MUST specify the XPath
|
||||
context in which the XPath expression is evaluated.";
|
||||
reference
|
||||
"XPATH: XML Path Language (XPath) Version 1.0";
|
||||
}
|
||||
|
||||
/*** collection of string types ***/
|
||||
|
||||
typedef hex-string {
|
||||
type string {
|
||||
pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
|
||||
}
|
||||
description
|
||||
"A hexadecimal string with octets represented as hex digits
|
||||
separated by colons. The canonical representation uses
|
||||
lowercase characters.";
|
||||
}
|
||||
|
||||
typedef uuid {
|
||||
type string {
|
||||
pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'
|
||||
+ '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
|
||||
}
|
||||
description
|
||||
"A Universally Unique IDentifier in the string representation
|
||||
defined in RFC 4122. The canonical representation uses
|
||||
lowercase characters.
|
||||
|
||||
The following is an example of a UUID in string representation:
|
||||
f81d4fae-7dec-11d0-a765-00a0c91e6bf6
|
||||
";
|
||||
reference
|
||||
"RFC 4122: A Universally Unique IDentifier (UUID) URN
|
||||
Namespace";
|
||||
}
|
||||
|
||||
typedef dotted-quad {
|
||||
type string {
|
||||
pattern
|
||||
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
|
||||
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
|
||||
}
|
||||
description
|
||||
"An unsigned 32-bit number expressed in the dotted-quad
|
||||
notation, i.e., four octets written as decimal numbers
|
||||
and separated with the '.' (full stop) character.";
|
||||
}
|
||||
}
|
||||
|
||||
27
example/routing.conf.local
Normal file
27
example/routing.conf.local
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Main YANG module first parsed by parser (in CLICON_YANG_DIR). eg clicon.yang.
|
||||
|
||||
# Save values as XML in database instead of lvec:s.
|
||||
# This is optimized for yang specified applications
|
||||
# But not compatible with key-based application (eg Rost)
|
||||
CLICON_DB_XML 1
|
||||
|
||||
# Startup CLI mode. This should match the CLICON_MODE in your startup clispec file
|
||||
CLICON_CLI_MODE routing
|
||||
|
||||
# Option used to construct initial yang file:
|
||||
# <module>[@<revision>]
|
||||
# This option is only relevant if CLICON_DBSPEC_TYPE is YANG
|
||||
CLICON_YANG_MODULE_MAIN ietf-ip
|
||||
|
||||
# Option used to construct initial yang file:
|
||||
# <module>[@<revision>]
|
||||
# This option is only relevant if CLICON_DBSPEC_TYPE is YANG
|
||||
CLICON_YANG_MODULE_REVISION 2014-06-16
|
||||
|
||||
# Generate code for CLI completion of existing db symbols
|
||||
# CLICON_CLI_GENMODEL_COMPLETION 0
|
||||
CLICON_CLI_GENMODEL_COMPLETION 1
|
||||
|
||||
# How to generate and show CLI syntax: VARS|ALL
|
||||
# CLICON_CLI_GENMODEL_TYPE VARS
|
||||
CLICON_CLI_GENMODEL_TYPE VARS
|
||||
78
example/routing_backend.c
Normal file
78
example/routing_backend.c
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
*
|
||||
Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
|
||||
|
||||
This file is part of CLIXON.
|
||||
|
||||
CLIXON is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CLIXON is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with CLIXON; see the file COPYING. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*
|
||||
* IETF yang routing example
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
/* clicon */
|
||||
#include <cligen/cligen.h>
|
||||
|
||||
/* Clicon library functions. */
|
||||
#include <clicon/clicon.h>
|
||||
|
||||
/* These include signatures for plugin and transaction callbacks. */
|
||||
#include <clicon/clicon_backend.h>
|
||||
|
||||
/*
|
||||
* Commit callback.
|
||||
* We do nothing here but simply create the config based on the current
|
||||
* db once everything is done as if will then contain the new config.
|
||||
*/
|
||||
int
|
||||
transaction_commit(clicon_handle h,
|
||||
transaction_data td)
|
||||
{
|
||||
fprintf(stderr, "%s\n", __FUNCTION__);
|
||||
transaction_print(stderr, td);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
transaction_validate(clicon_handle h,
|
||||
transaction_data td)
|
||||
{
|
||||
fprintf(stderr, "%s\n", __FUNCTION__);
|
||||
transaction_print(stderr, td);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Plugin initialization
|
||||
*/
|
||||
int
|
||||
plugin_init(clicon_handle h)
|
||||
{
|
||||
int retval = -1;
|
||||
|
||||
retval = 0;
|
||||
// done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
57
example/routing_cli.c
Normal file
57
example/routing_cli.c
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
*
|
||||
Copyright (C) 2009-2013 Olof Hagsand and Benny Holmgren
|
||||
|
||||
This file is part of CLICON.
|
||||
|
||||
CLICON is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CLICON is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with CLICON; see the file COPYING. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*
|
||||
* hello clicon cli frontend
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include <netinet/in.h>
|
||||
#include <fnmatch.h> /* matching strings */
|
||||
#include <signal.h> /* matching strings */
|
||||
|
||||
/* clicon */
|
||||
#include <cligen/cligen.h>
|
||||
#include <clicon/clicon.h>
|
||||
#include <clicon/clicon_cli.h>
|
||||
|
||||
/*
|
||||
* Plugin initialization
|
||||
*/
|
||||
int
|
||||
plugin_init(clicon_handle h)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
srandom(tv.tv_usec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
45
example/routing_cli.cli
Normal file
45
example/routing_cli.cli
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# $Id: datamodel_cli.cli,v 1.2 2013/09/19 15:02:38 olof Exp $
|
||||
# Common CLI syntax for both server and PMNode operatio mode
|
||||
CLICON_MODE="routing";
|
||||
CLICON_PROMPT="%U@%H> ";
|
||||
|
||||
# Note, when switching to PT, change datamodel to only @datamodel
|
||||
#set @datamodel:ietf-routing, cli_merge();
|
||||
#set @datamodel:ietf-ipv4-unicast-routing, cli_merge();
|
||||
set @datamodel:ietf-ip, cli_merge();
|
||||
|
||||
#delete("Delete a configuration item") @datamodel:ietf-ipv4-unicast-routing, cli_del();
|
||||
delete("Delete a configuration item") @datamodel:ietf-ip, cli_del();
|
||||
|
||||
validate("Validate changes"), cli_validate();
|
||||
commit("Commit the changes"), cli_commit((int)0); # snapshot
|
||||
quit("Quit Hello"), cli_quit();
|
||||
delete("Delete a configuration item") all("Delete whole candidate configuration"), delete_all("candidate");
|
||||
|
||||
no("Negate or remove") debug("Debugging parts of the system"), cli_debug((int)0);
|
||||
debug("Debugging parts of the system"), cli_debug((int)1);{
|
||||
level("Set debug level: 1..n") <level:int32>("Set debug level (0..n)"), cli_debug();
|
||||
}
|
||||
|
||||
discard("Discard edits (rollback 0)"), discard_changes();
|
||||
|
||||
show("Show a particular state of the system"){
|
||||
xpath("Show configuration") <xpath:string>("XPATH expression"), show_conf_xpath("candidate");
|
||||
compare("Compare candidate and running databases"), compare_dbs((int32)0);{
|
||||
xml("Show comparison in xml"), compare_dbs((int32)0);
|
||||
text("Show comparison in text"), compare_dbs((int32)1);
|
||||
}
|
||||
configuration("Show configuration"), show_conf_as_text("candidate /");{
|
||||
xml("Show configuration as XML"), show_conf_as_xml("candidate /");
|
||||
netconf("Show configuration as netconf edit-config operation"), show_conf_as_netconf("candidate /");
|
||||
text("Show configuration as text"), show_conf_as_text("candidate /");
|
||||
cli("Show configuration as cli commands"), show_conf_as_cli("candidate /");
|
||||
json("Show configuration as cli commands"), show_conf_as_json("candidate /");
|
||||
}
|
||||
}
|
||||
|
||||
save("Save candidate configuration to XML file") <filename:string>("Filename (local filename)"), save_config_file("candidate filename");
|
||||
load("Load configuration from XML file") <filename:string>("Filename (local filename)"),load_config_file("filename replace");{
|
||||
replace("Replace candidate with file contents"), load_config_file("filename replace");
|
||||
merge("Merge file with existent candidate"), load_config_file("filename merge");
|
||||
}
|
||||
62
example/routing_netconf.c
Normal file
62
example/routing_netconf.c
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
*
|
||||
Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
|
||||
|
||||
This file is part of CLIXON.
|
||||
|
||||
CLIXON is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
CLIXON is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with CLIXON; see the file COPYING. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <cligen/cligen.h>
|
||||
#include <clicon/clicon.h>
|
||||
#include <clicon/clicon_netconf.h>
|
||||
|
||||
|
||||
/*
|
||||
* Plugin initialization
|
||||
*/
|
||||
int
|
||||
plugin_init(clicon_handle h)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Plugin start
|
||||
* Called once everything has been initialized, right before
|
||||
* the main event loop is entered.
|
||||
*/
|
||||
int
|
||||
plugin_start(clicon_handle h, int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
plugin_exit(clicon_handle h)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue