fog-openstack 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/.travis.yml +6 -2
  4. data/README.md +4 -0
  5. data/Rakefile +10 -2
  6. data/fog-openstack.gemspec +2 -3
  7. data/gemfiles/Gemfile-1.9 +1 -1
  8. data/lib/fog/openstack.rb +14 -6
  9. data/lib/fog/openstack/baremetal.rb +1 -1
  10. data/lib/fog/openstack/common.rb +0 -2
  11. data/lib/fog/openstack/compute.rb +78 -75
  12. data/lib/fog/openstack/core.rb +2 -1
  13. data/lib/fog/openstack/docs/compute.md +1 -1
  14. data/lib/fog/openstack/docs/network.md +283 -0
  15. data/lib/fog/openstack/docs/nfv.md +144 -0
  16. data/lib/fog/openstack/examples/compute/block_device_mapping_v2.rb +4 -4
  17. data/lib/fog/openstack/examples/network/network_add_port.rb +21 -0
  18. data/lib/fog/openstack/examples/network/network_rbac.rb +69 -0
  19. data/lib/fog/openstack/identity.rb +14 -22
  20. data/lib/fog/openstack/identity_v2.rb +1 -1
  21. data/lib/fog/openstack/image_v1.rb +13 -28
  22. data/lib/fog/openstack/image_v2.rb +15 -17
  23. data/lib/fog/openstack/introspection.rb +1 -1
  24. data/lib/fog/openstack/metering.rb +1 -1
  25. data/lib/fog/openstack/models/collection.rb +4 -1
  26. data/lib/fog/openstack/models/compute/availability_zone.rb +5 -0
  27. data/lib/fog/openstack/models/compute/flavor.rb +21 -9
  28. data/lib/fog/openstack/models/compute/server.rb +64 -77
  29. data/lib/fog/openstack/models/compute/snapshot.rb +6 -6
  30. data/lib/fog/openstack/models/compute/volume_attachment.rb +15 -0
  31. data/lib/fog/openstack/models/compute/volume_attachments.rb +20 -0
  32. data/lib/fog/openstack/models/identity_v3/projects.rb +1 -1
  33. data/lib/fog/openstack/models/identity_v3/users.rb +2 -2
  34. data/lib/fog/openstack/models/image_v2/image.rb +41 -22
  35. data/lib/fog/openstack/models/network/floating_ip.rb +1 -0
  36. data/lib/fog/openstack/models/network/rbac_policies.rb +33 -0
  37. data/lib/fog/openstack/models/network/rbac_policy.rb +35 -0
  38. data/lib/fog/openstack/models/nfv/vnf.rb +58 -0
  39. data/lib/fog/openstack/models/nfv/vnfd.rb +53 -0
  40. data/lib/fog/openstack/models/nfv/vnfds.rb +28 -0
  41. data/lib/fog/openstack/models/nfv/vnfs.rb +28 -0
  42. data/lib/fog/openstack/models/volume/snapshot.rb +38 -0
  43. data/lib/fog/openstack/models/volume/snapshots.rb +26 -0
  44. data/lib/fog/openstack/models/volume/volume.rb +32 -2
  45. data/lib/fog/openstack/models/volume/volume_type.rb +3 -4
  46. data/lib/fog/openstack/models/volume_v1/snapshot.rb +43 -0
  47. data/lib/fog/openstack/models/volume_v1/snapshots.rb +16 -0
  48. data/lib/fog/openstack/models/volume_v1/volume.rb +12 -2
  49. data/lib/fog/openstack/models/volume_v2/snapshot.rb +43 -0
  50. data/lib/fog/openstack/models/volume_v2/snapshots.rb +16 -0
  51. data/lib/fog/openstack/models/volume_v2/volume.rb +12 -3
  52. data/lib/fog/openstack/network.rb +53 -46
  53. data/lib/fog/openstack/nfv.rb +158 -0
  54. data/lib/fog/openstack/orchestration.rb +1 -1
  55. data/lib/fog/openstack/planning.rb +1 -1
  56. data/lib/fog/openstack/requests/compute/create_server.rb +1 -1
  57. data/lib/fog/openstack/requests/compute/{create_volume_snapshot.rb → create_snapshot.rb} +16 -16
  58. data/lib/fog/openstack/requests/compute/delete_flavor_metadata.rb +30 -0
  59. data/lib/fog/openstack/requests/compute/evacuate_server.rb +8 -7
  60. data/lib/fog/openstack/requests/compute/get_key_pair.rb +49 -0
  61. data/lib/fog/openstack/requests/compute/list_availability_zones.rb +23 -0
  62. data/lib/fog/openstack/requests/compute/list_volume_attachments.rb +31 -0
  63. data/lib/fog/openstack/requests/compute/update_flavor_metadata.rb +33 -0
  64. data/lib/fog/openstack/requests/network/create_rbac_policy.rb +42 -0
  65. data/lib/fog/openstack/requests/network/delete_rbac_policy.rb +28 -0
  66. data/lib/fog/openstack/requests/network/get_rbac_policy.rb +28 -0
  67. data/lib/fog/openstack/requests/network/list_rbac_policies.rb +25 -0
  68. data/lib/fog/openstack/requests/network/update_port.rb +8 -7
  69. data/lib/fog/openstack/requests/network/update_rbac_policy.rb +41 -0
  70. data/lib/fog/openstack/requests/nfv/create_vnf.rb +37 -0
  71. data/lib/fog/openstack/requests/nfv/create_vnfd.rb +35 -0
  72. data/lib/fog/openstack/requests/nfv/delete_vnf.rb +23 -0
  73. data/lib/fog/openstack/requests/nfv/delete_vnfd.rb +23 -0
  74. data/lib/fog/openstack/requests/nfv/get_vnf.rb +24 -0
  75. data/lib/fog/openstack/requests/nfv/get_vnfd.rb +24 -0
  76. data/lib/fog/openstack/requests/nfv/list_vnfds.rb +25 -0
  77. data/lib/fog/openstack/requests/nfv/list_vnfs.rb +25 -0
  78. data/lib/fog/openstack/requests/nfv/update_vnf.rb +35 -0
  79. data/lib/fog/openstack/requests/volume/action.rb +16 -0
  80. data/lib/fog/openstack/requests/volume/create_snapshot.rb +18 -0
  81. data/lib/fog/openstack/requests/volume/delete_metadata.rb +15 -0
  82. data/lib/fog/openstack/requests/volume/delete_snapshot.rb +5 -5
  83. data/lib/fog/openstack/requests/volume/delete_snapshot_metadata.rb +15 -0
  84. data/lib/fog/openstack/requests/volume/replace_metadata.rb +20 -0
  85. data/lib/fog/openstack/requests/volume/update_metadata.rb +20 -0
  86. data/lib/fog/openstack/requests/volume/update_snapshot.rb +37 -0
  87. data/lib/fog/openstack/requests/volume/update_snapshot_metadata.rb +20 -0
  88. data/lib/fog/openstack/requests/volume/update_volume.rb +25 -0
  89. data/lib/fog/openstack/requests/volume_v1/action.rb +2 -0
  90. data/lib/fog/openstack/requests/volume_v1/create_snapshot.rb +45 -0
  91. data/lib/fog/openstack/requests/volume_v1/delete_metadata.rb +2 -0
  92. data/lib/fog/openstack/requests/volume_v1/delete_snapshot_metadata.rb +2 -0
  93. data/lib/fog/openstack/requests/volume_v1/replace_metadata.rb +2 -0
  94. data/lib/fog/openstack/requests/volume_v1/update_metadata.rb +2 -0
  95. data/lib/fog/openstack/requests/volume_v1/update_snapshot.rb +2 -0
  96. data/lib/fog/openstack/requests/volume_v1/update_snapshot_metadata.rb +2 -0
  97. data/lib/fog/openstack/requests/volume_v1/update_volume.rb +2 -0
  98. data/lib/fog/openstack/requests/volume_v2/action.rb +2 -0
  99. data/lib/fog/openstack/requests/volume_v2/create_snapshot.rb +45 -0
  100. data/lib/fog/openstack/requests/volume_v2/delete_metadata.rb +2 -0
  101. data/lib/fog/openstack/requests/volume_v2/delete_snapshot_metadata.rb +2 -0
  102. data/lib/fog/openstack/requests/volume_v2/replace_metadata.rb +2 -0
  103. data/lib/fog/openstack/requests/volume_v2/update_metadata.rb +2 -0
  104. data/lib/fog/openstack/requests/volume_v2/update_snapshot.rb +2 -0
  105. data/lib/fog/openstack/requests/volume_v2/update_snapshot_metadata.rb +2 -0
  106. data/lib/fog/openstack/requests/volume_v2/update_volume.rb +2 -0
  107. data/lib/fog/openstack/storage.rb +1 -1
  108. data/lib/fog/openstack/version.rb +1 -1
  109. data/lib/fog/openstack/volume.rb +1 -1
  110. data/lib/fog/openstack/volume_v1.rb +29 -21
  111. data/lib/fog/openstack/volume_v2.rb +29 -21
  112. data/supported.md +54 -0
  113. data/tests/openstack/models/identity/ec2_credential_tests.rb +1 -1
  114. data/tests/openstack/models/identity/ec2_credentials_tests.rb +1 -1
  115. data/tests/openstack/models/identity/role_tests.rb +8 -3
  116. data/tests/openstack/models/identity/roles_tests.rb +5 -4
  117. data/tests/openstack/models/identity/tenant_tests.rb +7 -4
  118. data/tests/openstack/models/identity/tenants_tests.rb +10 -5
  119. data/tests/openstack/models/identity/user_tests.rb +4 -3
  120. data/tests/openstack/models/identity/users_tests.rb +10 -6
  121. data/tests/openstack/models/nfv/vnf_tests.rb +35 -0
  122. data/tests/openstack/models/nfv/vnfd_tests.rb +23 -0
  123. data/tests/openstack/models/nfv/vnfds_tests.rb +31 -0
  124. data/tests/openstack/models/nfv/vnfs_tests.rb +38 -0
  125. data/tests/openstack/requests/identity/ec2_credentials_tests.rb +6 -9
  126. data/tests/openstack/requests/identity/helper.rb +12 -4
  127. data/tests/openstack/requests/identity/role_tests.rb +13 -10
  128. data/tests/openstack/requests/identity/tenant_tests.rb +10 -9
  129. data/tests/openstack/requests/identity/user_tests.rb +11 -6
  130. data/tests/openstack/requests/image/image_tests.rb +1 -0
  131. data/tests/openstack/requests/nfv/vnf_tests.rb +70 -0
  132. data/tests/openstack/requests/nfv/vnfd_tests.rb +44 -0
  133. metadata +81 -31
  134. data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +0 -26
  135. data/lib/fog/openstack/requests/volume_v1/create_volume_snapshot.rb +0 -44
  136. data/lib/fog/openstack/requests/volume_v2/create_volume_snapshot.rb +0 -43
  137. data/tests/openstack/authenticate_tests.rb +0 -200
  138. data/tests/openstack/identity_version_tests.rb +0 -25
  139. data/tests/openstack/storage_tests.rb +0 -18
  140. data/tests/openstack/version_tests.rb +0 -55
  141. data/tests/openstack/volume_tests.rb +0 -18
@@ -1,4 +1,4 @@
1
-
1
+ require 'fog/openstack/core'
2
2
  require 'fog/openstack/common'
3
3
  require 'fog/openstack/volume'
4
4
 
@@ -23,6 +23,9 @@ module Fog
23
23
  model :volume_type
24
24
  collection :volume_types
25
25
 
26
+ model :snapshot
27
+ collection :snapshots
28
+
26
29
  model :transfer
27
30
  collection :transfers
28
31
 
@@ -32,6 +35,7 @@ module Fog
32
35
  request :list_volumes
33
36
  request :list_volumes_detailed
34
37
  request :create_volume
38
+ request :update_volume
35
39
  request :get_volume_details
36
40
  request :extend_volume
37
41
  request :delete_volume
@@ -44,11 +48,14 @@ module Fog
44
48
  request :delete_volume_type
45
49
  request :get_volume_type_details
46
50
 
47
- request :create_volume_snapshot
51
+ request :create_snapshot
52
+ request :update_snapshot
48
53
  request :list_snapshots
49
54
  request :list_snapshots_detailed
50
55
  request :get_snapshot_details
51
56
  request :delete_snapshot
57
+ request :update_snapshot_metadata
58
+ request :delete_snapshot_metadata
52
59
 
53
60
  request :list_transfers
54
61
  request :list_transfers_detailed
@@ -60,22 +67,26 @@ module Fog
60
67
  request :update_quota
61
68
  request :get_quota
62
69
  request :get_quota_defaults
63
-
64
70
  request :get_quota_usage
65
71
 
72
+ request :update_metadata
73
+ request :replace_metadata
74
+ request :delete_metadata
75
+
66
76
  request :set_tenant
77
+ request :action
67
78
 
68
79
  class Mock
69
80
  def self.data
70
81
  @data ||= Hash.new do |hash, key|
71
82
  hash[key] = {
72
- :users => {},
73
- :tenants => {},
74
- :quota => {
75
- 'gigabytes' => 1000,
76
- 'volumes' => 10,
77
- 'snapshots' => 10
78
- }
83
+ :users => {},
84
+ :tenants => {},
85
+ :quota => {
86
+ 'gigabytes' => 1000,
87
+ 'volumes' => 10,
88
+ 'snapshots' => 10
89
+ }
79
90
  }
80
91
  end
81
92
  end
@@ -84,7 +95,7 @@ module Fog
84
95
  @data = nil
85
96
  end
86
97
 
87
- def initialize(options={})
98
+ def initialize(options = {})
88
99
  @openstack_username = options[:openstack_username]
89
100
  @openstack_tenant = options[:openstack_tenant]
90
101
  @openstack_auth_uri = URI.parse(options[:openstack_auth_url])
@@ -101,11 +112,11 @@ module Fog
101
112
  unless @data[:users].find { |u| u['name'] == options[:openstack_username] }
102
113
  id = Fog::Mock.random_numbers(6).to_s
103
114
  @data[:users][id] = {
104
- 'id' => id,
105
- 'name' => options[:openstack_username],
106
- 'email' => "#{options[:openstack_username]}@mock.com",
107
- 'tenantId' => Fog::Mock.random_numbers(6).to_s,
108
- 'enabled' => true
115
+ 'id' => id,
116
+ 'name' => options[:openstack_username],
117
+ 'email' => "#{options[:openstack_username]}@mock.com",
118
+ 'tenantId' => Fog::Mock.random_numbers(6).to_s,
119
+ 'enabled' => true
109
120
  }
110
121
  end
111
122
  end
@@ -133,7 +144,7 @@ module Fog
133
144
  end
134
145
  include Fog::OpenStack::Common
135
146
 
136
- def initialize(options={})
147
+ def initialize(options = {})
137
148
  initialize_identity options
138
149
 
139
150
  @openstack_service_type = options[:openstack_service_type] || ['volumev2']
@@ -154,11 +165,8 @@ module Fog
154
165
  @persistent = options[:persistent] || false
155
166
  @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
156
167
  end
157
-
158
- private
159
-
160
168
  end
161
169
  end
162
170
  end
163
171
  end
