def test_config_changed(mock_module):
    """
    cl_interface - test config change
    """
    # no change
    mock_module.custom_desired_config = {
        "name": "swp1",
        "addr_method": None,
        "config": {"address": "10.1.1.1/24", "mtu": "9000"},
    }
    mock_module.custom_current_config = {
        "name": "swp1",
        "addr_method": None,
        "config": {"address": "10.1.1.1/24", "mtu": "9000"},
    }
    assert_equals(cl_int.config_changed(mock_module), False)
    # change
    mock_module.custom_desired_config = {
        "name": "swp1",
        "addr_method": None,
        "config": {"address": "10.1.1.2/24", "mtu": "9000"},
    }
    mock_module.custom_current_config = {
        "name": "swp1",
        "addr_method": None,
        "config": {"address": "10.1.1.1/24", "mtu": "9000"},
    }
    assert_equals(cl_int.config_changed(mock_module), True)
    # config hash has no changed, but  addr_method has changed
    mock_module.custom_desired_config = {"name": "swp1", "addr_method": "dhcp", "config": {"mtu": "9000"}}
    mock_module.custom_current_config = {"name": "swp1", "addr_method": None, "config": {"mtu": "9000"}}
    assert_equals(cl_int.config_changed(mock_module), True)
def test_config_changed(mock_module):
    """
    cl_interface - test config change
    """
    # no change
    mock_module.custom_desired_config = {
        'name': 'swp1',
        'addr_method': None,
        'config': {
            'address': '10.1.1.1/24',
            'mtu': '9000'
        }
    }
    mock_module.custom_current_config = {
        'name': 'swp1',
        'addr_method': None,
        'config': {
            'address': '10.1.1.1/24',
            'mtu': '9000'
        }
    }
    assert_equals(cl_int.config_changed(mock_module), False)
    # change
    mock_module.custom_desired_config = {
        'name': 'swp1',
        'addr_method': None,
        'config': {
            'address': '10.1.1.2/24',
            'mtu': '9000'
        }
    }
    mock_module.custom_current_config = {
        'name': 'swp1',
        'addr_method': None,
        'config': {
            'address': '10.1.1.1/24',
            'mtu': '9000'
        }
    }
    assert_equals(cl_int.config_changed(mock_module), True)
    # config hash has no changed, but  addr_method has changed
    mock_module.custom_desired_config = {
        'name': 'swp1',
        'addr_method': 'dhcp',
        'config': {
            'mtu': '9000'
        }
    }
    mock_module.custom_current_config = {
        'name': 'swp1',
        'addr_method': None,
        'config': {
            'mtu': '9000'
        }
    }
    assert_equals(cl_int.config_changed(mock_module), True)
def test_config_changed(mock_module):
    """
    cl_interface - test config change
    """
    # no change
    mock_module.custom_desired_config = {
        'name': 'swp1',
        'addr_method': None,
        'config':
        {'address': '10.1.1.1/24',
         'mtu': '9000'}
    }
    mock_module.custom_current_config = {
        'name': 'swp1',
        'addr_method': None,
        'config':
        {'address': '10.1.1.1/24',
         'mtu': '9000'}
    }
    assert_equals(cl_int.config_changed(mock_module), False)
    # change
    mock_module.custom_desired_config = {
        'name': 'swp1',
        'addr_method': None,
        'config':
        {'address': '10.1.1.2/24',
         'mtu': '9000'}
    }
    mock_module.custom_current_config = {
        'name': 'swp1',
        'addr_method': None,
        'config':
        {'address': '10.1.1.1/24',
         'mtu': '9000'}
    }
    assert_equals(cl_int.config_changed(mock_module), True)
    # config hash has no changed, but  addr_method has changed
    mock_module.custom_desired_config = {
        'name': 'swp1',
        'addr_method': 'dhcp',
        'config':
        {'mtu': '9000'}
    }
    mock_module.custom_current_config = {
        'name': 'swp1',
        'addr_method': None,
        'config':
        {'mtu': '9000'}
    }
    assert_equals(cl_int.config_changed(mock_module), True)