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

[Multiasic]: Update Interfaces MIB testcase to test multiasic platform #1635

Merged
merged 5 commits into from
Mar 3, 2021

Conversation

SuvarnaMeenakshi
Copy link
Contributor

@SuvarnaMeenakshi SuvarnaMeenakshi commented May 1, 2020

platform.

Signed-off-by: SuvarnaMeenakshi [email protected]

Description of PR

Multiasic platform will have config_db for each ASIC.
Update test_interfaces test case to work for multi asic platform.

Summary:
Fixes # (issue)

Type of change

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

Approach

How did you do it?

Updated test case to run snmp interfaces test case for each namespace.

How did you verify/test it?

Tested it on multi-asic platform.
pytest --testbed=vms-kvm-multi-asic-t1-lag --inventory=veos_vtb --testbed_file=vtestbed.csv --host-pattern=vlab-07 --module-path=../ansible/library "snmp/test_snmp_interfaces.py" --show-capture=no --disable_loganalyzer --skip_sanity -v
/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/init.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
from cryptography.exceptions import InvalidSignature
=============================================================================== test session starts ===============================================================================
platform linux2 -- Python 2.7.17, pytest-4.6.5, py-1.9.0, pluggy-0.13.1 -- /usr/bin/python
cachedir: .pytest_cache
metadata: {'Python': '2.7.17', 'Platform': 'Linux-5.4.0-1031-azure-x86_64-with-Ubuntu-18.04-bionic', 'Packages': {'py': '1.9.0', 'pytest': '4.6.5', 'pluggy': '0.13.1'}, 'Plugins': {u'repeat': u'0.9.1', u'ansible': u'2.2.2', u'xdist': u'1.28.0', u'html': u'1.22.1', u'forked': u'1.3.0', u'metadata': u'1.10.0'}}
ansible: 2.8.12
rootdir: /data/sonic-mgmt/tests, inifile: pytest.ini
plugins: metadata-1.10.0, forked-1.3.0, html-1.22.1, repeat-0.9.1, xdist-1.28.0, ansible-2.2.2
collected 7 items

snmp/test_snmp_interfaces.py::test_snmp_interface[vlab-07-0] PASSED [ 14%]
snmp/test_snmp_interfaces.py::test_snmp_mgmt_interface[vlab-07]
PASSED [28%]
snmp/test_snmp_interfaces.py::test_snmp_interface[vlab-07-1] PASSED [ 42%]
snmp/test_snmp_interfaces.py::test_snmp_interface[vlab-07-2] PASSED [ 57%]
snmp/test_snmp_interfaces.py::test_snmp_interface[vlab-07-3] PASSED [ 71%]
snmp/test_snmp_interfaces.py::test_snmp_interface[vlab-07-4] PASSED [ 85%]
snmp/test_snmp_interfaces.py::test_snmp_interface[vlab-07-5] PASSED [100%]

Any platform specific information?

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

Documentation

@@ -9,20 +9,30 @@ def test_snmp_interfaces(ansible_adhoc, duthost, creds):

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

npus = duthost.num_npus()
Copy link
Contributor

@qiluo-msft qiluo-msft May 1, 2020

Choose a reason for hiding this comment

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

num_npus [](start = 20, length = 8)

Is it working for single ASIC SKU? #Closed

# Verify all port channels in snmp interface list
for po_name in config_facts.get('PORTCHANNEL', {}):
assert po_name in snmp_ifnames

# Verify management port in snmp interface list
for name in config_facts.get('MGMT_INTERFACE', {}):
assert name in snmp_ifnames
Copy link
Contributor

@qiluo-msft qiluo-msft May 1, 2020

Choose a reason for hiding this comment

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

assert name in snmp_ifnames [](start = 8, length = 27)

You can add some string as second parameter for easy troubleshooting. ref: https://www.w3schools.com/python/ref_keyword_assert.asp #Closed

for po_name in config_facts.get('PORTCHANNEL', {}):
assert po_name in snmp_ifnames
else:
config_facts = duthost.config_facts(host=duthost.hostname, source="persistent")['ansible_facts']
Copy link
Contributor

@qiluo-msft qiluo-msft May 1, 2020

Choose a reason for hiding this comment

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

config_facts = duthost.config_facts(host=duthost.hostname, source="persistent")['ansible_facts'] [](start = 8, length = 97)

For single ASIC, you run this twice. #Closed

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

As comments

namespace for multi-asic testbed.
Add change to config_facts to retrieve port alias infomration
only if alias key exists in PORT table in config_db.

Signed-off-by: SuvarnaMeenakshi <[email protected]>
@SuvarnaMeenakshi SuvarnaMeenakshi requested a review from a team as a code owner February 4, 2021 01:14
@@ -6,26 +6,39 @@
]

@pytest.mark.bsl
def test_snmp_interfaces(duthosts, rand_one_dut_hostname, localhost, creds):
Copy link
Contributor

@qiluo-msft qiluo-msft Mar 2, 2021

Choose a reason for hiding this comment

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

test_snmp_interfaces [](start = 4, length = 20)

You changed function name, but it is used in several places already. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed function name to as it was before.

@SuvarnaMeenakshi SuvarnaMeenakshi merged commit 8306390 into sonic-net:master Mar 3, 2021
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.

2 participants