Closed dhanakane closed 7 years ago
I think that the problem is in IOS-XR prompt because it doesn't like "hostname\<delimeter>". I never tested netdev on IOS-XR, but it's not difficult for me. I will try to add IOS-XR support this weekend :) I will add information about it here
@dhanakane I have tested IOS XR with IOS class - it works fine (but I mention about send_config_set - it doesn't make commit so you need to make it by hand. I will implement it in new IOS XR Class soon). In your case you made this:
RP/0/0/CPU0:ios#show run interface loopback0 Sat Nov 4 12:22:41.504 YEKAT % No such configuration item(s) RP/0/0/CPU0:ios#exit <--- No more information (and prompt too) in buffer here because of you close session. Connection to 10.1.64.100 closed by remote host. Connection to 10.1.64.100 closed.
As you see you made exit and close connection by hand but you don't need it - netdev make it himself: your session automatically will be closed after exiting async context manager (async with as ). The reason of problem is that nedev doesn't check that session alive or not in reading. It only reads buffer from the connection. But asyncssh allows to reading it without any exception (don't know why I will research it)
And the other thing: if you want to test exactly applying configuration you should use send_config_set instead of send_command (but you can use and send_command too but in this case, you need manually enter and exit to configuration mode). It will be like this:
# Testing sending configuration set
commands = ["line console 0", "exit"]
out = await ios.send_config_set(commands)
RP/0/0/CPU0:ios#show run interface loopback0 Sat Nov 4 12:32:45.852 YEKAT % No such configuration item(s) RP/0/0/CPU0:ios#conf t <------ automatically enter to config mode Sat Nov 4 12:32:55.662 YEKAT RP/0/0/CPU0:ios(config)#line console 0 RP/0/0/CPU0:ios(config-line)#exit RP/0/0/CPU0:ios(config)#end <------- automatically exit from config mode RP/0/0/CPU0:ios#
Command send_config_set automatically enters to configuration mode and after applying command exits from it (but without commiting right now).
I added some support for IOS XR (adding with_commit parameter for IOX XR send_config_set. We can see example for IOS XR in example folder) at 2d413d05a92c34bf0a4dd95c45fa8bf64c157a2b. You can use now device_type "cisco_xr" for IOS XR.
I'm running the following code on an IOS-XR device:
Looking at the logs, it looks like the prompt is never received from the device, so the connection is never terminated. Any advice?