nitos_testbed_rc 1.0.0.pre.11 → 1.0.0.pre.12

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 CHANGED
@@ -39,7 +39,7 @@ Then you need to run the install_ntrc script to generate the configuration files
39
39
  Create certificates
40
40
  -------------------
41
41
 
42
- Use omf_cert.rb script to generate the following certificates and place them on directories '/root/.omf' and /root/.omf.
42
+ Use omf_cert.rb script to generate the following certificates and place them on directories '/root/.omf' and '/root/.omf/trusted_roots'.
43
43
 
44
44
  $ mkdir /root/.omf
45
45
  $ mkdir /root/.omf/trusted_roots
data/bin/cm_proxy CHANGED
@@ -84,15 +84,27 @@ class CmPDP
84
84
 
85
85
  node = node[:resources].first
86
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
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
92
 
93
+ nod = {}
94
+ nod[:node_name] = node[:name]
95
+ node[:interfaces].each do |i|
96
+ if i[:role] == "control"
97
+ nod[:node_ip] = i[:ip][:address]
98
+ nod[:node_mac] = i[:mac]
99
+ elsif i[:role] == "cm_network"
100
+ nod[:node_cm_ip] = i[:ip][:address]
101
+ end
102
+ end
103
+ nod[:node_cm_ip] = node[:cmc][:ip][:address]
104
+
93
105
  if acc == 'root'
94
106
  debug "AUTH PASSED (root account)"
95
- msg.properties.state.node = node
107
+ msg.properties.state.node = nod
96
108
  return msg
97
109
  end
98
110
 
@@ -115,7 +127,7 @@ class CmPDP
115
127
  return msg
116
128
  else
117
129
  debug "AUTH PASSED"
118
- msg.properties.state.node = node
130
+ msg.properties.state.node = nod
119
131
  return msg
120
132
  end
121
133
  # wait = true
data/bin/frisbee_proxy CHANGED
@@ -88,15 +88,27 @@ class FrisbeePDP
88
88
 
89
89
  node = node[:resources].first
90
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
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
+
97
+ nod = {}
98
+ nod[:node_name] = node[:name]
99
+ node[:interfaces].each do |i|
100
+ if i[:role] == "control"
101
+ nod[:node_ip] = i[:ip][:address]
102
+ nod[:node_mac] = i[:mac]
103
+ elsif i[:role] == "cm_network"
104
+ nod[:node_cm_ip] = i[:ip][:address]
105
+ end
95
106
  end
107
+ nod[:node_cm_ip] = node[:cmc][:ip][:address]
96
108
 
97
109
  if acc == 'root'
98
110
  debug "AUTH PASSED (root account)"
99
- msg.properties.node = node
111
+ msg.properties.node = nod
100
112
  return msg
101
113
  end
102
114
 
@@ -118,7 +130,7 @@ class FrisbeePDP
118
130
  return msg
119
131
  else
120
132
  debug "AUTH PASSED"
121
- msg.properties.node = node
133
+ msg.properties.node = nod
122
134
  return msg
123
135
  end
124
136
  # wait = true
@@ -199,7 +211,6 @@ class FrisbeePDP
199
211
  debug "AUTH PASSED"
200
212
  return msg
201
213
  end
202
- # msg
203
214
  end
204
215
 
205
216
  private
data/bin/omf6 CHANGED
@@ -4,11 +4,16 @@ require 'time'
4
4
  require 'omf_common'
5
5
  require 'optparse'
6
6
  require 'progress_bar'
7
+ require 'erb'
8
+ require 'socket'
9
+
7
10
  CONF_PATH = '~/.omf/etc/omf_script_conf.yaml'
8
11
  FRISB_PATH = '/etc/nitos_testbed_rc/frisbee_proxy_conf.yaml'
9
12
  CM_PATH = '/etc/nitos_testbed_rc/cm_proxy_conf.yaml'
10
13
 
11
- @config = YAML.load_file(File.expand_path(CONF_PATH))
14
+ conf_file = File.read(File.expand_path(CONF_PATH))
15
+ conf_file = ERB.new(conf_file, nil).result(binding)
16
+ @config = YAML.load(conf_file)
12
17
  # @config = YAML.load_file(File.join(File.dirname(File.expand_path(__FILE__)), '.../etc/omf_script_conf.yaml'))
13
18
  @auth = @config[:auth]
14
19
  @xmpp = @config[:xmpp]
@@ -501,7 +506,7 @@ def save(comm, options)
501
506
  start_saving()
502
507
  puts "INFO: Starting Imagezip Server on port '#{port}'"
503
508
  create_imagezip_server(comm, fcontroller, port, options)
504
- sleep 2
509
+ sleep 1
505
510
  puts "INFO: Starting Imagezip Client on node '#{options[:node]}'"
506
511
  create_imagezip_client(comm, fcontroller, options[:node], port, options)
507
512
  print "INFO: Saving Image for node '#{options[:node]}'..."
@@ -1,9 +1,9 @@
1
1
  :xmpp:
2
2
  :script_user: script_user
3
3
  :password: pw
4
- :server: testserver
4
+ :server: <% Socket.gethostname %>.inf.uth.gr
5
5
  :auth:
6
- :root_cert_dir: ~/.omf/trusted_roots
6
+ :root_cert_dir: /etc/nitos_testbed_rc/trusted_roots
7
7
  :entity_cert: ~/.omf/user_cert.pem
8
8
  :entity_key: ~/.ssh/id_rsa
9
9
  #operation mode for OmfCommon.init (development, production, etc)
@@ -28,21 +28,22 @@ 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
35
- nod = {}
36
- nod[:node_name] = value.node[:name]
37
- value.node[:interfaces].each do |i|
38
- if i[:role] == "control"
39
- nod[:node_ip] = i[:ip][:address]
40
- nod[:node_mac] = i[:mac]
41
- elsif i[:role] == "cm_network"
42
- nod[:node_cm_ip] = i[:ip][:address]
43
- end
44
- end
45
- nod[:node_cm_ip] = value.node[:cmc][:ip][:address]
31
+ # if value.ignore_msg
32
+ # #just ignore this message, another resource controller should take care of this message
33
+ # next
34
+ # end
35
+ # nod = {}
36
+ # nod[:node_name] = value.node[:name]
37
+ # value.node[:interfaces].each do |i|
38
+ # if i[:role] == "control"
39
+ # nod[:node_ip] = i[:ip][:address]
40
+ # nod[:node_mac] = i[:mac]
41
+ # elsif i[:role] == "cm_network"
42
+ # nod[:node_cm_ip] = i[:ip][:address]
43
+ # end
44
+ # end
45
+ # nod[:node_cm_ip] = value.node[:cmc][:ip][:address]
46
+ nod = value.node
46
47
  # nod = {node_name: "node1", node_ip: "10.0.0.1", node_mac: "00-03-1d-0d-4b-96", node_cm_ip: "10.0.0.101"}
47
48
 
48
49
  case value[:status].to_sym
@@ -39,20 +39,21 @@ 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
46
- nod = {}
47
- nod[:node_name] = client.opts.node.name
48
- client.opts.node.interfaces.each do |i|
49
- if i[:role] == "control"
50
- nod[:node_ip] = i[:ip][:address]
51
- nod[:node_mac] = i[:mac]
52
- end
53
- end
54
- nod[:node_cm_ip] = client.opts.node.cmc.ip.address
42
+ # if client.opts.ignore_msg
43
+ # #just ignore this message, another resource controller should take care of this message
44
+ # next
45
+ # end
46
+ # nod = {}
47
+ # nod[:node_name] = client.opts.node.name
48
+ # client.opts.node.interfaces.each do |i|
49
+ # if i[:role] == "control"
50
+ # nod[:node_ip] = i[:ip][:address]
51
+ # nod[:node_mac] = i[:mac]
52
+ # end
53
+ # end
54
+ # nod[:node_cm_ip] = client.opts.node.cmc.ip.address
55
55
  #nod = {node_name: "node1", node_ip: "10.0.0.1", node_mac: "00-03-1d-0d-4b-96", node_cm_ip: "10.0.0.101"}
56
+ nod = client.opts.node
56
57
  client.property.multicast_interface = nod[:node_ip]
57
58
  client.property.app_id = client.hrn.nil? ? client.uid : client.hrn
58
59
 
@@ -29,13 +29,13 @@ module OmfRc::ResourceProxy::Frisbeed
29
29
 
30
30
  hook :after_initial_configured do |server|
31
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
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
39
39
  server.property.app_id = server.hrn.nil? ? server.uid : server.hrn
40
40
  server.property.image = server.property.image.nil? ? @fconf[:imageDir] + '/' + @fconf[:defaultImage] : server.property.image
41
41
  server.property.image = server.property.image.start_with?('/') ? server.property.image : @fconf[:imageDir] + '/' + server.property.image
@@ -38,31 +38,35 @@ 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
+ # if client.opts.ignore_msg
42
+ # #just ignore this message, another resource controller should take care of this message
43
+ # next
44
+ # end
45
45
 
46
- nod = {}
47
- nod[:node_name] = client.opts.node.name
48
- client.opts.node.interfaces.each do |i|
49
- if i[:role] == "control"
50
- nod[:node_ip] = i[:ip][:address]
51
- nod[:node_mac] = i[:mac]
52
- elsif i[:role] == "cm_network"
53
- nod[:node_cm_ip] = i[:ip][:address]
54
- end
55
- end
56
- nod[:node_cm_ip] = client.opts.node.cmc.ip.address
46
+ # nod = {}
47
+ # nod[:node_name] = client.opts.node.name
48
+ # client.opts.node.interfaces.each do |i|
49
+ # if i[:role] == "control"
50
+ # nod[:node_ip] = i[:ip][:address]
51
+ # nod[:node_mac] = i[:mac]
52
+ # elsif i[:role] == "cm_network"
53
+ # nod[:node_cm_ip] = i[:ip][:address]
54
+ # end
55
+ # end
56
+ # nod[:node_cm_ip] = client.opts.node.cmc.ip.address
57
57
 
58
+ nod = client.opts.node
58
59
  client.property.app_id = client.hrn.nil? ? client.uid : client.hrn
59
60
 
60
- command = "#{client.property.binary_path} -o -z1 #{client.property.hardrive} - | #{@fconf[:imagezipClientNC]} -q 0 #{client.property.ip} #{client.property.port}"
61
- debug "Executing command #{command}"
62
- # nod = {node_name: "node1", node_ip: "10.0.0.1", node_mac: "00-03-1d-0d-4b-96", node_cm_ip: "10.0.0.101"}
61
+ command = "#{client.property.binary_path} -o -z1 -d #{client.property.hardrive} - | #{@fconf[:imagezipClientNC]} -q 0 #{client.property.ip} #{client.property.port}"
62
+ # nod = {node_name: "node1", node_ip: "10.0.0.1", node_mac: "00-03-1d-0d-4b-96", node_cm_ip: "10.0.0.101"}
63
63
  summary = ''
64
+ debug "Telnet on: '#{nod[:node_ip]}'"
64
65
  host = Net::Telnet.new("Host" => nod[:node_ip], "Timeout" => false)#, "Prompt" => /[\w().-]*[\$#>:.]\s?(?:\(enable\))?\s*$/)
66
+ debug "Telnet successfull"
67
+ debug "Executing command #{command.to_s}"
65
68
  host.cmd(command.to_s) do |c|
69
+ print "#{c}"
66
70
  # if c.to_s != "\n" && c[0,5] != "\n/usr" && c.to_s != "." && c.to_s != ".." && c.to_s != "..."
67
71
  # puts '---------(' + c.to_s + ')-----------'
68
72
  if c.include? 'compressed'
@@ -76,6 +80,7 @@ module OmfRc::ResourceProxy::ImagezipClient #Imagezip client
76
80
  # }, :ALL)
77
81
  end
78
82
  end
83
+ debug "imagezip client finished"
79
84
 
80
85
  client.inform(:status, {
81
86
  status_type: 'IMAGEZIP',
@@ -25,13 +25,13 @@ module OmfRc::ResourceProxy::ImagezipServer #Imagezip server
25
25
 
26
26
  hook :after_initial_configured do |server|
27
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
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
35
35
  server.property.app_id = server.hrn.nil? ? server.uid : server.hrn
36
36
  server.property.image_name = server.property.image_name.nil? ? @fconf[:imageDir] + '/' + @fconf[:defaultImage] : server.property.image_name
37
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
@@ -1,5 +1,5 @@
1
1
  module NITOS
2
2
  module TestbedRc
3
- VERSION = "1.0.0.pre.11"
3
+ VERSION = "1.0.0.pre.12"
4
4
  end
5
5
  end
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.11
4
+ version: 1.0.0.pre.12
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-09 00:00:00.000000000 Z
12
+ date: 2014-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omf_common