--- /dev/null
+module openconfig-types {
+ yang-version "1";
+
+ namespace "http://openconfig.net/yang/openconfig-types";
+
+ prefix "oc-types";
+
+ // import statements
+ import openconfig-extensions { prefix oc-ext; }
+
+ // meta
+ organization
+ "OpenConfig working group";
+
+ contact
+ "OpenConfig working group
+ netopenconfig@googlegroups.com";
+
+ description
+ "This module contains a set of general type definitions that
+ are used across OpenConfig models. It can be imported by modules
+ that make use of these types.";
+
+ oc-ext:openconfig-version "0.4.0";
+
+ revision "2018-01-16" {
+ description
+ "Add interval to min/max/avg stats; add percentage stat";
+ reference "0.4.0";
+ }
+
+ revision "2017-08-16" {
+ description
+ "Apply fix for ieetfloat32 length parameter";
+ reference "0.3.3";
+ }
+
+ revision "2017-01-13" {
+ description
+ "Add ADDRESS_FAMILY identity";
+ reference "0.3.2";
+ }
+
+ revision "2016-11-14" {
+ description
+ "Correct length of ieeefloat32";
+ reference "0.3.1";
+ }
+
+ revision "2016-11-11" {
+ description
+ "Additional types - ieeefloat32 and routing-password";
+ reference "0.3.0";
+ }
+
+ revision "2016-05-31" {
+ description
+ "OpenConfig public release";
+ reference "0.2.0";
+ }
+
+ typedef percentage {
+ type uint8 {
+ range "0..100";
+ }
+ description
+ "Integer indicating a percentage value";
+ }
+
+ typedef std-regexp {
+ type string;
+ description
+ "This type definition is a placeholder for a standard
+ definition of a regular expression that can be utilised in
+ OpenConfig models. Further discussion is required to
+ consider the type of regular expressions that are to be
+ supported. An initial proposal is POSIX compatible.";
+ }
+
+ typedef timeticks64 {
+ type uint64;
+ description
+ "This type is based on the timeticks type defined in
+ RFC 6991, but with 64-bit width. It represents the time,
+ modulo 2^64, in hundredths of a second between two epochs.";
+ reference
+ "RFC 6991 - Common YANG Data Types";
+ }
+
+ typedef ieeefloat32 {
+ type binary {
+ length "4";
+ }
+ description
+ "An IEEE 32-bit floating point number. The format of this number
+ is of the form:
+ 1-bit sign
+ 8-bit exponent
+ 23-bit fraction
+ The floating point value is calculated using:
+ (-1)**S * 2**(Exponent-127) * (1+Fraction)";
+ }
+
+ typedef routing-password {
+ type string;
+ description
+ "This type is indicative of a password that is used within
+ a routing protocol which can be returned in plain text to the
+ NMS by the local system. Such passwords are typically stored
+ as encrypted strings. Since the encryption used is generally
+ well known, it is possible to extract the original value from
+ the string - and hence this format is not considered secure.
+ Leaves specified with this type should not be modified by
+ the system, and should be returned to the end-user in plain
+ text. This type exists to differentiate passwords, which
+ may be sensitive, from other string leaves. It could, for
+ example, be used by the NMS to censor this data when
+ viewed by particular users.";
+ }
+
+ typedef stat-interval {
+ type uint64;
+ units nanoseconds;
+ description
+ "A time interval over which a set of statistics is computed.
+ A common usage is to report the interval over which
+ avg/min/max stats are computed and reported.";
+ }
+
+ grouping stat-interval-state {
+ description
+ "Reusable leaf definition for stats computation interval";
+
+ leaf interval {
+ type oc-types:stat-interval;
+ description
+ "The time interval over which the min/max/average statistics
+ are computed by the system.";
+ }
+ }
+
+ grouping avg-min-max-stats-precision1 {
+ description
+ "Common nodes for recording average, minimum, and
+ maximum values for a statistic. These values all have
+ fraction-digits set to 1.";
+
+ leaf avg {
+ type decimal64 {
+ fraction-digits 1;
+ }
+ description
+ "The arithmetic mean value of the statistic over the
+ sampling period.";
+ }
+
+ leaf min {
+ type decimal64 {
+ fraction-digits 1;
+ }
+ description
+ "The minimum value of the statistic over the sampling
+ period";
+ }
+
+ leaf max {
+ type decimal64 {
+ fraction-digits 1;
+ }
+ description
+ "The maximum value of the statitic over the sampling
+ period";
+ }
+
+ uses stat-interval-state;
+ }
+
+ grouping avg-min-max-instant-stats-precision1 {
+ description
+ "Common grouping for recording an instantaneous statistic value
+ in addition to avg-min-max stats";
+
+ leaf instant {
+ type decimal64 {
+ fraction-digits 1;
+ }
+ description
+ "The instantaneous value of the statistic.";
+ }
+
+ uses avg-min-max-stats-precision1;
+ }
+
+ grouping avg-min-max-instant-stats-precision2-dB {
+ description
+ "Common grouping for recording dB values with 2 decimal
+ precision. Values include the instantaneous, average,
+ minimum, and maximum statistics";
+
+ leaf instant {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units dB;
+ description
+ "The instantaneous value of the statistic.";
+ }
+
+ leaf avg {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units dB;
+ description
+ "The arithmetic mean value of the statistic over the
+ sampling period.";
+ }
+
+ leaf min {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units dB;
+ description
+ "The minimum value of the statistic over the sampling
+ period";
+ }
+
+ leaf max {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units dB;
+ description
+ "The maximum value of the statistic over the sampling
+ period";
+ }
+
+ uses stat-interval-state;
+ }
+
+ grouping avg-min-max-instant-stats-precision2-dBm {
+ description
+ "Common grouping for recording dBm values with 2 decimal
+ precision. Values include the instantaneous, average,
+ minimum, and maximum statistics";
+
+ leaf instant {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units dBm;
+ description
+ "The instantaneous value of the statistic.";
+ }
+
+ leaf avg {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units dBm;
+ description
+ "The arithmetic mean value of the statistic over the
+ sampling period.";
+ }
+
+ leaf min {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units dBm;
+ description
+ "The minimum value of the statistic over the sampling
+ period";
+ }
+
+ leaf max {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units dBm;
+ description
+ "The maximum value of the statistic over the sampling
+ period";
+ }
+
+ uses stat-interval-state;
+ }
+
+ grouping avg-min-max-instant-stats-precision2-mA {
+ description
+ "Common grouping for recording mA values with 2 decimal
+ precision. Values include the instantaneous, average,
+ minimum, and maximum statistics";
+
+ leaf instant {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units mA;
+ description
+ "The instantaneous value of the statistic.";
+ }
+
+ leaf avg {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units mA;
+ description
+ "The arithmetic mean value of the statistic over the
+ sampling period.";
+ }
+
+ leaf min {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units mA;
+ description
+ "The minimum value of the statistic over the sampling
+ period";
+ }
+
+ leaf max {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ units mA;
+ description
+ "The maximum value of the statistic over the sampling
+ period";
+ }
+
+ uses stat-interval-state;
+ }
+
+ grouping avg-min-max-instant-stats-pct {
+ description
+ "Common grouping for percentage statistics.";
+
+ leaf instant {
+ type oc-types:percentage;
+ description
+ "The instantaneous percentage value.";
+ }
+
+ leaf avg {
+ type oc-types:percentage;
+ description
+ "The arithmetic mean value of the percentage measure of the
+ statistic over the sampling period.";
+ }
+
+ leaf min {
+ type oc-types:percentage;
+ description
+ "The minimum value of the percentage measure of the
+ statistic over the sampling period";
+ }
+
+ leaf max {
+ type oc-types:percentage;
+ description
+ "The maximum value of the percentage measure of the
+ statistic over the sampling period";
+ }
+
+ uses stat-interval-state;
+ }
+
+ identity ADDRESS_FAMILY {
+ description
+ "A base identity for all address families";
+ }
+
+ identity IPV4 {
+ base ADDRESS_FAMILY;
+ description
+ "The IPv4 address family";
+ }
+
+ identity IPV6 {
+ base ADDRESS_FAMILY;
+ description
+ "The IPv6 address family";
+ }
+
+ identity MPLS {
+ base ADDRESS_FAMILY;
+ description
+ "The MPLS address family";
+ }
+
+ identity L2_ETHERNET {
+ base ADDRESS_FAMILY;
+ description
+ "The 802.3 Ethernet address family";
+ }
+
+}
\ No newline at end of file