164
- end
172
+ end
data/supported.md ADDED
@@ -0,0 +1,54 @@
1
+ # Supported OpenStack Projects
2
+
3
+ ## Supported
4
+
5
+ | Project | Fog Type | API Version(s) | Compliance | Notes |
6
+ |------------------|---------------|----------------|------------|-------|
7
+ | Ceilometer | Metering | v2 | TBD | |
8
+ | Cinder | Volume | v1, v2 | TBD | |
9
+ | Glance | Image | v1, v2 | TBD | |
10
+ | Heat | Orchestration | v1 | TBD | |
11
+ | Keystone | Identity | v2, v3 | TBD | |
12
+ | Neutron | Network | v2 | TBD | |
13
+ | Nova | Compute | v2.0 | TBD | |
14
+ | Ironic | Bare Metal | v1 | TBD | |
15
+ | Ironic Inspector | Introspection | v1 | TBD | |
16
+ | Swift | Storage | v2 | TBD | |
17
+ | Tacker | NFV | v1 | TBD | |
18
+
19
+ ## Wish List
20
+
21
+ Feel free to submit pull requests to add support for these.
22
+
23
+ * [barbican](https://wiki.openstack.org/wiki/Barbican) (Key Management)
24
+ * [congress](https://wiki.openstack.org/wiki/Congress) (Policy As a Service)
25
+ * [designate](https://wiki.openstack.org/wiki/Designate) (DNSaaS)
26
+ * [magnum](https://wiki.openstack.org/wiki/Magnum) (Containers)
27
+ * [manila](https://wiki.openstack.org/wiki/Manila) (File Storage)
28
+ * [monasca](https://wiki.openstack.org/wiki/Monasca) (Monitoring)
29
+ * [trove](https://wiki.openstack.org/wiki/Trove) (DBaaS)
30
+
31
+ ## Unsupported
32
+
33
+ * aodh (Telemetry Alarms)
34
+ * astara (Network)
35
+ * cloudkitty (Telemetry)
36
+ * cue (Messaging)
37
+ * dragonflow (Network)
38
+ * ec2-api (Compatibility Layer)
39
+ * freezer (Disaster Recovery)
40
+ * fuel (Orchestration)
41
+ * gnocchi (TSDB)
42
+ * horizon (Web Frontend)
43
+ * kolla (Containers)
44
+ * kuryr (Containers)
45
+ * mistral (Workflow)
46
+ * murano (Catalog Service)
47
+ * rally (Benchmarking)
48
+ * sahara (Map-Reduce)
49
+ * searchlight (Searching)
50
+ * senlin (Clustering)
51
+ * solum (Lifecycle)
52
+ * tripleo (Orchestration)
53
+ * zaqar (Messaging)
54
+
@@ -1,6 +1,6 @@
1
1
  Shindo.tests("Fog::Identity[:openstack] | ec2_credential", ['openstack']) do
2
2
  before do
3
- openstack = Fog::Identity[:openstack]
3
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
4
4
  tenant_id = openstack.list_tenants.body['tenants'].first['id']
5
5
 
6
6
  @user = openstack.users.find { |user| user.name == 'foobar' }
@@ -1,6 +1,6 @@
1
1
  Shindo.tests("Fog::Identity[:openstack] | ec2_credentials", ['openstack']) do
2
2
  before do
3
- openstack = Fog::Identity[:openstack]
3
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
4
4
  tenant_id = openstack.list_tenants.body['tenants'].first['id']
5
5
 
6
6
  @user = openstack.users.find { |user| user.name == 'foobar' }
@@ -1,7 +1,12 @@
1
1
  Shindo.tests("Fog::Identity[:openstack] | role", ['openstack']) do
2
- @instance = Fog::Identity[:openstack].roles.new({:name => 'Role Name', :user_id => 1, :role_id => 1})
3
- @tenant = Fog::Identity[:openstack].tenants.create(:name => 'test_user')
4
- @user = Fog::Identity[:openstack].users.create(:name => 'test_user', :tenant_id => @tenant.id, :password => 'spoof')
2
+ @identity = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
3
+ @instance = @identity.roles.new(
4
+ :name => 'Role Name',
5
+ :user_id => 1,
6
+ :role_id => 1
7
+ )
8
+ @tenant = @identity.tenants.create(:name => 'test_user')
9
+ @user = @identity.users.create(:name => 'test_user', :tenant_id => @tenant.id, :password => 'spoof')
5
10
 
6
11
  tests('success') do
7
12
  tests('#save').returns(true) do
@@ -1,8 +1,9 @@
1
1
  Shindo.tests("Fog::Identity[:openstack] | roles", ['openstack']) do
2
- @tenant = Fog::Identity[:openstack].tenants.create(:name => 'test_user')
3
- @user = Fog::Identity[:openstack].users.create(:name => 'test_user', :tenant_id => @tenant.id, :password => 'spoof')
4
- @role = Fog::Identity[:openstack].roles(:user => @user, :tenant => @tenant).create(:name => 'test_role')
5
- @roles = Fog::Identity[:openstack].roles(:user => @user, :tenant => @tenant)
2
+ @identity = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
3
+ @tenant = @identity.tenants.create(:name => 'test_user')
4
+ @user = @identity.users.create(:name => 'test_user', :tenant_id => @tenant.id, :password => 'spoof')
5
+ @role = @identity.roles(:user => @user, :tenant => @tenant).create(:name => 'test_role')
6
+ @roles = @identity.roles(:user => @user, :tenant => @tenant)
6
7
 
7
8
  tests('success') do
8
9
  tests('#all').succeeds do
@@ -1,20 +1,23 @@
1
1
  Shindo.tests("Fog::Identity[:openstack] | tenant", ['openstack']) do
2
2
  tests('success') do
3
+ @openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
4
+
3
5
  tests('#roles_for(0)').succeeds do
4
- instance = Fog::Identity[:openstack].tenants.first
6
+ instance = @openstack.tenants.first
5
7
  instance.roles_for(0)
6
8
  end
7
9
 
8
10
  tests('#users').succeeds do
9
- instance = Fog::Identity[:openstack].tenants.first
11
+ instance = @openstack.tenants.first
12
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
10
13
 
11
- instance.users.count != Fog::Identity[:openstack].users.count
14
+ instance.users.count != openstack.users.count
12
15
  end
13
16
  end
14
17
 
15
18
  tests('CRUD') do
16
19
  tests('#create').succeeds do
17
- @instance = Fog::Identity[:openstack].tenants.create(:name => 'test')
20
+ @instance = @openstack.tenants.create(:name => 'test')
18
21
  !@instance.id.nil?
19
22
  end
20
23
 
@@ -1,14 +1,17 @@
1
1
  Shindo.tests("Fog::Compute[:openstack] | tenants", ['openstack']) do
2
- @instance = Fog::Identity[:openstack].tenants.create(:name => 'test')
2
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
3
+ @instance = openstack.tenants.create(:name => 'test')
3
4
 
4
5
  tests('success') do
5
6
  tests('#find_by_id').succeeds do
6
- tenant = Fog::Identity[:openstack].tenants.find_by_id(@instance.id)
7
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
8
+ tenant = openstack.tenants.find_by_id(@instance.id)
7
9
  tenant.id == @instance.id
8
10
  end
9
11
 
10
12
  tests('#destroy').succeeds do
11
- Fog::Identity[:openstack].tenants.destroy(@instance.id)
13
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
14
+ openstack.tenants.destroy(@instance.id)
12
15
  end
13
16
  end
14
17
 
@@ -16,11 +19,13 @@ Shindo.tests("Fog::Compute[:openstack] | tenants", ['openstack']) do
16
19
  pending if Fog.mocking?
17
20
 
18
21
  tests('#find_by_id').raises(Fog::Identity::OpenStack::NotFound) do
19
- Fog::Identity[:openstack].tenants.find_by_id('fake')
22
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
23
+ openstack.tenants.find_by_id('fake')
20
24
  end
21
25
 
22
26
  tests('#destroy').raises(Fog::Identity::OpenStack::NotFound) do
23
- Fog::Identity[:openstack].tenants.destroy('fake')
27
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
28
+ openstack.tenants.destroy('fake')
24
29
  end
25
30
  end
26
31
  end
@@ -1,12 +1,13 @@
1
1
  Shindo.tests("Fog::Identity[:openstack] | user", ['openstack']) do
2
- tenant_id = Fog::Identity[:openstack].list_tenants.body['tenants'].first['id']
3
- @instance = Fog::Identity[:openstack].users.new({
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(
4
5
  :name => 'User Name',
5
6
  :email => 'test@fog.com',
6
7
  :tenant_id => tenant_id,
7
8
  :password => 'spoof',
8
9
  :enabled => true
9
- })
10
+ )
10
11
 
11
12
  tests('success') do
12
13
  tests('#save').returns(true) do
@@ -1,26 +1,30 @@
1
1
  Shindo.tests("Fog::Identity[:openstack] | users", ['openstack']) do
2
- tenant_id = Fog::Identity[:openstack].list_tenants.body['tenants'].first['id']
3
- @instance = Fog::Identity[:openstack].users.create({
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(
4
5
  :name => 'foobar',
5
6
  :email => 'foo@bar.com',
6
7
  :tenant_id => tenant_id,
7
8
  :password => 'spoof',
8
9
  :enabled => true
9
- })
10
+ )
10
11
 
11
12
  tests('success') do
12
13
  tests('#find_by_id').succeeds do
13
- user = Fog::Identity[:openstack].users.find_by_id(@instance.id)
14
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
15
+ user = openstack.users.find_by_id(@instance.id)
14
16
  user.id == @instance.id
15
17
  end
16
18
 
17
19
  tests('#find_by_name').succeeds do
18
- user = Fog::Identity[:openstack].users.find_by_name(@instance.name)
20
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
21
+ user = openstack.users.find_by_name(@instance.name)
19
22
  user.name == @instance.name
20
23
  end
21
24
 
22
25
  tests('#destroy').succeeds do
23
- Fog::Identity[:openstack].users.destroy(@instance.id)
26
+ openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
27
+ openstack.users.destroy(@instance.id)
24
28
  end
25
29
  end
26
30
 
@@ -0,0 +1,35 @@
1
+ Shindo.tests("Fog::NFV[:openstack] | vnf", ['openstack']) do
2
+ tests('success') do
3
+ tests('#create').succeeds do
4
+ vnfd_data = {:attributes => {:vnfd => "template_name: sample-vnfd\ndescription: demo-example\n\nservice_prop"\
5
+ "erties:\n Id: sample-vnfd\n vendor: tacker\n version: 1\n\nvdus:\n"\
6
+ " vdu1:\n id: vdu1\n vm_image: cirros\n instance_type: m1.ti"\
7
+ "ny\n\n network_interfaces:\n management:\n network: ne"\
8
+ "t_mgmt\n management: true\n pkt_in:\n network: net"\
9
+ "0\n pkt_out:\n network: net1\n\n placement_policy:\n "\
10
+ " availability_zone: nova\n\n auto-scaling: noop\n\n config:"\
11
+ "\n param0: key0\n param1: key1\n"},
12
+ :service_types => [{:service_type => "vnfd"}],
13
+ :mgmt_driver => "noop",
14
+ :infra_driver => "heat"}
15
+ auth = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin", "password" => "password"}}
16
+ @vnfd = Fog::NFV[:openstack].vnfds.create(:vnfd => vnfd_data, :auth => auth)
17
+ vnf_data = {:vnfd_id => @vnfd.id, :name => 'Test'}
18
+ @vnf = Fog::NFV[:openstack].vnfs.create(:vnf => vnf_data, :auth => auth)
19
+ end
20
+
21
+ Fog::NFV[:openstack].vnfs.get(@vnf.id).wait_for { ready? }
22
+
23
+ tests('#update').succeeds do
24
+ @vnf.vnf = {:attributes => {:config => "vdus:\n vdu1:<sample_vdu_config> \n\n"}}
25
+ @vnf.update
26
+ end
27
+
28
+ tests('#destroy').succeeds do
29
+ sleep(10) unless Fog.mocking?
30
+
31
+ @vnf.destroy
32
+ @vnfd.destroy
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,23 @@
1
+ Shindo.tests("Fog::NFV[:openstack] | vnf", ['openstack']) do
2
+ tests('success') do
3
+ tests('#create').succeeds do
4
+ vnfd_data = {:attributes => {:vnfd => "template_name: sample-vnfd\ndescription: demo-example\n\nservice_prop"\
5
+ "erties:\n Id: sample-vnfd\n vendor: tacker\n version: 1\n\nvdus:\n"\
6
+ " vdu1:\n id: vdu1\n vm_image: cirros\n instance_type: m1.ti"\
7
+ "ny\n\n network_interfaces:\n management:\n network: ne"\
8
+ "t_mgmt\n management: true\n pkt_in:\n network: net"\
9
+ "0\n pkt_out:\n network: net1\n\n placement_policy:\n "\
10
+ " availability_zone: nova\n\n auto-scaling: noop\n\n config:"\
11
+ "\n param0: key0\n param1: key1\n"},
12
+ :service_types => [{:service_type => "vnfd"}],
13
+ :mgmt_driver => "noop",
14
+ :infra_driver => "heat"}
15
+ auth = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin", "password" => "password"}}
16
+ @vnfd = Fog::NFV[:openstack].vnfds.create(:vnfd => vnfd_data, :auth => auth)
17
+ end
18
+
19
+ tests('#destroy').succeeds do
20
+ @vnfd.destroy == true
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,31 @@
1
+ Shindo.tests("Fog::NFV[:openstack] | vnfs", ['openstack']) do
2
+ vnfd_data = {:attributes => {:vnfd => "template_name: sample-vnfd\ndescription: demo-example\n\nservice_prop"\
3
+ "erties:\n Id: sample-vnfd\n vendor: tacker\n version: 1\n\nvdus:\n"\
4
+ " vdu1:\n id: vdu1\n vm_image: cirros\n instance_type: m1.ti"\
5
+ "ny\n\n network_interfaces:\n management:\n network: ne"\
6
+ "t_mgmt\n management: true\n pkt_in:\n network: net"\
7
+ "0\n pkt_out:\n network: net1\n\n placement_policy:\n "\
8
+ " availability_zone: nova\n\n auto-scaling: noop\n\n config:"\
9
+ "\n param0: key0\n param1: key1\n"},
10
+ :service_types => [{:service_type => "vnfd"}],
11
+ :mgmt_driver => "noop",
12
+ :infra_driver => "heat"}
13
+ auth = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin", "password" => "password"}}
14
+ @vnfd = Fog::NFV[:openstack].vnfds.create(:vnfd => vnfd_data, :auth => auth)
15
+
16
+ tests('success') do
17
+ tests('#find_by_id').succeeds do
18
+ vnf = Fog::NFV[:openstack].vnfds.find_by_id(@vnfd.id)
19
+ vnf.id == @vnfd.id
20
+ end
21
+
22
+ tests('#get').succeeds do
23
+ vnf = Fog::NFV[:openstack].vnfds.get(@vnfd.id)
24
+ vnf.id == @vnfd.id
25
+ end
26
+
27
+ tests('#destroy').succeeds do
28
+ Fog::NFV[:openstack].vnfds.destroy(@vnfd.id)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,38 @@
1
+ Shindo.tests("Fog::NFV[:openstack] | vnfs", ['openstack']) do
2
+ vnfd_data = {:attributes => {:vnfd => "template_name: sample-vnfd\ndescription: demo-example\n\nservice_prop"\
3
+ "erties:\n Id: sample-vnfd\n vendor: tacker\n version: 1\n\nvdus:\n"\
4
+ " vdu1:\n id: vdu1\n vm_image: cirros\n instance_type: m1.ti"\
5
+ "ny\n\n network_interfaces:\n management:\n network: ne"\
6
+ "t_mgmt\n management: true\n pkt_in:\n network: net"\
7
+ "0\n pkt_out:\n network: net1\n\n placement_policy:\n "\
8
+ " availability_zone: nova\n\n auto-scaling: noop\n\n config:"\
9
+ "\n param0: key0\n param1: key1\n"},
10
+ :service_types => [{:service_type => "vnfd"}],
11
+ :mgmt_driver => "noop",
12
+ :infra_driver => "heat"}
13
+ auth = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin", "password" => "password"}}
14
+ @vnfd = Fog::NFV[:openstack].vnfds.create(:vnfd => vnfd_data, :auth => auth)
15
+ vnf_data = {:vnfd_id => @vnfd.id, :name => 'Test'}
16
+ @vnf = Fog::NFV[:openstack].vnfs.create(:vnf => vnf_data, :auth => auth)
17
+
18
+ Fog::NFV[:openstack].vnfs.get(@vnf.id).wait_for { ready? }
19
+
20
+ tests('success') do
21
+ tests('#find_by_id').succeeds do
22
+ vnf = Fog::NFV[:openstack].vnfs.find_by_id(@vnf.id)
23
+ vnf.id == @vnf.id
24
+ end
25
+
26
+ tests('#get').succeeds do
27
+ vnf = Fog::NFV[:openstack].vnfs.get(@vnf.id)
28
+ vnf.id == @vnf.id
29
+ end
30
+
31
+ tests('#destroy').succeeds do
32
+ sleep(10) unless Fog.mocking?
33
+
34
+ Fog::NFV[:openstack].vnfs.destroy(@vnf.id)
35
+ Fog::NFV[:openstack].vnfds.destroy(@vnfd.id)
36
+ end
37
+ end
38
+ end