Skip to content

[consutil] Store console port state in STATE_DB#1208

Merged
Blueve merged 3 commits intosonic-net:masterfrom
Blueve:dev/jika/connect
Nov 4, 2020
Merged

[consutil] Store console port state in STATE_DB#1208
Blueve merged 3 commits intosonic-net:masterfrom
Blueve:dev/jika/connect

Conversation

@Blueve
Copy link
Contributor

@Blueve Blueve commented Nov 3, 2020

- What I did

  • Console port state now stored in STATE_DB
  • Add new exit code(ERR_DISABLE)
  • Refactor consutil/lib.py
  • Refactor consutil/consutil.py
  • Add unit tests for consutil/lib.py

- How I did it

  • Refactor origin function to classes
  • Refactor origin command implementation with new lib api
  • Add 4 new custom exception for error handling
  • Take advantage of STATE_DB

- How to verify it
Add unit tests

---------- coverage: platform linux2, python 2.7.16-final-0 ----------
Name                                       Stmts   Miss  Cover
--------------------------------------------------------------
consutil/lib.py                              222     15    93%

Tested on a physical SONiC DUT. Detail steps shown below:

test show command

admin@sonic:~$ sudo consutil show
  Line    Baud    PID    Start Time    Device
------  ------  -----  ------------  --------
     0       -      -             -
     1    9600      -             -
     2       -      -             -
     3       -      -             -
     4       -      -             -
     5       -      -             -
     6       -      -             -
     7       -      -             -
     8       -      -             -
     9       -      -             -
    10       -      -             -
    11       -      -             -
    12       -      -             -
    13       -      -             -
    14       -      -             -
    15       -      -             -
    16       -      -             -
    17       -      -             -
    18       -      -             -
    19       -      -             -
    20       -      -             -
    21       -      -             -
    22       -      -             -
    23       -      -             -
    24       -      -             -
    25       -      -             -
    26       -      -             -
    27       -      -             -
    28       -      -             -
    29       -      -             -
    30       -      -             -
    31       -      -             -
    32       -      -             -
    33       -      -             -
    34       -      -             -
    35       -      -             -
    36       -      -             -
    37       -      -             -
    38       -      -             -
    39       -      -             -
    40       -      -             -
    41       -      -             -
    42       -      -             -
    43       -      -             -
    44       -      -             -
    45       -      -             -
    46       -      -             -
    47       -      -             -

test connect command

admin@sonic:~$ sudo consutil connect 1
Successful connection to line 1
Press ^A ^X to disconnect

test show brief command (while the line is busy)

admin@sonic:~$ sudo consutil show -b
  Line    Baud    PID                Start Time    Device
------  ------  -----  ------------------------  --------
    *1    9600  18706  Wed Mar  6 09:31:14 2019

test clear command

admin@sonic:~$ sudo consutil clear 1
admin@sonic:~$ sudo consutil show -b
  Line    Baud    PID    Start Time    Device
------  ------  -----  ------------  --------
     1    9600      -             -

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

No change.

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

No change.

@Blueve Blueve requested a review from yxieca November 3, 2020 06:47
@lgtm-com
Copy link

lgtm-com bot commented Nov 3, 2020

This pull request introduces 3 alerts when merging 60b68eb into ef5f212 - view on LGTM.com

new alerts:

  • 2 for Unused import
  • 1 for Unreachable code

@Blueve
Copy link
Contributor Author

Blueve commented Nov 4, 2020

retest default please

@Blueve Blueve merged commit e3d3d92 into sonic-net:master Nov 4, 2020
@Blueve Blueve deleted the dev/jika/connect branch November 4, 2020 06:32
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
 Enable m_isCombinedMirrorV6Table for BFN platform (sonic-net#1212)
[vnet]: Update VNET route table size to 40K for BITMAP implementation (sonic-net#1132)
 Default action for Egress ACL Table not poulated. (sonic-net#1208)
Add/Del lag_name_map item according to lag adding and removing (sonic-net#1124)
Increase ip2me CIR/CBR for faster in-band file transfers (sonic-net#1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants