omf_ec 6.0.0.pre.4 → 6.0.0.pre.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/omf_ec CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- #
2
+
3
+ abort "Please use Ruby 1.9.3 or higher" if RUBY_VERSION < "1.9.3"
4
+
3
5
  require 'gli'
4
6
  require 'omf_ec'
5
7
  $stdout.sync = true
@@ -13,22 +15,14 @@ version OmfEc::VERSION
13
15
  desc "Debug mode (printing debug logging messages)"
14
16
  switch [:d, :debug]
15
17
 
18
+ desc "URI for communication layer"
19
+ arg_name "URI"
20
+ default_value "xmpp://bob:password@localhost"
21
+ flag [:u, :uri]
22
+
16
23
  desc "Debug XMPP traffic mode (include XMPP debug logging messages under debug mode)."
17
24
  switch [:x, :xmpp]
18
25
 
19
- desc "XMPP user name"
20
- arg_name "user"
21
- flag [:u, :user]
22
-
23
- desc "XMPP user password"
24
- arg_name "password"
25
- flag [:p, :password]
26
-
27
- desc "XMPP server domain"
28
- arg_name "domain"
29
- default_value "localhost"
30
- flag [:s, :server]
31
-
32
26
  desc "Private key file"
33
27
  arg_name "key", :optional
34
28
  flag [:private_key]
@@ -58,21 +52,25 @@ command :exec do |c|
58
52
  help_now! "Missing experiment script" if args[0].nil?
59
53
  help_now! "Experiment script not found" unless File.exist?(args[0])
60
54
 
61
- # User provided exp properties
55
+ # User-provided command line values for Experiment Properties cannot be
56
+ # set here as the propertties have not been defined yet by the experiment.
57
+ # Thus just pass them to the experiment, which will be responsible
58
+ # for setting them later
59
+ properties = {}
62
60
  if args.size > 1
63
61
  exp_properties = args[1..-1]
64
-
65
62
  exp_properties.in_groups_of(2) do |p|
66
63
  unless p[0] =~ /^--(.+)/ && !p[1].nil?
67
64
  help_now! "Malformatted properties '#{exp_properties.join(' ')}'"
68
65
  else
69
- OmfEc.exp.property[$1.to_sym] = p[1].ducktype
66
+ properties[$1.to_sym] = p[1].ducktype
70
67
  end
71
68
  end
69
+ OmfEc.experiment.cmdline_properties = properties
72
70
  end
73
71
 
74
72
  # FIXME this loading script is way too simple
75
- load_exp(args[0], global_options, options)
73
+ load_exp(args[0], global_options, options, properties)
76
74
  end
77
75
  end
78
76
 
@@ -175,14 +173,14 @@ command :tell do |c|
175
173
  'offh' turn node(s) OFF (hard) -
176
174
  'reboot' reboots node(s) (soft) -
177
175
  'reset' resets node(s) (hard)"
178
- c.arg_name "ACTION"
179
- c.flag [:a, :action]
176
+ c.arg_name "ACTION"
177
+ c.flag [:a, :action]
180
178
 
181
- c.action do |global_options, options, args|
182
- @cmd = "omf-5.4 tell -c #{options[:c]} -t #{options[:t]} "
183
- @cmd += "-a #{options[:a]} " if options[:a]
184
- load_exp(@testbed_exp_path, global_options, options)
185
- end
179
+ c.action do |global_options, options, args|
180
+ @cmd = "omf-5.4 tell -c #{options[:c]} -t #{options[:t]} "
181
+ @cmd += "-a #{options[:a]} " if options[:a]
182
+ load_exp(@testbed_exp_path, global_options, options)
183
+ end
186
184
  end
187
185
 
188
186
  on_error do |exception|
@@ -190,19 +188,10 @@ on_error do |exception|
190
188
  end
191
189
 
192
190
  pre do |global_options, command, options, args|
193
- unless global_options[:user] && global_options[:password] && global_options[:server]
194
- help_now! "Incomplete options"
195
- end
196
-
197
- if global_options[:xmpp]
198
- Blather.logger = logger
191
+ unless global_options[:uri]
192
+ help_now! "Incomplete options. Need communication URI"
199
193
  end
200
194
 
201
- if global_options[:debug]
202
- Logging.logger.root.level = :debug
203
- else
204
- Logging.consolidate 'OmfCommon', 'OmfEc', 'OmfRc'
205
- end
206
195
 
207
196
  # Import private key
208
197
  if global_options[:private_key]
@@ -222,38 +211,67 @@ pre do |global_options, command, options, args|
222
211
 
223
212
  include OmfEc::DSL
224
213
 
225
- OmfEc.exp.name = options[:experiment] if options[:experiment]
226
- OmfEc.exp.oml_uri = options[:oml_uri] if options[:oml_uri]
214
+ OmfEc.experiment.name = options[:experiment] if options[:experiment]
215
+ OmfEc.experiment.oml_uri = options[:oml_uri] if options[:oml_uri]
227
216
 
217
+ @testbed_exp_path = File.join(OmfEc.lib_root, "omf_ec/backward/exp/testbed.rb")
218
+ end
219
+
220
+ def setup_logging(global_options = {})
221
+ if global_options[:xmpp]
222
+ require 'blather'
223
+ Blather.logger = logger
224
+ end
225
+
226
+ unless global_options[:debug]
227
+ Logging.consolidate 'OmfCommon', 'OmfEc', 'OmfRc'
228
+ end
229
+
230
+ # FIXME this should go to common setup
228
231
  if global_options[:log_file_dir] && File.exist?(global_options[:log_file_dir])
229
232
  Logging.logger.root.add_appenders(
230
233
  Logging.appenders.file(
231
- "#{global_options[:log_file_dir]}/#{OmfEc.exp.id}.log",
234
+ "#{global_options[:log_file_dir]}/#{OmfEc.experiment.id}.log",
232
235
  :layout => Logging.layouts.pattern(:date_pattern => '%F %T %z',
233
236
  :pattern => '[%d] %-5l %c: %m\n')))
234
237
  end
235
-
236
- @testbed_exp_path = File.join(OmfEc.lib_root, "omf_ec/backward/exp/testbed.rb")
237
238
  end
238
239
 
239
- def load_exp(exp_path, global_options = {} , options = {})
240
+ def load_exp(exp_path, global_options = {} , options = {}, properties = {})
240
241
  begin
241
- OmfEc.comm.when_ready do
242
- logger.info "Connected: #{OmfEc.comm.jid.inspect}"
243
- logger.info "Start experiment: #{OmfEc.exp.id}"
244
- begin
245
- include OmfEc::Backward::DefaultEvents
246
- load exp_path
247
- rescue => e
248
- logger.error e.message
249
- logger.error e.backtrace.join("\n")
250
- end
251
- end
242
+ opts = {
243
+ communication: { url: global_options[:uri] },
244
+ eventloop: { type: :em },
245
+ logging: {
246
+ level: global_options[:debug] ? 'debug' : 'info',
247
+ appenders: {
248
+ stdout: {
249
+ date_pattern: '%H:%M:%S',
250
+ pattern: '%d %-5l %c{2}: %m\n',
251
+ color_scheme: 'default'
252
+ }
253
+ }
254
+ }
255
+ }
256
+
257
+ OmfCommon.init(:development, opts) do |el|
258
+ setup_logging(global_options)
259
+
260
+ OmfCommon.comm.on_connected do |comm|
261
+ info "Connected"
262
+ info "Start experiment: #{OmfEc.experiment.id}"
263
+
264
+ begin
265
+ include OmfEc::Backward::DefaultEvents
266
+ load exp_path
267
+ rescue => e
268
+ error e.message
269
+ error e.backtrace.join("\n")
270
+ end
252
271
 
