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

[sub intf] Update vs tests to validate physical port host interface vlan tag attribute #1634

Merged
merged 7 commits into from
Feb 17, 2021

Conversation

wendani
Copy link
Contributor

@wendani wendani commented Feb 11, 2021

What I did

Why I did it
vs test update to cover changes in #1573

How I verified it
vs test:

Without #1573, vs tests on sub interface creation and removal fail

Physical parent port:

sub interface creation
====================================================================== test session starts ======================================================================
platform linux -- Python 3.6.9, pytest-6.1.2, py-1.9.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /var/wendani/src/sonic-buildimage/src/sonic-swss/tests
plugins: flaky-3.7.0
collected 1 item                                                                                                                                                

test_sub_port_intf.py::TestSubPortIntf::test_sub_port_intf_creation remove extra link PortChannel1
remove extra link dummy
FAILED

=========================================================================== FAILURES ============================================================================
__________________________________________________________ TestSubPortIntf.test_sub_port_intf_creation __________________________________________________________

self = <test_sub_port_intf.TestSubPortIntf object at 0x7f4e5d63cb00>, dvs = <conftest.DockerVirtualSwitch object at 0x7f4e5d5670f0>

    def test_sub_port_intf_creation(self, dvs):
        self.connect_dbs(dvs)
    
>       self._test_sub_port_intf_creation(dvs, self.SUB_PORT_INTERFACE_UNDER_TEST)

test_sub_port_intf.py:258: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_sub_port_intf.py:245: in _test_sub_port_intf_creation
    self.check_sub_port_intf_fvs(self.asic_db, ASIC_HOSTIF_TABLE, hostif_oid, fv_dict)
test_sub_port_intf.py:167: in check_sub_port_intf_fvs
    db.wait_for_field_match(table_name, key, fv_dict)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <dvslib.dvs_database.DVSDatabase object at 0x7f4e5d640198>, table_name = 'ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF', key = 'oid:0xd00000000059e'
expected_fields = {'SAI_HOSTIF_ATTR_VLAN_TAG': 'SAI_HOSTIF_VLAN_TAG_KEEP'}, polling_config = PollingConfig(polling_interval=0.01, timeout=5.0, strict=True)
failure_message = None

    def wait_for_field_match(
        self,
        table_name: str,
        key: str,
        expected_fields: Dict[str, str],
        polling_config: PollingConfig = PollingConfig(),
        failure_message: str = None,
    ) -> Dict[str, str]:
        """Wait for the entry stored at `key` to have the specified field/values and retrieve it.
    
        This method is useful if you only care about the contents of a subset of the fields stored
        in the specified entry.
    
        Args:
            table_name: The name of the table where the entry is stored.
            key: The key that maps to the entry being checked.
            expected_fields: The fields and their values we expect to see in the entry.
            polling_config: The parameters to use to poll the db.
            failure_message: The message to print if the call times out. This will only take effect
                if the PollingConfig is set to strict.
    
        Returns:
            The entry stored at `key`. If no entry is found, then an empty Dict is returned.
        """
    
        def access_function():
            fv_pairs = self.get_entry(table_name, key)
            return (
                all(fv_pairs.get(k) == v for k, v in expected_fields.items()),
                fv_pairs,
            )
    
        status, result = wait_for_result(
            access_function, self._disable_strict_polling(polling_config)
        )
    
        if not status:
            message = failure_message or (
                f"Expected field/value pairs not found: expected={expected_fields}, "
                f'received={result}, key="{key}", table="{table_name}"'
            )
>           assert not polling_config.strict, message
E           AssertionError: Expected field/value pairs not found: expected={'SAI_HOSTIF_ATTR_VLAN_TAG': 'SAI_HOSTIF_VLAN_TAG_KEEP'}, received={'SAI_HOSTIF_ATTR_TYPE': 'SAI_HOSTIF_TYPE_NETDEV', 'SAI_HOSTIF_ATTR_OBJ_ID': 'oid:0x1000000000012', 'SAI_HOSTIF_ATTR_NAME': 'Ethernet64', 'SAI_HOSTIF_ATTR_OPER_STATUS': 'true'}, key="oid:0xd00000000059e", table="ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF"

dvslib/dvs_database.py:203: AssertionError
==================================================================== short test summary info ====================================================================
FAILED test_sub_port_intf.py::TestSubPortIntf::test_sub_port_intf_creation - AssertionError: Expected field/value pairs not found: expected={'SAI_HOSTIF_ATTR_...
================================================================= 1 failed in 62.62s (0:01:02) ==================================================================
sub interface removal
====================================================================== test session starts ======================================================================
platform linux -- Python 3.6.9, pytest-6.1.2, py-1.9.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /var/wendani/src/sonic-buildimage/src/sonic-swss/tests
plugins: flaky-3.7.0
collected 1 item                                                                                                                                                

test_sub_port_intf.py::TestSubPortIntf::test_sub_port_intf_removal remove extra link dummy
FAILED

=========================================================================== FAILURES ============================================================================
__________________________________________________________ TestSubPortIntf.test_sub_port_intf_removal ___________________________________________________________

self = <test_sub_port_intf.TestSubPortIntf object at 0x7f11468beeb8>, dvs = <conftest.DockerVirtualSwitch object at 0x7f11468c80f0>

    def test_sub_port_intf_removal(self, dvs):
        self.connect_dbs(dvs)
    
>       self._test_sub_port_intf_removal(dvs, self.SUB_PORT_INTERFACE_UNDER_TEST)

test_sub_port_intf.py:524: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_sub_port_intf.py:515: in _test_sub_port_intf_removal
    self.check_sub_port_intf_fvs(self.asic_db, ASIC_HOSTIF_TABLE, hostif_oid, fv_dict)
test_sub_port_intf.py:167: in check_sub_port_intf_fvs
    db.wait_for_field_match(table_name, key, fv_dict)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <dvslib.dvs_database.DVSDatabase object at 0x7f11468484e0>, table_name = 'ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF', key = 'oid:0xd00000000059e'
expected_fields = {'SAI_HOSTIF_ATTR_VLAN_TAG': 'SAI_HOSTIF_VLAN_TAG_STRIP'}, polling_config = PollingConfig(polling_interval=0.01, timeout=5.0, strict=True)
failure_message = None

    def wait_for_field_match(
        self,
        table_name: str,
        key: str,
        expected_fields: Dict[str, str],
        polling_config: PollingConfig = PollingConfig(),
        failure_message: str = None,
    ) -> Dict[str, str]:
        """Wait for the entry stored at `key` to have the specified field/values and retrieve it.
    
        This method is useful if you only care about the contents of a subset of the fields stored
        in the specified entry.
    
        Args:
            table_name: The name of the table where the entry is stored.
            key: The key that maps to the entry being checked.
            expected_fields: The fields and their values we expect to see in the entry.
            polling_config: The parameters to use to poll the db.
            failure_message: The message to print if the call times out. This will only take effect
                if the PollingConfig is set to strict.
    
        Returns:
            The entry stored at `key`. If no entry is found, then an empty Dict is returned.
        """
    
        def access_function():
            fv_pairs = self.get_entry(table_name, key)
            return (
                all(fv_pairs.get(k) == v for k, v in expected_fields.items()),
                fv_pairs,
            )
    
        status, result = wait_for_result(
            access_function, self._disable_strict_polling(polling_config)
        )
    
        if not status:
            message = failure_message or (
                f"Expected field/value pairs not found: expected={expected_fields}, "
                f'received={result}, key="{key}", table="{table_name}"'
            )
>           assert not polling_config.strict, message
E           AssertionError: Expected field/value pairs not found: expected={'SAI_HOSTIF_ATTR_VLAN_TAG': 'SAI_HOSTIF_VLAN_TAG_STRIP'}, received={'SAI_HOSTIF_ATTR_TYPE': 'SAI_HOSTIF_TYPE_NETDEV', 'SAI_HOSTIF_ATTR_OBJ_ID': 'oid:0x1000000000012', 'SAI_HOSTIF_ATTR_NAME': 'Ethernet64', 'SAI_HOSTIF_ATTR_OPER_STATUS': 'true'}, key="oid:0xd00000000059e", table="ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF"

dvslib/dvs_database.py:203: AssertionError
==================================================================== short test summary info ====================================================================
FAILED test_sub_port_intf.py::TestSubPortIntf::test_sub_port_intf_removal - AssertionError: Expected field/value pairs not found: expected={'SAI_HOSTIF_ATTR_V...
================================================================= 1 failed in 62.89s (0:01:02) ==================================================================

Lag parent port

sub interface creation
====================================================================== test session starts ======================================================================
platform linux -- Python 3.6.9, pytest-6.1.2, py-1.9.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /var/wendani/src/sonic-buildimage/src/sonic-swss/tests
plugins: flaky-3.7.0
collected 1 item                                                                                                                                                

test_sub_port_intf.py::TestSubPortIntf::test_sub_port_intf_creation remove extra link PortChannel1
remove extra link dummy
FAILED

=========================================================================== FAILURES ============================================================================
__________________________________________________________ TestSubPortIntf.test_sub_port_intf_creation __________________________________________________________

self = <test_sub_port_intf.TestSubPortIntf object at 0x7f00297710b8>, dvs = <conftest.DockerVirtualSwitch object at 0x7f00297714a8>

    def test_sub_port_intf_creation(self, dvs):
        self.connect_dbs(dvs)
    
        #self._test_sub_port_intf_creation(dvs, self.SUB_PORT_INTERFACE_UNDER_TEST)
>       self._test_sub_port_intf_creation(dvs, self.LAG_SUB_PORT_INTERFACE_UNDER_TEST)

test_sub_port_intf.py:261: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_sub_port_intf.py:247: in _test_sub_port_intf_creation
    self.check_sub_port_intf_fvs(self.asic_db, ASIC_HOSTIF_TABLE, hostif_oid, fv_dict)
test_sub_port_intf.py:169: in check_sub_port_intf_fvs
    db.wait_for_field_match(table_name, key, fv_dict)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <dvslib.dvs_database.DVSDatabase object at 0x7f0029858f28>, table_name = 'ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF', key = 'oid:0xd00000000059d'
expected_fields = {'SAI_HOSTIF_ATTR_VLAN_TAG': 'SAI_HOSTIF_VLAN_TAG_KEEP'}, polling_config = PollingConfig(polling_interval=0.01, timeout=5.0, strict=True)
failure_message = None

    def wait_for_field_match(
        self,
        table_name: str,
        key: str,
        expected_fields: Dict[str, str],
        polling_config: PollingConfig = PollingConfig(),
        failure_message: str = None,
    ) -> Dict[str, str]:
        """Wait for the entry stored at `key` to have the specified field/values and retrieve it.
    
        This method is useful if you only care about the contents of a subset of the fields stored
        in the specified entry.
    
        Args:
            table_name: The name of the table where the entry is stored.
            key: The key that maps to the entry being checked.
            expected_fields: The fields and their values we expect to see in the entry.
            polling_config: The parameters to use to poll the db.
            failure_message: The message to print if the call times out. This will only take effect
                if the PollingConfig is set to strict.
    
        Returns:
            The entry stored at `key`. If no entry is found, then an empty Dict is returned.
        """
    
        def access_function():
            fv_pairs = self.get_entry(table_name, key)
            return (
                all(fv_pairs.get(k) == v for k, v in expected_fields.items()),
                fv_pairs,
            )
    
        status, result = wait_for_result(
            access_function, self._disable_strict_polling(polling_config)
        )
    
        if not status:
            message = failure_message or (
                f"Expected field/value pairs not found: expected={expected_fields}, "
                f'received={result}, key="{key}", table="{table_name}"'
            )
>           assert not polling_config.strict, message
E           AssertionError: Expected field/value pairs not found: expected={'SAI_HOSTIF_ATTR_VLAN_TAG': 'SAI_HOSTIF_VLAN_TAG_KEEP'}, received={'SAI_HOSTIF_ATTR_TYPE': 'SAI_HOSTIF_TYPE_NETDEV', 'SAI_HOSTIF_ATTR_OBJ_ID': 'oid:0x1000000000013', 'SAI_HOSTIF_ATTR_NAME': 'Ethernet68', 'SAI_HOSTIF_ATTR_OPER_STATUS': 'false'}, key="oid:0xd00000000059d", table="ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF"

dvslib/dvs_database.py:203: AssertionError
==================================================================== short test summary info ====================================================================
FAILED test_sub_port_intf.py::TestSubPortIntf::test_sub_port_intf_creation - AssertionError: Expected field/value pairs not found: expected={'SAI_HOSTIF_ATTR_...
================================================================= 1 failed in 62.00s (0:01:02) ==================================================================
sub interface removal
====================================================================== test session starts ======================================================================
platform linux -- Python 3.6.9, pytest-6.1.2, py-1.9.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /var/wendani/src/sonic-buildimage/src/sonic-swss/tests
plugins: flaky-3.7.0
collected 1 item                                                                                                                                                

test_sub_port_intf.py::TestSubPortIntf::test_sub_port_intf_removal remove extra link PortChannel1
remove extra link PortChannel1.20@PortChannel1
remove extra link dummy
FAILED

=========================================================================== FAILURES ============================================================================
__________________________________________________________ TestSubPortIntf.test_sub_port_intf_removal ___________________________________________________________

self = <test_sub_port_intf.TestSubPortIntf object at 0x7f13746c2eb8>, dvs = <conftest.DockerVirtualSwitch object at 0x7f13746b26d8>

    def test_sub_port_intf_removal(self, dvs):
        self.connect_dbs(dvs)
    
        #self._test_sub_port_intf_removal(dvs, self.SUB_PORT_INTERFACE_UNDER_TEST)
>       self._test_sub_port_intf_removal(dvs, self.LAG_SUB_PORT_INTERFACE_UNDER_TEST)

test_sub_port_intf.py:527: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_sub_port_intf.py:517: in _test_sub_port_intf_removal
    self.check_sub_port_intf_fvs(self.asic_db, ASIC_HOSTIF_TABLE, hostif_oid, fv_dict)
test_sub_port_intf.py:169: in check_sub_port_intf_fvs
    db.wait_for_field_match(table_name, key, fv_dict)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <dvslib.dvs_database.DVSDatabase object at 0x7f13745ee6a0>, table_name = 'ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF', key = 'oid:0xd00000000059d'
expected_fields = {'SAI_HOSTIF_ATTR_VLAN_TAG': 'SAI_HOSTIF_VLAN_TAG_STRIP'}, polling_config = PollingConfig(polling_interval=0.01, timeout=5.0, strict=True)
failure_message = None

    def wait_for_field_match(
        self,
        table_name: str,
        key: str,
        expected_fields: Dict[str, str],
        polling_config: PollingConfig = PollingConfig(),
        failure_message: str = None,
    ) -> Dict[str, str]:
        """Wait for the entry stored at `key` to have the specified field/values and retrieve it.
    
        This method is useful if you only care about the contents of a subset of the fields stored
        in the specified entry.
    
        Args:
            table_name: The name of the table where the entry is stored.
            key: The key that maps to the entry being checked.
            expected_fields: The fields and their values we expect to see in the entry.
            polling_config: The parameters to use to poll the db.
            failure_message: The message to print if the call times out. This will only take effect
                if the PollingConfig is set to strict.
    
        Returns:
            The entry stored at `key`. If no entry is found, then an empty Dict is returned.
        """
    
        def access_function():
            fv_pairs = self.get_entry(table_name, key)
            return (
                all(fv_pairs.get(k) == v for k, v in expected_fields.items()),
                fv_pairs,
            )
    
        status, result = wait_for_result(
            access_function, self._disable_strict_polling(polling_config)
        )
    
        if not status:
            message = failure_message or (
                f"Expected field/value pairs not found: expected={expected_fields}, "
                f'received={result}, key="{key}", table="{table_name}"'
            )
>           assert not polling_config.strict, message
E           AssertionError: Expected field/value pairs not found: expected={'SAI_HOSTIF_ATTR_VLAN_TAG': 'SAI_HOSTIF_VLAN_TAG_STRIP'}, received={'SAI_HOSTIF_ATTR_TYPE': 'SAI_HOSTIF_TYPE_NETDEV', 'SAI_HOSTIF_ATTR_OBJ_ID': 'oid:0x1000000000013', 'SAI_HOSTIF_ATTR_NAME': 'Ethernet68', 'SAI_HOSTIF_ATTR_OPER_STATUS': 'false'}, key="oid:0xd00000000059d", table="ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF"

dvslib/dvs_database.py:203: AssertionError
==================================================================== short test summary info ====================================================================
FAILED test_sub_port_intf.py::TestSubPortIntf::test_sub_port_intf_removal - AssertionError: Expected field/value pairs not found: expected={'SAI_HOSTIF_ATTR_V...
================================================================= 1 failed in 62.04s (0:01:02) ==================================================================

Details if related

wendani and others added 7 commits February 10, 2021 04:06
Signed-off-by: Wenda Ni <wonda.ni@gmail.com>
Signed-off-by: Wenda Ni <wonda.ni@gmail.com>
Signed-off-by: Wenda Ni <wonda.ni@gmail.com>
Signed-off-by: Wenda Ni <wonda.ni@gmail.com>
Signed-off-by: Wenda Ni <wonda.ni@gmail.com>
@lguohan lguohan merged commit c49668e into sonic-net:master Feb 17, 2021
DavidZagury pushed a commit to DavidZagury/sonic-swss that referenced this pull request Mar 4, 2021
…face vlan tag attribute (sonic-net#1634)

* Check vlan tag attribute for parent port being physical port

Signed-off-by: Wenda Ni <wonda.ni@gmail.com>
daall pushed a commit that referenced this pull request Apr 22, 2021
…face vlan tag attribute (#1634)

* Check vlan tag attribute for parent port being physical port

Signed-off-by: Wenda Ni <wonda.ni@gmail.com>
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
…face vlan tag attribute (sonic-net#1634)

* Check vlan tag attribute for parent port being physical port

Signed-off-by: Wenda Ni <wonda.ni@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants