deltacloud-core 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. data/LICENSE +23 -0
  2. data/NOTICE +3 -0
  3. data/Rakefile +32 -20
  4. data/bin/deltacloudd +1 -1
  5. data/config.ru +25 -32
  6. data/deltacloud-core.gemspec +1 -1
  7. data/lib/cimi/collections.rb +4 -1
  8. data/lib/cimi/collections/address_templates.rb +2 -2
  9. data/lib/cimi/collections/addresses.rb +1 -1
  10. data/lib/cimi/collections/base.rb +64 -0
  11. data/lib/cimi/collections/{machine_admins.rb → credentials.rb} +12 -12
  12. data/lib/cimi/collections/{vsp_templates.rb → forwarding_group_templates.rb} +12 -16
  13. data/lib/cimi/collections/{vsp_configurations.rb → forwarding_groups.rb} +12 -13
  14. data/lib/cimi/collections/machine_configurations.rb +2 -2
  15. data/lib/cimi/collections/machine_images.rb +1 -1
  16. data/lib/cimi/collections/machines.rb +8 -2
  17. data/lib/cimi/collections/network_configurations.rb +2 -2
  18. data/lib/cimi/collections/{routing_groups.rb → network_port_configurations.rb} +12 -12
  19. data/lib/cimi/collections/{routing_group_templates.rb → network_port_templates.rb} +15 -12
  20. data/lib/cimi/collections/{vsps.rb → network_ports.rb} +33 -32
  21. data/lib/cimi/collections/network_templates.rb +2 -2
  22. data/lib/cimi/collections/networks.rb +17 -2
  23. data/lib/cimi/collections/{entity_metadata.rb → resource_metadata.rb} +10 -10
  24. data/lib/cimi/collections/volume_configurations.rb +1 -1
  25. data/lib/cimi/collections/volume_images.rb +1 -1
  26. data/lib/cimi/collections/volumes.rb +1 -2
  27. data/lib/cimi/dependencies.rb +1 -1
  28. data/lib/cimi/helpers.rb +3 -84
  29. data/lib/cimi/helpers/cimi_helper.rb +15 -14
  30. data/lib/cimi/models.rb +20 -36
  31. data/lib/cimi/models/address.rb +32 -4
  32. data/lib/cimi/models/address_template.rb +2 -2
  33. data/lib/cimi/models/base.rb +24 -5
  34. data/lib/cimi/models/cloud_entry_point.rb +4 -9
  35. data/lib/cimi/models/collection.rb +101 -0
  36. data/lib/cimi/models/{machine_admin.rb → credential.rb} +6 -4
  37. data/lib/cimi/models/disk_collection.rb +1 -2
  38. data/lib/cimi/models/{routing_group_template.rb → forwarding_group.rb} +5 -3
  39. data/lib/cimi/models/{routing_group.rb → forwarding_group_template.rb} +5 -3
  40. data/lib/cimi/models/machine.rb +9 -7
  41. data/lib/cimi/models/machine_configuration.rb +2 -0
  42. data/lib/cimi/models/machine_image.rb +2 -0
  43. data/lib/cimi/models/machine_template.rb +3 -1
  44. data/lib/cimi/models/machine_volume_collection.rb +1 -1
  45. data/lib/cimi/models/network.rb +2 -0
  46. data/lib/cimi/models/network_configuration.rb +4 -8
  47. data/lib/cimi/models/{vsp.rb → network_port.rb} +7 -11
  48. data/lib/cimi/models/{network_configuration_collection.rb → network_port_collection.rb} +25 -8
  49. data/lib/cimi/models/{vsp_configuration.rb → network_port_configuration.rb} +6 -10
  50. data/lib/cimi/models/{network_collection.rb → network_port_configuration_collection.rb} +9 -9
  51. data/lib/cimi/models/{vsp_template.rb → network_port_template.rb} +6 -4
  52. data/lib/cimi/models/{network_template_collection.rb → network_port_template_collection.rb} +10 -8
  53. data/lib/cimi/models/network_template.rb +3 -1
  54. data/lib/cimi/models/{entity_metadata.rb → resource_metadata.rb} +16 -15
  55. data/lib/cimi/models/schema.rb +23 -12
  56. data/lib/cimi/models/volume.rb +2 -0
  57. data/lib/cimi/models/volume_configuration.rb +2 -0
  58. data/lib/cimi/models/volume_image.rb +2 -0
  59. data/lib/cimi/models/volume_template.rb +2 -0
  60. data/lib/cimi/server.rb +10 -6
  61. data/lib/deltacloud/collections.rb +7 -2
  62. data/lib/deltacloud/collections/addresses.rb +3 -1
  63. data/lib/deltacloud/collections/base.rb +64 -0
  64. data/lib/deltacloud/collections/buckets.rb +14 -4
  65. data/lib/deltacloud/collections/drivers.rb +1 -1
  66. data/lib/deltacloud/collections/firewalls.rb +1 -1
  67. data/lib/deltacloud/collections/instances.rb +5 -1
  68. data/lib/deltacloud/collections/keys.rb +1 -1
  69. data/lib/deltacloud/collections/load_balancers.rb +2 -0
  70. data/lib/deltacloud/collections/storage_volumes.rb +3 -5
  71. data/lib/deltacloud/core_ext.rb +1 -0
  72. data/lib/deltacloud/core_ext/hash.rb +8 -0
  73. data/lib/deltacloud/core_ext/ordered_hash.rb +222 -0
  74. data/lib/deltacloud/core_ext/string.rb +9 -0
  75. data/lib/deltacloud/drivers/aruba/aruba_driver.rb +0 -9
  76. data/lib/deltacloud/drivers/base_driver.rb +22 -4
  77. data/lib/deltacloud/drivers/ec2/ec2_driver.rb +0 -4
  78. data/lib/deltacloud/drivers/exceptions.rb +30 -13
  79. data/lib/deltacloud/drivers/features.rb +7 -0
  80. data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +1 -9
  81. data/lib/deltacloud/drivers/google/google_driver.rb +13 -0
  82. data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.1.yml +3 -0
  83. data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.2.yml +3 -0
  84. data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.3.yml +3 -0
  85. data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.4.yml +3 -0
  86. data/lib/deltacloud/drivers/mock/mock_driver.rb +65 -1
  87. data/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +55 -32
  88. data/lib/deltacloud/drivers/openstack/openstack_driver.rb +18 -6
  89. data/lib/deltacloud/helpers.rb +0 -75
  90. data/lib/deltacloud/helpers/deltacloud_helper.rb +66 -28
  91. data/lib/deltacloud/helpers/driver_helper.rb +7 -0
  92. data/lib/deltacloud/helpers/rabbit_helper.rb +51 -0
  93. data/lib/deltacloud/server.rb +12 -14
  94. data/lib/deltacloud/version.rb +1 -1
  95. data/lib/deltacloud_rack.rb +26 -2
  96. data/lib/ec2/query_parser.rb +18 -3
  97. data/lib/sinatra/rack_accept.rb +7 -2
  98. data/lib/sinatra/rack_matrix_params.rb +14 -14
  99. data/public/javascripts/cmwgapp.js +2 -2
  100. data/tests/cimi/collections/cloud_entry_point_test.rb +3 -3
  101. data/tests/cimi/collections/machine_images_test.rb +2 -2
  102. data/tests/cimi/collections/machines_test.rb +1 -1
  103. data/tests/cimi/collections/url_helper_test.rb +31 -0
  104. data/tests/cimi/spec/cimi/model/{machine_admin_spec.rb → credential_spec.rb} +4 -4
  105. data/tests/deltacloud/base_collection_test.rb +0 -5
  106. data/tests/deltacloud/collections/buckets_collection_test.rb +1 -1
  107. data/tests/deltacloud/collections/drivers_collection_test.rb +1 -1
  108. data/tests/deltacloud/collections/hardware_profiles_collection_test.rb +1 -1
  109. data/tests/deltacloud/collections/images_collection_test.rb +1 -1
  110. data/tests/deltacloud/collections/instance_states_collection_test.rb +1 -1
  111. data/tests/deltacloud/collections/instances_collection_test.rb +1 -1
  112. data/tests/deltacloud/collections/keys_collection_test.rb +1 -4
  113. data/tests/deltacloud/deltacloud_helper_test.rb +0 -9
  114. data/tests/deltacloud/server_test.rb +1 -1
  115. data/tests/drivers/base/base_driver_test.rb +30 -0
  116. data/tests/drivers/base/common.rb +14 -0
  117. data/tests/drivers/base/exceptions_test.rb +64 -0
  118. data/tests/drivers/ec2/buckets_test.rb +45 -0
  119. data/tests/drivers/ec2/keys_test.rb +1 -1
  120. data/tests/drivers/google/buckets_test.rb +2 -2
  121. data/tests/drivers/google/common.rb +3 -3
  122. data/tests/test_helper.rb +28 -0
  123. data/views/api/show.html.haml +2 -2
  124. data/views/api/show.xml.haml +1 -1
  125. data/views/buckets/index.html.haml +1 -1
  126. data/views/cimi/cloudEntryPoint/index.xml.haml +1 -1
  127. data/views/cimi/collection/index.html.haml +3 -3
  128. data/views/cimi/collection/response.xml.haml +1 -1
  129. data/views/cimi/error.html.haml +1 -1
  130. data/views/cimi/errors/500.xml.haml +1 -1
  131. data/views/cimi/layout.html.haml +1 -1
  132. data/views/cimi/machine_configurations/show.html.haml +2 -2
  133. data/views/cimi/machine_configurations/show.xml.haml +1 -1
  134. data/views/cimi/machine_images/show.html.haml +2 -2
  135. data/views/cimi/machine_images/show.xml.haml +1 -1
  136. data/views/cimi/machines/show.html.haml +2 -2
  137. data/views/cimi/machines/show.xml.haml +1 -1
  138. data/views/cimi/volumes/show.html.haml +2 -2
  139. data/views/cimi/volumes/show.xml.haml +1 -1
  140. data/views/docs/collection.html.haml +1 -1
  141. data/views/docs/collection.xml.haml +2 -2
  142. data/views/docs/index.html.haml +1 -1
  143. data/views/docs/index.xml.haml +1 -1
  144. data/views/docs/operation.xml.haml +1 -1
  145. data/views/error.html.haml +1 -1
  146. data/views/errors/500.html.haml +7 -4
  147. data/views/firewalls/index.html.haml +1 -1
  148. data/views/firewalls/show.html.haml +1 -1
  149. data/views/images/show.html.haml +2 -2
  150. data/views/index.html.haml +9 -0
  151. data/views/instance_states/show.html.haml +1 -1
  152. data/views/instances/run_command.html.haml +1 -1
  153. data/views/instances/show.html.haml +2 -2
  154. data/views/keys/index.html.haml +1 -1
  155. data/views/layout.html.haml +1 -1
  156. data/views/load_balancers/index.html.haml +1 -1
  157. data/views/load_balancers/show.html.haml +3 -3
  158. data/views/storage_snapshots/show.html.haml +1 -1
  159. data/views/storage_volumes/attach.html.haml +1 -1
  160. data/views/storage_volumes/index.html.haml +1 -1
  161. data/views/storage_volumes/show.html.haml +4 -4
  162. metadata +40 -43
  163. data/lib/cimi/models/address_collection.rb +0 -34
  164. data/lib/cimi/models/address_template_collection.rb +0 -34
  165. data/lib/cimi/models/entity_metadata_collection.rb +0 -31
  166. data/lib/cimi/models/machine_admin_collection.rb +0 -34
  167. data/lib/cimi/models/machine_collection.rb +0 -37
  168. data/lib/cimi/models/machine_configuration_collection.rb +0 -36
  169. data/lib/cimi/models/machine_image_collection.rb +0 -36
  170. data/lib/cimi/models/machine_template_collection.rb +0 -36
  171. data/lib/cimi/models/routing_group_collection.rb +0 -34
  172. data/lib/cimi/models/routing_group_template_collection.rb +0 -35
  173. data/lib/cimi/models/volume_collection.rb +0 -36
  174. data/lib/cimi/models/volume_configuration_collection.rb +0 -36
  175. data/lib/cimi/models/volume_image_collection.rb +0 -36
  176. data/lib/cimi/models/volume_template_collection.rb +0 -36
  177. data/lib/cimi/models/vsp_collection.rb +0 -34
  178. data/lib/cimi/models/vsp_configuration_collection.rb +0 -34
  179. data/lib/cimi/models/vsp_template_collection.rb +0 -34
  180. data/lib/deltacloud/helpers/url_helper.rb +0 -115
