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
@@ -0,0 +1,101 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership. The
4
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the
6
+ # License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations
14
+ # under the License.
15
+
16
+ module CIMI::Model
17
+ class Collection < Base
18
+
19
+ class << self
20
+ attr_accessor :entry_name
21
+ end
22
+
23
+ # Make sure the base schema gets cloned
24
+ self.schema
25
+
26
+ def initialize(values = {})
27
+ if values[:entries]
28
+ values[self.class.entry_name] = values.delete(:entries)
29
+ end
30
+ super(values)
31
+ end
32
+
33
+ def entries
34
+ self[entry_name]
35
+ end
36
+
37
+ def [](a)
38
+ a = entry_name if a == :entries
39
+ super(a)
40
+ end
41
+
42
+ def []=(a, v)
43
+ a = entry_name if a == :entries
44
+ super(a, v)
45
+ end
46
+
47
+ def self.xml_tag_name
48
+ "Collection"
49
+ end
50
+
51
+ def self.generate(model_class)
52
+ model_name = model_class.name.split("::").last
53
+ coll_class = Class.new(CIMI::Model::Collection)
54
+ CIMI::Model.const_set(:"#{model_name}Collection", coll_class)
55
+ coll_class.entry_name = model_name.underscore.pluralize.to_sym
56
+ entry_schema = model_class.schema
57
+ coll_class.instance_eval do
58
+ text :count
59
+ array self.entry_name, :schema => entry_schema, :xml_name => model_name
60
+ array :operations do
61
+ scalar :rel, :href
62
+ end
63
+ end
64
+ coll_class
65
+ end
66
+ end
67
+
68
+ #
69
+ # We need to reopen Base and add some stuff to avoid circular dependencies
70
+ #
71
+ class Base
72
+ #
73
+ # Toplevel collections
74
+ #
75
+
76
+ class << self
77
+
78
+ attr_accessor :collection_class
79
+
80
+ def acts_as_root_entity(opts = {})
81
+ self.collection_class = Collection.generate(self)
82
+ CIMI::Model.register_as_root_entity! self, opts
83
+ end
84
+
85
+ # Return a collection of entities
86
+ def list(context)
87
+ entries = find(:all, context)
88
+ desc = "#{self.name.split("::").last} Collection for the #{context.driver.name.capitalize} driver"
89
+ id = context.send("#{collection_class.entry_name}_url")
90
+ collection_class.new(:id => id, :name => 'default',
91
+ :count => entries.size,
92
+ :entries => entries,
93
+ :description => desc)
94
+ end
95
+ end
96
+
97
+ def self.all(context)
98
+ find(:all, context)
99
+ end
100
+ end
101
+ end
@@ -13,7 +13,9 @@
13
13
  # License for the specific language governing permissions and limitations
14
14
  # under the License.
15
15
 
16
- class CIMI::Model::MachineAdmin < CIMI::Model::Base
16
+ class CIMI::Model::Credential < CIMI::Model::Base
17
+
18
+ acts_as_root_entity
17
19
 
18
20
  text :username
19
21
  text :password
@@ -35,8 +37,8 @@ class CIMI::Model::MachineAdmin < CIMI::Model::Base
35
37
  end
36
38
 
37
39
  def self.create_from_xml(body, context)
38
- machine_admin = MachineAdmin.from_xml(body)
39
- key = context.driver.create_key(context.credentials, :key_name => machine_admin.name)
40
+ credential = Credential.from_xml(body)
41
+ key = context.driver.create_key(context.credentials, :key_name => credential.name)
40
42
  from_key(key, context)
41
43
  end
42
44
 
@@ -52,7 +54,7 @@ class CIMI::Model::MachineAdmin < CIMI::Model::Base
52
54
  :username => key.username,
53
55
  :password => key.is_password? ? key.password : key.fingerprint,
54
56
  :key => key.is_key? ? key.pem_rsa_key : nil,
55
- :id => context.machine_admin_url(key.id),
57
+ :id => context.credential_url(key.id),
56
58
  :created => Time.now
57
59
  )
58
60
  end
@@ -16,7 +16,7 @@ class CIMI::Model::DiskCollection < CIMI::Model::Base
16
16
  text :count
17
17
 
18
18
  #add disks array:
19
- self.schema.add_collection_member_array(CIMI::Model::Disk)
19
+ self << CIMI::Model::Disk
20
20
 
21
21
  array :operations do
22
22
  scalar :rel, :href
@@ -26,7 +26,6 @@ class CIMI::Model::DiskCollection < CIMI::Model::Base
26
26
  instance = context.driver.instance(context.credentials, :id=>instance_id)
27
27
  machine_conf = CIMI::Model::MachineConfiguration.find(instance.instance_profile.name, context)
28
28
  disks = CIMI::Model::Disk.find(instance, machine_conf, context, :all)
29
- storage_override = instance.instance_profile.overrides.find { |p, v| p == :storage }
30
29
  self.new(
31
30
  :id => context.machine_url(instance_id)+"/disks",
32
31
  :description => "DiskCollection for Machine #{instance_id}",
@@ -13,7 +13,9 @@
13
13
  # License for the specific language governing permissions and limitations
14
14
  # under the License.
15
15
 
16
- class CIMI::Model::RoutingGroupTemplate < CIMI::Model::Base
16
+ class CIMI::Model::ForwardingGroup < CIMI::Model::Base
17
+
18
+ acts_as_root_entity
17
19
 
18
20
  array :networks do
19
21
  scalar :href
@@ -25,9 +27,9 @@ class CIMI::Model::RoutingGroupTemplate < CIMI::Model::Base
25
27
 
26
28
  def self.find(id, context)
27
29
  if id==:all
28
- context.driver.routing_group_templates(context.credentials, {:env=>context})
30
+ context.driver.forwarding_groups(context.credentials, {:env=>context})
29
31
  else
30
- context.driver.routing_group_templates(context.credentials, {:env=>context, :id=>id})
32
+ context.driver.forwarding_groups(context.credentials, {:env=>context, :id=>id})
31
33
  end
32
34
  end
33
35
 
@@ -13,7 +13,9 @@
13
13
  # License for the specific language governing permissions and limitations
14
14
  # under the License.
15
15
 
16
- class CIMI::Model::RoutingGroup < CIMI::Model::Base
16
+ class CIMI::Model::ForwardingGroupTemplate < CIMI::Model::Base
17
+
18
+ acts_as_root_entity
17
19
 
18
20
  array :networks do
19
21
  scalar :href
@@ -25,9 +27,9 @@ class CIMI::Model::RoutingGroup < CIMI::Model::Base
25
27
 
26
28
  def self.find(id, context)
27
29
  if id==:all
28
- context.driver.routing_groups(context.credentials, {:env=>context})
30
+ context.driver.forwarding_group_templates(context.credentials, {:env=>context})
29
31
  else
30
- context.driver.routing_groups(context.credentials, {:env=>context, :id=>id})
32
+ context.driver.forwarding_group_templates(context.credentials, {:env=>context, :id=>id})
31
33
  end
32
34
  end
33
35
 
@@ -15,6 +15,8 @@
15
15
 
16
16
  class CIMI::Model::Machine < CIMI::Model::Base
17
17
 
18
+ acts_as_root_entity
19
+
18
20
  text :state
19
21
  text :cpu
20
22
 
@@ -63,8 +65,8 @@ class CIMI::Model::Machine < CIMI::Model::Base
63
65
  image_id = machine_template['machineImage'][0]["href"].split('/').last
64
66
  additional_params = {}
65
67
  additional_params[:name] =xml['name'][0] if xml['name']
66
- if machine_template.has_key? 'machineAdmin'
67
- additional_params[:keyname] = machine_template['machineAdmin'][0]["href"].split('/').last
68
+ if machine_template.has_key? 'credential'
69
+ additional_params[:keyname] = machine_template['credential'][0]["href"].split('/').last
68
70
  end
69
71
  instance = context.driver.create_instance(context.credentials, image_id, {
70
72
  :hwp_id => hardware_profile_id
@@ -88,9 +90,9 @@ class CIMI::Model::Machine < CIMI::Model::Base
88
90
  context.driver.destroy_instance(context.credentials, id)
89
91
  end
90
92
 
91
- def self.create_entity_metadata(context)
92
- cimi_entity = self.name.split("::").last
93
- metadata = CIMI::Model::EntityMetadata.metadata_from_deltacloud_features(cimi_entity, :instances, context)
93
+ def self.create_resource_metadata(context)
94
+ cimi_resource = self.name.split("::").last
95
+ metadata = CIMI::Model::ResourceMetadata.metadata_from_deltacloud_features(cimi_resource, :instances, context)
94
96
  unless metadata.includes_attribute?(:name)
95
97
  metadata.attributes << {:name=>"name", :required=>"false",
96
98
  :constraints=>"Determined by the cloud provider", :type=>"xs:string"}
@@ -143,7 +145,7 @@ class CIMI::Model::Machine < CIMI::Model::Base
143
145
  properties = {}
144
146
  properties["machine_image"] = context.machine_image_url(instance.image_id)
145
147
  if instance.respond_to? :keyname
146
- properties["machine_admin"] = context.machine_admin_url(instance.keyname)
148
+ properties["credential"] = context.credential_url(instance.keyname)
147
149
  end
148
150
  properties
149
151
  end
@@ -180,7 +182,7 @@ class CIMI::Model::Machine < CIMI::Model::Base
180
182
  instance.actions.collect do |action|
181
183
  action = :destroy if action == :delete # In CIMI destroy operation become delete
182
184
  action = :restart if action == :reboot # In CIMI reboot operation become restart
183
- { :href => context.send(:"#{action}_machine_url", instance.id), :rel => "http://www.dmtf.org/cimi/action/#{action}" }
185
+ { :href => context.send(:"#{action}_machine_url", instance.id), :rel => "http://schemas.dmtf.org/cimi/1/action/#{action}" }
184
186
  end
185
187
  end
186
188
 
@@ -15,6 +15,8 @@
15
15
 
16
16
  class CIMI::Model::MachineConfiguration < CIMI::Model::Base
17
17
 
18
+ acts_as_root_entity :as => "machineConfigs"
19
+
18
20
  text :memory
19
21
  text :cpu
20
22
 
@@ -15,6 +15,8 @@
15
15
 
16
16
  class CIMI::Model::MachineImage < CIMI::Model::Base
17
17
 
18
+ acts_as_root_entity
19
+
18
20
  href :image_location
19
21
  text :image_data
20
22
 
@@ -15,9 +15,11 @@
15
15
 
16
16
  class CIMI::Model::MachineTemplate < CIMI::Model::Base
17
17
 
18
+ acts_as_root_entity
19
+
18
20
  href :machine_config
19
21
  href :machine_image
20
- href :machine_admin
22
+ href :credential
21
23
 
22
24
  array :volumes do
23
25
  scalar :href
@@ -16,7 +16,7 @@ class CIMI::Model::MachineVolumeCollection < CIMI::Model::Base
16
16
 
17
17
  text :count
18
18
 
19
- self.schema.add_collection_member_array(CIMI::Model::MachineVolume)
19
+ self << CIMI::Model::MachineVolume
20
20
 
21
21
  array :operations do
22
22
  scalar :rel, :href
@@ -15,6 +15,8 @@
15
15
 
16
16
  class CIMI::Model::Network < CIMI::Model::Base
17
17
 
18
+ acts_as_root_entity
19
+
18
20
  text :state
19
21
 
20
22
  text :network_type
@@ -15,17 +15,13 @@
15
15
 
16
16
  class CIMI::Model::NetworkConfiguration < CIMI::Model::Base
17
17
 
18
- text :access
18
+ acts_as_root_entity :as => "networkConfigs"
19
19
 
20
- text :bandwidth_limit
20
+ text :network_type
21
21
 
22
- text :traffic_priority
22
+ text :mtu
23
23
 
24
- text :max_traffic_delay
25
-
26
- text :max_traffic_loss
27
-
28
- text :max_traffic_jitter
24
+ text :class_of_service
29
25
 
30
26
  array :operations do
31
27
  scalar :rel, :href
@@ -13,21 +13,17 @@
13
13
  # License for the specific language governing permissions and limitations
14
14
  # under the License.
15
15
 
16
- class CIMI::Model::VSP < CIMI::Model::Base
16
+ class CIMI::Model::NetworkPort < CIMI::Model::Base
17
+
18
+ acts_as_root_entity
17
19
 
18
20
  text :state
19
21
 
20
22
  href :network
21
23
 
22
- text :bandwidth_reservation
23
-
24
- text :traffic_priority
25
-
26
- text :max_traffic_delay
27
-
28
- text :max_traffic_loss
24
+ text :port_type
29
25
 
30
- text :max_traffic_jitter
26
+ text :class_of_service
31
27
 
32
28
  href :event_log
33
29
 
@@ -41,9 +37,9 @@ class CIMI::Model::VSP < CIMI::Model::Base
41
37
 
42
38
  def self.find(id, context)
43
39
  if id==:all
44
- context.driver.vsps(context.credentials, {:env=>context})
40
+ context.driver.network_ports(context.credentials, {:env=>context})
45
41
  else
46
- context.driver.vsps(context.credentials, {:id=>id, :env=>context})
42
+ context.driver.network_ports(context.credentials, {:id=>id, :env=>context})
47
43
  end
48
44
  end
49
45
 
@@ -13,21 +13,38 @@
13
13
  # License for the specific language governing permissions and limitations
14
14
  # under the License.
15
15
 
16
- class CIMI::Model::NetworkConfigurationCollection < CIMI::Model::Base
16
+ class CIMI::Model::NetworkPortCollection < CIMI::Model::Base
17
17
 
18
- act_as_root_entity :network_configuration
18
+ act_as_root_entity :network_port
19
19
 
20
- array :network_configurations do
21
- scalar :href
22
- end
20
+ text :count
21
+
22
+ #add member array:
23
+ self << CIMI::Model::NetworkPort
23
24
 
24
25
  def self.default(context)
26
+ network_ports = CIMI::Model::NetworkPort.all(context)
27
+ self.new(
28
+ :id => context.network_ports_url,
29
+ :name => 'default',
30
+ :created => Time.now,
31
+ :description => "#{context.driver.name.capitalize} NetworkPortCollection",
32
+ :count => network_ports.size,
33
+ :network_ports => network_ports
34
+ )
35
+ end
36
+
37
+ def self.for_network(network_id, context)
38
+ net_url = context.network_url(network_id)
39
+ network_ports = CIMI::Model::NetworkPort.all(context)
40
+ ports_collection = network_ports.inject([]){|res, current| res << current if current.network.href == net_url ; res}
25
41
  self.new(
26
- :id => context.network_configurations_url,
42
+ :id => net_url+"/network_ports",
27
43
  :name => 'default',
28
44
  :created => Time.now,
29
- :description => "#{context.driver.name.capitalize} NetworkConfigurationCollection",
30
- :network_configurations => CIMI::Model::NetworkConfiguration.all(context).map { |c| { :href => c.id } }
45
+ :description => "#{context.driver.name.capitalize} NetworkPortCollection",
46
+ :count => ports_collection.size,
47
+ :network_ports => ports_collection
31
48
  )
32
49
  end
33
50
 
@@ -13,17 +13,13 @@
13
13
  # License for the specific language governing permissions and limitations
14
14
  # under the License.
15
15
 
16
- class CIMI::Model::VSPConfiguration < CIMI::Model::Base
16
+ class CIMI::Model::NetworkPortConfiguration < CIMI::Model::Base
17
17
 
18
- text :bandwidth_reservation
18
+ acts_as_root_entity :as => "networkPortConfigs"
19
19
 
20
- text :traffic_priority
20
+ text :class_of_service
21
21
 
22
- text :max_traffic_delay
23
-
24
- text :max_traffic_loss
25
-
26
- text :max_traffic_jitter
22
+ text :port_type
27
23
 
28
24
  array :operations do
29
25
  scalar :rel, :href
@@ -31,9 +27,9 @@ class CIMI::Model::VSPConfiguration < CIMI::Model::Base
31
27
 
32
28
  def self.find(id, context)
33
29
  if id==:all
34
- context.driver.vsp_configurations(context.credentials, {:env=>context})
30
+ context.driver.network_port_configurations(context.credentials, {:env=>context})
35
31
  else
36
- context.driver.vsp_configurations(context.credentials, {:env=>context, :id=>id})
32
+ context.driver.network_port_configurations(context.credentials, {:env=>context, :id=>id})
37
33
  end
38
34
  end
39
35
 
@@ -12,23 +12,23 @@
12
12
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
13
  # License for the specific language governing permissions and limitations
14
14
  # under the License.
15
- class CIMI::Model::NetworkCollection < CIMI::Model::Base
15
+ class CIMI::Model::NetworkPortConfigurationCollection < CIMI::Model::Base
16
+
17
+ act_as_root_entity :network_port_configuration
16
18
 
17
- act_as_root_entity :network
18
19
  text :count
19
20
 
20
- #add networks Array:
21
- self.schema.add_collection_member_array(CIMI::Model::Network)
21
+ self << CIMI::Model::NetworkPortConfiguration
22
22
 
23
23
  def self.default(context)
24
- networks = CIMI::Model::Network.all(context)
24
+ network_port_configurations = CIMI::Model::NetworkPortConfiguration.all(context)
25
25
  self.new(
26
- :id => context.networks_url,
26
+ :id => context.network_port_configurations_url,
27
27
  :name => 'default',
28
28
  :created => Time.now,
29
- :description => "#{context.driver.name.capitalize} NetworkCollection",
30
- :count => networks.size,
31
- :networks => networks
29
+ :description => "#{context.driver.name.capitalize} NetworkPortConfigurationCollection",
30
+ :count => network_port_configurations.size,
31
+ :network_port_configurations => network_port_configurations
32
32
  )
33
33
  end
34
34