Email: ndelecro@cisco.com
This repository contains a NX-SDK application to provide more advanced PTP monitoring capabilities on Nexus 9K:
- Rogue Grandmaster enforcement: shutdown interfaces when they must not be connected to a PTP master, only to a PTP slave.
- Display a syslog when the PTP state of an interface changes (example: master to slave).
- Display a syslog when the PTP correction exceeds a threshold. The threshold is defined with the CLI "ptpMonitoring correction-threshold".
Copy ptpMonitoring-1.0-7.0.3.I6.1.x86_64.rpm to the switch.
Install the app:
switch(config)# feature nxsdk
switch(config)# exit
switch# install add bootflash:ptpMonitoring-1-7.0.3.I6.1.x86_64.rpm
switch# install activate ptpMonitoring-1-7.0.3.I6.1.x86_64
switch# conf t
switch(config)# nxsdk service-name /isan/bin/ptpMonitoring
Verify that the app is running:
switch# show nxsdk internal service
Stop the app:
switch(config)# no nxsdk service-name /isan/bin/ptpMonitoring
The app code can be modified directly on the switch without re-packaging it into an RPM:
switch(config)# feature bash-shell
switch(config)# run bash
bash-4.2$ sudo su
bash-4.2$ vi /isan/bin/ptpMonitoring
Start the app from bash:
bash-4.2# /isan/bin/python /isan/bin/ptpMonitoring
Stop the app:
switch# ptpMonitoring stop-event-loop
switch# sh nxsdk internal service
NXSDK Started/Temp unavailabe/Max services : 1/0/32
NXSDK Default App Path : /isan/bin/nxsdk
NXSDK Supported Versions : 1.0
Service-name Base App Started(PID) Version RPM Package
------------------------- --------------- ----------------- ---------- ------------------------
/isan/bin/ptpMonitoring nxsdk_app1 VSH(23042) 1.0 ptpMonitoring-1-7.0.3.I6.1.x86_64
switch#
switch# sh ptp brief
PTP port status
----------------------------------
Port State
---------------- ----------------
Eth1/41 Master
Eth1/42 Master
Eth1/43 Master
switch# 2017 May 24 10:40:28 switch %NXSDK-1-ALERT_MSG: nxsdk_app1 [23042] [ptpMonitoring] PTP parent id change: old = 00:f6:63:ff:fe:10:a0:0b, new = 00:11:01:ff:fe:00:00:01
2017 May 24 10:40:29 switch %NXSDK-5-NOTICE_MSG: nxsdk_app1 [23042] [ptpMonitoring] PTP port state change: port = Eth1/41, old state = master, new state = slave
switch# sh ptp brief
PTP port status
----------------------------------
Port State
---------------- ----------------
Eth1/41 Slave
Eth1/42 Master
Eth1/43 Master
switch# sh ptp corrections
PTP past corrections
-----------------------------------------------------------------------------------
Slave Port SUP Time Correction(ns) MeanPath Delay(ns)
---------- ------------------------------- ------------------ ------------------
Eth1/41 Wed May 24 10:40:45 2017 39403 40 104
Eth1/41 Wed May 24 10:40:44 2017 39512 64 104
Eth1/41 Wed May 24 10:40:43 2017 39182 32 96
switch(config)# ptpMonitoring correction-threshold 10
switch(config)# 2017 May 24 10:40:55 switch %NXSDK-4-WARNING_MSG: nxsdk_app1 [23042] [ptpMonitoring] PTP correction too high: correction=44
2017 May 24 10:40:27 switch %NXSDK-5-NOTICE_MSG: nxsdk_app1 [23042] [ptpMonitoring] PTP port state change: port = Eth1/43, old state = master, new state = slave
2017 May 24 10:40:27 switch %NXSDK-3-ERR_MSG: nxsdk_app1 [23042] [ptpMonitoring] PTP GM should not be on interface Eth1/43, shutting down