Skip to content

CMLDEV-1472: Switch set_web_session_timeout to PUT with JSON body - #250

Closed
marpauli-cisco wants to merge 5 commits into
devfrom
CMLDEV-1472-Discuss-deferred-CML-2.11-API-deprecations
Closed

CMLDEV-1472: Switch set_web_session_timeout to PUT with JSON body#250
marpauli-cisco wants to merge 5 commits into
devfrom
CMLDEV-1472-Discuss-deferred-CML-2.11-API-deprecations

Conversation

@marpauli-cisco

Copy link
Copy Markdown
Collaborator

Summary

  • Aligns SystemManagement.set_web_session_timeout with the 2.11 server API introduced under CMLDEV-1472: PUT /web_session_timeout with a JSON body, returning the effective timeout.
  • Return type changes from None to int, so callers get the server's post-update value without a follow-up GET.
  • No compatibility shim on the client — the legacy PATCH /web_session_timeout/{timeout} route still exists server-side (soft deprecation), older clients keep working, but this client now targets the new shape.

Changes

PCL — virl2_client/models/system.py

  • set_web_session_timeout(timeout: int) -> int now issues self._session.put(self._url_for("web_session_timeout"), json={"timeout": timeout}) and returns .json().
  • Docstring updated to document the new return value.

Tests

  • tests/test_system.py::test_set_web_session_timeout: asserts the client calls session.put("web_session_timeout", json={"timeout": 120}) and returns the mocked int.
  • tests/test_system_runtime.py::test_web_session_timeout_rt: extends the get/set roundtrip to mock and assert the PUT return value.

Verification

  • poetry run pytest -c pytest.ini tests/test_system.py::test_set_web_session_timeout tests/test_system_runtime.py::test_web_session_timeout_rt — 2 passed.
  • pre-commit run --files virl2_client/models/system.py tests/test_system.py tests/test_system_runtime.py — clean.
  • Manual integration coverage lives in the simple PR under tests/integration/test_server.py::test_web_session_config, which asserts the round-trip against a live controller.

marpauli-cisco and others added 5 commits July 29, 2026 12:01
Server 2.11 replaced `PATCH /web_session_timeout/{timeout}` with `PUT /web_session_timeout` accepting a JSON body and returning the updated value. Update `SystemManagement.set_web_session_timeout` to PUT `{"timeout": ...}` and return the server's response.

Return type changes from `None` to `int`. Callers wanting the new effective value no longer need a follow-up GET. Legacy PATCH route still works server-side for older clients (soft deprecation).

Unit test asserts PUT call + JSON body + int return; runtime test mirrors get/set roundtrip against updated mock.
… of github-cisco:CiscoDevNet/virl2-client into CMLDEV-1472-Discuss-deferred-CML-2.11-API-deprecations
@marpauli-cisco

Copy link
Copy Markdown
Collaborator Author

Parent PR #16 in CML was reverted and closed. Therefore, same goes for this.

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.

2 participants