topologygenerator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CODE_OF_CONDUCT.md +49 -0
  6. data/Gemfile +10 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +35 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/lib/behaviors/serialize_behavior.rb +14 -0
  13. data/lib/builders_examples/pdm_builders/PhaseI/Flow_concrete_builder.rb +82 -0
  14. data/lib/builders_examples/pdm_builders/PhaseI/Host_concrete_builder.rb +24 -0
  15. data/lib/builders_examples/pdm_builders/PhaseI/Link_concrete_builder.rb +150 -0
  16. data/lib/builders_examples/pdm_builders/PhaseI/Router_concrete_builder.rb +24 -0
  17. data/lib/builders_examples/pdm_builders/PhaseI/output_concrete_builder.rb +86 -0
  18. data/lib/builders_examples/pdm_builders/PhaseI/pdm_constants.rb +111 -0
  19. data/lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/Flow_concrete_builder.rb +82 -0
  20. data/lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/Host_concrete_builder.rb +335 -0
  21. data/lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/Link_concrete_builder.rb +25 -0
  22. data/lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/Router_concrete_builder.rb +449 -0
  23. data/lib/builders_examples/pdm_builders/PhaseIWithPriorityQueues/output_concrete_builder.rb +229 -0
  24. data/lib/builders_examples/ruby_builders/Flow_concrete_builder.rb +5 -0
  25. data/lib/builders_examples/ruby_builders/Host_concrete_builder.rb +5 -0
  26. data/lib/builders_examples/ruby_builders/Link_concrete_builder.rb +5 -0
  27. data/lib/builders_examples/ruby_builders/Router_concrete_builder.rb +5 -0
  28. data/lib/builders_examples/ruby_builders/output_concrete_builder.rb +78 -0
  29. data/lib/command_line/command_line_arguments.rb +59 -0
  30. data/lib/createTopology.rb +10 -0
  31. data/lib/flows_distributions/constant_distribution.rb +7 -0
  32. data/lib/flows_distributions/exponential_distribution.rb +7 -0
  33. data/lib/flows_distributions/normal_distribution.rb +8 -0
  34. data/lib/flows_distributions/pareto_distribution.rb +9 -0
  35. data/lib/flows_distributions/split_distribution.rb +8 -0
  36. data/lib/network_entities/abstracts/flow.rb +27 -0
  37. data/lib/network_entities/abstracts/network_element.rb +19 -0
  38. data/lib/network_entities/abstracts/path.rb +16 -0
  39. data/lib/network_entities/physical/host.rb +10 -0
  40. data/lib/network_entities/physical/link.rb +36 -0
  41. data/lib/network_entities/physical/router.rb +12 -0
  42. data/lib/network_entities/topology.rb +69 -0
  43. data/lib/network_topologies_examples/PhaseI_onlyLAr_1FelixTo1SWROD.rb +93 -0
  44. data/lib/network_topologies_examples/octopus_topology.rb +66 -0
  45. data/lib/network_topologies_examples/phase1_topology_mininet/tdaq +4 -0
  46. data/lib/network_topologies_examples/phase1_topology_mininet/tdaq.py +99 -0
  47. data/lib/network_topologies_examples/sofisticated_octopus_topology.rb +121 -0
  48. data/lib/network_topologies_examples/tdaq_network_topology.rb +76 -0
  49. data/lib/network_topologies_examples/tdaq_topology_example.rb +119 -0
  50. data/lib/network_topologies_examples/tree_topology.rb +102 -0
  51. data/lib/output/FlowDefinitions.cpp +109 -0
  52. data/lib/output/copy_files.sh +8 -0
  53. data/lib/output/flows_definition.scilabParams +30 -0
  54. data/lib/output/hosts_definition.scilabParams +5 -0
  55. data/lib/output/links_definition.scilabParams +48 -0
  56. data/lib/output/routers_definition.scilabParams +24 -0
  57. data/lib/output/ruby_network_topology.rb +76 -0
  58. data/lib/output/topology.pdm +5321 -0
  59. data/lib/output_builder.rb +39 -0
  60. data/lib/providers/apis/onos_topology_provider.rb +146 -0
  61. data/lib/providers/customs/custom_topology_provider.rb +14 -0
  62. data/lib/providers/interface_topology_provider.rb +11 -0
  63. data/lib/topologygenerator/version.rb +3 -0
  64. data/lib/topologygenerator.rb +34 -0
  65. data/lib/utils/custom_files_utils.rb +16 -0
  66. data/topologygenerator.gemspec +45 -0
  67. metadata +188 -0
@@ -0,0 +1,111 @@
1
+ PDM_INITIAL_STRUCTURE = "Coupled
2
+ {
3
+ Type = Root
4
+ Name = MyTopology
5
+ Ports = 0; 0
6
+ Description = Testing the creation of a topology by getting the info from the controller
7
+ Graphic
8
+ {
9
+ Position = 0; 0
10
+ Dimension = 600; 600
11
+ Direction = Right
12
+ Color = 15
13
+ Icon =
14
+ Window = 5000; 5000; 5000; 5000
15
+ }
16
+ Parameters
17
+ {
18
+ }
19
+ System
20
+ {
21
+ Atomic
22
+ {
23
+ Name = LoadScilabParams
24
+ Ports = 1 ; 0
25
+ Path = sinks/RunScilabJob.h
26
+ Description = If Scilab is configured as backed in the cmd line options, this model runs Scilab commands at Init, Exit and when receive events.
27
+ Graphic
28
+ {
29
+ Position = -13845 ; -14220
30
+ Dimension = 540 ; 540
31
+ Direction = Right
32
+ Color = 15
33
+ Icon = %sinks%scilab.ico
34
+ }
35
+ Parameters
36
+ {
37
+ Run at Init = Str; exec('../examples/Matias/PhaseI/Scilab/model.scilabParams', 0) ; Scilab Job at Init
38
+ Run at External = Str; ; Scilab Job when receive event
39
+ Run at Exit = Str; ; Scilab Job at Exit
40
+ }
41
+ }
42
+ Atomic
43
+ {
44
+ Name = ExperimenetTracker
45
+ Ports = 0 ; 0
46
+ Path = sinks/SimulationExperimentTracker.h
47
+ Description = Allows to use multiple simulation runs setting new parameter values in each run. It configures Scilab variables according to the current simunation number. This model should run with 1st priority!!
48
+ Graphic
49
+ {
50
+ Position = -11220 ; -14220
51
+ Dimension = 540 ; 540
52
+ Direction = Right
53
+ Color = 15
54
+ Icon = %realtime%lcd.svg
55
+ }
56
+ Parameters
57
+ {
58
+ ScilabSimulationSetID = Str; SimulationName ; indicates the simulation set ID
59
+ ScilabSimulationCounterVariableName = Str; ExperimentNumber ; Name of the Scilab variable that indicates the simulation number.
60
+ ScilabParametersVariableName = Str; ParameterValues ; Name of the Scilab variable that contains the parameter values for each simulation
61
+ ScilabParametersValuesVariableName = Str; ParameterNames ; Name of the Scilab variable that contains the parameter names for each simulation
62
+ }
63
+ }
64
+ Atomic
65
+ {
66
+ Name = UpdateScilabParams
67
+ Ports = 1 ; 0
68
+ Path = sinks/RunScilabJob.h
69
+ Description = If Scilab is configured as backed in the cmd line options, this model runs Scilab commands at Init, Exit and when receive events.
70
+ Graphic
71
+ {
72
+ Position = -8670 ; -14220
73
+ Dimension = 540 ; 540
74
+ Direction = Right
75
+ Color = 15
76
+ Icon = %sinks%scilab.ico
77
+ }
78
+ Parameters
79
+ {
80
+ Run at Init = Str; ; Scilab Job at Init
81
+ Run at External = Str; ; Scilab Job when receive event
82
+ Run at Exit = Str; ; Scilab Job at Exit
83
+ }
84
+ }
85
+ "
86
+
87
+ NUMBER_OF_PDM_MODELS_IN_STRUCTURE = 3
88
+
89
+ PDM_FINAL_STRUCTURE=' Atomic
90
+ {
91
+ Name = FinalizationCommands
92
+ Ports = 0 ; 0
93
+ Path = sinks/multipleSimulationCommands.h
94
+ Description = Executes Scilab commands when using multiple simulation runs (at the end of each simulation, and at the end of ALL simulations).\nThis model should run with LAST priority
95
+ Graphic
96
+ {
97
+ Position = -6270 ; -14220
98
+ Dimension = 540 ; 540
99
+ Direction = Right
100
+ Color = 15
101
+ Icon = %datanetworks%scilab.bmp
102
+ }
103
+ Parameters
104
+ {
105
+ initSimulationCommandName = Str; ../examples/Matias/PhaseI/Scilab/firstSimulation.sce ;
106
+ eachSimulationCommandName = Str; ../examples/Matias/PhaseI/Scilab/eachSimulation.sce ;
107
+ lastSimulationCommandName = Str; ../examples/Matias/PhaseI/Scilab/lastSimulation.sce ;
108
+ }
109
+ }
110
+ }
111
+ }'
@@ -0,0 +1,82 @@
1
+ module FlowConcreteBuilder
2
+ def build_output_representation
3
+ scilab_definition = build_scilab_definition
4
+ cplusplus_definition = build_cplusplus_definition
5
+ {'scilab'=>scilab_definition, 'cplusplus'=>cplusplus_definition}
6
+ end
7
+
8
+ def build_scilab_definition
9
+ scilab_flows_definition = ''
10
+ scilab_flows_definition += "\n"
11
+ scilab_flows_definition += build_parameter_flow_distribution 'periodDistribution', distribution_rate
12
+ scilab_flows_definition += build_parameter_flow_distribution 'packetSizeDistribution', distribution_size
13
+ scilab_flows_definition
14
+ end
15
+
16
+ def build_parameter_flow_distribution(distribution_name, distribution_variable)
17
+ scilab_flow_parameter_distribution = ''
18
+ case distribution_variable
19
+ when ConstantDistribution
20
+ scilab_flow_parameter_distribution = "flow#{@id}.#{distribution_name} = DISTRIBUTION_CONSTANT;\n"
21
+ scilab_flow_parameter_distribution += "flow#{@id}.#{distribution_name}_value = #{distribution_variable.value}; // value for the constant distribution\n"
22
+ when ExponentialDistribution
23
+ scilab_flow_parameter_distribution = "flow#{@id}.#{distribution_name} = DISTRIBUTION_EXPONENTIAL;\n"
24
+ scilab_flow_parameter_distribution += "flow#{@id}.#{distribution_name}_mu = #{distribution_variable.mu}; // mean for the exponential distribution.\n"
25
+ when NormalDistribution
26
+ scilab_flow_parameter_distribution = "flow#{@id}.#{distribution_name} = DISTRIBUTION_NORMAL;\n"
27
+ scilab_flow_parameter_distribution += "flow#{@id}.#{distribution_name}_mu = #{distribution_variable.mu}; \n"
28
+ scilab_flow_parameter_distribution += "flow#{@id}.#{distribution_name}_var = #{distribution_variable.var}; \n"
29
+ when ParetoDistribution
30
+ scilab_flow_parameter_distribution = "flow#{@id}.#{distribution_name} = DISTRIBUTION_PARETO;\n"
31
+ scilab_flow_parameter_distribution += "flow#{@id}.#{distribution_name}_val1 = #{distribution_variable.val_1}; \n"
32
+ scilab_flow_parameter_distribution += "flow#{@id}.#{distribution_name}_val2 = #{distribution_variable.val_2}; \n"
33
+ scilab_flow_parameter_distribution += "flow#{@id}.#{distribution_name}_mean = #{distribution_variable.mean}; \n"
34
+ when SplitDistribution
35
+ scilab_flow_parameter_distribution = "flow#{@id}.#{distribution_name} = DISTRIBUTION_SPLIT;\n"
36
+ scilab_flow_parameter_distribution += "flow#{@id}.#{distribution_name}_shape = #{distribution_variable.shape}; \n"
37
+ scilab_flow_parameter_distribution += "flow#{@id}.#{distribution_name}_scale = #{distribution_variable.scale}; \n"
38
+ else
39
+ raise "Distribution provided has a class which was unexpected. Class was: #{distribution_variable.class}"
40
+ end
41
+ scilab_flow_parameter_distribution
42
+ end
43
+
44
+ def build_cplusplus_definition
45
+ start_time_of_flow = 0
46
+ # flow
47
+ cplusplus_flows_definition = "\n"
48
+ cplusplus_flows_definition += "\t ///// definition of flow #{@id} \n"
49
+ cplusplus_flows_definition += "\t auto flow#{@id}PeriodDistribution = readDistributionParameter(\"flow#{@id}.periodDistribution\"); \n"
50
+ cplusplus_flows_definition += "\t auto flow#{@id}PacketSizeDistribution = readDistributionParameter(\"flow#{@id}.packetSizeDistribution\"); \n"
51
+ cplusplus_flows_definition += "\t auto flow#{@id} = std::make_shared<Flow>(\"#{@id}\", #{start_time_of_flow} /*startTime*/, #{priority} /*typeOfService*/, flow#{@id}PeriodDistribution, flow#{@id}PacketSizeDistribution); \n"
52
+
53
+ #routes
54
+ cplusplus_flows_definition += "\t // routes for flow #{@id} \n"
55
+ paths.each_with_index do |path, index| # add each route/path in the flow
56
+ cplusplus_flows_definition += "\t auto flow#{@id}_route#{index} = std::make_shared<Route>( std::deque<Route::Node>{ \n"
57
+ path.links.each do |link|
58
+ cplusplus_flows_definition += "\t\t\t {#{link.src_port}, \"#{link.src_element.id}.Routing\"}, \n"
59
+ end
60
+ last_link = path.links.last
61
+ cplusplus_flows_definition += "\t\t\t {#{last_link.dst_port}, \"#{last_link.dst_element.id}.Routing\"} \n"
62
+ cplusplus_flows_definition += "\t });"
63
+ cplusplus_flows_definition += "\t \n"
64
+ end
65
+
66
+
67
+ # registrations
68
+ cplusplus_flows_definition += "\t // register flow #{@id} with its routes\n"
69
+ unique_sources = paths.map{ |path| path.links.first.src_element.id }.uniq{|id| id} # only add unique sources
70
+ unique_sources.each do |source|
71
+ cplusplus_flows_definition += "\t FlowDefinitions::registerFlowSourceNode(flow#{@id}, \"#{source}.GeneratorApplication\"); \n"
72
+ end
73
+
74
+ paths.each_with_index do |path, index| # register each route/path in the flow for each route
75
+ cplusplus_flows_definition += "\t FlowDefinitions::registerFlowRoute(flow#{@id}, flow#{@id}_route#{index}); \n"
76
+ end
77
+
78
+ cplusplus_flows_definition += "\t \n"
79
+
80
+ cplusplus_flows_definition
81
+ end
82
+ end
@@ -0,0 +1,335 @@
1
+ module HostConcreteBuilder
2
+ def build_output_representation
3
+ raise "A host should be either a generator or a receiving application. This host has 0 in_elements and 0 out_elements" if @in_elements.size == 0 && @out_elements.size == 0
4
+
5
+ pdm_output = " Coupled
6
+ {
7
+ Type = Coordinator
8
+ Name = #{id}
9
+ Ports = #{@in_elements.size}; #{@out_elements.size}
10
+ Description = Coupled DEVS model
11
+ Graphic
12
+ {
13
+ Position = #{-13995 + 1600 * (my_number - 4)} ; -12375
14
+ Dimension = 390; 1050
15
+ Direction = Down
16
+ Color = 15
17
+ Icon = %datanetworks%server.jpg
18
+ Window = 5000; 5000; 5000; 5000
19
+ }
20
+ Parameters
21
+ {
22
+ }
23
+ System
24
+ {#{componentsPdm}
25
+ }
26
+ }
27
+ "
28
+ scilab_host_output = "\n"
29
+ scilab_host_output += "#{id}.egressPort.queueCapacity = #{queue_capacity};"
30
+ {'scilab'=>scilab_host_output, 'pdm'=>pdm_output}
31
+ end
32
+
33
+ def componentsPdm
34
+ components = ''
35
+ # 1st we need the in/out ports
36
+ components += portsPdm
37
+
38
+ # 2nd we need the components
39
+ components += generatorApplication if @out_elements.size > 0
40
+ components += receivingApplication if @in_elements.size > 0
41
+ # 3rd the lines
42
+ components += linksPdm
43
+
44
+ components
45
+ end
46
+
47
+ def portsPdm
48
+ ports = ''
49
+ # inports
50
+ (0..@in_elements.size-1).each do |i|
51
+ ports +="
52
+ Inport
53
+ {
54
+ Name = Inport#{i}
55
+ CoupledPort = #{i+1}
56
+ Description =
57
+ Graphic
58
+ {
59
+ Position = -9330 ; #{-3250 + (i*1000)}
60
+ Dimension = 510
61
+ Direction = Right
62
+ }
63
+ }"
64
+ end
65
+
66
+ # outports
67
+ (0..@out_elements.size-1).each do |i|
68
+ ports += "
69
+ Outport
70
+ {
71
+ Name = Outport#{i}
72
+ CoupledPort = #{i+1}
73
+ Description =
74
+ Graphic
75
+ {
76
+ Position = #{-7000 + (2000 * i)} ; 3600
77
+ Dimension = 555
78
+ Direction = Right
79
+ }
80
+ }"
81
+ end
82
+
83
+ ports
84
+ end
85
+
86
+ def linksPdm
87
+ links_pdm = ''
88
+
89
+ # from generator (component 1) to router (component 2)
90
+ if @out_elements.size > 0 # if there is a generator
91
+ links_pdm += "
92
+ Line
93
+ {
94
+ Source = Cmp ; 1 ; 1 ; 0
95
+ Sink = Cmp ; 2 ; 1 ; -1
96
+ PointX = -6300 ; -6300 ; -6300
97
+ PointY = -1725 ; -1725 ; -1140
98
+ }"
99
+ end
100
+
101
+ (1..@out_elements.size).each do |i|
102
+ # from router (component 2) to egressLink (components 3,4.. outElems+2)
103
+ links_pdm += "
104
+ Line
105
+ {
106
+ Source = Cmp ; 2 ; #{i} ; 0
107
+ Sink = Cmp ; #{i+2} ; 1 ; -1
108
+ PointX = -6300 ; -6300 ; -6300
109
+ PointY = -1725 ; -1725 ; -1140
110
+ }"
111
+ # from egressLink (components 3,4.. outElems+2) to outports
112
+ links_pdm += "
113
+ Line
114
+ {
115
+ Source = Cmp ; #{i+2} ; 1 ; 0
116
+ Sink = Prt ; #{i} ; 1 ; -1
117
+ PointX = #{-7200 + (2000 * (i-1))} ; #{-7200 + (2000 * (i-1))} ; #{-7200 + (2000 * (i-1))}
118
+ PointY = 900 ; 3525 ; 3525
119
+ }"
120
+ end
121
+
122
+ # from inports to receiving app
123
+ (0..@in_elements.size-1).each do |i|
124
+ links_pdm +="
125
+ Line
126
+ {
127
+ Source = Prt ; #{(@out_elements.size + 1) + i} ; 1 ; 0
128
+ Sink = Cmp ; #{(@out_elements.size * 3) + 1} ; #{1 + i} ; -1
129
+ PointX = -8700 ; #{-8325 + (i * 300)} ; #{-8325 + (i * 300)}
130
+ PointY = #{-3250 + (i*1000)} ; #{-3250 + (i*1000)} ; -90
131
+ }"
132
+ end
133
+
134
+
135
+ links_pdm
136
+ end
137
+
138
+ def generatorApplication
139
+ pdm_generator_application = "
140
+ Atomic
141
+ {
142
+ Name = GeneratorApplication
143
+ Ports = 0 ; 1
144
+ Path = PhaseI/FelixServer.h
145
+ Description = Generates jobs. Distribution for the rate and jobSize are retrieved from the Flows assigned to this server
146
+ Graphic
147
+ {
148
+ Position = -7740 ; -4365
149
+ Dimension = 630 ; 645
150
+ Direction = Down
151
+ Color = 15
152
+ Icon = %datanetworks%generator.png
153
+ }
154
+ Parameters
155
+ {
156
+ }
157
+ }
158
+ Atomic
159
+ {
160
+ Name = Routing
161
+ Ports = 1 ; #{@out_elements.size}
162
+ Path = PhaseI/Router.h
163
+ Description = InN: Incomming packets\\nInN: Outgoing packets \\n This model routes incoming packets to outports. The decision is based on the global table GlobalFlowBasedRoutingTable(flowId, routerName). If there are more than one possible outport, the model uses a routingPolicy (currently hardcoded to Round-Robin) to decide.
164
+ Graphic
165
+ {
166
+ Position = -7740 ; -2115
167
+ Dimension = 615 ; 1785
168
+ Direction = Down
169
+ Color = 15
170
+ Icon = %datanetworks%router.jpg
171
+ }
172
+ Parameters
173
+ {
174
+ }
175
+ }"
176
+ (0..@out_elements.size-1).each do |i|
177
+ pdm_generator_application += "
178
+ Coupled
179
+ {
180
+ Type = Coordinator
181
+ Name = egressPort#{i}
182
+ Ports = 1; 1
183
+ Description = Coupled DEVS model
184
+ Graphic
185
+ {
186
+ Position = #{-7700 + (2000 * i)}; -120
187
+ Dimension = 990; 840
188
+ Direction = Down
189
+ Color = 15
190
+ Icon = %datanetworks%egressport.jpg
191
+ Window = 5000; 5000; 5000; 5000
192
+ }
193
+ Parameters
194
+ {
195
+ }
196
+ System
197
+ {
198
+ Inport
199
+ {
200
+ Name = Inport0
201
+ CoupledPort = 1
202
+ Description =
203
+ Graphic
204
+ {
205
+ Position = -4725 ; -3525
206
+ Dimension = 450
207
+ Direction = Right
208
+ }
209
+ }
210
+ Outport
211
+ {
212
+ Name = Outport0
213
+ CoupledPort = 1
214
+ Description =
215
+ Graphic
216
+ {
217
+ Position = -930 ; 1575
218
+ Dimension = 525
219
+ Direction = Right
220
+ }
221
+ }
222
+ Atomic
223
+ {
224
+ Name = portQueue
225
+ Ports = 2 ; 2
226
+ Path = PhaseI/NetworkQueue.h
227
+ Description = In0 Incomming packets to queue\\nIn1 Incoming signal to request dequeue\\nOut0 Outgoing dequeued packets\\nOut1 Outgoing queue lenght information\\n\\nQueues incoming packets and enqueues them as required by a\\nexternal entity. FIFO Policy (FirstInFirstOut). Provides information\\nits internal state.
228
+ Graphic
229
+ {
230
+ Position = -3855 ; -2355
231
+ Dimension = 675 ; 675
232
+ Direction = Down
233
+ Color = 15
234
+ Icon = %datanetworks%queue.png
235
+ }
236
+ Parameters
237
+ {
238
+ MaxCapacity = Str; #{id}.egressPort.queueCapacity ; Queue Capacity in Bytes. (Use -1 for INF capacity)
239
+ ForcedPeriod = Str; -1 ; Force minimum period to transition. Use -1 for INF
240
+ }
241
+ }
242
+ Atomic
243
+ {
244
+ Name = Link
245
+ Ports = 1 ; 1
246
+ Path = PhaseI/Link.h
247
+ Description = Vector to scalar signal
248
+ Graphic
249
+ {
250
+ Position = -3990 ; -540
251
+ Dimension = 630 ; 630
252
+ Direction = Down
253
+ Color = 15
254
+ Icon = %vectors%vec2scalar.svg
255
+ }
256
+ Parameters
257
+ {
258
+ link.capacity = Str; #{id}.egressPort#{i}.link.capacity ; Signal Index
259
+ link.delay = Str; #{id}.egressPort#{i}.link.delay ;
260
+ }
261
+ }
262
+ Point
263
+ {
264
+ ConectedLines = 3 ; 4 ; 5
265
+ ConectedExtrems = Org ; Org ; Org
266
+ Position = -3705 ; 765
267
+ }
268
+ Line
269
+ {
270
+ Source = Prt ; 1 ; 1 ; 0
271
+ Sink = Cmp ; 1 ; 1 ; -1
272
+ PointX = -4125 ; -3675 ; -3675
273
+ PointY = -3525 ; -3525 ; -2490
274
+ }
275
+ Line
276
+ {
277
+ Source = Cmp ; 1 ; 1 ; 0
278
+ Sink = Cmp ; 2 ; 1 ; -1
279
+ PointX = -3675 ; -3675 ; -3675
280
+ PointY = -1575 ; -1575 ; -690
281
+ }
282
+ Line
283
+ {
284
+ Source = Cmp ; 2 ; 1 ; 0
285
+ Sink = Pnt ; 1 ; -1 ; 0
286
+ PointX = -3675 ; -3705 ; -3705
287
+ PointY = 225 ; 225 ; 765
288
+ }
289
+ Line
290
+ {
291
+ Source = Cmp ; 1 ; 2 ; -1
292
+ Sink = Pnt ; 1 ; -1 ; 0
293
+ PointX = -3375 ; -3375 ; -2775 ; -2775 ; -3705
294
+ PointY = -2490 ; -2775 ; -2775 ; 765 ; 765
295
+ }
296
+ Line
297
+ {
298
+ Source = Pnt ; 1 ; -1 ; 0
299
+ Sink = Prt ; 2 ; 1 ; -1
300
+ PointX = -3705 ; -3705 ; -1065
301
+ PointY = 765 ; 1575 ; 1575
302
+ }
303
+ }
304
+ }"
305
+ end
306
+ pdm_generator_application
307
+ end
308
+
309
+
310
+ def receivingApplication
311
+ # atomic model for receiving application
312
+ pdm_receiving_app = "
313
+ Atomic
314
+ {
315
+ Name = ReceivingApplication
316
+ Ports = #{@in_elements.size} ; 0
317
+ Path = PhaseI/Packetsink.h
318
+ Description = Generates jobs. Distribution for the rate and jobSize are retrieved from the Flows assigned to this server
319
+ Graphic
320
+ {
321
+ Position = -8490 ; 45
322
+ Dimension = 630 ; 675
323
+ Direction = Down
324
+ Color = 15
325
+ Icon = %datanetworks%generator.png
326
+ }
327
+ Parameters
328
+ {
329
+ }
330
+ }"
331
+
332
+ pdm_receiving_app
333
+ end
334
+
335
+ end
@@ -0,0 +1,25 @@
1
+ module LinkConcreteBuilder
2
+ def build_output_representation
3
+ scilab_link_definition = ''
4
+
5
+ #Think a better way to do this. This is the only thing that I could image to find out which link is this
6
+ egressPortnumber = src_element.out_elements.index dst_element
7
+ scilab_link_definition += "\n"
8
+ scilab_link_definition += "#{src_element.id}.egressPort#{egressPortnumber}.link.capacity = #{bandwith} ;\n"
9
+ scilab_link_definition += "#{src_element.id}.egressPort#{egressPortnumber}.link.delay = #{delay}; \n"
10
+
11
+ {'scilab'=>scilab_link_definition, 'pdm'=>''}
12
+ end
13
+
14
+ def create_pdm_line_between_src_and_dst(src_element_pdm_pos, dst_element_pdm_pos, link_element_pdm_pos)
15
+ "Line
16
+ {
17
+ Source = Cmp ; #{src_element_pdm_pos} ; #{@src_port + 1} ; 0
18
+ Sink = Cmp ; #{dst_element_pdm_pos} ; #{@dst_port + 1} ; -1
19
+ PointX = -9675 ; -9675 ; -9675
20
+ PointY = -10350 ; -10350 ; -9990
21
+ }
22
+ "
23
+ end
24
+
25
+ end