Skip to content

Fix: move OS discovery to dedicated method called after IN_PROGRESS status in device_stable (b/573531479) - #1670

Open
hitnik wants to merge 6 commits into
devfrom
fix-ai/move-os-discover-device-stable
Open

hitnik wants to merge 6 commits into
devfrom
fix-ai/move-os-discover-device-stable

Conversation

@hitnik

@hitnik hitnik commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Summary / Problem

This Pull Request resolves Buganizer ticket b/573531479 per user instructions:
"move os_discover to a dedicared method and call it right after set testryStatus.IN_PROGRESS in device_stable method and create a pull request".

Previously, device OS discovery via Nmap and SSH was executed synchronously inside the sniffer packet monitoring loop in NetworkOrchestrator._start_device_monitor (framework/python/src/net_orc/network_orchestrator.py). Performing OS discovery within the monitoring loop coupled network traffic capture with active network scanning probes and blocked timely monitor packet polling and state transitions.

Root Cause

In NetworkOrchestrator._start_device_monitor, the loop while sniffer.running: executed OS discovery attempts (util.get_device_os_nmap and util.get_device_os_ssh) during passive packet capture. This discovery logically belongs to the core test execution flow when the device reaches steady state and transitions to TestrunStatus.IN_PROGRESS.

Changes Made

  1. framework/python/src/net_orc/network_orchestrator.py:

    • Removed the blocking device OS discovery logic (device_os_discover_attempts, util.get_device_os_nmap, util.get_device_os_ssh) from inside the while sniffer.running: loop in _start_device_monitor.
    • Kept packet monitoring focused exclusively on sniffer health, cancellation checks, and interface connectivity.
  2. framework/python/src/core/testrun.py:

    • In _device_stable(self, mac_addr): Added a call to self._os_discover(mac_addr) immediately following self._set_status(TestrunStatus.IN_PROGRESS).
    • Added dedicated helper method _os_discover(self, mac_addr=None) (with alias os_discover = _os_discover) that:
      • Obtains the target device from session or MAC lookup.
      • Performs up to 3 discovery attempts using util.get_device_os_nmap and util.get_device_os_ssh.
      • Updates session kernel/OS via self.get_session().set_device_kernel(device_os).

Verification Plan

  1. Unit and lint verification:
    • Ensure framework/python/src/core/testrun.py and framework/python/src/net_orc/network_orchestrator.py parse with no syntax errors.
    • Verify _os_discover handles missing devices / IP addresses gracefully.
  2. End-to-end device testing:
    • Run a testrun against a connected device.
    • Observe status progression: MONITORING completes without OS probe interference, followed by transition to IN_PROGRESS.
    • Verify log outputs: Discovering device OS for <ip_addr> and Discovered device OS: <device_os> upon entering device_stable.
    • Verify session reports contain detected device kernel/OS.

Branch comparison against dev: dev...fix-ai/move-os-discover-device-stable

@hitnik
hitnik requested a review from sofyakurilova October 26, 2026 09:45

This branch has not been deployed

No deployments
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