import pytest
from AutomationFramework.page_objects.interfaces.interfaces import Interfaces
from AutomationFramework.tests.base_test import BaseTest


class TestInterfacesSubInterfaces(BaseTest):
    test_case_file = 'if_subif.yml'

    @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file,
                                                         'test_case_name': 'if_subif_description',
                                                         'page_object_class': Interfaces}])
    def test_if_subif_description(self, create_page_object):
        create_page_object.execute_generic_interfaces_edit_config_test_case()
        assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description()

    @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file,
                                                         'test_case_name': 'if_subif_enabled',
                                                         'page_object_class': Interfaces}])
    def test_if_subif_enabled(self, create_page_object):
        create_page_object.execute_generic_interfaces_edit_config_test_case()
        assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description()

    @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file,
                                                         'test_case_name': 'if_subif_ip_prefix_length',
                                                         'page_object_class': Interfaces}])
    def test_if_subif_ip_prefix_length(self, create_page_object):
        create_page_object.execute_generic_interfaces_edit_config_test_case()
        assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description()

    @pytest.mark.parametrize('multiple_create_page_objects_arg', [{'test_case_file': test_case_file,
                                                                   'test_case_name': 'if_subif_ip_state',
                                                                   'page_object_rpcs_classes': [Interfaces, Interfaces],
                                                                   'rpc_clean_order': None,
                                                                   }])
    def test_if_subif_ip_state(self, multiple_create_page_objects):
        for page_object in multiple_create_page_objects:
            page_object.execute_interface_rpc()
            assert page_object.validate_rpc(), page_object.get_test_case_description()

    @pytest.mark.parametrize('multiple_create_page_objects_arg', [{'test_case_file': test_case_file,
                                                                   'test_case_name': 'if_subif_origin',
                                                                   'page_object_rpcs_classes': [Interfaces, Interfaces],
                                                                   'rpc_clean_order': None,
                                                                   }])
    def test_if_subif_origin(self, multiple_create_page_objects):
        for page_object in multiple_create_page_objects:
            page_object.execute_interface_rpc()
            assert page_object.validate_rpc(), page_object.get_test_case_description()

    @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file,
                                                         'test_case_name': 'if_subif_dhcp_client',
                                                         'page_object_class': Interfaces}])
    def test_if_subif_dhcp_client(self, create_page_object):
        create_page_object.execute_generic_interfaces_edit_config_test_case()
        assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description()

    @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file,
                                                         'test_case_name': 'if_subif_mtu',
                                                         'page_object_class': Interfaces}])
    def test_if_subif_mtu(self, create_page_object):
        create_page_object.execute_generic_interfaces_edit_config_test_case()
        assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description()

    @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file,
                                                         'test_case_name': 'if_subif_vlan_id',
                                                         'page_object_class': Interfaces}])
    def test_if_subif_vlan_id(self, create_page_object):
        create_page_object.execute_generic_interfaces_edit_config_test_case()
        assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description()

    @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file,
                                                         'test_case_name': 'if_subif_inner_outer_vlan_id',
                                                         'page_object_class': Interfaces}])
    def test_if_subif_inner_outer_vlan_id(self, create_page_object):
        create_page_object.execute_generic_interfaces_edit_config_test_case()
        assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description()

    @pytest.mark.parametrize('create_page_object_arg', [{'test_case_file': test_case_file,
                                                         'test_case_name': 'if_subif_match_vlan_id',
                                                         'page_object_class': Interfaces}])
    def test_if_subif_match_vlan_id(self, create_page_object):
        create_page_object.execute_generic_interfaces_edit_config_test_case()
        assert create_page_object.generic_validate_test_case_params(), create_page_object.get_test_case_description()

[((9, 5, 11, 91), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(9, 29, 9, 53): '"""create_page_object_arg"""', (9, 55, 11, 90): "[{'test_case_file': test_case_file, 'test_case_name':\n    'if_subif_description', 'page_object_class': Interfaces}]"}, {}), "('create_page_object_arg', [{'test_case_file':\n    test_case_file, 'test_case_name': 'if_subif_description',\n    'page_object_class': Interfaces}])", False, 'import pytest\n'), ((16, 5, 18, 91), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(16, 29, 16, 53): '"""create_page_object_arg"""', (16, 55, 18, 90): "[{'test_case_file': test_case_file, 'test_case_name': 'if_subif_enabled',\n    'page_object_class': Interfaces}]"}, {}), "('create_page_object_arg', [{'test_case_file':\n    test_case_file, 'test_case_name': 'if_subif_enabled',\n    'page_object_class': Interfaces}])", False, 'import pytest\n'), ((23, 5, 25, 91), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(23, 29, 23, 53): '"""create_page_object_arg"""', (23, 55, 25, 90): "[{'test_case_file': test_case_file, 'test_case_name':\n    'if_subif_ip_prefix_length', 'page_object_class': Interfaces}]"}, {}), "('create_page_object_arg', [{'test_case_file':\n    test_case_file, 'test_case_name': 'if_subif_ip_prefix_length',\n    'page_object_class': Interfaces}])", False, 'import pytest\n'), ((30, 5, 34, 70), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(30, 29, 30, 63): '"""multiple_create_page_objects_arg"""', (30, 65, 34, 69): "[{'test_case_file': test_case_file, 'test_case_name': 'if_subif_ip_state',\n    'page_object_rpcs_classes': [Interfaces, Interfaces], 'rpc_clean_order':\n    None}]"}, {}), "('multiple_create_page_objects_arg', [{\n    'test_case_file': test_case_file, 'test_case_name': 'if_subif_ip_state',\n    'page_object_rpcs_classes': [Interfaces, Interfaces], 'rpc_clean_order':\n    None}])", False, 'import pytest\n'), ((40, 5, 44, 70), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(40, 29, 40, 63): '"""multiple_create_page_objects_arg"""', (40, 65, 44, 69): "[{'test_case_file': test_case_file, 'test_case_name': 'if_subif_origin',\n    'page_object_rpcs_classes': [Interfaces, Interfaces], 'rpc_clean_order':\n    None}]"}, {}), "('multiple_create_page_objects_arg', [{\n    'test_case_file': test_case_file, 'test_case_name': 'if_subif_origin',\n    'page_object_rpcs_classes': [Interfaces, Interfaces], 'rpc_clean_order':\n    None}])", False, 'import pytest\n'), ((50, 5, 52, 91), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(50, 29, 50, 53): '"""create_page_object_arg"""', (50, 55, 52, 90): "[{'test_case_file': test_case_file, 'test_case_name':\n    'if_subif_dhcp_client', 'page_object_class': Interfaces}]"}, {}), "('create_page_object_arg', [{'test_case_file':\n    test_case_file, 'test_case_name': 'if_subif_dhcp_client',\n    'page_object_class': Interfaces}])", False, 'import pytest\n'), ((57, 5, 59, 91), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(57, 29, 57, 53): '"""create_page_object_arg"""', (57, 55, 59, 90): "[{'test_case_file': test_case_file, 'test_case_name': 'if_subif_mtu',\n    'page_object_class': Interfaces}]"}, {}), "('create_page_object_arg', [{'test_case_file':\n    test_case_file, 'test_case_name': 'if_subif_mtu', 'page_object_class':\n    Interfaces}])", False, 'import pytest\n'), ((64, 5, 66, 91), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(64, 29, 64, 53): '"""create_page_object_arg"""', (64, 55, 66, 90): "[{'test_case_file': test_case_file, 'test_case_name': 'if_subif_vlan_id',\n    'page_object_class': Interfaces}]"}, {}), "('create_page_object_arg', [{'test_case_file':\n    test_case_file, 'test_case_name': 'if_subif_vlan_id',\n    'page_object_class': Interfaces}])", False, 'import pytest\n'), ((71, 5, 73, 91), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(71, 29, 71, 53): '"""create_page_object_arg"""', (71, 55, 73, 90): "[{'test_case_file': test_case_file, 'test_case_name':\n    'if_subif_inner_outer_vlan_id', 'page_object_class': Interfaces}]"}, {}), "('create_page_object_arg', [{'test_case_file':\n    test_case_file, 'test_case_name': 'if_subif_inner_outer_vlan_id',\n    'page_object_class': Interfaces}])", False, 'import pytest\n'), ((78, 5, 80, 91), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(78, 29, 78, 53): '"""create_page_object_arg"""', (78, 55, 80, 90): "[{'test_case_file': test_case_file, 'test_case_name':\n    'if_subif_match_vlan_id', 'page_object_class': Interfaces}]"}, {}), "('create_page_object_arg', [{'test_case_file':\n    test_case_file, 'test_case_name': 'if_subif_match_vlan_id',\n    'page_object_class': Interfaces}])", False, 'import pytest\n')]