Commit Graph
19 Commits
Author SHA1 Message Date
Christian Manivong 0b30ab00a5 feat(time-sync): w32time's servers and the time zone through TimeSyncMixin
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 57s
driver / test (3.12) (pull_request) Successful in 58s
driver / test (3.13) (pull_request) Successful in 51s
driver / lowest (pull_request) Successful in 26s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 57s
CI / driver (pull_request) Successful in 2m23s
driver / publish (pull_request) Skipped
netOrk keeps one list of NTP servers and a time zone per site and aligns
a device that differs (NetOrk/netork#2360). A Windows host takes part
through w32time and its time zone, in one PowerShell script per read.

The servers and the mode are read from w32time's registry values, group
policy's first, not from w32tm /query /configuration, whose text is in
the host's language; synchronised is the leap indicator on the first
line of w32tm /query /status, which reads the same in any language. The
servers are written the way w32tm /config /manualpeerlist
/syncfromflags:manual writes them (NtpServer with 0x8, Type NTP),
followed by w32tm /config /update: no value passes a native command
line, whose quoting Windows PowerShell 5.1 mangles. A domain member that
takes its time from the domain hierarchy (NT5DS, AllSync) and a host
whose w32time comes from group policy refuse the write: their time is
set elsewhere, and a local write would be overridden or break the
domain's time.

Windows keeps a Windows zone, which stands for several IANA zones, so
Europe/Vienna written would read back as Europe/Berlin and the poll
would align the host forever. The IANA name written is kept beside it
in HKLM\SOFTWARE\napalm-windows and read back while the host is still
in that Windows zone. The zone is read from the registry, which
[TimeZoneInfo]::Local caches for the life of the remote session.

The zone table is now CLDR's windowsZones.xml (release 49) both ways,
generated by tools/windows_zones.py with tzdata's links and committed
with its source and checksum; nothing is fetched at runtime. CLDR's old
names (Asia/Calcutta) read as their current ones (Asia/Kolkata).

Writes the host already has are skipped. Needs napalm-device-types
4.35.0.

Refs NetOrk/netork#2367
2026-11-11 15:27:56 +01:00
christianmanivong 37708009a0 Merge pull request 'feat(scheduled-jobs): the Task Scheduler as scheduled jobs (#8)' (#9) from feature/scheduled-jobs into main
driver / standard (push) Successful in 19s
driver / lint (push) Successful in 18s
driver / types (push) Successful in 1m7s
driver / test (3.12) (push) Successful in 1m2s
driver / test (3.13) (push) Successful in 58s
driver / lowest (push) Successful in 29s
driver / build (push) Successful in 27s
driver / security (push) Successful in 1m1s
CI / driver (push) Successful in 2m40s
driver / publish (push) Skipped
2026-11-03 08:20:27 +00:00
Christian Manivong 74a8c53c7c chore(scheduled-jobs): require napalm-device-types 4.27.0
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 54s
driver / test (3.12) (pull_request) Successful in 55s
driver / test (3.13) (pull_request) Successful in 46s
driver / lowest (pull_request) Successful in 32s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m1s
CI / driver (pull_request) Successful in 2m22s
driver / publish (pull_request) Skipped
4.26.0 went out with the sshd drop-in change; the scheduled-jobs
contract is in 4.27.0.
2026-11-03 08:36:00 +01:00
Christian Manivong a508b872b0 feat(scheduled-jobs): the Task Scheduler as scheduled jobs (#8)
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 15s
driver / test (3.12) (pull_request) Failing after 14s
driver / types (pull_request) Failing after 23s
driver / test (3.13) (pull_request) Failing after 13s
driver / lowest (pull_request) Failing after 14s
driver / security (pull_request) Failing after 32s
driver / build (pull_request) Successful in 25s
CI / driver (pull_request) Failing after 1m21s
driver / publish (pull_request) Skipped
netOrk shows and controls every scheduled job of a host; on Windows that
is the Task Scheduler. The driver now implements napalm-device-types'
ScheduledJobsMixin over PowerShell Remoting, one script per call as every
getter does.

get_scheduled_jobs reads every task with its run info in one script
(Get-ScheduledTask, Get-ScheduledTaskInfo) as task:<path><name>, its
triggers summarised. Tasks under \Microsoft\ are the platform's, others
the admin's: Windows does not record which software installed a task.
The time zone is mapped to IANA for the common Windows zones, else None.
A reading cut short, or holding fewer tasks than it counted, raises.

manage_scheduled_job switches the task's own flag or starts it;
Start-ScheduledTask returns once the task has started, so the result says
that and no more. A disabled task, or one that refuses a start on demand,
is not offered run.

put_scheduled_job registers an application's task \<name> in the root
folder from XML, so a create and a change write the whole definition the
same way: the command runs in cmd.exe /d /s /c, the principal is SYSTEM
or a local user without a stored password (S4U), and the cron expression
becomes triggers only where Task Scheduler can say it exactly; any other
shape is refused, naming why. The description keeps the job's name and
cron expression, so the reading gives back what was written, and the
digest also covers the triggers, so a change by hand is seen.
delete_scheduled_job unregisters such a task and no other. Every write
reads the task again first, and every value goes into PowerShell
single-quoted with its quotes doubled.

Requires napalm-device-types 4.26.0.

Closes #8
2026-11-03 05:49:12 +01:00
christianmanivong 581c2df5e8 Merge pull request 'fix: an unknown ARP age is -1.0, not 0.0' (#7) from fix/arp-unknown-age into main
driver / standard (push) Successful in 17s
driver / lint (push) Successful in 15s
driver / types (push) Successful in 1m6s
driver / test (3.12) (push) Successful in 1m5s
driver / lowest (push) Successful in 32s
driver / test (3.13) (push) Successful in 57s
driver / build (push) Successful in 31s
driver / security (push) Successful in 1m12s
CI / driver (push) Successful in 2m50s
driver / publish (push) Skipped
2026-10-30 09:11:44 +00:00
Christian Manivong dacefaa606 fix: an unknown ARP age is -1.0, not 0.0
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m0s
driver / test (3.12) (pull_request) Successful in 57s
driver / lowest (pull_request) Successful in 24s
driver / test (3.13) (pull_request) Successful in 48s
driver / build (pull_request) Successful in 25s
driver / security (pull_request) Successful in 1m1s
CI / driver (pull_request) Successful in 2m32s
driver / publish (pull_request) Skipped
Get-NetNeighbor reports a state but no age, so get_arp_table reports
ARP_AGE_UNKNOWN instead of 0.0 ("confirmed just now").

NetOrk/netork#1327
2026-10-30 08:37:08 +01:00
christianmanivong 7c985acfad Merge pull request 'chore: Python 3.12 is the floor (NAPALM/driver-standard#6)' (#6) from chore/python-312-floor into main
driver / standard (push) Successful in 15s
driver / lint (push) Successful in 12s
driver / types (push) Successful in 56s
driver / test (3.12) (push) Successful in 55s
driver / test (3.13) (push) Successful in 50s
driver / lowest (push) Successful in 25s
driver / build (push) Successful in 27s
driver / security (push) Successful in 1m2s
CI / driver (push) Successful in 2m24s
driver / publish (push) Skipped
2026-10-27 10:46:56 +00:00
Christian Manivong cd50d3c102 fix: the floor on napalm is 5.1 (NAPALM/driver-standard#6)
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 12s
driver / test (3.12) (pull_request) Successful in 55s
driver / types (pull_request) Successful in 1m1s
driver / test (3.13) (pull_request) Successful in 50s
driver / lowest (pull_request) Successful in 27s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m26s
CI / driver (pull_request) Successful in 2m51s
driver / publish (pull_request) Skipped
napalm 5.0 and older import pkg_resources, which a Python 3.12 venv no
longer has, so the lowest job failed on them.
2026-10-27 10:49:32 +01:00
Christian Manivong 15740f9e05 chore: Python 3.12 is the floor (NAPALM/driver-standard#6)
driver / standard (pull_request) Successful in 20s
driver / lint (pull_request) Successful in 14s
driver / test (3.12) (pull_request) Successful in 1m2s
driver / types (pull_request) Successful in 1m8s
driver / test (3.13) (pull_request) Successful in 56s
driver / lowest (pull_request) Failing after 30s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m16s
CI / driver (pull_request) Failing after 2m57s
driver / publish (pull_request) Skipped
netOrk runs every driver in its own containers on Python 3.12, so 3.10
and 3.11 are no longer supported or tested. requires-python, mypy and
ruff move to 3.12, along with what ruff's pyupgrade rules then rewrite.
2026-10-27 10:19:01 +01:00
christianmanivong 211ed27c9e Merge pull request 'chore: adopt the NAPALM driver standard' (#5) from chore/driver-standard into main
driver / lint (push) Successful in 14s
driver / standard (push) Successful in 15s
driver / types (push) Successful in 1m0s
driver / test (3.10) (push) Successful in 56s
driver / test (3.11) (push) Successful in 55s
driver / lowest (push) Successful in 35s
driver / test (3.12) (push) Successful in 58s
driver / test (3.13) (push) Successful in 52s
driver / build (push) Successful in 25s
driver / security (push) Successful in 1m28s
driver / publish (push) Successful in 25s
CI / driver (push) Successful in 3m42s
v0.2.0
2026-10-23 11:16:23 +00:00
Christian Manivong 40346456d0 chore(release): 0.2.0
driver / standard (pull_request) Successful in 13s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 45s
driver / test (3.10) (pull_request) Successful in 44s
driver / test (3.11) (pull_request) Successful in 45s
driver / test (3.12) (pull_request) Successful in 43s
driver / test (3.13) (pull_request) Successful in 39s
driver / lowest (pull_request) Successful in 24s
driver / security (pull_request) Successful in 47s
driver / build (pull_request) Successful in 22s
CI / driver (pull_request) Successful in 5m35s
driver / publish (pull_request) Skipped
2026-10-23 11:37:04 +02:00
Christian Manivong d43d697700 chore: adopt the NAPALM driver standard
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 11s
driver / types (pull_request) Successful in 44s
driver / test (3.10) (pull_request) Successful in 46s
driver / test (3.11) (pull_request) Successful in 45s
driver / test (3.12) (pull_request) Successful in 42s
driver / test (3.13) (pull_request) Successful in 38s
driver / lowest (pull_request) Successful in 22s
driver / security (pull_request) Successful in 45s
driver / build (pull_request) Successful in 22s
CI / driver (pull_request) Successful in 5m30s
driver / publish (pull_request) Skipped
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow
  of NAPALM/driver-standard; .github/ is gone.
- requires-python >=3.10 (napalm-device-types needs it), LICENSE file,
  py.typed, setuptools>=77 with the SPDX license string, Issues and
  Changelog links on git.netork.io, napalm-device-types>=4.21.1 from PyPI,
  floors on the dev extra.
- mypy strict for the whole package, no module exempt: optional_args is
  dict[str, Any] | None.
- tests/quality_baseline.json records get_facts and get_route_to, over
  complexity 10. Coverage floor 95 % (measured 95.67 %).
- CHANGELOG.md in Keep a Changelog form; the README says no host output is
  recorded yet, links napalm-device-types in the NAPALM org and pypsrp on
  PyPI.
2026-10-23 08:49:27 +02:00
Christian Manivong 989e826b34 fix: what bandit and the remaining lint rules found
- get_route_to: "0.0.0.0" and "::" are the unspecified next hop of an
  on-link route as the host reports it, not an address anything binds to
  (nosec B104).
2026-10-23 08:47:56 +02:00
Christian Manivong 3b87a9ad77 style: ruff format and the lint rules of the driver standard
Mechanical: the rule set every NAPALM driver uses (E, F, I, UP, B at line
length 100, Python 3.10), with E501 off under tests/. The code was already
formatted and clean under it; what ruff cannot fix comes in the next commit.
2026-10-23 08:47:43 +02:00
christianmanivong 1775f100e4 Merge pull request 'ci: run the tests and build the package on every push and pull request' (#2) from ci/workflow into main
CI / test (3.10) (push) Successful in 25s
CI / test (3.11) (push) Successful in 23s
CI / test (3.12) (push) Successful in 25s
2026-10-07 06:43:14 +00:00
Christian Manivong a6076afbd5 ci: run the tests and build the package on every push and pull request
CI / test (3.10) (push) Successful in 27s
CI / test (3.11) (push) Successful in 27s
CI / test (3.12) (push) Successful in 28s
CI / test (3.10) (pull_request) Successful in 25s
CI / test (3.11) (pull_request) Successful in 24s
CI / test (3.12) (pull_request) Successful in 26s
The same job as napalm-fritzbox and napalm-opnsense: Python 3.10, 3.11 and
3.12, pytest, then wheel and sdist. napalm-device-types comes from
git.netork.io first, because PyPI has an unrelated package of that name.
2026-10-07 07:52:44 +02:00
christianmanivong 0edc0cc0fd Merge pull request 'feat: report what listens, and which Windows service it is' (#1) from feat/listening-sockets into main 2026-10-07 05:21:32 +00:00
Christian Manivong a6814ad92e feat: report what listens, and which Windows service it is
One script: Get-NetTCPConnection -State Listen, Get-NetUDPEndpoint, the
processes holding them and Win32_Service's PIDs. A process running one
service names it; a shared svchost runs several, and which of them holds
the socket Windows does not say, so it names none. http.sys sockets
(WinRM, IIS, SMB) belong to the System process.

The fixture is synthetic: no Windows host was at hand. tools/harvest.py
records the real output. For netOrk#673.
2026-10-07 07:20:27 +02:00
Christian Manivong 1ce42ef099 feat: NAPALM driver for Windows over PowerShell Remoting
Talks PSRP over WinRM via pypsrp, one runspace pool per connection. Each
getter sends one PowerShell script that projects cmdlet results onto flat
fields and ends in ConvertTo-Json, so the Python side parses JSON, not text.

Covers facts, interfaces, IP addresses, ARP, routes and services, plus
service start/stop/restart/enable/disable. Service names are validated and
quoted as PowerShell verbatim strings, typographic quotes included.

Fixtures are synthetic: they pin down the JSON the scripts are designed to
emit. tools/harvest.py records the real output from a host.

Refs christianmanivong/netork#300
2026-09-24 09:23:25 +02:00