How to use SoL - 10 common examples

To help you get started, we’ve selected a few SoL examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_cutoffs():
    t = generateCompleteTopology(8)
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100)
    assert len(pptc) > 20
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 1)
    assert len(pptc) == 1
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2)
    assert len(pptc) == 7
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100, maxPaths=4)
    assert len(pptc) == 4
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
"""
    Check that one path is found on chain topology
    """
    chaintopo = generateChainTopology(5)
    for sink in xrange(1, 5):
        pptc = generatePathsPerIE(0, sink, chaintopo, nullPredicate, cutoff=100)
        print pptc
        assert len(pptc) == 1

    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, lambda p, t: False, 100)

    chaintopo.getGraph().remove_edge(1, 2)
    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, nullPredicate, 100)
    assert len(generatePathsPerIE(0, 4, chaintopo, nullPredicate, cutoff=100,
                                  raiseOnEmpty=False)) == 0
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_simple():
    """
    Check that one path is found on chain topology
    """
    chaintopo = generateChainTopology(5)
    for sink in xrange(1, 5):
        pptc = generatePathsPerIE(0, sink, chaintopo, nullPredicate, cutoff=100)
        print pptc
        assert len(pptc) == 1

    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, lambda p, t: False, 100)

    chaintopo.getGraph().remove_edge(1, 2)
    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, nullPredicate, 100)
    assert len(generatePathsPerIE(0, 4, chaintopo, nullPredicate, cutoff=100,
                                  raiseOnEmpty=False)) == 0
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_mbox():
    t = generateCompleteTopology(8)

    # noinspection PyUnusedLocal
    def mbox(path, topology):
        return [PathWithMbox(path, [n]) for n in path]

    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2,
                              modifyFunc=mbox)
    assert len(pptc) == 20

    t.setMbox(1)
    t.setMbox(3)
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2,
                              modifyFunc=useMboxModifier)
    assert len(pptc) == 14
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_cutoffs():
    t = generateCompleteTopology(8)
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100)
    assert len(pptc) > 20
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 1)
    assert len(pptc) == 1
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2)
    assert len(pptc) == 7
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100, maxPaths=4)
    assert len(pptc) == 4
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_cutoffs():
    t = generateCompleteTopology(8)
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100)
    assert len(pptc) > 20
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 1)
    assert len(pptc) == 1
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2)
    assert len(pptc) == 7
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100, maxPaths=4)
    assert len(pptc) == 4
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_simple():
    """
    Check that one path is found on chain topology
    """
    chaintopo = generateChainTopology(5)
    for sink in xrange(1, 5):
        pptc = generatePathsPerIE(0, sink, chaintopo, nullPredicate, cutoff=100)
        print pptc
        assert len(pptc) == 1

    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, lambda p, t: False, 100)

    chaintopo.getGraph().remove_edge(1, 2)
    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, nullPredicate, 100)
    assert len(generatePathsPerIE(0, 4, chaintopo, nullPredicate, cutoff=100,
                                  raiseOnEmpty=False)) == 0
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_simple():
    """
    Check that one path is found on chain topology
    """
    chaintopo = generateChainTopology(5)
    for sink in xrange(1, 5):
        pptc = generatePathsPerIE(0, sink, chaintopo, nullPredicate, cutoff=100)
        print pptc
        assert len(pptc) == 1

    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, lambda p, t: False, 100)

    chaintopo.getGraph().remove_edge(1, 2)
    with pytest.raises(NoPathsException):
        generatePathsPerIE(0, 4, chaintopo, nullPredicate, 100)
    assert len(generatePathsPerIE(0, 4, chaintopo, nullPredicate, cutoff=100,
                                  raiseOnEmpty=False)) == 0
github progwriter / SOL / test / sol / optimization / path / test_generation.py View on Github external
def test_pathgen_cutoffs():
    t = generateCompleteTopology(8)
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100)
    assert len(pptc) > 20
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 1)
    assert len(pptc) == 1
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 2)
    assert len(pptc) == 7
    pptc = generatePathsPerIE(1, 3, t, nullPredicate, 100, maxPaths=4)
    assert len(pptc) == 4
github progwriter / SOL / test / sol / opt / fixtures.py View on Github external
def mock_min_latency_app(topo):
    """
    Return a simple mock min latency app with a single traffic class.
    The traffic class will be between two randomly chosen nodes
    """
    # Application configuration
    appconfig = {
        'name': u'mockminLatencyApp',
        'constraints': [ALLOCATE_FLOW, ROUTE_ALL],
        'obj': OBJ_MIN_LATENCY,
        'predicate': null_predicate,
        'resource_cost': {RES_BANDWIDTH: 100}
    }

    # Create an application based on our config
    app = App(_get_pptc(topo, appconfig), **appconfig)
    return app