Comments (10)
Thank you for your interest to this library!
I really didn't test carefully IOS XR class because I haven't it in my work. I can divide my thoughts into 2 points:
- I want to make timeout for operation for a long time :) I want to add default timer to all read operations in all classes for better controlling the flow. And I have the stimulus to do it right now :) I think that it should raise timeout exception.
- In this particular situation, it's a normal operation and we should make changes in function for normal processing this variant.
Firstly, we should check the output for the string "Failed to commit" and raise the "Failed to commit" exception. And we also should check "Uncommitted changes found" after "end" command.
Right now we have function with these parameters async def send_config_set(self, config_commands=None, with_commit=True, commit_comment='', exit_config_mode=True)
. So we can have different situations:
- with_commit=True - All changes will be commited. If not - we will get "Failed to commit" exception
- with_commit=False and exit_config_mode=False. Nothing special, user should make decision himself
- with_commit=False and exit_config_mode=True - I think we should always exit from config mode without any changes. In this situation we should check the output for "Uncommitted changes found" string by using special function for this purpose:
_read_until_prompt_or_pattern
. We should overrideexit_config_mode
in IOS XR class or maybe change this function in IOS class.
I can make these changes in this week, but if you really want to help me and make changes yourself - it will be really great!! You can pm me in telegram or slack and I can help you make PR for it.
from netdev.
I'm happy to help.
I will create a PR, and then the first thing I'll do is create a test that demonstrates the issue. Then we can discuss the test. Then I will add code to resolve the problem, which will include the handling you've discussed above.
Sound good?
from netdev.
Yes, it will be amazing! I will wait for the PR!
from netdev.
Quick note to say I have not forgotten about this issue, but I've been extremely busy recently.
from netdev.
Hello, @cjrh!
I have just pushed new code to IOS XR class. Right now it works like this:
- with_commit=True - All changes will be commited. If not - we will get
CommitError
exception - with_commit=False and exit_config_mode=False. Nothing special, user should make decision himself
- with_commit=False and exit_config_mode=True - exit from config without any changes and commits
For taking this behavior I made these changes master...develop#diff-c089f96ea63362ebd55df599d9d7c153. The main:
- I change cleanup function for properly session termination. In all sessions, we should clear all unsaved changes, so I simply write "abort" to channel. It's useful when we get Exception because we are using an async context manager which always runs cleanup function.
- I changed
exit_config_mode
function for properly working with an unsaved date when we have this condition "with_commit=False and exit_config_mode=True".
Can you test it in your environment? After that, I will release it in master branch :)
from netdev.
Forgot! I also added timeout params for managing timeout in all async operations :) You can use it only in init. The default timeout is 15 seconds:
def __init__(self, host=u'', username=u'', password=u'', port=22, device_type=u'', known_hosts=None,
local_addr=None, client_keys=None, passphrase=None, timeout=15, loop=None):
I thought about adding timeout exactly to operations (send_config_set and send_command) but I don't know if it's really necessary. Do you need this?
from netdev.
@selfuryon Thanks! I will have a look towards the middle or end of this week.
from netdev.
@cjrh Hello! Did you test new code? :)
from netdev.
Sadly, I have not tested it yet. I did the workaround we discussed, where I made a subclass of the XR class and so far that has worked very well. sorry!
from netdev.
This same stuck can happen on IOS.
I suspect the find_base_prompt() gets stuck for a similar reason...
Say you have a switch that has an automatic vty command, and you forget to issue the proper command....
autocommand who
but they forgot the...
autocommand-options nohangup
Well, now you connect, get logged in, and before the prompt ever appears, you're disconnected.
Well now you're stuck, you're stuck at the find_base_prompt() forever...
from netdev.
Related Issues (20)
- Change license type
- Improve documentation
- Haven't any exceptions/messages about the wrong secret password in IOS
- What is default timeout or retry Number HOT 2
- Refactoring the code
- MikrotikRouterOS raises Attribute error during initialization HOT 1
- Timeout feature not working in MircoticRouterOS HOT 1
- MicrotikRouterOS raises TimeoutError HOT 1
- Small issue with Ubiquity_edge - probably my fault. HOT 1
- Support for paloalto_panos HOT 1
- Unexpected keyword argument 'loop' with asyncssh==2.3.0 HOT 3
- device TimeoutError HOT 1
- Little correction to add in the online documentation
- send_config_from_file support for netdev
- False positives on _base_pattern, can't override. HOT 2
- Issue with asyncio stuck at task
- Prompt pattern matches where it should NOT HOT 1
- Could you upgrade Asyncssh in netdev HOT 1
- Async IO task is getting stuck at send_command method.
- Support for Juniper_screenOs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netdev.