def test_verification():
    graph = Topology().nx_graph()
    graph.remove_edges_from([(101,102),(103,104),(105,106)])
    policy = shortest_path_policy(graph)

    # Induce a loop
    conf = policy.get_configuration(106)
    conf.rules.insert(0,Rule({DL_TYPE:0x800},[forward(graph.node[106]['ports'][105])]))

    # Verify no loops -- should return false
    model = verification.KripkeModel(graph, policy)
    result,msg = model.verify(verification.NO_LOOPS)
    if not result:
        send_signal('SUCCESS - loop detected.\n')
    else:
        send_signal('FAILURE - loop not detected.\n%s\n' % msg)
    return
def topology1():
    graph = Topology().nx_graph()
    graph.remove_nodes_from([3,5])
    graph.remove_edges_from([(101,103),(103,104),(104,106)])
    return graph
def topology3():
    graph = Topology().nx_graph()
    graph.remove_edges_from([(101,102),(103,104),(105,106)])
    policy = shortest_path_policy(graph, graph.hosts())
    return graph