napalm-device-types 4.38.0 declares ConfigRevisionsMixin: the listing,
the reading, ConfigRevisionDict and the exceptions, and the revert as a
template. The driver keeps the device communication: the three backup
API calls, the revert step, and config_revision_content(), which leaves
out the <revision> block every save writes into config.xml and the
indentation between elements.
The template reads the newest revision after the revert and checks that
it holds the revision's configuration. OPNsense answers "reverted" even
when restoreBackup() could not load the file and kept the previous one;
that now raises ConfigRevertFailed instead of passing. A refusal of the
firewall raises ConfigRevertFailed too. An id the history does not list
still never reaches a request path.
Refs NetOrk/netork#2511
OPNsense has no API that takes an uploaded config.xml: the backup API
lists the history in /conf/backup, hands out a revision and reverts to
one that is already on the firewall. A full replace exists only on the
legacy page diag_backup.php. So an application restores a configuration
by reverting to the revision that holds it (NetOrk/netork#2511).
get_config_revisions() lists the history newest first: id, time in UTC
(time_iso is in the firewall's zone), description, user and size.
get_config_revision(id) returns one revision's config.xml.
revert_config_revision(id) calls revert_backup and refuses an id that is
not in the history now; an id that is no file name of the history never
reaches a request path. A revert only saves config.xml as a new newest
revision: no service is reloaded and the firewall does not reboot.
load_replace_candidate is None instead of NAPALM's stub that raised, so
a capability check sees that the driver replaces nothing. The helper
that finds the newest backup for rollback() moves to the new module,
which keeps opnsense.py under its recorded size.
Refs NetOrk/netork#2511