* adds commit replace with config file for iosxr (#35564)

* * adds commit replace with config file for iosxr
* fixes dci failure in iosxr_logging

* * review comment changes
This commit is contained in:
Kedar Kekan 2018-02-01 19:45:32 +05:30 committed by John R Barker
parent 2479b6d635
commit 684e953b50
11 changed files with 227 additions and 48 deletions

View file

@ -67,12 +67,27 @@ class Cliconf(CliconfBase):
return self.send_command(cmd)
def edit_config(self, command):
for cmd in chain(to_list(command)):
self.send_command(cmd)
def edit_config(self, commands=None):
for cmd in chain(to_list(commands)):
try:
if isinstance(cmd, str):
cmd = json.loads(cmd)
command = cmd.get('command', None)
prompt = cmd.get('prompt', None)
answer = cmd.get('answer', None)
sendonly = cmd.get('sendonly', False)
newline = cmd.get('newline', True)
except:
command = cmd
prompt = None
answer = None
sendonly = None
newline = None
def get(self, command, prompt=None, answer=None, sendonly=False):
return self.send_command(command, prompt=prompt, answer=answer, sendonly=sendonly)
self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, newline=newline)
def get(self, command=None, prompt=None, answer=None, sendonly=False, newline=True):
return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, newline=newline)
def commit(self, comment=None):
if comment: