Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@mark_to_call_base_class_method_with_same_name
def _prepare_transitions_without_proxy_pc(self):
"""
Prepare transitions to change states without proxy_pc state.
:return: transitions without proxy_pc state.
"""
transitions = {
UnixRemote.unix_remote: {
AtRemote.at_remote: {
"action": [
"_execute_command_to_change_state"
],
}
},
AtRemote.at_remote: {
UnixRemote.unix_remote: {
"action": [
@mark_to_call_base_class_method_with_same_name
def _prepare_transitions_with_proxy_pc(self):
"""
Prepare transitions to change states with proxy_pc state.
:return: transitions with proxy_pc state.
"""
transitions = {
JuniperGeneric.proxy_pc: {
JuniperGeneric.cli: {
"action": [
"_execute_command_to_change_state"
],
},
},
JuniperGeneric.cli: {
@mark_to_call_base_class_method_with_same_name
def _get_default_sm_configuration_without_proxy_pc(self):
"""
Return State Machine default configuration without proxy_pc state.
:return: default sm configuration without proxy_pc state.
"""
config = { # TODO: shell we use direct-string names of config dicts? change simplicity vs readability
TextualDevice.connection_hops: {
UnixRemote.unix_remote: { # from
AdbRemote.adb_shell: { # to
"execute_command": "adb_shell",
"command_params": { # with parameters
"target_newline": "\n",
"prompt_from_serial_number": True,
},
"required_command_params": [
"serial_number",
@mark_to_call_base_class_method_with_same_name
def _prepare_state_prompts_without_proxy_pc(self):
"""
Prepare textual prompt for each state for State Machine without proxy_pc state.
:return: textual prompt for each state without proxy_pc state.
"""
hops_cfg = self._configurations[CONNECTION_HOPS]
if self._use_local_unix_state:
state_prompts = {
UNIX_REMOTE:
hops_cfg[UNIX_LOCAL][UNIX_REMOTE]["command_params"]["expected_prompt"],
UNIX_REMOTE_ROOT:
hops_cfg[UNIX_REMOTE][UNIX_REMOTE_ROOT]["command_params"]["expected_prompt"],
UNIX_LOCAL:
hops_cfg[UNIX_REMOTE][UNIX_LOCAL]["command_params"]["expected_prompt"],
}
else: # directly from NOT_CONNECTED to UNIX_REMOTE via open connection
@mark_to_call_base_class_method_with_same_name
def _get_default_sm_configuration_with_proxy_pc(self):
"""
Return State Machine default configuration with proxy_pc state.
:return: default sm configuration with proxy_pc state.
"""
config = {
PduAten.connection_hops: {
PduAten.proxy_pc: { # from
PduAten.pdu: { # to
"execute_command": "telnet", # using command
"command_params": { # with parameters
"expected_prompt": r'^>',
"set_timeout": None,
"target_newline": "\r\n",
"login": "teladmin",
"password": "telpwd",
@mark_to_call_base_class_method_with_same_name
def _prepare_state_hops_without_proxy_pc(self):
"""
Prepare non direct transitions for each state for State Machine without proxy_pc state.
:return: non direct transitions for each state without proxy_pc state.
"""
state_hops = {
TextualDevice.not_connected: {
UnixLocal.unix_local_root: UnixLocal.unix_local,
UnixRemote.unix_remote: UnixLocal.unix_local,
UnixRemote.unix_remote_root: UnixLocal.unix_local,
AdbRemote.adb_shell: UnixLocal.unix_local,
AdbRemote.adb_shell_root: UnixLocal.unix_local,
},
UnixLocal.unix_local: {
UnixRemote.unix_remote_root: UnixRemote.unix_remote,
AdbRemote.adb_shell: UnixRemote.unix_remote,
@mark_to_call_base_class_method_with_same_name
def _prepare_transitions_without_proxy_pc(self):
"""
Prepare transitions to change states without proxy_pc state.
:return: transitions without proxy_pc state.
"""
transitions = {
PduAten.pdu: {
PduAten.unix_local: {
"action": [
"_execute_command_to_change_state"
],
},
},
PduAten.unix_local: {
PduAten.pdu: {
"action": [
@mark_to_call_base_class_method_with_same_name
def _prepare_state_hops_with_proxy_pc(self):
"""
Prepare non direct transitions for each state for State Machine with proxy_pc state.
:return: non direct transitions for each state with proxy_pc state.
"""
state_hops = {
Scpi.not_connected: {
Scpi.scpi: Scpi.unix_local,
Scpi.proxy_pc: Scpi.unix_local,
Scpi.unix_local_root: Scpi.unix_local,
},
Scpi.scpi: {
Scpi.not_connected: Scpi.proxy_pc,
Scpi.unix_local: Scpi.proxy_pc,
Scpi.unix_local_root: Scpi.proxy_pc
},
@mark_to_call_base_class_method_with_same_name
def _prepare_transitions_without_proxy_pc(self):
"""
Prepare transitions to change states without proxy_pc state.
:return: transitions without proxy_pc state.
"""
transitions = {
JuniperGeneric.cli: {
JuniperGeneric.unix_local: {
"action": [
"_execute_command_to_change_state"
],
},
JuniperGeneric.configure: {
"action": [
"_execute_command_to_change_state"
@mark_to_call_base_class_method_with_same_name
def _prepare_transitions_without_proxy_pc(self):
"""
Prepare transitions to change states without proxy_pc state.
:return: transitions without proxy_pc state.
"""
if self._use_local_unix_state:
transitions = {
UNIX_LOCAL: {
UNIX_REMOTE: {
"action": [
"_execute_command_to_change_state"
],
}
},
UNIX_REMOTE: {
UNIX_LOCAL: {