@@ -16,7 +16,7 @@
16
16
  module CIMI::Collections
17
17
  class MachineConfigurations < Base
18
18
 
19
- check_capability :for => lambda { |m| driver.respond_to? m }
19
+ set :capability => lambda { |m| driver.respond_to? m }
20
20
 
21
21
  collection :machine_configurations do
22
22
  description 'List all machine configurations'
@@ -25,7 +25,7 @@ module CIMI::Collections
25
25
  param :CIMISelect, :string, :optional
26
26
  description "List all machine configurations"
27
27
  control do
28
- machine_configs = MachineConfigurationCollection.default(self).filter_by(params[:CIMISelect])
28
+ machine_configs = MachineConfiguration.list(self).filter_by(params[:CIMISelect])
29
29
  respond_to do |format|
30
30
  format.xml { machine_configs.to_xml }
31
31
  format.json { machine_configs.to_json }
@@ -25,7 +25,7 @@ module CIMI::Collections
25
25
  description "List all machine configurations"
26
26
  param :CIMISelect, :string, :optional
27
27
  control do
28
- machine_images = MachineImageCollection.default(self).filter_by(params[:CIMISelect])
28
+ machine_images = MachineImage.list(self).filter_by(params[:CIMISelect])
29
29
  respond_to do |format|
30
30
  format.xml { machine_images.to_xml }
31
31
  format.json { machine_images.to_json }
@@ -25,7 +25,7 @@ module CIMI::Collections
25
25
  param :CIMISelect, :string, :optional
26
26
  description "List all machines"
27
27
  control do
28
- machines = MachineCollection.default(self).filter_by(params[:CIMISelect])
28
+ machines = Machine.list(self).filter_by(params[:CIMISelect])
29
29
  respond_to do |format|
30
30
  format.xml { machines.to_xml }
31
31
  format.json { machines.to_json }
@@ -62,7 +62,6 @@ module CIMI::Collections
62
62
 
63
63
  operation :destroy, :with_capability => :destroy_instance do
64
64
  description "Delete a specified machine."
65
- param :id, :string, :required
66
65
  control do
67
66
  Machine.delete!(params[:id], self)
68
67
  no_content_with_status(200)
@@ -71,6 +70,7 @@ module CIMI::Collections
71
70
 
72
71
  action :stop, :with_capability => :stop_instance do
73
72
  description "Stop specific machine."
73
+ param :id, :string, :required
74
74
  control do
75
75
  machine = Machine.find(params[:id], self)
76
76
  if request.content_type.end_with?("+json")
@@ -87,6 +87,7 @@ module CIMI::Collections
87
87
 
