Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions tests/test_bgp_fact.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import pytest
from ansible_host import AnsibleHost

@pytest.fixture(scope="module", autouse=True)
def setup_check_topo(testbed):
if testbed['topo']['type'] == 'ptf':
pytest.skip('Unsupported topology')

def test_bgp_facts(ansible_adhoc, testbed,duthost):
"""compare the bgp facts between observed states and target state"""

Expand Down
4 changes: 4 additions & 0 deletions tests/test_bgp_speaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import requests
from ptf_runner import ptf_runner

@pytest.fixture(scope="module", autouse=True)
def setup_check_topo(testbed):
if testbed['topo']['type'] in ['t1', 'ptf']:
pytest.skip('Unsupported topology')

def generate_ips(num, prefix, exclude_ips):
"""
Expand Down
4 changes: 4 additions & 0 deletions tests/test_dhcp_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

from ptf_runner import ptf_runner

@pytest.fixture(scope="module", autouse=True)
def setup_check_topo(testbed):
if testbed['topo']['type'] in ['t1', 'ptf']:
pytest.skip('Unsupported topology')

@pytest.fixture(scope="module", autouse=True)
def copy_ptftests_directory(ptfhost):
Expand Down
5 changes: 5 additions & 0 deletions tests/test_vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
So, we prefer a fixture rather than xunit-style setup/teardown functions.
"""

@pytest.fixture(scope="module", autouse=True)
def setup_check_topo(testbed):
if testbed['topo']['name'] != 't0':
Copy link
Contributor

Choose a reason for hiding this comment

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

why use topo name here, not type?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because we meet setup error on t0-56 as below

>       g_vars['vrf_intfs'] = get_vrf_intfs(cfg_facts)

test_vrf.py:426:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cfg_facts = {'ACL_TABLE': {'DATAACL': {'policy_desc': 'DATAACL', 'ports': ['PortChannel0001', 'PortChannel0002', 'PortChannel0003'...BUFFER_POOL': {'ingress_lossy_pool': {'mode': 'dynamic', 'size': '32736769', 'type': 'ingress', 'xoff': '19457'}}, ...}

    def get_vrf_intfs(cfg_facts):
        intf_tables = ['INTERFACE', 'PORTCHANNEL_INTERFACE', 'VLAN_INTERFACE', 'LOOPBACK_INTERFACE']
        vrf_intfs = {}

        for table in intf_tables:
            for intf, attrs in cfg_facts.get(table, {}).iteritems():
                if '|' not in intf:
>                   vrf = attrs['vrf_name']
E                   KeyError: 'vrf_name'

test_vrf.py:115: KeyError

Copy link
Contributor

Choose a reason for hiding this comment

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

the test should be fixed to support t0-56. you can open an issue to ask support vrf support in t0-56. but we should have uniform rule to decide whether a test can or cannot be run on certain topology. otherwise, the maintenance cost is too high.

pytest.skip('Unsupported topology')
Copy link
Contributor

Choose a reason for hiding this comment

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

is this by design that vrf won't work for t0 topology?

Copy link
Contributor

Choose a reason for hiding this comment

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

Run vrf on t0 only.


# global variables
g_vars = {}

Expand Down
4 changes: 4 additions & 0 deletions tests/test_vrf_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
)
from ptf_runner import ptf_runner

@pytest.fixture(scope="module", autouse=True)
def setup_check_topo(testbed):
if testbed['topo']['name'] != 't0':
pytest.skip('Unsupported topology')

# tests
class TestVrfAttrSrcMac():
Expand Down