fog-openstack 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/Rakefile +25 -15
- data/{lib/fog/openstack/docs → docs}/compute.md +0 -0
- data/{lib/fog/openstack/docs → docs}/getting_started.md +0 -0
- data/{lib/fog/openstack/docs → docs}/introspection.md +0 -0
- data/{lib/fog/openstack/docs → docs}/metering.md +0 -0
- data/{lib/fog/openstack/docs → docs}/network.md +0 -0
- data/{lib/fog/openstack/docs → docs}/nfv.md +0 -0
- data/{lib/fog/openstack/docs → docs}/orchestration.md +0 -0
- data/{lib/fog/openstack/docs → docs}/planning.md +0 -0
- data/{lib/fog/openstack/docs → docs}/storage.md +0 -0
- data/{lib/fog/openstack/examples → examples}/compute/basics.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/compute/block_device_mapping_v2.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/identity/basics.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/image/upload-test-image.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/introspection/basics.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/network/network_add_port.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/network/network_rbac.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/network/network_subnets_routers.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/planning/basics.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/storage/set-account-quota.rb +0 -0
- data/fog-openstack.gemspec +1 -1
- data/lib/fog/openstack.rb +6 -0
- data/lib/fog/openstack/models/compute/aggregate.rb +3 -2
- data/lib/fog/openstack/models/monitoring/alarm.rb +48 -0
- data/lib/fog/openstack/models/monitoring/alarm_count.rb +17 -0
- data/lib/fog/openstack/models/monitoring/alarm_counts.rb +16 -0
- data/lib/fog/openstack/models/monitoring/alarm_definition.rb +56 -0
- data/lib/fog/openstack/models/monitoring/alarm_definitions.rb +42 -0
- data/lib/fog/openstack/models/monitoring/alarm_state.rb +32 -0
- data/lib/fog/openstack/models/monitoring/alarm_states.rb +20 -0
- data/lib/fog/openstack/models/monitoring/alarms.rb +30 -0
- data/lib/fog/openstack/models/monitoring/measurement.rb +20 -0
- data/lib/fog/openstack/models/monitoring/measurements.rb +16 -0
- data/lib/fog/openstack/models/monitoring/metric.rb +27 -0
- data/lib/fog/openstack/models/monitoring/metrics.rb +28 -0
- data/lib/fog/openstack/models/monitoring/notification_method.rb +40 -0
- data/lib/fog/openstack/models/monitoring/notification_methods.rb +38 -0
- data/lib/fog/openstack/models/monitoring/statistic.rb +20 -0
- data/lib/fog/openstack/models/monitoring/statistics.rb +16 -0
- data/lib/fog/openstack/monitoring.rb +116 -0
- data/lib/fog/openstack/requests/compute/attach_volume.rb +1 -0
- data/lib/fog/openstack/requests/compute/create_aggregate.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +2 -2
- data/lib/fog/openstack/requests/compute/detach_volume.rb +1 -0
- data/lib/fog/openstack/requests/compute/update_aggregate.rb +1 -1
- data/lib/fog/openstack/requests/monitoring/create_alarm_definition.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/create_metric.rb +29 -0
- data/lib/fog/openstack/requests/monitoring/create_metric_array.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/create_notification_method.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/delete_alarm.rb +18 -0
- data/lib/fog/openstack/requests/monitoring/delete_alarm_definition.rb +18 -0
- data/lib/fog/openstack/requests/monitoring/delete_notification_method.rb +18 -0
- data/lib/fog/openstack/requests/monitoring/find_measurements.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/get_alarm.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/get_alarm_counts.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/get_alarm_definition.rb +18 -0
- data/lib/fog/openstack/requests/monitoring/get_notification_method.rb +18 -0
- data/lib/fog/openstack/requests/monitoring/list_alarm_definitions.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_alarm_state_history_for_all_alarms.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_alarm_state_history_for_specific_alarm.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_alarms.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_metric_names.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_metrics.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_notification_methods.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_statistics.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/patch_alarm.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/patch_alarm_definition.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/update_alarm.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/update_alarm_definition.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/update_notification_method.rb +19 -0
- data/lib/fog/openstack/version.rb +1 -1
- metadata +65 -42
- data/tests/openstack/models/identity/ec2_credential_tests.rb +0 -41
- data/tests/openstack/models/identity/ec2_credentials_tests.rb +0 -58
- data/tests/openstack/models/identity/role_tests.rb +0 -31
- data/tests/openstack/models/identity/roles_tests.rb +0 -21
- data/tests/openstack/models/identity/tenant_tests.rb +0 -33
- data/tests/openstack/models/identity/tenants_tests.rb +0 -31
- data/tests/openstack/models/identity/user_tests.rb +0 -47
- data/tests/openstack/models/identity/users_tests.rb +0 -46
- data/tests/openstack/requests/baremetal/chassis_tests.rb +0 -48
- data/tests/openstack/requests/baremetal/driver_tests.rb +0 -40
- data/tests/openstack/requests/baremetal/node_tests.rb +0 -83
- data/tests/openstack/requests/baremetal/port_tests.rb +0 -56
- data/tests/openstack/requests/identity/ec2_credentials_tests.rb +0 -41
- data/tests/openstack/requests/identity/helper.rb +0 -21
- data/tests/openstack/requests/identity/role_tests.rb +0 -48
- data/tests/openstack/requests/identity/tenant_tests.rb +0 -57
- data/tests/openstack/requests/identity/user_tests.rb +0 -46
- data/tests/openstack/requests/introspection/introspection_tests.rb +0 -297
- data/tests/openstack/requests/introspection/rules_tests.rb +0 -46
@@ -1,47 +0,0 @@
|
|
1
|
-
Shindo.tests("Fog::Identity[:openstack] | user", ['openstack']) do
|
2
|
-
openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
|
3
|
-
tenant_id = openstack.list_tenants.body['tenants'].first['id']
|
4
|
-
@instance = openstack.users.new(
|
5
|
-
:name => 'User Name',
|
6
|
-
:email => 'test@fog.com',
|
7
|
-
:tenant_id => tenant_id,
|
8
|
-
:password => 'spoof',
|
9
|
-
:enabled => true
|
10
|
-
)
|
11
|
-
|
12
|
-
tests('success') do
|
13
|
-
tests('#save').returns(true) do
|
14
|
-
@instance.save
|
15
|
-
end
|
16
|
-
|
17
|
-
tests('#roles').succeeds do
|
18
|
-
@instance.roles
|
19
|
-
end
|
20
|
-
|
21
|
-
tests('#update').returns(true) do
|
22
|
-
@instance.update({:name => 'updatename', :email => 'new@email.com'})
|
23
|
-
end
|
24
|
-
|
25
|
-
tests('#update_password').returns(true) do
|
26
|
-
@instance.update_password('swordfish')
|
27
|
-
end
|
28
|
-
|
29
|
-
tests('#update_tenant').returns(true) do
|
30
|
-
@instance.update_tenant(tenant_id)
|
31
|
-
end
|
32
|
-
|
33
|
-
tests('#update_enabled').returns(true) do
|
34
|
-
@instance.update_enabled(true)
|
35
|
-
end
|
36
|
-
|
37
|
-
tests('#destroy').returns(true) do
|
38
|
-
@instance.destroy
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
tests('failure') do
|
43
|
-
tests('#save').raises(Fog::Errors::Error) do
|
44
|
-
@instance.save
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
Shindo.tests("Fog::Identity[:openstack] | users", ['openstack']) do
|
2
|
-
openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
|
3
|
-
tenant_id = openstack.list_tenants.body['tenants'].first['id']
|
4
|
-
@instance = openstack.users.create(
|
5
|
-
:name => 'foobar',
|
6
|
-
:email => 'foo@bar.com',
|
7
|
-
:tenant_id => tenant_id,
|
8
|
-
:password => 'spoof',
|
9
|
-
:enabled => true
|
10
|
-
)
|
11
|
-
|
12
|
-
tests('success') do
|
13
|
-
tests('#find_by_id').succeeds do
|
14
|
-
openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
|
15
|
-
user = openstack.users.find_by_id(@instance.id)
|
16
|
-
user.id == @instance.id
|
17
|
-
end
|
18
|
-
|
19
|
-
tests('#find_by_name').succeeds do
|
20
|
-
openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
|
21
|
-
user = openstack.users.find_by_name(@instance.name)
|
22
|
-
user.name == @instance.name
|
23
|
-
end
|
24
|
-
|
25
|
-
tests('#destroy').succeeds do
|
26
|
-
openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
|
27
|
-
openstack.users.destroy(@instance.id)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
tests('fails') do
|
32
|
-
pending if Fog.mocking?
|
33
|
-
|
34
|
-
tests('#find_by_id').raises(Fog::Identity::OpenStack::NotFound) do
|
35
|
-
Fog::Identity[:openstack].users.find_by_id('fake')
|
36
|
-
end
|
37
|
-
|
38
|
-
tests('#find_by_name').raises(Fog::Identity::OpenStack::NotFound) do
|
39
|
-
Fog::Identity[:openstack].users.find_by_name('fake')
|
40
|
-
end
|
41
|
-
|
42
|
-
tests('#destroy').raises(Fog::Identity::OpenStack::NotFound) do
|
43
|
-
Fog::Identity[:openstack].users.destroy('fake')
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Baremetal[:openstack] | Baremetal chassis requests', ['openstack']) do
|
2
|
-
openstack = Fog::Identity[:openstack]
|
3
|
-
|
4
|
-
@chassis_format = {
|
5
|
-
'description' => String,
|
6
|
-
'uuid' => String,
|
7
|
-
'links' => Array
|
8
|
-
}
|
9
|
-
|
10
|
-
@detailed_chassis_format = {
|
11
|
-
'description' => String,
|
12
|
-
'uuid' => String,
|
13
|
-
'created_at' => String,
|
14
|
-
'updated_at' => Fog::Nullable::String,
|
15
|
-
'extra' => Hash,
|
16
|
-
'nodes' => Array,
|
17
|
-
'links' => Array
|
18
|
-
}
|
19
|
-
|
20
|
-
tests('success') do
|
21
|
-
tests('#list_chassis').data_matches_schema({'chassis' => [@chassis_format]}) do
|
22
|
-
Fog::Baremetal[:openstack].list_chassis.body
|
23
|
-
end
|
24
|
-
|
25
|
-
tests('#list_chassis_detailed').data_matches_schema({'chassis' => [@detailed_chassis_format]}) do
|
26
|
-
Fog::Baremetal[:openstack].list_chassis_detailed.body
|
27
|
-
end
|
28
|
-
|
29
|
-
tests('#create_chassis').data_matches_schema(@detailed_chassis_format) do
|
30
|
-
chassis_attributes = {:description => 'description'}
|
31
|
-
@instance = Fog::Baremetal[:openstack].create_chassis(chassis_attributes).body
|
32
|
-
end
|
33
|
-
|
34
|
-
tests('#get_chassis').data_matches_schema(@detailed_chassis_format) do
|
35
|
-
Fog::Baremetal[:openstack].get_chassis(@instance['uuid']).body
|
36
|
-
end
|
37
|
-
|
38
|
-
tests('#patch_chassis').data_matches_schema(@detailed_chassis_format) do
|
39
|
-
Fog::Baremetal[:openstack].patch_chassis(
|
40
|
-
@instance['uuid'],
|
41
|
-
[{'op' => 'replace', 'path' => '/description', 'value' => 'new description'}]).body
|
42
|
-
end
|
43
|
-
|
44
|
-
tests('#delete_chassis').succeeds do
|
45
|
-
Fog::Baremetal[:openstack].delete_chassis(@instance['uuid'])
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Baremetal[:openstack] | Baremetal driver requests', ['openstack']) do
|
2
|
-
openstack = Fog::Identity[:openstack]
|
3
|
-
|
4
|
-
@driver_format = {
|
5
|
-
'hosts' => Array,
|
6
|
-
'name' => String
|
7
|
-
}
|
8
|
-
|
9
|
-
@driver_properties_format = {
|
10
|
-
"pxe_deploy_ramdisk" => String,
|
11
|
-
"ipmi_transit_address" => String,
|
12
|
-
"ipmi_terminal_port" => String,
|
13
|
-
"ipmi_target_channel" => String,
|
14
|
-
"ipmi_transit_channel" => String,
|
15
|
-
"ipmi_local_address" => String,
|
16
|
-
"ipmi_username" => String,
|
17
|
-
"ipmi_address" => String,
|
18
|
-
"ipmi_target_address" => String,
|
19
|
-
"ipmi_password" => String,
|
20
|
-
"pxe_deploy_kernel" => String,
|
21
|
-
"ipmi_priv_level" => String,
|
22
|
-
"ipmi_bridging" => String
|
23
|
-
}
|
24
|
-
|
25
|
-
tests('success') do
|
26
|
-
tests('#list_drivers').data_matches_schema({'drivers' => [@driver_format]}) do
|
27
|
-
instances = Fog::Baremetal[:openstack].list_drivers.body
|
28
|
-
@instance = instances['drivers'].last
|
29
|
-
instances
|
30
|
-
end
|
31
|
-
|
32
|
-
tests('#get_driver').data_matches_schema(@driver_format) do
|
33
|
-
Fog::Baremetal[:openstack].get_driver(@instance['name']).body
|
34
|
-
end
|
35
|
-
|
36
|
-
tests('#get_driver_properties').data_matches_schema(@driver_properties_format) do
|
37
|
-
Fog::Baremetal[:openstack].get_driver_properties(@instance['name']).body
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Baremetal[:openstack] | Baremetal node requests', ['openstack']) do
|
2
|
-
openstack = Fog::Identity[:openstack]
|
3
|
-
|
4
|
-
@node_format = {
|
5
|
-
'instance_uuid' => Fog::Nullable::String,
|
6
|
-
'maintenance' => Fog::Boolean,
|
7
|
-
'power_state' => Fog::Nullable::String,
|
8
|
-
'provision_state' => Fog::Nullable::String,
|
9
|
-
'uuid' => String,
|
10
|
-
'links' => Array
|
11
|
-
}
|
12
|
-
|
13
|
-
@detailed_node_format = {
|
14
|
-
'instance_uuid' => Fog::Nullable::String,
|
15
|
-
'maintenance' => Fog::Boolean,
|
16
|
-
'power_state' => Fog::Nullable::String,
|
17
|
-
'provision_state' => Fog::Nullable::String,
|
18
|
-
'uuid' => String,
|
19
|
-
'created_at' => String,
|
20
|
-
'updated_at' => Fog::Nullable::String,
|
21
|
-
'chassis_uuid' => Fog::Nullable::String,
|
22
|
-
'console_enabled' => Fog::Boolean,
|
23
|
-
'driver' => String,
|
24
|
-
'driver_info' => Hash,
|
25
|
-
'extra' => Hash,
|
26
|
-
'instance_info' => Hash,
|
27
|
-
'last_error' => Fog::Nullable::String,
|
28
|
-
'maintenance_reason' => Fog::Nullable::String,
|
29
|
-
'properties' => Hash,
|
30
|
-
'provision_updated_at' => Fog::Nullable::String,
|
31
|
-
'reservation' => Fog::Nullable::String,
|
32
|
-
'target_power_state' => Fog::Nullable::String,
|
33
|
-
'target_provision_state' => Fog::Nullable::String,
|
34
|
-
'links' => Array
|
35
|
-
}
|
36
|
-
|
37
|
-
tests('success') do
|
38
|
-
tests('#list_nodes').data_matches_schema({'nodes' => [@node_format]}) do
|
39
|
-
Fog::Baremetal[:openstack].list_nodes.body
|
40
|
-
end
|
41
|
-
|
42
|
-
tests('#list_nodes_detailed').data_matches_schema({'nodes' => [@detailed_node_format]}) do
|
43
|
-
Fog::Baremetal[:openstack].list_nodes_detailed.body
|
44
|
-
end
|
45
|
-
|
46
|
-
tests('#create_node').data_matches_schema(@detailed_node_format) do
|
47
|
-
node_attributes = {:driver => 'pxe_ipmitool'}
|
48
|
-
@instance = Fog::Baremetal[:openstack].create_node(node_attributes).body
|
49
|
-
end
|
50
|
-
|
51
|
-
tests('#get_node').data_matches_schema(@detailed_node_format) do
|
52
|
-
Fog::Baremetal[:openstack].get_node(@instance['uuid']).body
|
53
|
-
end
|
54
|
-
|
55
|
-
tests('#patch_node').data_matches_schema(@detailed_node_format) do
|
56
|
-
Fog::Baremetal[:openstack].patch_node(
|
57
|
-
@instance['uuid'],
|
58
|
-
[{'op' => 'replace', 'path' => '/driver', 'value' => 'pxe_ssh'}]).body
|
59
|
-
end
|
60
|
-
|
61
|
-
tests('#set_node_power_state').data_matches_schema(@detailed_node_format) do
|
62
|
-
Fog::Baremetal[:openstack].set_node_power_state(
|
63
|
-
@instance['uuid'], 'power off').body
|
64
|
-
end
|
65
|
-
|
66
|
-
tests('#set_node_provision_state').data_matches_schema(@detailed_node_format) do
|
67
|
-
Fog::Baremetal[:openstack].set_node_provision_state(
|
68
|
-
@instance['uuid'], 'manage').body
|
69
|
-
end
|
70
|
-
|
71
|
-
tests('#set_node_maintenance').succeeds do
|
72
|
-
Fog::Baremetal[:openstack].set_node_maintenance(@instance['uuid'])
|
73
|
-
end
|
74
|
-
|
75
|
-
tests('#unset_node_maintenance').succeeds do
|
76
|
-
Fog::Baremetal[:openstack].unset_node_maintenance(@instance['uuid'])
|
77
|
-
end
|
78
|
-
|
79
|
-
tests('#delete_node').succeeds do
|
80
|
-
Fog::Baremetal[:openstack].delete_node(@instance['uuid'])
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Baremetal[:openstack] | Baremetal port requests', ['openstack']) do
|
2
|
-
openstack = Fog::Identity[:openstack]
|
3
|
-
|
4
|
-
@port_format = {
|
5
|
-
'address' => String,
|
6
|
-
'uuid' => String
|
7
|
-
}
|
8
|
-
|
9
|
-
# {"node_uuid"=>"ebf4e459-ddd6-4ce9-bef5-5181987cb62c", "uuid"=>"82a26de6-6af5-4cd3-a076-a5af1a75d457", "links"=>[{"href"=>"http://192.0.2.1:6385/v1/ports/82a26de6-6af5-4cd3-a076-a5af1a75d457", "rel"=>"self"}, {"href"=>"http://192.0.2.1:6385/ports/82a26de6-6af5-4cd3-a076-a5af1a75d457", "rel"=>"bookmark"}], "extra"=>{}, "created_at"=>"2015-01-15T09:22:23.673409+00:00", "updated_at"=>nil, "address"=>"00:c2:08:85:de:ca"} does not match {"address"=>String, "uuid"=>String, "created_at"=>String, "updated_at"=>String, "extra"=>Hash, "node_uuid"=>String}
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@detailed_port_format = {
|
14
|
-
'address' => String,
|
15
|
-
'uuid' => String,
|
16
|
-
'created_at' => String,
|
17
|
-
'updated_at' => Fog::Nullable::String,
|
18
|
-
'extra' => Hash,
|
19
|
-
'node_uuid' => String,
|
20
|
-
'links' => Array
|
21
|
-
}
|
22
|
-
|
23
|
-
tests('success') do
|
24
|
-
tests('#list_ports').data_matches_schema({'ports' => [@port_format]}) do
|
25
|
-
Fog::Baremetal[:openstack].list_ports.body
|
26
|
-
end
|
27
|
-
|
28
|
-
tests('#list_ports_detailed').data_matches_schema({'ports' => [@detailed_port_format]}) do
|
29
|
-
Fog::Baremetal[:openstack].list_ports_detailed.body
|
30
|
-
end
|
31
|
-
|
32
|
-
tests('#create_port').data_matches_schema(@detailed_port_format) do
|
33
|
-
node_attributes = {:driver => 'pxe_ipmitool'}
|
34
|
-
@instance = Fog::Baremetal[:openstack].create_node(node_attributes).body
|
35
|
-
|
36
|
-
port_attributes = {:address => '00:c2:08:85:de:ca',
|
37
|
-
:node_uuid => @instance['uuid']}
|
38
|
-
@port = Fog::Baremetal[:openstack].create_port(port_attributes).body
|
39
|
-
end
|
40
|
-
|
41
|
-
tests('#get_port').data_matches_schema(@detailed_port_format) do
|
42
|
-
Fog::Baremetal[:openstack].get_port(@port['uuid']).body
|
43
|
-
end
|
44
|
-
|
45
|
-
tests('#patch_port').data_matches_schema(@detailed_port_format) do
|
46
|
-
Fog::Baremetal[:openstack].patch_port(
|
47
|
-
@port['uuid'],
|
48
|
-
[{'op' => 'add', 'path' => '/extra/name', 'value' => 'eth1'}]).body
|
49
|
-
end
|
50
|
-
|
51
|
-
tests('#delete_port').succeeds do
|
52
|
-
Fog::Baremetal[:openstack].delete_port(@port['uuid'])
|
53
|
-
Fog::Baremetal[:openstack].delete_node(@instance['uuid'])
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Identity[:openstack] | EC2 credential requests', ['openstack']) do
|
2
|
-
|
3
|
-
@credential_format = {
|
4
|
-
'access' => String,
|
5
|
-
'tenant_id' => String,
|
6
|
-
'secret' => String,
|
7
|
-
'user_id' => String,
|
8
|
-
}
|
9
|
-
|
10
|
-
@identity = Fog::Identity::OpenStack.new(:openstack_auth_url => "http://openstack:35357/v2.0/tokens")
|
11
|
-
|
12
|
-
@user_id = OpenStack::Identity.get_user_id
|
13
|
-
@tenant_id = OpenStack::Identity.get_tenant_id
|
14
|
-
|
15
|
-
tests('success') do
|
16
|
-
tests('#create_ec2_credential').
|
17
|
-
formats({'credential' => @credential_format}) do
|
18
|
-
response = @identity.create_ec2_credential(@user_id, @tenant_id)
|
19
|
-
|
20
|
-
@ec2_credential = response.body['credential']
|
21
|
-
|
22
|
-
response.body
|
23
|
-
end
|
24
|
-
|
25
|
-
tests('#get_ec2_credential').
|
26
|
-
formats({'credential' => @credential_format}) do
|
27
|
-
@identity.get_ec2_credential(@user_id, @ec2_credential['access']).body
|
28
|
-
end
|
29
|
-
|
30
|
-
tests('#list_ec2_credentials').
|
31
|
-
formats({'credentials' => [@credential_format]}) do
|
32
|
-
@identity.list_ec2_credentials(@user_id).body
|
33
|
-
end
|
34
|
-
|
35
|
-
tests('#delete_ec2_credential').succeeds do
|
36
|
-
@identity.delete_ec2_credential(@user_id, @ec2_credential['access'])
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class OpenStack
|
2
|
-
module Identity
|
3
|
-
def self.get_tenant_id_old
|
4
|
-
identity = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
|
5
|
-
ENV['OPENSTACK_TENANT_NAME'] || identity.list_tenants.body['tenants'].first['id']
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.get_user_id_old
|
9
|
-
identity = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
|
10
|
-
ENV['OPENSTACK_USER_ID'] || identity.list_users.body['users'].first['id']
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.get_tenant_id
|
14
|
-
'tenant_id'
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.get_user_id
|
18
|
-
'user_id'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Identity[:openstack] | role requests', ['openstack']) do
|
2
|
-
@role_format = {
|
3
|
-
'id' => String,
|
4
|
-
'name' => String
|
5
|
-
}
|
6
|
-
|
7
|
-
@identity = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
|
8
|
-
|
9
|
-
@user = @identity.list_users.body['users'].first
|
10
|
-
@tenant = @identity.list_tenants.body['tenants'].first
|
11
|
-
tests('success') do
|
12
|
-
|
13
|
-
tests('#create_role("Role Name")').formats(@role_format, false) do
|
14
|
-
@role = @identity.create_role("Role Name").body['role']
|
15
|
-
end
|
16
|
-
|
17
|
-
tests('#list_roles').formats({'roles' => [@role_format]}) do
|
18
|
-
@identity.list_roles.body
|
19
|
-
end
|
20
|
-
|
21
|
-
tests("#get_role('#{@role['id']}')").formats(@role_format) do
|
22
|
-
@identity.get_role(@role['id']).body['role']
|
23
|
-
end
|
24
|
-
|
25
|
-
tests('#create_user_role(@tenant["id"], @user["id"], @role["id"])').formats(@role_format) do
|
26
|
-
@identity.create_user_role(@tenant['id'], @user['id'], @role['id']).body['role']
|
27
|
-
end
|
28
|
-
|
29
|
-
tests("#list_roles_for_user_on_tenant('#{@tenant['id']}','#{@user['id']}')").formats([@role_format]) do
|
30
|
-
@identity.list_roles_for_user_on_tenant(@tenant['id'], @user['id']).body['roles']
|
31
|
-
end
|
32
|
-
|
33
|
-
tests("#delete_user_role with tenant").returns("") do
|
34
|
-
@identity.delete_user_role(@tenant['id'], @user['id'], @role['id']).body
|
35
|
-
end
|
36
|
-
|
37
|
-
tests("#delete_user_role with tenant").formats(@role_format) do
|
38
|
-
# FIXME - Response (under mocks) is empty String which does not match schema
|
39
|
-
pending
|
40
|
-
@identity.delete_user_role(@tenant['id'], @user['id'], @role['id']).body
|
41
|
-
end
|
42
|
-
|
43
|
-
tests("#delete_role('#{@role['id']}')").succeeds do
|
44
|
-
@identity.delete_role(@role['id']).body
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Identity[:openstack] | tenant requests', ['openstack']) do
|
2
|
-
|
3
|
-
@tenant_format = {
|
4
|
-
'id' => String,
|
5
|
-
'name' => String,
|
6
|
-
'enabled' => Fog::Nullable::Boolean,
|
7
|
-
'description' => Fog::Nullable::String
|
8
|
-
}
|
9
|
-
|
10
|
-
@role_format = {
|
11
|
-
'id' => String,
|
12
|
-
'name' => String
|
13
|
-
}
|
14
|
-
|
15
|
-
@tenant_name = Fog::Mock.random_hex(64)
|
16
|
-
@tenant_name_update = Fog::Mock.random_hex(64)
|
17
|
-
@tenant_name_update2 = Fog::Mock.random_hex(64)
|
18
|
-
|
19
|
-
@identity = Fog::Identity[:openstack]
|
20
|
-
|
21
|
-
tests('success') do
|
22
|
-
tests('#list_tenants').formats({'tenants' => [@tenant_format], 'tenants_links' => []}) do
|
23
|
-
@identity.list_tenants.body
|
24
|
-
end
|
25
|
-
|
26
|
-
tests('#list_roles_for_user_on_tenant(0,1)').
|
27
|
-
formats({'roles' => [@role_format]}) do
|
28
|
-
|
29
|
-
@identity.list_roles_for_user_on_tenant(
|
30
|
-
@identity.current_tenant['id'], OpenStack::Identity.get_user_id).body
|
31
|
-
end
|
32
|
-
|
33
|
-
tests('#create_tenant').formats({'tenant' => @tenant_format}) do
|
34
|
-
@tenant = @identity.create_tenant('name' => @tenant_name).body
|
35
|
-
end
|
36
|
-
|
37
|
-
tests('#get_tenant').formats({'tenant' => @tenant_format}) do
|
38
|
-
@identity.get_tenant(@tenant['tenant']['id']).body
|
39
|
-
end
|
40
|
-
|
41
|
-
tests('#update_tenant check format').formats({'tenant' => @tenant_format}) do
|
42
|
-
@tenant = @identity.update_tenant(
|
43
|
-
@tenant['tenant']['id'], 'name' => @tenant_name_update).body
|
44
|
-
end
|
45
|
-
|
46
|
-
tests('#update_tenant update name').succeeds do
|
47
|
-
@tenant = @identity.update_tenant(
|
48
|
-
@tenant['tenant']['id'], 'name' => @tenant_name_update2).body
|
49
|
-
@tenant['tenant']['name'] == @tenant_name_update2
|
50
|
-
end
|
51
|
-
|
52
|
-
tests('#delete_tenant').succeeds do
|
53
|
-
@identity.delete_tenant(@tenant['tenant']['id'])
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
end
|