omf_rc 6.0.0.pre.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +16 -0
- data/bin/omf_rc +64 -0
- data/config/omf_rc.yml +70 -0
- data/integration_test/omf_rc/resource_proxy/app_spec.rb +25 -0
- data/integration_test/omf_rc/resource_proxy/interface_spec.rb +26 -0
- data/integration_test/omf_rc/resource_proxy/mock_spec.rb +58 -0
- data/integration_test/omf_rc/resource_proxy/node_spec.rb +26 -0
- data/integration_test/omf_rc/resource_proxy/wifi_spec.rb +30 -0
- data/integration_test/test_helper.rb +5 -0
- data/lib/omf_rc/deferred_process.rb +20 -0
- data/lib/omf_rc/message_process_error.rb +11 -0
- data/lib/omf_rc/resource_factory.rb +74 -0
- data/lib/omf_rc/resource_proxy/abstract_resource.rb +257 -0
- data/lib/omf_rc/resource_proxy/interface.rb +48 -0
- data/lib/omf_rc/resource_proxy/mock.rb +16 -0
- data/lib/omf_rc/resource_proxy/node.rb +17 -0
- data/lib/omf_rc/resource_proxy/wifi.rb +8 -0
- data/lib/omf_rc/resource_proxy_dsl.rb +170 -0
- data/lib/omf_rc/util/iw.rb +22 -0
- data/lib/omf_rc/util/mock.rb +27 -0
- data/lib/omf_rc/util/mod.rb +23 -0
- data/lib/omf_rc/util/package.rb +17 -0
- data/lib/omf_rc/version.rb +3 -0
- data/lib/omf_rc.rb +6 -0
- data/omf_rc.gemspec +25 -0
- data/test/omf_rc/deferred_process_spec.rb +39 -0
- data/test/omf_rc/resource_factory_spec.rb +18 -0
- data/test/omf_rc/resource_proxy/abstract_resource_spec.rb +82 -0
- data/test/omf_rc/resource_proxy_dsl_spec.rb +43 -0
- data/test/test_helper.rb +11 -0
- metadata +128 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'omf_rc/resource_factory'
|
3
|
+
|
4
|
+
describe OmfRc::ResourceFactory do
|
5
|
+
describe "when resource proxies loaded" do
|
6
|
+
it "must have list of registered proxies and utilities" do
|
7
|
+
OmfRc::ResourceFactory.proxy_list.must_include :mock
|
8
|
+
end
|
9
|
+
|
10
|
+
it "must be able to create new resource proxy" do
|
11
|
+
mock = OmfRc::ResourceFactory.new(:mock)
|
12
|
+
mock.must_be_kind_of OmfRc::ResourceProxy::AbstractResource
|
13
|
+
mock.must_respond_to :request_nothing
|
14
|
+
mock.request_nothing.must_equal mock.uid
|
15
|
+
mock.must_respond_to :configure_nothing
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'omf_rc/resource_factory'
|
3
|
+
|
4
|
+
include OmfRc::ResourceProxy
|
5
|
+
|
6
|
+
module OmfRc::ResourceProxy
|
7
|
+
module Node
|
8
|
+
include OmfRc::ResourceProxyDSL
|
9
|
+
register_proxy :node
|
10
|
+
|
11
|
+
register_request :name
|
12
|
+
register_configure :name
|
13
|
+
end
|
14
|
+
|
15
|
+
module Interface
|
16
|
+
include OmfRc::ResourceProxyDSL
|
17
|
+
register_proxy :interface
|
18
|
+
end
|
19
|
+
|
20
|
+
module Wifi
|
21
|
+
include OmfRc::ResourceProxyDSL
|
22
|
+
register_proxy :wifi
|
23
|
+
end
|
24
|
+
|
25
|
+
module Mock
|
26
|
+
include OmfRc::ResourceProxyDSL
|
27
|
+
register_proxy :mock
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe AbstractResource do
|
32
|
+
before do
|
33
|
+
@node = OmfRc::ResourceFactory.new(:node, { hrn: 'default_node' })
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "when intialised" do
|
37
|
+
it "must convert configuration hash into instance methods, and assign the values" do
|
38
|
+
@node.type.must_equal 'node'
|
39
|
+
end
|
40
|
+
|
41
|
+
it "must have an unique id generated" do
|
42
|
+
@node.uid.must_match /.{8}-.{4}-.{4}-.{4}-.{12}/
|
43
|
+
@node.request_uid.must_match /.{8}-.{4}-.{4}-.{4}-.{12}/
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "when asked to create another resource" do
|
48
|
+
it "must return the newly created resource" do
|
49
|
+
@node.create(:interface).must_be_kind_of AbstractResource
|
50
|
+
end
|
51
|
+
|
52
|
+
it "must add the resource to its created resource list" do
|
53
|
+
child = @node.create(:wifi, { hrn: 'default_wifi' })
|
54
|
+
@node.children.must_include child
|
55
|
+
@node.request_child_resources[child.uid].must_equal 'default_wifi'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "when destroyed" do
|
60
|
+
it "must destroy itself together with any resources created by it" do
|
61
|
+
@node.release
|
62
|
+
@node.frozen?.must_equal true
|
63
|
+
@node.children.must_be_empty
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "when asked for the funcitonalities it supports" do
|
68
|
+
it "must returned all the properties can be requested & configured" do
|
69
|
+
@node.request_available_properties.must_be_kind_of Hashie::Mash
|
70
|
+
@node.request_available_properties.configure.must_include :name
|
71
|
+
@node.request_available_properties.request.must_include :name
|
72
|
+
end
|
73
|
+
|
74
|
+
it "must be able to request and configure some common properties" do
|
75
|
+
@node.request_hrn.must_equal 'default_node'
|
76
|
+
@node.configure_hrn('bob')
|
77
|
+
@node.request_hrn.must_equal 'bob'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'omf_rc/resource_proxy_dsl'
|
3
|
+
|
4
|
+
describe OmfRc::ResourceProxyDSL do
|
5
|
+
before do
|
6
|
+
module OmfRc::Util::MockUtility
|
7
|
+
include OmfRc::ResourceProxyDSL
|
8
|
+
register_utility :mock_utility
|
9
|
+
register_configure :alpha
|
10
|
+
register_request :alpha
|
11
|
+
end
|
12
|
+
|
13
|
+
module OmfRc::ResourceProxy::MockProxy
|
14
|
+
include OmfRc::ResourceProxyDSL
|
15
|
+
|
16
|
+
register_proxy :mock_proxy
|
17
|
+
utility :mock_utility
|
18
|
+
|
19
|
+
register_hook :before_ready do
|
20
|
+
"bob"
|
21
|
+
end
|
22
|
+
register_hook :before_release
|
23
|
+
register_configure :bravo
|
24
|
+
register_request :bravo
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "when included by modules to define resource proxy functionalities" do
|
29
|
+
it "must be able to register the modules" do
|
30
|
+
OmfRc::ResourceFactory.proxy_list.must_include :mock_proxy
|
31
|
+
OmfRc::ResourceFactory.utility_list.must_include :mock_utility
|
32
|
+
end
|
33
|
+
|
34
|
+
it "must be able to define methods" do
|
35
|
+
OmfRc::Util::MockUtility.method_defined?(:configure_alpha).must_equal true
|
36
|
+
OmfRc::Util::MockUtility.method_defined?(:request_alpha).must_equal true
|
37
|
+
OmfRc::ResourceProxy::MockProxy.method_defined?(:configure_alpha).must_equal true
|
38
|
+
OmfRc::ResourceProxy::MockProxy.method_defined?(:request_alpha).must_equal true
|
39
|
+
OmfRc::ResourceProxy::MockProxy.method_defined?(:before_ready).must_equal true
|
40
|
+
OmfRc::ResourceProxy::MockProxy.method_defined?(:before_release).must_equal true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omf_rc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 6.0.0.pre.2
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- NICTA
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: minitest
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.11.3
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.11.3
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: em-minitest-spec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.1.1
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.1.1
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: omf_common
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 6.0.0.pre
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 6.0.0.pre
|
62
|
+
description: Resource controller of OMF, a generic framework for controlling and managing
|
63
|
+
networking testbeds.
|
64
|
+
email:
|
65
|
+
- omf-user@lists.nicta.com.au
|
66
|
+
executables:
|
67
|
+
- omf_rc
|
68
|
+
extensions: []
|
69
|
+
extra_rdoc_files: []
|
70
|
+
files:
|
71
|
+
- .gitignore
|
72
|
+
- Gemfile
|
73
|
+
- Rakefile
|
74
|
+
- bin/omf_rc
|
75
|
+
- config/omf_rc.yml
|
76
|
+
- integration_test/omf_rc/resource_proxy/app_spec.rb
|
77
|
+
- integration_test/omf_rc/resource_proxy/interface_spec.rb
|
78
|
+
- integration_test/omf_rc/resource_proxy/mock_spec.rb
|
79
|
+
- integration_test/omf_rc/resource_proxy/node_spec.rb
|
80
|
+
- integration_test/omf_rc/resource_proxy/wifi_spec.rb
|
81
|
+
- integration_test/test_helper.rb
|
82
|
+
- lib/omf_rc.rb
|
83
|
+
- lib/omf_rc/deferred_process.rb
|
84
|
+
- lib/omf_rc/message_process_error.rb
|
85
|
+
- lib/omf_rc/resource_factory.rb
|
86
|
+
- lib/omf_rc/resource_proxy/abstract_resource.rb
|
87
|
+
- lib/omf_rc/resource_proxy/interface.rb
|
88
|
+
- lib/omf_rc/resource_proxy/mock.rb
|
89
|
+
- lib/omf_rc/resource_proxy/node.rb
|
90
|
+
- lib/omf_rc/resource_proxy/wifi.rb
|
91
|
+
- lib/omf_rc/resource_proxy_dsl.rb
|
92
|
+
- lib/omf_rc/util/iw.rb
|
93
|
+
- lib/omf_rc/util/mock.rb
|
94
|
+
- lib/omf_rc/util/mod.rb
|
95
|
+
- lib/omf_rc/util/package.rb
|
96
|
+
- lib/omf_rc/version.rb
|
97
|
+
- omf_rc.gemspec
|
98
|
+
- test/omf_rc/deferred_process_spec.rb
|
99
|
+
- test/omf_rc/resource_factory_spec.rb
|
100
|
+
- test/omf_rc/resource_proxy/abstract_resource_spec.rb
|
101
|
+
- test/omf_rc/resource_proxy_dsl_spec.rb
|
102
|
+
- test/test_helper.rb
|
103
|
+
homepage: https://www.mytestbed.net
|
104
|
+
licenses: []
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>'
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 1.3.1
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project: omf_rc
|
123
|
+
rubygems_version: 1.8.23
|
124
|
+
signing_key:
|
125
|
+
specification_version: 3
|
126
|
+
summary: OMF resource controller
|
127
|
+
test_files: []
|
128
|
+
has_rdoc:
|