Skip to content

Commit

Permalink
Add support for cli_restore functionality provided with in netcommon …
Browse files Browse the repository at this point in the history
…module (#510)

* restore_plugin

Signed-off-by: rohitthakur2590 <[email protected]>

* update netcommon base

Signed-off-by: rohitthakur2590 <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: rohitthakur2590 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
rohitthakur2590 and pre-commit-ci[bot] authored Apr 12, 2024
1 parent 9eaa97e commit cdff244
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions changelogs/fragments/add_restore_implementation.yaml
Original file line number Diff line number Diff line change
@@ -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).
9 changes: 9 additions & 0 deletions plugins/cliconf/junos.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,15 @@ def rollback(self, rollback_id, commit=True):
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}
response = self.compare_configuration(rollback_id=rollback_id)
Expand Down

0 comments on commit cdff244

Please sign in to comment.