diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2018-08-22 09:52:43 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2018-08-22 09:52:43 +0200 |
commit | a92966bf867f30a67a71b007bc170e0b1686efe2 (patch) | |
tree | e70c9b4570c22b461252e090b29f95aac8660272 | |
parent | 8b2e577ef86d99ceca59d73aa71f3d62f44b0de7 (diff) |
examples/ncclient: make validate and commit optional
Change-Id: I9da8729b58500d18c82981284c44ad07bcbee167
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
-rwxr-xr-x | examples/ncclient/edit_config.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/ncclient/edit_config.py b/examples/ncclient/edit_config.py index 741232b51..598770738 100755 --- a/examples/ncclient/edit_config.py +++ b/examples/ncclient/edit_config.py @@ -25,10 +25,12 @@ def _edit_config(config_filename, host='localhost', port=2831, username='admin', with open(config_filename, 'r') as f: ret = m.edit_config(config=f.read()) logger.info("<edit-config> successful:\n%s" % ret) - validate = m.validate() - logger.info("<validate> successful:\n%s" % validate) - commit = m.commit() - logger.info("<commit> successful:\n%s" % commit) + if validate: + ret = m.validate() + logger.info("<validate> successful:\n%s" % ret) + if commit: + ret = m.commit() + logger.info("<commit> successful:\n%s" % ret) if __name__ == '__main__': argparser = argparse.ArgumentParser(description="Configures VPP using <edit-config> RPC") |