Skip to content

T-BC tests#205

Draft
nocturnalastro wants to merge 9 commits intok8snetworkplumbingwg:mainfrom
nocturnalastro:tbc_ci_tests
Draft

T-BC tests#205
nocturnalastro wants to merge 9 commits intok8snetworkplumbingwg:mainfrom
nocturnalastro:tbc_ci_tests

Conversation

@nocturnalastro
Copy link
Copy Markdown
Collaborator

No description provided.

Simplify DaemonNodeSelector nil check in ptp.go and ptptesthelper.go
- len handles nil maps.

Assisted-by: Cursor
Replace all pointer.Int64Ptr calls with ptr.To from the already-
imported k8s.io/utils/ptr package. Rename the int5/int65 magic
constants to defaultPriority/defaultSchedulingPriority. Drop the
deprecated k8s.io/utils/pointer import.

Assisted-by: Cursor
Extract the pod-label-matching logic that was inline in several
ptphelper functions into reusable GetPodWithLabel and findMatchingPod
helpers. Refactor GetProfileLogID, GetClockIDMaster, GetClockIDForeign,
and WaitForClockIDForeign to use them, reducing duplicated list+filter
loops.

Assisted-by: Cursor
- Add refreshPodOnNotFound helper to automatically refresh stale pod
  references after restarts; wire into ExecCommand call sites in
  checkProcessStatus, checkClockClassState, checkDPLLFrequencyState,
  checkDPLLPhaseState, and checkClockClassStateReturnBool
- GetPTPPodWithPTPConfig returns error instead of (nil, nil) when no
  matching pod is found
- GetPodsRunningPTP4l guards against nil pod
- discoverMode sets DiscoveryFailureStatus on pod lookup failure
- Guard DiscoveredClockUnderTestPod against nil before use
- Improve getMetric error to list available metric lines on miss
- Refactor GetProfileName to use switch with nil-guard

Assisted-by: Cursor
Add WriteStep and createStepMarker to the log collector to write
phase markers into pod log files, making it easier to correlate test
steps with daemon output. Wire WriteStep calls into checkProcessStatus
and checkClockClassState.

Include PTP_TEST_MODE in the serial suite log directory name so runs
for different clock types (OC, TBC, TGM, etc.) are separated.

Assisted-by: Cursor
Replace the name-prefix heuristic (e.g. ens7f0 -> ens7f*) with PTP
hardware clock index from ethtool -T to group interfaces sharing the
same NIC. Add getPTPHardwareClockIndex and findIfaceWithPinsForPhc
helpers. Refactor GetListOfWPCEnabledInterfaces and
addAllInterfacesForNic accordingly.

Assisted-by: Cursor
Split toggleNetworkInterface into disableInterface (returning a
restore closure) and a thin toggleNetworkInterface wrapper. This
makes it possible to disable multiple interfaces and defer their
collective restoration.

Assisted-by: Cursor
- Add timeout parameter to checkClockClassState for caller-controlled
  wait duration
- Move podsRunningPTP4l retrieval outside By blocks so discovery
  failures are caught before pod readiness checks
- Add HA version check (>= 4.16) to underscore profile name test
- Fix indentation in BeforeEach block
- Add getL2DiscoveryImage() helper to allow environment override
- Initialize MAX_OFFSET_IN_NS/MIN_OFFSET_IN_NS at the top of
  CreatePtpConfigurations so they're available for config creation
- Add verbose PTP announce logging during L2 discovery
- Replace hardcoded ptp4lconfBc with dynamic generateBCConfig

Assisted-by: Cursor
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands the conformance test suite by introducing detailed scenarios for Telco Boundary Clock (T-BC) operation, including its behavior during various holdover states and re-synchronization. It also enhances the test framework's configurability with a new environment variable for E810 plugin settings and improves the robustness of PTP-related helper functions and logging mechanisms.

Highlights

  • Telco Boundary Clock (T-BC) Conformance Tests: Introduced comprehensive new test cases for Telco Boundary Clock (T-BC) functionality, covering GM announcements, holdover transitions (in-spec, out-of-spec, freerun), and re-locking scenarios.
  • New Environment Variable for E810 Plugin: Added MAX_IN_SPEC_OFFSET_NS environment variable to configure the maximum in-spec offset for the E810 plugin, allowing fine-grained control over holdover specification thresholds.
  • PTP Helper Function Refactoring and Robustness: Refactored several PTP helper functions (GetProfileLogID, GetClockIDMaster, GetClockIDForeign, WaitForClockIDForeign) to improve pod discovery, configuration retrieval, and error handling, enhancing overall test reliability.
  • PMC Monitoring Utility: Implemented a new pmc package for continuously monitoring and parsing PTP Management Client (PMC) output, enabling detailed verification of PTP announce messages and clock state transitions during tests.
  • Enhanced Test Logging: Integrated logging.WriteStep calls throughout the test suite to provide clearer, step-by-step progress markers in test logs, aiding in debugging and understanding test flow.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist
Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@nocturnalastro
Copy link
Copy Markdown
Collaborator Author

/gemini review

Add Telco Boundary Clock (T-BC) test mode with full CI test coverage:

- New PTP test mode TelcoBoundaryClock with ptp4l receiver (tbc-tr) and
  transmitter (tbc-tt) profiles, ts2phc and E810 plugin configuration
- PMC monitoring package (test/pkg/pmc) for polling PTP announce data
  and verifying clock quality passthrough
- T-BC holdover test verifying clock class transitions (6 -> 135 -> 165
  -> 248) under cable-pull conditions with configurable thresholds
- Announce field comparison between receiver and transmitter profiles
- DisableSlaveInterfaces helper for multi-interface outage simulation
- GetProfileLogID fallback via /var/run config paths
- MutateE810PluginSettings for dynamic holdover threshold injection
- GetConfigForProfile, GetWPCEnabledInterfaceNames,
  GetInterfacesByPHCAndPins, GetLeadingInterfaceForSlavePHC helpers
- MaxInSpecOffsetNs environment variable support
- Updated test README with new environment variables
- T-BC specific test mock generators and PTPWPCTBCPolicyName constant

Assisted-by: Cursor
@gemini-code-assist
Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant