Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from sol.opt.formulation.funcs import defaultLinkFuncNoNormalize
from sol.opt.topology import generators
from sol.opt.topology import provisioning
from sol.opt.topology.provisioning import generateTrafficClasses
from sol.path import chooserand
from sol.path import generatePathsPerTrafficClass
from sol.path import useMboxModifier
if __name__ == '__main__':
# Let's create a topology first, as an example
# ============================================
topo = generators.extractTopo()
# label our switches
generators.forceSwitchLabels(topo)
# For the sake of example, set middleboxes everywhere
for node, data in topo.nodes():
topo.setMbox(node)
topo.setServiceTypes(node, ['switch', 'fw', 'ids'])
# Resort to some default functions, obviously you'd provide your real data here
# =============================================================================
# ingress-egress pairs
iePairs = provisioning.generateIEpairs(topo)
# generate traffic matrix
trafficMatrix = provisioning.computeUniformTrafficMatrixPerIE(
iePairs, 10 ** 6)
# compute traffic classes, only one class
trafficClasses = generateTrafficClasses(iePairs, trafficMatrix, {'allTraffic': 1},
{'allTraffic': 2000})
from sol.opt.formulation.funcs import defaultLinkFuncNoNormalize
from sol.opt.topology import generators
from sol.opt.topology import provisioning
from sol.opt.topology.provisioning import generateTrafficClasses
from sol.path import chooserand
from sol.path import generatePathsPerTrafficClass
from sol.path import nullPredicate
if __name__ == '__main__':
# Let's create a topology first, as an example
# ============================================
topo = generators.generateCompleteTopology(5)
# label our switches
generators.forceSwitchLabels(topo)
# For the sake of example, set middleboxes everywhere
for node, data in topo.nodes():
topo.setMbox(node)
topo.setServiceTypes(node, ['switch', 'fw', 'ids'])
# Resort to some default functions, obviously you'd provide your real data here
# =============================================================================
# ingress-egress pairs
iePairs = provisioning.generateIEpairs(topo)
# generate traffic matrix
trafficMatrix = provisioning.computeUniformTrafficMatrixPerIE(
iePairs, 10 ** 6)
# compute traffic classes, only one class
trafficClasses = generateTrafficClasses(iePairs, trafficMatrix, {'allTraffic': 1},
{'allTraffic': 2000})
def runBasicLoadBalancer():
raise NotImplemented()
# Let's create a topology first, as an example
topo = generators.generateChainTopology(4)
# label our switches
generators.forceSwitchLabels(topo)
# For the sake of example, set middleboxes everywhere
for node, data in topo.nodes():
topo.setMbox(node)
topo.setServiceTypes(node, ['dpi'])
iePairs = provisioning.generateIEpairs(topo)
trafficMatrix = provisioning.computeUniformTrafficMatrixPerIE(
iePairs, 10 ** 6)
trafficClasses = generateTrafficClasses(iePairs, trafficMatrix, {'allTraffic': 1},
{'allTraffic': 100})
for t in trafficClasses:
t.cpuCost = 10
maxCPUCap = provisioning.computeMaxIngressLoad(trafficClasses, {t: t.cpuCost for t in trafficClasses})
nodeCaps = {node: maxCPUCap for node, data in topo.nodes()
if 'dpi' in topo.getServiceTypes(node)}
linkCaps = provisioning.provisionLinks(topo, trafficClasses, 2)
from sol.opt.formulation.funcs import defaultLinkFuncNoNormalize
from sol.opt.topology import generators
from sol.opt.topology import provisioning
from sol.opt.topology.provisioning import generateTrafficClasses
from sol.path import chooserand
from sol.path import generatePathsPerTrafficClass
from sol.path import nullPredicate
if __name__ == '__main__':
# Let's create a topology first, as an example
# ============================================
topo = generators.generateCompleteTopology(10)
# label our switches
generators.forceSwitchLabels(topo)
# For the sake of example, set middleboxes everywhere
for node, data in topo.nodes():
topo.setMbox(node)
topo.setServiceTypes(node, ['switch', 'fw', 'ids'])
# Resort to some default functions, obviously you'd provide your real data here
# =============================================================================
# ingress-egress pairs
iePairs = provisioning.generateIEpairs(topo)
# generate traffic matrix
trafficMatrix = provisioning.computeUniformTrafficMatrixPerIE(
iePairs, 10 ** 6)
# compute traffic classes, only one class
trafficClasses = generateTrafficClasses(iePairs, trafficMatrix, {'allTraffic': 1},
{'allTraffic': 2000})
import networkx
from sol.opt.formulation import getOptimization
from sol.opt.formulation.funcs import defaultLinkFuncNoNormalize
from sol.opt.topology import generators
from sol.opt.topology import provisioning
from sol.opt.topology.provisioning import generateTrafficClasses
from sol.path import chooserand
from sol.path import generatePathsPerTrafficClass
from sol.path import nullPredicate
if __name__ == '__main__':
# Let's create a topology first, as an example
# ============================================
topo = generators.generateCompleteTopology(5)
# label our switches
generators.forceSwitchLabels(topo)
# For the sake of example, set middleboxes everywhere
for node, data in topo.nodes():
topo.setMbox(node)
topo.setServiceTypes(node, ['switch', 'fw', 'ids'])
# Resort to some default functions, obviously you'd provide your real data here
# =============================================================================
# ingress-egress pairs
iePairs = provisioning.generateIEpairs(topo)
# generate traffic matrix
trafficMatrix = provisioning.computeUniformTrafficMatrixPerIE(
iePairs, 10 ** 6)
# compute traffic classes, only one class
def runBasicLoadBalancer():
raise NotImplemented()
# Let's create a topology first, as an example
topo = generators.generateChainTopology(4)
# label our switches
generators.forceSwitchLabels(topo)
# For the sake of example, set middleboxes everywhere
for node, data in topo.nodes():
topo.setMbox(node)
topo.setServiceTypes(node, ['dpi'])
iePairs = provisioning.generateIEpairs(topo)
trafficMatrix = provisioning.computeUniformTrafficMatrixPerIE(
iePairs, 10 ** 6)
trafficClasses = generateTrafficClasses(iePairs, trafficMatrix, {'allTraffic': 1},
{'allTraffic': 100})
for t in trafficClasses:
t.cpuCost = 10
maxCPUCap = provisioning.computeMaxIngressLoad(trafficClasses, {t: t.cpuCost for t in trafficClasses})
nodeCaps = {node: maxCPUCap for node, data in topo.nodes()
if 'dpi' in topo.getServiceTypes(node)}
import networkx
from sol.opt.formulation import getOptimization
from sol.opt.formulation.funcs import defaultLinkFuncNoNormalize
from sol.opt.topology import generators
from sol.opt.topology import provisioning
from sol.opt.topology.provisioning import generateTrafficClasses
from sol.path import chooserand
from sol.path import generatePathsPerTrafficClass
from sol.path import nullPredicate
if __name__ == '__main__':
# Let's create a topology first, as an example
# ============================================
topo = generators.generateCompleteTopology(10)
# label our switches
generators.forceSwitchLabels(topo)
# For the sake of example, set middleboxes everywhere
for node, data in topo.nodes():
topo.setMbox(node)
topo.setServiceTypes(node, ['switch', 'fw', 'ids'])
# Resort to some default functions, obviously you'd provide your real data here
# =============================================================================
# ingress-egress pairs
iePairs = provisioning.generateIEpairs(topo)
# generate traffic matrix
trafficMatrix = provisioning.computeUniformTrafficMatrixPerIE(
iePairs, 10 ** 6)
# compute traffic classes, only one class
import networkx
from sol.opt.formulation import getOptimization
from sol.opt.formulation.funcs import defaultLinkFuncNoNormalize
from sol.opt.topology import generators
from sol.opt.topology import provisioning
from sol.opt.topology.provisioning import generateTrafficClasses
from sol.path import chooserand
from sol.path import generatePathsPerTrafficClass
from sol.path import useMboxModifier
if __name__ == '__main__':
# Let's create a topology first, as an example
# ============================================
topo = generators.extractTopo()
# label our switches
generators.forceSwitchLabels(topo)
# For the sake of example, set middleboxes everywhere
for node, data in topo.nodes():
topo.setMbox(node)
topo.setServiceTypes(node, ['switch', 'fw', 'ids'])
# Resort to some default functions, obviously you'd provide your real data here
# =============================================================================
# ingress-egress pairs
iePairs = provisioning.generateIEpairs(topo)
# generate traffic matrix
trafficMatrix = provisioning.computeUniformTrafficMatrixPerIE(
iePairs, 10 ** 6)
# compute traffic classes, only one class