From da8fb721566ab87621595a68719c83ee2258eb21 Mon Sep 17 00:00:00 2001 From: rohitthakur2590 Date: Tue, 26 Mar 2024 15:32:47 +0530 Subject: [PATCH 1/3] restore_plugin Signed-off-by: rohitthakur2590 --- plugins/cliconf/junos.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/cliconf/junos.py b/plugins/cliconf/junos.py index 75a2e23b..596a8393 100644 --- a/plugins/cliconf/junos.py +++ b/plugins/cliconf/junos.py @@ -271,6 +271,15 @@ def rollback(self, rollback_id, commit=True): else: self.discard_changes() return resp + + @configure + def restore(self, filename=None, path=""): + if not filename: + raise ValueError("'file_name' value is required for restore") + cmd = f"load override {path}{filename}" + resp = self.send_command(cmd) + self.commit() + return resp def get_diff(self, rollback_id=None): diff = {"config_diff": None} From 44c58a30a4a93c9fd4224dca462e6724b0d822c2 Mon Sep 17 00:00:00 2001 From: rohitthakur2590 Date: Fri, 12 Apr 2024 23:11:34 +0530 Subject: [PATCH 2/3] update netcommon base Signed-off-by: rohitthakur2590 --- changelogs/fragments/add_restore_implementation.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelogs/fragments/add_restore_implementation.yaml diff --git a/changelogs/fragments/add_restore_implementation.yaml b/changelogs/fragments/add_restore_implementation.yaml new file mode 100644 index 00000000..ff161ac7 --- /dev/null +++ b/changelogs/fragments/add_restore_implementation.yaml @@ -0,0 +1,6 @@ +major_changes: + - Update the netcommon base version 6.1.0 to support cli_restore plugin. +minor_changes: + - Add support for cli_restore functionality. + - cli_restore module is part of netcommon. + - Please refer the PR to know more about core changes (https://github.com/ansible-collections/ansible.netcommon/pull/618). From 241548ddcbed0aa5d191b717478cad00dc4ce7db Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 17:43:13 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- plugins/cliconf/junos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cliconf/junos.py b/plugins/cliconf/junos.py index 596a8393..4461c9cb 100644 --- a/plugins/cliconf/junos.py +++ b/plugins/cliconf/junos.py @@ -271,7 +271,7 @@ def rollback(self, rollback_id, commit=True): else: self.discard_changes() return resp - + @configure def restore(self, filename=None, path=""): if not filename: