nitos_testbed_rc 1.0.0.pre.10 → 1.0.0.pre.11
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.
- data/README.md +32 -25
- data/bin/cm_proxy +18 -5
- data/bin/frisbee_proxy +15 -3
- data/bin/omf6 +1 -1
- data/etc/cm_proxy_conf.yaml +5 -2
- data/etc/frisbee_proxy_conf.yaml +3 -0
- data/etc/omf_script_conf.yaml +2 -2
- data/lib/nitos_testbed_rc/cm_factory.rb +4 -0
- data/lib/nitos_testbed_rc/frisbee.rb +4 -0
- data/lib/nitos_testbed_rc/frisbeed.rb +8 -0
- data/lib/nitos_testbed_rc/imagezip_client.rb +4 -0
- data/lib/nitos_testbed_rc/imagezip_server.rb +9 -1
- data/lib/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Prerequirements
|
|
21
21
|
|
22
22
|
Install frisbee, which is required by the frisbee proxy
|
23
23
|
|
24
|
-
|
24
|
+
$ apt-get install frisbee
|
25
25
|
|
26
26
|
If that fails add this line 'deb http://pkg.mytestbed.net/ubuntu precise/ ' to your /etc/apt/sources.list and then 'apt-get update'.
|
27
27
|
|
@@ -30,46 +30,48 @@ Installation
|
|
30
30
|
|
31
31
|
First you need to install the gem
|
32
32
|
|
33
|
-
|
33
|
+
$ gem install nitos_testbed_rc --pre
|
34
34
|
|
35
35
|
Then you need to run the install_ntrc script to generate the configuration files [tutorial](http://mytestbed.net/doc/omf/file.set_up_communication_server.html).
|
36
36
|
|
37
|
-
|
37
|
+
$ install_ntrc
|
38
38
|
|
39
39
|
Create certificates
|
40
40
|
-------------------
|
41
41
|
|
42
42
|
Use omf_cert.rb script to generate the following certificates and place them on directories '/root/.omf' and /root/.omf.
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
$ mkdir /root/.omf
|
45
|
+
$ mkdir /root/.omf/trusted_roots
|
46
|
+
$ cd /root/.omf
|
47
47
|
|
48
48
|
Create a root certificate (change DOMAIN).
|
49
49
|
|
50
50
|
Important!!! If you already have a root certificate (probably created while installing omf_sfa) DO NOT create this certificate again and use the old one instead.
|
51
51
|
|
52
|
-
|
52
|
+
$ omf_cert.rb --email root@DOMAIN -o /root/.omf/trusted_roots/root.pem --duration 5000000 create_root
|
53
53
|
|
54
54
|
Create a certificate for user_proxy of NTRC (change DOMAIN, XMPP_DOMAIN and if you wish the output file names).
|
55
55
|
|
56
|
-
|
56
|
+
$ omf_cert.rb -o user_factory.pem --email user_factory@DOMAIN --resource-type user_factory --resource-id xmpp://user_factory@XMPP_DOMAIN --root /root/.omf/trusted_roots/root.pem --duration 50000000 create_resource
|
57
57
|
|
58
58
|
Create a certificate for cm_proxy of NTRC (change DOMAIN, XMPP_DOMAIN and if you wish the output file names).
|
59
59
|
|
60
|
-
|
60
|
+
$ omf_cert.rb -o cm_factory.pem --email cm_factory@DOMAIN --resource-type cm_factory --resource-id xmpp://cm_factory@XMPP_DOMAIN --root /root/.omf/trusted_roots/root.pem --duration 50000000 create_resource
|
61
61
|
|
62
62
|
Create a certificate for frisbee_proxy of NTRC (change DOMAIN, XMPP_DOMAIN and if you wish the output file names).
|
63
63
|
|
64
|
-
|
64
|
+
$ omf_cert.rb -o frisbee_factory.pem --email frisbee_factory@DOMAIN --resource-type frisbee_factory --resource-id xmpp://frisbee_factory@XMPP_DOMAIN --root /root/.omf/trusted_roots/root.pem --duration 50000000 create_resource
|
65
65
|
|
66
66
|
|
67
|
+
Finally, omf6 script will be used by every user in the server, so we need to create a certificate for each user and place it in folder '~/.omf'.
|
67
68
|
|
68
|
-
|
69
|
+
Important (just for the root user)!!! If you already have a certificate for the root user in folder /root/.omf (probably created while installing omf_sfa) DO NOT create this certificate again and use the old one instead.
|
69
70
|
|
70
|
-
|
71
|
+
Use this commands to generate a certificate for a user (change DOMAIN, USERNAME and if you wish the output file names)
|
71
72
|
|
72
|
-
|
73
|
+
$ omf_cert.rb -o user_cert.pem --email USERNAME@DOMAIN --user USERNAME --root /root/.omf/trusted_roots/root.pem --duration 50000000 --geni_uri URI:urn:publicid:IDN+DOMAIN+user+USERNAME create_user
|
74
|
+
$ cp user_cert.pem /home/USERNAME/.omf
|
73
75
|
|
74
76
|
Configuration files
|
75
77
|
-------------------
|
@@ -159,16 +161,21 @@ Change configuration file '/etc/nitos_testbed_rc/frisbee_proxy_conf.yaml', which
|
|
159
161
|
|
160
162
|
Important!!! DO NOT modify the file /etc/nitos_testbed_rc/omf_script_conf.yaml. It is a skeleton used by the user_proxy to generate the configuration file for every user it creates.
|
161
163
|
|
162
|
-
Finaly, create/modify for each user the configuration file '
|
164
|
+
Finaly, create/modify for each user the configuration file '/home/USERNAME/.omf/etc/omf_script_conf.yaml', which is related to omf6 script of NTRC, every user of the testbed should have his own configuration file in order to use omf6 script.
|
165
|
+
|
166
|
+
$ mkdir /home/USERNAME/.omf/etc
|
167
|
+
$ cp /etc/nitos_testbed_rc/omf_script_conf.yaml /home/USERNAME/.omf/etc
|
168
|
+
|
169
|
+
For example:
|
163
170
|
|
164
171
|
:xmpp:
|
165
|
-
:script_user:
|
172
|
+
:script_user: USERNAME
|
166
173
|
:password: pw
|
167
174
|
:server: DOMAIN
|
168
175
|
:auth:
|
169
|
-
:root_cert_dir:
|
176
|
+
:root_cert_dir: /etc/nitos_testbed_rc/.omf/trusted_roots
|
170
177
|
:entity_cert: ~/.omf/user_cert.pem
|
171
|
-
:entity_key: ~/.
|
178
|
+
:entity_key: ~/.ssh/id_rsa
|
172
179
|
#operation mode for OmfCommon.init (development, production, etc)
|
173
180
|
:operationMode: development
|
174
181
|
#omf script configuration
|
@@ -181,9 +188,9 @@ Run proxies
|
|
181
188
|
|
182
189
|
To start/stop/restart the upstart service of nitos_testbed_rc use:
|
183
190
|
|
184
|
-
|
185
|
-
|
186
|
-
|
191
|
+
$ start ntrc
|
192
|
+
$ stop ntrc
|
193
|
+
$ restart ntrc
|
187
194
|
|
188
195
|
Starting ntrc as an upstart will generate the following log files:
|
189
196
|
|
@@ -195,17 +202,17 @@ Starting ntrc as an upstart will generate the following log files:
|
|
195
202
|
|
196
203
|
Alternatively (mostly for debugging reasons) you can execute all proxies with one command:
|
197
204
|
|
198
|
-
|
205
|
+
$ run_proxies
|
199
206
|
|
200
207
|
Or you run proxies seperatly
|
201
208
|
|
202
|
-
|
203
|
-
|
204
|
-
|
209
|
+
$ user_proxy
|
210
|
+
$ cm_proxy
|
211
|
+
$ frisbee_proxy
|
205
212
|
|
206
213
|
Run omf6 commands
|
207
214
|
-----------------
|
208
215
|
|
209
216
|
Now you can use omf6 script to execute omf6 related commands
|
210
217
|
|
211
|
-
|
218
|
+
$ omf6 --help
|
data/bin/cm_proxy
CHANGED
@@ -65,8 +65,13 @@ class CmPDP
|
|
65
65
|
resp = JSON.parse(response.body, :symbolize_names => true)
|
66
66
|
|
67
67
|
if response.header.code != '200'
|
68
|
-
|
69
|
-
|
68
|
+
if resp[:exception][:reason] == "No resources matching the request."
|
69
|
+
error "AUTH error: Node #{node_name} does not exist."
|
70
|
+
msg.properties.state.error_msg = "Node '#{node_name}' does not exist."
|
71
|
+
else
|
72
|
+
error "AUTH error: empty response"
|
73
|
+
msg.properties.state.error_msg = "#{resp[:exception][:reason]} - code: '#{resp[:exception][:code]}'"
|
74
|
+
end
|
70
75
|
return msg# next
|
71
76
|
end
|
72
77
|
|
@@ -77,13 +82,21 @@ class CmPDP
|
|
77
82
|
return msg
|
78
83
|
end
|
79
84
|
|
85
|
+
node = node[:resources].first
|
86
|
+
|
87
|
+
if @config[:testbedDomain] != "ALL" && node[:domain] != @config[:testbedDomain]
|
88
|
+
debug "This node does not belong to the domain '#{@config[:testbedDomain]}'"
|
89
|
+
msg.properties.state.ignore_msg = true
|
90
|
+
return msg
|
91
|
+
end
|
92
|
+
|
80
93
|
if acc == 'root'
|
81
|
-
debug "AUTH PASSED"
|
82
|
-
msg.properties.state.node = node
|
94
|
+
debug "AUTH PASSED (root account)"
|
95
|
+
msg.properties.state.node = node
|
83
96
|
return msg
|
84
97
|
end
|
85
98
|
|
86
|
-
|
99
|
+
|
87
100
|
lease = nil
|
88
101
|
unless node[:leases].nil?
|
89
102
|
node[:leases].each do |l|
|
data/bin/frisbee_proxy
CHANGED
@@ -69,8 +69,13 @@ class FrisbeePDP
|
|
69
69
|
resp = JSON.parse(response.body, :symbolize_names => true)
|
70
70
|
|
71
71
|
if response.header.code != '200'
|
72
|
-
|
73
|
-
|
72
|
+
if resp[:exception] == "No resources matching the request."
|
73
|
+
error "AUTH error: Node '#{node_name}' does not exist."
|
74
|
+
msg.properties.state.error_msg = "Node #{node_name} does not exist."
|
75
|
+
else
|
76
|
+
error "AUTH error: empty response"
|
77
|
+
msg.properties.state.error_msg = "#{resp[:reason]} - code: '#{resp[:exception][:code]}'"
|
78
|
+
end
|
74
79
|
return msg# next
|
75
80
|
end
|
76
81
|
|
@@ -82,8 +87,15 @@ class FrisbeePDP
|
|
82
87
|
end
|
83
88
|
|
84
89
|
node = node[:resources].first
|
90
|
+
|
91
|
+
if @config[:testbedDomain] != "ALL" && node[:domain] != @config[:testbedDomain]
|
92
|
+
debug "This node does not belong to the domain '#{@config[:testbedDomain]}'"
|
93
|
+
msg.properties.state.ignore_msg = true
|
94
|
+
return msg
|
95
|
+
end
|
96
|
+
|
85
97
|
if acc == 'root'
|
86
|
-
debug "AUTH PASSED"
|
98
|
+
debug "AUTH PASSED (root account)"
|
87
99
|
msg.properties.node = node
|
88
100
|
return msg
|
89
101
|
end
|
data/bin/omf6
CHANGED
@@ -787,7 +787,7 @@ def shut_down(comm)
|
|
787
787
|
comm.disconnect
|
788
788
|
end
|
789
789
|
|
790
|
-
OmfCommon.init(@config[:operationMode], communication: { url: "xmpp://#{@xmpp[:script_user]}:#{@xmpp[:password]}@#{@xmpp[:server]}", auth: {} }) do
|
790
|
+
OmfCommon.init(@config[:operationMode], {communication: { url: "xmpp://#{@xmpp[:script_user]}:#{@xmpp[:password]}@#{@xmpp[:server]}", auth: {}}, logging: {}}) do
|
791
791
|
OmfCommon.comm.on_connected do |comm|
|
792
792
|
OmfCommon::Auth::CertificateStore.instance.register_default_certs(trusted_roots)
|
793
793
|
entity.resource_id = OmfCommon.comm.local_topic.address
|
data/etc/cm_proxy_conf.yaml
CHANGED
@@ -15,11 +15,14 @@
|
|
15
15
|
#time (in seconds) before timeout error occurs
|
16
16
|
:timeout: 80
|
17
17
|
|
18
|
-
#
|
18
|
+
#the pxe configuration file in /tftpboot/pxelinux.cfg
|
19
19
|
:pxeSymLinkConfFile: omf-5.4
|
20
20
|
|
21
21
|
#operation mode for OmfCommon.init (development, production, etc)
|
22
22
|
:operationMode: development
|
23
23
|
|
24
24
|
#testbed xmpp topic
|
25
|
-
:testbedTopic: am_controller
|
25
|
+
:testbedTopic: am_controller
|
26
|
+
|
27
|
+
#testbed domain (resources with other domains will be ignored unless if this has the value 'ALL')
|
28
|
+
:testbedDomain: omf:testserver
|
data/etc/frisbee_proxy_conf.yaml
CHANGED
@@ -18,6 +18,9 @@
|
|
18
18
|
#testbed xmpp topic
|
19
19
|
:testbedTopic: am_controller
|
20
20
|
|
21
|
+
#testbed domain (resources with other domains will be ignored unless if this has the value 'ALL')
|
22
|
+
:testbedDomain: omf:testserver
|
23
|
+
|
21
24
|
#frisbee and imagezip configuration
|
22
25
|
:frisbee:
|
23
26
|
# Directory images are stored
|
data/etc/omf_script_conf.yaml
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
:auth:
|
6
6
|
:root_cert_dir: ~/.omf/trusted_roots
|
7
7
|
:entity_cert: ~/.omf/user_cert.pem
|
8
|
-
:entity_key: ~/.
|
8
|
+
:entity_key: ~/.ssh/id_rsa
|
9
9
|
#operation mode for OmfCommon.init (development, production, etc)
|
10
|
-
:operationMode:
|
10
|
+
:operationMode: production
|
11
11
|
#omf script configuration
|
12
12
|
:omf_script:
|
13
13
|
#default last action on load and save commands (reset or shutdown)
|
@@ -28,6 +28,10 @@ module OmfRc::ResourceProxy::CMFactory
|
|
28
28
|
}, :ALL)
|
29
29
|
next
|
30
30
|
end
|
31
|
+
if value.ignore_msg
|
32
|
+
#just ignore this message, another resource controller should take care of this message
|
33
|
+
next
|
34
|
+
end
|
31
35
|
nod = {}
|
32
36
|
nod[:node_name] = value.node[:name]
|
33
37
|
value.node[:interfaces].each do |i|
|
@@ -39,6 +39,10 @@ module OmfRc::ResourceProxy::Frisbee #frisbee client
|
|
39
39
|
}, :ALL)
|
40
40
|
next
|
41
41
|
end
|
42
|
+
if client.opts.ignore_msg
|
43
|
+
#just ignore this message, another resource controller should take care of this message
|
44
|
+
next
|
45
|
+
end
|
42
46
|
nod = {}
|
43
47
|
nod[:node_name] = client.opts.node.name
|
44
48
|
client.opts.node.interfaces.each do |i|
|
@@ -28,6 +28,14 @@ module OmfRc::ResourceProxy::Frisbeed
|
|
28
28
|
|
29
29
|
|
30
30
|
hook :after_initial_configured do |server|
|
31
|
+
debug "Received message '#{server.opts.inspect}'"
|
32
|
+
if error_msg = server.opts.error_msg
|
33
|
+
next
|
34
|
+
end
|
35
|
+
if server.opts.ignore_msg
|
36
|
+
#just ignore this message, another resource controller should take care of this message
|
37
|
+
next
|
38
|
+
end
|
31
39
|
server.property.app_id = server.hrn.nil? ? server.uid : server.hrn
|
32
40
|
server.property.image = server.property.image.nil? ? @fconf[:imageDir] + '/' + @fconf[:defaultImage] : server.property.image
|
33
41
|
server.property.image = server.property.image.start_with?('/') ? server.property.image : @fconf[:imageDir] + '/' + server.property.image
|
@@ -38,6 +38,10 @@ module OmfRc::ResourceProxy::ImagezipClient #Imagezip client
|
|
38
38
|
}, :ALL)
|
39
39
|
next
|
40
40
|
end
|
41
|
+
if client.opts.ignore_msg
|
42
|
+
#just ignore this message, another resource controller should take care of this message
|
43
|
+
next
|
44
|
+
end
|
41
45
|
|
42
46
|
nod = {}
|
43
47
|
nod[:node_name] = client.opts.node.name
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#Imagezip
|
1
|
+
#Imagezip server
|
2
2
|
#created by parent :frisbee_factory
|
3
3
|
#used in save command
|
4
4
|
|
@@ -24,6 +24,14 @@ module OmfRc::ResourceProxy::ImagezipServer #Imagezip server
|
|
24
24
|
property :image_name, :default => @fconf[:imageDir] + '/new_image.ndz'
|
25
25
|
|
26
26
|
hook :after_initial_configured do |server|
|
27
|
+
debug "Received message '#{server.opts.inspect}'"
|
28
|
+
if error_msg = server.opts.error_msg
|
29
|
+
next
|
30
|
+
end
|
31
|
+
if server.opts.ignore_msg
|
32
|
+
#just ignore this message, another resource controller should take care of this message
|
33
|
+
next
|
34
|
+
end
|
27
35
|
server.property.app_id = server.hrn.nil? ? server.uid : server.hrn
|
28
36
|
server.property.image_name = server.property.image_name.nil? ? @fconf[:imageDir] + '/' + @fconf[:defaultImage] : server.property.image_name
|
29
37
|
server.property.image_name = server.property.image_name.start_with?('/') ? server.property.image_name : @fconf[:imageDir] + '/' + server.property.image_name
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nitos_testbed_rc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.
|
4
|
+
version: 1.0.0.pre.11
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omf_common
|