sonic-utilities icon indicating copy to clipboard operation
sonic-utilities copied to clipboard

Switch Port Modes and VLAN CLI Enhancement

Open MuhammadUmarAsad opened this issue 2 years ago • 13 comments

What I did

  • Modified "/config/vlan.py" to add support for multiple vids, range of vids in vlan add|del and vlan member add|del

  • Creation of "/config/switchport.py" which will deal with port modes for interfaces i.e. access, trunk and routed

  • Modified the show interface status command so that it shows the status of port being access or trunk. Before this, it did not show the port status being access mode.

  • Modified Command-Reference.md to add new commands in it with usage and examples

  • Added new utility functions in "/utilities_common/cli.py" to use in vlan.py and switchport.py commands

  • Modified "/scripts/intfutil" to change the behaviour of Vlan to Mode so it will show correct port mode

  • Modified test cases and added new test cases for the new commands

How I did it

  • Added new commands and modified the existing commands in "/config/vlan.py" to

    • accept multiple vids
    • accept range of vids
    • except_flag and all option in vlan member command
  • Creation of "/config/switchport.py" file to add commands which will deal with port modes i.e. access, trunk or routed which we were unable to define or assign in SONiC before

  • New utility functions in "/utilities_common/cli.py"

  • Changes in "/scripts/intfutil" and modified the existing function. Now it will display if an interface is in access or trunk or routed mode.

How to verify it

New commands have been added in Command-Reference.md All the syntax and examples have been added there and they can be verified by running the specific command

Signed-off-by: Muhammad Umar Asad [email protected] [ xFlow Research Inc. ]

MuhammadUmarAsad avatar Oct 01 '22 19:10 MuhammadUmarAsad

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: MuhammadUmarAsad / name: RoRonoa (330b10101cdb1cd9d5939cc766db4a7627ff52fb, d4ba1637934c2b22c645a9bdbfe5a25b489c0958, 0ddb795d350b5e84ebb9901cc9b25005c46fc65a, 6b3ac13450bda06b310636fbeb14169aa5cdb859, 930630c7b39f4fdf1611b8de307ef21341de0374, fa5d75625e9b6c01ad445bae22cbc20fd3ee6b65, 02b1e8a540c97e737f171d73105520eabd672ecc, cd13da3eeec064191f438ede38a88fb71de4ab89, 519324d44766f92f9082a858cf06dbd67ecf70eb, 0ca0d2430183268ea51a808a3a20ed4b6215cab3, 5fea7b873dd3fe47b36fd565718cc0d210dc65fd, 2fd4c0975ad9d9baa6eb99ce9708952581fad4b3, 22888f10fece03f95f5de69235deed91e09bac5f, 99609dd6f8b0c778fbc6f8856c92fc7b6326c20a, 4176fecea50851a888bc14a7588157e0f3471dbf, b4e46dbdea95eb5698f52122f24d05c0c9acdcf4, 6ea60252fe7c3d27e27878c297b2c502565789a6, a007d208d2440ed250b6f55a848292b697958f4e, d77508f7de0c5b2767e14dda164c2b68a113b66a, d64ddd66571c61106abac4412f0b16f29ec97cac, 5a18655d9bfb5008fe298d4cf890382a9036d29a, 499b6d5297dfd014ca1250effc17e73b22949788, 63e28aa27ab4a36bdc1ea8b343eb71d76821ed5e, b4197b97f38062c5bff87b696e2e4459b96bbdd3, 0df0f3472924f6ed1f7551a9a82bf9a8ab0d9451, 8bc54930cee485445e44beabc03072b09690c7d4, 046fc2ed7f9476d9e4d42d68f0605c397490b2e0, 92f8a2cd6e9103fa18dcfafffc4fd09e3c0610a2, dd4828a2dc69d964fe21e7b53e96e3ec122c9b9c, 478a3a63b6159f69a0060041b09b0c5bdbac5384, c5a1ea15497a12c9fcc672dde0db3854ac24fd6e, 9547b956bf6df106e75186512b8432d1dcfee66f, f7bc359740d8cea49c3790a38aeea13b95b00887, d85642572c073685023fb5e525848564911ea044, 6861d631de350b12e8eac86440dcbecc4aba59fe, 14586102eecab19fe657ae0100d6da0691787746, ae002972832c2a4837b0667f74df3dc74630869c, 5ccc73b646f216af2bb5f19292b1a26bcb920e2e, ddabf32bf8d148c65e32e2e7c7d4741a2236dbc0, 94111966d0ce73153e454fc5e4fc884dd005dbdf, c3fab6d89cc1ec32695e30fa2e774555f282a95a, da65f41c6cabd45f0c7f83a8b58a56a3332864c3, 4c03ff15675e4e78a5f462a04cfb5bf5522aaaaf, e347a61153da646609330f6e60984134326db9fe, 43d7b053bf09d6f225324dfdb326c1e528dea563, 55dbfb39caa61fd44d508768ad04b40e12a0e004, f4b130caf79736dee9d885048978b3891a70c327, e98047193748b3eeaab554e74e6c4debb4ee9740, 1836cd8130a33828d34d6788065ffb2c9f83ecde, 7998123b42d0ebd9bae5d3cf2cdc35a0ab3f2ff0, 485b4c8c65ad5ddcdb264162030179c09656771f, 22731031b93e4a1176de3cd86d0c0bc46ce48301, ba7b72d064c9554118dea209e6973169e445246d, 57f1c993e69d65f897c07a6a72f209979fd22b8c, 70cbfe516aaf72ddbcfa075b42abb3457f58b27a, ebc14ca12c4391fa0cbec3475f4c08b3c5fd82a1, 5b1063cc9c74b5320a2aec5a4adbd41def4b66b7, 3faca88fe3d0e9eaea41aec1b6418d36ed3f4306, 7177585346dc695fa518c772353738edf770f6d2, 2672a99612ee546511e3c46c51931ba69985402a, f87a7e78e4ef56efdcf5b39120a6d13d4317818c, 7ccb8170905164a50554e5181b58f6497bd4bb60, 43a5e1798a0a93ea029d317d49d68274af15483d, 76b4f810237666d54dad2966c486589560e022a8, a70fd531fc82f649defc089d7023d092fdad3484, cba8e2e9e2315a0fcffbfcd75def0c078d94628f, dd11b3cd01ed57afcd84a638f28f46357ea026f1, 300b353bc3d2ae21083a8703dacbfe41da7c7bcd, 95912ba202881780e9d1ba66c78f2d4dddc50b24, f63f96091f385dae98094e88e3006ed5d8c7a835, 7b7fd960403f29fe3e17b924c3168dcfd90b160d, 6d67b531e5be5404ee8d4fe7a5d5714673ab7839)

This pull request introduces 2 alerts when merging 6b3ac13450bda06b310636fbeb14169aa5cdb859 into abd5eba492bdfa35c931738070ef60398a4460dc - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'
  • 1 for Unused import

lgtm-com[bot] avatar Oct 14 '22 12:10 lgtm-com[bot]

This pull request introduces 2 alerts when merging 45fe3b8868a6e1e4ded919a55ced0f97e2c634ce into abd5eba492bdfa35c931738070ef60398a4460dc - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'
  • 1 for Unused import

lgtm-com[bot] avatar Oct 14 '22 12:10 lgtm-com[bot]

This pull request introduces 2 alerts when merging 7fe882bc50a905d90ed37c626435430fa0d16c96 into abd5eba492bdfa35c931738070ef60398a4460dc - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'
  • 1 for Unused import

lgtm-com[bot] avatar Oct 14 '22 13:10 lgtm-com[bot]

This pull request introduces 3 alerts when merging 1d9daf105e6dc6966a0446aa03f32c1c6283bc6e into aedc05ecf23d72fd28ed05dee0d082c307a888d0 - view on LGTM.com

new alerts:

  • 3 for Unused import

lgtm-com[bot] avatar Oct 20 '22 14:10 lgtm-com[bot]

This pull request introduces 2 alerts when merging fb2921d351fad3666c25fb728a814015a724a401 into aedc05ecf23d72fd28ed05dee0d082c307a888d0 - view on LGTM.com

new alerts:

  • 2 for Unused import

lgtm-com[bot] avatar Oct 20 '22 21:10 lgtm-com[bot]

This pull request introduces 4 alerts when merging 15587ab5cb5ff525815f13ff170483b83639ed59 into aedc05ecf23d72fd28ed05dee0d082c307a888d0 - view on LGTM.com

new alerts:

  • 2 for Unused local variable
  • 2 for Unused import

lgtm-com[bot] avatar Oct 21 '22 12:10 lgtm-com[bot]

This pull request introduces 4 alerts when merging 4e660a21223b04cde0e9636f8f3310202780591d into aedc05ecf23d72fd28ed05dee0d082c307a888d0 - view on LGTM.com

new alerts:

  • 2 for Unused local variable
  • 2 for Unused import

lgtm-com[bot] avatar Oct 21 '22 12:10 lgtm-com[bot]

This pull request introduces 5 alerts when merging a50778613459798dc7c042dd736207f4b3122a19 into aedc05ecf23d72fd28ed05dee0d082c307a888d0 - view on LGTM.com

new alerts:

  • 2 for Unused local variable
  • 2 for Unused import
  • 1 for Variable defined multiple times

lgtm-com[bot] avatar Oct 21 '22 14:10 lgtm-com[bot]

This pull request introduces 5 alerts when merging 5cf9b60e67718cd5ddfc338430da843e84cd43ed into aedc05ecf23d72fd28ed05dee0d082c307a888d0 - view on LGTM.com

new alerts:

  • 2 for Unused local variable
  • 2 for Unused import
  • 1 for Variable defined multiple times

lgtm-com[bot] avatar Oct 21 '22 14:10 lgtm-com[bot]

This pull request introduces 5 alerts when merging 63086abcb7499ea598780d689d3bdd84fd90c992 into aedc05ecf23d72fd28ed05dee0d082c307a888d0 - view on LGTM.com

new alerts:

  • 2 for Unused local variable
  • 2 for Unused import
  • 1 for Variable defined multiple times

lgtm-com[bot] avatar Oct 21 '22 15:10 lgtm-com[bot]

We have modified our code along with HLD. Suggestions have been incorporated. @venkatmahalingam pls review.

ridahanif96 avatar Oct 28 '22 19:10 ridahanif96

@venkatmahalingam can you please help to review this PR? Thanks.

zhangyanzhao avatar Nov 11 '22 23:11 zhangyanzhao

@venkatmahalingam can you please help to approve this PR if you are ok? Thanks.

zhangyanzhao avatar Jan 17 '23 19:01 zhangyanzhao

@venkatmahalingam can you please help to approve this PR if you are ok? Thanks.

@zhangyanzhao I have added @prsunny @dgsudharsan for HLD review, once they approved the HLD, we can revisit if required and merge the PR.

venkatmahalingam avatar Jan 19 '23 20:01 venkatmahalingam

add @dprital as reviewer.

zhangyanzhao avatar Feb 10 '23 22:02 zhangyanzhao

you should not modify the existing output of the "show interface status" command. You should work on a new show command that displays the switchport mode. reason is there are many applications already depended on parsing on the existing show interface status output and your change will break all those applications, parsers, and testcases... may be create a new show command such as "show interface switch-mode". The output mainly needs to have the switchport mode displayed in conjunction with whatever else you think may be useful for the users...

gechiang avatar Mar 23 '23 01:03 gechiang

you should not modify the existing output of the "show interface status" command. You should work on a new show command that displays the switchport mode. reason is there are many applications already depended on parsing on the existing show interface status output and your change will break all those applications, parsers, and testcases... may be create a new show command such as "show interface switch-mode". The output mainly needs to have the switchport mode displayed in conjunction with whatever else you think may be useful for the users...

We have updated code for switchport modes configuration. Please Review @gechiang @venkatmahalingam

ridahanif96 avatar May 09 '23 06:05 ridahanif96

@venkatmahalingam pls, review this as well.

ridahanif96 avatar May 23 '23 06:05 ridahanif96

@dprital @qiluo-msft pls review this PR, target of this PR is 202305.

ridahanif96 avatar Jun 13 '23 06:06 ridahanif96

@venkatmahalingam @dprital can you please help to review and approve this PR? Thanks.

zhangyanzhao avatar Jun 14 '23 04:06 zhangyanzhao

@venkatmahalingam @dprital can you please help to review and approve this PR. Target is 202305 Thanks.

ridahanif96 avatar Jun 14 '23 19:06 ridahanif96

@qiluo-msft can you please merge this PR? Target is 202305 , Thanks

ridahanif96 avatar Jun 15 '23 04:06 ridahanif96

@qiluo-msft can you please merge this PR, target 202305, thanks

ridahanif96 avatar Jun 16 '23 19:06 ridahanif96

@gechiang Do you have more concern?

qiluo-msft avatar Jun 16 '23 23:06 qiluo-msft

@gechiang can you please reapprove this, all tests passed. Thanks

ridahanif96 avatar Jun 17 '23 00:06 ridahanif96

@qiluo-msft can you please help merge this PR , thanks.

ridahanif96 avatar Jun 19 '23 18:06 ridahanif96

@qiluo-msft can you please help merge this PR? thanks

ridahanif96 avatar Jul 24 '23 04:07 ridahanif96

@gechiang @venkatmahalingam can you please guide in this PR. Its reviewed and approved but still awaiting for merge, please help, thanks. @vaibhavhd & @prsunny can you please help with this PR, thanks.

ridahanif96 avatar Aug 07 '23 04:08 ridahanif96

@gechiang Do you have more concern?

I don't have any more concerns. Please help review and approve/merge this PR. Thanks!

gechiang avatar Aug 15 '23 18:08 gechiang