88
88
  action :restart, :with_capability => :restart_instance do
89
89
  description "Start specific machine."
90
+ param :id, :string, :required
90
91
  control do
91
92
  machine = Machine.find(params[:id], self)
92
93
  if request.content_type.end_with?("+json")
@@ -103,6 +104,7 @@ module CIMI::Collections
103
104
 
104
105
  action :start, :with_capability => :start_instance do
105
106
  description "Start specific machine."
107
+ param :id, :string, :required
106
108
  control do
107
109
  machine = Machine.find(params[:id], self)
108
110
  if request.content_type.end_with?("+json")
@@ -119,6 +121,7 @@ module CIMI::Collections
119
121
 
120
122
  operation :disks, :with_capability => :hardware_profiles do
121
123
  description "Retrieve the Machine's DiskCollection"
124
+ param :id, :string, :required
122
125
  control do
123
126
  disks = DiskCollection.default(params[:id], self)
124
127
  respond_to do |format|
@@ -130,6 +133,7 @@ module CIMI::Collections
130
133
 
131
134
  operation :volumes, :with_capability => :storage_volumes do
132
135
  description "Retrieve the Machine's MachineVolumeCollection"
136
+ param :id, :string, :required
133
137
  control do
134
138
  volumes = MachineVolumeCollection.default(params[:id], self)
