summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-02-01Merge pull request #2 from andy-maier/andy/add-timeoutHEADmasterDaniil Baturin
Added support for pxxsh timeout
2019-01-31Added support for pxxsh timeoutAndreas Maier
This change adds an optional timeout parameter to the VRouter constructor, that is passed on to the pxxsh session timeout. Its default value is 30 which is the default of pxxsh, so that there is no change in behavior by default. Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
2018-01-26T527: Merge pull request #1 from tomodachi/ssh_key_supportDaniil Baturin
Add support for ssh key authentication.
2018-01-22T527: Add support for ssh key authentication.Mateusz Mojsiejuk
2016-09-06Add links to PyPI and ReadTheDocs.Daniil Baturin
2016-09-06How the hell do I use autodoc again?Daniil Baturin
2016-09-06Proper license headers and metadata.release/0.1Daniil Baturin
2016-09-06Improve the docs.Daniil Baturin
2016-09-06Run the sphinx-quickstarthochikong
2016-09-06Add credits section to the README.Daniil Baturin
2016-09-06Make README more consice.Daniil Baturin
2016-09-06Add port parameter. Make password and port named rather than positional ↵Daniil Baturin
arguments. Destroy the pxssh object on logout.
2016-09-06Add generic run_op_mode_command and run_conf_mode_commandDaniil Baturin
so that people can use functions outside of set/delete/commit that we don't support yet, like show, rename or whatever else.
2016-09-06Create pxssh instance when user logins, rather than when the object is created.Daniil Baturin
This allows reusing the same router object with multiple logins and logouts, pxssh refuses to login from the same instance again after logout for some reason.
2016-09-06Forgot . in the relative module path...Daniil Baturin
2016-09-06Fix some mistakes in code according to PEP8hochikong
Rewrite some parts of readme Fix a mistake in logout.If want to reuse the instance,you must create a new pxssh instance
2016-09-06Code cleanup.Daniil Baturin
The code was mostly functional but hard to follow and not quite up to the best current practice. What has been done: Exception hierarchy cleanup. Now it is VyOSError > ConfigError > CommitError > ConfigLocked VyOSError (base class) is raised when the user does something obviously wrong, like trying to commit before entering conf mode. These are programming errors and not recoverable without editing the code. ConfigError other than CommitError is raised on set/delete command failures. These are usually user input errors and cannot be recovered from without interacting with the user. CommitErrors include commit failures due to user errors, and ConfigLocked condition. ConfigLocked is raised when anoher commit is in progress. This is the only condition that can be recovered from programatically (wait and try again). This way people can write try/catch sequences that go from more specific down to VyOSError and use different recovery strategies for different error classes. These names are also more self-explanatory than MaintenanceError etc. Eliminate the last instances of functions that return error messages as strings instead of raising exceptions, and especially those that extract error messages from exceptions caught within and return them. Exceptions are easy to recognize and handle programmatically, string messages are not. Writing a try/catch statement is quick, knowing what the message is and using re.search every time is inefficient for both the user and the computer. Replace inefficient and functionally limited "foo in bar" substring checks with regex matching. Add handling of timeout errors, which was entirely absent (prompt() returns false in those cases, easy to check). Replace the __status dict with individual instance variables. There are few of them, and they are always checked individually, so a dict is unwarranted. I kept the status() method that now wraps those attributes in a dict. I also made it protected (single _) as it's debug stuff and not something end users would normally want to touch. Give attributes descriptive names (logged_in, conf_mode, session_modified, session_saved). All attributes are now boolean. It both makes it more efficient than comparing strings, and easier to understand what values they can have. It would be very hard to deduce that "status" can be "login" or "logout" (or None, but only before the user logins) and "save" can be "Yes" or None without reading the whole thing, and even harder to remember. Simplify the error handling. Eliminate the has_error being set to "Type1", "Type2" etc.. This is very hard to follow especially when the mapping of those strings to actual error strings is partially in different file. This is affectionately known as "spaghetti code". ;) It's been replaced with simple conditionals that raise appropriate exceptions as they go. Eliminate unnecessary attribute checking and setting. If the state machine model cuts off erroneous paths early and sets the state properly, there is simply no way the conf_mode flag can be True while logged_in is False, for instance. There is also no need to unset say session_modified in save() because there is no way it can be True if save() got to that state without throwing an error. It's (now) easy to see, and, if needed, formally prove. Always reuse the pxssh connection object created by __init__, never make a new one, as it's redundant. Replace all occurences of type() with isinstance() so that it also works for all subclases of the type/class in question. Eliminate inconsistent use of stuff like """ foo is "Yes" """, """ foo == None """ and so on. Boolean checks all should be like """ if foo: something() """ or """ if not foo: """, None checks should be """ foo is None """, and == should be reserved for values that are neither None nor boolean. Pass user and password to the constructor as separate arguments for convenience, rather than have the user join them just to split them back. Eliminate the "basic_string" dict. Command prefixes like set and delete always stay the same anyway, and they are only used in corresponding functions.
2016-09-05Fix a problem in exit()hochikong
2016-09-05Fix the logic error in logout()hochikong
2016-09-05Fix some logic error in commit()hochikong
Fix the readme add a new exception rewrite the error handle in router.py
2016-08-26Fix some logic error in logout()hochikong
Fix two mistakes may raise error exceptions in error_distinguish Add a quick start section to README
2016-08-24Fix some mistakes in README and check all codes by 2to3hochikong
2016-08-24Update README.mdHochikong
2016-08-24T133 Add a generic method set() and delete()hochikong
Fix all problems from now on
2016-08-24T133 Add a generic method set() and delete()hochikong
Add 5 exception classes Add the Exceptions section on README When your operation has error,will raise the exception and display the error message from VyOS
2016-08-21T133:Add a generic method set() and delete()hochikong
Rename the project Add set and delete method Rewrite README
2016-08-18T86 Python management library methods give timeoutsOLD_VERSIONhochikong
Fix some problem and add BGP support
2016-08-18T86 Python management library methods give timeoutshochikong
Fix what and what I have done log: 1.Add BGP support 2.Change the API style 3.Rewrite the README.md 4.Fix some mistakes in the codes 5.Test all functions
2016-08-17T86 Python management library methods give timeoutshochikong
Fix a error in exit_config()
2016-08-17T86 Python management library methods give timeoutshochikong
Fix a error in exit_config()
2016-08-17T86 Python management library methods give timeoutshochikong
Fix an error in exit_config()
2016-08-17T86 Python management library methods give timeoutshochikong
Add the BGP configure support
2016-07-31T86 Python management library methods give timeoutshochikong
Fix a error in exit_config():When a user login and enter configure mode but change nothing and exit.It return a message "You should commit first!" Fix the problem when you logout you should create a new instance.Now you can reuse the BasicRouter instance
2016-07-24T86 Python management library methods give timeoutshochikong
Use pxssh replace exscript Attention:When you execute the logout method,you can't use this object any more.You must create a new BasicRouter substance to login the former VyOS system.
2016-06-08T85:Python management library is not Python3 compatible.Hochikong
Fix "no newline at end of file" mistake in StaticRoute.py
2016-06-08T85:Python management library is not Python3 compatible.Hochikong
Fix Router.py and all file in basic_function/ to support Python3.
2016-06-07T83:Remove autogenerated files from git.Administrator
T84:Add proper .gitignore to the python management library. Fix a website address error in setup.py. Fix no newline at end of file
2016-06-07T84:Add proper .gitignore to the python management libraryAdministrator
2016-06-07T83:Remove autogenerated files from gitAdministrator
And fix some errors in LICENSE,README and setup.py
2016-05-30build a new .egg and move LICENSEHochikong
2016-05-30add English version READMEAdministrator
2016-05-29add licenseAdministrator
2016-05-25fix "exit discard"Hochikong
2016-05-25rebuilt eggHochikong
2016-05-25fix little bugsHochikong
2016-05-25final bugs fix and rebuilt egg file,Congratulations!Hochikong
2016-05-25rebuild eggHochikong
2016-05-25Merge remote-tracking branch 'origin/master'Administrator
2016-05-25add deleterouteAdministrator
2016-05-25buid egg againHochikong