From 5c7c56264681faa44b2bca036973b08cecf168ae Mon Sep 17 00:00:00 2001 From: hochikong <1097225749@qq.com> Date: Wed, 24 Aug 2016 14:41:35 +0800 Subject: T133 Add a generic method set() and delete() Fix all problems from now on --- vymgmt/mgmt_common.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'vymgmt/mgmt_common.py') 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 -- cgit v1.2.3