コード例 #1
0
 def test_two_tier(self):
     topology = fnss.two_tier_topology(10, 20, 30)
     self.assertEqual(len(topology), 10 + 20 + 20 * 30)
     self.assertEqual(topology.number_of_hosts(), 20 * 30)
     self.assertEqual(topology.number_of_switches(), 10 + 20)
コード例 #2
0
ファイル: datacenter.py プロジェクト: itkq/docker-fnss
"""
Datacenter topology
===================

This example shows how to generate a datacenter topology, assign capacities
and save everything to an XML file
"""
import fnss
import networkx as nx

# create a topology with 10 core switches, 20 edge switches and 10 hosts
# per switch (i.e. 200 hosts in total)
topology = fnss.two_tier_topology(n_core=10, n_edge=20, n_hosts=10)

# assign capacities
# let's set links connecting servers to edge switches to 1 Gbps
# and links connecting core and edge switches to 10 Gbps.

# get list of core_edge links and edge_leaf links
link_types = nx.get_edge_attributes(topology, 'type')
core_edge_links = [
    link for link in link_types if link_types[link] == 'core_edge'
]
edge_leaf_links = [
    link for link in link_types if link_types[link] == 'edge_leaf'
]

# assign capacities
fnss.set_capacities_constant(topology, 1, 'Gbps', edge_leaf_links)
fnss.set_capacities_constant(topology, 10, 'Gbps', core_edge_links)
コード例 #3
0
ファイル: datacenter.py プロジェクト: brucespang/fnss
"""
Datacenter topology
===================

This example shows how to generate a datacenter topology, assign capacities
and save everything to an XML file
"""
import fnss
import networkx as nx

# create a topology with 10 core switches, 20 edge switches and 10 hosts
# per switch (i.e. 200 hosts in total)
topology = fnss.two_tier_topology(n_core=10, n_edge=20, n_hosts=10)

# assign capacities
# let's set links connecting servers to edge switches to 1 Gbps
# and links connecting core and edge switches to 10 Gbps.

# get list of core_edge links and edge_leaf links
link_types = nx.get_edge_attributes(topology, 'type')
core_edge_links = [link for link in link_types
                   if link_types[link] == 'core_edge']
edge_leaf_links = [link for link in link_types
                   if link_types[link] == 'edge_leaf']

# assign capacities
fnss.set_capacities_constant(topology, 1, 'Gbps', edge_leaf_links)
fnss.set_capacities_constant(topology, 10, 'Gbps', core_edge_links)

# assign weight 1 to all links
fnss.set_weights_constant(topology, 1)
コード例 #4
0
ファイル: mininet_datacenter.py プロジェクト: ccascone/fnss
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 datacenter 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.two_tier_topology(n_core=1, n_edge=2, n_hosts=2)

# Set link attributes
fnss.set_capacities_constant(fnss_topo, 10, 'Mbps')
fnss.set_delays_constant(fnss_topo, 2, 'ms')
fnss.set_buffer_sizes_constant(fnss_topo, 50, 'packets')

# Convert FNSS topology to Mininet
# If argument relabel_nodes is set to False, node labels are not changed when
# converting an FNSS topology to a Mininet one, except converting the type to
# string (e.g. 1 -> '1'). If relabel_nodes is set to True (default option)
# then nodes are label according to Mininet conventions, e.g. hosts are 
# prepended an h (e.g. 1 -> 'h1') and switches are prepended an s
# (e.g. 2 -> 's2') 
mn_topo = fnss.to_mininet(fnss_topo, relabel_nodes=True)
コード例 #5
0
# FNSS NETWORK EXAMPLE
import fnss
import random
import networkx as nx

# drones = 50, edge_nodes = 5, cloud=1
topology = fnss.two_tier_topology(n_core=1, n_edge=5, n_hosts=5)

# assign capacities
# let's set links connecting servers to edge switches to 5 Mbps.
# and links connecting core and edge switches to 5 Mbps.

# get list of core_edge links and edge_leaf links
link_types = nx.get_edge_attributes(topology, 'type')
core_edge_links = [
    link for link in link_types if link_types[link] == 'core_edge'
]
edge_leaf_links = [
    link for link in link_types if link_types[link] == 'edge_leaf'
]

# assign capacities
fnss.set_capacities_constant(topology, 5, 'Mbps', edge_leaf_links)
fnss.set_capacities_constant(topology, 5, 'Mbps', core_edge_links)

# add traffic
traffic_matrix = fnss.static_traffic_matrix(topology,
                                            mean=2,
                                            stddev=0.2,
                                            max_u=0.5)
コード例 #6
0
ファイル: test_datacenter.py プロジェクト: fnss/fnss
 def test_two_tier(self):
     topology = fnss.two_tier_topology(10, 20, 30)
     self.assertEqual(len(topology), 10 + 20 + 20 * 30)
     self.assertEqual(topology.number_of_hosts(), 20 * 30)
     self.assertEqual(topology.number_of_switches(), 10 + 20)
コード例 #7
0
ファイル: script_two_tier.py プロジェクト: assistof/sdn
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 RemoteController
from mininet.cli import CLI

# Create FNSS topology. Let's create a simple datacenter 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.two_tier_topology(n_core=1, n_edge=2, n_hosts=2)

# Set link attributes
fnss.set_capacities_constant(fnss_topo, 10, 'Mbps')
fnss.set_delays_constant(fnss_topo, 2, 'ms')
fnss.set_buffer_sizes_constant(fnss_topo, 50, 'packets')

# Convert FNSS topology to Mininet
# If argument relabel_nodes is set to False, node labels are not changed when
# converting an FNSS topology to a Mininet one, except converting the type to
# string (e.g. 1 -> '1'). If relabel_nodes is set to True (default option)
# then nodes are label according to Mininet conventions, e.g. hosts are
# prepended an h (e.g. 1 -> 'h1') and switches are prepended an s
# (e.g. 2 -> 's2')
mn_topo = fnss.to_mininet(fnss_topo, relabel_nodes=True)