-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update console connection tool (#2829)
This PR updates console connection tool Refactor code. Move most code from __init__.py to console_host.py Support interactive shell Add a new interactice posix_shell for devutils
- Loading branch information
1 parent
6ef0848
commit c12a893
Showing
5 changed files
with
69 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +0,0 @@ | ||
from tests.common.connections.base_console_conn import CONSOLE_SSH, CONSOLE_SSH_MENU_PORTS, CONSOLE_TELNET | ||
from telnet_console_conn import TelnetConsoleConn | ||
from ssh_console_conn import SSHConsoleConn | ||
|
||
__all__ = ["TelnetConsoleConn", "SSHConsoleConn"] | ||
|
||
ConsoleTypeMapper = { | ||
CONSOLE_TELNET: TelnetConsoleConn, | ||
CONSOLE_SSH: SSHConsoleConn, | ||
CONSOLE_SSH_MENU_PORTS: SSHConsoleConn | ||
} | ||
|
||
def ConsoleHost(console_type, | ||
console_host, | ||
console_port, | ||
sonic_username, | ||
sonic_password, | ||
console_username=None, | ||
console_password=None, | ||
timeout_s=100): | ||
if not ConsoleTypeMapper.has_key(console_type): | ||
raise ValueError("console type {} is not supported yet".format(console_type)) | ||
params = { | ||
"console_host": console_host, | ||
"console_port": console_port, | ||
"console_type": console_type, | ||
"sonic_username": sonic_username, | ||
"sonic_password": sonic_password, | ||
"console_username": console_username, | ||
"console_password": console_password, | ||
"timeout": timeout_s | ||
} | ||
return ConsoleTypeMapper[console_type](**params) | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from base_console_conn import CONSOLE_SSH, CONSOLE_SSH_MENU_PORTS, CONSOLE_TELNET | ||
from telnet_console_conn import TelnetConsoleConn | ||
from ssh_console_conn import SSHConsoleConn | ||
|
||
ConsoleTypeMapper = { | ||
CONSOLE_TELNET: TelnetConsoleConn, | ||
CONSOLE_SSH: SSHConsoleConn, | ||
CONSOLE_SSH_MENU_PORTS: SSHConsoleConn | ||
} | ||
|
||
def ConsoleHost(console_type, | ||
console_host, | ||
console_port, | ||
sonic_username, | ||
sonic_password, | ||
console_username=None, | ||
console_password=None, | ||
timeout_s=100): | ||
if not ConsoleTypeMapper.has_key(console_type): | ||
raise ValueError("console type {} is not supported yet".format(console_type)) | ||
params = { | ||
"console_host": console_host, | ||
"console_port": console_port, | ||
"console_type": console_type, | ||
"sonic_username": sonic_username, | ||
"sonic_password": sonic_password, | ||
"console_username": console_username, | ||
"console_password": console_password, | ||
"timeout": timeout_s | ||
} | ||
return ConsoleTypeMapper[console_type](**params) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters