diff --git a/release/models/ptp/.spec.yml b/release/models/ptp/.spec.yml new file mode 100644 index 000000000..ff369d9e3 --- /dev/null +++ b/release/models/ptp/.spec.yml @@ -0,0 +1,8 @@ +- name: openconfig-ptp + docs: + - yang/ptp/openconfig-ptp-types.yang + - yang/ptp/openconfig-ptp.yang + build: + - yang/ptp/openconfig-ptp-types.yang + - yang/ptp/openconfig-ptp.yang + run-ci: true diff --git a/release/models/ptp/openconfig-ptp-types.yang b/release/models/ptp/openconfig-ptp-types.yang new file mode 100644 index 000000000..943569639 --- /dev/null +++ b/release/models/ptp/openconfig-ptp-types.yang @@ -0,0 +1,299 @@ +module openconfig-ptp-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/ptp-types"; + + prefix "oc-ptp-types"; + + import openconfig-extensions { + prefix oc-ext; + } + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net "; + + description + "This module defines types and identities used in OpenConfig + models related to Precision Time Protocol (PTP). + + IEEE code is subject to the following copyright and license: + Copyright (c) 2020 by The Institute of Electrical and Electronics + Engineers, Inc. All rights reserved."; + + oc-ext:openconfig-version "1.0.0"; + + revision 2024-09-17 { + description + "Initial Public Version"; + reference "1.0.0"; + } + + // extension statements + + // feature statements + + // identity statements + + identity TIME_SOURCE { + description + "Enumeration for the source of time used by the Grandmaster + PTP Instance. + YANG identity is used so that a PTP Profile's YANG augment + can assign values, using numeric range F0 to FE hex."; + reference + "7.6.2.8 of IEEE Std 1588-2019"; + } + + identity CLOCK_CLASS { + description + "Enumeration that denotes the traceability, synchronization + state and expected performance of the time or frequency + distributed by the Grandmaster PTP Instance. + IEEE Std 1588 does not specify a name for each clock-class, + but the names below are intended to be as intuitive as possible. + YANG identity is used so that a PTP Profile's YANG augment + can assign values using a numeric range designated for use by + alternate PTP Profiles."; + reference + "7.6.2.5 of IEEE Std 1588-2019"; + } + + identity CLOCK_ACCURACY { + description + "Enumeration that indicates the expected accuracy of a + PTP Instance when it is the Grandmaster PTP Instance, + or in the event it becomes the Grandmaster PTP Instance. + The value shall be conservatively estimated by the PTP + Instance to a precision consistent with the value of the + selected clock-accuracy and of the next lower enumerated + value, for example, for clockAccuracy = 23 hex, between + 250 ns and 1000 ns. + IEEE Std 1588 does not specify a name for each clock-accuracy, + but the names below are intended to be as intuitive as possible. + YANG identity is used so that a PTP Profile's YANG augment + can assign values, using numeric range 80 to FD hex."; + reference + "7.6.2.6 of IEEE Std 1588-2019"; + } + + typedef clock-identity { + type string { + pattern "[0-9A-F]{2}(-[0-9A-F]{2}){7}"; + oc-ext:posix-pattern '^[0-9A-F]{2}(-[0-9A-F]{2}){7}$'; + } + description + "Identifies unique entities within a PTP Network, + e.g. a PTP Instance or an entity of a common service. + The identity is an 8-octet array, constructed according + to specifications in IEEE Std 1588, using an + organization identifier from the IEEE Registration + Authority. + Each octet is represented in YANG as a pair of + hexadecimal characters, using uppercase for a letter. + Each octet in the array is separated by the dash + character."; + reference + "5.3.4 of IEEE Std 1588-2019 + 7.5.2.2 of IEEE Std 1588-2019"; + } + + typedef time-interval { + type int64; + description + "Time interval, expressed in nanoseconds, multiplied by 2^16. + Positive or negative time intervals outside the maximum range + of this data type shall be encoded as the largest positive and + negative values of the data type, respectively."; + reference + "5.3.2 of IEEE Std 1588-2019"; + } + +typedef instance-type { + type enumeration { + enum OC { + value 0; + description + "Ordinary Clock"; + } + enum BC { + value 1; + description + "Boundary Clock"; + } + enum P2P_TC { + value 2; + description + "Peer-to-peer Transparent Clock"; + } + enum E2E_TC { + value 3; + description + "End-to-end Transparent Clock"; + } + } + description + "Enumeration for the type of PTP Instance. + Values for this enumeration are specified by the IEEE 1588 + standard exclusively."; + reference + "8.2.1.5.5 of IEEE Std 1588-2019"; + } + + + typedef unicast-multicast-enumeration { + type enumeration { + enum UNICAST { + value 1; + description + "unicast"; + } + enum MULTICAST { + value 2; + description + "multicast"; + } + } + description + "Type definition for options when setting the unicast-multicast + attribute in the default data set"; + } + + typedef delay-mechanism-enumeration { + type enumeration { + enum E2E { + value 1; + description + "The port uses the delay request-response mechanism."; + } + enum P2P { + value 2; + description + "The port uses the peer delay mechanism."; + } + enum DISABLED { + value 254; + description + "The port does not implement any delay mechanism."; + } + } + description + "The propagation-delay measuring option used by the + port. Values for this enumeration are specified + by the IEEE Std 1588 standard exclusively."; + reference + "IEEE Std 1588-2008: 8.2.5.4.4"; + } + + typedef port-state-enumeration { + type enumeration { + enum INITIALIZING { + value 1; + description + "The port is initializing its data sets, hardware, and + communication facilities."; + } + enum FAULTY { + value 2; + description + "The port is in the fault state."; + } + enum DISABLED { + value 3; + description + "The port is disabled and is not communicating PTP + messages (other than possibly PTP management + messages)."; + } + enum LISTENING { + value 4; + description + "The port is listening for an Announce message."; + } + enum PRE_MASTER { + value 5; + description + "The port is in the pre-master state."; + } + enum MASTER { + value 6; + description + "The port is behaving as a master port."; + } + enum PASSIVE { + value 7; + description + "The port is in the passive state."; + } + enum UNCALIBRATED { + value 8; + description + "A master port has been selected, but the port is still + in the uncalibrated state."; + } + enum SLAVE { + value 9; + description + "The port is synchronizing to the selected master port."; + } + } + description + "The current state of the protocol engine associated + with the port. Values for this enumeration are specified + by the IEEE Std 1588 standard exclusively."; + reference + "IEEE Std 1588-2008: 8.2.5.3.1, 9.2.5"; + } + + typedef network-transport-enumeration { + type enumeration { + enum L2 { + value 1; + description + "Layer 2 network"; + } + enum UDPV4 { + value 2; + description + "UDPv4 network"; + } + enum UDPV6 { + value 3; + description + "UDPv6 network"; + } + } + description + "Type definition for options when setting the network transport + attribute in the default data set"; + } + + typedef domain-profile-enumeration { + type enumeration { + enum IEEE1588 { + value 1; + description + "default profile"; + } + enum G8275.1 { + value 2; + description + "g8275.1 profile"; + } + enum G8275.2 { + value 3; + description + "g8275.2 profile"; + } + } + description + "Type definition for options when setting the domain-profile + attribute in the default data set"; + } +} diff --git a/release/models/ptp/openconfig-ptp.yang b/release/models/ptp/openconfig-ptp.yang new file mode 100644 index 000000000..8c2a4c714 --- /dev/null +++ b/release/models/ptp/openconfig-ptp.yang @@ -0,0 +1,1198 @@ +module openconfig-ptp { + + yang-version "1"; + + namespace "http://openconfig.net/yang/ptp"; + + prefix "oc-ptp"; + + import ietf-interfaces { prefix if; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-ptp-types { prefix oc-ptp-types; } + + organization + "OpenConfig working group"; + contact + "OpenConfig working group + www.openconfig.net "; + description + "This YANG module defines a data model for the configuration + and state of IEEE Std 1588 clocks. IEEE Std 1588 specifies the + Precision Time Protocol (PTP). + + The nodes in this YANG module are designed for compatibility + with ietf-ptp.yang, the YANG data model for IEEE Std 1588-2008, + as specified in IETF RFC 8575. + + NOTE regarding default value: + PTP's concept of 'initialization value' is analogous to YANG's + concept of a 'default value'. According to 8.1.3.4 of + IEEE Std 1588-2019, the initialization value for configuration + is specified in IEEE Std 1588, but that value can be overridden + by a PTP Profile specification, or by the product that + implements PTP. This makes it challenging to repeat the + specification of initialization value using a YANG 'default' + statement, because there is no straightforward mechanism for + a PTP Profile's (or product's) YANG module to import this + module and override its YANG default. Since a YANG management + client can read the default value from the operational + datastore, there is no need to re-specify the default in YANG. + The implementer of PTP refers to the relevant PTP + specifications for the default (not YANG modules). + Therefore, this YANG module avoids use of the YANG 'default' + statement. + + NOTE regarding IEEE Std 1588 classification: + 8.1.2 of IEEE Std 1588-2019 specifies a classification of + each data set member, which corresponds to a leaf in YANG. + The relationship between 1588 classification and + YANG 'config' (i.e., whether the leaf is read-write) is: + - 1588 static: The leaf is 'config false' (read-only). + - 1588 configurable: The leaf is 'config true', which is + the default value for a YANG leaf. + - 1588 dynamic: A judgement is made on a member-by-member + basis. If the member corresponds to the first item of + 8.1.2.1.2 of IEEE Std 1588-2019 (i.e., value from protocol + only, such as log of protocol behavior), the YANG leaf + is 'config false'. Otherwise, the member's value can be + provided by an entity outside PTP (e.g., NETCONF or + RESTCONF client), and therefore the YANG leaf is + 'config true'. + + NOTE regarding terminology (two YANG modules): + To accommodate the need by some organizations to use the + original terminology specified by IEEE Std 1588, and the + need by some other organizations to use the alternative + terminology specified in 4.4 of IEEE Std 1588g-2022, + two YANG modules are provided by IEEE Std 1588e (MIB and + YANG Data Models). For a detailed explanation, see 15.4.2.11 + of IEEE Std 1588e. + This module uses the original terminology specified by + IEEE Std 1588 (master/slave). + + IEEE code is subject to the following copyright and license: + Copyright (c) 2020 by The Institute of Electrical and Electronics + Engineers, Inc. All rights reserved."; + + oc-ext:openconfig-version "1.0.0"; + + revision 2024-09-17 { + description + "Initial revision. IEEE Std 1588e-XXXX, IEEE Standard for a Precision + Clock Synchronization Protocol for Networked Measurement and Control + Systems - MIB and YANG Data Models."; + reference + "1.0.0"; + } + + grouping instance-config { + description + "Config state data of an instance of the PTP"; + + leaf id { + type uint32; + description + "The instance list is indexed using a number that is unique per PTP + Instance within the PTP Node, applicable to the management context + only (i.e. not used in PTP messages). The domain-number of the PTP + Instance is not used as the key to instance-list, since it is possible + for a PTP Node to contain multiple PTP Instances using the same + domain-number."; + reference + "8.1.4.2 of IEEE Std 1588-2019"; + } + } + + grouping instance-state { + description + "Operational state data of an instance of the PTP"; + + uses instance-config; + } + + grouping current-ds-state { + description + "Provides current data from operation of the protocol."; + reference + "8.2.2 of IEEE Std 1588-2019"; + + leaf steps-removed { + type uint16; + config false; + description + "The number of PTP Communication Paths traversed + between this PTP Instance and the Grandmaster + PTP Instance."; + reference + "8.2.2.2 of IEEE Std 1588-2019"; + } + + leaf offset-from-master { + type oc-ptp-types:time-interval; + config false; + description + "The current value of the time difference between + a Master PTP Instance and a Slave PTP Instance as + computed by the Slave PTP Instance. + NOTE - When a PTP Profile requires a Boundary + Clock to transfer offset information internally + from Slave PTP Port to Master PTP Port(s), this value + effectively returns the offset from the Grandmaster + PTP Instance."; + reference + "8.2.2.3 of IEEE Std 1588-2019"; + } + + leaf mean-path-delay { + type oc-ptp-types:time-interval; + config false; + status deprecated; + description + "In IEEE Std 1588-2008, currentDS.meanDelay was called + currentDS.meanPathDelay. While the specification of + this member is retained in the current standard, the + member is renamed to currentDS.meanDelay. This change + is consistent with other changes that ensure clarity + and consistency of naming, where + - 'path' is associated with the + request-response mechanism + - 'link' is associated with the + peer-to-peer delay mechanism"; + reference + "8.2.2.4 of IEEE Std 1588-2008"; + } + } + + grouping time-properties-ds-state { + description + "Provides data learned from the current Grandmaster PTP Instance."; + reference + "8.2.4 of IEEE Std 1588-2019"; + leaf current-utc-offset { + when "../current-utc-offset-valid='true'"; + type int16; + description + "Specified as in IERS Bulletin C, this provides + the offset from UTC (TAI - UTC). The offset is in + units of seconds."; + reference + "7.2.4 of IEEE Std 1588-2019 + 8.2.4.2 of IEEE Std 1588-2019"; + } + + leaf current-utc-offset-valid { + type boolean; + description + "The value of current-utc-offset-valid shall be true + if the values of current-utc-offset, leap59, and leap61 + are known to be correct, otherwise it shall be false. + NOTE - The constraint for leap59 and leap61 did not + exist in IEEE Std 1588-2008, and for compatibility, + corresponding when statements were not included below."; + reference + "8.2.4.3 of IEEE Std 1588-2019"; + } + + leaf leap59 { + type boolean; + description + "If the timescale is PTP, a true value for leap59 + shall indicate that the last minute of the + current UTC day contains 59 seconds. + If the timescale is not PTP, the value shall be + false."; + reference + "8.2.4.4 of IEEE Std 1588-2019"; + } + + leaf leap61 { + type boolean; + description + "If the timescale is PTP, a true value for leap61 shall indicate + that the last minute of the current UTC day contains 61 seconds. + If the timescale is not PTP, the value shall be false."; + reference + "8.2.4.5 of IEEE Std 1588-2019"; + } + + leaf time-traceable { + type boolean; + description + "The value of time-traceable shall be true if the timescale is + traceable to a primary reference; otherwise, the value shall be + false. The uncertainty specifications appropriate to the + evaluation of whether traceability to a primary reference is + achieved should be defined in the applicable PTP Profile. In + the absence of such a definition the value of time-traceable is + implementation specific."; + reference + "8.2.4.6 of IEEE Std 1588-2019"; + } + + leaf frequency-traceable { + type boolean; + description + "The value of time-traceable shall be true if the frequency + determining the timescale is traceable to a primary reference; + otherwise, the value shall be false. + The uncertainty specifications appropriate to the evaluation + of whether traceability to a primary reference is achieved + should be defined in the applicable PTP Profile. In the absence + of such a definition the value of frequency-traceable is + implementation specific."; + reference + "8.2.4.7 of IEEE Std 1588-2019"; + } + + leaf ptp-timescale { + type boolean; + description + "If ptp-timescale is true, the timescale of the Grandmaster PTP + Instance is PTP, which is the elapsed time since the PTP epoch + measured using the second defined by International Atomic Time (TAI). + If ptp-timescale is false, the timescale of the Grandmaster PTP + Instance is ARB, which is the elapsed time since an arbitrary epoch."; + reference + "7.2.1 of IEEE Std 1588-2019 + 8.2.4.8 of IEEE Std 1588-2019"; + } + + leaf time-source { + type identityref { + base oc-ptp-types:TIME_SOURCE; + } + description + "The source of time used by the Grandmaster + PTP Instance."; + reference + "7.6.2.8 of IEEE Std 1588-2019 + 8.2.4.9 of IEEE Std 1588-2019"; + } + } + + grouping default-ds-config { + description + "Config state data of default data set of the clock"; + + leaf priority1 { + type uint8; + description + "The IEEE Std 1588 priority1 of the PTP Instance. + Since priority1 is one of the first comparisons + performed by the Best Master Clock Algorithm (BMCA), + this leaf's configuration can be used to explicitly + select a Grandmaster PTP Instance. + Lower values take precedence. + The value of priority1 shall be configurable to any + value in the range 0 to 255, unless restricted by + limits established by the applicable PTP Profile."; + reference + "7.6.2.3 of IEEE Std 1588-2019 + 8.2.1.4.1 of IEEE Std 1588-2019"; + } + leaf priority2 { + type uint8; + description + "The IEEE Std 1588 priority2 of the PTP Instance. + The priority2 member is compared by the Best Master + Clock Algorithm (BMCA) after priority1 and clockQuality. + Lower values take precedence. + The value of priority2 shall be configurable to any + value in the range 0 to 255, unless restricted by + limits established by the applicable PTP Profile."; + reference + "7.6.2.4 of IEEE Std 1588-2019 + 8.2.1.4.2 of IEEE Std 1588-2019"; + } + leaf domain-number { + type uint8; + description + "The IEEE Std 1588 domainNumber of the PTP Instance. + A domain consists of one or more PTP Instances + communicating with each other as defined by the + protocol. A domain shall define the scope of PTP message + communication, state, operations, data sets, and + timescale. Therefore, each domain represents a distinct + time. + Within a PTP Network, a domain is identified by two + data set members: domainNumber and sdoId. + The domainNumber is the primary mechanism for end users + and system integrators to isolate the operation of a + PTP Instance from PTP messages used in other domains. + The value of the domainNumber shall be configurable + to values permitted in IEEE Std 1588, unless the + allowed values are further restricted by the applicable + PTP Profile."; + reference + "7.1 of IEEE Std 1588-2019 + 8.2.1.4.3 of IEEE Std 1588-2019"; + } + leaf slave-only { + type boolean; + description + "The value of slave-only shall be true if the + PTP Instance is a slave-only PTP Instance + (false for non-slave-only). + The slave-only member can be true for Ordinary Clocks + only. + When slave-only is true, the PTP Instance implements + special behavior in the context of the state machines + that determine port-state."; + reference + "8.2.1.4.4 of IEEE Std 1588-2019 + 9.2.2.1 of IEEE Std 1588-2019"; + } + + leaf instance-type { + type oc-ptp-types:instance-type; + description + "The type of PTP Instance. + This leaf is read-only unless support for write is + explicitly specified by the applicable PTP Profile or + product specification."; + reference + "8.2.1.5.5 of IEEE Std 1588-2019"; + } + + leaf sdo-id { + type uint16 { + range "0..4095"; + } + description + "The IEEE Std 1588 sdoId of the PTP Instance. + A domain consists of one or more PTP Instances + communicating with each other as defined by the + protocol. A domain shall define the scope of PTP message + communication, state, operations, data sets, and + timescale. Therefore, each domain represents a distinct + time. + Within a PTP Network, a domain is identified by two + data set members: domainNumber and sdoId. + The sdoId of a domain is a 12-bit integer in the + closed range 0 to 4095. + The sdoId member is the primary mechanism for providing + isolation of PTP Instances operating a PTP Profile + specified by a Standards Development Organization (SDO), + from other PTP Instances operating a PTP Profile + specified by a different SDO."; + reference + "7.1 of IEEE Std 1588-2019 + 8.2.1.4.5 of IEEE Std 1588-2019 + 16.5 of IEEE Std 1588-2019"; + } + leaf network-transport { + type oc-ptp-types:network-transport-enumeration; + description + "The network transport used for communication"; + } + leaf unicast-multicast { + type oc-ptp-types:unicast-multicast-enumeration; + description + "Whether the network transport uses unicast or + multicast communication"; + } + leaf domain-profile { + type oc-ptp-types:domain-profile-enumeration; + description + "The method to be used when comparing data sets during + the Best Master Clock Algorithm."; + } + } + + grouping clock-quality-top { + description + "Quality of a PTP Instance, which contains IEEE Std 1588 + clockClass, clockAccuracy and offsetScaledLogVariance. + PTP Instances with better quality are more likely to + become the Grandmaster PTP Instance."; + reference + "5.3.7 of IEEE Std 1588-2019 + 8.2.1.3.1 of IEEE Std 1588-2019"; + + leaf clock-class { + type identityref { + base oc-ptp-types:CLOCK_CLASS; + } + description + "The clockClass denotes the traceability of the time + or frequency distributed by the clock."; + reference + "7.6.2.5 of IEEE Std 1588-2019 + 8.2.1.3.1.2 of IEEE Std 1588-2019"; + } + + leaf clock-accuracy { + type identityref { + base oc-ptp-types:CLOCK_ACCURACY; + } + description + "The clockAccuracy indicates the accuracy of the clock + (Local Clock of the PTP Instance)."; + reference + "7.6.2.6 of IEEE Std 1588-2019 + 8.2.1.3.1.3 of IEEE Std 1588-2019"; + } + + leaf offset-scaled-log-variance { + type uint16; + description + "The offsetScaledLogVariance indicates the stability of the + clock (Local Clock of the PTP Instance). It provides an + estimate of the variations of the clock from a linear timescale + when it is not synchronized to another clock using the + protocol."; + reference + "7.6.2.7 of IEEE Std 1588-2019"; + } + } + + grouping default-ds-state { + description + "Operational state data of default data set of the clock"; + uses default-ds-config; + + leaf two-step-flag { + type boolean; + description + "When set to true, the PTP Instance is two-step, + otherwise the PTP Instance is one-step. + This data set member is no longer used. However, + the twoStepFlag of the PTP common header is used. + One step or two step egress behavior is allowed to + be specified per PTP Port, or per PTP Instance. + Management of the one/two step egress behavior of + a PTP Port is not provided by this standard, but + can be specified as extensions to the data sets by a + PTP Profile or a product specification."; + reference + "8.2.1.2.1 of IEEE Std 1588-2019"; + } + + leaf clock-identity { + type oc-ptp-types:clock-identity; + description + "The IEEE Std 1588 clockIdentity of the PTP Instance."; + reference + "8.2.1.2.2 of IEEE Std 1588-2019"; + } + + leaf number-ports { + type uint16; + description + "The number of PTP Ports on the PTP Instance. + For an Ordinary Clock, the value shall be one."; + reference + "8.2.1.2.3 of IEEE Std 1588-2019"; + } + } + + grouping default-ds-top { + description + "Top-level grouping for default data sets of the clock, + including configuration and operational state data"; + + container default-ds { + description + "The default data set of the PTP Instance."; + reference + "8.2.1 of IEEE Std 1588-2019"; + + container clock-quality { + description + "The IEEE Std 1588 clockQuality of the PTP Instance. + PTP Instances with better quality are more likely to + become the Grandmaster PTP Instance."; + reference + "8.2.1.3.1 of IEEE Std 1588-2019"; + + container config { + description + "Config state data of clock-quality"; + uses clock-quality-top; + } + container state { + config false; + description + "Operational state data of clock-quality"; + uses clock-quality-top; + } + } + container config { + description + "Config state data of default data set of the clock"; + uses default-ds-config; + } + container state { + config false; + description + "Operational state data of default data set of the clock"; + uses default-ds-state; + } + } + } + + grouping port-identity { + description + "The IEEE Std 1588 PortIdentity type identifies a + PTP Port or Link Port."; + reference + "5.3.5 of IEEE Std 1588-2019"; + + leaf clock-identity { + type oc-ptp-types:clock-identity; + description + "IEEE Std 1588 clockIdentity."; + } + + leaf port-number { + type uint16; + description + "IEEE Std 1588 portNumber. + If portNumber is unavailable, the value 0 can + be used, or this leaf can be omitted from the + operational datastore."; + reference + "7.5.2.3 of IEEE Std 1588-2019"; + } + } + + grouping parent-ds-state { + description + "The parent data set of the clock (see IEEE Std 1588-2008 + subclause 8.2.3)."; + reference + "IEEE Std 1588-2008: 8.2.3"; + + container parent-port-identity { + description + "The IEEE Std 1588 portIdentity of the PTP Port on the + Master PTP Instance that issues the Sync messages + used in synchronizing this PTP Instance."; + reference + "8.2.3.2 of IEEE Std 1588-2019"; + uses port-identity; + } + + leaf parent-stats { + type boolean; + description + "When set to true, the values of + parent-ds/observed-parent-offset-scaled-log-variance + and + parent-ds/observed-parent-clock-phase-change-rate + have been measured and are valid."; + reference + "8.2.3.3 of IEEE Std 1588-2019"; + } + + leaf observed-parent-offset-scaled-log-variance { + type uint16; + description + "Estimate of the variance of the phase offset of the + Local PTP Clock of the Parent PTP Instance as measured + with respect to the Local PTP Clock in the Slave PTP + Instance. This measurement is optional, but if not made, + the value of parent-ds/parent-stats shall be false."; + reference + "7.6.3.3 of IEEE Std 1588-2019 + 7.6.3.5 of IEEE Std 1588-2019 + 8.2.3.4 of IEEE Std 1588-2019"; + } + + leaf observed-parent-clock-phase-change-rate { + type int32; + description + "Estimate of the phase change rate of the + Local PTP Clock of the Parent PTP Instance as measured + by the Slave PTP Instance using its Local PTP Clock. + If the estimate exceeds the capacity of its data type, + this value shall be set to 7FFF FFFF (base 16) or + 8000 0000 (base 16), as appropriate. A positive sign + indicates that the phase change rate in the + Parent PTP Instance is greater than that in the + Slave PTP Instance. The measurement of this value is + optional, but if not measured, the value of + parent-ds/parent-stats shall be false."; + reference + "7.6.4.4 of IEEE Std 1588-2019 + 8.2.3.5 of IEEE Std 1588-2019"; + } + + leaf grandmaster-identity { + type oc-ptp-types:clock-identity; + description + "The IEEE Std 1588 clockIdentity of the Grandmaster PTP + Instance."; + reference + "8.2.3.6 of IEEE Std 1588-2019"; + } + + container grandmaster-clock-quality { + description + "The IEEE Std 1588 clockQuality of the Grandmaster PTP + Instance."; + reference + "8.2.3.7 of IEEE Std 1588-2019"; + uses clock-quality-top; + } + + leaf grandmaster-priority1 { + type uint8; + description + "The IEEE Std 1588 priority1 of the Grandmaster PTP + Instance."; + reference + "8.2.3.8 of IEEE Std 1588-2019"; + } + + leaf grandmaster-priority2 { + type uint8; + description + "The IEEE Std 1588 priority2 of the Grandmaster PTP + Instance."; + reference + "8.2.3.9 of IEEE Std 1588-2019"; + } + } + + grouping parent-ds-top { + description + "Top-level grouping for parent data sets of the clock, including + configuration and operational state data"; + + container parent-ds { + description + "Provides data learned from the parent of this PTP Instance (i.e. + master port on the other side of the path/link)."; + reference + "8.2.3 of IEEE Std 1588-2019"; + + container state { + description + "Operational state data of parent data set"; + config false; + uses parent-ds-state; + } + } + } + + grouping ports-top { + description + "Top-level grouping for port data sets of the clock, + including configuration and operational state data"; + container ports { + description + "YANG container that is used to get all PTP Ports + in the PTP Instance. + YANG does not allow get of all elements in a YANG list, + so a YANG container wrapping the YANG list is provided for + that purpose. The naming convention uses plural for the + wrapping YANG container, and singular for the YANG list."; + list port { + key "port-index"; + description + "List of data for each PTP Port in the PTP Instance. + While the PTP Instance is disabled, it is possible to + have zero PTP Ports (i.e., ports not yet created). + While the PTP Instance is enabled, an Ordinary Clock + will have one PTP Port, and a Boundary Clock or + Transparent Clock will have more than one PTP Port."; + reference + "8.1.4.2 of IEEE Std 1588-2019"; + + leaf port-index { + type leafref { + path "../config/port-index"; + } + description + "The port list is indexed using a number that is + unique per PTP Port within the PTP Instance, + applicable to the management context only + (i.e., not used in PTP messages)."; + } + + container config { + description + "Config state data of port data set of the clock"; + uses port-config-top; + } + + container state { + description + "operational state data of port data set of the clock"; + config false; + uses port-config-top; + } + + uses port-ds-top; + } + } + } + + grouping port-config-top { + description + "Configuration data of port data set of the clock"; + leaf port-index { + type uint16; + description + "The port list is indexed using a number that is + unique per PTP Port within the PTP Instance, + applicable to the management context only + (i.e., not used in PTP messages)."; + } + + leaf underlying-interface { + type if:interface-ref; + description + "Reference to the configured underlying IETF YANG + interface that is used by this PTP Port for + transport of PTP messages. Among other data, + physical identifiers for the interface + (e.g., MAC address) can be obtained using this + reference."; + reference + "RFC 8343"; + } + } + + grouping port-ds-state-top { + description + "Operational state data of port data set of the clock"; + + leaf port-state { + type oc-ptp-types:port-state-enumeration; + description + "Current state of the protocol engine associated + with this PTP Port."; + reference + "8.2.15.3.1 of IEEE Std 1588-2019"; + } + + leaf peer-mean-path-delay { + type oc-ptp-types:time-interval; + description + "In IEEE Std 1588-2008, this data set member was + called portDS.peerMeanPathDelay. While the + specification of this member is retained in the + current standard, the member is renamed to + portDS.meanLinkDelay (i.e., ../mean-link-delay). + This change is consistent with other changes that + ensure clarity and consistency of naming, where + - 'path' is associated with the + request-response mechanism + - 'link' is associated with the + peer-to-peer delay mechanism"; + reference + "8.2.5.3.3 of IEEE Std 1588-2008"; + } + } + + grouping port-ds-top { + description + "Top-level container for port data set of PTP Port."; + container port-ds { + description + "Primary data set for the PTP Port."; + reference + "8.2.15 of IEEE Std 1588-2019"; + + container config { + description + "Configuration data of port data set of the clock"; + uses port-ds-config-top; + } + + container state { + description + "Operational state data of port data set of the clock"; + config false; + uses port-ds-config-top; + uses port-ds-state-top; + } + } + } + + grouping port-ds-config-top { + description + "Top-level container for configuration port data set of PTP Port."; + + leaf log-announce-interval { + type int8; + description + "Logarithm to the base 2 of the mean IEEE Std 1588 + announceInterval, the time interval between + successive Announce messages sent by a PTP Port."; + reference + "7.7.2.2 of IEEE Std 1588-2019 + 8.2.15.4.1 of IEEE Std 1588-2019"; + } + + leaf announce-receipt-timeout { + type uint8; + description + "The integral multiple of IEEE Std 1588 + announceInterval that must pass without receipt of + an Announce message before the occurrence of the + event ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES. The range + shall be 2 to 255 subject to further restrictions of + the applicable PTP Profile. While 2 is permissible, + normally the value should be at least 3."; + reference + "7.7.3.1 of IEEE Std 1588-2019 + 8.2.15.4.2 of IEEE Std 1588-2019"; + } + + leaf log-sync-interval { + type int8; + description + "Logarithm to the base 2 of the mean IEEE Std 1588 + syncInterval, the time interval between successive + Sync messages, when transmitted as multicast + messages. The rates for unicast transmissions are + negotiated separately on a per PTP Port basis and + are not constrained by this leaf."; + reference + "7.7.2.3 of IEEE Std 1588-2019 + 8.2.15.4.3 of IEEE Std 1588-2019"; + } + + leaf delay-mechanism { + type oc-ptp-types:delay-mechanism-enumeration; + description + "The path delay measuring mechanism used by the PTP + Port in computing (propagation delay)."; + reference + "8.2.15.4.4 of IEEE Std 1588-2019"; + } + + leaf log-min-pdelay-req-interval { + type int8; + description + "Logarithm to the base 2 of the IEEE Std 1588 + minPdelayReqInterval, the minimum permitted + mean time interval between successive Pdelay_Req + messages sent over a PTP Link."; + reference + "7.7.2.5 of IEEE Std 1588-2019 + 8.2.15.4.5 of IEEE Std 1588-2019"; + } + + leaf version-number { + type uint8; + description + "The PTP major version in use on the PTP Port. + NOTE - This indicates the version of the + IEEE 1588 standard, and not the version of an + applicable PTP Profile."; + reference + "8.2.15.4.6 of IEEE Std 1588-2019"; + } + + leaf log-min-delay-req-interval { + type int8; + description + "Logarithm to the base 2 of the IEEE Std 1588 + minDelayReqInterval, the minimum permitted + mean time interval between successive Delay_Req + messages sent by a Slave PTP Instance."; + reference + "7.7.2.4 of IEEE Std 1588-2019 + 8.2.15.3.2 of IEEE Std 1588-2019"; + } + + leaf unicast-multicast { + type oc-ptp-types:unicast-multicast-enumeration; + description + "Whether the network transport uses unicast or + multicast communication"; + } + } + + grouping transparent-clock-default-ds-config-top { + description + "Top-level container for configuration default data set of transparent clock."; + + leaf delay-mechanism { + type oc-ptp-types:delay-mechanism-enumeration; + description + "The propagation delay measuring mechanism (e2e or p2p)."; + reference + "8.3.2.3.1 of IEEE Std 1588-2019"; + } + + leaf primary-domain { + type uint8; + description + "The domainNumber of the primary syntonization domain."; + reference + "8.3.2.3.2 of IEEE Std 1588-2019"; + } + + leaf two-step-flag { + type boolean; + description + "When set to true, the clock is a two-step clock; + otherwise,the clock is a one-step clock."; + } + } + grouping transparent-clock-top { + description + "Top-level container for configuration and operational state data of transparent clock."; + + container transparent-clock-default-ds { + description + "This default data set was specified in + IEEE Std 1588-2008, and under some interpretations, + it applied to all domains, which in turn means that it + represents multiple Transparent Clocks. + In IEEE Std 1588-2019, this data set is specified as + applying to the PTP Node (all domains), but the data set is + deprecated. For new designs, the standard recommends that + Transparent Clocks use the PTP Instance data sets + (i.e., /ptp/instances/instance[]), such that each + Transparent Clock supports a single PTP Instance and + domain."; + reference + "8.3.1 of IEEE Std 1588-2019"; + + container config { + description + "Top-level container for configuration data of transparent clock."; + uses transparent-clock-default-ds-config-top; + } + container state { + description + "Top-level container for operational state data of transparent clock."; + + config false; + + uses transparent-clock-default-ds-config-top; + + leaf clock-identity { + type oc-ptp-types:clock-identity; + description + "The clockIdentity of the local clock."; + reference + "8.3.2.2.1 of IEEE Std 1588-2019"; + } + + leaf number-ports { + type uint16; + description + "The number of PTP Ports of the device."; + reference + "8.3.2.2.2 of IEEE Std 1588-2019"; + } + } + } + + container transparent-clock-ports { + description + "YANG container that is used to get all ports of the + IEEE Std 1588 transparentClockPortDS. + YANG does not allow get of all elements in a YANG list, + so a YANG container wrapping the YANG list is provided for + that purpose. The naming convention uses plural for the + wrapping YANG container, and singular for the YANG list."; + + list port { + description + "This list of Transparent Clock port data sets was specified + in IEEE Std 1588-2008, and under some interpretations, + it applied to all domains, which in turn means that it + represents multiple Transparent Clocks. + In IEEE Std 1588-2019, this list is specified as + applying to the PTP Node (all domains), but the list is + deprecated. For new designs, the standard recommends that + Transparent Clocks use the PTP Instance data sets + (i.e., /ptp/instances/instance[]), such that each + Transparent Clock supports a single PTP Instance + and domain."; + reference + "8.3.1 of IEEE Std 1588-2019"; + key "port-index"; + leaf port-index { + description + "The port list is indexed using a number that is + unique per PTP Port within the PTP Instance, + applicable to the management context only + (i.e., not used in PTP messages)."; + type leafref { + path "../config/port-index"; + } + } + + container config { + description + "Top-level container for configuration data of transparent clock port."; + uses port-config-top; + } + + container state { + description + "Top-level container for operational state data of transparent clock port."; + config false; + uses port-config-top; + } + + container port-ds { + description + "IEEE Std 1588 transparentClockPortDS."; + reference + "8.3.3 of IEEE Std 1588-2019"; + + container config { + description + "Configuration data of transparent clock port data set."; + uses transparent-port-ds-config-top; + } + container state { + description + "Operational state data of transparent clock port data set."; + config false; + uses transparent-port-ds-config-top; + container port-identity { + description + "The IEEE Std 1588 portIdentity of this port."; + reference + "8.3.3.2.1 of IEEE Std 1588-2019"; + uses port-identity; + } + leaf peer-mean-path-delay { + type oc-ptp-types:time-interval; + description + "An estimate of the current one-way propagation delay + on the link when the delayMechanism is P2P; otherwise, + it is zero."; + reference + "8.3.3.3.3 of IEEE Std 1588-2019"; + } + } + } + } + } + } + + grouping transparent-port-ds-config-top { + description + "Top-level container for configuration port data set of transparent clock port."; + leaf log-min-pdelay-req-interval { + type int8; + description + "The logarithm to the base 2 of the + minPdelayReqInterval (minimum permitted mean time + interval between successive Pdelay_Req messages)."; + reference + "8.3.3.3.1 of IEEE Std 1588-2019"; + } + + leaf faulty-flag { + type boolean; + description + "Shall be true if the port is faulty and false + if the port is operating normally."; + reference + "8.3.3.3.2 of IEEE Std 1588-2019"; + } + + leaf network-transport { + type oc-ptp-types:network-transport-enumeration; + description + "The network transport used for communication"; + } + } + + grouping ptp-top { + description + "Top-level grouping for PTP configuration and operational state data"; + + container ptp { + description + "Contains all YANG nodes for the PTP data sets. This hierarchy can be + augmented with YANG nodes for a specific vendor or PTP Profile."; + + container instances { + description + "YANG container that is used to get all PTP Instances. YANG does not + allow get of all elements in a YANG list, so a YANG container wrapping + the YANG list is provided for that purpose. The naming convention uses + plural for the wrapping YANG container, and singular for the YANG list."; + + list instance { + key "id"; + description + "List of one or more PTP Instances in the product (PTP Node). Each + PTP Instance represents a distinct instance of PTP implementation + (i.e. distinct Ordinary Clock, Boundary Clock, or Transparent Clock), + maintaining a distinct time. PTP Instances may be created or deleted + dynamically in implementations that support dynamic create/delete."; + reference + "8.1.4.2 of IEEE Std 1588-2019"; + + leaf id { + type leafref { + path "../config/id"; + } + description + "The instance list is indexed using a number that is unique per PTP + Instance within the PTP Node, applicable to the management context + only (i.e. not used in PTP messages). The domain-number of the PTP + Instance is not used as the key to instance-list, since it is possible + for a PTP Node to contain multiple PTP Instances using the same + domain-number."; + reference + "8.1.4.2 of IEEE Std 1588-2019"; + } + + container config { + description + "Configuration data for PTP instance."; + uses instance-config; + } + + container state { + description + "Operational state data for PTP instance."; + config false; + uses instance-state; + } + + container current-ds { + description + "Current data set state data of PTP instance."; + container state { + description + "Operational state current data set of PTP instance."; + config false; + uses current-ds-state; + } + } + container time-properties-ds { + description + "Time properties data set of PTP instance."; + container config { + description + "Configuration data of time properties data set."; + uses time-properties-ds-state; + } + + container state { + description + "Operational state data of time properties data set."; + config false; + uses time-properties-ds-state; + } + } + + uses default-ds-top; + uses parent-ds-top; + uses ports-top; + } + } + + uses transparent-clock-top; + } + } + + uses ptp-top; +}