Skip to content

[action] [PR:4448] Show vnet route cli update on 202511#313

Merged
mssonicbld merged 1 commit into
Azure:202506from
mssonicbld:cherry/msft-202506/4448
Apr 17, 2026
Merged

[action] [PR:4448] Show vnet route cli update on 202511#313
mssonicbld merged 1 commit into
Azure:202506from
mssonicbld:cherry/msft-202506/4448

Conversation

@mssonicbld

Copy link
Copy Markdown
Collaborator

What I did

It is a manually cherry-pick from sonic-net/sonic-utilities#4332

Updating the show vnet cli:
1. showing new filed "metric" in show vnet route all/tunnel
2. added <vnet_name> for specific vnet name on vnet show route all/local/tunnel commands

How I did it

  1. added metric field in show vnet route
  2. changed show vnet show route all/tunnel, and added vnet show route local
  3. updated command reference document
  4. Added mock test cases and related unit tests

How to verify it

added unit tests and passed.
image

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

>show vnet routes all

vnet name        prefix            nexthop                                interface
---------------  ----------------  -------------------------------------  -------------------------------
test_v4_in_v4-0  160.162.191.1/32  100.100.4.1                            Ethernet1
test_v4_in_v4-0  160.163.191.1/32  100.101.4.1, 100.101.4.2               Ethernet1, Ethernet2
test_v4_in_v4-0  160.164.191.1/32  100.102.4.1, 100.102.4.2, 100.102.4.3  Ethernet1, Ethernet2, Ethernet3
test_v4_in_v4-1  160.165.191.1/32  100.103.4.1, 100.103.4.2, 100.103.4.3  Ethernet1, Ethernet2, Ethernet3

vnet name        prefix                    endpoint                                     mac address    vni    status
---------------  ------------------------  -------------------------------------------  -------------  -----  --------
Vnet_v6_in_v6-0  fddd:a156:a251::a6:1/128  fddd:a100:a251::a10:1,fddd:a101:a251::a10:1                        active
                                           fddd:a102:a251::a10:1,fddd:a103:a251::a10:1
test_v4_in_v4-0  160.162.191.1/32          100.251.7.1                                                        active
test_v4_in_v4-0  160.163.191.1/32          100.251.7.1                                                        active
test_v4_in_v4-0  160.164.191.1/32          100.251.7.1

>show vnet routes tunnel

vnet name        prefix                    endpoint                                                                                 mac address    vni
---------------  ------------------------  ---------------------------------------------------------------------------------------  -------------  -----
Vnet_v6_in_v6-0  fddd:a156:a251::a6:1/128  fddd:a100:a251::a10:1,fddd:a101:a251::a10:1,fddd:a102:a251::a10:1,fddd:a103:a251::a10:1
test_v4_in_v4-0  160.162.191.1/32          100.251.7.1
test_v4_in_v4-0  160.163.191.1/32          100.251.7.1
test_v4_in_v4-0  160.164.191.1/32          100.251.7.1

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

>show vnet routes all

vnet name        prefix            nexthop                                interface
---------------  ----------------  -------------------------------------  -------------------------------
test_v4_in_v4-0  160.162.191.1/32  100.100.4.1                            Ethernet1
test_v4_in_v4-0  160.163.191.1/32  100.101.4.1, 100.101.4.2               Ethernet1, Ethernet2
test_v4_in_v4-0  160.164.191.1/32  100.102.4.1, 100.102.4.2, 100.102.4.3  Ethernet1, Ethernet2, Ethernet3
test_v4_in_v4-1  160.165.191.1/32  100.103.4.1, 100.103.4.2, 100.103.4.3  Ethernet1, Ethernet2, Ethernet3

vnet name        prefix                    endpoint                                     mac address    vni    metric    status
---------------  ------------------------  -------------------------------------------  -------------  -----  --------  --------
Vnet_v6_in_v6-0  fddd:a156:a251::a6:1/128  fddd:a100:a251::a10:1,fddd:a101:a251::a10:1                                  active
                                           fddd:a102:a251::a10:1,fddd:a103:a251::a10:1
test_v4_in_v4-0  160.162.191.1/32          100.251.7.1                                                                  active
test_v4_in_v4-0  160.163.191.1/32          100.251.7.1                                                        0         active
test_v4_in_v4-0  160.164.191.1/32          100.251.7.1

>show vnet routes all test_v4_in_v4-0

vnet name        prefix            nexthop                                interface
---------------  ----------------  -------------------------------------  -------------------------------
test_v4_in_v4-0  160.162.191.1/32  100.100.4.1                            Ethernet1
test_v4_in_v4-0  160.163.191.1/32  100.101.4.1, 100.101.4.2               Ethernet1, Ethernet2
test_v4_in_v4-0  160.164.191.1/32  100.102.4.1, 100.102.4.2, 100.102.4.3  Ethernet1, Ethernet2, Ethernet3

vnet name        prefix            endpoint     mac address    vni      metric  status
---------------  ----------------  -----------  -------------  -----  --------  --------
test_v4_in_v4-0  160.162.191.1/32  100.251.7.1                                  active
test_v4_in_v4-0  160.163.191.1/32  100.251.7.1                               0  active
test_v4_in_v4-0  160.164.191.1/32  100.251.7.1

> show vnet routes tunnel

vnet name        prefix                    endpoint                                     mac address    vni    metric    status
---------------  ------------------------  -------------------------------------------  -------------  -----  --------  --------
Vnet_v6_in_v6-0  fddd:a156:a251::a6:1/128  fddd:a100:a251::a10:1,fddd:a101:a251::a10:1                                  active
                                           fddd:a102:a251::a10:1,fddd:a103:a251::a10:1
test_v4_in_v4-0  160.162.191.1/32          100.251.7.1                                                                  active
test_v4_in_v4-0  160.163.191.1/32          100.251.7.1                                                        0         active
test_v4_in_v4-0  160.164.191.1/32          100.251.7.1

>show vnet routes tunnel test_v4_in_v4-0

vnet name        prefix            endpoint     mac address    vni      metric  status
---------------  ----------------  -----------  -------------  -----  --------  --------
test_v4_in_v4-0  160.162.191.1/32  100.251.7.1                                  active
test_v4_in_v4-0  160.163.191.1/32  100.251.7.1                               0  active
test_v4_in_v4-0  160.164.191.1/32  100.251.7.1

>show vnet routes local

vnet name        prefix            nexthop                                interface
---------------  ----------------  -------------------------------------  -------------------------------
test_v4_in_v4-0  160.162.191.1/32  100.100.4.1                            Ethernet1
test_v4_in_v4-0  160.163.191.1/32  100.101.4.1, 100.101.4.2               Ethernet1, Ethernet2
test_v4_in_v4-0  160.164.191.1/32  100.102.4.1, 100.102.4.2, 100.102.4.3  Ethernet1, Ethernet2, Ethernet3
test_v4_in_v4-1  160.165.191.1/32  100.103.4.1, 100.103.4.2, 100.103.4.3  Ethernet1, Ethernet2, Ethernet3

>show vnet routes local test_v4_in_v4-0

vnet name        prefix            nexthop                                interface
---------------  ----------------  -------------------------------------  -------------------------------
test_v4_in_v4-0  160.162.191.1/32  100.100.4.1                            Ethernet1
test_v4_in_v4-0  160.163.191.1/32  100.101.4.1, 100.101.4.2               Ethernet1, Ethernet2
test_v4_in_v4-0  160.164.191.1/32  100.102.4.1, 100.102.4.2, 100.102.4.3  Ethernet1, Ethernet2, Ethernet3

Signed-off-by: Sonic Build Admin sonicbld@microsoft.com

<!--
    Please make sure you've read and understood our contributing guidelines:
    https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

    ** Make sure all your commits include a signature generated with `git commit -s` **

    If this is a bug fix, make sure your description includes "closes #xxxx",
    "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
    issue when the PR is merged.

    If you are adding/modifying/removing any command or utility script, please also
    make sure to add/modify/remove any unit tests from the tests
    directory as appropriate.

    If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
    subcommand, or you are adding a new subcommand, please make sure you also
    update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
    your changes.

    Please provide the following information:
-->

#### What I did
It is a manually cherry-pick from sonic-net/sonic-utilities#4332

Updating the show vnet cli:
    1. showing new filed "metric" in show vnet route all/tunnel
    2. added <vnet_name> for specific vnet name on vnet show route all/local/tunnel commands

#### How I did it
1. added metric field in show vnet route
2. changed show vnet show route all/tunnel, and added vnet show route local
3. updated command reference document
4. Added mock test cases and related unit tests
#### How to verify it
added unit tests and passed.
<img width="1716" height="422" alt="image" src="https://github.com/user-attachments/assets/a6a5352c-c1e7-4ed3-9081-197ec5412d04" />

#### Previous command output (if the output of a command-line utility has changed)
\>show vnet routes all
```
vnet name        prefix            nexthop                                interface
---------------  ----------------  -------------------------------------  -------------------------------
test_v4_in_v4-0  160.162.191.1/32  100.100.4.1                            Ethernet1
test_v4_in_v4-0  160.163.191.1/32  100.101.4.1, 100.101.4.2               Ethernet1, Ethernet2
test_v4_in_v4-0  160.164.191.1/32  100.102.4.1, 100.102.4.2, 100.102.4.3  Ethernet1, Ethernet2, Ethernet3
test_v4_in_v4-1  160.165.191.1/32  100.103.4.1, 100.103.4.2, 100.103.4.3  Ethernet1, Ethernet2, Ethernet3

vnet name        prefix                    endpoint                                     mac address    vni    status
---------------  ------------------------  -------------------------------------------  -------------  -----  --------
Vnet_v6_in_v6-0  fddd:a156:a251::a6:1/128  fddd:a100:a251::a10:1,fddd:a101:a251::a10:1                        active
                                           fddd:a102:a251::a10:1,fddd:a103:a251::a10:1
test_v4_in_v4-0  160.162.191.1/32          100.251.7.1                                                        active
test_v4_in_v4-0  160.163.191.1/32          100.251.7.1                                                        active
test_v4_in_v4-0  160.164.191.1/32          100.251.7.1
```
\>show vnet routes tunnel
```
vnet name        prefix                    endpoint                                                                                 mac address    vni
---------------  ------------------------  ---------------------------------------------------------------------------------------  -------------  -----
Vnet_v6_in_v6-0  fddd:a156:a251::a6:1/128  fddd:a100:a251::a10:1,fddd:a101:a251::a10:1,fddd:a102:a251::a10:1,fddd:a103:a251::a10:1
test_v4_in_v4-0  160.162.191.1/32          100.251.7.1
test_v4_in_v4-0  160.163.191.1/32          100.251.7.1
test_v4_in_v4-0  160.164.191.1/32          100.251.7.1
```
#### New command output (if the output of a command-line utility has changed)
\>show vnet routes all
```
vnet name        prefix            nexthop                                interface
---------------  ----------------  -------------------------------------  -------------------------------
test_v4_in_v4-0  160.162.191.1/32  100.100.4.1                            Ethernet1
test_v4_in_v4-0  160.163.191.1/32  100.101.4.1, 100.101.4.2               Ethernet1, Ethernet2
test_v4_in_v4-0  160.164.191.1/32  100.102.4.1, 100.102.4.2, 100.102.4.3  Ethernet1, Ethernet2, Ethernet3
test_v4_in_v4-1  160.165.191.1/32  100.103.4.1, 100.103.4.2, 100.103.4.3  Ethernet1, Ethernet2, Ethernet3

vnet name        prefix                    endpoint                                     mac address    vni    metric    status
---------------  ------------------------  -------------------------------------------  -------------  -----  --------  --------
Vnet_v6_in_v6-0  fddd:a156:a251::a6:1/128  fddd:a100:a251::a10:1,fddd:a101:a251::a10:1                                  active
                                           fddd:a102:a251::a10:1,fddd:a103:a251::a10:1
test_v4_in_v4-0  160.162.191.1/32          100.251.7.1                                                                  active
test_v4_in_v4-0  160.163.191.1/32          100.251.7.1                                                        0         active
test_v4_in_v4-0  160.164.191.1/32          100.251.7.1
```
\>show vnet routes all test_v4_in_v4-0
```
vnet name        prefix            nexthop                                interface
---------------  ----------------  -------------------------------------  -------------------------------
test_v4_in_v4-0  160.162.191.1/32  100.100.4.1                            Ethernet1
test_v4_in_v4-0  160.163.191.1/32  100.101.4.1, 100.101.4.2               Ethernet1, Ethernet2
test_v4_in_v4-0  160.164.191.1/32  100.102.4.1, 100.102.4.2, 100.102.4.3  Ethernet1, Ethernet2, Ethernet3

vnet name        prefix            endpoint     mac address    vni      metric  status
---------------  ----------------  -----------  -------------  -----  --------  --------
test_v4_in_v4-0  160.162.191.1/32  100.251.7.1                                  active
test_v4_in_v4-0  160.163.191.1/32  100.251.7.1                               0  active
test_v4_in_v4-0  160.164.191.1/32  100.251.7.1
```
\> show vnet routes tunnel
```
vnet name        prefix                    endpoint                                     mac address    vni    metric    status
---------------  ------------------------  -------------------------------------------  -------------  -----  --------  --------
Vnet_v6_in_v6-0  fddd:a156:a251::a6:1/128  fddd:a100:a251::a10:1,fddd:a101:a251::a10:1                                  active
                                           fddd:a102:a251::a10:1,fddd:a103:a251::a10:1
test_v4_in_v4-0  160.162.191.1/32          100.251.7.1                                                                  active
test_v4_in_v4-0  160.163.191.1/32          100.251.7.1                                                        0         active
test_v4_in_v4-0  160.164.191.1/32          100.251.7.1
```
\>show vnet routes tunnel test_v4_in_v4-0
```
vnet name        prefix            endpoint     mac address    vni      metric  status
---------------  ----------------  -----------  -------------  -----  --------  --------
test_v4_in_v4-0  160.162.191.1/32  100.251.7.1                                  active
test_v4_in_v4-0  160.163.191.1/32  100.251.7.1                               0  active
test_v4_in_v4-0  160.164.191.1/32  100.251.7.1
```
\>show vnet routes local
```
vnet name        prefix            nexthop                                interface
---------------  ----------------  -------------------------------------  -------------------------------
test_v4_in_v4-0  160.162.191.1/32  100.100.4.1                            Ethernet1
test_v4_in_v4-0  160.163.191.1/32  100.101.4.1, 100.101.4.2               Ethernet1, Ethernet2
test_v4_in_v4-0  160.164.191.1/32  100.102.4.1, 100.102.4.2, 100.102.4.3  Ethernet1, Ethernet2, Ethernet3
test_v4_in_v4-1  160.165.191.1/32  100.103.4.1, 100.103.4.2, 100.103.4.3  Ethernet1, Ethernet2, Ethernet3
```
\>show vnet routes local test_v4_in_v4-0
```
vnet name        prefix            nexthop                                interface
---------------  ----------------  -------------------------------------  -------------------------------
test_v4_in_v4-0  160.162.191.1/32  100.100.4.1                            Ethernet1
test_v4_in_v4-0  160.163.191.1/32  100.101.4.1, 100.101.4.2               Ethernet1, Ethernet2
test_v4_in_v4-0  160.164.191.1/32  100.102.4.1, 100.102.4.2, 100.102.4.3  Ethernet1, Ethernet2, Ethernet3
```

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator Author

Original PR: sonic-net/sonic-utilities#4448

@mssonicbld

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mssonicbld mssonicbld merged commit c843bc4 into Azure:202506 Apr 17, 2026
4 checks passed
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.

1 participant