10 Commits

Author SHA1 Message Date
Cole Walker
93778b296e Build Debian container image for notificationservice-base-v1-api
Add the required code and Dockerfile to build a Debian based container
image of notificationservice-base to support v1 API backwards
compatibility.

The notificationservice-base-v1 code added here is being ported forward
from stx.6.0. This code existed as-is in StarlingX prior to the work
done to implement the ORAN Notification API. It is being returned in
order to support user's needs for backwards compatbility. Subsequent
work will done to update the helm charts, allowing
notificationservice-base-v1-api and notificationservice-base-v2-api
(ORAN Notification) to be deployed in parallel.

Test plan:
PASS: Build container image
PASS: Manually deploy image and test with v1 client

Story: 2010538
Task: 47175

Change-Id: I2f672fe1b226cb60b62bd5fe7f8abbedc7b0c4cc
2023-01-30 15:05:15 +00:00
Douglas Henrique Koerich
3a365e737a Fix bad GNSS status reported by PTP tracker
A "FAILURE-NOFIX" GNSS status was being reported because the new ICE
driver reports "locked_ho_acq" status instead of "locked_ho_ack" as
before. Now the logic takes both variations into account to decide upon
the GNSS status.

BONUS: Found an issue (bad indentation with subsequent logic error) with
the threading lockers for ptp4l and ts2phc handlers in the sidecar
(notificationclient), that could lead to an exception.

Test Plan:
PASS: Checked with synchronized GNSS status.

Closes-Bug: #1996179
Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
Change-Id: I1ad3c4c9ad9e1428685bf6729c77ba29b470ece3
2022-11-10 16:32:33 -03:00
Cole Walker
b50b361d9f [PTP] No longer consider clockClass 7 and 135 as locked
PTP-notification was treating clockClass values 7 and 135 as indicators
of a locked status, which is incorrect as per ITU-T G.8275.1. This was
resulting in ptp-notification delivering locked status to clients when
it should instead be transitioning to holdover/freerun.

Removed clockClass 7 and 135 from the list of valid locked clockClasses.
PTP-notification is now able to properly transition states when these
classes are observed.

Test plan:
PASS: Build and deploy image
PASS: Verify correct state transitions when clockClass 6, 7, 135 are
observed

Partial-Bug: 1995014

Signed-off-by: Cole Walker <cole.walker@windriver.com>
Change-Id: If68df991c3d6555f09e19a0d11f2c71e077c2587
2022-10-31 10:52:59 -04:00
Douglas Henrique Koerich
297584e7b9 Fix bad path for PTP configuration files
The PTP tracking container ("notificationservice-base") used hard-coded
path in the reference to ptp4l, phc2sys and ts2phc configuration files,
which led to bad initialization in a Debian environment (regardless the
container is CentOS-based, since the path is mapped to the host).
This change tests for the correct path, either in ./linuxptp/ptpinstance
(Debian) or ./ptpinstance (CentOS).
It also fixes an issue when there is no PHC interface defined, neither
in the command line or in the phc2sys configuration file.

BONUS: The logging helper of location service was fixed to properly log
the messages like done already for the other images (notification server
and client). Logging level can now be set also for this container.

Test Plan:
PASS: Built and tested new image for notificationservice-base.

Closes-Bug: #1994192
Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
Change-Id: I7be15b19b9a165a47e12c38deb9eed2b5b7d09ee
2022-10-28 11:10:45 -03:00
Cole Walker
63fefca36c [PTP] Reduce cpu usage and correct holdover time
Fixes two issues:

1.
The CPU usage consumed by monitoring the kern.log file for changes in
the NIC cgu status was found to be excessive. This change reverts that
implementation and returns to a polling approach similar to what was
already used for monitoring ptp4l and os clock statuses. This has been
observed to bring main process in the notificationservice-base image
down from ~60% CPU to ~8-10% CPU utilization.

In the future, a preferrable implementation would be to work with device
driver owners to provide support for udev events, removing the need to
poll the status of devices.

2.
User supplied holdover times for each service type were not being
applied correctly. Updated daemon.py to set the holdover times in the
service context.

This also includes providing a user configurable "CONTROL_TIMEOUT"
parameter to control the frequency of polling. This is a global value
and affects the polling rate for all services.

Test-plan:
PASS: Build and install ptp-notification app and containers
PASS: Observe reduced CPU usage and confirm that GNSS monitoring still
works
PASS: User supplied holdover times work correctly, along with polling
rate

Story: 2010056
Task: 46512
Task: 46513

Signed-off-by: Cole Walker <cole.walker@windriver.com>
Change-Id: Ic0050cc09f5118e7f1c32aa13168084d6456437e
2022-10-06 19:27:04 +00:00
Cole Walker
f63dd6dc17 [PTP] Set context for multiple ptp instances and correct master status
Fixed two issues:
1. Issue where the default context for initiating each ptp service
context was incorrectly being copied by reference.

On startup, the initial context for each ptp service was set to default
values with a copy-by-reference resulting in updates propagating to each
instance when they shouldn't. Corrected the initialization to copy by
value instead. This fixes an issue where subscription notifications
were reporting the wrong status, ie. if one ptp4l instance is Freerun,
all ptp4l instances were being updated to Freerun. Fix ensures that only
the affected instance is updated.

2. Nodes running as master now change out of locked state when their
ports are FAULTY.

The original logic did not consider the port state for master nodes.
Added check to change the ptp4l lock status when ports enter a fault
state.

Test Plan:
PASS: Build and deploy ptp-notification app
PASS: Multiple ptp instance contexts are updated independently and
notifications now report correct state.
PASS: Master nodes transition their ptp4l status when ports go faulty.

Story: 2010056
Task: 46417

Signed-off-by: Cole Walker <cole.walker@windriver.com>
Change-Id: I3d2bfa62efeefc5aca282d80eccc5d825d7ef900
2022-09-26 17:33:39 +00:00
Cole Walker
4178a86975 Integration work for ORAN notification
Several improvements and fixes to enable the end-to-end functionality of
all of the components in support of the O-RAN Spec Compliant Timing API
Notification work.

1. Add time stamps to logging for notificationservice and
notificationclient
2. Add support for the "optional" hierarchy in the resource address
which allows the client to query the status of a specific ptp instances.
ie. get the status of instance ptp1 rather than all ptp instances
3. Add a parent key to the returned notification data so that multiple
statuses can be returned to the client with a single notification'
4. Reworked the notificationservice daemonset to start its process
directly rather than using an intermediary script. This allows the
container logs to show properly via kubectl logs and will also allow the
container to crash properly if the program errors out.
5. Reworked the helm values for ptp4l and ts2phc instances to allow
users to supply overrides with multiple instances

Test plan:
PASS: PTP notification v1 compatibility
PASS: GET all v2 resources
PASS: SUBSCRIBE/LIST/DELETE v2 resources
PASS: Build and deploy containers/fluxcd app

Story: 2010056
Task: 46226

Change-Id: Id471fdc0815afdcc5639e81c6457616e268e6cd7
Signed-off-by: Cole Walker <cole.walker@windriver.com>
2022-09-14 11:02:43 -04:00
Cole Walker
939b72d8b1 [PTP] Add clockClass tracking and multi ptp instance support
Adds notification functionality for PTP clockClass data and re-works the
overall PTP sync status to allow for multiple ptp4l instances to be
tracked. Each ptp4l instance reports its own sync status and clockClass.

This change moves several static functions out of ptpsync.py and into
the PtpMonitor class. The remaining static functions have been moved
into utils.py

This change retains backwards compatibility allowing for v1 PTP
notifications and subscriptions to continue working while also providing
the v2 functionality required by the ORAN Notification standard.

This change also provides an override value for the logging level
exposed via a helm chart override.

Testing:
PASS: GET and Subscribe functions for each notification type
PASS: Multiple PTP instance support

Story: 2010056
Task: 46038
Task: 46039

Signed-off-by: Cole Walker <cole.walker@windriver.com>
Change-Id: Ic5456bc5a36f95186cdc6fe01ef1068b7124a5fc
2022-08-22 20:33:21 +00:00
Teresa Ho
67452b94db Implement ORAN v2 api on notificationserver
The commit added the support to publish ptp status for v2 API in the
notification-service.
It also renamed the previously name v0 API to v1 API.

Test Plan:
Pass: PTP status push notification v2 API
Pass: PTP status push notification v1 API
Pass: Subscribe/List/Delete subscription in v2 API
Pass: Subscribe/List/Delete subscription in v1 API

Story: 2010056
Task: 45809

Signed-off-by: Teresa Ho <teresa.ho@windriver.com>
Change-Id: Id5a1ff955eade59d68b6bcadfea4ffe6ed1567cd
2022-08-02 13:59:52 -04:00
Douglas Henrique Koerich
84b5114027 Images of ptp-notification containers for Debian
This change reorganizes the source directories of the ptp-notification's
containers: locationservice; notificationservice; notificationclient, to
be reused by both CentOS and Debian Dockerfiles to build the images
having the corresponding OS-specific base, together with the new files
used to build images for Debian.

Tests:
PASS: Build images of the 3 containers for Debian
PASS: Upload and apply changed ptp-notification application to pull
      Debian images from private repository (since final tag is
      not possible yet) in a Debian AIO-SX environment

Regression:
PASS: Build images of the 3 containers for CentOS

Story: 2009831
Task: 45658
Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
Change-Id: I4aa9650dbebe5ba68cd4d104ee0995e79681cfa4
2022-07-19 15:01:27 -03:00