// Module included in the following assemblies:
//
// * networking/ptp/configuring-ptp.adoc

:_mod-docs-content-type: PROCEDURE
[id="cnf-troubleshooting-common-ptp-operator-issues_{context}"]
= Troubleshooting common PTP Operator issues

[role="_abstract"]
Troubleshoot common problems with the PTP Operator by performing the following steps.

.Prerequisites

* Install the {product-title} CLI (`oc`).
* Log in as a user with `cluster-admin` privileges.
* Install the PTP Operator on a bare-metal cluster with hosts that support PTP.

.Procedure

. Check the Operator and operands are successfully deployed in the cluster for the configured nodes.
+
[source,terminal]
----
$ oc get pods -n openshift-ptp -o wide
----
+
.Example output
[source,terminal]
----
NAME                            READY   STATUS    RESTARTS   AGE     IP            NODE
linuxptp-daemon-lmvgn           3/3     Running   0          4d17h   10.1.196.24   compute-0.example.com
linuxptp-daemon-qhfg7           3/3     Running   0          4d17h   10.1.196.25   compute-1.example.com
ptp-operator-6b8dcbf7f4-zndk7   1/1     Running   0          5d7h    10.129.0.61   control-plane-1.example.com
----
+
[NOTE]
====
When the PTP fast event bus is enabled, the number of ready `linuxptp-daemon` pods is `3/3`. If the PTP fast event bus is not enabled, `2/2` is displayed.
====

. Check that supported hardware is found in the cluster.
+
[source,terminal]
----
$ oc -n openshift-ptp get nodeptpdevices.ptp.openshift.io
----
+
.Example output
[source,terminal]
----
NAME                                  AGE
control-plane-0.example.com           10d
control-plane-1.example.com           10d
compute-0.example.com                 10d
compute-1.example.com                 10d
compute-2.example.com                 10d
----

. Check the available PTP network interfaces for a node:
+
[source,terminal]
----
$ oc -n openshift-ptp get nodeptpdevices.ptp.openshift.io <node_name> -o yaml
----
+
where:
+
<node_name>:: Specifies the node you want to query, for example, `compute-0.example.com`.
+
.Example output
[source,yaml]
----
apiVersion: ptp.openshift.io/v1
kind: NodePtpDevice
metadata:
  creationTimestamp: "2021-09-14T16:52:33Z"
  generation: 1
  name: compute-0.example.com
  namespace: openshift-ptp
  resourceVersion: "177400"
  uid: 30413db0-4d8d-46da-9bef-737bacd548fd
spec: {}
status:
  devices:
  - name: eno1
  - name: eno2
  - name: eno3
  - name: eno4
  - name: enp5s0f0
  - name: enp5s0f1
----

. Check that the PTP interface is successfully synchronized to the primary clock by accessing the `linuxptp-daemon` pod for the corresponding node.

.. Get the name of the `linuxptp-daemon` pod and corresponding node you want to troubleshoot by running the following command:
+
[source,terminal]
----
$ oc get pods -n openshift-ptp -o wide
----
+
.Example output
[source,terminal]
----
NAME                            READY   STATUS    RESTARTS   AGE     IP            NODE
linuxptp-daemon-lmvgn           3/3     Running   0          4d17h   10.1.196.24   compute-0.example.com
linuxptp-daemon-qhfg7           3/3     Running   0          4d17h   10.1.196.25   compute-1.example.com
ptp-operator-6b8dcbf7f4-zndk7   1/1     Running   0          5d7h    10.129.0.61   control-plane-1.example.com
----

.. Remote shell into the required `linuxptp-daemon` container:
+
[source,terminal]
----
$ oc rsh -n openshift-ptp -c linuxptp-daemon-container <linux_daemon_container>
----
+
where:
+
<linux_daemon_container>:: is the container you want to diagnose, for example `linuxptp-daemon-lmvgn`.

.. In the remote shell connection to the `linuxptp-daemon` container, use the PTP Management Client (`pmc`) tool to diagnose the network interface. Run the following `pmc` command to check the sync status of the PTP device, for example `ptp4l`.
+
[source,terminal]
----
# pmc -u -f /var/run/ptp4l.0.config -b 0 'GET PORT_DATA_SET'
----
+
.Example output when the node is successfully synced to the primary clock
[source,terminal]
----
sending: GET PORT_DATA_SET
    40a6b7.fffe.166ef0-1 seq 0 RESPONSE MANAGEMENT PORT_DATA_SET
        portIdentity            40a6b7.fffe.166ef0-1
        portState               SLAVE
        logMinDelayReqInterval  -4
        peerMeanPathDelay       0
        logAnnounceInterval     -3
        announceReceiptTimeout  3
        logSyncInterval         -4
        delayMechanism          1
        logMinPdelayReqInterval -4
        versionNumber           2
----

. For GNSS-sourced grandmaster clocks, verify that the in-tree NIC ice driver is correct by running the following command, for example:
+
[source,terminal]
----
$ oc rsh -n openshift-ptp -c linuxptp-daemon-container linuxptp-daemon-74m2g ethtool -i ens7f0
----
+
.Example output
[source,terminal]
----
driver: ice
version: 5.14.0-356.bz2232515.el9.x86_64
firmware-version: 4.22 0x8001778b 1.3346.0
----

. For GNSS-sourced grandmaster clocks, verify that the `linuxptp-daemon` container is receiving signal from the GNSS antenna.
If the container is not receiving the GNSS signal, the `/dev/gnss0` file is not populated.
To verify, run the following command:
+
[source,terminal]
----
$ oc rsh -n openshift-ptp -c linuxptp-daemon-container linuxptp-daemon-jnz6r cat /dev/gnss0
----
+
.Example output
[source,terminal]
----
$GNRMC,125223.00,A,4233.24463,N,07126.64561,W,0.000,,300823,,,A,V*0A
$GNVTG,,T,,M,0.000,N,0.000,K,A*3D
$GNGGA,125223.00,4233.24463,N,07126.64561,W,1,12,99.99,98.6,M,-33.1,M,,*7E
$GNGSA,A,3,25,17,19,11,12,06,05,04,09,20,,,99.99,99.99,99.99,1*37
$GPGSV,3,1,10,04,12,039,41,05,31,222,46,06,50,064,48,09,28,064,42,1*62
----
