Esempio n. 1
0
 def test_dumbbell_connectivity(m, n):
     G = fnss.dumbbell_topology(m, n)
     self.assertEqual(2 * m + n, G.number_of_nodes())
     self.assertEqual(2 * m + n - 1, G.number_of_edges())
     for i in range(m):
         self.assertTrue(G.has_edge(i, m))
         self.assertEqual('left_bell', G.node[i]['type'])
     for i in range(m, m + n):
         self.assertTrue(G.has_edge(i, i + 1))
         self.assertEqual('core', G.node[i]['type'])
     for i in range(m + n, 2 * m + n):
         self.assertTrue(G.has_edge(m + n - 1, i))
         self.assertEqual('right_bell', G.node[i]['type'])
Esempio n. 2
0
 def test_dumbbell_connectivity(m, n):
     G = fnss.dumbbell_topology(m, n)
     self.assertEquals(2 * m + n, G.number_of_nodes())
     self.assertEquals(2 * m + n - 1, G.number_of_edges())
     for i in range(m):
         self.assertTrue(G.has_edge(i, m))
         self.assertEquals('left_bell', G.node[i]['type'])
     for i in range(m, m + n):
         self.assertTrue(G.has_edge(i, i + 1))
         self.assertEquals('core', G.node[i]['type'])
     for i in range(m + n, 2 * m + n):
         self.assertTrue(G.has_edge(m + n - 1, i))
         self.assertEquals('right_bell', G.node[i]['type'])
Esempio n. 3
0
Generate Event Schedule
=======================

This example shows how to generate an event schedule.

In this specific example we create a dumbbell topology, place traffic sources
on one side and traffic receivers on the other side and we generate requests
following a Poisson distribution.
"""
import fnss
import random
import networkx as nx

# generate a dumbbell topology with 5 nodes on each bell and 3 nodes on the
# connecting path
topology = fnss.dumbbell_topology(5, 3)

# assign constant weight (1) to all links
fnss.set_weights_constant(topology, 1)

# now extract links located in the edges and links in the core
# we do this easily using Python list comprehension. Each link in the dumbbell
# topology has a 'type' attribute which identifies whether it a link of the
# core path or it is in a bell.
# Look at dumbbell_topology documentation for more details.

# this return a dictionary of egdes and value of attribute type
# This function is provided by the NetworkX library.
# Since FNSS Topology and DirecteedTopology objects inherit from NetworkX's
# Graph and DiGraph, respectively, NetworkX functions can be used in FNSS too.
link_types = nx.get_edge_attributes(topology, 'type')
Esempio n. 4
0
Generate Event Schedule
=======================

This example shows how to generate an event schedule.

In this specific example we create a dumbbell topology, place traffic sources
on one side and traffic receivers on the other side and we generate requests
following a Poisson distribution.
"""
import fnss
import random
import networkx as nx

# generate a dumbbell topology with 5 nodes on each bell and 3 nodes on the
# connecting path
topology = fnss.dumbbell_topology(5, 3)

# assign constant weight (1) to all links
fnss.set_weights_constant(topology, 1)

# now extract links located in the edges and links in the core
# we do this easily using Python list comprehension. Each link in the dumbbell
# topology has a 'type' attribute which identifies whether it a link of the
# core path or it is in a bell. 
# Look at dumbbell_topology documentation for more details.

# this return a dictionary of egdes and value of attribute type
# This function is provided by the NetworkX library.
# Since FNSS Topology and DirecteedTopology objects inherit from NetworkX's
# Graph and DiGraph, respectively, NetworkX functions can be used in FNSS too.
link_types = nx.get_edge_attributes(topology, 'type')
Esempio n. 5
0
import networkx as nx
import fnss

from mininet.topo import Topo
from mininet.net import Mininet
from mininet.link import TCLink
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel
from mininet.node import OVSController

# Create FNSS topology. Let's create a simple dumbbell topology
# This topology does not contain loops. If you want to use a topology with
# loops or multiple paths in Mininet you need to use a custom controller.
# More info here:
# https://github.com/mininet/mininet/wiki/Introduction-to-Mininet#multipath-routing
fnss_topo = fnss.dumbbell_topology(5, 4)

# now extract links located in the edges and links in the core
# we do this easily using Python list comprehension. Each link in the dumbbell
# topology has a 'type' attribute which identifies whether it a link of the
# core path or it is in a bell.
# Look at dumbbell_topology documentation for more details.

# this return a dictionary of egdes and value of attribute type
# This function is provided by the NetworkX library.
# Since FNSS Topology and DirecteedTopology objects inherit from NetworkX's
# Graph and DiGraph, respectively, NetworkX functions can be used in FNSS too.

for i in dir(fnss):
    print i
link_types = nx.get_edge_attributes(fnss_topo, 'type')
Esempio n. 6
0
import fnss

from mininet.topo import Topo
from mininet.net import Mininet
from mininet.link import TCLink
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel
from mininet.node import OVSController


# Create FNSS topology. Let's create a simple dumbbell topology
# This topology does not contain loops. If you want to use a topology with
# loops or multiple paths in Mininet you need to use a custom controller.
# More info here:
# https://github.com/mininet/mininet/wiki/Introduction-to-Mininet#multipath-routing
fnss_topo = fnss.dumbbell_topology(5, 4)

# now extract links located in the edges and links in the core
# we do this easily using Python list comprehension. Each link in the dumbbell
# topology has a 'type' attribute which identifies whether it a link of the
# core path or it is in a bell. 
# Look at dumbbell_topology documentation for more details.

# this return a dictionary of egdes and value of attribute type
# This function is provided by the NetworkX library.
# Since FNSS Topology and DirecteedTopology objects inherit from NetworkX's
# Graph and DiGraph, respectively, NetworkX functions can be used in FNSS too.
link_types = nx.get_edge_attributes(fnss_topo, 'type')
core_links = [links for links in link_types if link_types[links] == 'core']
edge_links = [links for links in link_types 
              if link_types[links] == 'right_bell'