Merging upstream version 1.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
ae7b7df396
commit
afeccccd6a
154 changed files with 7346 additions and 5000 deletions
|
@ -29,8 +29,7 @@ __all__ = ["SessionConfig"]
|
|||
|
||||
|
||||
class SessionConfig:
|
||||
"""
|
||||
Send configuration to a device using the EOS session mechanism.
|
||||
"""Send configuration to a device using the EOS session mechanism.
|
||||
|
||||
This is the preferred way of managing configuration changes.
|
||||
|
||||
|
@ -44,8 +43,7 @@ class SessionConfig:
|
|||
CLI_CFG_FACTORY_RESET = "rollback clean-config"
|
||||
|
||||
def __init__(self, device: Device, name: str) -> None:
|
||||
"""
|
||||
Create a new instance of SessionConfig.
|
||||
"""Create a new instance of SessionConfig.
|
||||
|
||||
The session config instance bound
|
||||
to the given device instance, and using the session `name`.
|
||||
|
@ -81,8 +79,7 @@ class SessionConfig:
|
|||
# -------------------------------------------------------------------------
|
||||
|
||||
async def status_all(self) -> dict[str, Any]:
|
||||
"""
|
||||
Get the status of all the session config on the device.
|
||||
"""Get the status of all the session config on the device.
|
||||
|
||||
Run the following command on the device:
|
||||
# show configuration sessions detail
|
||||
|
@ -122,8 +119,7 @@ class SessionConfig:
|
|||
return await self._cli("show configuration sessions detail") # type: ignore[return-value] # json outformat returns dict[str, Any]
|
||||
|
||||
async def status(self) -> dict[str, Any] | None:
|
||||
"""
|
||||
Get the status of a session config on the device.
|
||||
"""Get the status of a session config on the device.
|
||||
|
||||
Run the following command on the device:
|
||||
# show configuration sessions detail
|
||||
|
@ -179,8 +175,7 @@ class SessionConfig:
|
|||
return res["sessions"].get(self.name)
|
||||
|
||||
async def push(self, content: list[str] | str, *, replace: bool = False) -> None:
|
||||
"""
|
||||
Send the configuration content to the device.
|
||||
"""Send the configuration content to the device.
|
||||
|
||||
If `replace` is true, then the command "rollback clean-config" is issued
|
||||
before sending the configuration content.
|
||||
|
@ -218,8 +213,7 @@ class SessionConfig:
|
|||
await self._cli(commands=commands)
|
||||
|
||||
async def commit(self, timer: str | None = None) -> None:
|
||||
"""
|
||||
Commit the session config.
|
||||
"""Commit the session config.
|
||||
|
||||
Run the following command on the device:
|
||||
# configure session <name>
|
||||
|
@ -241,8 +235,7 @@ class SessionConfig:
|
|||
await self._cli(command)
|
||||
|
||||
async def abort(self) -> None:
|
||||
"""
|
||||
Abort the configuration session.
|
||||
"""Abort the configuration session.
|
||||
|
||||
Run the following command on the device:
|
||||
# configure session <name> abort
|
||||
|
@ -250,8 +243,7 @@ class SessionConfig:
|
|||
await self._cli(f"{self._cli_config_session} abort")
|
||||
|
||||
async def diff(self) -> str:
|
||||
"""
|
||||
Return the "diff" of the session config relative to the running config.
|
||||
"""Return the "diff" of the session config relative to the running config.
|
||||
|
||||
Run the following command on the device:
|
||||
# show session-config named <name> diffs
|
||||
|
@ -268,8 +260,7 @@ class SessionConfig:
|
|||
return await self._cli(f"show session-config named {self.name} diffs", ofmt="text") # type: ignore[return-value] # text outformat returns str
|
||||
|
||||
async def load_file(self, filename: str, *, replace: bool = False) -> None:
|
||||
"""
|
||||
Load the configuration from <filename> into the session configuration.
|
||||
"""Load the configuration from <filename> into the session configuration.
|
||||
|
||||
If the replace parameter is True then the file contents will replace the existing session config (load-replace).
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue