testlab 0.2.1 → 0.3.0
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/.gitignore +0 -1
- data/Gemfile +0 -2
- data/bin/tl +28 -41
- data/lib/testlab/container/actions.rb +35 -0
- data/lib/testlab/container/class_methods.rb +7 -1
- data/lib/testlab/container/generators.rb +11 -0
- data/lib/testlab/container/interface.rb +10 -17
- data/lib/testlab/container/lifecycle.rb +14 -2
- data/lib/testlab/container/lxc.rb +24 -10
- data/lib/testlab/container/method_missing.rb +3 -1
- data/lib/testlab/container/status.rb +46 -2
- data/lib/testlab/container.rb +52 -2
- data/lib/testlab/interface.rb +45 -0
- data/lib/testlab/monkeys.rb +4 -0
- data/lib/testlab/network/actions.rb +1 -1
- data/lib/testlab/network/bind.rb +2 -2
- data/lib/testlab/network/class_methods.rb +1 -1
- data/lib/testlab/network/status.rb +12 -4
- data/lib/testlab/network.rb +2 -1
- data/lib/testlab/node/actions.rb +45 -0
- data/lib/testlab/node/bind.rb +7 -5
- data/lib/testlab/node/lifecycle.rb +3 -5
- data/lib/testlab/node/status.rb +1 -2
- data/lib/testlab/node.rb +1 -2
- data/lib/testlab/providers/vagrant.rb +1 -1
- data/lib/testlab/provisioners/shell.rb +8 -4
- data/lib/testlab/utility/misc.rb +49 -0
- data/lib/testlab/version.rb +1 -1
- data/lib/testlab.rb +123 -31
- data/spec/support/Labfile +8 -9
- data/testlab.gemspec +1 -0
- metadata +24 -5
- data/lib/testlab/router.rb +0 -66
@@ -0,0 +1,45 @@
|
|
1
|
+
class TestLab
|
2
|
+
class Node
|
3
|
+
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Create the node
|
7
|
+
def create
|
8
|
+
@ui.logger.debug { "Node Create: #{self.id} " }
|
9
|
+
|
10
|
+
please_wait(:ui => @ui, :message => format_object_action(self, 'Create', :green)) do
|
11
|
+
@provider.create
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Destroy the node
|
16
|
+
def destroy
|
17
|
+
@ui.logger.debug { "Node Destroy: #{self.id} " }
|
18
|
+
|
19
|
+
please_wait(:ui => @ui, :message => format_object_action(self, 'Destroy', :red)) do
|
20
|
+
@provider.destroy
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Start the node
|
25
|
+
def up
|
26
|
+
@ui.logger.debug { "Node Up: #{self.id} " }
|
27
|
+
|
28
|
+
please_wait(:ui => @ui, :message => format_object_action(self, 'Up', :green)) do
|
29
|
+
@provider.up
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Stop the node
|
34
|
+
def down
|
35
|
+
@ui.logger.debug { "Node Down: #{self.id} " }
|
36
|
+
|
37
|
+
please_wait(:ui => @ui, :message => format_object_action(self, 'Down', :red)) do
|
38
|
+
@provider.down
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
data/lib/testlab/node/bind.rb
CHANGED
@@ -17,14 +17,16 @@ class TestLab
|
|
17
17
|
reverse_records = Hash.new
|
18
18
|
|
19
19
|
TestLab::Container.all.each do |container|
|
20
|
-
interface = container.primary_interface
|
21
20
|
container.domain ||= container.node.labfile.config[:domain]
|
22
21
|
|
23
|
-
|
24
|
-
|
22
|
+
container.interfaces.each do |interface|
|
23
|
+
forward_records[container.domain] ||= Array.new
|
24
|
+
forward_records[container.domain] << %(#{container.id} IN A #{interface.ip})
|
25
|
+
|
26
|
+
reverse_records[interface.network_id] ||= Array.new
|
27
|
+
reverse_records[interface.network_id] << %(#{interface.ptr} IN PTR #{container.fqdn}.)
|
28
|
+
end
|
25
29
|
|
26
|
-
reverse_records[interface.first] ||= Array.new
|
27
|
-
reverse_records[interface.first] << %(#{container.ptr} IN PTR #{container.id}.#{container.domain}.)
|
28
30
|
end
|
29
31
|
{ :forward => forward_records, :reverse => reverse_records }
|
30
32
|
end
|
@@ -14,8 +14,6 @@ class TestLab
|
|
14
14
|
# Calls the specified method on all the objects supplied
|
15
15
|
def call_methods(objects, method_name)
|
16
16
|
objects.each do |object|
|
17
|
-
# @ui.stdout.puts(format_message(format_object(object, (method_name == :setup ? :green : :red))))
|
18
|
-
|
19
17
|
if object.respond_to?(method_name)
|
20
18
|
object.send(method_name)
|
21
19
|
end
|
@@ -31,7 +29,7 @@ class TestLab
|
|
31
29
|
def route_setup(action)
|
32
30
|
self.networks.each do |network|
|
33
31
|
command = ZTK::Command.new(:silence => true, :ignore_exit_status => true)
|
34
|
-
command.exec(%(sudo route #{action} -net #{TestLab::Utility.network(network.
|
32
|
+
command.exec(%(sudo route #{action} -net #{TestLab::Utility.network(network.address)} netmask #{TestLab::Utility.netmask(network.address)} gw #{network.node.ip}))
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
@@ -56,7 +54,7 @@ class TestLab
|
|
56
54
|
end
|
57
55
|
end
|
58
56
|
|
59
|
-
call_collections([self.networks, self.
|
57
|
+
call_collections([self.networks, self.containers], :setup)
|
60
58
|
|
61
59
|
if self.components.include?('bind')
|
62
60
|
bind_reload
|
@@ -69,7 +67,7 @@ class TestLab
|
|
69
67
|
def teardown
|
70
68
|
@ui.logger.debug { "Node Teardown: #{self.id} " }
|
71
69
|
|
72
|
-
call_collections([self.containers, self.
|
70
|
+
call_collections([self.containers, self.networks], :teardown)
|
73
71
|
|
74
72
|
please_wait(:ui => @ui, :message => format_object_action(self, 'Teardown', :red)) do
|
75
73
|
|
data/lib/testlab/node/status.rb
CHANGED
data/lib/testlab/node.rb
CHANGED
@@ -7,7 +7,7 @@ class TestLab
|
|
7
7
|
#
|
8
8
|
# @author Zachary Patten <zachary@jovelabs.net>
|
9
9
|
class Node < ZTK::DSL::Base
|
10
|
-
STATUS_KEYS = %w(id instance_id state user ip port provider con net
|
10
|
+
STATUS_KEYS = %w(id instance_id state user ip port provider con net).map(&:to_sym)
|
11
11
|
|
12
12
|
# Sub-Modules
|
13
13
|
autoload :Actions, 'testlab/node/actions'
|
@@ -36,7 +36,6 @@ class TestLab
|
|
36
36
|
# Associations and Attributes
|
37
37
|
belongs_to :labfile, :class_name => 'TestLab::Lab'
|
38
38
|
|
39
|
-
has_many :routers, :class_name => 'TestLab::Router'
|
40
39
|
has_many :containers, :class_name => 'TestLab::Container'
|
41
40
|
has_many :networks, :class_name => 'TestLab::Network'
|
42
41
|
|
@@ -171,7 +171,7 @@ class TestLab
|
|
171
171
|
def vagrant_cli(*args)
|
172
172
|
@ui.logger.debug { "args == #{args.inspect}" }
|
173
173
|
|
174
|
-
command = TestLab.
|
174
|
+
command = TestLab.build_command_line("vagrant", *args)
|
175
175
|
@ui.logger.debug { "command == #{command.inspect}" }
|
176
176
|
|
177
177
|
ZTK::Command.new(:ui => @ui).exec(command, :silence => true)
|
@@ -20,11 +20,15 @@ class TestLab
|
|
20
20
|
|
21
21
|
def setup(container)
|
22
22
|
if !@config[:setup].nil?
|
23
|
-
|
24
|
-
|
25
|
-
file.
|
23
|
+
ZTK::RescueRetry.try(:tries => 2, :on => ShellError) do
|
24
|
+
tempfile = Tempfile.new("bootstrap")
|
25
|
+
container.node.ssh.file(:target => File.join(container.lxc.fs_root, tempfile.path), :chmod => '0777', :chown => 'root:root') do |file|
|
26
|
+
file.puts(@config[:setup])
|
27
|
+
end
|
28
|
+
if container.lxc.attach(@config[:shell], tempfile.path) =~ /No such file or directory/
|
29
|
+
raise ShellError, "We could not find the bootstrap file!"
|
30
|
+
end
|
26
31
|
end
|
27
|
-
container.lxc.attach(@config[:shell], tempfile.path)
|
28
32
|
end
|
29
33
|
end
|
30
34
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class TestLab
|
2
|
+
module Utility
|
3
|
+
|
4
|
+
# Misc Error Class
|
5
|
+
class MiscError < UtilityError; end
|
6
|
+
|
7
|
+
# Misc Module
|
8
|
+
#
|
9
|
+
# @author Zachary Patten <zachary@jovelabs.net>
|
10
|
+
module Misc
|
11
|
+
|
12
|
+
def format_object(object, color)
|
13
|
+
klass = object.class.to_s.split('::').last
|
14
|
+
|
15
|
+
["#{klass}:".upcase.send(color).bold, "#{object.id}".white.bold].join(' ')
|
16
|
+
end
|
17
|
+
|
18
|
+
def format_object_action(object, action, color)
|
19
|
+
klass = object.class.to_s.split('::').last
|
20
|
+
|
21
|
+
["#{klass}".downcase.send(color).bold, "#{object.id}".white.bold, "#{action}".downcase.send(color).bold, ].join(' ')
|
22
|
+
end
|
23
|
+
|
24
|
+
def format_message(message)
|
25
|
+
"[".blue + "TL".blue.bold + "]".blue + " " + message
|
26
|
+
end
|
27
|
+
|
28
|
+
def please_wait(options={}, &block)
|
29
|
+
ui = options[:ui]
|
30
|
+
message = options[:message]
|
31
|
+
mark = (options[:mark] || "# Completed in %0.4f seconds!".black.bold)
|
32
|
+
|
33
|
+
!block_given? and raise MiscError, "You must supply a block!"
|
34
|
+
ui.nil? and raise MiscError, "You must supply a ZTK::UI object!"
|
35
|
+
message.nil? and raise MiscError, "You must supply a message!"
|
36
|
+
|
37
|
+
message = format_message(message)
|
38
|
+
length = message.uncolor.length
|
39
|
+
mark = ((' ' * (60 - length)) + mark)
|
40
|
+
|
41
|
+
ZTK::Benchmark.bench(:ui => ui, :message => message, :mark => mark) do
|
42
|
+
yield
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
data/lib/testlab/version.rb
CHANGED
data/lib/testlab.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
require 'ztk'
|
2
2
|
|
3
3
|
require 'testlab/version'
|
4
|
+
require 'testlab/monkeys'
|
4
5
|
|
5
|
-
#
|
6
|
-
class String
|
7
|
-
include ZTK::ANSI
|
8
|
-
end
|
9
|
-
|
10
|
-
# Top-Level LXC Class
|
6
|
+
# Top-Level TestLab Class
|
11
7
|
#
|
12
8
|
# @author Zachary Patten <zachary@jovelabs.net>
|
13
9
|
class TestLab
|
@@ -17,99 +13,160 @@ class TestLab
|
|
17
13
|
|
18
14
|
# Main Classes
|
19
15
|
autoload :Container, 'testlab/container'
|
16
|
+
autoload :Interface, 'testlab/interface'
|
20
17
|
autoload :Labfile, 'testlab/labfile'
|
21
18
|
autoload :Network, 'testlab/network'
|
22
19
|
autoload :Node, 'testlab/node'
|
23
20
|
autoload :Provider, 'testlab/provider'
|
24
21
|
autoload :Provisioner, 'testlab/provisioner'
|
25
|
-
autoload :Router, 'testlab/router'
|
26
22
|
autoload :Utility, 'testlab/utility'
|
27
23
|
|
28
24
|
include TestLab::Utility::Misc
|
29
25
|
|
30
|
-
@@ui ||= nil
|
31
|
-
|
32
26
|
def initialize(options={})
|
33
27
|
labfile = (options[:labfile] || 'Labfile')
|
34
28
|
labfile_path = ZTK::Locator.find(labfile)
|
35
29
|
|
36
|
-
|
30
|
+
self.ui = (options[:ui] || ZTK::UI.new)
|
37
31
|
|
38
32
|
@labfile = TestLab::Labfile.load(labfile_path)
|
39
33
|
end
|
40
34
|
|
35
|
+
# Test Lab Nodes
|
36
|
+
#
|
37
|
+
# Returns an array of our defined nodes.
|
38
|
+
#
|
39
|
+
# @return [Array<TestLab::Node>] An array of all defined nodes.
|
41
40
|
def nodes
|
42
41
|
TestLab::Node.all
|
43
42
|
end
|
44
43
|
|
44
|
+
# Test Lab Containers
|
45
|
+
#
|
46
|
+
# Returns an array of our defined containers.
|
47
|
+
#
|
48
|
+
# @return [Array<TestLab::Container>] An array of all defined containers.
|
45
49
|
def containers
|
46
50
|
TestLab::Container.all
|
47
51
|
end
|
48
52
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
+
# Test Lab Networks
|
54
|
+
#
|
55
|
+
# Returns an array of our defined networks.
|
56
|
+
#
|
57
|
+
# @return [Array<TestLab::Network>] An array of all defined networks.
|
53
58
|
def networks
|
54
59
|
TestLab::Network.all
|
55
60
|
end
|
56
61
|
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
62
|
+
# Test Lab Configuration
|
63
|
+
#
|
64
|
+
# The hash defined in our *Labfile* DSL object which represents any high-level
|
65
|
+
# lab configuration options.
|
66
|
+
#
|
67
|
+
# @return [Hash] A hash representing the labs configuration options.
|
68
|
+
def config
|
69
|
+
@labfile.config
|
70
|
+
end
|
60
71
|
|
72
|
+
# Test Lab Alive?
|
73
|
+
#
|
74
|
+
# Are all of our nodes alive; that is up and running?
|
75
|
+
#
|
76
|
+
# @return [Boolean] True is all nodes are running; false otherwise.
|
61
77
|
def alive?
|
62
78
|
nodes.map(&:state).all?{ |state| state == :running }
|
63
79
|
end
|
64
80
|
|
81
|
+
# Test Lab Dead?
|
82
|
+
#
|
83
|
+
# Are any of our nodes dead; that is not up and running?
|
84
|
+
#
|
85
|
+
# @return [Boolean] False is all nodes are running; true otherwise.
|
65
86
|
def dead?
|
66
87
|
!alive?
|
67
88
|
end
|
68
89
|
|
90
|
+
# Test Lab Status
|
91
|
+
#
|
92
|
+
# Iterates our various DSL objects and calls their status methods pushing
|
93
|
+
# the results through ZTK::Report to generate nice tabled output for us
|
94
|
+
# indicating the state of the lab.
|
95
|
+
#
|
96
|
+
# This can only be run if the lab is alive.
|
97
|
+
#
|
98
|
+
# @return [Boolean] True if successful; false otherwise.
|
69
99
|
def status
|
70
100
|
if alive?
|
71
101
|
%w(nodes networks containers).map(&:to_sym).each do |object_symbol|
|
72
|
-
|
73
|
-
|
102
|
+
self.ui.stdout.puts
|
103
|
+
self.ui.stdout.puts("#{object_symbol}:".upcase.green.bold)
|
74
104
|
|
75
105
|
klass = object_symbol.to_s.singularize.capitalize
|
76
106
|
status_keys = "TestLab::#{klass}::STATUS_KEYS".constantize
|
77
107
|
|
78
|
-
ZTK::Report.new(:ui =>
|
108
|
+
ZTK::Report.new(:ui => self.ui).spreadsheet(self.send(object_symbol), status_keys) do |object|
|
79
109
|
OpenStruct.new(object.status)
|
80
110
|
end
|
81
111
|
end
|
82
112
|
|
83
113
|
true
|
84
114
|
else
|
85
|
-
|
115
|
+
self.ui.stdout.puts("Looks like your test lab is dead; fix this and try again.")
|
86
116
|
|
87
117
|
false
|
88
118
|
end
|
89
119
|
end
|
90
120
|
|
121
|
+
# Test Lab Setup
|
122
|
+
#
|
123
|
+
# Attempts to setup our lab topology. This calls the setup method on all of
|
124
|
+
# our nodes.
|
125
|
+
#
|
126
|
+
# @return [Boolean] True if successful.
|
91
127
|
def setup
|
92
128
|
self.dead? and raise TestLabError, "You must have a running node in order to setup your infrastructure!"
|
93
129
|
|
94
130
|
node_method_proxy(:setup)
|
131
|
+
|
132
|
+
true
|
95
133
|
end
|
96
134
|
|
135
|
+
# Test Lab Teardown
|
136
|
+
#
|
137
|
+
# Attempts to tearddown our lab topology. This calls the teardown method on
|
138
|
+
# all of our nodes.
|
139
|
+
#
|
140
|
+
# @return [Boolean] True if successful.
|
97
141
|
def teardown
|
98
142
|
self.dead? and raise TestLabError, "You must have a running node in order to teardown your infrastructure!"
|
99
143
|
|
100
144
|
node_method_proxy(:teardown)
|
145
|
+
|
146
|
+
true
|
101
147
|
end
|
102
148
|
|
103
|
-
#
|
149
|
+
# Node Method Proxy
|
150
|
+
#
|
151
|
+
# Iterates all of the lab nodes, sending the supplied method name and arguments
|
152
|
+
# to each node.
|
153
|
+
#
|
154
|
+
# @return [Boolean] True if successful.
|
104
155
|
def node_method_proxy(method_name, *method_args)
|
105
|
-
|
156
|
+
nodes.map do |node|
|
106
157
|
node.send(method_name.to_sym, *method_args)
|
107
158
|
end
|
159
|
+
|
160
|
+
true
|
108
161
|
end
|
109
162
|
|
110
|
-
# Method
|
163
|
+
# Provider Method Handler
|
164
|
+
#
|
165
|
+
# Proxies missing provider method calls to all nodes.
|
166
|
+
#
|
167
|
+
# @see TestLab::Provider::PROXY_METHODS
|
111
168
|
def method_missing(method_name, *method_args)
|
112
|
-
|
169
|
+
self.ui.logger.debug { "TESTLAB METHOD MISSING: #{method_name.inspect}(#{method_args.inspect})" }
|
113
170
|
|
114
171
|
if TestLab::Provider::PROXY_METHODS.include?(method_name) # || %w(setup teardown).map(&:to_sym).include?(method_name))
|
115
172
|
node_method_proxy(method_name, *method_args)
|
@@ -118,27 +175,62 @@ class TestLab
|
|
118
175
|
end
|
119
176
|
end
|
120
177
|
|
121
|
-
|
122
|
-
|
123
|
-
|
178
|
+
# Test Lab Class Methods
|
179
|
+
#
|
180
|
+
# These are special methods that we both include and extend on the parent
|
181
|
+
# class.
|
182
|
+
module ClassMethods
|
124
183
|
|
125
|
-
|
126
|
-
class << self
|
184
|
+
@@ui ||= nil
|
127
185
|
|
186
|
+
# Get Test Lab User Interface
|
187
|
+
#
|
188
|
+
# Returns the instance of ZTK:UI the lab is using for its user interface.
|
189
|
+
#
|
190
|
+
# @return [ZTK::UI] Our user interface instance of ZTK::UI.
|
128
191
|
def ui
|
129
192
|
@@ui ||= ZTK::UI.new
|
130
193
|
end
|
131
194
|
|
195
|
+
# Set Test Lab User Interface
|
196
|
+
#
|
197
|
+
# Sets the instance of ZTK::UI the lab will use for its user interface.
|
198
|
+
#
|
199
|
+
# @param [ZTK:UI] value The instance of ZTK::UI to use for the labs user
|
200
|
+
# interface.
|
201
|
+
#
|
202
|
+
# @return [ZTK::UI]
|
203
|
+
def ui=(value)
|
204
|
+
@@ui = value
|
205
|
+
value
|
206
|
+
end
|
207
|
+
|
208
|
+
# Test Lab Gem Directory
|
209
|
+
#
|
210
|
+
# Returns the directory path to where the gem is installed.
|
211
|
+
#
|
212
|
+
# @return [String] The directory path to the gem installation.
|
132
213
|
def gem_dir
|
133
214
|
directory = File.join(File.dirname(__FILE__), "..")
|
134
215
|
File.expand_path(directory, File.dirname(__FILE__))
|
135
216
|
end
|
136
217
|
|
137
|
-
|
218
|
+
# Build Command Line
|
219
|
+
#
|
220
|
+
# Attempts to build a command line to a binary for us. We use ZTK::Locator
|
221
|
+
# to attempt to determine if we are using bundler binstubs; otherwise we
|
222
|
+
# simply rely on */bin/env* to find the executable for us via the
|
223
|
+
# *PATH* environment variable.
|
224
|
+
#
|
225
|
+
# @return [String] Constructed command line with arguments.
|
226
|
+
def build_command_line(name, *args)
|
138
227
|
executable = (ZTK::Locator.find('bin', name) rescue "/bin/env #{name}")
|
139
228
|
[executable, args].flatten.compact.join(' ')
|
140
229
|
end
|
141
230
|
|
142
231
|
end
|
143
232
|
|
233
|
+
include TestLab::ClassMethods
|
234
|
+
extend TestLab::ClassMethods
|
235
|
+
|
144
236
|
end
|
data/spec/support/Labfile
CHANGED
@@ -8,7 +8,7 @@ node :localhost do
|
|
8
8
|
config Hash[
|
9
9
|
:vagrant => {
|
10
10
|
:id => "mytestlab-#{ENV['USER']}".downcase,
|
11
|
-
:ip => "192.168.
|
11
|
+
:ip => "192.168.255.1",
|
12
12
|
:user => "vagrant",
|
13
13
|
:port => 22,
|
14
14
|
:cpus => 1,
|
@@ -18,20 +18,19 @@ node :localhost do
|
|
18
18
|
]
|
19
19
|
|
20
20
|
network :testnet do
|
21
|
-
|
22
|
-
bridge
|
21
|
+
address '192.168.255.254/16'
|
22
|
+
bridge :br0
|
23
23
|
end
|
24
24
|
|
25
25
|
container "server-1" do
|
26
26
|
distro "ubuntu"
|
27
27
|
release "lucid"
|
28
28
|
|
29
|
-
|
30
|
-
:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
]
|
29
|
+
interface do
|
30
|
+
name :eth0
|
31
|
+
network_id :testnet
|
32
|
+
address '192.168.0.254/16'
|
33
|
+
end
|
35
34
|
end
|
36
35
|
|
37
36
|
end
|
data/testlab.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
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: 2013-05-
|
12
|
+
date: 2013-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gli
|
@@ -155,6 +155,22 @@ dependencies:
|
|
155
155
|
- - ! '>='
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: coveralls
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
158
174
|
description: A framework for building lightweight virtual infrastructure using LXC
|
159
175
|
email:
|
160
176
|
- zachary@jovelabs.com
|
@@ -184,7 +200,9 @@ files:
|
|
184
200
|
- lib/testlab/container/lxc.rb
|
185
201
|
- lib/testlab/container/method_missing.rb
|
186
202
|
- lib/testlab/container/status.rb
|
203
|
+
- lib/testlab/interface.rb
|
187
204
|
- lib/testlab/labfile.rb
|
205
|
+
- lib/testlab/monkeys.rb
|
188
206
|
- lib/testlab/network.rb
|
189
207
|
- lib/testlab/network/actions.rb
|
190
208
|
- lib/testlab/network/bind.rb
|
@@ -192,6 +210,7 @@ files:
|
|
192
210
|
- lib/testlab/network/lifecycle.rb
|
193
211
|
- lib/testlab/network/status.rb
|
194
212
|
- lib/testlab/node.rb
|
213
|
+
- lib/testlab/node/actions.rb
|
195
214
|
- lib/testlab/node/bind.rb
|
196
215
|
- lib/testlab/node/class_methods.rb
|
197
216
|
- lib/testlab/node/lifecycle.rb
|
@@ -214,9 +233,9 @@ files:
|
|
214
233
|
- lib/testlab/provisioners/chef.rb
|
215
234
|
- lib/testlab/provisioners/shell.rb
|
216
235
|
- lib/testlab/provisioners/templates/chef/bootstrap.erb
|
217
|
-
- lib/testlab/router.rb
|
218
236
|
- lib/testlab/utility.rb
|
219
237
|
- lib/testlab/utility/cidr.rb
|
238
|
+
- lib/testlab/utility/misc.rb
|
220
239
|
- lib/testlab/version.rb
|
221
240
|
- spec/provider_spec.rb
|
222
241
|
- spec/provisioner_spec.rb
|
@@ -239,7 +258,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
258
|
version: '0'
|
240
259
|
segments:
|
241
260
|
- 0
|
242
|
-
hash:
|
261
|
+
hash: 1288569389927238950
|
243
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
263
|
none: false
|
245
264
|
requirements:
|
@@ -248,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
267
|
version: '0'
|
249
268
|
segments:
|
250
269
|
- 0
|
251
|
-
hash:
|
270
|
+
hash: 1288569389927238950
|
252
271
|
requirements: []
|
253
272
|
rubyforge_project:
|
254
273
|
rubygems_version: 1.8.25
|
data/lib/testlab/router.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
class TestLab
|
2
|
-
|
3
|
-
# Router Error Class
|
4
|
-
class RouterError < TestLabError; end
|
5
|
-
|
6
|
-
# Router Class
|
7
|
-
#
|
8
|
-
# @author Zachary Patten <zachary@jovelabs.net>
|
9
|
-
class Router < ZTK::DSL::Base
|
10
|
-
belongs_to :node, :class_name => 'TestNode::Node'
|
11
|
-
|
12
|
-
attribute :interfaces
|
13
|
-
|
14
|
-
def initialize(*args)
|
15
|
-
super(*args)
|
16
|
-
|
17
|
-
@ui = TestLab.ui
|
18
|
-
end
|
19
|
-
|
20
|
-
# Create the router
|
21
|
-
def create
|
22
|
-
@ui.logger.debug { "Router Create: #{self.id} " }
|
23
|
-
end
|
24
|
-
|
25
|
-
# Destroy the router
|
26
|
-
def destroy
|
27
|
-
@ui.logger.debug { "Router Destroy: #{self.id} " }
|
28
|
-
end
|
29
|
-
|
30
|
-
# Start the router
|
31
|
-
def up
|
32
|
-
@ui.logger.debug { "Router Up: #{self.id} " }
|
33
|
-
end
|
34
|
-
|
35
|
-
# Stop the router
|
36
|
-
def down
|
37
|
-
@ui.logger.debug { "Router Down: #{self.id} " }
|
38
|
-
end
|
39
|
-
|
40
|
-
# State of the router
|
41
|
-
def state
|
42
|
-
end
|
43
|
-
|
44
|
-
# Router Callback: after_up
|
45
|
-
def setup
|
46
|
-
@ui.logger.debug { "Router Callback: After Up: #{self.id} " }
|
47
|
-
self.create
|
48
|
-
self.up
|
49
|
-
end
|
50
|
-
|
51
|
-
# Router Callback: before_down
|
52
|
-
def teardown
|
53
|
-
@ui.logger.debug { "Router Callback: Before Down: #{self.id} " }
|
54
|
-
self.down
|
55
|
-
self.destroy
|
56
|
-
end
|
57
|
-
|
58
|
-
# Method missing handler
|
59
|
-
def method_missing(method_name, *method_args)
|
60
|
-
@ui.logger.debug { "ROUTER METHOD MISSING: #{method_name.inspect}(#{method_args.inspect})" }
|
61
|
-
super(method_name, *method_args)
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|