These forums are a place for learning, helping and sharing experiences with others about any of our products. Feel free to ask a question and get answers from our community and our most advanced users.
Note that these are public forums - anyone can view the discussions here.
Announcements | |
CloudShell | TestShell |
Developers | BI (Business Inteligence) |
This is where you can suggest your ideas to help and improve the product for everyone.
Please make sure to read the following article before posting a new idea, to get more information about the required information and ideas lifecycle.
Feel free to vote and comment on other ideas to promote them.
Thanks for everyone who suggested the ideas and voted for them.
Find, download and share integrations that can extend and enhance the CloudShell experience.
Integrations have several levels:
Certified - Officially tested and supported by Quali.
Preview - Provides a sneak peek to what the Quali team is developing. Officially supported by Quali. Feel free to experiment and comment, but please take into consideration that it is not yet tested and released.
Community - Integrations shared by community users. Feel free to look into what other users have contributed, please take into consideration that these integrations are not tested by Quali.
To learn more about creating Shells and integrating with CloudShell, use the following links:
CloudShell's Dev Guide | Configuration Management |
Getting started with Shells | Extending CloudShell with Cloud Providers |
Getting started with Orchestration | API Guide |
To share your integration, follow the instructions in this guide.
Hi,
I am developing shells for our devices. Until now, I had only one ssh session and I used 'DefaultCommandMode' (package cloudshell.cli.command_mode). Now, I need to do 2 ssh sessions (ssh to a jumphost and then ssh to my device).
Please let me know how I can have 2 consecutive ssh sessions in my Shell. Can you please give some sample python file for this?
Thanks & Regards
Geetha
Answer by Yaroslav Nikonorov · Mar 01, 2019 at 12:14 PM
Hi Geetha,
I have added additional logging to cli_handler to see passwords.
Can you replace cli_handler in the driver from cli-handlerpy.zip and run the driver in Cloudshell.
I think this can help to see passwords which the driver sends. Then can you attach new logs?
Thanks.
Answer by Yaroslav Nikonorov · Feb 15, 2019 at 02:32 PM
Hi Geetha,
I have attached an example, in the example you can see the way how to use jump host as a command mode.
Let me know if that works for you?
Thanks.
Regards,
Yaroslav
Answer by Geetha Kuthalam · Feb 18, 2019 at 03:24 AM
Hi Yaroslav,
Thanks for your quick reply. When I execute the code I only get the first jumphost prompt, not the second 'device' prompt . Please see my file attached.
My result:
-sh-4.1$
Expecting to see my second prompt SWCMT0000202TS#
______________________________________________________________________________
My manual steps:
1. use Putty to ssh to 172.28.18.210 and login
2. I get the prompt -sh-4.1$
3. ssh to the device
-sh-4.1$ ssh autouser@172.28.17.251
autouser@172.28.17.251's password:
*******************************************************************************
Unauthorised access and use of the
* system may result in legal proceedings against you.
*******************************************************************************
* NOTE: Certain password procedures for complexity, reuse restrictions,
* and aging thresholds, including immediate change of passwords, enforced
* by your organization may prevent you from logging on to this system.
* You may need to change your password on the authentication system prior
* to logging in.
*******************************************************************************
no echo
>>>> All commands in script /usr/.profile were successful
SWCMT0000202TS#
4. SWCMT0000202TS# is my device prompt
Please advise. Thanks.
Regards
Geetha
Answer by Yaroslav Nikonorov · Feb 18, 2019 at 12:18 PM
Hi Geetha,
I have added minor fixes to your script, try it and let me know a result.
Thanks
Regards,
Yaroslav
Answer by Geetha Kuthalam · Feb 19, 2019 at 05:29 AM
Hi Yaroslav,
That worked when I execute the command_modes file by itself. Thanks :).
But, when I added the file command_modes.py to my driver project and execute, I get the following error: Please let me know why I get this error. I have attached my files.
Traceback (most recent call last):
File "E:\Apps\PyCharm Community Edition 2017.3.3\helpers\pydev\pydevd.py", line 1668, in
main()
File "E:\Apps\PyCharm Community Edition 2017.3.3\helpers\pydev\pydevd.py", line 1662, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "E:\Apps\PyCharm Community Edition 2017.3.3\helpers\pydev\pydevd.py", line 1072, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "E:/SHELLS/HfcShell/src/run_hfc_driver.py", line 253, in
out = driver.get_inventory(context)
File "E:/SHELLS/HfcShell/src\driver.py", line 260, in get_inventory
response = autoload_operations.discover()
File "E:\SHELLS\lib\site-packages\cloudshell\devices\networking_utils.py", line 119, in wrapped
result = func(self, *args, **kwargs)
File "E:\SHELLS\lib\site-packages\cloudshell\devices\runners\autoload_runner.py", line 61, in discover
self.resource_config.name)
File "E:/SHELLS/HfcShell/src\hfc\flows\autoload_flow.py", line 15, in execute_flow
with self._cli_handler.default_mode_service() as cli_service:
File "E:\SHELLS\lib\site-packages\cloudshell\cli\session_pool_context_manager.py", line 43, in __enter__
prompts_re = r'|'.join(CommandModeHelper.defined_modes_by_prompt(self._command_mode).keys())
File "E:\SHELLS\lib\site-packages\cloudshell\cli\command_mode_helper.py", line 47, in defined_modes_by_prompt
while node.parent_node:
AttributeError: 'DefaultCommandMode' object has no attribute 'parent_node'
Regards
Geetha
Answer by Yaroslav Nikonorov · Feb 19, 2019 at 03:05 PM
Hi Geetha,
I have moved modes to cli_handler.py and changed service name in autoload_flow.py.
See changes.
Regards,
Yaroslav
Answer by Geetha Kuthalam · Feb 20, 2019 at 06:06 AM
Hi Yaroslav,
Initially I got an ssh error. But, after I swapped the ipaddress assignment it worked.
Thanks a lot for your help.
Regards
Geetha
Answer by Geetha Kuthalam · Feb 28, 2019 at 02:43 AM
Hi Yaroslav,
When the python project code is executed on pycharm, it works fine. But, when the code is used as a Shell in CloudShell to discover a Resource there is an error 'loop detected with the second part of the ssh:
Discovery failed for resource 'Hfc': 'get_inventory' command failed with 'SessionLoopDetectorException' error.
Description: ('SSHSession', 'Expected actions loops detected'). The resource is now excluded. To include the resource, navigate to the Inventory page.
I have attached the debug log from C:\ProgramData\QualiSystems\logs\inventory\HfcShell_3_107.
Note: The username and password work when tested manually or using pycharm.
Regards
Geetha
Answer by Yaroslav Nikonorov · Feb 28, 2019 at 12:05 PM
Hi Geetha,
In the attached debug log you can find cli session output. When it connects from the jump host to the device and enter password, device return ":Permission denied, please try again."
Looks like some credentials are not correct. When this repeats, LoopDetector catches this repetition and raises an exception.
Command: ssh autouser@172.28.17.251 ssh autouser@172.28.17.251 autouser@172.28.17.251's password: Action key: password: Permission denied, please try again. autouser@172.28.17.251's password: Action key: password: Permission denied, please try again.
Regards, Yaroslav
Answer by Geetha Kuthalam · Mar 01, 2019 at 05:59 AM
Hi Yaroslav,
Thanks for the reply. But, the credentials worked fine via pycharm :(.
I even tried another set of credentials which work on pycharm and I get the following error. The credentials are correct. Any other ideas?
2019-03-01 16:47:19,500 [ERROR]: QS.hfc.Thread-92 ssh_session - _initialize_session Traceback (most recent call last): 2019-03-01 16:47:19,500 [ERROR]: QS.hfc.Thread-92 ssh_session - _initialize_session File "C:\ProgramData\QualiSystems\venv\HfcShell_4_107\lib\site-packages\cloudshell\cli\session\ssh_session.py", line 63, in _initialize_session 2019-03-01 16:47:19,500 [ERROR]: QS.hfc.Thread-92 ssh_session - _initialize_session banner_timeout=30, allow_agent=True, look_for_keys=False, pkey=self.pkey) 2019-03-01 16:47:19,500 [ERROR]: QS.hfc.Thread-92 ssh_session - _initialize_session File "C:\ProgramData\QualiSystems\venv\HfcShell_4_107\lib\site-packages\paramiko\client.py", line 424, in connect 2019-03-01 16:47:19,500 [ERROR]: QS.hfc.Thread-92 ssh_session - _initialize_session passphrase, 2019-03-01 16:47:19,500 [ERROR]: QS.hfc.Thread-92 ssh_session - _initialize_session File "C:\ProgramData\QualiSystems\venv\HfcShell_4_107\lib\site-packages\paramiko\client.py", line 714, in _auth 2019-03-01 16:47:19,500 [ERROR]: QS.hfc.Thread-92 ssh_session - _initialize_session raise saved_exception 2019-03-01 16:47:19,500 [ERROR]: QS.hfc.Thread-92 ssh_session - _initialize_session AuthenticationException: Authentication failed. 2019-03-01 16:47:19,500 [ERROR]: QS.hfc.Thread-92 ssh_session - _initialize_session 2019-03-01 16:47:20,621 [INFO]: QS.hfc.Thread-92 networking_utils - wrapped Command "discover" finished unsuccessfully
Regards
Geetha
These forums are a place for learning, helping and sharing experiences with others about any of our products. Feel free to ask a question and get answers from our community and our most advanced users.
Note that these are public forums - anyone can view the discussions here.
Announcements | |
CloudShell | TestShell |
Developers | BI (Business Inteligence) |
This is where you can suggest your ideas to help and improve the product for everyone.
Please make sure to read the following article before posting a new idea, to get more information about the required information and ideas lifecycle.
Feel free to vote and comment on other ideas to promote them.
Thanks for everyone who suggested the ideas and voted for them.
Find, download and share integrations that can extend and enhance the CloudShell experience.
Integrations have several levels:
Certified - Officially tested and supported by Quali.
Preview - Provides a sneak peek to what the Quali team is developing. Officially supported by Quali. Feel free to experiment and comment, but please take into consideration that it is not yet tested and released.
Community - Integrations shared by community users. Feel free to look into what other users have contributed, please take into consideration that these integrations are not tested by Quali.
To learn more about creating Shells and integrating with CloudShell, use the following links:
CloudShell's Dev Guide | Configuration Management |
Getting started with Shells | Extending CloudShell with Cloud Providers |
Getting started with Orchestration | API Guide |
To share your integration, follow the instructions in this guide.
Creating an L2 Shell in CloudShell 7.1 0 Answers
Hi to All! Why VirtualAppliance_SDK activation failed? 6 Answers
How to use GetTopologiesByCategory(categoryName='', categoryValue='') 2 Answers
API command to get resource connections? 3 Answers
Has someone experience with Python vs cx_Oracle library integration? 3 Answers