f5-icontrol 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +19 -2
- data/bin/f5 +8 -0
- data/lib/f5/cli/application.rb +12 -14
- data/lib/f5/icontrol.rb +16 -28
- data/lib/f5/icontrol/api.rb +79 -0
- data/lib/f5/icontrol/version.rb +2 -2
- data/spec/models/api_spec.rb +54 -0
- metadata +5 -10
- data/lib/f5/cli/config.rb +0 -21
- data/lib/f5/icontrol/local_lb/node_address_v2.rb +0 -27
- data/lib/f5/icontrol/local_lb/pool.rb +0 -27
- data/lib/f5/icontrol/system/system_info.rb +0 -27
- data/spec/models/local_lb/pool_spec.rb +0 -26
- data/spec/models/system/system_info_spec.rb +0 -31
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 629649284f385f3dce498418e2b46347ea3abc8b
|
|
4
|
+
data.tar.gz: 97608378edc825c3056da1f1dd15027af0aa9c6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 09366ecfcff0925f4507c79a4a30a5bad9bb6ee2b1f69267a609e73dae648b1b503397df6378989bb4106e297c0677331a41d07af5eeb06966c24f7808375dab
|
|
7
|
+
data.tar.gz: 74415bd966863d47ecd3c06bff9d1f0df59b62904544f386297cdb1ac8acaf3b90a5196c3077bcdcf4c621f8279b231e575bbf1d5955b503305f5e4473eca004
|
data/README.md
CHANGED
|
@@ -13,7 +13,7 @@ I originally set out to improve the official one:
|
|
|
13
13
|
* Support Ruby 2.0.0 and 2.1.0
|
|
14
14
|
* Make the interface to the library more Ruby-esque
|
|
15
15
|
|
|
16
|
-
But given the original one was pretty
|
|
16
|
+
But given the original one was pretty bare-bones, I started over.
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
@@ -31,7 +31,24 @@ Or install it yourself as:
|
|
|
31
31
|
|
|
32
32
|
## Usage
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
First, configure the gem:
|
|
35
|
+
|
|
36
|
+
```Ruby
|
|
37
|
+
F5::Icontrol.configure do |f|
|
|
38
|
+
f.host = "hostname.of.bigip"
|
|
39
|
+
f.username = "username"
|
|
40
|
+
f.password = "password"
|
|
41
|
+
end
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then use it:
|
|
45
|
+
|
|
46
|
+
```Ruby
|
|
47
|
+
api = F5::Icontrol::API.new
|
|
48
|
+
response = api.LocalLB.Pool.get_list
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
See specs subdir for more examples, especially as it pertains to passing parameters.
|
|
35
52
|
|
|
36
53
|
## CLI
|
|
37
54
|
|
data/bin/f5
CHANGED
|
@@ -3,4 +3,12 @@
|
|
|
3
3
|
require 'f5/cli/application'
|
|
4
4
|
require 'f5/icontrol'
|
|
5
5
|
|
|
6
|
+
config ||= YAML.load_file("#{ENV['HOME']}/.f5.yml")
|
|
7
|
+
|
|
8
|
+
F5::Icontrol.configure do |f5|
|
|
9
|
+
f5.host = config['host']
|
|
10
|
+
f5.username = config['username']
|
|
11
|
+
f5.password = config['password']
|
|
12
|
+
end
|
|
13
|
+
|
|
6
14
|
F5::Cli::Application.start(ARGV)
|
data/lib/f5/cli/application.rb
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
require 'thor'
|
|
2
|
-
require 'f5/cli/config'
|
|
3
2
|
|
|
4
3
|
module F5
|
|
5
4
|
module Cli
|
|
6
5
|
class Pool < Thor
|
|
6
|
+
|
|
7
7
|
desc "list", "Lists all the pools"
|
|
8
8
|
def list
|
|
9
|
-
response =
|
|
9
|
+
response = client.LocalLB.Pool.get_list
|
|
10
|
+
|
|
10
11
|
pools = Array(response[:item])
|
|
11
12
|
if pools.empty?
|
|
12
13
|
puts "No pools found"
|
|
@@ -18,7 +19,6 @@ module F5
|
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
desc "show POOL", "Shows a pool's status"
|
|
21
|
-
|
|
22
22
|
def show(pool)
|
|
23
23
|
members = pool_members(pool)
|
|
24
24
|
if members.empty?
|
|
@@ -33,15 +33,14 @@ module F5
|
|
|
33
33
|
desc "status POOL", "Shows the status of a pool"
|
|
34
34
|
def status(pool)
|
|
35
35
|
members = pool_members(pool)
|
|
36
|
-
response =
|
|
36
|
+
response = client.LocalLB.Pool.get_member_object_status(
|
|
37
37
|
pool_names: { item: [ pool ] },
|
|
38
38
|
members: { item: [ members ] }
|
|
39
39
|
)
|
|
40
40
|
statuses = Array(response[:item][:item])
|
|
41
41
|
puts "%20s %25s %25s" % ["Address", "Availability", "Enabled"]
|
|
42
42
|
statuses.each_with_index do |s, idx|
|
|
43
|
-
|
|
44
|
-
puts "%20s %25s %25s" % [ members[idx][:address], s[:availability_status], s[:enabled_status] ]
|
|
43
|
+
puts "%20s %25s %25s" % [ members[idx][:address], s[:availability_status].split(/_/).last, s[:enabled_status].split(/_/).last ]
|
|
45
44
|
end
|
|
46
45
|
end
|
|
47
46
|
|
|
@@ -51,7 +50,7 @@ module F5
|
|
|
51
50
|
members.include? m[:address]
|
|
52
51
|
end
|
|
53
52
|
|
|
54
|
-
response =
|
|
53
|
+
response = client.LocalLB.Pool.set_member_session_enabled_state(
|
|
55
54
|
pool_names: { item: [ pool ] },
|
|
56
55
|
members: { item: [ set ] },
|
|
57
56
|
session_states: { item: [ set.map { "STATE_ENABLED" } ] }
|
|
@@ -65,7 +64,7 @@ module F5
|
|
|
65
64
|
members.include? m[:address]
|
|
66
65
|
end
|
|
67
66
|
|
|
68
|
-
response =
|
|
67
|
+
response = client.LocalLB.Pool.set_member_session_enabled_state(
|
|
69
68
|
pool_names: { item: [ pool ] },
|
|
70
69
|
members: { item: [ set ] },
|
|
71
70
|
session_states: { item: [ set.map { "STATE_DISABLED" } ] }
|
|
@@ -75,11 +74,15 @@ module F5
|
|
|
75
74
|
private
|
|
76
75
|
|
|
77
76
|
def pool_members(pool)
|
|
78
|
-
response =
|
|
77
|
+
response = client.LocalLB.Pool.get_member_v2(pool_names: { item: [ pool ] } )
|
|
79
78
|
members = Array(response[:item][:item])
|
|
80
79
|
members.map { |m| { address: m[:address], port: m[:port] } }
|
|
81
80
|
end
|
|
82
81
|
|
|
82
|
+
def client
|
|
83
|
+
@client || F5::Icontrol::API.new
|
|
84
|
+
end
|
|
85
|
+
|
|
83
86
|
end
|
|
84
87
|
|
|
85
88
|
class Application < Thor
|
|
@@ -93,10 +96,5 @@ module F5
|
|
|
93
96
|
subcommand "pool", Pool
|
|
94
97
|
|
|
95
98
|
end
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def self.api(klass)
|
|
99
|
-
klass.new(F5::Cli::Config.host, F5::Cli::Config.username, F5::Cli::Config.password)
|
|
100
|
-
end
|
|
101
99
|
end
|
|
102
100
|
end
|
data/lib/f5/icontrol.rb
CHANGED
|
@@ -1,40 +1,28 @@
|
|
|
1
1
|
require "f5/icontrol/version"
|
|
2
|
-
require "f5/icontrol/
|
|
3
|
-
require "f5/icontrol/local_lb/pool"
|
|
4
|
-
require "f5/icontrol/local_lb/node_address_v2"
|
|
2
|
+
require "f5/icontrol/api"
|
|
5
3
|
require "openssl"
|
|
6
4
|
require "savon"
|
|
7
5
|
|
|
8
6
|
module F5
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@username = username
|
|
13
|
-
@password = password
|
|
14
|
-
@client_cache = {}
|
|
7
|
+
module Icontrol
|
|
8
|
+
class << self
|
|
9
|
+
attr_accessor :configuration
|
|
15
10
|
end
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
File.dirname(__FILE__).gsub /(f5-icontrol[^\/]*\/lib)\/.*/, "\\1/wsdl/"
|
|
12
|
+
def self.configure
|
|
13
|
+
self.configuration ||= Configuration.new
|
|
14
|
+
yield configuration
|
|
21
15
|
end
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
#log: true,
|
|
32
|
-
#logger: Logger.new(STDOUT),
|
|
33
|
-
#pretty_print_xml: true,
|
|
34
|
-
#log_level: :debug,
|
|
35
|
-
namespace: "urn:iControl:#{api_namespace}",
|
|
36
|
-
convert_request_keys_to: :none
|
|
37
|
-
)
|
|
17
|
+
class Configuration
|
|
18
|
+
attr_accessor :host, :username, :password
|
|
19
|
+
|
|
20
|
+
def initialize
|
|
21
|
+
@host = "set_me_in_configure_block"
|
|
22
|
+
@username = ""
|
|
23
|
+
@password = ""
|
|
24
|
+
end
|
|
38
25
|
end
|
|
26
|
+
|
|
39
27
|
end
|
|
40
28
|
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
module F5
|
|
2
|
+
module Icontrol
|
|
3
|
+
class API
|
|
4
|
+
attr_accessor :api_path
|
|
5
|
+
|
|
6
|
+
def initialize(api_path = nil)
|
|
7
|
+
@username="a"
|
|
8
|
+
@password="b"
|
|
9
|
+
@hostname="xxx"
|
|
10
|
+
@client_cache = {}
|
|
11
|
+
@api_path = api_path
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def method_missing(method, args = nil, &block)
|
|
15
|
+
if terminal_node?
|
|
16
|
+
if supported_method?(method)
|
|
17
|
+
response_key = "#{method.to_s}_response".to_sym
|
|
18
|
+
|
|
19
|
+
response = client.call(method) do
|
|
20
|
+
if args
|
|
21
|
+
message args
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
response.to_hash[response_key][:return]
|
|
26
|
+
|
|
27
|
+
else
|
|
28
|
+
raise NameError, "#{@api_path} does not support #{method}"
|
|
29
|
+
end
|
|
30
|
+
else
|
|
31
|
+
if supported_path? append_path(method)
|
|
32
|
+
self.class.new append_path(method)
|
|
33
|
+
else
|
|
34
|
+
raise NameError, "#{append_path(method)} is not supported"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def terminal_node?
|
|
42
|
+
::File.exists? "#{wsdl_path}/#{@api_path}.wsdl"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def supported_method?(method)
|
|
46
|
+
client.operations.include?(method)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def supported_path?(path)
|
|
50
|
+
! Dir.glob("#{wsdl_path}/#{path}.*wsdl").empty?
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def append_path(item)
|
|
54
|
+
@api_path ? "#{@api_path}.#{item}" : item.to_s
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def wsdl_path
|
|
58
|
+
File.dirname(__FILE__).gsub /(f5-icontrol[^\/]*\/lib)\/.*/, "\\1/wsdl/"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def client
|
|
62
|
+
api_namespace = @api_path.gsub /\./, '/'
|
|
63
|
+
endpoint = '/iControl/iControlPortal.cgi'
|
|
64
|
+
@client_cache[@api_path] ||=
|
|
65
|
+
Savon.client(wsdl: "#{wsdl_path}#{@api_path}.wsdl",
|
|
66
|
+
endpoint: "https://#{F5::Icontrol.configuration.host}#{endpoint}",
|
|
67
|
+
ssl_verify_mode: :none,
|
|
68
|
+
basic_auth: [F5::Icontrol.configuration.username, F5::Icontrol.configuration.password],
|
|
69
|
+
#log: true,
|
|
70
|
+
#logger: Logger.new(STDOUT),
|
|
71
|
+
#pretty_print_xml: true,
|
|
72
|
+
#log_level: :debug,
|
|
73
|
+
namespace: "urn:iControl:#{api_namespace}",
|
|
74
|
+
convert_request_keys_to: :none
|
|
75
|
+
)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
data/lib/f5/icontrol/version.rb
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe F5::Icontrol::API do
|
|
4
|
+
before do
|
|
5
|
+
F5::Icontrol.configure do
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe '#initialize' do
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe 'a non terminal object' do
|
|
13
|
+
it "returns another version of itself" do
|
|
14
|
+
expect(subject.LocalLB.class).to eq described_class
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "stores the path" do
|
|
18
|
+
expect(subject.LocalLB.api_path).to eq "LocalLB"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe 'a terminal object' do
|
|
23
|
+
it "returns another version of itself" do
|
|
24
|
+
expect(subject.LocalLB.Pool.class).to eq described_class
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "stores the path" do
|
|
28
|
+
expect(subject.LocalLB.Pool.api_path).to eq "LocalLB.Pool"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe 'a terminal object with a method' do
|
|
33
|
+
let(:client) { double('SavonClient', operations: [ :get_list ]) }
|
|
34
|
+
|
|
35
|
+
before do
|
|
36
|
+
expect(Savon).to receive(:client).and_return(client)
|
|
37
|
+
expect(client).to receive(:call).with(:get_list).and_return({get_list_response: { return: "foo" }})
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "calls the method" do
|
|
41
|
+
subject.LocalLB.Pool.get_list
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe 'a non existent method' do
|
|
46
|
+
it "raises on non terminal method" do
|
|
47
|
+
expect { subject.foo }.to raise_error(NameError)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "raises on terminal method" do
|
|
51
|
+
expect { subject.LocalLB.Pool.foo }.to raise_error(NameError)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: f5-icontrol
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Walberg
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-10-
|
|
11
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: savon
|
|
@@ -140,11 +140,8 @@ files:
|
|
|
140
140
|
- bin/f5
|
|
141
141
|
- f5-icontrol.gemspec
|
|
142
142
|
- lib/f5/cli/application.rb
|
|
143
|
-
- lib/f5/cli/config.rb
|
|
144
143
|
- lib/f5/icontrol.rb
|
|
145
|
-
- lib/f5/icontrol/
|
|
146
|
-
- lib/f5/icontrol/local_lb/pool.rb
|
|
147
|
-
- lib/f5/icontrol/system/system_info.rb
|
|
144
|
+
- lib/f5/icontrol/api.rb
|
|
148
145
|
- lib/f5/icontrol/version.rb
|
|
149
146
|
- lib/wsdl/ASM.LoggingProfile.wsdl
|
|
150
147
|
- lib/wsdl/ASM.ObjectParams.wsdl
|
|
@@ -378,8 +375,7 @@ files:
|
|
|
378
375
|
- spec/cassettes/F5_Icontrol_System_SystemInfo/retrieves_something_with_a_complex_return_type_and_input.yml
|
|
379
376
|
- spec/cassettes/F5_Icontrol_System_SystemInfo/retrieves_the_uptime.yml
|
|
380
377
|
- spec/cassettes/F5_Icontrol_System_SystemInfo/retrieves_the_version.yml
|
|
381
|
-
- spec/models/
|
|
382
|
-
- spec/models/system/system_info_spec.rb
|
|
378
|
+
- spec/models/api_spec.rb
|
|
383
379
|
- spec/spec_helper.rb
|
|
384
380
|
homepage: https://github.com/swalberg/f5-icontrol
|
|
385
381
|
licenses:
|
|
@@ -410,6 +406,5 @@ test_files:
|
|
|
410
406
|
- spec/cassettes/F5_Icontrol_System_SystemInfo/retrieves_something_with_a_complex_return_type_and_input.yml
|
|
411
407
|
- spec/cassettes/F5_Icontrol_System_SystemInfo/retrieves_the_uptime.yml
|
|
412
408
|
- spec/cassettes/F5_Icontrol_System_SystemInfo/retrieves_the_version.yml
|
|
413
|
-
- spec/models/
|
|
414
|
-
- spec/models/system/system_info_spec.rb
|
|
409
|
+
- spec/models/api_spec.rb
|
|
415
410
|
- spec/spec_helper.rb
|
data/lib/f5/cli/config.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module F5
|
|
2
|
-
module Cli
|
|
3
|
-
class Config
|
|
4
|
-
def self.host
|
|
5
|
-
config["host"]
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def self.username
|
|
9
|
-
config["username"]
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def self.password
|
|
13
|
-
config["password"]
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def self.config
|
|
17
|
-
@@config ||= YAML.load_file("#{ENV['HOME']}/.f5.yml")
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require "savon"
|
|
2
|
-
module F5
|
|
3
|
-
class Icontrol
|
|
4
|
-
class LocalLB
|
|
5
|
-
class NodeAddressV2 < F5::Icontrol
|
|
6
|
-
def method_missing(method, args = nil, &block)
|
|
7
|
-
if respond_to? method
|
|
8
|
-
response_key = "#{method.to_s}_response".to_sym
|
|
9
|
-
|
|
10
|
-
response = client("LocalLB.NodeAddressV2").call(method) do
|
|
11
|
-
if args
|
|
12
|
-
message args
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
response.to_hash[response_key][:return]
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def respond_to?(method)
|
|
21
|
-
client("LocalLB.NodeAddressV2").operations.include? method
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require "savon"
|
|
2
|
-
module F5
|
|
3
|
-
class Icontrol
|
|
4
|
-
class LocalLB
|
|
5
|
-
class Pool < F5::Icontrol
|
|
6
|
-
def method_missing(method, args = nil, &block)
|
|
7
|
-
if respond_to? method
|
|
8
|
-
response_key = "#{method.to_s}_response".to_sym
|
|
9
|
-
|
|
10
|
-
response = client("LocalLB.Pool").call(method) do
|
|
11
|
-
if args
|
|
12
|
-
message args
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
response.to_hash[response_key][:return]
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def respond_to?(method)
|
|
21
|
-
client("LocalLB.Pool").operations.include? method
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require "savon"
|
|
2
|
-
module F5
|
|
3
|
-
class Icontrol
|
|
4
|
-
class System
|
|
5
|
-
class SystemInfo < F5::Icontrol
|
|
6
|
-
def method_missing(method, args = nil, &block)
|
|
7
|
-
if respond_to? method
|
|
8
|
-
response_key = "#{method.to_s}_response".to_sym
|
|
9
|
-
|
|
10
|
-
response = client("System.SystemInfo").call(method) do
|
|
11
|
-
if args
|
|
12
|
-
message args
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
response.to_hash[response_key][:return]
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def respond_to?(method)
|
|
21
|
-
client("System.SystemInfo").operations.include? method
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe F5::Icontrol::LocalLB::Pool, :vcr do
|
|
4
|
-
subject { described_class.new("10.198.4.135", "admin", "admin") }
|
|
5
|
-
|
|
6
|
-
describe "#respond_to?" do
|
|
7
|
-
it "supports create_v2" do
|
|
8
|
-
expect(subject.respond_to? :create_v2).to be_truthy
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "does not support buy cisco" do
|
|
12
|
-
expect(subject.respond_to? :buy_cisco).to be_falsey
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "creates a pool" do
|
|
17
|
-
#<hosts s:type="A:Array" A:arrayType="iControl:System.CPUUsageExtended[0]"/>
|
|
18
|
-
# Common.AddressPortSequenceSequence"
|
|
19
|
-
|
|
20
|
-
expect(subject.create_v2(pool_names: {item: ['test_pool']},
|
|
21
|
-
lb_methods: {item: ["LB_METHOD_OBSERVED_MEMBER"] },
|
|
22
|
-
members: [ { address: "10.1.1.1", port: "80" } ]
|
|
23
|
-
)
|
|
24
|
-
).to be_nil
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe F5::Icontrol::System::SystemInfo, :vcr do
|
|
4
|
-
subject { described_class.new("10.198.4.135", "admin", "admin") }
|
|
5
|
-
|
|
6
|
-
describe "#respond_to?" do
|
|
7
|
-
it "supports get_version" do
|
|
8
|
-
expect(subject.respond_to? :get_version).to be_truthy
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "supports get_uptime" do
|
|
12
|
-
expect(subject.respond_to? :get_uptime).to be_truthy
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "does not support buy cisco" do
|
|
16
|
-
expect(subject.respond_to? :buy_cisco).to be_falsey
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "retrieves the version" do
|
|
21
|
-
expect(subject.get_version).to eq "BIG-IP_v11.3.0"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "retrieves the uptime" do
|
|
25
|
-
expect(subject.get_uptime).to eq "425782"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "retrieves something with a complex return type and input" do
|
|
29
|
-
expect(subject.get_cpu_usage_extended_information(host_ids: { item: ["0-50-56-94-10-19.example.com"] } )).to eq(:"@s:type" => "iControl:System.CPUUsageExtendedInformation", :hosts => {:item=>{:host_id=>"0-50-56-94-10-19.example.com", :statistics=>{:item=>{:item=>[{:type=>"STATISTIC_CPU_INFO_CPU_ID", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_USER", :value=>{:high=>"0", :low=>"720687", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_NICED", :value=>{:high=>"0", :low=>"304036", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_SYSTEM", :value=>{:high=>"0", :low=>"200072", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_IDLE", :value=>{:high=>"0", :low=>"42375955", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_IRQ", :value=>{:high=>"0", :low=>"2153", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_SOFTIRQ", :value=>{:high=>"0", :low=>"3636", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_IOWAIT", :value=>{:high=>"0", :low=>"23673", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_STOLEN", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_USAGE_RATIO", :value=>{:high=>"0", :low=>"2", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_SEC_AVG_USER", :value=>{:high=>"0", :low=>"2", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_SEC_AVG_NICED", :value=>{:high=>"0", :low=>"1", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_SEC_AVG_SYSTEM", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_SEC_AVG_IDLE", :value=>{:high=>"0", :low=>"97", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_SEC_AVG_IRQ", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_SEC_AVG_SOFTIRQ", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_SEC_AVG_IOWAIT", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_SEC_AVG_STOLEN", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_SEC_AVG_USAGE_RATIO", :value=>{:high=>"0", :low=>"2", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_ONE_MIN_AVG_USER", :value=>{:high=>"0", :low=>"2", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_ONE_MIN_AVG_NICED", :value=>{:high=>"0", :low=>"1", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_ONE_MIN_AVG_SYSTEM", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_ONE_MIN_AVG_IDLE", :value=>{:high=>"0", :low=>"97", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_ONE_MIN_AVG_IRQ", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_ONE_MIN_AVG_SOFTIRQ", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_ONE_MIN_AVG_IOWAIT", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_ONE_MIN_AVG_STOLEN", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_ONE_MIN_AVG_USAGE_RATIO", :value=>{:high=>"0", :low=>"3", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_MIN_AVG_USER", :value=>{:high=>"0", :low=>"2", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_MIN_AVG_NICED", :value=>{:high=>"0", :low=>"1", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_MIN_AVG_SYSTEM", :value=>{:high=>"0", :low=>"1", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_MIN_AVG_IDLE", :value=>{:high=>"0", :low=>"97", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_MIN_AVG_IRQ", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_MIN_AVG_SOFTIRQ", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_MIN_AVG_IOWAIT", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_MIN_AVG_STOLEN", :value=>{:high=>"0", :low=>"0", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}, {:type=>"STATISTIC_CPU_INFO_FIVE_MIN_AVG_USAGE_RATIO", :value=>{:high=>"0", :low=>"3", :"@s:type"=>"iControl:Common.ULong64"}, :time_stamp=>"0"}], :"@a:array_type"=>"iControl:Common.Statistic[37]"}, :"@s:type"=>"A:Array", :"@a:array_type"=>"iControl:Common.Statistic[][1]"}}, :"@s:type"=>"A:Array", :"@a:array_type"=>"iControl:System.CPUUsageExtended[1]"}, :time_stamp => {:year=>"2014", :month=>"4", :day=>"9", :hour=>"18", :minute=>"38", :second=>"39", :"@s:type"=>"iControl:Common.TimeStamp"})
|
|
30
|
-
end
|
|
31
|
-
end
|