135
139
  respond_to do |format|
@@ -144,6 +148,7 @@ module CIMI::Collections
144
148
  #with inclusion/ommission of the volumes you want [att|det]ached
145
149
  action :attach_volume, :http_method => :put, :with_capability => :attach_storage_volume do
146
150
  description "Attach CIMI Volume(s) to a machine."
151
+ param :id, :string, :required
147
152
  control do
148
153
  if request.content_type.end_with?("+json")
149
154
  volumes_to_attach = Volume.find_to_attach_from_json(request.body.read, self)
@@ -160,6 +165,7 @@ module CIMI::Collections
160
165
 
161
166
  action :detach_volume, :http_method => :put, :with_capability => :detach_storage_volume do
162
167
  description "Detach CIMI Volume(s) from a machine."
168
+ param :id, :string, :required
163
169
  control do
164
170
  if request.content_type.end_with?("+json")
165
171
  volumes_to_detach = Volume.find_to_attach_from_json(request.body.read, self)
@@ -24,7 +24,7 @@ module CIMI::Collections
24
24
  description 'List all NetworkConfigurations'
25
25
  param :CIMISelect, :string, :optional
26
26
  control do
27
- network_configurations = NetworkConfigurationCollection.default(self).filter_by(params[:CIMISelect])
27
+ network_configurations = NetworkConfiguration.list(self).filter_by(params[:CIMISelect])
28
28
  respond_to do |format|
29
29
  format.xml { network_configurations.to_xml }
30
30
  format.json { network_configurations.to_json }
@@ -32,7 +32,7 @@ module CIMI::Collections
32
32
  end
33
33
  end
34
34
 
35
- operation :show, :with_capability => :network_configuration do
35
+ operation :show, :with_capability => :network_configurations do
36
36
  description 'Show a specific NetworkConfiguration'
37
37
  control do
38
38
  network_config = NetworkConfiguration.find(params[:id], self)
@@ -14,31 +14,31 @@
14
14
  # under the License.
15
15
 
16
16
  module CIMI::Collections
17
- class RoutingGroups < Base
17
+ class NetworkPortConfigurations < Base
18
18
 
19
19
  set :capability, lambda { |m| driver.respond_to? m }
20
20
 
21
- collection :routing_groups do
21
+ collection :network_port_configurations do
22
22
 
23
- operation :index, :with_capability => :routing_groups do
24
- description 'List all RoutingGroups in the RoutingGroupsCollection'
23
+ operation :index, :with_capability => :network_port_configurations do
24
+ description 'List all NetworkPortConfigurations in the NetworkPortConfigurationCollection'
25
25
  param :CIMISelect, :string, :optional
26
26
  control do
27
- routing_groups = RoutingGroupCollection.default(self).filter_by(params[:CIMISelect])
27
+ net_port_configs = NetworkPortConfiguration.list(self).filter_by(params[:CIMISelect])
28
28
  respond_to do |format|
29
- format.xml {routing_groups.to_xml}
30
- format.json {routing_groups.to_json}
29
+ format.xml {net_port_configs.to_xml}
30
+ format.json {net_port_configs.to_json}
31
31
  end
32
32
  end
33
33
  end
34
34
 
35
- operation :show, :with_capability => :routing_group do
36
- description 'Show a specific RoutingGroup'
35
+ operation :show, :with_capability => :network_port_configurations do
36
+ description 'Show a specific NetworkPortConfiguration'
37
37
  control do
38
- routing_group = RoutingGroup.find(params[:id], self)
38
+ net_port_config = NetworkPortConfiguration.find(params[:id], self)
39
39
  respond_to do |format|
40
- format.xml {routing_group.to_xml}
41
- format.json {routing_group.to_json}
40
+ format.xml {net_port_config.to_xml}
41
+ format.json {net_port_config.to_json}
42
42
  end
