sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
736 stars 1.42k forks source link

[multi-asic] [CLI] multi_asic_namespace_validation_callback not working properly #13560

Open wenyiz2021 opened 1 year ago

wenyiz2021 commented 1 year ago

Description

def multi_asic_namespace_validation_callback(ctx, param, value):
    # TODO: this condition has a bug: it should be either "multi_asic.is_multi_asic()"
    # or "self.is_multi_asic", but changing it to correct version will lead to the 
    # following cli not working on single-asic:
    # show ip(v6) bgp neighbors/network, show storm_control add/del
    # e.g. 
    # admin@str2-7050cx3-acs-02:/usr$ show ip bgp neighbor -n asic0
    # -n/--namespace is not available for single asic
    # Aborted!
    # admin@str2-7050cx3-acs-02:/usr$ show ip bgp neighbor
    # -n/--namespace is not available for single asic
    # Aborted!
    if not multi_asic.is_multi_asic:
        click.echo("-n/--namespace is not available for single asic")
        ctx.abort()
    return value

Steps to reproduce the issue:

1. 2. 3.

Describe the results you received:

Describe the results you expected:

Output of show version:

(paste your output here)

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

wenyiz2021 commented 1 year ago

This is a simple fix but require multiple UT changes

wenyiz2021 commented 1 year ago

https://github.com/sonic-net/sonic-utilities/pull/2429