-
Notifications
You must be signed in to change notification settings - Fork 656
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
[multi-asic] show ip interface changes for multi asic #1396
Conversation
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
tests/show_ip_int_test.py
Outdated
'sudo ip link del Vlan100', | ||
'sudo sysctl -w net.ipv6.conf.default.addr_gen_mode=1', | ||
'sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we have an issue with using sysctl in docker, @jleveque ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Good catch. Discussion is here: #1406. We need to figure out a solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jleveque , @prsunny
I am able to use the sysctl commands in the slave docker.
arlakshm@a0b00d89505a:/sonic/src/sonic-utilities$ sudo sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 1
arlakshm@a0b00d89505a:/sonic/src/sonic-utilities$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
net.ipv6.conf.all.disable_ipv6 = 0
arlakshm@a0b00d89505a:/sonic/src/sonic-utilities$ sudo sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
arlakshm@a0b00d89505a:/sonic/src/sonic-utilities$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.all.disable_ipv6 = 1
arlakshm@a0b00d89505a:/sonic/src/sonic-utilities$ sudo sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 1
arlakshm@a0b00d89505a:/sonic/src/sonic-utilities$
We do similar configuration for the ptf docker in sonic-mgmt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to use 'netifaces' apis in the tests instead of mocking the data. If this might cause as issue, let me know I can rewrite the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arlakshm: I have confirmed that "privileged" mode is the difference. However, please see the comments here. Tests which rely on interacting with the system should be reserved for sonic-mgmt tests. For unit testing, you should simply mock any system calls and return contrived output that you can test against.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jleveque, update the unit tests to use mock data in the latest commit.
This pull request introduces 3 alerts when merging 67de06f into 794cdd3 - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please fix LGTM alerts
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
Fixed the LGTMs warnings |
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
show ip interfaces is enhanced recently to support multi ASIC platforms in this PR- sonic-net/sonic-utilities#1396 . The ipintutil script as to run as sudo user, to get the ip interface from each namespace. Add this script to the sudoer file so that show ip interface command is available for user with read-only permissions Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com> - What I did The PR has changes to support command show ip interface for multi asic platform. - How I did it The following changes are done in this PR The code for show ip interface has been moved from show/main.py to scripts\ipintutil - Modify the code to support both single and multi asic platform - To do this the library pyroute2 is used to get interface information in each namespace - Add the following options for multi asic [-n, --namespace] to allow user to display the information for given namespaces If this option is not present the information from all the namespaces will be displayed [-d, --display] to allow user to display information related both internal and external interfaces If this option is not present only external interfaces/neighbors will be display - Add unit tests for single and multi asic
from tabulate import tabulate | ||
|
||
from sonic_py_common import multi_asic | ||
from swsssdk import ConfigDBConnector, SonicDBConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swsssdk is deprecated largely in sonic-utilities. Could you adapt the new ConfigDBConnector
as in latest code?
show ip interfaces is enhanced recently to support multi ASIC platforms in this PR- sonic-net/sonic-utilities#1396 . The ipintutil script as to run as sudo user, to get the ip interface from each namespace. Add this script to the sudoer file so that show ip interface command is available for user with read-only permissions Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
show ip interfaces is enhanced recently to support multi ASIC platforms in this PR- sonic-net/sonic-utilities#1396 . The ipintutil script as to run as sudo user, to get the ip interface from each namespace. Add this script to the sudoer file so that show ip interface command is available for user with read-only permissions Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
This PR could not be cleanly cherry-pick to 202012. Please submit another PR. |
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan arlakshm@microsoft.com
- What I did
The PR has changes to support command
show ip interface
for multi asic platform.- How I did it
The following changes are done in this PR
show ip interface
has been moved fromshow/main.py
toscripts\ipintutil
[-n, --namespace] to allow user to display the information for given namespaces
If this option is not present the information from all the namespaces will be displayed
[-d, --display] to allow user to display information related both internal and external interfaces
If this option is not present only external interfaces/neighbors will be display
- How to verify it
Verify on single and multi asic
Code Coverage
- 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)