Convert nxos_vlan to DI module (#31866)

* Convert nxos_vlan to DI

* fix conflict

* push fix for qalthos's comment

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha
2017-12-21 14:08:33 +05:30
committed by GitHub
parent 8b15b93d01
commit 60f3649ebd
6 changed files with 483 additions and 243 deletions

View File

@@ -123,13 +123,17 @@ class Cli:
"""
flags = [] if flags is None else flags
if self._device_configs != {}:
return self._device_configs
else:
cmd = 'show running-config '
cmd += ' '.join(flags)
cmd = cmd.strip()
try:
return self._device_configs[cmd]
except KeyError:
connection = self._get_connection()
out = connection.get_config(flags=flags)
cfg = to_text(out, errors='surrogate_then_replace').strip()
self._device_configs = cfg
self._device_configs[cmd] = cfg
return cfg
def run_commands(self, commands, check_rc=True):