yao 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yao/resources.rb +27 -22
- data/lib/yao/resources/loadbalancer.rb +55 -0
- data/lib/yao/resources/loadbalancer_healthmonitor.rb +29 -0
- data/lib/yao/resources/loadbalancer_listener.rb +39 -0
- data/lib/yao/resources/loadbalancer_pool.rb +43 -1
- data/lib/yao/resources/loadbalancer_pool_member.rb +64 -0
- data/lib/yao/resources/old_sample.rb +1 -1
- data/lib/yao/resources/restfully_accessible.rb +1 -9
- data/lib/yao/resources/server.rb +8 -0
- data/lib/yao/version.rb +1 -1
- data/test/support/auth_stub.rb +21 -0
- data/test/yao/resources/test_loadbalancer.rb +28 -0
- data/test/yao/resources/test_loadbalancer_healthmonitor.rb +38 -0
- data/test/yao/resources/test_loadbalancer_listener.rb +58 -0
- data/test/yao/resources/test_loadbalancer_pool.rb +36 -0
- data/test/yao/resources/test_loadbalancer_pool_member.rb +32 -0
- data/test/yao/test_auth.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60c1114d4626aed1840dea9429543222ce8a0526
|
4
|
+
data.tar.gz: e53ef4409bcd048d6f3fd1fc719b2900c7b8e392
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '025418597e6b6f0bb2b8dae6591773a927354ba2215511b032ef17d0a57710bbc7fede8f5f66ac994c82336646abe570ce794f6c317f773d3056082508ae980f'
|
7
|
+
data.tar.gz: 2ef45a2b54da4430835e03569a772a6af5779736bfcf91c25b5575863bc1af33595596cf5484b17253dd45f3814fad83584dcde1c47d3567e6777cd06c94c55f
|
data/lib/yao/resources.rb
CHANGED
@@ -2,29 +2,34 @@ module Yao
|
|
2
2
|
module Resources
|
3
3
|
require "yao/resources/base"
|
4
4
|
|
5
|
-
autoload :Server,
|
6
|
-
autoload :Flavor,
|
7
|
-
autoload :Image,
|
8
|
-
autoload :SecurityGroup,
|
9
|
-
autoload :SecurityGroupRule,
|
10
|
-
autoload :Hypervisor,
|
11
|
-
autoload :Aggregates,
|
12
|
-
autoload :Keypair,
|
13
|
-
autoload :FloatingIP,
|
14
|
-
autoload :Network,
|
15
|
-
autoload :Subnet,
|
16
|
-
autoload :Port,
|
17
|
-
autoload :Router,
|
18
|
-
autoload :
|
19
|
-
autoload :
|
20
|
-
autoload :
|
21
|
-
autoload :
|
22
|
-
autoload :
|
5
|
+
autoload :Server, "yao/resources/server"
|
6
|
+
autoload :Flavor, "yao/resources/flavor"
|
7
|
+
autoload :Image, "yao/resources/image"
|
8
|
+
autoload :SecurityGroup, "yao/resources/security_group"
|
9
|
+
autoload :SecurityGroupRule, "yao/resources/security_group_rule"
|
10
|
+
autoload :Hypervisor, "yao/resources/hypervisor"
|
11
|
+
autoload :Aggregates, "yao/resources/aggregates"
|
12
|
+
autoload :Keypair, "yao/resources/keypair"
|
13
|
+
autoload :FloatingIP, "yao/resources/floating_ip"
|
14
|
+
autoload :Network, "yao/resources/network"
|
15
|
+
autoload :Subnet, "yao/resources/subnet"
|
16
|
+
autoload :Port, "yao/resources/port"
|
17
|
+
autoload :Router, "yao/resources/router"
|
18
|
+
autoload :LoadBalancer, "yao/resources/loadbalancer"
|
19
|
+
autoload :LoadBalancerListener, "yao/resources/loadbalancer_listener"
|
20
|
+
autoload :LoadBalancerPool, "yao/resources/loadbalancer_pool"
|
21
|
+
autoload :LoadBalancerPoolMember, "yao/resources/loadbalancer_pool_member"
|
22
|
+
autoload :LoadBalancerHealthMonitor, "yao/resources/loadbalancer_healthmonitor"
|
23
|
+
autoload :Tenant, "yao/resources/tenant"
|
24
|
+
autoload :Host, "yao/resources/host"
|
25
|
+
autoload :User, "yao/resources/user"
|
26
|
+
autoload :Role, "yao/resources/role"
|
27
|
+
autoload :RoleAssignment, "yao/resources/role_assignment"
|
23
28
|
|
24
|
-
autoload :Resource,
|
25
|
-
autoload :Meter,
|
26
|
-
autoload :OldSample,
|
27
|
-
autoload :Sample,
|
29
|
+
autoload :Resource, "yao/resources/resource"
|
30
|
+
autoload :Meter, "yao/resources/meter"
|
31
|
+
autoload :OldSample, "yao/resources/old_sample"
|
32
|
+
autoload :Sample, "yao/resources/sample"
|
28
33
|
end
|
29
34
|
|
30
35
|
def self.const_missing(name)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Yao::Resources
|
4
|
+
class LoadBalancer < Base
|
5
|
+
friendly_attributes :provider, :description, :admin_state_up, :provisioning_status,
|
6
|
+
:pools, :vip_address,
|
7
|
+
:operationg_status, :name
|
8
|
+
|
9
|
+
def created_at
|
10
|
+
Date.parse(self["created_at"])
|
11
|
+
end
|
12
|
+
|
13
|
+
def updated_at
|
14
|
+
Date.parse(self["updated_at"])
|
15
|
+
end
|
16
|
+
|
17
|
+
def project
|
18
|
+
Yao::Tenant.find self["project_id"]
|
19
|
+
end
|
20
|
+
|
21
|
+
def vip_network
|
22
|
+
Yao::Network.find self["vip_network_id"]
|
23
|
+
end
|
24
|
+
|
25
|
+
def vip_port
|
26
|
+
Yao::Port.find self["vip_port_id"]
|
27
|
+
end
|
28
|
+
|
29
|
+
def vip_subnet
|
30
|
+
Yao::Subnet.find self["vip_subnet_id"]
|
31
|
+
end
|
32
|
+
|
33
|
+
def listeners
|
34
|
+
self["listeners"].map do |listener|
|
35
|
+
Yao::LoadBalancerListener.find listener["id"]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def pools
|
40
|
+
self["pools"].map do |pool|
|
41
|
+
Yao::LoadBalancerPool.find pool["id"]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
self.service = "load-balancer"
|
46
|
+
self.api_version = "v2.0"
|
47
|
+
self.resource_name = "loadbalancer"
|
48
|
+
self.resources_name = "loadbalancers"
|
49
|
+
self.resources_path = "lbaas/loadbalancers"
|
50
|
+
|
51
|
+
class << self
|
52
|
+
alias :delete :destroy
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'date'
|
2
|
+
module Yao::Resources
|
3
|
+
class LoadBalancerHealthMonitor < Base
|
4
|
+
friendly_attributes :name, :admin_state_up, :provisioning_status,
|
5
|
+
:delay, :expected_codes, :max_retries,
|
6
|
+
:http_method, :timeout, :max_retries_down,
|
7
|
+
:url_path, :type, :operating_status
|
8
|
+
|
9
|
+
def pools
|
10
|
+
self["pools"].map do |pool|
|
11
|
+
Yao::LoadBalancerPool.find pool["id"]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def created_at
|
16
|
+
Date.parse(self["created_at"])
|
17
|
+
end
|
18
|
+
|
19
|
+
def updated_at
|
20
|
+
Date.parse(self["updated_at"])
|
21
|
+
end
|
22
|
+
|
23
|
+
self.service = "load-balancer"
|
24
|
+
self.api_version = "v2.0"
|
25
|
+
self.resource_name = "healthmonitor"
|
26
|
+
self.resources_name = "healthmonitors"
|
27
|
+
self.resources_path = "lbaas/healthmonitors"
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'date'
|
2
|
+
module Yao::Resources
|
3
|
+
class LoadBalancerListener < Base
|
4
|
+
friendly_attributes :description, :admin_state_up,
|
5
|
+
:protocol, :protocol_port, :provisioning_status,
|
6
|
+
:default_tls_container_ref, :insert_headers,
|
7
|
+
:operating_status, :sni_container_refs,
|
8
|
+
:l7policies, :name
|
9
|
+
|
10
|
+
def project
|
11
|
+
Yao::Tenant.find self["project_id"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def loadbalancers
|
15
|
+
self["loadbalancers"].map do |loadbalancer|
|
16
|
+
Yao::LoadBalancer.get loadbalancer["id"]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def created_at
|
21
|
+
Date.parse(self["created_at"])
|
22
|
+
end
|
23
|
+
|
24
|
+
def updated_at
|
25
|
+
Date.parse(self["updated_at"])
|
26
|
+
end
|
27
|
+
|
28
|
+
def default_pool
|
29
|
+
Yao::LoadBalancerPool.find self["default_pool_id"]
|
30
|
+
end
|
31
|
+
alias pool default_pool
|
32
|
+
|
33
|
+
self.service = "load-balancer"
|
34
|
+
self.api_version = "v2.0"
|
35
|
+
self.resource_name = "listener"
|
36
|
+
self.resources_name = "listeners"
|
37
|
+
self.resources_path = "lbaas/listeners"
|
38
|
+
end
|
39
|
+
end
|
@@ -1,6 +1,48 @@
|
|
1
|
+
require 'date'
|
1
2
|
module Yao::Resources
|
2
|
-
class
|
3
|
+
class LoadBalancerPool < Base
|
4
|
+
friendly_attributes :lb_algorithm, :protocol, :description,
|
5
|
+
:admin_state_up, :provisioning_status,
|
6
|
+
:session_persistence, :operating_status, :name,
|
7
|
+
|
8
|
+
def loadbalancers
|
9
|
+
self["loadbalancers"].map do |loadbalancer|
|
10
|
+
Yao::LoadBalancer.find loadbalancer["id"]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def created_at
|
15
|
+
Date.parse(self["created_at"])
|
16
|
+
end
|
17
|
+
|
18
|
+
def updated_at
|
19
|
+
Date.parse(self["updated_at"])
|
20
|
+
end
|
21
|
+
|
22
|
+
def listeners
|
23
|
+
self["listeners"].map do |listener|
|
24
|
+
Yao::LoadBalancerListener.find listener["id"]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def project
|
29
|
+
Yao::Tenant.find self["project_id"]
|
30
|
+
end
|
31
|
+
|
32
|
+
def members
|
33
|
+
self["members"].map do |member|
|
34
|
+
Yao::LoadBalancerPoolMember.find(self,member["id"])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def healthmonitor
|
39
|
+
Yao::LoadBalancerHealthMonitor.find self["healthmonitor_id"]
|
40
|
+
end
|
41
|
+
|
3
42
|
self.service = "load-balancer"
|
4
43
|
self.api_version = "v2.0"
|
44
|
+
self.resource_name = "pool"
|
45
|
+
self.resources_name = "pools"
|
46
|
+
self.resources_path = "lbaas/pools"
|
5
47
|
end
|
6
48
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'date'
|
2
|
+
module Yao::Resources
|
3
|
+
class LoadBalancerPoolMember < Base
|
4
|
+
friendly_attributes :monitor_port, :name, :weight,
|
5
|
+
:admin_state_up, :provisioning_status,
|
6
|
+
:monitor_address, :address,
|
7
|
+
:protocol_port, :operating_status
|
8
|
+
|
9
|
+
def project
|
10
|
+
Yao::Tenant.find self["project_id"]
|
11
|
+
end
|
12
|
+
|
13
|
+
def subnet
|
14
|
+
Yao::Subnet.find self["subnet_id"]
|
15
|
+
end
|
16
|
+
|
17
|
+
def created_at
|
18
|
+
Date.parse(self["created_at"])
|
19
|
+
end
|
20
|
+
|
21
|
+
def updated_at
|
22
|
+
Date.parse(self["updated_at"])
|
23
|
+
end
|
24
|
+
|
25
|
+
self.service = "load-balancer"
|
26
|
+
self.api_version = "v2.0"
|
27
|
+
self.resource_name = "member"
|
28
|
+
self.resources_name = "members"
|
29
|
+
|
30
|
+
class << self
|
31
|
+
|
32
|
+
def list(pool, query={})
|
33
|
+
self.resources_path = member_resources_path(pool)
|
34
|
+
super(query)
|
35
|
+
end
|
36
|
+
|
37
|
+
def get(pool, id_or_permalink, query={})
|
38
|
+
self.resources_path = member_resources_path(pool)
|
39
|
+
super(id_or_permalink, query)
|
40
|
+
end
|
41
|
+
alias find get
|
42
|
+
|
43
|
+
def create(pool, resource_params)
|
44
|
+
self.resources_path = member_resources_path(pool)
|
45
|
+
super(resource_params)
|
46
|
+
end
|
47
|
+
|
48
|
+
def update(pool, id, resource_params)
|
49
|
+
self.resources_path = member_resources_path(pool)
|
50
|
+
super(id, resource_params)
|
51
|
+
end
|
52
|
+
|
53
|
+
def destroy(pool, id)
|
54
|
+
self.resources_path = member_resources_path(pool)
|
55
|
+
super(id)
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
def member_resources_path(pool)
|
60
|
+
"lbaas/pools/#{pool.id}/#{self.resources_name}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Yao::Resources
|
2
2
|
class OldSample < Base
|
3
3
|
friendly_attributes :counter_name, :counter_type, :counter_unit, :counter_volume,
|
4
|
-
:message_id, :project_id, :resource_id, :timestamp, :resource_metadata, :user_id
|
4
|
+
:message_id, :project_id, :resource_id, :timestamp, :resource_metadata, :user_id,
|
5
5
|
:source
|
6
6
|
|
7
7
|
def recorded_at
|
@@ -24,7 +24,7 @@ module Yao::Resources
|
|
24
24
|
raise("Set api_version after service is declared") unless service
|
25
25
|
@api_version = v
|
26
26
|
if cli = client
|
27
|
-
cli.url_prefix.path
|
27
|
+
cli.url_prefix.path += "/#{api_version}" unless cli.url_prefix.to_s.include?("/#{api_version}")
|
28
28
|
end
|
29
29
|
api_version
|
30
30
|
end
|
@@ -84,14 +84,6 @@ module Yao::Resources
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
def list_detail(query={})
|
88
|
-
return_resources(
|
89
|
-
resources_from_json(
|
90
|
-
GET([resources_path, "detail"].join("/"), query).body
|
91
|
-
)
|
92
|
-
)
|
93
|
-
end
|
94
|
-
|
95
87
|
def get(id_or_permalink, query={})
|
96
88
|
res = if id_or_permalink =~ /^https?:\/\//
|
97
89
|
GET(id_or_permalink, query)
|
data/lib/yao/resources/server.rb
CHANGED
@@ -44,6 +44,14 @@ module Yao::Resources
|
|
44
44
|
|
45
45
|
class << self
|
46
46
|
alias :stop :shutoff
|
47
|
+
|
48
|
+
def list_detail(query={})
|
49
|
+
return_resources(
|
50
|
+
resources_from_json(
|
51
|
+
GET([resources_path, "detail"].join("/"), query).body
|
52
|
+
)
|
53
|
+
)
|
54
|
+
end
|
47
55
|
end
|
48
56
|
|
49
57
|
extend MetadataAvailable
|
data/lib/yao/version.rb
CHANGED
data/test/support/auth_stub.rb
CHANGED
@@ -119,6 +119,27 @@ module AuthStub
|
|
119
119
|
"endpoints_links": [],
|
120
120
|
"type": "identity",
|
121
121
|
"name": "keystone"
|
122
|
+
},
|
123
|
+
{
|
124
|
+
"endpoints": [
|
125
|
+
{
|
126
|
+
"adminURL": "#{auth_url}",
|
127
|
+
"region": "RegionOne",
|
128
|
+
"internalURL": "http://endpoint.example.com:9876",
|
129
|
+
"id": "bde3abca8864400a809f0089f025370a",
|
130
|
+
"publicURL": "http://endpoint.example.com:9876"
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"adminURL": "https://global-endpoint.example.com/api/octavia/",
|
134
|
+
"region": "RegionTest",
|
135
|
+
"internalURL": "http://192.168.10.52:9876",
|
136
|
+
"id": "2c3197eb24ef433eb5d9386c46ff1eb0",
|
137
|
+
"publicURL": "https://global-endpoint.example.com/api/octavia/"
|
138
|
+
}
|
139
|
+
],
|
140
|
+
"endpoints_links": [],
|
141
|
+
"type": "load-balancer",
|
142
|
+
"name": "octavia"
|
122
143
|
}
|
123
144
|
],
|
124
145
|
"user": {
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "date"
|
2
|
+
|
3
|
+
class TestRole < Test::Unit::TestCase
|
4
|
+
def test_loadbalancer
|
5
|
+
params = {
|
6
|
+
"provider" => "octavia",
|
7
|
+
"description" => "greate loadbalancer",
|
8
|
+
"admin_state_up" => true,
|
9
|
+
"provisioning_status" => "ACTIVE",
|
10
|
+
"vip_address" => "198.51.100.1",
|
11
|
+
"operationg_status" => "ONLINE",
|
12
|
+
"name" => "greate loadbalancer",
|
13
|
+
"created_at" => "2017-02-28T00:41:44",
|
14
|
+
"updated_at" => "2017-02-28T00:43:30",
|
15
|
+
}
|
16
|
+
|
17
|
+
lb = Yao::LoadBalancer.new(params)
|
18
|
+
assert_equal(lb.provider, "octavia")
|
19
|
+
assert_equal(lb.description, "greate loadbalancer")
|
20
|
+
assert_equal(lb.admin_state_up, true)
|
21
|
+
assert_equal(lb.provisioning_status, "ACTIVE")
|
22
|
+
assert_equal(lb.vip_address, "198.51.100.1")
|
23
|
+
assert_equal(lb.operationg_status, "ONLINE")
|
24
|
+
assert_equal(lb.name, "greate loadbalancer")
|
25
|
+
assert_equal(lb.created_at, Date.parse("2017-02-28T00:41:44"))
|
26
|
+
assert_equal(lb.updated_at, Date.parse("2017-02-28T00:43:30"))
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "date"
|
2
|
+
|
3
|
+
class TestRole < Test::Unit::TestCase
|
4
|
+
def test_loadbalancer_healtchmonitor
|
5
|
+
params = {
|
6
|
+
"name" => "super-pool-health-monitor",
|
7
|
+
"admin_state_up" => true,
|
8
|
+
"created_at" => "2017-05-11T23 =>53 =>47",
|
9
|
+
"provisioning_status" => "ACTIVE",
|
10
|
+
"updated_at" => "2017-05-11T23 =>53 =>47",
|
11
|
+
"delay" => 10,
|
12
|
+
"expected_codes" => "200",
|
13
|
+
"max_retries" => 1,
|
14
|
+
"http_method" => "GET",
|
15
|
+
"timeout" => 5,
|
16
|
+
"max_retries_down" => 3,
|
17
|
+
"url_path" => "/",
|
18
|
+
"type" => "HTTP",
|
19
|
+
"operating_status" => "ONLINE"
|
20
|
+
}
|
21
|
+
|
22
|
+
healthmonitor = Yao::LoadBalancerHealthMonitor.new(params)
|
23
|
+
assert_equal(healthmonitor.name, "super-pool-health-monitor")
|
24
|
+
assert_equal(healthmonitor.admin_state_up, true)
|
25
|
+
assert_equal(healthmonitor.created_at, Date.parse("2017-05-11T23:53:47"))
|
26
|
+
assert_equal(healthmonitor.provisioning_status, "ACTIVE")
|
27
|
+
assert_equal(healthmonitor.updated_at, Date.parse("2017-05-11T23:53:47"))
|
28
|
+
assert_equal(healthmonitor.delay, 10)
|
29
|
+
assert_equal(healthmonitor.expected_codes, "200")
|
30
|
+
assert_equal(healthmonitor.max_retries, 1)
|
31
|
+
assert_equal(healthmonitor.http_method, "GET")
|
32
|
+
assert_equal(healthmonitor.timeout, 5)
|
33
|
+
assert_equal(healthmonitor.max_retries_down, 3)
|
34
|
+
assert_equal(healthmonitor.url_path, "/")
|
35
|
+
assert_equal(healthmonitor.type, "HTTP")
|
36
|
+
assert_equal(healthmonitor.operating_status, "ONLINE")
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require "date"
|
2
|
+
|
3
|
+
class TestRole < Test::Unit::TestCase
|
4
|
+
def test_loadbalancer_listener
|
5
|
+
params = {
|
6
|
+
"description" => "A great TLS listener",
|
7
|
+
"admin_state_up" => true,
|
8
|
+
"protocol" => "TERMINATED_HTTPS",
|
9
|
+
"protocol_port" => 443,
|
10
|
+
"provisioning_status" => "ACTIVE",
|
11
|
+
"default_tls_container_ref" => "http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51",
|
12
|
+
"insert_headers" => {
|
13
|
+
"X-Forwarded-Port" => "true",
|
14
|
+
"X-Forwarded-For" => "true"
|
15
|
+
},
|
16
|
+
"created_at" => "2017-02-28T00:42:44",
|
17
|
+
"updated_at" => "2017-02-28T00:44:30",
|
18
|
+
"operating_status" => "ONLINE",
|
19
|
+
"sni_container_refs" => [
|
20
|
+
"http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51",
|
21
|
+
"http://198.51.100.10:9311/v1/containers/aaebb31e-7761-4826-8cb4-2b829caca3ee"
|
22
|
+
],
|
23
|
+
"l7policies" => [
|
24
|
+
{
|
25
|
+
"id" => "58284ac9-673e-47ff-9dcb-09871a1956c4",
|
26
|
+
"id" => "5e618272-339d-4a80-8d14-dbc093091bb1"
|
27
|
+
}
|
28
|
+
],
|
29
|
+
"name" => "great_tls_listener"
|
30
|
+
}
|
31
|
+
|
32
|
+
listener = Yao::LoadBalancerListener.new(params)
|
33
|
+
assert_equal(listener.description, "A great TLS listener")
|
34
|
+
assert_equal(listener.admin_state_up, true)
|
35
|
+
assert_equal(listener.protocol, "TERMINATED_HTTPS")
|
36
|
+
assert_equal(listener.protocol_port, 443)
|
37
|
+
assert_equal(listener.provisioning_status, "ACTIVE")
|
38
|
+
assert_equal(listener.default_tls_container_ref, "http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51")
|
39
|
+
assert_equal(listener.insert_headers, {
|
40
|
+
"X-Forwarded-Port" => "true",
|
41
|
+
"X-Forwarded-For" => "true"
|
42
|
+
})
|
43
|
+
assert_equal(listener.created_at, Date.parse("2017-02-28T00:42:44"))
|
44
|
+
assert_equal(listener.updated_at, Date.parse("2017-02-28T00:44:30"))
|
45
|
+
assert_equal(listener.operating_status, "ONLINE")
|
46
|
+
assert_equal(listener.sni_container_refs, [
|
47
|
+
"http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51",
|
48
|
+
"http://198.51.100.10:9311/v1/containers/aaebb31e-7761-4826-8cb4-2b829caca3ee"
|
49
|
+
])
|
50
|
+
assert_equal(listener.l7policies, [
|
51
|
+
{
|
52
|
+
"id" => "58284ac9-673e-47ff-9dcb-09871a1956c4",
|
53
|
+
"id" => "5e618272-339d-4a80-8d14-dbc093091bb1"
|
54
|
+
}
|
55
|
+
])
|
56
|
+
assert_equal(listener.name, "great_tls_listener")
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "date"
|
2
|
+
|
3
|
+
class TestRole < Test::Unit::TestCase
|
4
|
+
def test_loadbalancer_pool
|
5
|
+
params = {
|
6
|
+
"lb_algorithm" => "ROUND_ROBIN",
|
7
|
+
"protocol" => "HTTP",
|
8
|
+
"description" => "My round robin pool",
|
9
|
+
"admin_state_up" => true,
|
10
|
+
"created_at" => "2017-04-13T18:14:44",
|
11
|
+
"provisioning_status" => "ACTIVE",
|
12
|
+
"updated_at" => "2017-04-13T23:08:12",
|
13
|
+
"session_persistence" => {
|
14
|
+
"cookie_name" => nil,
|
15
|
+
"type" => "SOURCE_IP"
|
16
|
+
},
|
17
|
+
"operating_status" => "ONLINE",
|
18
|
+
"name" => "round_robin_pool"
|
19
|
+
}
|
20
|
+
|
21
|
+
pool = Yao::LoadBalancerPool.new(params)
|
22
|
+
assert_equal(pool.lb_algorithm, "ROUND_ROBIN")
|
23
|
+
assert_equal(pool.protocol, "HTTP")
|
24
|
+
assert_equal(pool.description, "My round robin pool")
|
25
|
+
assert_equal(pool.admin_state_up, true)
|
26
|
+
assert_equal(pool.created_at, Date.parse("2017-04-13T18:14:44"))
|
27
|
+
assert_equal(pool.provisioning_status, "ACTIVE")
|
28
|
+
assert_equal(pool.updated_at, Date.parse("2017-04-13T23:08:12"))
|
29
|
+
assert_equal(pool.session_persistence, {
|
30
|
+
"cookie_name" => nil,
|
31
|
+
"type" => "SOURCE_IP"
|
32
|
+
})
|
33
|
+
assert_equal(pool.operating_status, "ONLINE")
|
34
|
+
assert_equal(pool.name, "round_robin_pool")
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "date"
|
2
|
+
|
3
|
+
class TestRole < Test::Unit::TestCase
|
4
|
+
def test_loadbalancer_pool_member
|
5
|
+
params = {
|
6
|
+
"monitor_port" => 8080,
|
7
|
+
"name" => "web-server-1",
|
8
|
+
"weight" => 20,
|
9
|
+
"admin_state_up" => true,
|
10
|
+
"created_at" => "2017-05-11T17 =>21 =>34",
|
11
|
+
"provisioning_status" => "ACTIVE",
|
12
|
+
"monitor_address" => nil,
|
13
|
+
"updated_at" => "2017-05-11T17 =>21 =>37",
|
14
|
+
"address" => "192.0.2.16",
|
15
|
+
"protocol_port" => 80,
|
16
|
+
"operating_status" => "NO_MONITOR"
|
17
|
+
}
|
18
|
+
|
19
|
+
member = Yao::LoadBalancerPoolMember.new(params)
|
20
|
+
assert_equal(member.monitor_port, 8080)
|
21
|
+
assert_equal(member.name, "web-server-1")
|
22
|
+
assert_equal(member.weight, 20)
|
23
|
+
assert_equal(member.admin_state_up, true)
|
24
|
+
assert_equal(member.created_at, Date.parse("2017-05-11T17:21:34"))
|
25
|
+
assert_equal(member.provisioning_status, "ACTIVE")
|
26
|
+
assert_equal(member.monitor_address, nil)
|
27
|
+
assert_equal(member.updated_at, Date.parse("2017-05-11T17:21:37"))
|
28
|
+
assert_equal(member.address, "192.0.2.16")
|
29
|
+
assert_equal(member.protocol_port, 80)
|
30
|
+
assert_equal(member.operating_status, "NO_MONITOR")
|
31
|
+
end
|
32
|
+
end
|
data/test/yao/test_auth.rb
CHANGED
@@ -45,7 +45,7 @@ class TestAuth < Test::Unit::TestCase
|
|
45
45
|
def test_token_is_valid
|
46
46
|
assert { @token.token == "aaaa166533fd49f3b11b1cdce2430000" }
|
47
47
|
assert { @token.expire_at - @token.issued_at == 3600 }
|
48
|
-
assert { @token.endpoints.size ==
|
48
|
+
assert { @token.endpoints.size == 5 }
|
49
49
|
end
|
50
50
|
|
51
51
|
def test_hooked_by_configure_block
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uchio, KONDO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07
|
11
|
+
date: 2017-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -186,7 +186,11 @@ files:
|
|
186
186
|
- lib/yao/resources/hypervisor.rb
|
187
187
|
- lib/yao/resources/image.rb
|
188
188
|
- lib/yao/resources/keypair.rb
|
189
|
+
- lib/yao/resources/loadbalancer.rb
|
190
|
+
- lib/yao/resources/loadbalancer_healthmonitor.rb
|
191
|
+
- lib/yao/resources/loadbalancer_listener.rb
|
189
192
|
- lib/yao/resources/loadbalancer_pool.rb
|
193
|
+
- lib/yao/resources/loadbalancer_pool_member.rb
|
190
194
|
- lib/yao/resources/metadata_available.rb
|
191
195
|
- lib/yao/resources/meter.rb
|
192
196
|
- lib/yao/resources/network.rb
|
@@ -212,6 +216,11 @@ files:
|
|
212
216
|
- test/fixtures/dummy.pem
|
213
217
|
- test/support/auth_stub.rb
|
214
218
|
- test/yao/resources/test_aggregates.rb
|
219
|
+
- test/yao/resources/test_loadbalancer.rb
|
220
|
+
- test/yao/resources/test_loadbalancer_healthmonitor.rb
|
221
|
+
- test/yao/resources/test_loadbalancer_listener.rb
|
222
|
+
- test/yao/resources/test_loadbalancer_pool.rb
|
223
|
+
- test/yao/resources/test_loadbalancer_pool_member.rb
|
215
224
|
- test/yao/resources/test_role.rb
|
216
225
|
- test/yao/resources/test_security_group.rb
|
217
226
|
- test/yao/resources/test_security_group_rule.rb
|
@@ -255,6 +264,11 @@ test_files:
|
|
255
264
|
- test/fixtures/dummy.pem
|
256
265
|
- test/support/auth_stub.rb
|
257
266
|
- test/yao/resources/test_aggregates.rb
|
267
|
+
- test/yao/resources/test_loadbalancer.rb
|
268
|
+
- test/yao/resources/test_loadbalancer_healthmonitor.rb
|
269
|
+
- test/yao/resources/test_loadbalancer_listener.rb
|
270
|
+
- test/yao/resources/test_loadbalancer_pool.rb
|
271
|
+
- test/yao/resources/test_loadbalancer_pool_member.rb
|
258
272
|
- test/yao/resources/test_role.rb
|
259
273
|
- test/yao/resources/test_security_group.rb
|
260
274
|
- test/yao/resources/test_security_group_rule.rb
|