How to use the sol.topology.generators.complete_topology function in SoL

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 / opt / fixtures.py View on Github external
def mock_topo():
    """
    Returns a complete topology with 5 nodes. No middleboxes or link capacities
    are configured

    :return: a new :py:class:`~sol.topology.topologynx.Topology`
    """
    return complete_topology(5)
github progwriter / SOL / old_examples / MaxFlowWithONOS.py View on Github external
def MaxFlow():
    # ==============
    # Let's generate some example data; SOL has some functions to help with that.
    # ==============
    # A complete topology
    topo = complete_topology(5)
    # ingress-egress pairs, between which the traffic will flow
    iePairs = [(0, 3)]
    # generate a traffic matrix, in this case, a uniform traffic matrix with a million flows
    trafficMatrix = provisioning.uniformTM(
        iePairs, 10 ** 6)
    # compute traffic classes. We will only have one class that encompasses all the traffic;
    # assume that each flow consumes 2000 units of bandwidth
    trafficClasses = generateTrafficClasses(iePairs, trafficMatrix, {'allTraffic': 1},
                                            {'allTraffic': 2000})
    # since our topology is "fake", provision our links and generate link capacities in our network
    linkcaps = provisioning.provision_links(topo, trafficClasses, 1)
    # these will be our link constraints: do not load links more than 50%
    linkConstrCaps = {(u, v): .5 for u, v in topo.links()}

    # ==============
    # Optimization
github progwriter / SOL / examples / singleapp.py View on Github external
# coding=utf-8

from sol.opt.quickstart import from_app
from sol.opt.app import App
from sol.path.generate import generate_paths_tc
from sol.path.predicates import null_predicate
from sol.topology.generators import complete_topology
from sol.topology.traffic import TrafficClass
from sol.utils.const import *

if __name__ == '__main__':

    # Generate a topology:
    topo = complete_topology(5)  # 5 nodes

    # Application configuration
    appconfig = {
        'name': u'minLatencyApp',
        'constraints': [ALLOCATE_FLOW, ROUTE_ALL],
        'obj': OBJ_MIN_LATENCY,
        'predicate': null_predicate,
        'resource_cost': {BANDWIDTH: 100}
    }

    # Generate a single traffic class:
    # TrafficClass (id, name, source node, destination node)
    # For now don't worry about IP addresses.
    tc = [TrafficClass(1, u'classname', 0, 4)]
    # Generate all paths for this traffic class
    pptc = generate_paths_tc(topo, tc, appconfig['predicate'],
github progwriter / SOL / old_examples / MaxFlow.py View on Github external
def MaxFlow():
    # ==============
    # Let's generate some example data; SOL has some functions to help with that.
    # ==============
    # A complete topology
    topo = complete_topology(5)
    # ingress-egress pairs, between which the traffic will flow
    iePairs = [(0, 3)]
    # generate a traffic matrix, in this case, a uniform traffic matrix with a million flows
    trafficMatrix = provisioning.uniformTM(
        iePairs, 10 ** 6)
    # compute traffic classes. We will only have one class that encompasses all the traffic;
    # assume that each flow consumes 2000 units of bandwidth
    trafficClasses = generateTrafficClasses(iePairs, trafficMatrix, {'allTraffic': 1},
                                            {'allTraffic': 2000})
    # since our topology is "fake", provision our links and generate link capacities in our network
    linkcaps = provisioning.provision_links(topo, trafficClasses, 1)
    # these will be our link constraints: do not load links more than 50%
    linkConstrCaps = {(u, v): .5 for u, v in topo.links()}

    # ==============
    # Optimization