Vyos CliConf refactor (#33348)

* Refactor VyOS to use cliconf

* Use show configuration commands on get_config

* Remove debug statement

* Construct command/answer/prompt if needed and fix commit comments

* Convert command/prompt/answer to bytes
This commit is contained in:
Ricardo Carrillo Cruz 2017-11-29 11:39:29 +01:00 committed by GitHub
parent 6732be3e62
commit fec39ba1f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 39 deletions

View file

@ -52,18 +52,18 @@ class Cliconf(CliconfBase):
return device_info
def get_config(self):
return self.send_command(b'show configuration all')
return self.send_command(b'show configuration commands')
def edit_config(self, command):
for cmd in chain([b'configure'], to_list(command)):
self.send_command(cmd)
def get(self, command, prompt=None, answer=None, sendonly=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
return self.send_command(to_bytes(command), prompt=to_bytes(prompt), answer=to_bytes(answer), sendonly=sendonly)
def commit(self, comment=None):
if comment:
command = b'commit comment {0}'.format(comment)
command = b'commit comment "{0}"'.format(comment)
else:
command = b'commit'
self.send_command(command)