253
- EM.run do
254
- OmfEc.comm.connect(global_options[:user], global_options[:password], global_options[:server])
255
- trap(:INT) { Experiment.done }
256
- trap(:TERM) { Experiment.done }
272
+ #comm.on_interrupted { Experiment.done }
273
+ comm.on_interrupted { comm.disconnect }
274
+ end
257
275
  end
258
276
  rescue => e
259
277
  logger.fatal e.message
@@ -1,51 +1,51 @@
1
1
  # OMF_VERSIONS = 6.0
2
2
  #
3
- # :num_of_garage can be passed in from EC command line
4
- defProperty('num_of_garage', 1, 'Number of garage to start')
5
3
 
6
- garages = (1..prop.num_of_garage).map { |i| "garage_#{i}" }
4
+ def_property('name', 'garage', 'Name of garage')
7
5
 
8
- defEvent :all_engines_up do |state|
6
+ garage = prop.name
7
+
8
+ defEvent :engine_created do |state|
9
9
  # state holds list of resources, and automatically updated once OMF inform messages received.
10
10
  state.find_all do |v|
11
11
  v[:type] == 'engine'
12
- end.size >= prop.num_of_garage
12
+ end.size >= 1
13
13
  end
14
14
 
15
- defEvent :rpm_reached do |state|
15
+ defEvent :rpm_reached_4000 do |state|
16
16
  state.find_all do |v|
17
17
  v[:type] == 'engine' && v[:rpm] && v[:rpm] >= 4000
18
- end.size >= prop.num_of_garage
18
+ end.size >= 1
19
19
  end
20
20
 
21
21
  # Define a group and add garages to it.
22
- defGroup('many_garages', *garages)
22
+ defGroup('garages', garage)
23
23
 
24
24
  # :ALL_UP is a pre-defined event,
25
25
  # triggered when all resources set to be part of groups are available and configured as members of the associated groups.
26
26
  onEvent :ALL_UP do
27
- group('many_garages') do |g|
28
- g.create_resource('primary_engine', type: 'engine', sn: "<%= rand(1000) %>")
27
+ group('garages') do |g|
28
+ g.create_resource('primary_engine', type: 'engine', sn: rand(1000))
29
29
 
30
- onEvent :all_engines_up do
31
- info "Accelerating all engines"
32
- g.resources[type: 'engine'][name: 'primary_engine'].throttle = 40
30
+ onEvent :engine_created do
31
+ info ">>> Accelerating all engines"
32
+ g.resources[type: 'engine'][name: 'primary_engine'].throttle = 50
33
33
 
34
34
  g.resources[type: 'engine'][name: 'primary_engine'].sn
35
-
36
- g.resources[type: 'engine'][name: 'primary_engine'].failure
35
+ g.resources[type: 'engine'][name: 'primary_engine'].membership
37
36
  end
38
37
 
39
- onEvent :rpm_reached do
40
- info "All engines RPM reached 4000"
41
- info "Release All engines throttle"
38
+ onEvent :rpm_reached_4000 do
39
+ info ">>> Engine RPM reached 4000"
40
+
41
+ info ">>> Reduce engine throttle"
42
42
  g.resources[type: 'engine'].throttle = 0
43
43
 
44
44
  after 7.seconds do
45
- info "Shutting ALL engines off"
45
+ info ">>> Release engines"
46
46
  g.resources[type: 'engine'].release
47
47
 
48
- Experiment.done
48
+ done!
49
49
  end
50
50
  end
51
51
  end
@@ -1,90 +1,68 @@
1
1
  # OMF_VERSIONS = 6.0
2
2
 
3
- @comm = OmfEc.comm
4
-
5
- # @comm is default communicator defined in script runner
6
- #
7
- garage_id = "garage_1"
8
- garage_topic = @comm.get_topic(garage_id)
9
-
10
- garage_topic.on_message lambda {|m| m.operation == :inform && m.read_content('inform_type') == 'FAILED' } do |message|
11
- logger.error message
3
+ def create_engine(garage)
4
+ garage.create(:engine, { sn: 10001 }) do |reply_msg|
5
+ if reply_msg.success?
6
+ engine = reply_msg.resource
7
+
8
+ engine.on_subscribed do
9
+ info ">>> Connected to newly created resource #{reply_msg[:res_id]} with serial number #{reply_msg[:sn]}"
10
+ on_engine_created(engine)
11
+ end
12
+
13
+ after(2) do
14
+ info ">>> RELEASE engine"
15
+ garage.release(engine) do |reply_msg|
16
+ info reply_msg
17
+ end
18
+ end
19
+ else
20
+ error ">>> Resource creation failed - #{reply_msg[:reason]}"
21
+ end
22
+ end
12
23
  end
13
24
 
14
- msgs = {
15
- create: @comm.create_message([type: 'mp4']),
16
- request: @comm.request_message([:max_rpm, {:provider => {country: 'japan'}}, :max_power]),
17
- request_rpm: @comm.request_message([:rpm]),
18
- increase_throttle: @comm.configure_message([throttle: 50]),
19
- reduce_throttle: @comm.configure_message([throttle: 0]),
20
- test_error_handling: @comm.request_message([:error]),
21
- }
22
-
23
- msgs[:test_error_handling].on_inform_failed do |message|
24
- logger.error message.read_content("reason")
25
- end
25
+ def on_engine_created(engine)
26
+ info ">>> SENDING REQUEST"
27
+ # We can ask for some information about the engine
28
+ engine.request([:rpm, :max_rpm, :max_power, :provider])
26
29
 
27
- msgs[:create].on_inform_failed do |message|
28
- logger.error "Resource creation failed ---"
29
- logger.error message.read_content("reason")
30
- end
30
+ # Now we will apply 50% throttle to the engine
31
+ info ">>> SENDING CONFIGURE throttle 50%"
32
+ engine.configure(throttle: 50)
31
33
 
32
- msgs[:request].on_inform_status do |message|
33
- message.each_property do |p|
34
- logger.info "#{p.attr('key')} => #{p.content.strip}"
34
+ # Some time later, we want to reduce the throttle to 0, to avoid blowing up the engine
35
+ after(5) do
36
+ info ">>> SENDING CONFIGURE throttle 0%"
37
+ engine.configure(throttle: 0)
35
38
  end
36
- end
37
-
38
- msgs[:request].on_inform_failed do |message|
39
- logger.error message.read_content("reason")
40
- end
41
39
 
42
- msgs[:request_rpm].on_inform_status do |message|
43
- message.each_property do |p|
44
- logger.info "#{p.attr('key')} => #{p.content.strip}"
40
+ every(1) do
41
+ engine.request([:rpm])
45
42
  end
46
- end
47
-
48
- # Triggered when new messages published to the topics I subscribed to
49
- msgs[:create].on_inform_created do |message|
50
- engine_topic = @comm.get_topic(message.resource_id)
51
- engine_id = engine_topic.id
52
43
 
53
- msgs[:release] ||= @comm.release_message { |m| m.element('resource_id', engine_id) }
54
-
55
- msgs[:release].on_inform_released do |message|
56
- logger.info "Engine (#{message.resource_id}) turned off (resource released)"
57
- done!
44
+ # Monitor all status information from the engine
45
+ engine.on_status do |msg|
46
+ msg.each_property do |name, value|
47
+ info "#{name} => #{value}"
48
+ end
58
49
  end
59
50
 
60
- logger.info "Engine #{engine_id} ready for testing"
61
-
62
- engine_topic.subscribe do
63
- # Now subscribed to engine topic, we can ask for some information about the engine
64
- msgs[:request].publish engine_id
65
-
66
- # We will check engine's RPM
67
- msgs[:request_rpm].publish engine_id
68
-
69
- # Now we will apply 50% throttle to the engine
70
- msgs[:increase_throttle].publish engine_id
71
-
72
- @comm.add_timer(5) do
73
- # Some time later, we want to reduce the throttle to 0, to avoid blowing up the engine
74
- msgs[:reduce_throttle].publish engine_id
75
-
76
- # Testing error handling
77
- msgs[:test_error_handling].publish engine_id
78
- end
51
+ engine.on_error do |msg|
52
+ error msg[:reason]
53
+ end
79
54
 
80
- # 10 seconds later, we will 'release' this engine, i.e. shut it down
81
- @comm.add_timer(10) do
82
- msgs[:release].publish garage_id
83
- end
55
+ engine.on_warn do |msg|
56
+ warn msg[:reason]
84
57
  end
85
58
  end
86
59
 
87
- garage_topic.subscribe do
88
- # If subscribed, we publish a 'create' message, 'create' a new engine for testing
89
- msgs[:create].publish garage_topic.id
60
+ OmfCommon.comm.subscribe('garage') do |garage|
61
+ unless garage.error?
62
+ create_engine(garage)
63
+ else
64
+ error garage.inspect
65
+ end
66
+
67
+ after(20) { info 'Disconnecting ...'; OmfCommon.comm.disconnect }
90
68
  end
@@ -1,12 +1,32 @@
1
1
  # We can use communicator to interact with XMPP server
2
2
  #
3
3
  # Find all top level pubsub nodes
4
- host = "pubsub.#{OmfEc.comm.jid.domain}"
4
+ host = "pubsub.#{OmfCommon.comm.jid.domain}"
5
5
 
6
- OmfEc.comm.discover('items', host, '') do |m|
7
- m.items.each { |i| info i.node }
8
- info "Found #{m.items.size} items"
6
+ def discover
7
+ OmfCommon.comm.discover('items', host, '') do |m|
8
+ m.items.each { |i| info i.node }
9
+ info "Found #{m.items.size} items"
10
+ end
9
11
  end
10
12
 
11
- done!
12
13
 
14
+ def cleanup
15
+ OmfCommon.comm.affiliations do |a|
16
+ if a[:owner]
17
+ info "Found #{a[:owner].size} owned topics"
18
+ info "Now cleaning up..."
19
+ a[:owner].each do |t|
20
+ OmfCommon.comm.delete_topic(t) do |m|
21
+ debug m
22
+ end
23
+ end
24
+ else
25
+ info "Found no owned topics"
26
+ end
27
+ end
28
+ end
29
+
30
+ cleanup
31
+
32
+ done!
@@ -4,19 +4,18 @@
4
4
  # Testing one node in one group running one exec command for an already installed app
5
5
  #
6
6
  defProperty('res1', "unconfigured-node-1", "ID of a node")
7
- defProperty('res2', "unconfigured-node-2", "ID of a node")
8
7
 
9
- defGroup('Actor', property.res1, property.res2)
10
- defGroup('Bob', property.res1, property.res2)
8
+ defGroup('Actor', property.res1)
11
9
 
12
10
  onEvent(:ALL_UP) do
13
- wait 3
11
+ allGroups.startApplications
12
+
14
13
  info "TEST - allGroups"
15
14
  allGroups.exec("/bin/date")
16
15
 
17
- wait 3
18
16
  info "TEST - group"
19
17
  group("Actor").exec("/bin/hostname -f")
20
18
 
19
+ allGroups.stopApplications
21
20
  Experiment.done
22
21
  end
@@ -13,18 +13,15 @@ defGroup('Couple', property.res1, property.res2)
13
13
  defGroup('GroupOfGroup', "Alice", "Bob")
14
14
 
15
15
  onEvent(:ALL_UP) do
16
- wait 5
17
16
  info "-------------"
18
17
  info "TEST - Group of 2 (res1,res2)"
19
18
  group("Couple").exec("/bin/hostname")
20
- wait 5
21
19
  info "---------------------"
22
20
  info "TEST - Group of Group ( (res1) and (res2) )"
23
21
  group("GroupOfGroup").exec("/bin/hostname")
24
- wait 5
25
22
  info "---------------"
26
23
  info "TEST - allGroup"
27
24
  allGroups.exec("/bin/hostname")
28
- wait 5
29
- Experiment.done
25
+
26
+ after(20) { Experiment.done }
30
27
  end
@@ -14,42 +14,29 @@ defProperty('wifi', "g", "wifi type to use")
14
14
  defProperty('channel', "6", "wifi channel to use")
15
15
 
16
16
  defGroup('Sender', property.res1) {|node|
17
- node.addApplication("test:app:otg2") {|app|
18
- app.setProperty('udp:local_host', '192.168.0.2')
19
- app.setProperty('udp:dst_host', '192.168.0.3')
20
- app.setProperty('udp:dst_port', 3000)
21
- app.measure('udp_out', :interval => 3)
22
- }
23
17
  node.net.w0.mode = property.mode1
24
18
  node.net.w0.type = property.wifi
25
19
  node.net.w0.channel = property.channel
26
20
  node.net.w0.essid = "testing"
27
- node.net.w0.ip = "192.168.0.2"
21
+ node.net.w0.ip = "192.168.0.10/24"
28
22
  }
29
23
 
30
- defGroup('Receiver', property.res2) {|node|
31
- node.addApplication("test:app:otr2") {|app|
32
- app.setProperty('udp:local_host', '192.168.0.3')
33
- app.setProperty('udp:local_port', 3000)
34
- app.measure('udp_in', :samples => 3)
35
- }
36
- node.net.w0.mode = property.mode2
37
- node.net.w0.type = property.wifi
38
- node.net.w0.channel = property.channel
39
- node.net.w0.essid = "testing"
40
- node.net.w0.ip = "192.168.0.3"
41
- }
24
+ #defGroup('Receiver', property.res2) {|node|
25
+ # node.net.w0.mode = property.mode2
26
+ # node.net.w0.type = property.wifi
27
+ # node.net.w0.channel = property.channel
28
+ # node.net.w0.essid = "testing"
29
+ # node.net.w0.ip = "192.168.0.20/24"
30
+ #}
42
31
 
43
32
  onEvent(:ALL_UP_AND_INSTALLED) do |event|
44
- wait 10
45
- allGroups.startApplications
46
- wait 10
47
33
  info "TEST - Running ifconfig on Sender"
48
34
  group('Sender').exec("/sbin/ifconfig")
49
- wait 15
50
- info "TEST - Running ifconfig on Receiver"
51
- group('Receiver').exec("/sbin/ifconfig")
52
- wait 15
53
- allGroups.stopApplications
54
- Experiment.done
35
+
36
+ #info "TEST - Running ifconfig on Receiver"
37
+ #group('Receiver').exec("/sbin/ifconfig")
38
+
39
+ after 30.seconds do
40
+ Experiment.done
41
+ end
55
42
  end
@@ -13,7 +13,7 @@ module OmfEc
13
13
  # @param [String] name name of the application to define
14
14
  def initialize(name)
15
15
  self.name = name
16
- self.properties = Hash.new
16
+ self.properties = Hashie::Mash.new
17
17
  end
18
18
 
19
19
  # Add new parameter(s) to this Application Definition
@@ -21,7 +21,7 @@ module OmfEc
21
21
  # @param [Hash] params a hash with the parameters to add
22
22
  #
23
23
  def define_parameter(params)
24
- @properties[:parameters] = Hash.new unless @properties.key?(:parameters)
24
+ @properties[:parameters] = Hashie::Mash.new unless @properties.key?(:parameters)
25
25
  if params.kind_of? Hash
