omf_common 6.0.2.pre.2 → 6.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/file_broadcaster.rb +5 -0
- data/bin/file_receiver.rb +5 -0
- data/bin/omf_keygen +3 -3
- data/bin/omf_send_configure +114 -0
- data/bin/omf_send_request +19 -4
- data/example/engine_alt.rb +13 -7
- data/example/viz/garage_monitor.rb +69 -0
- data/example/viz/garage_viz.rb +52 -0
- data/example/viz/htdocs/image/garage.png +0 -0
- data/example/viz/htdocs/template/garage_banner.html +2 -0
- data/example/viz/layout.yaml +44 -0
- data/example/vm_alt.rb +5 -0
- data/lib/omf_common.rb +17 -8
- data/lib/omf_common/auth.rb +5 -0
- data/lib/omf_common/auth/certificate.rb +21 -2
- data/lib/omf_common/auth/certificate_store.rb +50 -20
- data/lib/omf_common/auth/ssh_pub_key_convert.rb +7 -0
- data/lib/omf_common/comm.rb +6 -1
- data/lib/omf_common/comm/amqp/amqp_communicator.rb +88 -12
- data/lib/omf_common/comm/amqp/amqp_file_transfer.rb +5 -0
- data/lib/omf_common/comm/amqp/amqp_topic.rb +37 -18
- data/lib/omf_common/comm/local/local_communicator.rb +5 -0
- data/lib/omf_common/comm/local/local_topic.rb +5 -0
- data/lib/omf_common/comm/topic.rb +32 -13
- data/lib/omf_common/comm/xmpp/communicator.rb +11 -1
- data/lib/omf_common/comm/xmpp/topic.rb +5 -0
- data/lib/omf_common/comm/xmpp/xmpp_mp.rb +5 -0
- data/lib/omf_common/command.rb +5 -0
- data/lib/omf_common/core_ext/string.rb +5 -0
- data/lib/omf_common/default_logging.rb +23 -5
- data/lib/omf_common/eventloop.rb +40 -23
- data/lib/omf_common/eventloop/em.rb +18 -5
- data/lib/omf_common/eventloop/local_evl.rb +18 -15
- data/lib/omf_common/exec_app.rb +44 -24
- data/lib/omf_common/key.rb +5 -0
- data/lib/omf_common/measure.rb +5 -0
- data/lib/omf_common/message.rb +5 -0
- data/lib/omf_common/message/json/json_message.rb +13 -5
- data/lib/omf_common/message/xml/message.rb +19 -4
- data/lib/omf_common/message/xml/relaxng_schema.rb +5 -0
- data/lib/omf_common/message/xml/topic_message.rb +5 -0
- data/lib/omf_common/version.rb +6 -1
- data/omf_common.gemspec +3 -2
- data/test/fixture/1st_level.pem +20 -0
- data/test/fixture/2nd_level.pem +19 -0
- data/test/fixture/3rd_level.pem +19 -0
- data/test/fixture/pubsub.rb +5 -0
- data/test/fixture/rc.pem +18 -0
- data/test/fixture/root.pem +17 -0
- data/test/omf_common/auth/certificate_spec.rb +27 -0
- data/test/omf_common/auth/certificate_store_spec.rb +58 -0
- data/test/omf_common/auth/ssh_pub_key_convert_spec.rb +5 -0
- data/test/omf_common/comm/topic_spec.rb +7 -1
- data/test/omf_common/comm/xmpp/communicator_spec.rb +5 -0
- data/test/omf_common/comm/xmpp/topic_spec.rb +5 -0
- data/test/omf_common/comm_spec.rb +5 -0
- data/test/omf_common/command_spec.rb +5 -0
- data/test/omf_common/core_ext/string_spec.rb +5 -0
- data/test/omf_common/message/xml/message_spec.rb +5 -0
- data/test/omf_common/message_spec.rb +8 -3
- data/test/test_helper.rb +5 -0
- metadata +48 -11
@@ -0,0 +1,58 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
6
|
+
require 'test_helper'
|
7
|
+
|
8
|
+
describe OmfCommon::Auth::CertificateStore do
|
9
|
+
before do
|
10
|
+
OmfCommon::Auth::CertificateStore.init
|
11
|
+
@private_folder = "#{File.dirname(__FILE__)}/../../fixture"
|
12
|
+
end
|
13
|
+
|
14
|
+
after do
|
15
|
+
OmfCommon::Auth::CertificateStore.reset
|
16
|
+
end
|
17
|
+
|
18
|
+
it "must register certificate instance" do
|
19
|
+
cert = OmfCommon::Auth::Certificate.create_from_x509(File.read "#{@private_folder}/1st_level.pem")
|
20
|
+
|
21
|
+
OmfCommon::Auth::CertificateStore.instance.register(cert, 'ca1')
|
22
|
+
|
23
|
+
OmfCommon::Auth::CertificateStore.instance.cert_for("ca1").must_equal cert
|
24
|
+
end
|
25
|
+
|
26
|
+
it "must verify certificate aginst store" do
|
27
|
+
# 2 level CAs
|
28
|
+
cert_1 = OmfCommon::Auth::Certificate.create_from_x509(File.read "#{@private_folder}/1st_level.pem")
|
29
|
+
cert_2 = OmfCommon::Auth::Certificate.create_from_x509(File.read "#{@private_folder}/2nd_level.pem")
|
30
|
+
cert_3 = OmfCommon::Auth::Certificate.create_from_x509(File.read "#{@private_folder}/3rd_level.pem")
|
31
|
+
|
32
|
+
|
33
|
+
# 1 level CA
|
34
|
+
|
35
|
+
cert_4 = OmfCommon::Auth::Certificate.create(nil, 'omf_ca', 'ca', 'omf')
|
36
|
+
key = OpenSSL::PKey::RSA.new(2048)
|
37
|
+
cert_5 = cert_4.create_for('my_add', 'bob', 'my_resource', 'omf', 365, key.public_key)
|
38
|
+
|
39
|
+
OmfCommon::Auth::CertificateStore.instance.verify(cert_2.to_x509).must_equal false
|
40
|
+
|
41
|
+
OmfCommon::Auth::CertificateStore.instance.register(cert_1)
|
42
|
+
OmfCommon::Auth::CertificateStore.instance.verify(cert_2.to_x509).must_equal true
|
43
|
+
OmfCommon::Auth::CertificateStore.instance.verify(cert_3.to_x509).must_equal false
|
44
|
+
|
45
|
+
OmfCommon::Auth::CertificateStore.instance.register(cert_2)
|
46
|
+
OmfCommon::Auth::CertificateStore.instance.verify(cert_3.to_x509).must_equal true
|
47
|
+
OmfCommon::Auth::CertificateStore.instance.verify(cert_5.to_x509).must_equal false
|
48
|
+
|
49
|
+
OmfCommon::Auth::CertificateStore.instance.register(cert_4)
|
50
|
+
OmfCommon::Auth::CertificateStore.instance.verify(cert_5.to_x509).must_equal true
|
51
|
+
end
|
52
|
+
|
53
|
+
it "wont die if registering same cert again" do
|
54
|
+
cert_1 = OmfCommon::Auth::Certificate.create_from_x509(File.read "#{@private_folder}/1st_level.pem")
|
55
|
+
OmfCommon::Auth::CertificateStore.instance.register(cert_1)
|
56
|
+
OmfCommon::Auth::CertificateStore.instance.register(cert_1)
|
57
|
+
end
|
58
|
+
end
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
1
6
|
require 'test_helper'
|
2
7
|
|
3
8
|
describe OmfCommon::Auth::SSHPubKeyConvert do
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
1
6
|
require 'test_helper'
|
2
7
|
|
3
8
|
describe OmfCommon::Comm::Topic do
|
@@ -44,6 +49,7 @@ describe OmfCommon::Comm::Topic do
|
|
44
49
|
OmfCommon.stubs(:comm).returns(@comm)
|
45
50
|
@topic = OmfCommon::Comm::Topic.create(:bob)
|
46
51
|
@comm.stubs(:local_address).returns(:bob_address)
|
52
|
+
@comm.stubs(:create_topic).returns(@topic)
|
47
53
|
end
|
48
54
|
|
49
55
|
after do
|
@@ -84,7 +90,7 @@ describe OmfCommon::Comm::Topic do
|
|
84
90
|
lambda { @topic.send(m_name) }.must_raise ArgumentError
|
85
91
|
cbk = proc {}
|
86
92
|
@topic.send(m_name, &(cbk))
|
87
|
-
@topic.handlers[name].must_include cbk
|
93
|
+
@topic.handlers[name].values.must_include cbk
|
88
94
|
end
|
89
95
|
|
90
96
|
@topic.class_eval do
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
1
6
|
require 'test_helper'
|
2
7
|
require 'fixture/pubsub'
|
3
8
|
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
1
6
|
require 'test_helper'
|
2
7
|
require 'fixture/pubsub'
|
3
8
|
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
1
6
|
require 'test_helper'
|
2
7
|
require 'omf_common/comm/local/local_communicator'
|
3
8
|
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
1
6
|
require 'test_helper'
|
2
7
|
require 'omf_common/command'
|
3
8
|
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
1
6
|
require 'test_helper'
|
2
7
|
|
3
8
|
describe String do
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
1
6
|
require 'test_helper'
|
2
7
|
require 'omf_common/message/xml/message'
|
3
8
|
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
1
6
|
require 'test_helper'
|
2
7
|
|
3
8
|
describe OmfCommon::Message do
|
@@ -46,12 +51,12 @@ describe OmfCommon::Message do
|
|
46
51
|
it "must be able to pretty print an app_event message" do
|
47
52
|
@message = OmfCommon::Message.create(:inform,
|
48
53
|
{ status_type: 'APP_EVENT',
|
49
|
-
event: '
|
54
|
+
event: 'EXIT',
|
50
55
|
app: 'app100',
|
51
|
-
msg: '
|
56
|
+
msg: '0',
|
52
57
|
seq: 1 },
|
53
58
|
{ itype: 'STATUS' })
|
54
|
-
@message.print_app_event.must_equal "APP_EVENT (app100, #1,
|
59
|
+
@message.print_app_event.must_equal "APP_EVENT (app100, #1, EXIT): 0"
|
55
60
|
end
|
56
61
|
|
57
62
|
it "must return inform type (itype), formatted" do
|
data/test/test_helper.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (c) 2012 National ICT Australia Limited (NICTA).
|
2
|
+
# This software may be used and distributed solely under the terms of the MIT license (License).
|
3
|
+
# You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
|
4
|
+
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
|
+
|
1
6
|
require 'simplecov'
|
2
7
|
SimpleCov.start { add_filter "/test" }
|
3
8
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.2
|
5
|
-
prerelease:
|
4
|
+
version: 6.0.2
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- NICTA
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -96,17 +96,17 @@ dependencies:
|
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - '='
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.
|
101
|
+
version: 1.0.3
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - '='
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.
|
109
|
+
version: 1.0.3
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: blather
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,7 +114,7 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.8.
|
117
|
+
version: 0.8.4
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - '='
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 0.8.
|
125
|
+
version: 0.8.4
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: logging
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +171,22 @@ dependencies:
|
|
171
171
|
- - ~>
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: 2.9.1
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: json
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ~>
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 1.7.7
|
182
|
+
type: :runtime
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ~>
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: 1.7.7
|
174
190
|
description: Common library of OMF, a generic framework for controlling and managing
|
175
191
|
networking testbeds.
|
176
192
|
email:
|
@@ -189,10 +205,16 @@ files:
|
|
189
205
|
- bin/file_receiver.rb
|
190
206
|
- bin/omf_keygen
|
191
207
|
- bin/omf_monitor_topic
|
208
|
+
- bin/omf_send_configure
|
192
209
|
- bin/omf_send_create
|
193
210
|
- bin/omf_send_request
|
194
211
|
- example/engine_alt.rb
|
195
212
|
- example/ls_app.yaml
|
213
|
+
- example/viz/garage_monitor.rb
|
214
|
+
- example/viz/garage_viz.rb
|
215
|
+
- example/viz/htdocs/image/garage.png
|
216
|
+
- example/viz/htdocs/template/garage_banner.html
|
217
|
+
- example/viz/layout.yaml
|
196
218
|
- example/vm_alt.rb
|
197
219
|
- lib/omf_common.rb
|
198
220
|
- lib/omf_common/auth.rb
|
@@ -227,12 +249,18 @@ files:
|
|
227
249
|
- lib/omf_common/protocol/6.0.rng
|
228
250
|
- lib/omf_common/version.rb
|
229
251
|
- omf_common.gemspec
|
252
|
+
- test/fixture/1st_level.pem
|
253
|
+
- test/fixture/2nd_level.pem
|
254
|
+
- test/fixture/3rd_level.pem
|
230
255
|
- test/fixture/omf_test.cert.pem
|
231
256
|
- test/fixture/omf_test.pem
|
232
257
|
- test/fixture/omf_test.pub
|
233
258
|
- test/fixture/omf_test.pub.pem
|
234
259
|
- test/fixture/pubsub.rb
|
260
|
+
- test/fixture/rc.pem
|
261
|
+
- test/fixture/root.pem
|
235
262
|
- test/omf_common/auth/certificate_spec.rb
|
263
|
+
- test/omf_common/auth/certificate_store_spec.rb
|
236
264
|
- test/omf_common/auth/ssh_pub_key_convert_spec.rb
|
237
265
|
- test/omf_common/comm/topic_spec.rb
|
238
266
|
- test/omf_common/comm/xmpp/communicator_spec.rb
|
@@ -259,9 +287,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
259
287
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
288
|
none: false
|
261
289
|
requirements:
|
262
|
-
- - ! '
|
290
|
+
- - ! '>='
|
263
291
|
- !ruby/object:Gem::Version
|
264
|
-
version:
|
292
|
+
version: '0'
|
293
|
+
segments:
|
294
|
+
- 0
|
295
|
+
hash: 475954182867685216
|
265
296
|
requirements: []
|
266
297
|
rubyforge_project: omf_common
|
267
298
|
rubygems_version: 1.8.25
|
@@ -269,12 +300,18 @@ signing_key:
|
|
269
300
|
specification_version: 3
|
270
301
|
summary: Common library of OMF
|
271
302
|
test_files:
|
303
|
+
- test/fixture/1st_level.pem
|
304
|
+
- test/fixture/2nd_level.pem
|
305
|
+
- test/fixture/3rd_level.pem
|
272
306
|
- test/fixture/omf_test.cert.pem
|
273
307
|
- test/fixture/omf_test.pem
|
274
308
|
- test/fixture/omf_test.pub
|
275
309
|
- test/fixture/omf_test.pub.pem
|
276
310
|
- test/fixture/pubsub.rb
|
311
|
+
- test/fixture/rc.pem
|
312
|
+
- test/fixture/root.pem
|
277
313
|
- test/omf_common/auth/certificate_spec.rb
|
314
|
+
- test/omf_common/auth/certificate_store_spec.rb
|
278
315
|
- test/omf_common/auth/ssh_pub_key_convert_spec.rb
|
279
316
|
- test/omf_common/comm/topic_spec.rb
|
280
317
|
- test/omf_common/comm/xmpp/communicator_spec.rb
|