Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions netpalm/backend/plugins/drivers/netmiko/netmiko_drvr.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,22 @@ def sendcommand(self, session=False, command=False):
if self.enable_mode:
session.enable()
result = {}
for commands in command:

if "ttp_template" in self.kwarg.keys():
if type(self.kwarg["ttp_template"]) == str:
templatelst = [self.kwarg["ttp_template"]]
else:
templatelst = self.kwarg["ttp_template"]

for idx, commands in enumerate(command):
if self.kwarg:
# normalise the ttp template name for ease of use
if "ttp_template" in self.kwarg.keys():
if self.kwarg["ttp_template"]:
template_name = config.ttp_templates + self.kwarg[
"ttp_template"] + ".ttp"
if idx < len(templatelst):
template_name = config.ttp_templates + templatelst[idx] + ".ttp"
self.kwarg["ttp_template"] = template_name
else:
self.kwarg["use_ttp"] = False
response = session.send_command(commands, **self.kwarg)
if response:
result[commands] = response
Expand Down