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.
- data/LICENSE +23 -0
- data/NOTICE +3 -0
- data/Rakefile +32 -20
- data/bin/deltacloudd +1 -1
- data/config.ru +25 -32
- data/deltacloud-core.gemspec +1 -1
- data/lib/cimi/collections.rb +4 -1
- data/lib/cimi/collections/address_templates.rb +2 -2
- data/lib/cimi/collections/addresses.rb +1 -1
- data/lib/cimi/collections/base.rb +64 -0
- data/lib/cimi/collections/{machine_admins.rb → credentials.rb} +12 -12
- data/lib/cimi/collections/{vsp_templates.rb → forwarding_group_templates.rb} +12 -16
- data/lib/cimi/collections/{vsp_configurations.rb → forwarding_groups.rb} +12 -13
- data/lib/cimi/collections/machine_configurations.rb +2 -2
- data/lib/cimi/collections/machine_images.rb +1 -1
- data/lib/cimi/collections/machines.rb +8 -2
- data/lib/cimi/collections/network_configurations.rb +2 -2
- data/lib/cimi/collections/{routing_groups.rb → network_port_configurations.rb} +12 -12
- data/lib/cimi/collections/{routing_group_templates.rb → network_port_templates.rb} +15 -12
- data/lib/cimi/collections/{vsps.rb → network_ports.rb} +33 -32
- data/lib/cimi/collections/network_templates.rb +2 -2
- data/lib/cimi/collections/networks.rb +17 -2
- data/lib/cimi/collections/{entity_metadata.rb → resource_metadata.rb} +10 -10
- data/lib/cimi/collections/volume_configurations.rb +1 -1
- data/lib/cimi/collections/volume_images.rb +1 -1
- data/lib/cimi/collections/volumes.rb +1 -2
- data/lib/cimi/dependencies.rb +1 -1
- data/lib/cimi/helpers.rb +3 -84
- data/lib/cimi/helpers/cimi_helper.rb +15 -14
- data/lib/cimi/models.rb +20 -36
- data/lib/cimi/models/address.rb +32 -4
- data/lib/cimi/models/address_template.rb +2 -2
- data/lib/cimi/models/base.rb +24 -5
- data/lib/cimi/models/cloud_entry_point.rb +4 -9
- data/lib/cimi/models/collection.rb +101 -0
- data/lib/cimi/models/{machine_admin.rb → credential.rb} +6 -4
- data/lib/cimi/models/disk_collection.rb +1 -2
- data/lib/cimi/models/{routing_group_template.rb → forwarding_group.rb} +5 -3
- data/lib/cimi/models/{routing_group.rb → forwarding_group_template.rb} +5 -3
- data/lib/cimi/models/machine.rb +9 -7
- data/lib/cimi/models/machine_configuration.rb +2 -0
- data/lib/cimi/models/machine_image.rb +2 -0
- data/lib/cimi/models/machine_template.rb +3 -1
- data/lib/cimi/models/machine_volume_collection.rb +1 -1
- data/lib/cimi/models/network.rb +2 -0
- data/lib/cimi/models/network_configuration.rb +4 -8
- data/lib/cimi/models/{vsp.rb → network_port.rb} +7 -11
- data/lib/cimi/models/{network_configuration_collection.rb → network_port_collection.rb} +25 -8
- data/lib/cimi/models/{vsp_configuration.rb → network_port_configuration.rb} +6 -10
- data/lib/cimi/models/{network_collection.rb → network_port_configuration_collection.rb} +9 -9
- data/lib/cimi/models/{vsp_template.rb → network_port_template.rb} +6 -4
- data/lib/cimi/models/{network_template_collection.rb → network_port_template_collection.rb} +10 -8
- data/lib/cimi/models/network_template.rb +3 -1
- data/lib/cimi/models/{entity_metadata.rb → resource_metadata.rb} +16 -15
- data/lib/cimi/models/schema.rb +23 -12
- data/lib/cimi/models/volume.rb +2 -0
- data/lib/cimi/models/volume_configuration.rb +2 -0
- data/lib/cimi/models/volume_image.rb +2 -0
- data/lib/cimi/models/volume_template.rb +2 -0
- data/lib/cimi/server.rb +10 -6
- data/lib/deltacloud/collections.rb +7 -2
- data/lib/deltacloud/collections/addresses.rb +3 -1
- data/lib/deltacloud/collections/base.rb +64 -0
- data/lib/deltacloud/collections/buckets.rb +14 -4
- data/lib/deltacloud/collections/drivers.rb +1 -1
- data/lib/deltacloud/collections/firewalls.rb +1 -1
- data/lib/deltacloud/collections/instances.rb +5 -1
- data/lib/deltacloud/collections/keys.rb +1 -1
- data/lib/deltacloud/collections/load_balancers.rb +2 -0
- data/lib/deltacloud/collections/storage_volumes.rb +3 -5
- data/lib/deltacloud/core_ext.rb +1 -0
- data/lib/deltacloud/core_ext/hash.rb +8 -0
- data/lib/deltacloud/core_ext/ordered_hash.rb +222 -0
- data/lib/deltacloud/core_ext/string.rb +9 -0
- data/lib/deltacloud/drivers/aruba/aruba_driver.rb +0 -9
- data/lib/deltacloud/drivers/base_driver.rb +22 -4
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +0 -4
- data/lib/deltacloud/drivers/exceptions.rb +30 -13
- data/lib/deltacloud/drivers/features.rb +7 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +1 -9
- data/lib/deltacloud/drivers/google/google_driver.rb +13 -0
- data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.1.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.2.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.3.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.4.yml +3 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +65 -1
- data/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +55 -32
- data/lib/deltacloud/drivers/openstack/openstack_driver.rb +18 -6
- data/lib/deltacloud/helpers.rb +0 -75
- data/lib/deltacloud/helpers/deltacloud_helper.rb +66 -28
- data/lib/deltacloud/helpers/driver_helper.rb +7 -0
- data/lib/deltacloud/helpers/rabbit_helper.rb +51 -0
- data/lib/deltacloud/server.rb +12 -14
- data/lib/deltacloud/version.rb +1 -1
- data/lib/deltacloud_rack.rb +26 -2
- data/lib/ec2/query_parser.rb +18 -3
- data/lib/sinatra/rack_accept.rb +7 -2
- data/lib/sinatra/rack_matrix_params.rb +14 -14
- data/public/javascripts/cmwgapp.js +2 -2
- data/tests/cimi/collections/cloud_entry_point_test.rb +3 -3
- data/tests/cimi/collections/machine_images_test.rb +2 -2
- data/tests/cimi/collections/machines_test.rb +1 -1
- data/tests/cimi/collections/url_helper_test.rb +31 -0
- data/tests/cimi/spec/cimi/model/{machine_admin_spec.rb → credential_spec.rb} +4 -4
- data/tests/deltacloud/base_collection_test.rb +0 -5
- data/tests/deltacloud/collections/buckets_collection_test.rb +1 -1
- data/tests/deltacloud/collections/drivers_collection_test.rb +1 -1
- data/tests/deltacloud/collections/hardware_profiles_collection_test.rb +1 -1
- data/tests/deltacloud/collections/images_collection_test.rb +1 -1
- data/tests/deltacloud/collections/instance_states_collection_test.rb +1 -1
- data/tests/deltacloud/collections/instances_collection_test.rb +1 -1
- data/tests/deltacloud/collections/keys_collection_test.rb +1 -4
- data/tests/deltacloud/deltacloud_helper_test.rb +0 -9
- data/tests/deltacloud/server_test.rb +1 -1
- data/tests/drivers/base/base_driver_test.rb +30 -0
- data/tests/drivers/base/common.rb +14 -0
- data/tests/drivers/base/exceptions_test.rb +64 -0
- data/tests/drivers/ec2/buckets_test.rb +45 -0
- data/tests/drivers/ec2/keys_test.rb +1 -1
- data/tests/drivers/google/buckets_test.rb +2 -2
- data/tests/drivers/google/common.rb +3 -3
- data/tests/test_helper.rb +28 -0
- data/views/api/show.html.haml +2 -2
- data/views/api/show.xml.haml +1 -1
- data/views/buckets/index.html.haml +1 -1
- data/views/cimi/cloudEntryPoint/index.xml.haml +1 -1
- data/views/cimi/collection/index.html.haml +3 -3
- data/views/cimi/collection/response.xml.haml +1 -1
- data/views/cimi/error.html.haml +1 -1
- data/views/cimi/errors/500.xml.haml +1 -1
- data/views/cimi/layout.html.haml +1 -1
- data/views/cimi/machine_configurations/show.html.haml +2 -2
- data/views/cimi/machine_configurations/show.xml.haml +1 -1
- data/views/cimi/machine_images/show.html.haml +2 -2
- data/views/cimi/machine_images/show.xml.haml +1 -1
- data/views/cimi/machines/show.html.haml +2 -2
- data/views/cimi/machines/show.xml.haml +1 -1
- data/views/cimi/volumes/show.html.haml +2 -2
- data/views/cimi/volumes/show.xml.haml +1 -1
- data/views/docs/collection.html.haml +1 -1
- data/views/docs/collection.xml.haml +2 -2
- data/views/docs/index.html.haml +1 -1
- data/views/docs/index.xml.haml +1 -1
- data/views/docs/operation.xml.haml +1 -1
- data/views/error.html.haml +1 -1
- data/views/errors/500.html.haml +7 -4
- data/views/firewalls/index.html.haml +1 -1
- data/views/firewalls/show.html.haml +1 -1
- data/views/images/show.html.haml +2 -2
- data/views/index.html.haml +9 -0
- data/views/instance_states/show.html.haml +1 -1
- data/views/instances/run_command.html.haml +1 -1
- data/views/instances/show.html.haml +2 -2
- data/views/keys/index.html.haml +1 -1
- data/views/layout.html.haml +1 -1
- data/views/load_balancers/index.html.haml +1 -1
- data/views/load_balancers/show.html.haml +3 -3
- data/views/storage_snapshots/show.html.haml +1 -1
- data/views/storage_volumes/attach.html.haml +1 -1
- data/views/storage_volumes/index.html.haml +1 -1
- data/views/storage_volumes/show.html.haml +4 -4
- metadata +40 -43
- data/lib/cimi/models/address_collection.rb +0 -34
- data/lib/cimi/models/address_template_collection.rb +0 -34
- data/lib/cimi/models/entity_metadata_collection.rb +0 -31
- data/lib/cimi/models/machine_admin_collection.rb +0 -34
- data/lib/cimi/models/machine_collection.rb +0 -37
- data/lib/cimi/models/machine_configuration_collection.rb +0 -36
- data/lib/cimi/models/machine_image_collection.rb +0 -36
- data/lib/cimi/models/machine_template_collection.rb +0 -36
- data/lib/cimi/models/routing_group_collection.rb +0 -34
- data/lib/cimi/models/routing_group_template_collection.rb +0 -35
- data/lib/cimi/models/volume_collection.rb +0 -36
- data/lib/cimi/models/volume_configuration_collection.rb +0 -36
- data/lib/cimi/models/volume_image_collection.rb +0 -36
- data/lib/cimi/models/volume_template_collection.rb +0 -36
- data/lib/cimi/models/vsp_collection.rb +0 -34
- data/lib/cimi/models/vsp_configuration_collection.rb +0 -34
- data/lib/cimi/models/vsp_template_collection.rb +0 -34
- 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::
|
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
|
-
|
39
|
-
key = context.driver.create_key(context.credentials, :key_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.
|
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
|
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::
|
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.
|
30
|
+
context.driver.forwarding_groups(context.credentials, {:env=>context})
|
29
31
|
else
|
30
|
-
context.driver.
|
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::
|
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.
|
30
|
+
context.driver.forwarding_group_templates(context.credentials, {:env=>context})
|
29
31
|
else
|
30
|
-
context.driver.
|
32
|
+
context.driver.forwarding_group_templates(context.credentials, {:env=>context, :id=>id})
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
data/lib/cimi/models/machine.rb
CHANGED
@@ -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? '
|
67
|
-
additional_params[:keyname] = machine_template['
|
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.
|
92
|
-
|
93
|
-
metadata = CIMI::Model::
|
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["
|
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://
|
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
|
|
data/lib/cimi/models/network.rb
CHANGED
@@ -15,17 +15,13 @@
|
|
15
15
|
|
16
16
|
class CIMI::Model::NetworkConfiguration < CIMI::Model::Base
|
17
17
|
|
18
|
-
|
18
|
+
acts_as_root_entity :as => "networkConfigs"
|
19
19
|
|
20
|
-
text :
|
20
|
+
text :network_type
|
21
21
|
|
22
|
-
text :
|
22
|
+
text :mtu
|
23
23
|
|
24
|
-
text :
|
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::
|
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 :
|
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 :
|
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.
|
40
|
+
context.driver.network_ports(context.credentials, {:env=>context})
|
45
41
|
else
|
46
|
-
context.driver.
|
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::
|
16
|
+
class CIMI::Model::NetworkPortCollection < CIMI::Model::Base
|
17
17
|
|
18
|
-
act_as_root_entity :
|
18
|
+
act_as_root_entity :network_port
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
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 =>
|
42
|
+
:id => net_url+"/network_ports",
|
27
43
|
:name => 'default',
|
28
44
|
:created => Time.now,
|
29
|
-
:description => "#{context.driver.name.capitalize}
|
30
|
-
:
|
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::
|
16
|
+
class CIMI::Model::NetworkPortConfiguration < CIMI::Model::Base
|
17
17
|
|
18
|
-
|
18
|
+
acts_as_root_entity :as => "networkPortConfigs"
|
19
19
|
|
20
|
-
text :
|
20
|
+
text :class_of_service
|
21
21
|
|
22
|
-
text :
|
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.
|
30
|
+
context.driver.network_port_configurations(context.credentials, {:env=>context})
|
35
31
|
else
|
36
|
-
context.driver.
|
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::
|
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
|
-
|
21
|
-
self.schema.add_collection_member_array(CIMI::Model::Network)
|
21
|
+
self << CIMI::Model::NetworkPortConfiguration
|
22
22
|
|
23
23
|
def self.default(context)
|
24
|
-
|
24
|
+
network_port_configurations = CIMI::Model::NetworkPortConfiguration.all(context)
|
25
25
|
self.new(
|
26
|
-
:id => context.
|
26
|
+
:id => context.network_port_configurations_url,
|
27
27
|
:name => 'default',
|
28
28
|
:created => Time.now,
|
29
|
-
:description => "#{context.driver.name.capitalize}
|
30
|
-
:count =>
|
31
|
-
:
|
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
|
|