summaryrefslogtreecommitdiff
path: root/vymgmt/mgmt_common.py
diff options
context:
space:
mode:
authorhochikong <1097225749@qq.com>2016-08-24 14:41:35 +0800
committerhochikong <1097225749@qq.com>2016-08-24 14:41:35 +0800
commit5c7c56264681faa44b2bca036973b08cecf168ae (patch)
treee8c917d971e8585924515612d068eb672c4d2b9c /vymgmt/mgmt_common.py
parent2528aa7872958c8e4507d8f42ba0fe767989b19b (diff)
downloadpython-vyos-mgmt-5c7c56264681faa44b2bca036973b08cecf168ae.tar.gz
python-vyos-mgmt-5c7c56264681faa44b2bca036973b08cecf168ae.zip
T133 Add a generic method set() and delete()
Fix all problems from now on
Diffstat (limited to 'vymgmt/mgmt_common.py')
-rw-r--r--vymgmt/mgmt_common.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/vymgmt/mgmt_common.py b/vymgmt/mgmt_common.py
index 0ed4bf0..1ccb96a 100644
--- a/vymgmt/mgmt_common.py
+++ b/vymgmt/mgmt_common.py
@@ -17,3 +17,21 @@ def messenger(obj, config):
return "Result : Configured successfully"
except Exception as e:
return e
+
+
+def committer(obj, config):
+ """This method used for sending commit task to VyOS
+
+ :param obj: A connection object
+ :param config: A configuration string
+ :return: A message or an error
+ """
+ try:
+ obj.sendline(config)
+ obj.prompt()
+ if len(obj.before) > obj.before.index('\r\n') + 2:
+ return obj.before
+ else:
+ return "Result : Commit successfully"
+ except Exception as e:
+ return e