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

Modified SNMP, LLDP and PC testcases for T2 topology #2935

Merged
merged 5 commits into from Apr 9, 2021

Conversation

oxygen980
Copy link
Contributor

Description of PR

Modified testcases for T2 topology, these are very small changes mainly replaced 'rand_one_dut_hostname' with 'enum_rand_one_per_hwsku_frontend_hostname' for multi-dut.

Summary:
Fixes # (issue)

Type of change

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

Approach

What is the motivation for this PR?

Modified testcases to run on multi-dut

How did you do it?

Replaced 'rand_one_dut_hostname' with 'enum_rand_one_per_hwsku_frontend_hostname'

How did you verify/test it?

Modified and ran on T2 topology

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@oxygen980 oxygen980 requested a review from a team as a code owner February 5, 2021 06:26
@oxygen980 oxygen980 changed the title Modified SNMP and LLDP testcases for T2 topology Modified SNMP, LLDP and PC testcases for T2 topology Feb 10, 2021
@anshuv-mfst
Copy link

@yxieca, @wangxin - could you please review.
@eswaranb - please add Arista reviewers

@yxieca
Copy link
Collaborator

yxieca commented Mar 21, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@shubav
Copy link
Contributor

shubav commented Mar 22, 2021

@wangxin would you know what the root cause is? These are dhcp failures unrelated to the test cases modified in this commit. Could you help resolve this?

@oxygen980
Copy link
Contributor Author

@wangxin Could you please run again, the failure is not from the code change. Thanks

@shubav
Copy link
Contributor

shubav commented Mar 30, 2021

The pipeline checks have passed.
@wangxin - could you please review? Thanks

tests/pc/test_po_cleanup.py Show resolved Hide resolved
"""compare the snmp facts between observed states and target state"""

duthost = duthosts[enum_dut_hostname]
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
hostip = duthost.host.options['inventory_manager'].get_host(duthost.hostname).vars['ansible_host']

snmp_facts = localhost.snmp_facts(host=hostip, version="v2c", community=creds["snmp_rocommunity"])['ansible_facts']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the last case in this file be updated from

def test_snmp_interfaces_mibs(duthosts, rand_one_dut_hostname, localhost, creds):

to

def test_snmp_interfaces_mibs(duthosts, enum_rand_one_per_hwsku_hostname, localhost, creds):

?

@@ -120,9 +120,9 @@ def verify_snmp_speed(facts, snmp_facts, results):
return results

@pytest.mark.bsl
def test_snmp_interfaces(localhost, creds, duthosts, enum_dut_hostname, enum_asic_index):
def test_snmp_interfaces(localhost, creds, duthosts, enum_rand_one_per_hwsku_hostname, enum_asic_index):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will check interfaces on supervisor node too, right? Was the original intention to use fixture enum_rand_one_per_hwsku_frontend_hostname?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wangxin the reason on doing enum_rand_one_per_hwsku_hostname is because the other test test_snmp_mgmt_interface is applicable to both supervisor and front end node and we found if you have both enum_rand_one_per_hwsku_hostname and enum_rand_one_per_hwsku_frontend_hostname in same module correct nodes are not selected, I will add and if condition to skip this test for supervisor for now

host_ip = duthost.host.options['inventory_manager'].get_host(duthost.hostname).vars['ansible_host']
snmp_facts = localhost.snmp_facts(host=host_ip, version="v2c",
community=creds["snmp_rocommunity"])['ansible_facts']
facts = collect_memory(duthosts, rand_one_dut_hostname)
facts = collect_memory(duthosts, enum_rand_one_per_hwsku_hostname)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest to change the arguments definition of collect_memory to:

def collect_memory(duthost):

Then it would be unnecessary to get duthost using code like duthost = duthosts[enum_rand_one_per_hwsku_hostname].
And the code here can be just:

facts = collect_memory(duthost)

@@ -428,7 +441,7 @@ def _get_transceiver_sensor_data(duthost, name):


@pytest.mark.disable_loganalyzer
def test_turn_off_pdu_and_check_psu_info(duthost, localhost, creds, pdu_controller):
def test_turn_off_psu_and_check_psu_info(duthosts, enum_rand_one_per_hwsku_hostname, snmp_physical_entity_info, localhost, creds, pdu_controller):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently the pdu_controller definition is like below:

@pytest.fixture(scope="module")
def pdu_controller(duthosts, rand_one_dut_hostname, conn_graph_facts, pdu):

So, the pdu_controller object used by this test case could be a PDU controller for other node in current test bed. How to address this issue?

@@ -5,12 +5,12 @@
logger = logging.getLogger(__name__)

pytestmark = [
pytest.mark.topology('any'),
pytest.mark.topology('any', 't2'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

The supported topology is already any. It's unnecessary to add t2 here.


pytestmark = [
pytest.mark.topology('t0', 't1'),
pytest.mark.topology('t0', 't1', 't2'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change the topology mark to any instead of 't0', 't1', 't2'?

@@ -4,22 +4,22 @@
logger = logging.getLogger(__name__)

pytestmark = [
pytest.mark.topology('t0', 't1'),
pytest.mark.topology('t0', 't1', 't2'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change the topology mark to any instead of 't0', 't1', 't2'?

@@ -1,12 +1,12 @@
import pytest

pytestmark = [
pytest.mark.topology('any'),
pytest.mark.topology('any', 't2'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

The supported topology is already any. It's unnecessary to add t2 here.

tests/snmp/test_snmp_phy_entity.py Outdated Show resolved Hide resolved
@oxygen980 oxygen980 force-pushed the snmp_lldp branch 2 times, most recently from 49f8e1d to 7c20e70 Compare April 1, 2021 23:04
falodiya added 5 commits April 1, 2021 19:05
def test_snmp_psu_status(duthosts, rand_one_dut_hostname, localhost, creds):
duthost = duthosts[rand_one_dut_hostname]
def test_snmp_psu_status(duthosts, enum_supervisor_dut_hostname, localhost, creds):
duthost = duthosts[enum_supervisor_dut_hostname]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see. Thanks!

@wangxin wangxin merged commit 05c5fa9 into sonic-net:master Apr 9, 2021
saravanansv pushed a commit to saravanansv/sonic-mgmt that referenced this pull request May 6, 2021
What is the motivation for this PR?
Modified testcases to run on multi-dut

How did you do it?
Replaced 'rand_one_dut_hostname' with 'enum_rand_one_per_hwsku_frontend_hostname'

Co-authored-by: falodiya <renu.falodiy@nokia.com>
vmittal-msft pushed a commit to vmittal-msft/sonic-mgmt that referenced this pull request Sep 28, 2021
What is the motivation for this PR?
Modified testcases to run on multi-dut

How did you do it?
Replaced 'rand_one_dut_hostname' with 'enum_rand_one_per_hwsku_frontend_hostname'

Co-authored-by: falodiya <renu.falodiy@nokia.com>
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.

None yet

5 participants