예제 #1
0
def test_randomFailure(downed_links):
    try:
        net = IPNet(topo=Topo())
        net.start()

        # Wait for OSPF convergence
        assert_connectivity(net, v6=False)
        assert_connectivity(net, v6=True)

        interface_down = net.randomFailure(downed_links)

        # Check a failure between both hosts
        assert_node_not_connected(src=net["h1"], dst=net["h2"], v6=False)
        assert_node_not_connected(src=net["h1"], dst=net["h2"], v6=True)

        net.restoreIntfs(interface_down)

        # Check link restoration
        assert_connectivity(net, v6=False)
        assert_connectivity(net, v6=True)
        net.stop()
    finally:
        cleanup()
예제 #2
0
def test_randomFailureOnTargetedLink():
    try:
        net = IPNet(topo=Topo())
        net.start()

        # Wait for OSPF convergence
        assert_connectivity(net, v6=False)
        assert_connectivity(net, v6=True)

        itfs = net.randomFailure(1,
                                 weak_links=[net["r1"].intf("r1-eth0").link])

        # Check a failure between both hosts
        assert_node_not_connected(src=net["h1"], dst=net["h2"], v6=False)
        assert_node_not_connected(src=net["h1"], dst=net["h2"], v6=True)

        net.restoreIntfs(itfs)

        # Check link restoration
        assert_connectivity(net, v6=False)
        assert_connectivity(net, v6=True)
        net.stop()
    finally:
        cleanup()
예제 #3
0
def test_failurePlan(plan):
    try:
        net = IPNet(topo=Topo())
        net.start()

        # Wait for OSPF convergence
        assert_connectivity(net, v6=False)
        assert_connectivity(net, v6=True)

        interface_down = net.runFailurePlan(plan)

        # Check failures
        for n1, n2 in plan:
            assert_node_not_connected(src=net[n1], dst=net[n2], v6=False)
            assert_node_not_connected(src=net[n1], dst=net[n2], v6=True)

        net.restoreIntfs(interface_down)

        # Check link restoration
        assert_connectivity(net, v6=False)
        assert_connectivity(net, v6=True)
        net.stop()
    finally:
        cleanup()