scrapli / nornir_scrapli

scrapli's plugin for nornir
https://scrapli.github.io/nornir_scrapli/
MIT License
87 stars 12 forks source link

nornir_scrapli timing out on multi-line banner updates #106

Closed mdeng10 closed 2 years ago

mdeng10 commented 2 years ago

Hi Carl,

Device type: IOSXE I'm attempting to update the login banner via nornir scrapli and it's timing out, i have no problems doing the following

task.run(
    task=send_config,
    name="login_banner_command",
    config="banner login ^This is a login banner test^",
)

The above returns an expected MultiResult with the relevant details and the switch has the new login banner reflected when attempting to log in.

However, when attempting to do a multi line login banner through the following

task.run(
    task=send_config,
    name="login_banner_command",
    config="banner login ^This is a login banner \ntest^",
)

Nornir Scrapli times out and fails to finish the request - the following all fail as well

task.run(
    task=send_config,
    name="login_banner_command",
    config="banner login ^This is a login banner \r\ntest^",
)

task.run(
    task=send_configs,
    name="login_banner_command",
    config=["banner login ^", "This is a login banner test^"],
)

task.run(
    task=send_config,
    name="login_banner_command",
    config="banner login \"This is a login \nbanner test\"",
)

task.run(
    task=send_config,
    name="login_banner_command",
    config="banner login This is a login \nbanner test",
)

task.run(
    task=send_configs,
    name="login_banner_command",
    config=["banner login ^", "This is a login", "banner test^"],
)

I've had a look through existing issues and wasn't able to find a relevant one - but i did find this similar problem with netmiko so perhaps the problem might be related - https://github.com/ktbyers/netmiko/issues/1531

I also notice that when it fails, the banner gets reset (and then the workflow times out) so it seems it seems like it might get everything.

Is this an error or have I made a mistake when attempting to do multiline commands

carlmontanari commented 2 years ago

Expected behavior, see this example comments in there explain why. scrapli-cfg can load and merge/replace config w/out this caveat. TL;DR scrapli dislikes the "vi-like" mode that banners/macros put you into. you can send eager flag, but just using scrapli-cfg is the better option.

mdeng10 commented 2 years ago

appreciate the swift response, functionality is working as intended setting the eager flag!