updating pfc tests - #5
Conversation
| import snappi | ||
|
|
||
| try: | ||
| from abstract_open_traffic_generator.port import Port |
There was a problem hiding this comment.
We need to get rid of abstract_open_traffic_generator everywhere.
There was a problem hiding this comment.
And statements using abstract classes
There was a problem hiding this comment.
Added TODO as discussed
|
|
||
|
|
||
| @pytest.fixture(scope='module') | ||
| def snappi_api(ixia_api_serv_ip, |
There was a problem hiding this comment.
as discussed, we need a meeting with Wei
| ixia_api_serv_port (pytest fixture): ixia_api_serv_port fixture. | ||
| """ | ||
| host = "https://" + ixia_api_serv_ip + ":" + str(ixia_api_serv_port) | ||
| api = snappi.api(host=host, ext="ixnetwork") |
There was a problem hiding this comment.
add a comment here mentioning:
TODO: Currently extension is defaulted to ixnetwork but it doesn't need to be that way. Going forward, we should be able to specify extension from command line while running pytest.
|
|
||
| yield api | ||
|
|
||
| if api.assistant is not None: |
There was a problem hiding this comment.
This is specific to IxNetwork, so add a check here. i.e. execute this statement only if assistant is a valid attribute of api.
| config = testbed_config | ||
| config.flows = flows | ||
| config.captures = capture_config | ||
| __gen_traffic(testbed_config=testbed_config, |
There was a problem hiding this comment.
Please review description of this function. It doesn't return config anymore, rather mutates the one that is passed as an argument.
| ip_filter.custom.mask = '0f' | ||
|
|
||
|
|
||
| def __run_traffic(api, |
There was a problem hiding this comment.
This function is filled with API calls yet no asserts are used for error checking. We should check for errors and raise it, and if there's a warning, log it.
| request = api.capture_request() | ||
| request.port_name = capture_port_name | ||
| pcap_bytes = api.get_capture(request) | ||
| pcap_bytes = pcap_bytes.getvalue() |
There was a problem hiding this comment.
pcap_bytes.getvalue()Do this directly when writing to file.
ashutshkumr
left a comment
There was a problem hiding this comment.
Following needs to be addressed:
- All the comments provided for
ecn/helper.pyapplies to other helper files as well (e.g. change comments to provide correct info on returned values, check errors/warnings for api calls, etc.) - Do not import
ixia_api_serv_userandixia_api_serv_passwdin multiple files since we're not using those anymore - There are multiple such comments spread across multiple files:
snappi_api (pytest fixture): IXIA sessionInstead of IXIA session, we should mention snappi API session
Description of PR
Migrating PFC/PFCWD/ECN tests from abstract to snappi
Type of change
Approach
What is the motivation for this PR?
The motivation for this PR is to migrate the tests that are written with
abstract open traffic generatortosnappiwhich is more readableHow did you do it?
updated the tests with snappi
How did you verify/test it?
verified all the tests in sonic-mgmt framework with DUT and IXIA connections using the below version
snappi[ixnetwork]==0.3.13