Skip to content

[console] route connect CLI through in-process console_connect helper part 2#4658

Merged
lizhijianrd merged 1 commit into
sonic-net:masterfrom
hehuang-nokia:dev_c1_feature
Jul 16, 2026
Merged

[console] route connect CLI through in-process console_connect helper part 2#4658
lizhijianrd merged 1 commit into
sonic-net:masterfrom
hehuang-nokia:dev_c1_feature

Conversation

@hehuang-nokia

@hehuang-nokia hehuang-nokia commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

part 2 of 4531
Replace the last pexpect with os.execvp / bash session script to improve picocom performance

What I did

added the second part of the change to streamline the picocom launch process

How I did it

replaced the second pexpect call with execvp

How to verify it

first, launch console app just like before
then, use ps -ef to make sure "connect line" is no longer a standalone process

New command output (if the output of a command-line utility has changed)

connect line X or just reverse ssh

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202603
  • 202605

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

part 2 of 4531
Replace the last pexpect with os.execvp / bash session script to improve picocom performance

Signed-off-by: hehuang <henry.1.huang@nokia.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

This PR has backport request for branch(es): 202603,202605.
Added label(s) for branch(es) msft-202603,202605.

---Powered by SONiC BuildBot

@Pavan-Nokia

Copy link
Copy Markdown

@lizhijianrd @yejianquan Please help review and merge

@lizhijianrd

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@lizhijianrd
lizhijianrd enabled auto-merge (squash) July 16, 2026 06:40
@lizhijianrd
lizhijianrd merged commit ccdaeec into sonic-net:master Jul 16, 2026
9 checks passed
@mssonicbld

Copy link
Copy Markdown
Collaborator

The label Approved for msft-202603 Branch can only be added by a member of the @sonic-net/release-manager-202603 team. Removing the label. Please contact one of the release managers: @lizhijianrd to approve the cherry pick.

@mssonicbld

Copy link
Copy Markdown
Collaborator

The label Approved for msft-202603 Branch can only be added by a member of the @sonic-net/release-manager-202603 team. Removing the label. Please contact one of the release managers: @lizhijianrd to approve the cherry pick.

@mssonicbld

Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202603: Azure/sonic-utilities.msft#412

nkanchi-nexthop pushed a commit to nexthop-ai/sonic-utilities that referenced this pull request Jul 16, 2026
…sonic-net#4658)

part 2 of 4531
Replace the last pexpect with os.execvp / bash session script to improve picocom performance

Signed-off-by: hehuang <henry.1.huang@nokia.com>
Signed-off-by: Nikhil Kanchi <nkanchi@nexthop.ai>
yejianquan pushed a commit to sonic-net/sonic-mgmt that referenced this pull request Jul 24, 2026
### Description of PR

Summary:

Update the reverse-SSH force-interrupt test for the console session
behavior introduced by [sonic-utilities PR
4658](sonic-net/sonic-utilities#4658).

That change replaced the previous console session implementation and
changed the successful termination output from `Picocom was killed` to
`Thanks for using picocom`. The console line still returned to `IDLE`
and the SSH process exited successfully, but the test failed because it
only accepted the legacy message.

This PR accepts either termination message so the test remains
compatible with images from before and after the sonic-utilities change.
It also explicitly initializes the console client variable to satisfy
static analysis.

Fixes # (issue)

### Type of change

- [ ] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [ ] New Test case
    - [ ] Skipped for non-supported platforms
- [x] Test case improvement

### Back port request

- [ ] 202311
- [ ] 202405
- [ ] 202411
- [ ] 202505
- [ ] 202511
- [ ] 202512
- [ ] 202605

Tracking issue/work item for backport/cherry-pick request (GitHub issue
or Microsoft ADO): N/A
Failure type: compatibility with updated console termination output

### Tested branch

- [ ] master
- [ ] 202311
- [ ] 202405
- [ ] 202411
- [ ] 202505
- [ ] 202511
- [ ] 202512
- [ ] 202605
- [x] N/A

### Test result

- Affected SONiC image on a physical `c0` topology: `10 passed` in the
full `console/test_console_reversessh.py` module.
- Static validation: Python syntax validation passed.

### Approach
#### What is the motivation for this PR?

The force-interrupt test assumed one specific console termination
message. After sonic-utilities PR 4658 changed the console session
implementation, successful termination produced a different message and
caused a false test failure.

#### How did you do it?

Use `pexpect.expect_exact()` with the legacy and current termination
messages as alternatives. This preserves compatibility across image
versions while still validating that the client observes a successful
console-session termination message.

Explicitly initialize `client` before the session-creation block so
static analysis can determine that the local variable is initialized.

#### How did you verify/test it?

Ran the complete `console/test_console_reversessh.py` module on a
physical `c0` topology with the affected SONiC image. All 10 cases
passed, including `test_console_reversessh_force_interrupt` and all
custom escape-character variants.

#### Any platform specific information?

None.

#### Supported testbed topology if it's a new test case?

N/A; this is not a new test case.

### Documentation

N/A; test-only compatibility update.

---------

Signed-off-by: Zhijian Li <zhijianli@microsoft.com>
mssonicbld added a commit to Azure/sonic-mgmt.msft that referenced this pull request Jul 24, 2026
…age (#1330)

### Description of PR

Summary:

Update the reverse-SSH force-interrupt test for the console session behavior introduced by [sonic-utilities PR 4658](sonic-net/sonic-utilities#4658).

That change replaced the previous console session implementation and changed the successful termination output from `Picocom was killed` to `Thanks for using picocom`. The console line still returned to `IDLE` and the SSH process exited successfully, but the test failed because it only accepted the legacy message.

This PR accepts either termination message so the test remains compatible with images from before and after the sonic-utilities change. It also explicitly initializes the console client variable to satisfy static analysis.

Fixes # (issue)

### Type of change

- [ ] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [ ] New Test case
 - [ ] Skipped for non-supported platforms
- [x] Test case improvement

### Back port request

- [ ] 202311
- [ ] 202405
- [ ] 202411
- [ ] 202505
- [ ] 202511
- [ ] 202512
- [ ] 202605

Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO): N/A
Failure type: compatibility with updated console termination output

### Tested branch

- [ ] master
- [ ] 202311
- [ ] 202405
- [ ] 202411
- [ ] 202505
- [ ] 202511
- [ ] 202512
- [ ] 202605
- [x] N/A

### Test result

- Affected SONiC image on a physical `c0` topology: `10 passed` in the full `console/test_console_reversessh.py` module.
- Static validation: Python syntax validation passed.

### Approach
#### What is the motivation for this PR?

The force-interrupt test assumed one specific console termination message. After sonic-utilities PR 4658 changed the console session implementation, successful termination produced a different message and caused a false test failure.

#### How did you do it?

Use `pexpect.expect_exact()` with the legacy and current termination messages as alternatives. This preserves compatibility across image versions while still validating that the client observes a successful console-session termination message.

Explicitly initialize `client` before the session-creation block so static analysis can determine that the local variable is initialized.

#### How did you verify/test it?

Ran the complete `console/test_console_reversessh.py` module on a physical `c0` topology with the affected SONiC image. All 10 cases passed, including `test_console_reversessh_force_interrupt` and all custom escape-character variants.

#### Any platform specific information?

None.

#### Supported testbed topology if it's a new test case?

N/A; this is not a new test case.

### Documentation

N/A; test-only compatibility update.

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants