Example #1
0
def test__parse_settings_eth_hwaddr_and_macaddr():
    """
    Test that an AttributeError is thrown when hwaddr and macaddr are
    passed together. They cannot be used together
    """
    opts = {"hwaddr": 1, "macaddr": 2}

    with pytest.raises(AttributeError):
        suse_ip._parse_settings_eth(opts=opts,
                                    iface_type="eth",
                                    enabled=True,
                                    iface="eth0")
Example #2
0
def test__parse_settings_eth_macaddr():
    """
    Make sure macaddr gets added when parsing opts
    """
    opts = {"macaddr": "AA:BB:CC:11:22:33"}
    with patch.dict(suse_ip.__salt__, {"network.interfaces": MagicMock()}):
        results = suse_ip._parse_settings_eth(opts=opts,
                                              iface_type="eth",
                                              enabled=True,
                                              iface="eth0")
    assert "macaddr" in results
    assert results["macaddr"] == opts["macaddr"]
Example #3
0
def test__parse_settings_eth_ethtool_channels():
    """
    Make sure channels gets added when parsing opts
    """
    opts = {"channels": {"rx": 4, "tx": 4, "combined": 4, "other": 4}}
    with patch.dict(suse_ip.__grains__, {"num_cpus": 4}), patch.dict(
            suse_ip.__salt__, {"network.interfaces": MagicMock()}):
        results = suse_ip._parse_settings_eth(opts=opts,
                                              iface_type="eth",
                                              enabled=True,
                                              iface="eth0")
    assert "ethtool" in results
    assert results["ethtool"] == "-L eth0 rx 4 tx 4 other 4 combined 4"