[ixia/Keysight] Adding first Tgen-based rdma test cases.#2246
[ixia/Keysight] Adding first Tgen-based rdma test cases.#2246abhijit-dhar wants to merge 73 commits intosonic-net:masterfrom abhijit-dhar:master
Conversation
This directory should contain the Ixia ECN and RDMA test cases.
The lib folder contains
* fixtures required to run ixia test cases
* helper function required to write ixia test cases
As per review comments given against the 1819 we have to keep the ixia libraries under sonic-mgmt/tests/common/ixia/
This file should be in tests/common/ixia folder. So deleting it from tests/ixia/lib/ folder
This file should be under the folder tests/common/ixia Hence deleting it form tests/ixia/lib
This file should be under tests/common/ixia So deleting it from tests/ixia/lib
There were many review comment against this file. Some of the comments I have implemented. But some of the comments may be implemented in future. Like "(Wei Bai) Can you move all the low level IXIA API functions to ixia_helpers.py?" or "I have a high level comment. can we design some IXIA wrapper functions (e.g., configure ports, create a PFC traffic item) and only call these high level wrapper functions in py.test scripts without exposing too many IXIA low level details? (Wei Bai)" This comment may be addressed in future PRs once we come up with the high level wrapper APIs.
Added a new fixture ixia_api_server_session
This class is added to efficiently manage ixia fanout devices
Making ixia directory a package, to access ixia_fixtures.py and ixia_helpers.py
This class is a place holder right now. Ixia fanout devices (chassis) do not require this abstraction layer. Ixia PTF (ixia API server) takes care of all the operation that we can do on the ixia fanout devices (chassis) and hence we execute them via API server only. But it is still nice to have all abstractions in the same location. So future users knows where to find them.
Added a new class that should make chassis port management easier
There was an typo
Deletes accidentally
|
This pull request introduces 1 alert when merging eb0044c into 857cfb2 - view on LGTM.com new alerts:
|
|
This pull request introduces 1 alert when merging e568baa into ad43809 - view on LGTM.com new alerts:
|
|
This pull request introduces 1 alert when merging 7662ed3 into ad43809 - view on LGTM.com new alerts:
|
tests/pfc/files/configs/pfc.py
Outdated
| from abstract_open_traffic_generator.flow import Ethernet as EthernetHeader | ||
| from abstract_open_traffic_generator.port import Options as PortOptions | ||
|
|
||
| def calculate_priority_vector(v) : |
There was a problem hiding this comment.
This function should be moved to another file
There was a problem hiding this comment.
Add comments for this function
There was a problem hiding this comment.
- Relocation of this function to another generic/common file will be tracked by a separate PR. Let it be here now.
- This function is updated with appropriate comment section.
tests/pfc/files/configs/pfc.py
Outdated
| print(i) | ||
| return "%x"%(s) | ||
|
|
||
| def lossless_iteration_list (lst) : |
There was a problem hiding this comment.
Add comments for this function
There was a problem hiding this comment.
This function is updated with appropriate comment section.
tests/pfc/files/configs/pfc.py
Outdated
|
|
||
|
|
||
| @pytest.fixture | ||
| def one_hundred_gbe(conn_graph_facts, |
There was a problem hiding this comment.
The name of 'one_hundred_gbe' is not so straightforward. How about changing the name to 'l1_config' and extending this function to support any link speeds.
There was a problem hiding this comment.
The name 'one_hundred_gbe' has been replaced by the name 'l1_config' everywhere in the code.
tests/pfc/files/configs/pfc.py
Outdated
| ###################################################################### | ||
| tx_ipv4 = Ipv4(name='Tx Ipv4', | ||
| address=Pattern(tx_port_ip), | ||
| prefix=Pattern('24'), |
There was a problem hiding this comment.
We cannot assume the prefix length is 24. You should be able to get this from vlan_subnet
There was a problem hiding this comment.
This change request is implemented. I have extracted from 'vlan_subnet'
tests/pfc/files/configs/pfc.py
Outdated
|
|
||
|
|
||
| @pytest.fixture | ||
| def global_pause(conn_graph_facts, |
There was a problem hiding this comment.
This file is shared by two test cases 1) test_pfc_pause_lossy.py 2) test_global_pause.py. So fixture used by both the test cases exists here. This particular function is used by test_global_pause.py. So this should be here.
tests/pfc/test_pfc_pause_lossy.py
Outdated
| api.set_state(State(FlowTransmitState(state='stop'))) | ||
|
|
||
| # Get statistics | ||
| stat_captions =['Test Data', 'Background Data'] |
There was a problem hiding this comment.
we need to define 'Test Data' and 'Background Data' in tests/pfc/files/configs/pfc.py
There was a problem hiding this comment.
I have defined 'Test Data' and 'Background Data' in pfc/test_pfc_pause_lossy.py and made them available in pfc.py as parameter
| all lossless priorities. | ||
| 6. From Rx port send pause frames on all lossless priorities. Then | ||
| start 'Test Data Traffic' and 'Background Data Traffic'. | ||
| 7. Verify the following: |
There was a problem hiding this comment.
The verification is wrong. The right description is 'When all the traffic items stop, the Rx port receives all the packets of test traffic and background traffic. And their throughput are not impacted by the PFC pause storm'.
tests/pfc/test_pfc_pause_lossy.py
Outdated
| """ | ||
| duthost.shell('sudo pfcwd stop') | ||
|
|
||
| for base_config in lossy_configs: |
tests/pfc/files/configs/pfc.py
Outdated
|
|
||
| config.flows.append(pause_flow) | ||
|
|
||
| return one_hundred_gbe |
There was a problem hiding this comment.
It is a little bit weird to return an input argument (though I understand your point)
|
Remove the serialization |
tests/pfc/files/configs/pfc.py
Outdated
|
|
||
| for config in one_hundred_gbe : | ||
|
|
||
| delay = start_delay * 1000000000.0 |
There was a problem hiding this comment.
I would rename start_delay to start_delay_secs and name delay as delay_nsec. Also create a global variable NSECS_IN_SEC for 1000000000.0, or better, create a function sec_to_nsec() for the conversion.
There was a problem hiding this comment.
I have changed the name of variable/fixture and wrote a function as given in the suggestion.
tests/common/ixia/ixia_helpers.py
Outdated
| location = str("%s;%s;%s"%(intf['ip'],intf['card_id'],intf['port_id'])) | ||
| except : | ||
| pytest_assert(False, | ||
| "Interface must have the keys 'ip', 'card_id' and 'port_id'") |
There was a problem hiding this comment.
Please use pytest.fail(msg) instead.
There was a problem hiding this comment.
I have replaced this pytest_assert(False, ...) with pytest.fail(msg)
tests/pfc/test_pfc_pause_lossy.py
Outdated
|
|
||
| if ((row['frames_rx'] == 0) or (row['frames_tx'] != row['frames_rx'])): | ||
| pytest_assert(False, | ||
| "Not all %s reached Rx End" %(rows[caption_index])) |
There was a problem hiding this comment.
Either use if (cond): pytest.fail(msg) or use pytest_assert(! cond, msg). Please don't use pytest_assert(False, msg).
There was a problem hiding this comment.
I have replaced this pytest_assert(False, ...) with pytest.fail(msg)
tests/pfc/test_pfc_pause_lossy.py
Outdated
| if ((tolerance_ratio < TOLERANCE_THRESHOLD) or | ||
| (tolerance_ratio > 1)) : | ||
| pytest_assert(False, | ||
| "expected % of packets not received at the RX port") |
There was a problem hiding this comment.
Please don't use pytest_assert(False, msg) (see comments above)
There was a problem hiding this comment.
I have replaced this pytest_assert(False, ...) with pytest.fail(msg)
tests/pfc/files/configs/pfc.py
Outdated
| for i in range(8) : | ||
| if v[i] != '0' : | ||
| s += 2**(7 - i) | ||
| print(i) |
There was a problem hiding this comment.
please remove this debug statement. If needed, use log instead.
There was a problem hiding this comment.
I have removed the print statement.
| # Imports for Tgen and IxNetwork abstract class | ||
| ############################################################################### | ||
|
|
||
| from abstract_open_traffic_generator.port import Port |
There was a problem hiding this comment.
These links are already shared by Subhajit. We have refactored the code a bit after the new implementation. Our baseline is bstract-open-traffic-generator==0.0.50 and ixnetwork-open-traffic-generator==0.0.15 . Please install them using pip.
sudo pip install abstract-open-traffic-generator==0.0.50
sudo pip install ixnetwork-open-traffic-generator==0.0.15
tests/pfc/files/configs/pfc.py
Outdated
| from abstract_open_traffic_generator.flow import Ethernet as EthernetHeader | ||
| from abstract_open_traffic_generator.port import Options as PortOptions | ||
|
|
||
| @pytest.fixture |
There was a problem hiding this comment.
Implemented. Please check the file "test_pfc_pause_lossy.py"
tests/pfc/files/configs/pfc.py
Outdated
| return start_delay | ||
|
|
||
|
|
||
| @pytest.fixture |
There was a problem hiding this comment.
implemented. Please check the file "test_pfc_pause_lossy.py"
tests/pfc/files/configs/pfc.py
Outdated
| return traffic_duration | ||
|
|
||
|
|
||
| @pytest.fixture(scope='session') |
There was a problem hiding this comment.
This requires a discussion. I want place it in ~/sonic-mgmt/tests/common/ixia/ixia_fixtures.py. Should it be ok?
tests/pfc/files/configs/pfc.py
Outdated
|
|
||
| flow_ctl = FlowControl(choice=pfc) | ||
|
|
||
| l1_oneHundredGbe = OneHundredGbe(link_training=True, |
There was a problem hiding this comment.
If L1 config is different the you have to define a new fixture for that.
tests/pfc/test_pfc_pause_lossy.py
Outdated
| (rows[caption_index] == 'Background Data')): | ||
| if rows[tx_frame_index] != rows[rx_frame_index] : | ||
| pytest_assert(False, | ||
| "Not all %s reached Rx End" %(rows[caption_index])) |
|
This pull request introduces 3 alerts when merging 997e27b into 553e9ff - view on LGTM.com new alerts:
|
|
This pull request introduces 3 alerts when merging 089b53a into 4413d9d - view on LGTM.com new alerts:
|
|
This pull request introduces 3 alerts when merging 7628179 into 4413d9d - view on LGTM.com new alerts:
|
|
This pull request introduces 1 alert when merging c958741 into 43915ed - view on LGTM.com new alerts:
|
|
This pull request introduces 7 alerts when merging 512aa4b into 6b27e48 - view on LGTM.com new alerts:
|
|
This pull request introduces 2 alerts when merging bec37fe into 1306417 - view on LGTM.com new alerts:
|
This PR is to advance sonic-swss submodule for 202012 branch. Changes include eef993f [202012][cherry-pick]Update orchagent to support new field pfcwd_sw_enable (sonic-net#2302) ab675b3 [202012][cherry-pick] Support tunnel traffic QoS remapping (sonic-net#2246) Signed-off-by: bingwang <[email protected]>
… submodule head (sonic-net#12494) utilities: * 02eb899e 2022-07-12 | [config/load_mgmt_config] Support load IPv6 mgmt IP (sonic-net#2206) (sonic-net#2246) (sonic-net#2256) (HEAD -> 201811, github/201811) [Jing Kan] platform-daemon: * fc288cc 2022-05-05 | Mem leak caused by Xcvrd in Send-Q of REDIS-DB socket connection (sonic-net#260) (HEAD -> 201811, github/201811) [Prince George] platform-common: * edb062b 2022-02-09 | [sonic_sfp] Interpret sff 'int' element =0 as valid value (sonic-net#261) (HEAD -> 201811, github/201811) [Prince George] kernel: * 9d2d1a1 2022-02-11 | [201811] Increase log_buf_len size to 1M (HEAD -> 201811, github/201811) [Sujin Kang] * b34a213 2022-02-10 | [201811] Increase log_buf_len size to 1M [Samuel Angebault] * c4684cb 2022-02-11 | [201811] Apply kernel patches to fix emmc unreliability [Sujin Kang] * df68771 2022-02-03 | [201811] Apply kernel patches to fix emmc unreliability [Samuel Angebault] * f21cb06 2021-03-26 | [ci]: remove 201811 suffix (sonic-net#204) [lguohan] * 5439b2a 2021-02-08 | [dni_dps460] Add attributes to retrieve PMBus status command codes (sonic-net#194) [Arun Saravanan Balachandran] Signed-off-by: Ying Xie <[email protected]> Signed-off-by: Ying Xie <[email protected]>
Why I did it 62b7b56 2022-07-13 | Remove disabled and not loaded services before calling reset-failed and restart services (sonic-net#2266) [Zain Budhwani] 09b4678 2022-07-05 | [config/load_mgmt_config] Support load IPv6 mgmt IP (sonic-net#2206) (sonic-net#2246) [Jing Kan] How I did it Pulled latest commit from 201911 sonic-utilities branch and created PR How to verify it Look at build-image
Adding Tgen-Api based Pfc lossy test case.
Files added
Files changed