Exemple #1
0
def test_add_two_interfaces_on_same_cd(default_device: Machine):
    default_device.add_interface(Link(default_device.lab, "A"))
    with pytest.raises(MachineCollisionDomainConflictError):
        default_device.add_interface(Link(default_device.lab, "A"))
def default_link():
    from src.Kathara.model.Link import Link
    return Link(Lab("default_scenario"), "A")
Exemple #3
0
def test_add_interface_exception(default_device: Machine):
    default_device.add_interface(Link(default_device.lab, "A"))
    with pytest.raises(Exception):
        default_device.add_interface(Link(default_device.lab, "B"), number=0)
Exemple #4
0
def test_add_interface(default_device: Machine):
    default_device.add_interface(Link(default_device.lab, "A"))
    assert len(default_device.interfaces) == 1
    assert default_device.interfaces[0].name == "A"
Exemple #5
0
def test_check_exception(default_device: Machine):
    default_device.add_interface(Link(default_device.lab, "A"), number=2)
    default_device.add_interface(Link(default_device.lab, "B"), number=4)
    with pytest.raises(NonSequentialMachineInterfaceError):
        default_device.check()
Exemple #6
0
def test_check(default_device: Machine):
    default_device.add_interface(Link(default_device.lab, "A"), number=0)
    default_device.add_interface(Link(default_device.lab, "B"), number=1)
    default_device.check()
Exemple #7
0
def default_link_b(default_device):
    link = Link(default_device.lab, "B")
    link.api_object = Mock()
    link.api_object.connect = Mock(return_value=True)
    return link