Skip to content

[ixia/Keysight] Adding first Tgen-based rdma test cases.#2246

Open
abhijit-dhar wants to merge 73 commits intosonic-net:masterfrom
abhijit-dhar:master
Open

[ixia/Keysight] Adding first Tgen-based rdma test cases.#2246
abhijit-dhar wants to merge 73 commits intosonic-net:masterfrom
abhijit-dhar:master

Conversation

@abhijit-dhar
Copy link
Copy Markdown
Contributor

Adding Tgen-Api based Pfc lossy test case.
Files added

  1. ~/sonic-mgmt/tests/pfc/test_pfc_pause_loss.py
  2. ~/sonic-mgmt/tests/pfc/files/configs/init.py
  3. ~/sonic-mgmt/tests/pfc/files/configs/pfc.py
    Files changed
  4. ~/sonic-mgmt/tests/common/ixia/ixia_fixtures.py
  5. ~/sonic-mgmt/tests/common/ixia/ixia_helpers.py

abhijit-dhar and others added 30 commits June 25, 2020 21:38
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
@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 13, 2020

This pull request introduces 1 alert when merging eb0044c into 857cfb2 - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 14, 2020

This pull request introduces 1 alert when merging e568baa into ad43809 - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 14, 2020

This pull request introduces 1 alert when merging 7662ed3 into ad43809 - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

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) :
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should be moved to another file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments for this function

Copy link
Copy Markdown
Contributor Author

@abhijit-dhar abhijit-dhar Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Relocation of this function to another generic/common file will be tracked by a separate PR. Let it be here now.
  2. This function is updated with appropriate comment section.

print(i)
return "%x"%(s)

def lossless_iteration_list (lst) :
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments for this function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is updated with appropriate comment section.



@pytest.fixture
def one_hundred_gbe(conn_graph_facts,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name 'one_hundred_gbe' has been replaced by the name 'l1_config' everywhere in the code.

######################################################################
tx_ipv4 = Ipv4(name='Tx Ipv4',
address=Pattern(tx_port_ip),
prefix=Pattern('24'),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot assume the prefix length is 24. You should be able to get this from vlan_subnet

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change request is implemented. I have extracted from 'vlan_subnet'



@pytest.fixture
def global_pause(conn_graph_facts,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

api.set_state(State(FlowTransmitState(state='stop')))

# Get statistics
stat_captions =['Test Data', 'Background Data']
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to define 'Test Data' and 'Background Data' in tests/pfc/files/configs/pfc.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'.

"""
duthost.shell('sudo pfcwd stop')

for base_config in lossy_configs:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments


config.flows.append(pause_flow)

return one_hundred_gbe
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a little bit weird to return an input argument (though I understand your point)

@baiwei0427
Copy link
Copy Markdown
Contributor

Remove the serialization


for config in one_hundred_gbe :

delay = start_delay * 1000000000.0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the name of variable/fixture and wrote a function as given in the suggestion.

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'")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use pytest.fail(msg) instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have replaced this pytest_assert(False, ...) with pytest.fail(msg)


if ((row['frames_rx'] == 0) or (row['frames_tx'] != row['frames_rx'])):
pytest_assert(False,
"Not all %s reached Rx End" %(rows[caption_index]))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either use if (cond): pytest.fail(msg) or use pytest_assert(! cond, msg). Please don't use pytest_assert(False, msg).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have replaced this pytest_assert(False, ...) with pytest.fail(msg)

if ((tolerance_ratio < TOLERANCE_THRESHOLD) or
(tolerance_ratio > 1)) :
pytest_assert(False,
"expected % of packets not received at the RX port")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use pytest_assert(False, msg) (see comments above)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have replaced this pytest_assert(False, ...) with pytest.fail(msg)

for i in range(8) :
if v[i] != '0' :
s += 2**(7 - i)
print(i)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this debug statement. If needed, use log instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the print statement.

# Imports for Tgen and IxNetwork abstract class
###############################################################################

from abstract_open_traffic_generator.port import Port
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

from abstract_open_traffic_generator.flow import Ethernet as EthernetHeader
from abstract_open_traffic_generator.port import Options as PortOptions

@pytest.fixture
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented. Please check the file "test_pfc_pause_lossy.py"

return start_delay


@pytest.fixture
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implemented. Please check the file "test_pfc_pause_lossy.py"

return traffic_duration


@pytest.fixture(scope='session')
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires a discussion. I want place it in ~/sonic-mgmt/tests/common/ixia/ixia_fixtures.py. Should it be ok?


flow_ctl = FlowControl(choice=pfc)

l1_oneHundredGbe = OneHundredGbe(link_training=True,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If L1 config is different the you have to define a new fixture for that.

(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]))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 27, 2020

This pull request introduces 3 alerts when merging 997e27b into 553e9ff - view on LGTM.com

new alerts:

  • 2 for Variable defined multiple times
  • 1 for Except block handles 'BaseException'

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 29, 2020

This pull request introduces 3 alerts when merging 089b53a into 4413d9d - view on LGTM.com

new alerts:

  • 2 for Variable defined multiple times
  • 1 for Except block handles 'BaseException'

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 29, 2020

This pull request introduces 3 alerts when merging 7628179 into 4413d9d - view on LGTM.com

new alerts:

  • 2 for Variable defined multiple times
  • 1 for Except block handles 'BaseException'

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 30, 2020

This pull request introduces 1 alert when merging c958741 into 43915ed - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 30, 2020

This pull request introduces 7 alerts when merging 512aa4b into 6b27e48 - view on LGTM.com

new alerts:

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

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Nov 3, 2020

This pull request introduces 2 alerts when merging bec37fe into 1306417 - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'
  • 1 for Syntax error

kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
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]>
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
… 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]>
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants