misty 1.4.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +87 -88
- data/lib/misty.rb +115 -1
- data/lib/misty/auth/catalog.rb +38 -0
- data/lib/misty/auth/catalog/v2.rb +15 -0
- data/lib/misty/auth/catalog/v3.rb +15 -0
- data/lib/misty/auth/token.rb +70 -0
- data/lib/misty/auth/token/v2.rb +63 -0
- data/lib/misty/auth/token/v3.rb +90 -0
- data/lib/misty/cloud.rb +74 -15
- data/lib/misty/config.rb +37 -43
- data/lib/misty/errors.rb +25 -5
- data/lib/misty/helper.rb +26 -0
- data/lib/misty/http/header.rb +3 -6
- data/lib/misty/http/method_builder.rb +2 -2
- data/lib/misty/http/request.rb +3 -3
- data/lib/misty/microversion.rb +12 -1
- data/lib/misty/misty.rb +7 -62
- data/lib/misty/openstack.rb +39 -0
- data/lib/misty/openstack/{aodh → api/aodh}/aodh_v2.rb +1 -1
- data/lib/misty/openstack/api/aodh/v2.rb +19 -0
- data/lib/misty/openstack/api/barbican/barbican_v1.rb +42 -0
- data/lib/misty/openstack/api/barbican/v1.rb +19 -0
- data/lib/misty/openstack/api/blazar/blazar_v1.rb +16 -0
- data/lib/misty/openstack/api/blazar/v1.rb +19 -0
- data/lib/misty/openstack/{ceilometer → api/ceilometer}/ceilometer_v2.rb +1 -1
- data/lib/misty/openstack/api/ceilometer/v2.rb +19 -0
- data/lib/misty/openstack/{cinder → api/cinder}/cinder_v1.rb +1 -1
- data/lib/misty/openstack/{cinder → api/cinder}/cinder_v2.rb +3 -3
- data/lib/misty/openstack/{cinder → api/cinder}/cinder_v3.rb +7 -4
- data/lib/misty/openstack/api/cinder/v1.rb +23 -0
- data/lib/misty/openstack/api/cinder/v2.rb +24 -0
- data/lib/misty/openstack/api/cinder/v3.rb +29 -0
- data/lib/misty/openstack/{designate → api/designate}/designate_v2.rb +2 -2
- data/lib/misty/openstack/api/designate/v2.rb +19 -0
- data/lib/misty/openstack/{freezer → api/freezer}/freezer_v1.rb +2 -2
- data/lib/misty/openstack/api/freezer/v1.rb +19 -0
- data/lib/misty/openstack/{glance → api/glance}/glance_v1.rb +1 -1
- data/lib/misty/openstack/{glance → api/glance}/glance_v2.rb +1 -1
- data/lib/misty/openstack/api/glance/v1.rb +19 -0
- data/lib/misty/openstack/api/glance/v2.rb +24 -0
- data/lib/misty/openstack/api/gnocchi/gnocchi_v1.rb +39 -0
- data/lib/misty/openstack/api/gnocchi/v1.rb +19 -0
- data/lib/misty/openstack/{heat → api/heat}/heat_v1.rb +1 -1
- data/lib/misty/openstack/api/heat/v1.rb +23 -0
- data/lib/misty/openstack/{ironic → api/ironic}/ironic_v1.rb +8 -2
- data/lib/misty/openstack/api/ironic/v1.rb +25 -0
- data/lib/misty/openstack/{karbor → api/karbor}/karbor_v1.rb +2 -2
- data/lib/misty/openstack/api/karbor/v1.rb +19 -0
- data/lib/misty/openstack/{keystone → api/keystone}/keystone_v2_0.rb +1 -1
- data/lib/misty/openstack/api/keystone/keystone_v2_0_ext.rb +14 -0
- data/lib/misty/openstack/{keystone → api/keystone}/keystone_v3.rb +35 -3
- data/lib/misty/openstack/{keystone → api/keystone}/keystone_v3_ext.rb +7 -9
- data/lib/misty/openstack/api/keystone/v2_0.rb +23 -0
- data/lib/misty/openstack/api/keystone/v3.rb +23 -0
- data/lib/misty/openstack/{magnum → api/magnum}/magnum_v1.rb +2 -2
- data/lib/misty/openstack/api/magnum/v1.rb +21 -0
- data/lib/misty/openstack/{manila → api/manila}/manila_v2.rb +7 -3
- data/lib/misty/openstack/api/manila/v2.rb +25 -0
- data/lib/misty/openstack/api/masakari/masakari_v1_0.rb +22 -0
- data/lib/misty/openstack/api/masakari/v1_0.rb +19 -0
- data/lib/misty/openstack/api/mistral/mistral_v2.rb +44 -0
- data/lib/misty/openstack/api/mistral/v2.rb +19 -0
- data/lib/misty/openstack/api/monasca/monasca_v2_0.rb +28 -0
- data/lib/misty/openstack/api/monasca/v2_0.rb +19 -0
- data/lib/misty/openstack/{murano → api/murano}/murano_v1.rb +1 -1
- data/lib/misty/openstack/api/murano/v1.rb +19 -0
- data/lib/misty/openstack/{neutron → api/neutron}/neutron_v2_0.rb +11 -12
- data/lib/misty/openstack/api/neutron/v2_0.rb +19 -0
- data/lib/misty/openstack/{nova → api/nova}/nova_v2_1.rb +1 -2
- data/lib/misty/openstack/api/nova/v2_1.rb +33 -0
- data/lib/misty/openstack/{octavia → api/octavia}/octavia_v2_0.rb +4 -3
- data/lib/misty/openstack/api/octavia/v2_0.rb +19 -0
- data/lib/misty/openstack/api/panko/panko_v2.rb +14 -0
- data/lib/misty/openstack/api/panko/v2.rb +19 -0
- data/lib/misty/openstack/api/placement/placement_v2_1.rb +50 -0
- data/lib/misty/openstack/api/placement/v2_1.rb +21 -0
- data/lib/misty/openstack/{sahara → api/sahara}/sahara_v1_1.rb +2 -2
- data/lib/misty/openstack/api/sahara/v1_1.rb +19 -0
- data/lib/misty/openstack/{searchlight → api/searchlight}/searchlight_v1.rb +2 -2
- data/lib/misty/openstack/api/searchlight/v1.rb +19 -0
- data/lib/misty/openstack/{senlin → api/senlin}/senlin_v1.rb +2 -2
- data/lib/misty/openstack/api/senlin/v1.rb +19 -0
- data/lib/misty/openstack/{swift → api/swift}/swift_v1.rb +2 -2
- data/lib/misty/openstack/api/swift/v1.rb +34 -0
- data/lib/misty/openstack/{tacker → api/tacker}/tacker_v1_0.rb +2 -2
- data/lib/misty/openstack/api/tacker/v1_0.rb +19 -0
- data/lib/misty/openstack/{trove → api/trove}/trove_v1_0.rb +23 -8
- data/lib/misty/openstack/api/trove/v1_0.rb +19 -0
- data/lib/misty/openstack/api/watcher/v1.rb +19 -0
- data/lib/misty/openstack/api/watcher/watcher_v1.rb +38 -0
- data/lib/misty/openstack/api/zaqar/v2.rb +19 -0
- data/lib/misty/openstack/{zaqar → api/zaqar}/zaqar_v2.rb +2 -2
- data/lib/misty/openstack/api/zun/v1.rb +19 -0
- data/lib/misty/openstack/api/zun/zun_v1.rb +55 -0
- data/lib/misty/openstack/service.rb +18 -15
- data/lib/misty/openstack/service_pack.rb +18 -0
- data/lib/misty/service.rb +4 -6
- data/lib/misty/services.rb +11 -10
- data/lib/misty/version.rb +1 -1
- data/test/integration/compute_test.rb +2 -2
- data/test/integration/{networking_test.rb → network_test.rb} +10 -10
- data/test/integration/orchestration_test.rb +4 -4
- data/test/integration/vcr/{networking_using_neutron_v2_0.yml → network_using_neutron_v2_0.yml} +0 -0
- data/test/unit/auth/catalog_test.rb +99 -0
- data/test/unit/{auth_test.rb → auth/token_test.rb} +79 -45
- data/test/unit/cloud/config_test.rb +79 -41
- data/test/unit/cloud/requests_test.rb +6 -6
- data/test/unit/cloud/services_test.rb +23 -23
- data/test/unit/cloud_test.rb +10 -10
- data/test/unit/http/method_builder_test.rb +13 -23
- data/test/unit/http/request_test.rb +1 -1
- data/test/unit/microversion_test.rb +13 -16
- data/test/unit/misty_test.rb +51 -49
- data/test/unit/openstack/APIs_test.rb +5 -9
- data/test/unit/openstack/extension_test.rb +6 -6
- data/test/unit/openstack/service_test.rb +2 -10
- data/test/unit/service_helper.rb +3 -8
- data/test/unit/services_test.rb +5 -5
- metadata +91 -66
- data/lib/misty/auth.rb +0 -91
- data/lib/misty/auth/auth_v2.rb +0 -65
- data/lib/misty/auth/auth_v3.rb +0 -89
- data/lib/misty/autoload.rb +0 -99
- data/lib/misty/client_pack.rb +0 -16
- data/lib/misty/openstack/aodh/v2.rb +0 -17
- data/lib/misty/openstack/ceilometer/v2.rb +0 -17
- data/lib/misty/openstack/cinder/v1.rb +0 -21
- data/lib/misty/openstack/cinder/v2.rb +0 -22
- data/lib/misty/openstack/cinder/v3.rb +0 -31
- data/lib/misty/openstack/designate/v2.rb +0 -17
- data/lib/misty/openstack/freezer/v1.rb +0 -17
- data/lib/misty/openstack/glance/v1.rb +0 -17
- data/lib/misty/openstack/glance/v2.rb +0 -17
- data/lib/misty/openstack/heat/v1.rb +0 -21
- data/lib/misty/openstack/ironic/v1.rb +0 -27
- data/lib/misty/openstack/karbor/v1.rb +0 -17
- data/lib/misty/openstack/keystone/keystone_v2_0_ext.rb +0 -18
- data/lib/misty/openstack/keystone/v2_0.rb +0 -21
- data/lib/misty/openstack/keystone/v3.rb +0 -21
- data/lib/misty/openstack/magnum/v1.rb +0 -23
- data/lib/misty/openstack/manila/v2.rb +0 -27
- data/lib/misty/openstack/murano/v1.rb +0 -17
- data/lib/misty/openstack/neutron/v2_0.rb +0 -17
- data/lib/misty/openstack/nova/v2_1.rb +0 -42
- data/lib/misty/openstack/octavia/v2_0.rb +0 -17
- data/lib/misty/openstack/sahara/v1_1.rb +0 -17
- data/lib/misty/openstack/searchlight/v1.rb +0 -17
- data/lib/misty/openstack/senlin/v1.rb +0 -17
- data/lib/misty/openstack/swift/v1.rb +0 -32
- data/lib/misty/openstack/tacker/v1_0.rb +0 -17
- data/lib/misty/openstack/trove/v1_0.rb +0 -17
- data/lib/misty/openstack/zaqar/v2.rb +0 -17
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'misty/openstack/api/zaqar/zaqar_v2'
|
2
|
+
require 'misty/openstack/service_pack'
|
3
|
+
|
4
|
+
module Misty
|
5
|
+
module Openstack
|
6
|
+
module API
|
7
|
+
module Zaqar
|
8
|
+
class V2
|
9
|
+
include Misty::Openstack::API::ZaqarV2
|
10
|
+
include Misty::Openstack::ServicePack
|
11
|
+
|
12
|
+
def service_types
|
13
|
+
%w(message messaging)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'misty/openstack/api/zun/zun_v1'
|
2
|
+
require 'misty/openstack/service_pack'
|
3
|
+
|
4
|
+
module Misty
|
5
|
+
module Openstack
|
6
|
+
module API
|
7
|
+
module Zun
|
8
|
+
class V1
|
9
|
+
include Misty::Openstack::API::ZunV1
|
10
|
+
include Misty::Openstack::ServicePack
|
11
|
+
|
12
|
+
def service_types
|
13
|
+
%w(application-container container)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Misty::Openstack::API::ZunV1
|
2
|
+
def tag
|
3
|
+
'Containers Service API Reference 1.0.1'
|
4
|
+
end
|
5
|
+
|
6
|
+
def api
|
7
|
+
{"/v1/containers/"=>
|
8
|
+
{:POST=>[:create_new_container], :GET=>[:list_all_containers]},
|
9
|
+
"/v1/containers/{container_ident}"=>
|
10
|
+
{:GET=>[:show_details_of_a_container],
|
11
|
+
:DELETE=>[:delete_a_container],
|
12
|
+
:PATCH=>[:update_information_of_container]},
|
13
|
+
"/v1/containers/{container_ident}/kill"=>{:POST=>[:kill_a_container]},
|
14
|
+
"/v1/containers/{container_ident}/stats"=>
|
15
|
+
{:GET=>[:display_stats_of_a_container]},
|
16
|
+
"/v1/containers/{container_ident}/start"=>{:POST=>[:start_a_container]},
|
17
|
+
"/v1/containers/{container_ident}/stop"=>{:POST=>[:stop_a_container]},
|
18
|
+
"/v1/containers/{container_ident}/pause"=>{:POST=>[:pause_a_container]},
|
19
|
+
"/v1/containers/{container_ident}/unpause"=>{:POST=>[:unpause_a_container]},
|
20
|
+
"/v1/containers/{container_ident}/reboot"=>{:POST=>[:restart_a_container]},
|
21
|
+
"/v1/containers/{container_ident}/rename"=>{:POST=>[:rename_a_container]},
|
22
|
+
"/v1/containers/{container_ident}/get_archive"=>
|
23
|
+
{:GET=>[:get_archive_from_a_container]},
|
24
|
+
"/v1/containers/{container_ident}/put_archive"=>
|
25
|
+
{:POST=>[:put_archive_to_a_container]},
|
26
|
+
"/v1/containers/{container_ident}/add_securtiy_group"=>
|
27
|
+
{:POST=>[:add_security_group_for_specified_container]},
|
28
|
+
"/v1/containers/{container_ident}/commit"=>{:POST=>[:commit_a_container]},
|
29
|
+
"/v1/containers/{container_ident}/attach"=>{:GET=>[:attach_to_a_container]},
|
30
|
+
"/v1/containers/{container_ident}/network_detach"=>
|
31
|
+
{:POST=>[:detach_a_network_from_a_container]},
|
32
|
+
"/v1/containers/{container_ident}/resize"=>{:POST=>[:resize_a_container]},
|
33
|
+
"/v1/containers/{container_ident}/network_attach"=>
|
34
|
+
{:POST=>[:attach_a_network_to_a_container]},
|
35
|
+
"/v1/containers/{container_ident}/execute"=>
|
36
|
+
{:POST=>[:execute_command_in_a_running_container]},
|
37
|
+
"/v1/containers/{container_ident}/execute_resize"=>
|
38
|
+
{:POST=>[:resize_tty_when_execute_command_in_a_container]},
|
39
|
+
"/v1/containers/{container_ident}/logs"=>{:GET=>[:get_logs_of_a_container]},
|
40
|
+
"/v1/containers/{container_ident}/top"=>
|
41
|
+
{:GET=>[:display_the_running_processes_in_a_container]},
|
42
|
+
"/v1/containers/{container_ident}/network_list"=>
|
43
|
+
{:GET=>[:list_networks_on_a_container]},
|
44
|
+
"/v1/containers/{container_ident}/container_actions"=>
|
45
|
+
{:GET=>[:list_actions_for_container]},
|
46
|
+
"/v1/containers/{container_ident}/container_actions/{request_ident}"=>
|
47
|
+
{:GET=>[:show_container_action_details]},
|
48
|
+
"/v1/services"=>{:GET=>[:show_service_status], :DELETE=>[:delete_service]},
|
49
|
+
"/v1/services/enable"=>{:PUT=>[:enable_service]},
|
50
|
+
"/v1/services/disable"=>{:PUT=>[:disable_service]},
|
51
|
+
"/v1/services/force_down"=>{:PUT=>[:force_down_service]},
|
52
|
+
"/v1/hosts"=>{:GET=>[:list_all_compute_hosts]},
|
53
|
+
"/v1/hosts/{host_ident}"=>{:GET=>[:show_details_of_a_host]}}
|
54
|
+
end
|
55
|
+
end
|
@@ -3,12 +3,8 @@ module Misty
|
|
3
3
|
module Service
|
4
4
|
attr_reader :headers, :microversion
|
5
5
|
|
6
|
-
# ==== Attributes
|
7
|
-
#
|
8
|
-
# * +arg+ - +Misty::Config+ instance
|
9
|
-
#
|
10
6
|
def initialize(arg)
|
11
|
-
@
|
7
|
+
@token = arg[:token]
|
12
8
|
@log = arg[:log]
|
13
9
|
@config = arg[:config]
|
14
10
|
|
@@ -16,11 +12,15 @@ module Misty
|
|
16
12
|
@headers = Misty::HTTP::Header.new(@config[:headers].get.clone)
|
17
13
|
@ssl_verify_mode = @config[:ssl_verify_mode]
|
18
14
|
|
19
|
-
@
|
15
|
+
@endpoint = if @config[:endpoint]
|
16
|
+
URI.parse(@config[:endpoint])
|
17
|
+
else
|
18
|
+
names = service_types
|
19
|
+
names << @config[:service_name] if @config[:service_name]
|
20
|
+
URI.parse(@token.catalog.get_endpoint_url(names, @config[:region], @config[:interface]))
|
21
|
+
end
|
20
22
|
|
21
|
-
@base_path = @config[:base_path] ? @config[:base_path] : @
|
22
|
-
@base_path = @base_path.chomp('/')
|
23
|
-
@base_url = @config[:base_url] ? @config[:base_url] : nil
|
23
|
+
@base_path = @config[:base_path] ? @config[:base_path] : @endpoint.path.chomp('/')
|
24
24
|
|
25
25
|
if microversion
|
26
26
|
asked_version = @config[:version] ? @config[:version] : ''
|
@@ -46,7 +46,8 @@ module Misty
|
|
46
46
|
requests_api + requests_custom
|
47
47
|
end
|
48
48
|
|
49
|
-
# Each option is recreated
|
49
|
+
# Each option is recreated for a request brief life duration to account for a new value if provided or use value
|
50
|
+
# propagated from defaults, globals or service levels
|
50
51
|
def request_config(arg = {})
|
51
52
|
@request_content_type = arg[:content_type] ? arg[:content_type] : @content_type
|
52
53
|
@request_headers = Misty::HTTP::Header.new(@headers.get.clone)
|
@@ -61,11 +62,6 @@ module Misty
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
64
|
-
# TODO: remove
|
65
|
-
def baseclass
|
66
|
-
self.class.to_s.split('::')[-1]
|
67
|
-
end
|
68
|
-
|
69
65
|
private
|
70
66
|
|
71
67
|
def requests_api
|
@@ -83,6 +79,13 @@ module Misty
|
|
83
79
|
def requests_custom
|
84
80
|
[]
|
85
81
|
end
|
82
|
+
|
83
|
+
def service_types_soon
|
84
|
+
project = self.class.to_s.split('::')[-2].downcase.to_sym
|
85
|
+
s = Misty.services.find {|service| service.project == project}
|
86
|
+
raise RuntimeError, 'No service types found' unless s&.name
|
87
|
+
s.microversion
|
88
|
+
end
|
86
89
|
end
|
87
90
|
end
|
88
91
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'misty/openstack/service'
|
2
|
+
require 'misty/http/net_http'
|
3
|
+
require 'misty/http/method_builder'
|
4
|
+
require 'misty/http/request'
|
5
|
+
require 'misty/http/direct'
|
6
|
+
require 'misty/http/header'
|
7
|
+
|
8
|
+
module Misty
|
9
|
+
module Openstack
|
10
|
+
module ServicePack
|
11
|
+
include Misty::Openstack::Service
|
12
|
+
include Misty::HTTP::NetHTTP
|
13
|
+
include Misty::HTTP::MethodBuilder
|
14
|
+
include Misty::HTTP::Request
|
15
|
+
include Misty::HTTP::Direct
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/misty/service.rb
CHANGED
@@ -1,26 +1,24 @@
|
|
1
1
|
module Misty
|
2
2
|
class Service
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :type, :microversion, :project, :versions
|
4
4
|
|
5
5
|
def initialize(params)
|
6
|
-
@
|
6
|
+
@type = params[:type]
|
7
7
|
@project = params[:project]
|
8
8
|
@versions = params[:versions]
|
9
9
|
@microversion = params[:microversion]
|
10
10
|
end
|
11
11
|
|
12
12
|
def to_s
|
13
|
-
str = "#{
|
13
|
+
str = "#{type}: #{project}"
|
14
14
|
str << ", versions: #{@versions}" if @versions
|
15
15
|
str << ", microversion: #{@microversion}" if @microversion
|
16
16
|
str
|
17
17
|
end
|
18
18
|
|
19
19
|
def default_version(api_version = nil)
|
20
|
-
res = if api_version && (@versions&.include?(api_version)
|
20
|
+
res = if api_version && (@versions&.include?(api_version))
|
21
21
|
api_version
|
22
|
-
elsif @microversion
|
23
|
-
@microversion
|
24
22
|
else
|
25
23
|
self.versions.sort[-1]
|
26
24
|
end
|
data/lib/misty/services.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'yaml'
|
1
2
|
require 'misty/service'
|
2
3
|
|
3
4
|
module Misty
|
@@ -15,29 +16,29 @@ module Misty
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def each
|
18
|
-
@services.each do |
|
19
|
-
yield
|
19
|
+
@services.each do |s|
|
20
|
+
yield s
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
24
|
def get(name)
|
24
|
-
|
25
|
-
return
|
25
|
+
each do |s|
|
26
|
+
return s if s.name == name
|
26
27
|
end
|
27
28
|
nil
|
28
29
|
end
|
29
30
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
def types
|
32
|
+
list = []
|
33
|
+
each do |s|
|
34
|
+
list << s.type
|
34
35
|
end
|
35
|
-
|
36
|
+
list
|
36
37
|
end
|
37
38
|
|
38
39
|
def to_s
|
39
40
|
list = ''
|
40
|
-
|
41
|
+
each do |service|
|
41
42
|
list << service.to_s + "\n"
|
42
43
|
end
|
43
44
|
list
|
data/lib/misty/version.rb
CHANGED
@@ -19,7 +19,7 @@ describe 'Compute Service Nova v2.1 features' do
|
|
19
19
|
|
20
20
|
# POST with body data
|
21
21
|
server = { 'name': 'test_create_server', 'flavorRef': '1', 'imageRef': '07bd625e-d3ae-415c-bc82-46d66168378a', 'networks': [{'uuid': '204e3939-34d2-40af-b52d-f58cfec1e2b1'}]}
|
22
|
-
data = Misty.to_json('server' => server)
|
22
|
+
data = Misty::Helper.to_json('server' => server)
|
23
23
|
response = cloud.compute.create_server(data)
|
24
24
|
response.code.must_equal '202'
|
25
25
|
id = response.body['server']['id']
|
@@ -36,7 +36,7 @@ describe 'Compute Service Nova v2.1 features' do
|
|
36
36
|
|
37
37
|
# PUT with URI value and body data
|
38
38
|
update_server = { 'name': 'test_updated_server' }
|
39
|
-
data = Misty.to_json('server' => update_server)
|
39
|
+
data = Misty::Helper.to_json('server' => update_server)
|
40
40
|
response = cloud.compute.update_server(id, data)
|
41
41
|
response.code.must_equal '200'
|
42
42
|
response.body['server']['name'].must_equal 'test_updated_server'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
describe '
|
3
|
+
describe 'network Service Neutron v2.0 features' do
|
4
4
|
let(:auth) do
|
5
5
|
{
|
6
6
|
:url => 'http://192.0.2.6:5000',
|
@@ -13,34 +13,34 @@ describe 'Networking Service Neutron v2.0 features' do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'GET/POST/PUT/DELETE requests' do
|
16
|
-
VCR.use_cassette '
|
17
|
-
cloud = Misty::Cloud.new(:auth => auth, :
|
16
|
+
VCR.use_cassette 'network using neutron v2.0' do
|
17
|
+
cloud = Misty::Cloud.new(:auth => auth, :network => {:api_version => 'v2.0'})
|
18
18
|
|
19
19
|
# POST with body data
|
20
|
-
data = Misty.to_json('network' => { 'name': 'test_network' })
|
21
|
-
response = cloud.
|
20
|
+
data = Misty::Helper.to_json('network' => { 'name': 'test_network' })
|
21
|
+
response = cloud.network.create_network(data)
|
22
22
|
response.code.must_equal '201'
|
23
23
|
id = response.body['network']['id']
|
24
24
|
id.wont_be_empty
|
25
25
|
|
26
26
|
# GET
|
27
|
-
response = cloud.
|
27
|
+
response = cloud.network.list_networks
|
28
28
|
response.code.must_equal '200'
|
29
29
|
response.body['networks'].size.must_equal 2
|
30
30
|
|
31
31
|
# GET with URI value
|
32
|
-
response = cloud.
|
32
|
+
response = cloud.network.show_network_details(id)
|
33
33
|
response.code.must_equal '200'
|
34
34
|
response.body['network']['name'].must_equal 'test_network'
|
35
35
|
|
36
36
|
# PUT with URI value and body data
|
37
|
-
data = Misty.to_json('network' => { 'name': 'test_updated_network' })
|
38
|
-
response = cloud.
|
37
|
+
data = Misty::Helper.to_json('network' => { 'name': 'test_updated_network' })
|
38
|
+
response = cloud.network.update_network(id, data)
|
39
39
|
response.code.must_equal '200'
|
40
40
|
response.body['network']['name'].must_equal 'test_updated_network'
|
41
41
|
|
42
42
|
# DELETE with URI value
|
43
|
-
response = cloud.
|
43
|
+
response = cloud.network.delete_network(id)
|
44
44
|
response.code.must_equal '204'
|
45
45
|
end
|
46
46
|
end
|
@@ -64,13 +64,13 @@ describe 'Orchestration Service using Heat v1' do
|
|
64
64
|
cloud = Misty::Cloud.new(:auth => auth, :orchestration => {:api_version => 'v1'})
|
65
65
|
|
66
66
|
# POST with body data
|
67
|
-
data_heat_template1 = Misty.to_json(heat_template1)
|
67
|
+
data_heat_template1 = Misty::Helper.to_json(heat_template1)
|
68
68
|
response = cloud.orchestration.create_stack(data_heat_template1)
|
69
69
|
response.code.must_equal '201'
|
70
70
|
id1 = response.body['stack']['id']
|
71
71
|
id1.wont_be_empty
|
72
72
|
|
73
|
-
data_heat_template2 = Misty.to_json(heat_template2)
|
73
|
+
data_heat_template2 = Misty::Helper.to_json(heat_template2)
|
74
74
|
response = cloud.orchestration.create_stack(data_heat_template2)
|
75
75
|
response.code.must_equal '201'
|
76
76
|
id2 = response.body['stack']['id']
|
@@ -90,12 +90,12 @@ describe 'Orchestration Service using Heat v1' do
|
|
90
90
|
# Updating the network template because it's faster to execute
|
91
91
|
# therefore more likely to be in ready state before updating
|
92
92
|
heat_template1[:template][:description] = 'Updated test template'
|
93
|
-
data_heat_template1 = Misty.to_json(heat_template1)
|
93
|
+
data_heat_template1 = Misty::Helper.to_json(heat_template1)
|
94
94
|
response = cloud.orchestration.update_stack('test_stack1', id1, data_heat_template1)
|
95
95
|
response.code.must_equal '202'
|
96
96
|
|
97
97
|
# PATCH with URI values
|
98
|
-
data = Misty.to_json('disable_rollback': false)
|
98
|
+
data = Misty::Helper.to_json('disable_rollback': false)
|
99
99
|
response = cloud.orchestration.update_stack_patch('test_stack1', id1, data)
|
100
100
|
response.code.must_equal '202'
|
101
101
|
|
data/test/integration/vcr/{networking_using_neutron_v2_0.yml → network_using_neutron_v2_0.yml}
RENAMED
File without changes
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe Misty::Auth::Catalog::V3 do
|
4
|
+
let(:payload) do
|
5
|
+
[{'endpoints' => [
|
6
|
+
{'region_id' => 'regionOne',
|
7
|
+
'url' => 'http://localhost:8080/v1',
|
8
|
+
'region' => 'regionOne',
|
9
|
+
'interface' => 'internal',
|
10
|
+
'id' => 'id_endpoint1_internal'},
|
11
|
+
{'region_id' => 'regionOne',
|
12
|
+
'url' => 'http://localhost:8081/v1',
|
13
|
+
'region' => 'regionOne',
|
14
|
+
'interface' => 'public',
|
15
|
+
'id' => 'id_endpoint1_public' },
|
16
|
+
{'region_id' => 'regionOne',
|
17
|
+
'url' => 'http://localhost:8082/v1',
|
18
|
+
'region' => 'regionOne',
|
19
|
+
'interface' => 'admin',
|
20
|
+
'id' => 'id_endpoint1_admin' }],
|
21
|
+
'type' => 'v3_service1',
|
22
|
+
'id' => 'id_endpoint1',
|
23
|
+
'name' => 'alias1' }]
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#new' do
|
27
|
+
it 'successful' do
|
28
|
+
catalog = Misty::Auth::Catalog::V3.new(payload)
|
29
|
+
catalog.get_endpoint_url('v3_service1', 'regionOne', 'admin').must_equal 'http://localhost:8082/v1'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'fails' do
|
34
|
+
it 'with unmatched service type' do
|
35
|
+
catalog = Misty::Auth::Catalog::V3.new(payload)
|
36
|
+
proc do
|
37
|
+
catalog.get_endpoint_url('service', 'regionOther', 'nadmin')
|
38
|
+
end.must_raise Misty::Auth::Catalog::ServiceTypeError
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'with unmatched region' do
|
42
|
+
catalog = Misty::Auth::Catalog::V3.new(payload)
|
43
|
+
proc do
|
44
|
+
catalog.get_endpoint_url('v3_service1', 'regionOther', 'admin')
|
45
|
+
end.must_raise Misty::Auth::Catalog::EndpointError
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'with unmatched interface' do
|
49
|
+
catalog = Misty::Auth::Catalog::V3.new(payload)
|
50
|
+
proc do
|
51
|
+
catalog.get_endpoint_url('v3_service1', 'regionOne', 'private')
|
52
|
+
end.must_raise Misty::Auth::Catalog::EndpointError
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe Misty::Auth::Catalog::V2 do
|
58
|
+
let(:payload) do
|
59
|
+
[{ 'endpoints' =>
|
60
|
+
[{ 'adminURL' => 'http://localhost',
|
61
|
+
'region' => 'regionTwo',
|
62
|
+
'internalURL' => 'http://localhost:8888/v2.0',
|
63
|
+
'id' => 'id_endpoints',
|
64
|
+
'publicURL' => 'http://localhost' }],
|
65
|
+
'endpoints_links' => [],
|
66
|
+
'type' => 'v2_service1',
|
67
|
+
'name' => 'aliasv2' }]
|
68
|
+
end
|
69
|
+
|
70
|
+
describe '#new' do
|
71
|
+
it 'success' do
|
72
|
+
catalog = Misty::Auth::Catalog::V2.new(payload)
|
73
|
+
catalog.get_endpoint_url('v2_service1', 'regionTwo', 'internal').must_equal 'http://localhost:8888/v2.0'
|
74
|
+
end
|
75
|
+
|
76
|
+
describe 'fails' do
|
77
|
+
it 'with unmatched arguments' do
|
78
|
+
catalog = Misty::Auth::Catalog::V2.new(payload)
|
79
|
+
proc do
|
80
|
+
catalog.get_endpoint_url('test', 'regionOther', 'nadmin')
|
81
|
+
end.must_raise Misty::Auth::Catalog::ServiceTypeError
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'with unmatched region' do
|
85
|
+
catalog = Misty::Auth::Catalog::V2.new(payload)
|
86
|
+
proc do
|
87
|
+
catalog.get_endpoint_url('v2_service1','regionOther', 'admin')
|
88
|
+
end.must_raise Misty::Auth::Catalog::EndpointError
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'with unmatched interface' do
|
92
|
+
catalog = Misty::Auth::Catalog::V2.new(payload)
|
93
|
+
proc do
|
94
|
+
catalog.get_endpoint_url('v2_service1','regionTwo', 'private')
|
95
|
+
end.must_raise Misty::Auth::Catalog::EndpointError
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|