omf_rc 6.0.0.pre.6 → 6.0.0.pre.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,6 +31,7 @@ module OmfRc::ResourceProxyDSL
31
31
  #
32
32
  def register_proxy(name, opts = {})
33
33
  name = name.to_sym
34
+ opts = Hashie::Mash.new(opts)
34
35
  if opts[:create_by] && !opts[:create_by].kind_of?(Array)
35
36
  opts[:create_by] = [opts[:create_by]]
36
37
  end
@@ -44,6 +45,15 @@ module OmfRc::ResourceProxyDSL
44
45
  # * before_ready, called when a resource created, before creating an associated pubsub topic
45
46
  # * before_release, called before a resource released
46
47
  # * before_create, called before parent creates the child resource. (in the context of parent resource)
48
+ # * after_create, called after parent creates the child resource.
49
+ # * after_initial_configured, called after child resource created, and initial set of properties have been configured.
50
+ #
51
+ # The sequence of execution is:
52
+ # * before_create
53
+ # * before_ready
54
+ # * after_create
55
+ # * after_initial_configured
56
+ # * before_release
47
57
  #
48
58
  # @param [Symbol] name hook name. :before_create or :before_release
49
59
  # @yieldparam [AbstractResource] resource pass the current resource object to the block
@@ -74,13 +84,35 @@ module OmfRc::ResourceProxyDSL
74
84
  # new_resource_options.property.node_info = "Node #{resource.uid}"
75
85
  # end
76
86
  #
87
+ # # after_create hook
88
+ # #
89
+ # # the optional block will have access to these variables:
90
+ # # * resource: the parent resource itself
91
+ # # * new_resource: the child resource instance
92
+ # hook :after_create do |resource, new_resource|
93
+ # logger.info "#{resource.uid} created #{new_resource.uid}
94
+ # end
95
+ #
96
+ # # before_ready hook
97
+ # #
98
+ # # the optional block will have access to resource instance. Useful to initialise resource
77
99
  # hook :before_ready do |resource|
78
100
  # logger.info "#{resource.uid} is now ready"
79
101
  # end
80
102
  #
103
+ # # before_release hook
104
+ # #
105
+ # # the optional block will have access to resource instance. Useful to clean up resource before release it.
81
106
  # hook :before_release do |resource|
82
107
  # logger.info "#{resource.uid} is now released"
83
108
  # end
109
+ #
110
+ # # after_initial_configured hook
111
+ # #
112
+ # # the optional block will have access to resource instance. Useful for actions depends on certain configured property values.
113
+ # hook :after_initial_configured do |resource|
114
+ # logger.info "#{resource.uid} has an IP address" unless resource.request_ip_addr.nil?
115
+ # end
84
116
  # end
85
117
  def hook(name, &register_block)
86
118
  define_method(name) do |*args, &block|
@@ -123,6 +155,9 @@ module OmfRc::ResourceProxyDSL
123
155
 
124
156
  # Register a configurable property
125
157
  #
158
+ # Please note that the result of the last line in the configure block will be returned via 'inform' message.
159
+ # If you want to make sure that user get a proper notification about the configure operation, simply use the last line to return such notification
160
+ #
126
161
  # @param [Symbol] name of the property
127
162
  # @yieldparam [AbstractResource] resource pass the current resource object to the block
128
163
  # @yieldparam [Object] value pass the value to be configured
@@ -132,26 +167,25 @@ module OmfRc::ResourceProxyDSL
132
167
  # include OmfRc::ResourceProxyDSL
133
168
  #
134
169
  # configure :freq do |resource, value|
135
- # Command.execute("iw #{resource.hrn} set freq #{value}")
170
+ # `iw #{resource.hrn} set freq #{value}`
171
+ # "Frequency set to #{value}"
136
172
  # end
137
173
  #
138
174
  # # or use iterator to define multiple properties
139
175
  # %w(freq channel type).each do |p|
140
176
  # configure p do |resource, value|
141
- # Command.execute("iw #{resource.hrn} set freq #{value}")
177
+ # `iw #{resource.hrn} set freq #{value}`
142
178
  # end
143
179
  # end
144
180
  #
145
181
  # # or we can try to parse iw's help page to extract valid properties and then automatically register them
146
- # Command.execute("iw help").chomp.gsub(/^\t/, '').split("\n").map {|v| v.match(/[phy|dev] <.+> set (\w+) .*/) && $1 }.compact.uniq.each do |p|
182
+ # `iw help`.chomp.gsub(/^\t/, '').split("\n").map {|v| v.match(/[phy|dev] <.+> set (\w+) .*/) && $1 }.compact.uniq.each do |p|
147
183
  # configure p do |resource, value|
148
- # Command.execute("iw #{resource.hrn} set #{p} #{value}")
184
+ # `iw #{resource.hrn} set #{p} #{value}`
149
185
  # end
150
186
  # end
151
187
  # end
152
188
  #
153
- # @see OmfCommon::Command.execute
154
- #
155
189
  def configure(name, &register_block)
156
190
  define_method("configure_#{name.to_s}") do |*args, &block|
157
191
  args[0] = Hashie::Mash.new(args[0]) if args[0].class == Hash
@@ -168,11 +202,11 @@ module OmfRc::ResourceProxyDSL
168
202
  # include OmfRc::ResourceProxyDSL
169
203
  #
170
204
  # request :freq do |resource|
171
- # Command.execute("iw #{resource.hrn} link").match(/^(freq):\W*(.+)$/) && $2
205
+ # `iw #{resource.hrn} link`.match(/^(freq):\W*(.+)$/) && $2
172
206
  # end
173
207
  #
174
208
  # # or we can grab everything from output of iw link command and return as a hash(mash)
175
- # Command.execute("iw #{resource.hrn} link").chomp.gsub(/^\t/, '').split("\n").drop(1).each do |v|
209
+ # `iw #{resource.hrn} link`.chomp.gsub(/^\t/, '').split("\n").drop(1).each do |v|
176
210
  # v.match(/^(.+):\W*(.+)$/).tap do |m|
177
211
  # m && known_properties[m[1].downcase.gsub(/\W+/, '_')] = m[2].gsub(/^\W+/, '')
178
212
  # end
@@ -192,7 +226,7 @@ module OmfRc::ResourceProxyDSL
192
226
  # @example suppose we define a simple os checking method
193
227
  #
194
228
  # work :os do
195
- # Command.execute("uname")
229
+ # `uname`
196
230
  # end
197
231
  #
198
232
  # # then this os method will be available in all proxy definitions which includes this work method definition.
@@ -284,5 +318,13 @@ module OmfRc::ResourceProxyDSL
284
318
  alias_method "orig_request_#{request_name}", "request_#{request_name}"
285
319
  end
286
320
 
321
+ # Define internal property
322
+ def property(name, opts = {})
323
+ opts = Hashie::Mash.new(opts)
324
+
325
+ define_method("def_property_#{name}") do |*args, &block|
326
+ self.property[name] = opts[:default]
327
+ end
328
+ end
287
329
  end
288
330
  end
@@ -12,13 +12,17 @@ module OmfRc::Util::Iw
12
12
 
13
13
  # Parse iw help page and set up all configure methods available for iw command
14
14
  #
15
- CommandLine.new("iw", "help").run.chomp.gsub(/^\t/, '').split("\n").map {|v| v.match(/[phy|dev] <.+> set (\w+) .*/) && $1 }.compact.uniq.each do |p|
16
- configure p do |device, value|
17
- CommandLine.new("iw", "dev :dev set :property :value",
18
- :dev => device.hrn,
19
- :property => p,
20
- :value => value).run
15
+ begin
16
+ CommandLine.new("iw", "help").run.chomp.gsub(/^\t/, '').split("\n").map {|v| v.match(/[phy|dev] <.+> set (\w+) .*/) && $1 }.compact.uniq.each do |p|
17
+ configure p do |device, value|
18
+ CommandLine.new("iw", "dev :dev set :property :value",
19
+ :dev => device.hrn,
20
+ :property => p,
21
+ :value => value).run
22
+ end
21
23
  end
24
+ rescue Cocaine::CommandNotFoundError
25
+ logger.warn "Command iw not found"
22
26
  end
23
27
 
24
28
  # Parse iw link command output and return as a mash
@@ -1,13 +1,41 @@
1
+ require 'hashie'
2
+ require 'cocaine'
3
+
1
4
  module OmfRc::Util::Mod
2
5
  include OmfRc::ResourceProxyDSL
6
+ include Cocaine
7
+ include Hashie
3
8
 
4
9
  request :modules do
