[cli] add lease info to srp server host and srp server service (#12589)

This commit adds lease and remaining lease information to the output
of `srp server host` and `srp server service` CLI commands.

The information includes:
- `lease`: The total lease time in seconds.
- `key-lease`: The total key lease time in seconds.
- `remaining lease`: The remaining lease time in seconds (with
  millisecond precision).
- `remaining key-lease`: The remaining key lease time in seconds
  (with millisecond precision).

A new utility method `OutputMsecDurationInSec()` is added to `Utils`
class to format durations in milliseconds as seconds with a
fractional part.

The SRP server host and service output parsers in
`tests/scripts/thread-cert/node.py`, `tests/toranj/cli/cli.py`, and
`tools/otci/otci/otci.py` are updated to correctly handle the new
fields for both active and deleted entries.
This commit is contained in:
Abtin Keshavarzian
2026-03-02 18:03:14 -08:00
committed by GitHub
parent d5b5f863d7
commit cf1d23c11e
8 changed files with 132 additions and 30 deletions
+6
View File
@@ -1164,6 +1164,10 @@ class OTCI(object):
v = v[1:-1]
info['addresses'] = list(map(Ip6Addr, v.split(', ')))
elif k in ('lease', 'key-lease', 'remaining lease', 'remaining key-lease'):
info[k] = v
else:
raise UnexpectedCommandOutput(output)
@@ -1195,6 +1199,8 @@ class OTCI(object):
info[k] = list() if v == '(null)' else list(v.split(','))
elif k in ('port', 'weight', 'priority', 'ttl', 'lease', 'key-lease'):
info[k] = int(v)
elif k in ('remaining lease', 'remaining key-lease'):
info[k] = v
elif k in ('host',):
info[k] = v
elif k == 'TXT':