ConfigRevisionsMixin: a device's own configuration history.
get_config_revisions() and get_config_revision(revision_id) are declared only, so callable(getattr(driver, "get_config_revisions", None)) tells whether a driver has a history.
ConfigRevisionDict: id, time (UTC ISO 8601), description, user, size.
revert_config_revision(revision_id) is a template over the driver step _revert_to_config_revision. It refuses an id that is not in the history (UnknownConfigRevision, a ValueError), reads the revision before the revert can rotate it out, and afterwards checks that the newest revision holds its configuration (ConfigRevertFailed, a RuntimeError). The check is there because OPNsense answers "reverted" even when it fell back to the previous file. Returns the revision now in place.
config_revision_content(text) is the hook where a driver leaves out what its device stamps into every save (OPNsense's <revision> block). The default keeps the whole text. An application can compare through it too.
Tested: unit tests against an in-memory device.
Contract part of NetOrk/netork#2511, declared here first (STANDARDS.md §3) before napalm-opnsense implements it (NAPALM/napalm-opnsense#48).
`ConfigRevisionsMixin`: a device's own configuration history.
- `get_config_revisions()` and `get_config_revision(revision_id)` are declared only, so `callable(getattr(driver, "get_config_revisions", None))` tells whether a driver has a history.
- `ConfigRevisionDict`: `id`, `time` (UTC ISO 8601), `description`, `user`, `size`.
- `revert_config_revision(revision_id)` is a template over the driver step `_revert_to_config_revision`. It refuses an id that is not in the history (`UnknownConfigRevision`, a `ValueError`), reads the revision before the revert can rotate it out, and afterwards checks that the newest revision holds its configuration (`ConfigRevertFailed`, a `RuntimeError`). The check is there because OPNsense answers "reverted" even when it fell back to the previous file. Returns the revision now in place.
- `config_revision_content(text)` is the hook where a driver leaves out what its device stamps into every save (OPNsense's `<revision>` block). The default keeps the whole text. An application can compare through it too.
Tested: unit tests against an in-memory device.
Some devices keep a copy of their configuration for every save and can
go back to one. An application restores a configuration there by
reverting to the revision that holds it; on OPNsense that is the only
way, since its API takes no uploaded config.xml (NetOrk/netork#2511).
ConfigRevisionsMixin declares get_config_revisions() (newest first, as
ConfigRevisionDict) and get_config_revision(revision_id).
revert_config_revision(revision_id) is a template over the driver's
_revert_to_config_revision step: it refuses an id that is not in the
history (UnknownConfigRevision), reads the revision before the revert
can rotate it out, and afterwards checks that the newest revision holds
its configuration (ConfigRevertFailed otherwise), since a device may
report a revert it did not make. config_revision_content(text) is the
hook where a driver leaves out what its device stamps into every save,
so revisions with the same configuration compare equal.
Refs NetOrk/netork#2511
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Contract part of NetOrk/netork#2511, declared here first (STANDARDS.md §3) before napalm-opnsense implements it (NAPALM/napalm-opnsense#48).
ConfigRevisionsMixin: a device's own configuration history.get_config_revisions()andget_config_revision(revision_id)are declared only, socallable(getattr(driver, "get_config_revisions", None))tells whether a driver has a history.ConfigRevisionDict:id,time(UTC ISO 8601),description,user,size.revert_config_revision(revision_id)is a template over the driver step_revert_to_config_revision. It refuses an id that is not in the history (UnknownConfigRevision, aValueError), reads the revision before the revert can rotate it out, and afterwards checks that the newest revision holds its configuration (ConfigRevertFailed, aRuntimeError). The check is there because OPNsense answers "reverted" even when it fell back to the previous file. Returns the revision now in place.config_revision_content(text)is the hook where a driver leaves out what its device stamps into every save (OPNsense's<revision>block). The default keeps the whole text. An application can compare through it too.Tested: unit tests against an in-memory device.