Skip to content

[show] Issue in CLI output alignment with shorter alias names in intf naming mode "alias" #1397#1411

Merged
jleveque merged 1 commit intosonic-net:masterfrom
maulik-marvell:master
Feb 16, 2021
Merged

[show] Issue in CLI output alignment with shorter alias names in intf naming mode "alias" #1397#1411
jleveque merged 1 commit intosonic-net:masterfrom
maulik-marvell:master

Conversation

@maulik-marvell
Copy link
Contributor

@maulik-marvell maulik-marvell commented Feb 8, 2021

Fix #1397
- What I did
Added fix for Issue in CLI output alignment with shorter alias names in intf naming mode "alias"
- How I did it
Added code to remove last few extra characters from string (-------…) using Slicing & Positive Indexing in python, to match the width to alias's name(not interface)
- How to verify it
Steps to reproduce:
1. Change the naming mode to alias instead of port names
admin@sonic-svk169-dut:~$ config interface_naming_mode alias
2. Update config_db.json for port section to change alias to shorter names like below
3. Reload and run following command
- Previous command output (if the output of a command-line utility has changed)
For shorter alias names like P0, P1, etc..

admin@sonic-svk169-dut:~$ show interfaces  counters
    IFACE    STATE    RX_OK    RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR     TX_OK    TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR
    -----------  -------  -------  --------  ---------  --------  --------  --------  --------  --------  ---------  --------  --------  --------
      P0        X        0       N/A        N/A         0         0         0         0       N/A        N/A         0         0         0
     P4        X        0       N/A        N/A         0         0         0         0       N/A        N/A         0         0         0

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

For shorter alias names like P0, P1, etc..

admin@sonic-svk169-dut:~$ show interfaces  counters
IFACE    STATE    RX_OK    RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR     TX_OK    TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR
-------  -------  -------  --------  ---------  --------  --------  --------  --------  --------  ---------  --------  --------  --------
 P0        X        0       N/A        N/A         0         0         0         0       N/A        N/A         0         0         0
 P4        X        0       N/A        N/A         0         0         0         0       N/A        N/A         0         0         0
 P8        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0
P12        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0
P16        U        2       N/A        N/A         0         0         0     15889       N/A        N/A         0         0         0
P20        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0
P24        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0

For bigger alias names:

admin@sonic-svk169-dut:~$ show interfaces  counters
                   IFACE    STATE    RX_OK    RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR    TX_OK    TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR
------------------------  -------  -------  --------  ---------  --------  --------  --------  -------  --------  ---------  --------  --------  --------
P00000000000000000000000        X        0       N/A        N/A         0         0         0        0       N/A        N/A         0         0         0
       P0000000000000004        X        0       N/A        N/A         0         0         0        0       N/A        N/A         0         0         0
                      P8        U        2       N/A        N/A         0         0         0       16       N/A        N/A         0         0         0

     Fix for sonic-net#13

     **- What I did**
     Added fix

     **- How I did it**
     Added code to remove last few extra characters from string

     **- How to verify it**
    Steps to reproduce:
    1. Change the naming mode to alias instead of port names
        admin@sonic-svk169-dut:~$ config interface_naming_mode
    2. Update config_db.json for port section to change alias t
    3. Reload and run following command

     **- New command output

     With shorter alias names:
    admin@sonic-svk169-dut:~$ show interfaces  counters
    IFACE    STATE    RX_OK    RX_BPS    RX_UTIL    RX_ERR    R
    -------  -------  -------  --------  ---------  --------  -
      P0        X        0       N/A        N/A         0
     P4        X        0       N/A        N/A         0

    Signed-off-by: Maulik Patel <[email protected]>
@maulik-marvell
Copy link
Contributor Author

#1397

@maulik-marvell
Copy link
Contributor Author

retest this please

@prsunny
Copy link
Contributor

prsunny commented Feb 8, 2021

May be i'm missing, i don't see a difference b/w previous output and new output.. can you please highlight the diff?

@prsunny prsunny requested a review from jleveque February 8, 2021 18:47
@jleveque
Copy link
Contributor

jleveque commented Feb 8, 2021

May be i'm missing, i don't see a difference b/w previous output and new output.. can you please highlight the diff?

@maulik-innovium: Can you please format the command output using markdown code blocks (surround with three backticks)? This will use a monospaced font and allow us to see the differences better.

@maulik-marvell
Copy link
Contributor Author

May be i'm missing, i don't see a difference b/w previous output and new output.. can you please highlight the diff?

@maulik-innovium: Can you please format the command output using markdown code blocks (surround with three backticks)? This will use a monospaced font and allow us to see the differences better.

Thanks for the review, updated the command output using markdown code blocks.

@maulik-marvell
Copy link
Contributor Author

May be i'm missing, i don't see a difference b/w previous output and new output.. can you please highlight the diff?

Thanks for the review, updated the command output using markdown code blocks. Please note the extra ('---') characters under first column, which makes all the other column's data out of table alignment.

@jleveque
Copy link
Contributor

jleveque commented Feb 9, 2021

May be i'm missing, i don't see a difference b/w previous output and new output.. can you please highlight the diff?

Thanks for the review, updated the command output using markdown code blocks. Please note the extra ('---') characters under first column, which makes all the other column's data out of table alignment.

