Skip to content

sonic-utilities: Format show vlan config output#210

Merged
lguohan merged 1 commit intosonic-net:masterfrom
didi:master
Mar 2, 2018
Merged

sonic-utilities: Format show vlan config output#210
lguohan merged 1 commit intosonic-net:masterfrom
didi:master

Conversation

@richard28530
Copy link
Contributor

@richard28530 richard28530 commented Feb 26, 2018

  • Format the output of show vlan config

Signed-off-by: chenhu chenhu@didichuxing.com

Format the output of show clan config when multiple interfaces in vlan
iterate the vlan config to generate the table first, then print it

before the modification

show vlan config
Name       VID  Member                                                                                                                          Mode
-------  -----  ------------------------------------------------------------------------------------------------------------------------------  ------------------------------------------------------------------------------------
Vlan2        2  Ethernet4
Ethernet88
Ethernet92
Ethernet96
Ethernet100
Ethernet104
Ethernet108
Ethernet112
Ethernet116
Ethernet120
Ethernet124  untagged
untagged
untagged
untagged
untagged
untagged
untagged
?
untagged
?
untagged
Vlan100    100  Ethernet88                                                                                                                      tagged
Vlan11      11  Ethernet4
Ethernet8                                                                                                             ?
?
Vlan3        3  PortChannel02                                                                                                                   tagged

after the modification

show vlan config
Name       VID  Member         Mode
-------  -----  -------------  --------
Vlan2        2  Ethernet4      untagged
Vlan2        2  Ethernet88     untagged
Vlan2        2  Ethernet92     untagged
Vlan2        2  Ethernet96     untagged
Vlan2        2  Ethernet100    untagged
Vlan2        2  Ethernet104    untagged
Vlan2        2  Ethernet108    untagged
Vlan2        2  Ethernet112    ?
Vlan2        2  Ethernet116    untagged
Vlan2        2  Ethernet120    ?
Vlan2        2  Ethernet124    untagged
Vlan100    100  Ethernet88     tagged
Vlan11      11  Ethernet4      ?
Vlan11      11  Ethernet8      ?
Vlan3        3  PortChannel02  tagged

* Format the output of show vlan config

Signed-off-by: chenhu <chenhu@didichuxing.com>
@msftclas
Copy link

msftclas commented Feb 26, 2018

CLA assistant check
All CLA requirements met.

@lguohan lguohan merged commit 924dd38 into sonic-net:master Mar 2, 2018
zhenggen-xu added a commit to zhenggen-xu/sonic-utilities that referenced this pull request Jun 6, 2018
            RB=1288101
            G=lnos-reviewers
            R=ntrianta,pmao,rmolina,sfardeen,zxu

* github:
  [acl_loader] Support Service ACL binding to multiple services (sonic-net#236)
  [show] Rename 'show session' to 'show mirror session' (sonic-net#235)
  [pfcstat]: create python cli tool to show pfc counters (sonic-net#233)
  [queuestat] add python CLI tool to show queue counters
  [acl-loader] Not to crash upon invalid rule (sonic-net#232)
  Show FDB type in fdbshow/show mac (sonic-net#231)
  [show] add 'show runningconfiguration all' subcommand (sonic-net#230)
  [reboot scripts] remove -t option in docker exec commands (sonic-net#228)
  [reboot] reduce stop service to only stop syncd (sonic-net#223)
  [crm]: Fix failures in CLI show commands (sonic-net#221)
  [Fast-reboot]: Gracefully shutdown syncd in fast-reboot (sonic-net#212)
  add fast-reboot support for nephos platform by stop kernel modules (sonic-net#220)
  [config bgp] Convert user input ipv6 addr to lower case before comparing (sonic-net#218)
  [PFCWD]: set default configuration when enabled by default (sonic-net#213)
  Add fast-reboot support for Aboot based images (sonic-net#214)
  sonic-utilities: Format show vlan config output (sonic-net#210)
  [AAA] Support login(ascii) authentication type (sonic-net#217)
  [sfputil] Adapt new way of getting PLATFORM(sonic-net#216)
  [Fast-Reboot]: Adapt fast-reboot-dump script for SAIv1.2  (sonic-net#211)
  Refactor fast-reboot script. Generate fast-reboot-dumps into configurable directory (sonic-net#208)
  Find correct opennsl module name before stopping it (sonic-net#207)
  [crm]: Add utility for CRM configuration (sonic-net#187)
  [reboot] update reboot script to retrieve platform with new format (sonic-net#206)
  Adapt to config engine change to load platform info properly (sonic-net#205)
  [config] Add qos clear and qos reload support (sonic-net#204)
  Dump default routes from APPL_DB table before fast-reboot (sonic-net#203)
  [acl_loader] Fix a crash issue when appdb is not consistent with cfgdb (sonic-net#202)
  [pfcwd]: add command to set pfcwd polling interval (sonic-net#192)
  [acl-loader] Prevent from hanging if run by non-root user (sonic-net#199)
  [config] Store ConfigDB init indicator boolean value as 1/0 in Redis to be language-agnostic (sonic-net#197)
  Get Vlan Id from SAI Vlan Object if bvid present (sonic-net#196)
  [TACACS+]: Fix aaa show error without configuration (sonic-net#191)
  'config bgp [shutdown|startup] neighbor <hostname>' now affects all sessions for neighbor (sonic-net#195)
  [sonic-clear] add a clear fdb command (sonic-net#186)
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
20e1589 [Mellanox] [201911] backport kernel patches for hw-management 7.0100.2303 (sonic-net#210)
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Aug 9, 2025
…onic-net#210)

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

 failure_prs.log skip_prs.log 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
This change is to fix sonic-net/sonic-buildimage#22120 "Bug: [db_migrator] parse_xml fails when minigraph has SonicQosProfile".

If there is `SonicQosProfile` in minigraph.xml, parse_xml fails with below error:
```
2025 Jul 14 06:49:23.590302 vlab-01 ERR db_migrator: Caught exception while trying to parse minigraph: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
```
It's because select_mmu_profiles needs platform.
https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-config-engine/minigraph.py#L1925

#### How I did it
This change added code in db_migrator.py to get platform info. While calling `parse_xml`, pass in the `platform` argument.

#### How to verify it
Add SonicQosProfile to minigraph:
```
 <a:DeviceProperty>
 <a:Name>SonicQosProfile</a:Name>
 <a:Reference i:nil="true"/>
 <a:Value>Balanced</a:Value>
 </a:DeviceProperty>
```

Run `db_migrator.py -o migrate`. Check syslog, migration passed without exception.

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

#### New command output (if the output of a command-line utility has changed)
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.

4 participants