Merge pull request #5 from dgarros/pyez

Add options to get_config to accept format (text, set or xml)
pull/15566/head
Peter Sprygada 9 years ago committed by Peter Sprygada
parent 2c90472609
commit 61baf41edc

@ -249,9 +249,13 @@ class Netconf(object):
self.device.facts_refresh()
return self.device.facts
def get_config(self):
ele = self.rpc('get_configuration', format='text')
return str(ele.text).strip()
def get_config(self, config_format="text"):
ele = self.rpc('get_configuration', format=config_format)
if config_format == "text" or config_format == "set":
return str(ele.text).strip()
elif config_format == "xml":
return ele
def rpc(self, name, format='xml', **kwargs):
meth = getattr(self.device.rpc, name)
@ -337,4 +341,3 @@ def get_module(**kwargs):
module.connect()
return module

Loading…
Cancel
Save