43
43
  end
44
44
  end
@@ -14,34 +14,37 @@
14
14
  # under the License.
15
15
 
16
16
  module CIMI::Collections
17
- class RoutingGroupTemplates < Base
17
+ class NetworkPortTemplates < Base
18
18
 
19
19
  set :capability, lambda { |m| driver.respond_to? m }
20
20
 
21
- collection :routing_group_templates do
21
+ collection :network_port_templates do
22
22
 
23
- operation :index, :with_capability => :routing_groups do
24
- description 'List all RoutingGroupTemplates in the RoutingGroupTemplateCollection'
23
+ description 'The NetworkPort Template is a set of Configuration values for realizing a NetworkPort. A NetworkPort Template may be used to create multiple NetworkPorts'
24
+
25
+ operation :index, :with_capability => :network_port_templates do
26
+ description 'List all NetworkPortTemplates in the NetworkPortTemplateCollection'
25
27
  param :CIMISelect, :string, :optional
26
28
  control do
27
- routing_group_templates = RoutingGroupTemplateCollection.default(self).filter_by(params[:CIMISelect])
29
+ network_port_templates = NetworkPortTemplate.list(self).filter_by(params[:CIMISelect])
28
30
  respond_to do |format|
29
- format.xml {routing_group_templates.to_xml}
30
- format.json {routing_group_templates.to_json}
31
+ format.xml {network_port_templates.to_xml}
32
+ format.json {network_port_templates.to_json}
31
33
  end
32
34
  end
33
35
  end
34
36
 
35
- operation :show, :with_capability => :routing_group do
36
- description 'Show a specific RoutingGroupTemplate'
37
+ operation :show, :with_capability => :network_port_templates do
38
+ description 'Show a specific NetworkPortTemplate'
37
39
  control do
38
- routing_group_template = RoutingGroupTemplate.find(params[:id], self)
40
+ network_port_template = NetworkPortTemplate.find(params[:id], self)
39
41
  respond_to do |format|
40
- format.xml {routing_group_template.to_xml}
41
- format.json {routing_group_template.to_json}
42
+ format.xml {network_port_template.to_xml}
43
+ format.json {network_port_template.to_json}
42
44
  end
43
45
  end
44
46
  end
47
+
45
48
  end
46
49
 
47
50
  end
@@ -14,89 +14,90 @@
14
14
  # under the License.
15
15
 
16
16
  module CIMI::Collections
17
- class Vsps < Base
17
+ class NetworkPorts < Base
18
18
 
19
19
  set :capability, lambda { |m| driver.respond_to? m }
20
20
 
21
- collection :vsps do
21
+ collection :network_ports do
22
22
 
23
- description 'A VSP represents the connection parameters of a network port'
23
+ description 'A NetworkPort is a realized connection point between a Network and a resource - such as a Machine.'
24
24
 
25
- operation :index, :with_capability => :vsps do
26
- description 'List all VSPs in the VSPCollection'
25
+ operation :index, :with_capability => :network_ports do
26
+ description 'List all NetworkPorts in the NetworkPortCollection'
27
27
  param :CIMISelect, :string, :optional
28
28
  control do
29
- vsps = VSPCollection.default(self).filter_by(params[:CIMISelect])
29
+ network_ports = NetworkPort.list(self).filter_by(params[:CIMISelect])
30
30
  respond_to do |format|
31
- format.xml {vsps.to_xml}
32
- format.json {vsps.to_json}
31
+ format.xml {network_ports.to_xml}
32
+ format.json {network_ports.to_json}
33
33
  end
34
34
  end
35
35
  end
36
36
 
37
- operation :show, :with_capability => :vsp do
38
- description 'Show a specific VSP'
37
+ operation :show, :with_capability => :network_ports do
38
+ description 'Show a specific NetworkPort'
39
39
  control do
40
- vsp = VSP.find(params[:id], self)
40
+ network_port = NetworkPort.find(params[:id], self)
41
41
  respond_to do |format|
