omf_rc 6.1.2.pre.5 → 6.1.2.pre.6
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.
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
uri: xmpp://<%= "#{Socket.gethostname}-#{Process.pid}" %>:<%= "#{Socket.gethostname}-#{Process.pid}" %>@localhost
|
3
|
+
environment: development
|
4
|
+
debug: false
|
5
|
+
|
6
|
+
resources:
|
7
|
+
- type: node
|
8
|
+
uid: <%= Socket.gethostname %>
|
9
|
+
|
10
|
+
add_default_factories: false # Not loading default type factories
|
11
|
+
|
12
|
+
factories: # Additional resources which can be created by this RC
|
13
|
+
load: [
|
14
|
+
'omf_rc/resource_proxy/node',
|
15
|
+
'omf_rc/resource_proxy/net',
|
16
|
+
'omf_rc/resource_proxy/wlan',
|
17
|
+
'omf_rc/resource_proxy/application'
|
18
|
+
]
|
19
|
+
defaults:
|
20
|
+
node:
|
21
|
+
topo_file: '/etc/topology.txt'
|
@@ -31,6 +31,7 @@ module OmfRc::ResourceProxy::Node
|
|
31
31
|
# @!parse include OmfRc::Util::Sysfs
|
32
32
|
utility :mod
|
33
33
|
utility :sysfs
|
34
|
+
utility :topology
|
34
35
|
|
35
36
|
# @!macro group_request
|
36
37
|
#
|
@@ -78,4 +79,12 @@ module OmfRc::ResourceProxy::Node
|
|
78
79
|
end
|
79
80
|
end
|
80
81
|
# @!endgroup
|
82
|
+
|
83
|
+
# If a path to a topology file was given in the config file attribute
|
84
|
+
# 'topo_file', then check the connectivity towards the resources in
|
85
|
+
# referenced in that file. The result is sent to an OML database.
|
86
|
+
hook :before_ready do |res|
|
87
|
+
next if res.defaults(:topo_file).nil? || res.defaults(:topo_file).empty?
|
88
|
+
check_topology(res.uid, res.defaults(:topo_file))
|
89
|
+
end
|
81
90
|
end
|
data/lib/omf_rc/runner.rb
CHANGED
@@ -21,6 +21,7 @@ module OmfRc
|
|
21
21
|
def initialize()
|
22
22
|
@executable_name = File.basename($PROGRAM_NAME)
|
23
23
|
@oml_enabled = false
|
24
|
+
@instrument = false
|
24
25
|
@gem_version = OmfCommon.version_of('omf_common')
|
25
26
|
|
26
27
|
@node_id = Socket.gethostname
|
@@ -43,7 +44,7 @@ module OmfRc
|
|
43
44
|
def run()
|
44
45
|
oml_init() # calls parse_config_files()
|
45
46
|
|
46
|
-
OmfCommon::Measure.enable if @oml_enabled
|
47
|
+
OmfCommon::Measure.enable if @oml_enabled && @instrument
|
47
48
|
|
48
49
|
OmfCommon.init(@opts[:environment], @opts.to_hash) do |el|
|
49
50
|
# Load a customised logging set up if provided
|
@@ -165,6 +166,10 @@ module OmfRc
|
|
165
166
|
@gopts[:environment] = e
|
166
167
|
end
|
167
168
|
|
169
|
+
op.on("-i", "--instrument", "Turn on self instrumentation, OML parameters must be set!") do
|
170
|
+
@instrument = true
|
171
|
+
end
|
172
|
+
|
168
173
|
op.on("-v", "--version", "Show version") do
|
169
174
|
puts "OMF Resource Controller version '#{@gem_version}'"
|
170
175
|
exit
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2014 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
|
+
#
|
7
|
+
# This module defines a Utility which could be used to check a topology
|
8
|
+
# between distributed Resource Proxy.
|
9
|
+
#
|
10
|
+
module OmfRc::Util::Topology
|
11
|
+
include OmfRc::ResourceProxyDSL
|
12
|
+
|
13
|
+
# OML Measurement Point (MP)
|
14
|
+
# This MP is reporting if a 'to' host is reachable from a 'from' host
|
15
|
+
class OmfRc::Util::Topology::MPEdges < OML4R::MPBase
|
16
|
+
name :edges
|
17
|
+
param :timestamp, :type => :double # Time (s)
|
18
|
+
param :from, :type => :string # ID/Name for this Resource Proxy
|
19
|
+
param :to, :type => :string # Address/Name of remote host
|
20
|
+
param :reachable, :type => :string # Is the remote host reachable?
|
21
|
+
end
|
22
|
+
|
23
|
+
# Check if a list of hosts from a local file are reachable from the host
|
24
|
+
# running this Node Proxy. The input topology file must simply contain one
|
25
|
+
# line per host, i.e. its IP address of hostname.
|
26
|
+
# The results of this check are send to the OML server and database set
|
27
|
+
# on the command line of this Resource Controller.
|
28
|
+
#
|
29
|
+
# @yieldparam [Object] from the id or name of this Node Proxy
|
30
|
+
# @yieldparam [Object] topo_path the file with the host addresses
|
31
|
+
#
|
32
|
+
work :check_topology do |res,from,topo_path|
|
33
|
+
info "Checking topology from file: '#{topo_path}'"
|
34
|
+
File.foreach(topo_path) do |v|
|
35
|
+
target = v.chomp
|
36
|
+
reachable = `ping -c 1 #{target}`.include?('bytes from')
|
37
|
+
info "Checked link to #{target}: #{reachable}"
|
38
|
+
OmfRc::Util::Topology::MPEdges.inject(Time.now.to_i, from, target, reachable)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_rc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.2.pre.
|
4
|
+
version: 6.1.2.pre.6
|
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-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - '='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 6.1.2.pre.
|
69
|
+
version: 6.1.2.pre.6
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 6.1.2.pre.
|
77
|
+
version: 6.1.2.pre.6
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: cocaine
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- bin/plc_trigger_omf_rc
|
127
127
|
- config/config.yml
|
128
128
|
- config/config_node.yml.example
|
129
|
+
- config/config_node_topo_check.yml.example
|
129
130
|
- config/config_with_authentication.yml.example
|
130
131
|
- config/config_with_extensions.yml.example
|
131
132
|
- config/instageni.yaml
|
@@ -156,6 +157,7 @@ files:
|
|
156
157
|
- lib/omf_rc/util/package.rb
|
157
158
|
- lib/omf_rc/util/platform_tools.rb
|
158
159
|
- lib/omf_rc/util/sysfs.rb
|
160
|
+
- lib/omf_rc/util/topology.rb
|
159
161
|
- lib/omf_rc/util/vmbuilder.rb
|
160
162
|
- lib/omf_rc/util/wpa.rb
|
161
163
|
- lib/omf_rc/version.rb
|