Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for cli_restore functionality provided with in netcommon module #510

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading