Skip to content

Define PTP model for the Dell Enterprise SONiC collection #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions models/enterprise_sonic/ptp_default_ds/deleted_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Using deleted
#
# Before State:
# -------------
#
# sonic# show running-configuration ptp
# ptp network-transport l2 multicast
# ptp domain 25
# ptp domain-profile default
# ptp priority1 101
# ptp priority2 91
# ptp log-announce-interval 1
# ptp log-sync-interval -3
# sonic#

- name: Delete specified PTP configurations
dellemc.enterprise_sonic.sonic_ptp:
config:
log-sync-interval: -3
log-announce-interval: 1
network-transport: 'L2'
unicast-multicast: 'multicast'
priority1: 101
priority2: 91
domain-number: 25
state: deleted

# After State:
# ------------
#
# sonic# show running-configuration ptp
# ptp domain-profile default
# sonic#
30 changes: 30 additions & 0 deletions models/enterprise_sonic/ptp_default_ds/deleted_example_02.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Using deleted
#
# Before State:
# -------------
#
# sonic# show running-configuration ptp
# ptp mode boundary-clock
# ptp network-transport ipv6 unicast
# ptp domain 45
# ptp domain-profile g8275.2
# ptp announce-timeout 3
# sonic#

- name: Delete all PTP configurations
dellemc.enterprise_sonic.sonic_ptp:
config:
announce-receipt-timeout: 3
network-transport: 'ipv6'
unicast-multicast: 'unicast'
domain-number: 45
clock-type: 'BC'
domain-profile: 'G.8275.2'
state: deleted

# After State:
# ------------
#
# sonic# show running-configuration ptp

# sonic#
38 changes: 38 additions & 0 deletions models/enterprise_sonic/ptp_default_ds/merged_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Using merged
#
# Before State:
# -------------
#
# sonic# show running-configuration ptp
# ptp domain 35
# ptp domain-profile default
# ptp priority2 100
# sonic#

- name: Merge provided global PTP configurations
dellemc.enterprise_sonic.sonic_ptp:
config:
domain-profile: 'G.8275.1'
log-sync-interval: -4
log-announce-interval: -3
announce-receipt-timeout: 5
log-min-delay-req-interval: -4
clock-type: 'BC'
network-transport: 'L2'
unicast-multicast: 'multicast'
state: merged

# After State:
# ------------
#
# sonic# show running-configuration ptp
# ptp mode boundary-clock
# ptp network-transport l2 multicast
# ptp domain 35
# ptp domain-profile g8275.1
# ptp priority2 100
# ptp log-announce-interval -3
# ptp announce-timeout 5
# ptp log-sync-interval -4
# ptp log-min-delay-req-interval -4
# sonic#
34 changes: 34 additions & 0 deletions models/enterprise_sonic/ptp_default_ds/overridden_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Using overridden
#
# Before State:
# -------------
#
# sonic# show running-configuration ptp
# ptp mode boundary-clock
# ptp network-transport l2 multicast
# ptp domain 35
# ptp domain-profile g8275.1
# ptp priority2 100
# ptp log-announce-interval -3
# ptp announce-timeout 5
# ptp log-sync-interval -4
# ptp log-min-delay-req-interval -4
# sonic#

- name: Override device configuration of ptp with provided configuration
dellemc.enterprise_sonic.sonic_ptp:
config:
domain-number: 44
domain-profile: 'G.8275.2'
network-transport: 'ipv4'
unicast-multicast: 'unicast'
state: overridden

# After State:
# ------------
#
# sonic# show running-configuration ptp
# ptp network-transport ipv4 unicast
# ptp domain 44
# ptp domain-profile g8275.2
# sonic#
39 changes: 39 additions & 0 deletions models/enterprise_sonic/ptp_default_ds/replaced_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Using replaced
#
# Before State:
# -------------
#
# sonic# show running-configuration ptp
# ptp network-transport ipv4 unicast
# ptp domain 44
# ptp domain-profile default
# ptp priority1 100
# ptp priority2 90
# ptp log-announce-interval -2
# ptp log-sync-interval -4
# sonic#

- name: Replace global PTP configurations
dellemc.enterprise_sonic.sonic_ptp:
config:
log-sync-interval: -3
log-announce-interval: 1
network-transport: 'L2'
unicast-multicast: 'multicast'
priority1 101
priority2 91
domain-number: 25
state: replaced

# After State:
# ------------
#
# sonic# show running-configuration ptp
# ptp network-transport l2 multicast
# ptp domain 25
# ptp domain-profile default
# ptp priority1 101
# ptp priority2 91
# ptp log-announce-interval 1
# ptp log-sync-interval -3
# sonic#
115 changes: 115 additions & 0 deletions models/enterprise_sonic/ptp_default_ds/sonic_ptp_default_ds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
GENERATOR_VERSION: '1.0'
ANSIBLE_METADATA: |
{
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community',
'license': 'Apache 2.0'
}
NETWORK_OS: sonic
RESOURCE: ptp_default_ds
COPYRIGHT: Copyright 2025 Dell Inc. or its subsidiaries. All Rights Reserved
DOCUMENTATION: |
module: sonic_ptp_default_ds
version_added: '3.1.0'
short_description: Manage global PTP configurations on SONiC
description:
- This module provides configuration management of global PTP
parameters for devices running SONiC.
- The device should have timing chip support.
author: 'Vidya Chidambaram (@vidyac86)'
options:
config:
description:
- Specifies global PTP clock configurations.
type: dict
suboptions:
priority1:
description:
- The priority1 attribute of the local clock.
- The range is from 0 to 255.
type: int
priority2:
description:
- The priority2 attribute of the local clock.
- The range is from 0 to 255.
type: int
domain_number:
description:
- The domain number of the current syntonization domain.
- The range is from 0 to 127.
type: int
log_announce_interval:
description:
- The base-2 logarithm of the mean announceInterval (mean time
interval between successive Announce messages).
type: int
announce_receipt_timeout:
description:
- The number of announceIntervals that have to pass
without receipt of an Announce message before the
occurrence of the event ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES.
type: int
log_sync_interval:
description:
- The base-2 logarithm of the mean SyncInterval for multicast messages.
type: int
log_min_delay_req_interval:
description:
- The base-2 logarithm of the minDelayReqInterval.
- The minimum permitted mean time interval between successive Delay_Req messages.
type: int
two_step_flag:
description:
- The clockAccuracy indicates the expected accuracy of the clock.
type: int
clock_type:
description:
- Specifies the type of clock configured in the PTP domain.
type: str
choices: ['BC', 'E2E_TC', 'P2P_TC', 'disable']
network_transport:
description:
- The network transport used for communication.
type: str
choices: ['L2', 'UDPv4', 'UDPv6']
unicast_multicast:
description:
- Specifies whether the network transport uses unicast or multicast communication.
type: str
choices: ['unicast', 'multicast']
domain_profile:
description:
- The method to be used when comparing data sets during the Best Master Clock Algorithm.
type: str
choices: ['ieee1588', 'G.8275.1', 'G.8275.2']
source_interface:
description:
- Source interface whose IP to use as source ip for PTP IPv4
and IPv6 multicast transport mode.
type: str

state:
description:
- The state of the configuration after module completion.
- C(merged) - Merges provided PTP configuration with on-device
configuration.
- C(replaced) - Replaces on-device PTP configuration with provided
configuration.
- C(overridden) - Overrides all on-device PTP configurations with the
provided configuration.
- C(deleted) - Deletes on-device PTP configuration.
type: str
choices:
- merged
- deleted
- replaced
- overridden
default: merged
EXAMPLES:
- deleted_example_01.txt
- deleted_example_02.txt
- merged_example_01.txt
- replaced_example_01.txt
- overridden_example_01.txt
26 changes: 26 additions & 0 deletions models/enterprise_sonic/ptp_port_ds/deleted_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Using deleted
#
# Before State:
# -------------
#
# sonic# show running-configuration ptp | grep "ptp port"
# ptp port add Ethernet0 role slave local-priority 100
# ptp port add Ethernet4 role master local-priority 90
# ptp port master-table Ethernet0 add 1.1.1.1
# sonic#

- name: Delete specified PTP configurations
dellemc.enterprise_sonic.sonic_ptp_port_ds:
config:
- interface: 'Ethernet4'
role: 'master'
localpriority: 90
state: deleted

# After State:
# ------------
#
# sonic# show running-configuration ptp
# ptp port add Ethernet0 role slave local-priority 100
# ptp port master-table Ethernet0 add 1.1.1.1
# sonic#
29 changes: 29 additions & 0 deletions models/enterprise_sonic/ptp_port_ds/deleted_example_02.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Using deleted
#
# Before State:
# -------------
#
# sonic# show running-configuration ptp | grep "ptp port"
# ptp port add Ethernet0 role slave local-priority 100
# ptp port add Ethernet4 role master local-priority 90
# ptp port master-table Ethernet0 add 1.1.1.1
# ptp port master-table Ethernet0 add 1.1.1.2
# sonic#

- name: Delete specified PTP configurations
dellemc.enterprise_sonic.sonic_ptp_port_ds:
config:
- interface: 'Ethernet0'
role: 'slave'
localpriority: 100
unicasttable:
- '1.1.1.1'
- '1.1.1.2'
state: deleted

# After State:
# ------------
#
# sonic# show running-configuration ptp
# ptp port add Ethernet4 role master local-priority 90
# sonic#
23 changes: 23 additions & 0 deletions models/enterprise_sonic/ptp_port_ds/merged_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Using merged
#
# Before State:
# -------------
#
# sonic# show running-configuration ptp | grep "ptp port"
# ptp port add Ethernet0
# sonic#

- name: Merge provided global PTP configurations
dellemc.enterprise_sonic.sonic_ptp_port_ds:
config:
- interface: 'Ethernet0'
role: 'slave'
localpriority: 100
state: merged

# After State:
# ------------
#
# sonic# show running-configuration ptp | grep "ptp port"
# ptp port add Ethernet0 role slave local-priority 100
# sonic#
Loading