@maulik-innovium: Thanks. The command output is better now, but the alignment is messed up. Can you please fix?

@maulik-marvell
Copy link
Contributor Author

May be i'm missing, i don't see a difference b/w previous output and new output.. can you please highlight the diff?

Thanks for the review, updated the command output using markdown code blocks. Please note the extra ('---') characters under first column, which makes all the other column's data out of table alignment.

@maulik-innovium: Thanks. The command output is better now, but the alignment is messed up. Can you please fix?

Sorry, i am not sure which alignment is messed up. Can you please point that?
Pasting the new output again for reference:

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

For shorter alias names like P0, P1, etc..

admin@sonic-svk169-dut:~$ show interfaces  counters
IFACE    STATE    RX_OK    RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR     TX_OK    TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR
-------  -------  -------  --------  ---------  --------  --------  --------  --------  --------  ---------  --------  --------  --------
 P0        X        0       N/A        N/A         0         0         0         0       N/A        N/A         0         0         0
 P4        X        0       N/A        N/A         0         0         0         0       N/A        N/A         0         0         0
 P8        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0
P12        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0
P16        U        2       N/A        N/A         0         0         0     15889       N/A        N/A         0         0         0
P20        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0
P24        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0

For bigger alias names:

admin@sonic-svk169-dut:~$ show interfaces  counters
                   IFACE    STATE    RX_OK    RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR    TX_OK    TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR
------------------------  -------  -------  --------  ---------  --------  --------  --------  -------  --------  ---------  --------  --------  --------
P00000000000000000000000        X        0       N/A        N/A         0         0         0        0       N/A        N/A         0         0         0
       P0000000000000004        X        0       N/A        N/A         0         0         0        0       N/A        N/A         0         0         0
                      P8        U        2       N/A        N/A         0         0         0       16       N/A        N/A         0         0         0

@maulik-marvell
Copy link
Contributor Author

May be i'm missing, i don't see a difference b/w previous output and new output.. can you please highlight the diff?

Thanks for the review, updated the command output using markdown code blocks. Please note the extra ('---') characters under first column, which makes all the other column's data out of table alignment.

@maulik-innovium: Thanks. The command output is better now, but the alignment is messed up. Can you please fix?

Sorry, i am not sure which alignment is messed up. Can you please point that?
Pasting the new output again for reference:

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

For shorter alias names like P0, P1, etc..

admin@sonic-svk169-dut:~$ show interfaces  counters
IFACE    STATE    RX_OK    RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR     TX_OK    TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR
-------  -------  -------  --------  ---------  --------  --------  --------  --------  --------  ---------  --------  --------  --------
 P0        X        0       N/A        N/A         0         0         0         0       N/A        N/A         0         0         0
 P4        X        0       N/A        N/A         0         0         0         0       N/A        N/A         0         0         0
 P8        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0
P12        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0
P16        U        2       N/A        N/A         0         0         0     15889       N/A        N/A         0         0         0
P20        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0
P24        U        2       N/A        N/A         0         0         0     15890       N/A        N/A         0         0         0

For bigger alias names:

admin@sonic-svk169-dut:~$ show interfaces  counters
                   IFACE    STATE    RX_OK    RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR    TX_OK    TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR
------------------------  -------  -------  --------  ---------  --------  --------  --------  -------  --------  ---------  --------  --------  --------
P00000000000000000000000        X        0       N/A        N/A         0         0         0        0       N/A        N/A         0         0         0
       P0000000000000004        X        0       N/A        N/A         0         0         0        0       N/A        N/A         0         0         0
                      P8        U        2       N/A        N/A         0         0         0       16       N/A        N/A         0         0         0

The minor alignment mismatch could be because of the way i copied it from console and pasting it here.

@jleveque
Copy link
Contributor

Retest this please

@maulik-marvell
Copy link
Contributor Author

Retest this please

build is fine, can you please help merge this?

@jleveque
Copy link
Contributor

Retest this please

build is fine, can you please help merge this?

That comment wasn't directed at you. It is a special phrase to re-run our Jenkins-based check builds. We do not merge pull requests unless all check builds pass.

@jleveque jleveque merged commit 327b292 into sonic-net:master Feb 16, 2021
@jleveque jleveque changed the title [show ] Issue in CLI output alignment with shorter alias names in intf naming mode "alias" #1397 [show] Issue in CLI output alignment with shorter alias names in intf naming mode "alias" #1397 Feb 16, 2021
daall pushed a commit that referenced this pull request Feb 16, 2021
… naming mode "alias" #1397 (#1411)

#### What I did
Added fix for Issue in CLI output alignment with shorter alias names in intf naming mode "alias"

#### How I did it
Added code to remove last few extra characters from string (-------…) using Slicing & Positive Indexing in python, to match the width to alias's name(not interface)
anand-kumar-subramanian pushed a commit to anand-kumar-subramanian/sonic-utilities that referenced this pull request Mar 2, 2021
… naming mode "alias" sonic-net#1397 (sonic-net#1411)

#### What I did
Added fix for Issue in CLI output alignment with shorter alias names in intf naming mode "alias"

#### How I did it
Added code to remove last few extra characters from string (-------…) using Slicing & Positive Indexing in python, to match the width to alias's name(not interface)
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.

Issue in CLI output alignment with shorter alias names in intf naming mode "alias"

3 participants