summaryrefslogtreecommitdiff
path: root/vymgmt/mgmt_common.py
diff options
context:
space:
mode:
authorhochikong <1097225749@qq.com>2016-08-21 19:37:29 +0800
committerhochikong <1097225749@qq.com>2016-08-21 19:37:29 +0800
commit655811f476a95b8eac2f65c78323a982d59eff1b (patch)
tree6aa2a938dfb73d1b185f56f026fbb519197a2bf3 /vymgmt/mgmt_common.py
parent2584bea48c4c243fdf694cb21505bfbde6834a7f (diff)
downloadpython-vyos-mgmt-655811f476a95b8eac2f65c78323a982d59eff1b.tar.gz
python-vyos-mgmt-655811f476a95b8eac2f65c78323a982d59eff1b.zip
T133:Add a generic method set() and delete()
Rename the project Add set and delete method Rewrite README
Diffstat (limited to 'vymgmt/mgmt_common.py')
-rw-r--r--vymgmt/mgmt_common.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/vymgmt/mgmt_common.py b/vymgmt/mgmt_common.py
new file mode 100644
index 0000000..0ed4bf0
--- /dev/null
+++ b/vymgmt/mgmt_common.py
@@ -0,0 +1,19 @@
+# Copyright (c) 2016 Hochikong
+
+
+def messenger(obj, config):
+ """This method used for sending configuration 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 : Configured successfully"
+ except Exception as e:
+ return e