42
- format.xml {vsp.to_xml}
43
- format.json {vsp.to_json}
42
+ format.xml {network_port.to_xml}
43
+ format.json {network_port.to_json}
44
44
  end
45
45
  end
46
46
  end
47
47
 
48
- operation :create, :with_capability => :create_vsp do
49
- description "Create a new VSP"
48
+ operation :create, :with_capability => :create_network_port do
49
+ description "Create a new NetworkPort"
50
50
  control do
51
51
  if request.content_type.end_with?("json")
52
- vsp = CIMI::Model::VSP.create(request.body.read, self, :json)
52
+ network_port = CIMI::Model::NetworkPort.create(request.body.read, self, :json)
53
53
  else
54
- vsp = CIMI::Model::VSP.create(request.body.read, self, :xml)
54
+ network_port = CIMI::Model::NetworkPort.create(request.body.read, self, :xml)
55
55
  end
56
56
  respond_to do |format|
57
- format.xml { vsp.to_xml }
58
- format.json { vsp.to_json }
57
+ format.xml { network_port.to_xml }
58
+ format.json { network_port.to_json }
59
59
  end
60
60
  end
61
61
  end
62
62
 
63
- operation :destroy, :with_capability => :delete_vsp do
64
- description "Delete a specified VSP"
63
+ operation :destroy, :with_capability => :delete_network_port do
64
+ description "Delete a specified NetworkPort"
65
65
  control do
66
- CIMI::Model::VSP.delete!(params[:id], self)
66
+ CIMI::Model::NetworkPort.delete!(params[:id], self)
67
67
  no_content_with_status(200)
68
68
  end
69
69
  end
70
70
 
71
- action :start, :with_capability => :start_vsp do
72
- description "Start specific VSP."
71
+ action :start, :with_capability => :start_network_port do
72
+ description "Start specific NetworkPort."
73
73
  param :id, :string, :required
74
74
  control do
75
- vsp = VSP.find(params[:id], self)
76
- report_error(404) unless vsp
75
+ network_port = NetworkPort.find(params[:id], self)
76
+ report_error(404) unless network_port
77
77
  if request.content_type.end_with?("json")
78
78
  action = Action.from_json(request.body.read)
79
79
  else
80
80
  action = Action.from_xml(request.body.read)
81
81
  end
82
- vsp.perform(action, self) do |operation|
82
+ network_port.perform(action, self) do |operation|
83
83
  no_content_with_status(202) if operation.success?
84
84
  # Handle errors using operation.failure?
85
85
  end
86
86
  end
87
87
  end
88
88
 
89
- action :stop, :with_capability => :stop_vsp do
90
- description "Stop specific VSP."
89
+ action :stop, :with_capability => :stop_network_port do
90
+ description "Stop specific NetworkPort."
91
+ param :id, :string, :required
91
92
  control do
92
- vsp = VSP.find(params[:id], self)
93
- report_error(404) unless vsp
93
+ network_port = NetworkPort.find(params[:id], self)
94
+ report_error(404) unless network_port
94
95
  if request.content_type.end_with?("json")
95
96
  action = Action.from_json(request.body.read)
96
97
  else
97
98
  action = Action.from_xml(request.body.read)
98
99
  end
99
- vsp.perform(action, self) do |operation|
100
+ network_port.perform(action, self) do |operation|
100
101
  no_content_with_status(202) if operation.success?
101
102
  # Handle errors using operation.failure?
102
103
  end
@@ -24,7 +24,7 @@ module CIMI::Collections
24
24
  description 'List all Network Templates in the NetworkTemplateCollection'
25
25
  param :CIMISelect, :string, :optional
26
26
  control do
27
- network_templates = NetworkTemplateCollection.default(self).filter_by(params[:CIMISelect])
27
+ network_templates = NetworkTemplate.list(self).filter_by(params[:CIMISelect])
28
28
  respond_to do |format|
29
29
  format.xml {network_templates.to_xml}
30
30
  format.json {network_templates.to_json}
@@ -32,7 +32,7 @@ module CIMI::Collections
32
32
  end
33
33
  end
34
34
 
