-
Notifications
You must be signed in to change notification settings - Fork 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support PTP Yang model based on IEEE standard (#1103)
(A) release/models/ptp/openconfig-ptp.yang (A) release/models/ptp/openconfig-ptp-types.yang * Support PTP Yang model based on IEEE standard
- Loading branch information
Showing
3 changed files
with
1,505 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
} | ||
} |
Oops, something went wrong.