Module: NetworkTopology

Defined in:
lib/network_topologies_examples/tree_topology.rb,
lib/network_topologies_examples/paper_example.rb,
lib/network_topologies_examples/octopus_topology.rb,
lib/network_topologies_examples/tdaq_network_topology.rb,
lib/network_topologies_examples/tdaq_topology_example.rb,
lib/network_topologies_examples/PhaseI_LAr_MonitoringHLT.rb,
lib/network_topologies_examples/PhaseI_onlyLAr_1FelixTo1SWROD.rb,
lib/network_topologies_examples/sofisticated_octopus_topology.rb

Overview

asciiflow.com

            +-------------+           +----------------+
           |             |           |                |
           | Host0       |           |    Host1       |
           +-------------+       +---+----------------+
                         |       |
                         |       |
                         |       |
                        ++-------+-+
                        |          |
                        |          +-----------------------------+
             +----------+Switch0   +-------------+               |
             |          +-------+--+             |               |
             |                  |                |               |
        +----+---+         +----+---+        +---+-----+    +----+-----+
        |        |         |        |        |         |    |          |
        |Switch1 |  +------+Switch2 |        |Switch3  |    |Switch4   |
+------------+---+  |      +------+-+--+     +---+-----++   +----------++
|            |      |      |      |    |         |      |               |
|            |      |  +---+----+ |    |  +------+-+   ++------+      +-+--------+

---—-+ ----—+ | |Host4 | | | | | | | | | | | | | | | ------- | | Host9 | |Host10 | | Host11 | |Host2 | | Host3 | | +—–Host5 | | -------- ------- ---------- -------- -------- | | ------

|      +------Host6  |
|           |    +---+-----+
|           +----+Host7    |
|                |    +----+---+
+----------------+------Host8  |
|                     |        |
+---------------------+--------+

Constant Summary collapse

K =

constants

1000
M =

Kilo=10³

1000 * K
G =

Megas=10⁶

1000 * M
TCP_MTU_bytes =

Megas=10⁶

1500
NUMBER_OF_FELIX_SERVERS =

parameters

13
NUMBER_OF_MONITORING_SERVERS =

NUMBER_OF_FELIX_SERVERS = 3 # this generates 1:1 connections with sw_rod, so NUMBER_OF_FELIX_SERVERS=numberOfSWRODServers

5
40  * G
1  * G
FELIX_FLOW_PRIORITY =
0
10
FELIX_GBT_PERIOD_sec =

felix data-flow distributions (one per GBT)

ExponentialDistribution.new 1.0 / (100*K)
FELIX_GBT_SIZE_bytes =

FELIX_GBT_PERIOD_sec = ExponentialDistribution.new 1.0 / (100) #TODO: this is just for testing quick simulations. Normal rate should be 100*k

NormalDistribution.new 4.0*K, 1.0*K
FELIX_GBT_BUFFER_bytes =

(in bytes)

1*M
FELIX_GBT_TIME_OUT_sec =

(in seconds)

2
FELIX_GBT_OUT_SIZE_bytes =

(in bytes)

TCP_MTU_bytes
FELIX_GENERATION_PERIOD =

40 Gbps

ExponentialDistribution.new 1/10.0
FELIX_GENERATION_SIZE =

distribution size in bits

ConstantDistribution.new 1.0*K
FELIX_MONITORING_PRIORITY =

monitoring flows (one per GBT)

0
MONITORING_SIZE_bits =
(TCP_MTU_bytes - 300)*8
TOTAL_MONITORING_PER_SERVER_bits =
0.8 * G
MONITORING_GENERATION_PERIOD =
ExponentialDistribution.new 1.0 / (TOTAL_MONITORING_PER_SERVER_bits /  (MONITORING_SIZE_bits * FELIX_GBT_ELINKS))
MONITORING_GENERATION_SIZE =

distribution size in bits

NormalDistribution.new MONITORING_SIZE_bits, 300*8
40  * G
FELIX_MONITORING_GENERATION_PERIOD =

distribution period in seconds

ExponentialDistribution.new 1/20.0
FELIX_MONITORING_GENERATION_SIZE =

distribution size in bits

ConstantDistribution.new 500
FELIX_CONTROL_GENERATION_PERIOD =

distribution period in seconds

ExponentialDistribution.new 1/15.0
FELIX_CONTROL_GENERATION_SIZE =

distribution size in bits

ConstantDistribution.new 100

Instance Method Summary collapse

Instance Method Details

#add_flows_oneFelix_to_oneSWRODObject



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/network_topologies_examples/PhaseI_LAr_MonitoringHLT.rb', line 107

def add_flows_oneFelix_to_oneSWROD
  # data-flow Flows for each felix server
  @felix_servers.each_with_index do |felix,index|
     # NFelix:1mon: A group of N felix servers will always talk with the same mon server. N=#felix/#mon
     monServer_index = index % NUMBER_OF_MONITORING_SERVERS # first N will all go to different mon. Then, with n+1, it starts again.
             
     # each felix will have 1 data-flow and 1 monitoring-flow per e-link
     for eLinkIndex in 0..FELIX_GBT_ELINKS-1
       # Data-Flow path
       path = Path.new felix, @sw_rod_servers[index]
       if eLinkIndex % 2 == 0 then switchIndex = 1 else switchIndex = 2 end # half the flows with go one path (switch_1), the other will go the other path (switch_2) 
       path.add_link @topology.get_element_by_id "link_felix#{index}_switch#{switchIndex}"  # felix{i} -> switch_{1/2}
       path.add_link @topology.get_element_by_id "link_switch#{switchIndex}_swrod#{index}"  # switch_1 --> lar_swrod{i}
       
       @topology.add_flow "Flow#{index}_#{eLinkIndex}", FELIX_FLOW_PRIORITY, [path], FELIX_GENERATION_PERIOD, FELIX_GENERATION_SIZE
       
       # Monitoring-flow path will go always to same monServer, but half by switch_1 and half by switch_2
       path = Path.new felix, @sw_rod_servers[index]            
       path.add_link @topology.get_element_by_id "link_felix#{index}_switch#{switchIndex}"  # felix{i} -> switch_{1/2}
       path.add_link @topology.get_element_by_id "link_sw#{switchIndex}_core#{switchIndex}"  # switch_{1/2} --> lar_core{1/2}
       path.add_link @topology.get_element_by_id "link_core#{switchIndex}_hltcore#{switchIndex}"  # lar_core{1/2} --> hlt_core{1/2}
       path.add_link @topology.get_element_by_id "link_htlcore#{switchIndex}_mon#{monServer_index}"  # hlt_core{1/2} --> mon{monServer_index}
                
       @topology.add_flow "FlowMon#{index}_#{eLinkIndex}", FELIX_MONITORING_PRIORITY, [path], MONITORING_GENERATION_PERIOD, MONITORING_GENERATION_SIZE
     end
 end
end

#get_path_between(source, destination) ⇒ Object

Raises:

  • (Exception)


90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/network_topologies_examples/tree_topology.rb', line 90

def get_path_between(source, destination)
    raise Exception, "Source must be either from class Router or class Host to ask for a path" unless [Host, Router].include? source.class
    raise Exception, "Destination must be either from class Router or class Host to ask for a path" unless [Host, Router].include? destination.class

    first_link = @topology.topology_elements.select { |elem| (elem.is_a? Link) && (elem.src_element == source) }.first
    second_link = @topology.topology_elements.select { |elem| (elem.is_a? Link) && (elem.dst_element == destination) }.first

    path = Path.new(source,destination)        
    path.add_link first_link
    path.add_link second_link unless first_link.dst_element == destination
    path
end

#get_topologyObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/network_topologies_examples/paper_example.rb', line 2

def get_topology
 return @topology.topology_elements unless @topology.topology_elements.size == 0
 hosts = []
 router = @topology.add_router "Router1"
 for i in 0..2  
   host = @topology.add_host "Host#{i}"
   hosts.push host     
 end
 bwith = 500*1000*1000
@topology.add_full_duplex_link "Link1", hosts[0], 0, router, 0, bwith
@topology.add_full_duplex_link "Link2", hosts[1], 0, router, 1, bwith
@topology.add_full_duplex_link "Link3", hosts[2], 0, router, 2, bwith
 link1 = @topology.get_element_by_id "Link1_up"
 link2 = @topology.get_element_by_id "Link3_down"
 flow_1_path = Path.new hosts[0], hosts[2]
 flow_1_path.add_link link1
 flow_1_path.add_link link2
 @topology.add_flow "Flow1", 10, 
 [flow_1_path], 
 (ExponentialDistribution.new 1.0/6875), 
 (ConstantDistribution.new 1000*8)
 @topology.topology_elements
end