35
- operation :show, :with_capability => :network_template do
35
+ operation :show, :with_capability => :network_templates do
36
36
  description 'Show a specific Network Template'
37
37
  control do
38
38
  network_template = NetworkTemplate.find(params[:id], self)
@@ -25,7 +25,7 @@ module CIMI::Collections
25
25
  description "List all Networks"
26
26
  param :CIMISelect, :string, :optional
27
27
  control do
28
- networks = NetworkCollection.default(self).filter_by(params[:CIMISelect])
28
+ networks = Network.list(self).filter_by(params[:CIMISelect])
29
29
  respond_to do |format|
30
30
  format.xml { networks.to_xml }
31
31
  format.json { networks.to_json }
@@ -61,7 +61,6 @@ module CIMI::Collections
61
61
 
62
62
  operation :destroy, :with_capability => :delete_network do
63
63
  description "Delete a specified Network"
64
- param :id, :string, :required
65
64
  control do
66
65
  Network.delete!(params[:id], self)
67
66
  no_content_with_status(200)
@@ -70,6 +69,7 @@ module CIMI::Collections
70
69
 
71
70
  action :start, :with_capability => :start_network do
72
71
  description "Start specific network."
72
+ param :id, :string, :required
73
73
  control do
74
74
  network = Network.find(params[:id], self)
75
75
  report_error(404) unless network
@@ -87,6 +87,7 @@ module CIMI::Collections
87
87
 
88
88
  action :stop, :with_capability => :stop_network do
89
89
  description "Stop specific network."
90
+ param :id, :string, :required
90
91
  control do
91
92
  network = Network.find(params[:id], self)
92
93
  report_error(404) unless network
@@ -104,6 +105,7 @@ module CIMI::Collections
104
105
 
105
106
  action :suspend, :with_capability => :suspend_network do
106
107
  description "Suspend specific network."
108
+ param :id, :string, :required
107
109
  control do
108
110
  network = Network.find(params[:id], self)
109
111
  report_error(404) unless network
@@ -119,6 +121,19 @@ module CIMI::Collections
119
121
  end
120
122
  end
121
123
 
124
+ operation :network_ports, :with_capability => :network_ports do
125
+ description "Retrieve the Network's NetworkPortCollection"
126
+ param :id, :string, :required
127
+ control do
128
+ network_ports = NetworkPortCollection.for_network(params[:id], self)
129
+ respond_to do |format|
130
+ format.json {network_ports.to_json}
131
+ format.xml {network_ports.to_xml}
132
+ end
133
+ end
134
+ end
135
+
136
+
122
137
  end
123
138
 
124
139
  end
@@ -14,28 +14,28 @@
14
14
  # under the License.
15
15
 
16
16
  module CIMI::Collections
17
- class EntityMetadata < Base
17
+ class ResourceMetadata < Base
18
18
 
19
- collection :entity_metadata do
19
+ collection :resource_metadata do
20
20
 
21
21
  operation :index do
22
- description "List all entity metadata defined for this provider"
22
+ description "List all resource metadata defined for this provider"
23
23
  control do
24
- entity_metadata = CIMI::Model::EntityMetadataCollection.default(self)
24
+ resource_metadata = CIMI::Model::ResourceMetadata.list(self)
25
25
  respond_to do |format|
26
- format.xml{entity_metadata.to_xml}
27
- format.json{entity_metadata.to_json}
26
+ format.xml{resource_metadata.to_xml}
27
+ format.json{resource_metadata.to_json}
28
28
  end
29
29
  end
30
30
  end
31
31
 
32
32
  operation :show do
33
- description "Get the entity metadata for a specific collection"
33
+ description "Get the resource metadata for a specific collection"
34
34
  control do
35
- entity_metadata = EntityMetadata.find(params[:id], self)
35
+ resource_metadata = ResourceMetadata.find(params[:id], self)
36
36
  respond_to do |format|
37
- format.xml{entity_metadata.to_xml}
38
- format.json{entity_metadata.to_json}
37
+ format.xml{resource_metadata.to_xml}
38
+ format.json{resource_metadata.to_json}
39
39
  end
40
40
  end
41
41
  end