03-26-2021 07:53 AM - edited 03-26-2021 03:14 PM
Hello folks,
Can anybody tell me why when I use the manager of ncclient I cant check the method of it using the dot notation.
Here a print screen to illustrate, for example, the methods like "get_config", ""edit_config" exists but it doesn't shows.
Is there any other way to check the methods available inside ?
Thanks
Solved! Go to Solution.
04-14-2021 11:09 AM
Here's the GitHub repo and source code for ncclient / manager with all the available operations / methods:
https://github.com/ncclient/ncclient/blob/master/ncclient/manager.py
04-14-2021 11:01 AM
Hello Guilherme,
I see you are writing about the auto-complete function of an IDE. I wonder which one you're using. I recreated the core of your code in VS Code and I basically got the same auto-suggestions as you. Well, the 'get_config' and 'edit_config' are missing (see attached image)
I tried it in the Atom ID also and the 'get_config' and 'edit_config' are not auto-completion options there either.
Something is keeping these two methods from being suggested. I'm not sure why.
04-14-2021 11:09 AM
Here's the GitHub repo and source code for ncclient / manager with all the available operations / methods:
https://github.com/ncclient/ncclient/blob/master/ncclient/manager.py
05-03-2021 11:01 AM
Hey,
I just found my answer.
All the operations (get,get_config, etc...) are spicified as a dictionary in the method manager.
With the use of 'help' function of python.
>>> help (manager) Help on module ncclient.manager in ncclient: NAME ncclient.manager DESCRIPTION This module is a thin layer of abstraction around the library. It exposes all core functionality. <ommited> DATA OPERATIONS = {'cancel_commit': <class 'ncclient.operations.edit.Cancel...
Then, when we call 'manager.operations' we have them all, it is kind silly.
>>> dir(manager.operations) ['CancelCommit', 'CloseSession', 'Commit', 'CopyConfig', 'CreateSubscription', 'DeleteConfig', 'DiscardChanges', 'Dispatch', 'EditConfig', 'GenericRPC', 'Get', 'GetConfig', 'GetReply', 'GetSchema', 'KillSession', 'Lock', 'LockContext', 'MissingCapabilityError', 'OperationError', 'PoweroffMachine', 'RPC', 'RPCError', 'RPCReply', 'RaiseMode', 'RebootMachine', 'TimeoutExpiredError', 'Unlock', 'Validate', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'edit', 'errors', 'flowmon', 'lock', 'retrieve', 'rpc', 'session', 'subscribe', 'util']
07-18-2022 03:19 PM - edited 07-18-2022 03:53 PM
Hello Guiherme,
I still have the same problem than you with 'get_config' and 'edit_config' - I cannot see them from connect.manager().
I am using ncclient 0.9.13 on my windows Pycharm machine.
The only time i was able to use those method was from a Ubuntu machine with a different package version 0.6.0-2.1
Did you get a chance to find the right command to get_config and edit_config ? I am stuggling since days now...
If you can share some example, it would be great!
Unfortunately, i am unable to find any information on Internet with this new method.
Thanks, if you can help!
y = ncclient.operations.GetConfig.request(source="running")
TypeError: GetConfig.request() missing 1 required positional argument: 'self'
Z = ncclient.operations.EditConfig.request(target="running", config=netconf_hostname)
TypeError: EditConfig.request() missing 1 required positional argument: 'self'
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide