Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config] Add Initial draft of Breakout Mode subcommand #766

Merged
merged 17 commits into from
Jul 23, 2020

Conversation

samaity
Copy link
Contributor

@samaity samaity commented Dec 14, 2019

Signed-off-by: Sangita Maity sangitamaity0211@gmail.com

Integrating sonicMgmt API

Signed-off-by: Sangita Maity sangitamaity0211@gmail.com

- What I did
Added breakout subcommand in config command.

admin@lnos-x1-a-fab03:~$ sudo config interface -?
Usage: config interface [OPTIONS] COMMAND [ARGS]...

  Interface-related configuration tasks

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  breakout  Set interface breakout mode
  shutdown  Shut down interface
  speed     Set interface speed
  startup   Start up interface
admin@lnos-x1-a-fab03:~$ sudo config interface breakout -?
Usage: config interface breakout [OPTIONS] <interface_name> MODE

  Set interface breakout mode

Options:
  -y, --yes
  -v, --verbose   Enable verbose output
  -?, -h, --help  Show this message and exit

- How I did it
There are four basic functions needed before breakout any interface. It uses portconfig.py in sonic build image.

This Pr also has a dependency on below PRs.

  1. sonic-buildimage #3909

  2. sonic-utilities #765

  3. sonic-buildimage #4960

  4. [sonic-buildimage #4990] Enable DPB dependency check using YANG model in VS container (#45) sonic-buildimage#4990)

  5. readJsonFile: provides platform.json output which is needed to know supported mode and port attributes.

  6. _get_option: Provides dynamic mode option as per user argument i.e. interface name

  7. _validate_interface_mode: Validate Parent interface and user selected mode before starting deletetion or addition process

  8. shutdown_interfaces: shut down all the interfaces which need to be deleted.

For the integration of sonicMgmt API, this subcommand needs below three APIs.

  1. breakout_Ports: Add Ports and default config for ports to config DB, after validation of data tree and also to delete all ports.
  2. load_configMgmt: Load config for the commands which are capable of change in config DB

How to verify it
Verified using VS test case mentioned here

samaity@server09:~/REPO_FACTORY/GIT_REPO/DPB/sonic-buildimage/platform/vs/tests/breakout$ sudo pytest -s -v --dvsname=vs-sang test_breakout_cli.py
========================================================================================= test session starts =========================================================================================
platform linux2 -- Python 2.7.15+, pytest-3.3.0, py-1.8.0, pluggy-0.6.0 -- /usr/bin/python
cachedir: .cache
rootdir: /home/samaity/REPO_FACTORY/GIT_REPO/DPB/sonic-buildimage/platform/vs/tests/breakout, inifile:
collected 2 items

test_breakout_cli.py::TestBreakoutCli::test_InitialBreakoutMode remove extra link dummy
PASSED                                                                                      [ 50%]
test_breakout_cli.py::TestBreakoutCli::test_mode_1X100G **** Breakout Cli test Starts ****
**** 1X100G --> 2x50G passed ****
**** 2x50G --> 1x100G[40G] passed ****
**** 1X100G --> 4x25G[10G] passed ****
**** 4x25G[10G] --> 1x100G[40G] passed ****
**** 1x100G[40G] --> 2x25G(2)+1x50G(2) passed ****
**** 2x25G(2)+1x50G(2) --> 1x100G[40G] passed ****
**** 1x100G[40G] --> 1x50G(2)+2x25G(2)  passed ****
**** 1x50G(2)+2x25G(2) --> 1x100G[40G] passed ****
**** 1x100G[40G] --> 2x50G  passed ****
**** 2x50G --> 2x25G(2)+1x50G(2)  passed ****
**** 1x50G(2)+2x25G(2) --> 2x25G(2)+1x50G(2)  passed ****
**** 2x25G(2)+1x50G(2)  --> 1x100G[40G]  passed ****
PASSED                                                                                      [100%]

@samaity samaity marked this pull request as ready for review December 14, 2019 20:39
@daall
Copy link
Contributor

daall commented Jan 29, 2020

retest this please

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>

Integrating sonicMgmt API

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@vadymhlushko-mlnx
Copy link
Contributor

vadymhlushko-mlnx commented May 6, 2020

Hi, @samaity. I had tried to integrate this PR, and also PR's (links below) that you mentioned in the "How I did it" section.
sonic-net/sonic-buildimage#3909
#765

And after that when I try to run the command:

root@r-leopard-01:/# config interface -?

I have the output like that:

Traceback (most recent call last):
File "/usr/bin/config", line 8, in <module>
from config.main import config
File "/usr/lib/python2.7/dist-packages/config/main.py", line 19, in <module>
from config_mgmt import configMgmt
File "/usr/lib/python2.7/dist-packages/config/config_mgmt.py", line 26, in <module>
raise ImportError("%s - required module not found" % str(e))
ImportError: No module named sonic_yang - required module not found

So, should I integrate something else?

@samaity
Copy link
Contributor Author

samaity commented May 6, 2020

Hi, @samaity. I had tried to integrate this PR, and also PR's (links below) that you mentioned in the "How I did it" section.
Azure/sonic-buildimage#3909
#765

And after that when I try to run the command:

root@r-leopard-01:/# config interface -?

I have the output like that:

Traceback (most recent call last):
File "/usr/bin/config", line 8, in <module>
from config.main import config
File "/usr/lib/python2.7/dist-packages/config/main.py", line 19, in <module>
from config_mgmt import configMgmt
File "/usr/lib/python2.7/dist-packages/config/config_mgmt.py", line 26, in <module>
raise ImportError("%s - required module not found" % str(e))
ImportError: No module named sonic_yang - required module not found

So, should I integrate something else?

@praveen-li, can you provide some info?

@praveen-li
Copy link

Hi, @samaity. I had tried to integrate this PR, and also PR's (links below) that you mentioned in the "How I did it" section.
Azure/sonic-buildimage#3909
#765

And after that when I try to run the command:

root@r-leopard-01:/# config interface -?

I have the output like that:

Traceback (most recent call last):
File "/usr/bin/config", line 8, in <module>
from config.main import config
File "/usr/lib/python2.7/dist-packages/config/main.py", line 19, in <module>
from config_mgmt import configMgmt
File "/usr/lib/python2.7/dist-packages/config/config_mgmt.py", line 26, in <module>
raise ImportError("%s - required module not found" % str(e))
ImportError: No module named sonic_yang - required module not found

So, should I integrate something else?

Yeah, we need PR 3861 to make it work. That PR is still in review. Thx.

@vadymhlushko-mlnx
Copy link
Contributor

Hi, @praveen-li, I had tried to integrate PR 3861. After that I have a compilations errors that are related to sonic-yang, the issue appears when building sonic-mgmt-framework (compilation output below).

So, should I integrate something else?

image

@praveen-li
Copy link

Hi, @praveen-li, I had tried to integrate PR 3861. After that I have a compilations errors that are related to sonic-yang, the issue appears when building sonic-mgmt-framework (compilation output below).

So, should I integrate something else?

image

Not sure about the errors in sonic-mgmt-framework, Because sonic-yang-mgmt and sonic-mgmt-framework, should not be related. BTW, hope you are able to build sonic-yang-mgmt PKG,

@jleveque
Copy link
Contributor

@samaity: Please fix conflicts.

@vadymhlushko-mlnx
Copy link
Contributor

vadymhlushko-mlnx commented May 12, 2020

Hi, @samaity @praveen-li. I had integrated buildimage-PR3909, utilities-PR765, utilities-PR766, buildimage-PR3861. Then in sonic-buildimage/rules/config, I disabled sonic-mgmt-framework to avoid compilation errors (that I described in above comment). And after all those steps, I still have errors when I run next command on the switch:

root@r-leopard-01:/# config interface -?

image

Have someone of you faced such an issue, and should I integrate something else?

@praveen-li
Copy link

Hi, @samaity @praveen-li. I had integrated buildimage-PR3909, utilities-PR765, utilities-PR766, buildimage-PR3861. Then in sonic-buildimage/rules/config, I disabled sonic-mgmt-framework to avoid compilation errors (that I described in above comment). And after all those steps, I still have errors when I run next command on the switch:

root@r-leopard-01:/# config interface -?

image

Have someone of you faced such an issue, and should I integrate something else?

Kindly check if you have sonic_yang_mgmt PKG installed in pip. So "pip list | grep yang" must show sonic_yang_mgmt. Also "pip3 list | grep yang" must show sonic_yang_models.

@lgtm-com
Copy link

lgtm-com bot commented May 13, 2020

This pull request introduces 6 alerts when merging 2072a5a into 7e52ef9 - view on LGTM.com

new alerts:

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

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
config/main.py Outdated Show resolved Hide resolved
config/main.py Outdated Show resolved Hide resolved
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@lgtm-com
Copy link

lgtm-com bot commented May 14, 2020

This pull request introduces 1 alert when merging 8410e7d into ffd0bd1 - view on LGTM.com

new alerts:

  • 1 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented May 21, 2020

This pull request introduces 1 alert when merging ff80160 into 221b593 - view on LGTM.com

new alerts:

  • 1 for Unused import

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@vadymhlushko-mlnx
Copy link
Contributor

Hi, @samaity. Could you please tell me, approximately when do you plan to integrate sonic-buildimage-PR3909? Because there are merge conflicts that are hard to resolve properly if you are not a feature owner.

@zhenggen-xu
Copy link
Collaborator

Hi, @samaity. Could you please tell me, approximately when do you plan to integrate sonic-buildimage-PR3909? Because there are merge conflicts that are hard to resolve properly if you are not a feature owner.

We are working on the conflicts, should resolve it next week, will review the PR with MSFT next week too.

@samaity
Copy link
Contributor Author

samaity commented Jun 4, 2020

conflicts have been removed from sonic-buildimage #3909 PR and PR has been approved. Thanks!

@samaity
Copy link
Contributor Author

samaity commented Jun 29, 2020

retest this please

@samaity
Copy link
Contributor Author

samaity commented Jul 2, 2020

Retest this please

config/main.py Outdated Show resolved Hide resolved
@samaity
Copy link
Contributor Author

samaity commented Jul 12, 2020

Retest this please

@praveen-li
Copy link

praveen-li commented Jul 13, 2020 via email

@samaity
Copy link
Contributor Author

samaity commented Jul 13, 2020

@jleveque I have raised a PR for vs docker package dependency. Can you approve and merge the PR?
Otherwise, vs tests are getting failed due to this.

@samaity
Copy link
Contributor Author

samaity commented Jul 14, 2020

retest this please

@samaity
Copy link
Contributor Author

samaity commented Jul 15, 2020

Retest this please

jleveque pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jul 21, 2020
…4990)

Added required packages to enabled YANG dependency check for Dynamic Port Breakout in VS container.

[sonic-utilities PR #766](sonic-net/sonic-utilities#766) has a dependency on it.
Getting error like the following without this fix: `ImportError: No module named yang - required module not found`

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@samaity
Copy link
Contributor Author

samaity commented Jul 21, 2020

Retest this please

1 similar comment
@zhenggen-xu
Copy link
Collaborator

Retest this please

@samaity samaity requested a review from jleveque July 22, 2020 18:20
config/main.py Outdated Show resolved Hide resolved
config/main.py Outdated Show resolved Hide resolved
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
config/main.py Outdated Show resolved Hide resolved
config/main.py Outdated Show resolved Hide resolved
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@samaity
Copy link
Contributor Author

samaity commented Jul 22, 2020

Retest this please

@jleveque jleveque merged commit aa1b072 into sonic-net:master Jul 23, 2020
CharlieChenEC pushed a commit to CharlieChenEC/sonic-utilities that referenced this pull request May 14, 2021
Added breakout subcommand in config command

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
6cfb3ecb0248768da0a91e5f7fb4477c5da7eb4e (HEAD -> 201911, origin/201911) [build]: allow to use extra inc/lib location to build the package (sonic-net#595)
40d34872d3b7f354adac67f084eebf6ee467f779 Merge pull request sonic-net#846 from xumia/azp-201911
76ac50f147a7d820b19d8d7628a67f2fe4f5159b Disable the build test
6c9cf655b8b5b152cab1d578e05eddf8238b81b0 Fix branch reference error
ca8d81d37a9b0294098f161b036d330d9ff461e0 [ci]: download artifacts from master branch (sonic-net#768)
0cbf4d55c67a9f8f52715f95536f3588acf06c4a [ci]: use sonicbld pool (sonic-net#766)
b6f1265ee9bd86f8a5e909a6f1e9b2384497c906 [ci]: add build for arm64 and armhf (sonic-net#757)
9ec0a7da64d479b124815edc5b505fb88b2532a0 CI: add azure pipeline CI/CD (sonic-net#754)
1436dbe02cd3c56f796c6b3398d4075cd05d97e0 Fix RIF issue (sonic-net#835)

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
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.

7 participants