Skip to content
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

Snappi sample #3653

Merged
merged 19 commits into from
Jul 9, 2021
Merged

Snappi sample #3653

merged 19 commits into from
Jul 9, 2021

Conversation

ANISH-GOTTAPU
Copy link
Contributor

@ANISH-GOTTAPU ANISH-GOTTAPU commented Jun 10, 2021

Description of PR

Migration of ixa/test_tgen from ixnetwork open traffic generator to snappi

Summary:
Test case(new/improvement)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • [x ] Test case(new/improvement)

Approach

What is the motivation for this PR?

The motivation for this PR is to migrate the tests that are written with ixnetwork open traffic generator to snappi

How did you do it?

Replaced the code where abstract is used to snappi

How did you verify/test it?

verified the tests in sonic-mgmt using pytest with DUT and IXIA connections
snappi version used for the development of tests snappi[ixnetwork]==0.4.14

@ANISH-GOTTAPU ANISH-GOTTAPU requested a review from a team as a code owner June 10, 2021 14:25
@ANISH-GOTTAPU
Copy link
Contributor Author

This PR is dependant on sonic-net/sonic-buildimage#7829

@lgtm-com
Copy link

lgtm-com bot commented Jun 10, 2021

This pull request introduces 1 alert when merging 96d8762 into 6a4da3c - view on LGTM.com

new alerts:

  • 1 for Unused import

from ipaddress import ip_address, IPv4Address
from tests.common.fixtures.conn_graph_facts import conn_graph_facts,\
fanout_graph_facts
from tests.common.ixia.common_helpers import get_vlan_subnet, get_addrs_in_subnet,\
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you create a new folder test.common.snappi to hold all the helper functions used to snappi?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

created new folder and moved helper files as suggested

@pytest.fixture(scope="module")
def snappi_api_serv_ip(tbinfo):
"""
In a tgen testbed, there is no PTF docker.
Copy link
Contributor

Choose a reason for hiding this comment

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

tgen -> snappi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated


def __l3_intf_config(config, port_config_list, duthost, ixia_ports):
"""
Generate Tgen configuration of layer 3 interfaces
Copy link
Contributor

Choose a reason for hiding this comment

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

Tgen -> Snappi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

ip_stack.prefix = prefix
ip_stack.gateway = gw_addr

port_config = IxiaPortConfig(id=port_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

IxiaPortConfig -> SnappiPortConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created new file in snappi folder and updated the class name

fanout_graph_facts
from tests.common.fixtures.snappi_fixtures import snappi_api_serv_ip, snappi_api_serv_port,\
snappi_api, tgen_testbed_config
from tests.common.ixia.port import select_ports
Copy link
Contributor

Choose a reason for hiding this comment

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

ixia -> snappi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

return testbed_config


def test_snappi(snappi_api,
Copy link
Contributor

Choose a reason for hiding this comment

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

Align all the arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@ANISH-GOTTAPU
Copy link
Contributor Author

updated lab.yml to take snappi_api_server instead of ixia_api_server

ref:
https://github.com/ANISH-GOTTAPU/sonic-testbed-manager/blob/snappi/ixia-calbases-lab/ansible/group_vars/lab/lab.yml#L52

@lgtm-com
Copy link

lgtm-com bot commented Jun 14, 2021

This pull request introduces 3 alerts when merging 769106c into a26f2d5 - view on LGTM.com

new alerts:

  • 3 for Unused import

tests/snappi/test_snappi.py Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Jun 28, 2021

This pull request introduces 3 alerts when merging e48be1a into ca982e6 - view on LGTM.com

new alerts:

  • 3 for Unused import

@baiwei0427
Copy link
Contributor

@ANISH-GOTTAPU Can you fix LGTM alerts?

@baiwei0427
Copy link
Contributor

@neethajohn Can you merge this PR?

@neethajohn neethajohn merged commit 3da7456 into sonic-net:master Jul 9, 2021
bingwang-ms added a commit that referenced this pull request Jul 11, 2021
@bingwang-ms
Copy link
Collaborator

Sorry @neethajohn @ANISH-GOTTAPU , I have to revert this PR since it causes regression. Please check #3766 for more info. Thanks

bingwang-ms added a commit that referenced this pull request Jul 12, 2021
neethajohn added a commit that referenced this pull request Jul 16, 2021
neethajohn added a commit that referenced this pull request Jul 21, 2021
This reverts commit 1b53581.

Reverts #3766 since the build is using the new docker
vmittal-msft pushed a commit to vmittal-msft/sonic-mgmt that referenced this pull request Sep 28, 2021
* Sample traffic test using snappi
* Snappi helpers for traffic generation

What is the motivation for this PR?
The motivation for this PR is to migrate the tests that are written with ixnetwork open traffic generator to snappi

How did you do it?
Replaced the code where abstract is used to snappi

How did you verify/test it?
verified the tests in sonic-mgmt using pytest with DUT and IXIA connections
snappi version used for the development of tests snappi[ixnetwork]==0.4.14
vmittal-msft pushed a commit to vmittal-msft/sonic-mgmt that referenced this pull request Sep 28, 2021
vmittal-msft pushed a commit to vmittal-msft/sonic-mgmt that referenced this pull request Sep 28, 2021
sonic-net#3806)

This reverts commit 1b53581.

Reverts sonic-net#3766 since the build is using the new docker
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.

5 participants