testlab 0.4.6 → 0.4.7
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/bin/tl +20 -0
- data/lib/testlab/interface.rb +3 -3
- data/lib/testlab/labfile.rb +2 -2
- data/lib/testlab/node.rb +5 -5
- data/lib/testlab/version.rb +1 -1
- data/lib/testlab.rb +3 -3
- metadata +1 -1
data/bin/tl
CHANGED
@@ -198,6 +198,26 @@ command :network do |c|
|
|
198
198
|
@testlab.ui.stdout.puts %x(netstat -nr | grep '#{network.node.ip}').strip
|
199
199
|
end
|
200
200
|
end
|
201
|
+
|
202
|
+
# ROUTE SHOW
|
203
|
+
#############
|
204
|
+
route.desc 'Show routes to lab networks'
|
205
|
+
route.command :show do |show|
|
206
|
+
show.action do |global_options,options,args|
|
207
|
+
help_now!('id is required') if options[:id].nil?
|
208
|
+
|
209
|
+
network = @testlab.networks.select{ |c| c.id.to_sym == options[:id].to_sym }.first
|
210
|
+
network.nil? and raise TestLab::TestLabError, "We could not find the network you supplied!"
|
211
|
+
|
212
|
+
@testlab.ui.stdout.puts("TestLab routes:".green.bold)
|
213
|
+
case RUBY_PLATFORM
|
214
|
+
when /darwin/ then
|
215
|
+
@testlab.ui.stdout.puts %x(netstat -nrf inet | grep '#{network.node.ip}').strip
|
216
|
+
when /linux/ then
|
217
|
+
@testlab.ui.stdout.puts %x(netstat -nr | grep '#{network.node.ip}').strip
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
201
221
|
end
|
202
222
|
|
203
223
|
# NETWORK STATUS
|
data/lib/testlab/interface.rb
CHANGED
@@ -9,14 +9,14 @@ class TestLab
|
|
9
9
|
class Interface < ZTK::DSL::Base
|
10
10
|
|
11
11
|
# Associations and Attributes
|
12
|
-
belongs_to :container,
|
13
|
-
belongs_to :network,
|
12
|
+
belongs_to :container, :class_name => 'TestLab::Container'
|
13
|
+
belongs_to :network, :class_name => 'TestLab::Network'
|
14
14
|
|
15
15
|
attribute :address
|
16
16
|
attribute :mac
|
17
17
|
attribute :name
|
18
18
|
|
19
|
-
attribute :primary,
|
19
|
+
attribute :primary, :default => false
|
20
20
|
|
21
21
|
def initialize(*args)
|
22
22
|
super(*args)
|
data/lib/testlab/labfile.rb
CHANGED
@@ -7,9 +7,9 @@ class TestLab
|
|
7
7
|
#
|
8
8
|
# @author Zachary Patten <zachary AT jovelabs DOT com>
|
9
9
|
class Labfile < ZTK::DSL::Base
|
10
|
-
has_many :nodes,
|
10
|
+
has_many :nodes, :class_name => 'TestLab::Node'
|
11
11
|
|
12
|
-
attribute :config,
|
12
|
+
attribute :config, :default => Hash.new
|
13
13
|
end
|
14
14
|
|
15
15
|
end
|
data/lib/testlab/node.rb
CHANGED
@@ -34,14 +34,14 @@ class TestLab
|
|
34
34
|
include TestLab::Utility::Misc
|
35
35
|
|
36
36
|
# Associations and Attributes
|
37
|
-
belongs_to :labfile,
|
37
|
+
belongs_to :labfile, :class_name => 'TestLab::Labfile'
|
38
38
|
|
39
|
-
has_many :containers,
|
40
|
-
has_many :networks,
|
39
|
+
has_many :containers, :class_name => 'TestLab::Container'
|
40
|
+
has_many :networks, :class_name => 'TestLab::Network'
|
41
41
|
|
42
42
|
attribute :provider
|
43
|
-
attribute :config,
|
44
|
-
attribute :components,
|
43
|
+
attribute :config, :default => Hash.new
|
44
|
+
attribute :components, :default => Array.new
|
45
45
|
|
46
46
|
|
47
47
|
def initialize(*args)
|
data/lib/testlab/version.rb
CHANGED
data/lib/testlab.rb
CHANGED
@@ -222,7 +222,7 @@ class TestLab
|
|
222
222
|
def method_missing(method_name, *method_args)
|
223
223
|
self.ui.logger.debug { "TESTLAB METHOD MISSING: #{method_name.inspect}(#{method_args.inspect})" }
|
224
224
|
|
225
|
-
if TestLab::Provider::PROXY_METHODS.include?(method_name)
|
225
|
+
if TestLab::Provider::PROXY_METHODS.include?(method_name)
|
226
226
|
node_method_proxy(method_name, *method_args)
|
227
227
|
else
|
228
228
|
super(method_name, *method_args)
|
@@ -235,7 +235,7 @@ class TestLab
|
|
235
235
|
# class.
|
236
236
|
module DualMethods
|
237
237
|
|
238
|
-
@@ui
|
238
|
+
@@ui = nil
|
239
239
|
|
240
240
|
# Get Test Lab User Interface
|
241
241
|
#
|
@@ -284,7 +284,7 @@ class TestLab
|
|
284
284
|
|
285
285
|
end
|
286
286
|
|
287
|
-
include TestLab::DualMethods
|
288
287
|
extend TestLab::DualMethods
|
288
|
+
include TestLab::DualMethods
|
289
289
|
|
290
290
|
end
|