26
26
  @properties[:parameters].merge!(params)
27
27
  else
@@ -31,7 +31,7 @@ module OmfEc
31
31
  end
32
32
 
33
33
  def define_measurement_point(mp)
34
- @properties[:oml] = Hash.new unless @properties.key?(:oml)
34
+ @properties[:oml] = Hashie::Mash.new unless @properties.key?(:oml)
35
35
  if mp.kind_of? Hash
36
36
  @properties[:oml][:available_mps] = Array.new unless @properties[:oml].key?(:available_mps)
37
37
  @properties[:oml][:available_mps] << mp
@@ -7,11 +7,15 @@ module OmfEc
7
7
  base.instance_eval do
8
8
 
9
9
  def_event :ALL_UP do |state|
10
- !all_groups.empty? && all_groups.all? do |g|
10
+ all_groups? do |g|
11
11
  plan = g.members.uniq.sort
12
12
  actual = state.find_all do |v|
13
13
  v[:membership] && v[:membership].include?(g.id)
14
14
  end.map { |v| v[:uid] }.sort
15
+
16
+ debug "Planned: #{g.name}(#{g.id}): #{plan}"
17
+ debug "Actual: #{g.name}(#{g.id}): #{actual}"
18
+
15
19
  plan == actual
16
20
  end
17
21
  end
@@ -22,19 +26,20 @@ module OmfEc
22
26
  group.net_ifs && group.net_ifs.each do |nif|
23
27
  nif.map_channel_freq
24
28
  r_type = nif.conf[:type]
25
- r_hrn = nif.conf[:hrn]
29
+ r_if_name = nif.conf[:if_name]
26
30
  r_index = nif.conf[:index]
27
31
 
28
32
  conf_to_send =
29
33
  if r_type == 'wlan'
30
34
  { type: r_type,
31
- mode: nif.conf.merge(:phy => "<%= request_wlan_devices[#{r_index}][:name] %>").except(:hrn, :type, :index)
35
+ if_name: r_if_name,
36
+ mode: nif.conf.merge(:phy => "%#{r_index}%").except(:if_name, :type, :index)
32
37
  }
33
38
  else
34
39
  nif.conf.merge(type: r_type).except(:index)
35
40
  end
36
41
 
37
- group.create_resource(r_hrn, conf_to_send)
42
+ group.create_resource(r_if_name, conf_to_send)
38
43
  end
39
44
  # Create proxies for each apps that were added to this group
40
45
  group.app_contexts.each { |a| group.create_resource(a.name, a.properties) }
@@ -42,8 +47,8 @@ module OmfEc
42
47
  end
43
48
 
44
49
  def_event :ALL_INTERFACE_UP do |state|
45
- !all_groups.empty? && all_groups.all? do |g|
46
- plan = g.net_ifs.map { |v| v.conf[:hrn] }.uniq.size * g.members.uniq.size
50
+ all_groups? do |g|
51
+ plan = g.net_ifs.map { |v| v.conf[:if_name] }.uniq.size * g.members.uniq.size
47
52
  actual = state.find_all do |v|
48
53
  v[:membership] &&
49
54
  (v[:membership].include?("#{g.id}_wlan") || v[:membership].include?("#{g.id}_net"))
@@ -53,10 +58,10 @@ module OmfEc
53
58
  end
54
59
 
55
60
  def_event :ALL_UP_AND_INSTALLED do |state|
56
- !all_groups.empty? && all_groups.all? do |g|
61
+ all_groups? do |g|
57
62
  plan = g.app_contexts.size * g.members.uniq.size
58
63
  actual = state.find_all do |v|
59
- v[:membership] && v[:membership].include?("#{g.id}_application")
64
+ v[:membership] && v[:membership].include?("#{g.id}_application")
60
65
  end.size
61
66
  plan == actual
62
67
  end