diff --git a/napalm/eos/eos.py b/napalm/eos/eos.py index 38c9aa495..2f5744ef7 100644 --- a/napalm/eos/eos.py +++ b/napalm/eos/eos.py @@ -55,8 +55,9 @@ class EOSDriver(NetworkDriver): SUPPORTED_OC_MODELS = [] HEREDOC_COMMANDS = [ - "banner login", - "banner motd", + ("banner login", 1), + ("banner motd", 1), + ("protocol https certificate", 2) ] _RE_BGP_INFO = re.compile('BGP neighbor is (?P.*?), remote AS (?P.*?), .*') # noqa @@ -139,12 +140,15 @@ def _lock(self): raise SessionLockedException('Session is already in use') @staticmethod - def _multiline_convert(config, start="banner login", end="EOF"): + def _multiline_convert(config, start="banner login", end="EOF", depth=1): """Converts running-config HEREDOC into MULTILINE hack""" ret = list(config) # Don't modify list in-place try: s = ret.index(start) - e = ret.index(end, s) + e = s + while depth: + e = ret.index(end, e + 1) + depth = depth - 1 except ValueError: # Couldn't find end, abort return ret ret[s] = {'cmd': ret[s], 'input': "\n".join(ret[s+1:e])} @@ -177,8 +181,8 @@ def _load_config(self, filename=None, config=None, replace=True): continue commands.append(line) - for start in [s for s in self.HEREDOC_COMMANDS if s in commands]: - commands = self._multiline_convert(commands, start) + for start, depth in [(s, d) for (s, d) in self.HEREDOC_COMMANDS if s in commands]: + commands = self._multiline_convert(commands, start=start, depth=depth) try: self.device.run_commands(commands)