-
Notifications
You must be signed in to change notification settings - Fork 740
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
[Sub-ports] Added new sub-ports test cases #2669
[Sub-ports] Added new sub-ports test cases #2669
Conversation
Signed-off-by: Oleksandr Kozodoi <[email protected]>
retest vsimage please |
Signed-off-by: Oleksandr Kozodoi <[email protected]>
Signed-off-by: Oleksandr Kozodoi <[email protected]>
Signed-off-by: Oleksandr Kozodoi <[email protected]>
sub_ports_new[sub_ports.keys()[0]] = sub_ports[sub_ports.keys()[0]] | ||
sub_ports_new[sub_ports.keys()[-1]] = sub_ports[sub_ports.keys()[-1]] | ||
|
||
rand_sub_ports = sub_ports.keys()[random.randint(1, len(sub_ports)-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.
Shall the length of sub_ports (256 in this case) be verified here?
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.
The length of sub_ports is controlled in the block of the define_sub_ports_configuration
fixture. The test case uses range of sub-ports from 1 to 256 for port and range of sub-ports from 1 to 96 for lag-port.
# For example: 'PortChannel1.96' | ||
if request.param == 'port_in_lag': | ||
vlan_ranges_dut = range(1, 97, 24) | ||
vlan_ranges_ptf = range(1, 97, 24) |
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.
Can you add comments elaborating why 256 sub-ports configuration is generated here?
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.
Linux has the limitation of 15 characters on an interface name and name of LAG port should have prefix 'PortChannel' and suffix '<0-9999>' on SONiC. So max length of sub-port suffix can be 4 characters (such as, PortChannelX.XX, 15 characters). If we use just port, suffix can be 7 charecters (such as, EthernetXXX.XXX, 15 characters).
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.
For test case test_max_numbers_of_sub_ports
, is it suppose to create totally 256 number of sub-ports, or just verify that sub-port with suffix like PortChannelX.XX can be created?
I picked define_sub_ports_configuration
and tested it from my side on t0. For test case with max_numbers
in name, the dicts generated by this fixture are like below:
{
"sub_ports": {
"Ethernet4.129": {
"ip": "172.16.0.9/30",
"neighbor_port": "eth1.129",
"neighbor_ip": "172.16.0.10/30"
},
"Ethernet8.129": {
"ip": "172.16.4.9/30",
"neighbor_port": "eth2.129",
"neighbor_ip": "172.16.4.10/30"
},
"Ethernet8.65": {
"ip": "172.16.4.5/30",
"neighbor_port": "eth2.65",
"neighbor_ip": "172.16.4.6/30"
},
"Ethernet4.1": {
"ip": "172.16.0.1/30",
"neighbor_port": "eth1.1",
"neighbor_ip": "172.16.0.2/30"
},
"Ethernet4.65": {
"ip": "172.16.0.5/30",
"neighbor_port": "eth1.65",
"neighbor_ip": "172.16.0.6/30"
},
"Ethernet4.193": {
"ip": "172.16.0.13/30",
"nei\r\nghbor_port": "eth1.193",
"neighbor_ip": "172.16.0.14/30"
},
"Ethernet8.1": {
"ip": "172.16.4.1/30",
"neighbor_port": "eth2.1",
"neighbor_ip": "172.16.4.2/30"
},
"Ethernet8.193": {
"ip": "172.16.4.13/30",
"neighbor_port": "eth2.193",
"neighbor_ip": "172.16.4.14/30"
}
},
"dut_ports": {
"1": "Ethernet4",
"2": "Ethernet8"
},
"ptf_ports": [
"eth1",
"eth2"
]
}
and
{
"sub_ports": {
"PortChannel1.1": {
"ip": "172.16.0.1/30",
"neighbor_port": "bond1.1",
"neighbor_ip": "172.16.0.2/30"
},
"PortChannel2.73": {
"ip": "172.16.4.\r\n13/30",
"neighbor_port": "bond2.73",
"neighbor_ip": "172.16.4.14/30"
},
"PortChannel2.49": {
"ip": "172.16.4.9/30",
"neighbor_port": "bond2.49",
"neighbor_ip": "172.16.4.10/30"
},
"PortChannel1.25": {
"ip": "172.\r\n16.0.5/30",
"neighbor_port": "bond1.25",
"neighbor_ip": "172.16.0.6/30"
},
"PortChannel2.25": {
"ip": "172.16.4.5/30",
"neighbor_port": "bond2.25",
"neighbor_ip": "172.16.4.6/30"
},
"PortChannel1.49": {
"ip": "172.16.0.9/30",
"neighbor_port": "bond1.49",
"neighbor_ip": "172.16.0.10/30"
},
"PortChannel1.73": {
"ip": "172.16.0.13/30",
"neighbor_port": "bond1.73",
"neighbor_ip": "172.16.0.14/30"
},
"PortChannel2.1": {
"ip": "172.16.4.1/30",
"neighbor_port": "bond2.1",
"neighbor_ip": "172.16.4.2/30"
}
},
"dut_ports": {
"1": "PortChannel1",
"2": "PortChannel2"
},
"ptf_ports": {
"bond1": "eth1",
"bond2": "eth2"
}
}
The total number of sub-ports is far less than 256. Is this intended?
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.
Test case test_max_numbers_of_sub_ports
must create 256 sub-ports for port and 96 sub-ports for lag-port. Thanks for your help in investigating. I am working on this issue.
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.
This issue is fixed by changing steps of range in block (64 to 1), but the test needs too much time (~70 minutes) to run in this case. This behavior due to running of CLI commands for test setup and test teardown on the PTF and DUT. Does it make sense to change the steps of the range for that test case?
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.
Can you try the shell_cmds
module? By using this module, you can put all the CLI commands to be executed in a list. Then use this shell_cmds
module to run the commands one by one on remote host. It is more efficient than calling the shell module for each CLI command. Can you try it to see how much time is required then?
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've tried the shell_cmds
module. By using this module, the test case needs 40 minutes to run.
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.
Do we need to change the sub-ports range in this test case?
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 think 40 minutes is still too long. What about this idea:
- Add an option for specifying how many sub-ports to be covered. Value range of this option should be 1-256.
- Default value of the option can be much lesser to limit the test execution time.
Then we can run this test case by specifying value 256 for the option to have a full coverage when necessary. During daily regression, we can just cover the default range.
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've added --max_numbers_of_sub_ports
option for test_max_numbers_of_sub_ports case. Example of the command line how to run this tests:
py.test --testbed=testbed-t0 --inventory=../ansible/lab --testbed_file=../ansible/testbed.csv --host-pattern=testbed-t0 -- module-path=../ansible/library sub_port_interfaces --max_numbers_of_sub_ports=100
Signed-off-by: Oleksandr Kozodoi <[email protected]>
Signed-off-by: Oleksandr Kozodoi <[email protected]>
Commenter does not have sufficient privileges for PR 2669 in repo Azure/sonic-mgmt |
@wangxin Could you please review? |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Oleksandr Kozodoi [email protected]
Description of PR
Summary:
Type of change
Approach
What is the motivation for this PR?
Coverage of sub-ports feature by test cases to improve the quality of SONiC.
How did you do it?
Added new test cases to PyTest.
Implementation is based on the Sub-ports design spec
How did you verify/test it?
py.test --testbed=testbed-t0 --inventory=../ansible/lab --testbed_file=../ansible/testbed.csv --host-pattern=testbed-t0 -- module-path=../ansible/library sub_port_interfaces
Any platform specific information?
SONiC Software Version: SONiC.master.130-dirty-20210221.030317
Distribution: Debian 10.8
Kernel: 4.19.0-12-2-amd64
Build commit: ce3b2cbf
Build date: Sun Feb 21 10:23:58 UTC 2021
Platform: x86_64-accton_wedge100bf_32x-r0
HwSKU: montara
ASIC: barefoot
Supported testbed topology if it's a new test case?
T0, T1
Documentation