5
- OmfCommon::Command.execute('lsmod').split("\n").map do |v|
10
+ CommandLine.new('lsmod').run.split("\n").map do |v|
6
11
  v.match(/^(\w+).+$/) && $1
7
12
  end.compact.tap { |ary| ary.shift }
8
13
  end
9
14
 
10
15
  configure :load_module do |resource, value|
11
- OmfCommon::Command.execute("modprobe #{value}")
16
+ raise ArgumentError, "Please provide at least module name" if value.name.nil?
17
+
18
+ flags_string = nil
19
+
20
+ if !value.flags.nil?
21
+ if value.flags.kind_of?(Hash)
22
+ flags_string = value.flags.keys.map do |k|
23
+ "--#{k} #{value.flags[k]}"
24
+ end.join(" ")
25
+ else
26
+ raise ArgumentError, "Please provide modprobe flags as a hash"
27
+ end
28
+ end
29
+
30
+ if value.unload
31
+ CommandLine.new("modprobe", "-r :mod_names", :mod_names => [value.unload].flatten.join(' ')).run
32
+ end
33
+
34
+ CommandLine.new("modprobe", ":flags :mod_name :module_parameters",
35
+ :mod_name => value.name.to_s,
36
+ :flags => flags_string,
37
+ :module_parameters => value.mod_params.to_s).run
38
+
39
+ "#{value.name} loaded"
12
40
  end
13
41
  end
@@ -3,7 +3,7 @@ require 'xmlrpc/client'
3
3
  module OmfRc::Util::OpenflowTools
4
4
  include OmfRc::ResourceProxyDSL
5
5
 
6
- # The version of the flowvisor that this resource is able to control
6
+ # The version of the flowvisor that this resource is able to control
7
7
  FLOWVISOR_VERSION = "FV version=flowvisor-0.8.4"
8
8
 
9
9
  # Parts of the regular expression that describes a flow entry for flowvisor
@@ -18,7 +18,7 @@ module OmfRc::Util::OpenflowTools
18
18
  # The regular expression that describes a flow entry for flowvisor
19
19
  FLOWVISOR_FLOWENTRY_REGEXP = /FlowEntry\[#{FLOWVISOR_FLOWENTRY_REGEXP_DEVIDED.join(',')},\]/
20
20
 
21
- # The names of the flow (or flow entry) features
21
+ # The names of the flow (or flow entry) features
22
22
  FLOW_FEATURES = %w{device match slice actions id priority}
23
23
 
24
24
  # The names of the flow (or flow entry) features that are specified by the "match" feature
@@ -52,9 +52,9 @@ module OmfRc::Util::OpenflowTools
52
52
  result = resource.flowvisor_connection.call("api.listFlowSpace")
53
53
  result.map! do |line|
54
54
  array_values = line.match(FLOWVISOR_FLOWENTRY_REGEXP)[1..-1]
55
- # Example of above array's content: %w{00:00:...:01 in_port=1 test 4 30 10}
55
+ # Example of above array's content: %w{00:00:...:01 in_port=1 test 4 30 10}
56
56
  array_features_values_zipped = FLOW_FEATURES.zip(array_values)
57
- # Example of above array's content: %w{device 00:00:...:01 match in_port=1 slice test actions 4 id 30 priority 10}
57
+ # Example of above array's content: %w{device 00:00:...:01 match in_port=1 slice test actions 4 id 30 priority 10}
58
58
  hash = Hashie::Mash.new(Hash[array_features_values_zipped])
59
59
  # The following code adds extra features that are specified by the "match" feature
60
60
  hash["match"].split(",").each do |couple|
@@ -64,7 +64,7 @@ module OmfRc::Util::OpenflowTools
64
64
  hash
65
65
  end
66
66
  result.delete_if {|hash| hash["slice"] != resource.property.name} if resource.type.to_sym == :openflow_slice
67
- FLOW_FEATURES.each do |feature|
67
+ FLOW_FEATURES.each do |feature|
68
68
  result.delete_if {|hash| hash[feature] != filter[feature].to_s} if filter[feature]
69
69
  end if filter
70
70
  result
@@ -90,13 +90,13 @@ module OmfRc::Util::OpenflowTools
90
90
  result << h
91
91
  when "remove"
92
92
  resource.flows(parameters).each do |f|
93
- if f.match == match
93
+ if f.match == match
94
94
  h = Hashie::Mash.new
95
95
  h.operation = parameters.operation.upcase
96
96
  h.id = f.id
97
97
  result << h
98
- end
99
- end
98
+ end
99
+ end
100
100
  end
101
101
  result
102
102
  end
@@ -28,7 +28,7 @@ module OmfRc::Util::PlatformTools
28
28
  include OmfRc::ResourceProxyDSL
29
29
 
30
30
  utility :common_tools
31
-
31
+
32
32
  # This utility block logs attempts to detect the OS platform on which it is
33
33
  # currently running. Right now it can recognise the following platform:
34
34
  # - Ubuntu (by looking for an Ubuntu string in /etc/*release files)
@@ -38,22 +38,22 @@ module OmfRc::Util::PlatformTools
38
38
  #
39
39
  # [Symbol] either :unknown | :ubuntu | :fedora
40
40
  #
41
- work('detect_platform') do
41
+ work('detect_platform') do
42
42
  r = `cat /etc/*release`.upcase
43
43
  platform = :unknown
44
44
  platform = :ubuntu if r.include?('UBUNTU')
45
45
  platform = :fedora if r.include?('FEDORA')
46
- platform
46
+ platform
47
47
  end
48
-
48
+
49
49
  # This utility block logs attempts to validate if a given package name is
50
- # a valid one or not. Right now it checks the following:
50
+ # a valid one or not. Right now it checks the following:
51
51
  # - if the given pkg name is not nil
52
52
  # - if the given pkg name has a size > 0
53
53
  #
54
- # Further checks may be implemented later
54
+ # Further checks may be implemented later
55
55
  # (e.g. is the pkg provided by any known repository, etc...)
56
- #
56
+ #
57
57
  # @yieldparam [String] pkg_name the package name to check
58
58
  #
59
59
  # [Boolean] true or fals
@@ -70,7 +70,7 @@ module OmfRc::Util::PlatformTools
70
70
 
71
71
  # This utility block install a package on an Ubuntu platform using
72
72
  # the underlying apt-get tool
73
- #
73
+ #
74
74
  # @yieldparam [String] pkg_name the package name to install
75
75
  #
76
76
  work('install_ubuntu') do |res, pkg_name|
@@ -85,7 +85,7 @@ module OmfRc::Util::PlatformTools
85
85
 
86
86
  # This utility block install a package on an Fedora platform using
87
87
  # the underlying yum tool
88
- #
88
+ #
89
89
  # @yieldparam [String] pkg_name the package name to install
90
90
  #
91
91
  work('install_fedora') do |res, pkg_name|
@@ -95,13 +95,13 @@ module OmfRc::Util::PlatformTools
95
95
  "/usr/bin/yum -y install #{pkg_name}")
96
96
  end
97
97
 
98
- # This utility block install a software from a tarball archive. It first
99
- # tries to download the tarball at a given URI (if it has not been
98
+ # This utility block install a software from a tarball archive. It first
99
+ # tries to download the tarball at a given URI (if it has not been
100
100
  # downloaded earlier), then it unarchives it at the given install_path
101
101
  #
102
102
  # @yieldparam [String] pkg_name the package name to install
103
103
  # @yieldparam [String] install_path the path where to install this package
104
- #
104
+ #
105
105
  work('install_tarball') do |res, pkg_name, install_path|
106
106
  next false unless res.valid_pkg_name(pkg_name)
107
107
  require 'net/http'
@@ -132,7 +132,7 @@ module OmfRc::Util::PlatformTools
132
132
  next false
133
133
  end
134
134
 
135
- # if we have the file and its ETag locally,
135
+ # if we have the file and its ETag locally,
136
136
  # compare it to the ETag of the remote file
137
137
  if File.exists?(file) && File.exists?(eTagFile)
138
138
  f=File.open(eTagFile,'r')
@@ -1,3 +1,3 @@
1
1
  module OmfRc
2
- VERSION = "6.0.0.pre.6"
2
+ VERSION = "6.0.0.pre.7"
3
3
  end
data/test/fixture/iw/help CHANGED
@@ -33,14 +33,14 @@ Commands:
33
33
  phy <phyname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]
34
34
  Add a new virtual interface with the given configuration.
35
35
  Valid interface types are: managed, ibss, monitor, mesh, wds.
36
-
36
+
37
37
  The flags are only used for monitor interfaces, valid flags are:
38
38
  none: no special flags
39
39
  fcsfail: show frames with FCS errors
40
40
  control: show control frames
41
41
  otherbss: show frames from other BSSes
42
42
  cook: use cooked mode
43
-
43
+
44
44
  The mesh_id is used only for mesh mode.
45
45
 
46
46
  dev <devname> ibss join <SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>] [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] [key d:0:abcde]
@@ -128,12 +128,12 @@ Commands:
128
128
 
129
129
  dev <devname> cqm rssi <threshold|off> [<hysteresis>]
130
130
  Set connection quality monitor RSSI threshold.
131
-
132
131
 
133
- phy <phyname> wowlan show
132
+
133
+ phy <phyname> wowlan show
134
134
  Show WoWLAN status.
135
135
 
136
- phy <phyname> wowlan disable
136
+ phy <phyname> wowlan disable
137
137
  Disable WoWLAN.
138
138
 
139
139
  phy <phyname> wowlan enable [any] [disconnect] [magic-packet] [gtk-rekey-failure] [eap-identity-request] [4way-handshake] [rfkill-release] [patterns <pattern>*]
@@ -143,7 +143,7 @@ Commands:
143
143
  00:11:22:33:ff:44 etc.
144
144
 
145
145
  dev <devname> roc start <freq> <time>
146
-
146
+
147
147
 
148
148
  phy <phyname> set antenna <bitmap> | all | <tx bitmap> <rx bitmap>
149
149
  Set a bitmap of allowed antennas to use for TX and RX.
data/test/fixture/lsmod CHANGED
@@ -1,106 +1,106 @@
1
1
  Module Size Used by
2
- ip6table_filter 12540 0
2
+ ip6table_filter 12540 0
3
3
  ip6_tables 22175 1 ip6table_filter
4
- iptable_filter 12536 0
4
+ iptable_filter 12536 0
5
5
  ip_tables 22042 1 iptable_filter
6
- ebtable_nat 12580 0
6
+ ebtable_nat 12580 0
7
7
  ebtables 26235 1 ebtable_nat
8
8
  x_tables 19073 5 ebtables,ip_tables,iptable_filter,ip6_tables,ip6table_filter
9
- parport_pc 22364 0
10
- ppdev 12763 0
11
- lp 17149 0
9
+ parport_pc 22364 0
10
+ ppdev 12763 0
11
+ lp 17149 0
12
12
  parport 31858 3 lp,ppdev,parport_pc
13
- rfcomm 33656 8
14
- bnep 17567 2
15
- cpufreq_stats 12866 0
16
- cpufreq_userspace 12576 0
17
- cpufreq_powersave 12454 0
18
- cpufreq_conservative 13147 0
19
- pci_stub 12429 1
20
- vboxpci 19066 0
21
- autofs4 27582 2
22
- vboxnetadp 25443 0
23
- vboxnetflt 23571 0
13
+ rfcomm 33656 8
14
+ bnep 17567 2
15
+ cpufreq_stats 12866 0
16
+ cpufreq_userspace 12576 0
17
+ cpufreq_powersave 12454 0
18
+ cpufreq_conservative 13147 0
19
+ pci_stub 12429 1
20
+ vboxpci 19066 0
21
+ autofs4 27582 2
22
+ vboxnetadp 25443 0
23
+ vboxnetflt 23571 0
24
24
  vboxdrv 190105 3 vboxnetflt,vboxnetadp,vboxpci
25
- uinput 17440 1
26
- nfsd 211858 2
27
- nfs 312243 0
25
+ uinput 17440 1
26
+ nfsd 211858 2
27
+ nfs 312243 0
28
28
  nfs_acl 12511 2 nfs,nfsd
29
29
  auth_rpcgss 37143 2 nfs,nfsd
30
30
  fscache 36739 1 nfs
31
31
  lockd 67328 2 nfs,nfsd
32
32
  sunrpc 173671 6 lockd,auth_rpcgss,nfs_acl,nfs,nfsd
