Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/snmp/test_snmp_lldp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import pytest
from ansible_host import AnsibleHost

@pytest.fixture(scope="module", autouse=True)
def setup_check_topo(testbed):
if testbed['topo']['name'] in ('ptf32','ptf64'):
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 is difficult to maintain. we should at least define a function get_testbed_type(), and only three type should be returned t1, t0, and ptf.

Copy link
Copy Markdown
Contributor Author

@EmmaLin11 EmmaLin11 Mar 23, 2020

Choose a reason for hiding this comment

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

@lguohan , I get it. I defined get_testbed_type() for it. But I have some questions. What is the type of this function? It's a common function? If yes, where should I define this function? Could you give me some advice? Thanks.

Copy link
Copy Markdown
Collaborator

@wangxin wangxin Mar 23, 2020

Choose a reason for hiding this comment

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

Would you please consider adding a field to the object created in class TestbddInfo which is defined in tests/conftest.py. For example:

class TestbedInfo(object):
    ...

def __init__(self, testbed_file):
    ...
    line['topo']['type'] = self.get_testbed_type()

def get_testbed_type(self):
    ...

Then in test scripts, you can access it using testbed['topo']['type'].

Copy link
Copy Markdown
Contributor Author

@EmmaLin11 EmmaLin11 Mar 24, 2020

Choose a reason for hiding this comment

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

@wangxin , thank you for your advice. I added a field 'type' to the object created in class TestbddInfo which is defined in tests/conftest.py to identify testbed type. Could you please review it?

pytest.skip('Unsupported topology')

@pytest.mark.bsl
def test_snmp_lldp(ansible_adhoc, testbed, creds):
"""
Expand Down