33
- loop 22641 0
34
- fuse 61981 1
35
- kvm 287662 0
36
- snd_hda_codec_conexant 45252 1
37
- joydev 17266 0
38
- arc4 12458 2
39
- coretemp 12898 0
40
- crc32c_intel 12747 0
41
- btusb 17502 2
33
+ loop 22641 0
34
+ fuse 61981 1
35
+ kvm 287662 0
36
+ snd_hda_codec_conexant 45252 1
37
+ joydev 17266 0
38
+ arc4 12458 2
39
+ coretemp 12898 0
40
+ crc32c_intel 12747 0
41
+ btusb 17502 2
42
42
  bluetooth 119406 23 btusb,bnep,rfcomm
43
43
  crc16 12343 1 bluetooth
44
- snd_hda_intel 26345 0
45
- ghash_clmulni_intel 13133 0
46
- i2c_i801 16870 0
44
+ snd_hda_intel 26345 0
45
+ ghash_clmulni_intel 13133 0
46
+ i2c_i801 16870 0
47
47
  snd_hda_codec 78031 2 snd_hda_intel,snd_hda_codec_conexant
48
48
  snd_hwdep 13186 1 snd_hda_codec
49
49
  snd_pcm 63900 2 snd_hda_codec,snd_hda_intel
50
50
  snd_page_alloc 13003 2 snd_pcm,snd_hda_intel
51
- aesni_intel 50667 0
51
+ aesni_intel 50667 0
52
52
  aes_x86_64 16796 1 aesni_intel
53
- pcspkr 12579 0
54
- psmouse 64455 0
55
- thinkpad_acpi 61270 0
53
+ pcspkr 12579 0
54
+ psmouse 64455 0
55
+ thinkpad_acpi 61270 0
56
56
  aes_generic 33026 2 aes_x86_64,aesni_intel
57
57
  nvram 13049 1 thinkpad_acpi
58
58
  cryptd 14517 2 aesni_intel,ghash_clmulni_intel
59
- serio_raw 12931 0
60
- snd_seq 45093 0
61
- evdev 17562 15
59
+ serio_raw 12931 0
60
+ snd_seq 45093 0
61
+ evdev 17562 15
62
62
  snd_seq_device 13176 1 snd_seq
63
63
  snd_timer 22917 2 snd_seq,snd_pcm
64
- iwlwifi 170823 0
65
- i915 355994 3
64
+ iwlwifi 170823 0
65
+ i915 355994 3
66
66
  mac80211 192768 1 iwlwifi
67
67
  snd 52850 9 snd_timer,snd_seq_device,snd_seq,thinkpad_acpi,snd_pcm,snd_hwdep,snd_hda_codec,snd_hda_intel,snd_hda_codec_conexant
68
68
  cfg80211 137140 2 mac80211,iwlwifi
69
69
  drm_kms_helper 27227 1 i915
70
- iTCO_wdt 17081 0
70
+ iTCO_wdt 17081 0
71
71
  iTCO_vendor_support 12704 1 iTCO_wdt
72
72
  drm 167670 4 drm_kms_helper,i915
73
73
  soundcore 13065 1 snd
74
- battery 13109 0
74
+ battery 13109 0
75
75
  rfkill 19012 4 cfg80211,thinkpad_acpi,bluetooth
76
76
  i2c_algo_bit 12841 1 i915
77
77
  i2c_core 23876 5 i2c_algo_bit,drm,drm_kms_helper,i915,i2c_i801
78
- ac 12624 0
78
+ ac 12624 0
79
79
  power_supply 13475 2 ac,battery
80
- tpm_tis 17454 0
80
+ tpm_tis 17454 0
81
81
  tpm 17862 1 tpm_tis
82
82
  tpm_bios 12948 1 tpm
83
83
  video 17628 1 i915
84
- wmi 13243 0
85
- acpi_cpufreq 12935 1
84
+ wmi 13243 0
85
+ acpi_cpufreq 12935 1
86
86
  mperf 12453 1 acpi_cpufreq
87
87
  button 12937 1 i915
88
88
  processor 28157 1 acpi_cpufreq
89
- xfs 594991 4
90
- dm_mod 63545 12
91
- sd_mod 36136 2
89
+ xfs 594991 4
90
+ dm_mod 63545 12
91
+ sd_mod 36136 2
92
92
  crc_t10dif 12348 1 sd_mod
93
- sdhci_pci 17976 0
94
- ahci 24997 1
93
+ sdhci_pci 17976 0
94
+ ahci 24997 1
95
95
  libahci 22860 1 ahci
96
- xhci_hcd 73170 0
96
+ xhci_hcd 73170 0
97
97
  libata 140589 2 libahci,ahci
98
98
  sdhci 27053 1 sdhci_pci
99
99
  mmc_core 72460 2 sdhci,sdhci_pci
100
- ehci_hcd 40215 0
100
+ ehci_hcd 40215 0
101
101
  scsi_mod 162372 2 libata,sd_mod
102
102
  usbcore 128498 4 ehci_hcd,xhci_hcd,btusb
103
- e1000e 120822 0
103
+ e1000e 120822 0
104
104
  usb_common 12354 1 usbcore
105
- thermal 17383 0
105
+ thermal 17383 0
106
106
  thermal_sys 18040 3 thermal,processor,video
@@ -0,0 +1,30 @@
1
+ {
2
+ :experiment => 'my_foo_experiment',
3
+ :id => 'my_bar_application',
4
+ :collection => [
5
+ { :url => 'tcp://10.0.0.200:3003',
6
+ :streams => [
7
+ { :mp => 'radiotap',
8
+ :interval => 2,
9
+ :filters => [
10
+ {:field => 'sig_strength_dBm', :operation => 'avg'},
11
+ {:field => 'noise_strength_dBm', :operation => 'avg'},
12
+ {:field => 'power', :operation => 'avg', :rename => 'energy'}
13
+ ]
14
+ },
15
+ { :mp => 'udp',
16
+ :samples => 10,
17
+ :filters => [{:field => 'pkt_len', :operation => 'stddev'}]
18
+ }
19
+ ]
20
+ },
21
+ { :url => 'tcp://srv.mytestbed.net:3003',
22
+ :streams => [
23
+ { :mp => 'tcp',
24
+ :interval => 5,
25
+ :filters => [{:field => 'throughput', :operation => 'avg'}]
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ :available_mps => [
3
+ { :mp => 'radiotap',
4
+ :fields => [
5
+ {:field => 'sig_strength_dBm', :unit => 'dBm', :type => 'Fixnum'},
6
+ {:field => 'noise_strength_dBm', :unit => 'dBm', :type => 'Fixnum'},
7
+ ]
8
+ },
9
+ { :mp => 'udp',
10
+ :fields => [
11
+ {:field => 'source', :type => 'String'},
12
+ ]
13
+ },
14
+ ]
15
+ }
@@ -0,0 +1,17 @@
1
+ <omlc experiment='my_foo_experiment' id='my_bar_application'>
2
+ <collect url='tcp://10.0.0.200:3003'>
3
+ <stream mp='radiotap' interval='2'>
4
+ <filter field='sig_strength_dBm' operation='avg' />
5
+ <filter field='noise_strength_dBm' operation='avg' />
6
+ <filter field='power' operation='avg' rename='energy' />
7
+ </stream>
8
+ <stream mp='udp' samples='10'>
9
+ <filter field='pkt_len' operation='stddev' />
10
+ </stream>
11
+ </collect>
12
+ <collect url='tcp://srv.mytestbed.net:3003'>
13
+ <stream mp='tcp' interval='5'>
14
+ <filter field='throughput' operation='avg' />
15
+ </stream>
16
+ </collect>
17
+ </omlc>
@@ -58,7 +58,7 @@ describe AbstractResource do
58
58
  it "must add the resource to its created resource list" do
59
59
  child = @node.create(:wifi, { hrn: 'default_wifi' })
60
60
  @node.children.must_include child
61
- @node.request_child_resources[child.uid].must_equal 'default_wifi'
61
+ @node.request_child_resources.find { |v| v.uid == child.uid }.name.must_equal 'default_wifi'
62
62
  end
63
63
  end
64
64
 
@@ -130,10 +130,12 @@ describe AbstractResource do
130
130
  describe "when request/configure property not pre-defined in proxy" do
131
131
  it "must try property hash" do
132
132
  @node.property[:bob] = "bob"
133
+ @node.property[:false] = false
133
134
  @node.request_bob.must_equal "bob"
135
+ @node.request_false.must_equal false
134
136
  @node.configure_bob("not_bob")
135
137
  @node.request_bob.must_equal "not_bob"
136
- proc { @node.request_bobs_cousin }.must_raise NoMethodError
138
+ proc { @node.request_bobs_cousin }.must_raise OmfRc::UnknownPropertyError
137
139
  proc { @node.bobs_cousin }.must_raise NoMethodError
138
140
  end
139
141
  end