From: marios <[email protected]>
Signed-off-by: marios <[email protected]> --- .../cimi/collections/forwarding_group_templates.rb | 48 +++++++++++++++++++++ server/lib/cimi/collections/forwarding_groups.rb | 49 ++++++++++++++++++++++ .../cimi/collections/routing_group_templates.rb | 48 --------------------- server/lib/cimi/collections/routing_groups.rb | 49 ---------------------- server/lib/cimi/models.rb | 8 ++-- server/lib/cimi/models/forwarding_group.rb | 34 +++++++++++++++ .../lib/cimi/models/forwarding_group_collection.rb | 36 ++++++++++++++++ .../lib/cimi/models/forwarding_group_template.rb | 34 +++++++++++++++ .../models/forwarding_group_template_collection.rb | 37 ++++++++++++++++ server/lib/cimi/models/routing_group.rb | 34 --------------- server/lib/cimi/models/routing_group_collection.rb | 34 --------------- server/lib/cimi/models/routing_group_template.rb | 34 --------------- .../models/routing_group_template_collection.rb | 35 ---------------- .../drivers/mock/data/cimi/address/address1.json | 19 --------- .../drivers/mock/data/cimi/address/address2.json | 19 --------- .../drivers/mock/data/cimi/address/address3.json | 19 --------- .../mock/data/cimi/forwarding_group/group1.json | 13 ++++++ .../cimi/forwarding_group_template/template1.json | 12 ++++++ .../mock/data/cimi/routing_group/group1.json | 13 ------ .../cimi/routing_group_template/template1.json | 12 ------ .../drivers/mock/mock_driver_cimi_methods.rb | 31 +++++++++----- 21 files changed, 288 insertions(+), 330 deletions(-) create mode 100644 server/lib/cimi/collections/forwarding_group_templates.rb create mode 100644 server/lib/cimi/collections/forwarding_groups.rb delete mode 100644 server/lib/cimi/collections/routing_group_templates.rb delete mode 100644 server/lib/cimi/collections/routing_groups.rb create mode 100644 server/lib/cimi/models/forwarding_group.rb create mode 100644 server/lib/cimi/models/forwarding_group_collection.rb create mode 100644 server/lib/cimi/models/forwarding_group_template.rb create mode 100644 server/lib/cimi/models/forwarding_group_template_collection.rb delete mode 100644 server/lib/cimi/models/routing_group.rb delete mode 100644 server/lib/cimi/models/routing_group_collection.rb delete mode 100644 server/lib/cimi/models/routing_group_template.rb delete mode 100644 server/lib/cimi/models/routing_group_template_collection.rb delete mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/address/address1.json delete mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/address/address2.json delete mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/address/address3.json create mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group/group1.json create mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group_template/template1.json delete mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/routing_group/group1.json delete mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json diff --git a/server/lib/cimi/collections/forwarding_group_templates.rb b/server/lib/cimi/collections/forwarding_group_templates.rb new file mode 100644 index 0000000..c4217a9 --- /dev/null +++ b/server/lib/cimi/collections/forwarding_group_templates.rb @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +module CIMI::Collections + class ForwardingGroupTemplates < Base + + set :capability, lambda { |m| driver.respond_to? m } + + collection :forwarding_group_templates do + + operation :index, :with_capability => :forwarding_groups do + description 'List all ForwardingGroupTemplates in the ForwardingGroupTemplateCollection' + param :CIMISelect, :string, :optional + control do + forwarding_group_templates = ForwardingGroupTemplateCollection.default(self).filter_by(params[:CIMISelect]) + respond_to do |format| + format.xml {forwarding_group_templates.to_xml} + format.json {forwarding_group_templates.to_json} + end + end + end + + operation :show, :with_capability => :forwarding_groups do + description 'Show a specific ForwardingGroupTemplate' + control do + forwarding_group_template = ForwardingGroupTemplate.find(params[:id], self) + respond_to do |format| + format.xml {forwarding_group_template.to_xml} + format.json {forwarding_group_template.to_json} + end + end + end + end + + end +end diff --git a/server/lib/cimi/collections/forwarding_groups.rb b/server/lib/cimi/collections/forwarding_groups.rb new file mode 100644 index 0000000..dd17fde --- /dev/null +++ b/server/lib/cimi/collections/forwarding_groups.rb @@ -0,0 +1,49 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +module CIMI::Collections + class ForwardingGroups < Base + + set :capability, lambda { |m| driver.respond_to? m } + + collection :forwarding_groups do + + operation :index, :with_capability => :forwarding_groups do + description 'List all ForwardingGroups in the ForwardingGroupsCollection' + param :CIMISelect, :string, :optional + control do + forwarding_groups = ForwardingGroupCollection.default(self).filter_by(params[:CIMISelect]) + respond_to do |format| + format.xml {forwarding_groups.to_xml} + format.json {forwarding_groups.to_json} + end + end + end + + operation :show, :with_capability => :forwarding_groups do + description 'Show a specific ForwardingGroup' + control do + forwarding_group = ForwardingGroup.find(params[:id], self) + respond_to do |format| + format.xml {forwarding_group.to_xml} + format.json {forwarding_group.to_json} + end + end + end + + end + + end +end diff --git a/server/lib/cimi/collections/routing_group_templates.rb b/server/lib/cimi/collections/routing_group_templates.rb deleted file mode 100644 index d320d28..0000000 --- a/server/lib/cimi/collections/routing_group_templates.rb +++ /dev/null @@ -1,48 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -module CIMI::Collections - class RoutingGroupTemplates < Base - - set :capability, lambda { |m| driver.respond_to? m } - - collection :routing_group_templates do - - operation :index, :with_capability => :routing_groups do - description 'List all RoutingGroupTemplates in the RoutingGroupTemplateCollection' - param :CIMISelect, :string, :optional - control do - routing_group_templates = RoutingGroupTemplateCollection.default(self).filter_by(params[:CIMISelect]) - respond_to do |format| - format.xml {routing_group_templates.to_xml} - format.json {routing_group_templates.to_json} - end - end - end - - operation :show, :with_capability => :routing_group do - description 'Show a specific RoutingGroupTemplate' - control do - routing_group_template = RoutingGroupTemplate.find(params[:id], self) - respond_to do |format| - format.xml {routing_group_template.to_xml} - format.json {routing_group_template.to_json} - end - end - end - end - - end -end diff --git a/server/lib/cimi/collections/routing_groups.rb b/server/lib/cimi/collections/routing_groups.rb deleted file mode 100644 index 751290c..0000000 --- a/server/lib/cimi/collections/routing_groups.rb +++ /dev/null @@ -1,49 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -module CIMI::Collections - class RoutingGroups < Base - - set :capability, lambda { |m| driver.respond_to? m } - - collection :routing_groups do - - operation :index, :with_capability => :routing_groups do - description 'List all RoutingGroups in the RoutingGroupsCollection' - param :CIMISelect, :string, :optional - control do - routing_groups = RoutingGroupCollection.default(self).filter_by(params[:CIMISelect]) - respond_to do |format| - format.xml {routing_groups.to_xml} - format.json {routing_groups.to_json} - end - end - end - - operation :show, :with_capability => :routing_group do - description 'Show a specific RoutingGroup' - control do - routing_group = RoutingGroup.find(params[:id], self) - respond_to do |format| - format.xml {routing_group.to_xml} - format.json {routing_group.to_json} - end - end - end - - end - - end -end diff --git a/server/lib/cimi/models.rb b/server/lib/cimi/models.rb index 333f5bd..e66021e 100644 --- a/server/lib/cimi/models.rb +++ b/server/lib/cimi/models.rb @@ -50,10 +50,10 @@ require_relative './models/network_configuration' require_relative './models/network_configuration_collection' require_relative './models/network_template' require_relative './models/network_template_collection' -require_relative './models/routing_group' -require_relative './models/routing_group_collection' -require_relative './models/routing_group_template' -require_relative './models/routing_group_template_collection' +require_relative './models/forwarding_group' +require_relative './models/forwarding_group_collection' +require_relative './models/forwarding_group_template' +require_relative './models/forwarding_group_template_collection' require_relative './models/network_port' require_relative './models/network_port_collection' require_relative './models/network_port_configuration' diff --git a/server/lib/cimi/models/forwarding_group.rb b/server/lib/cimi/models/forwarding_group.rb new file mode 100644 index 0000000..edc038d --- /dev/null +++ b/server/lib/cimi/models/forwarding_group.rb @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +class CIMI::Model::ForwardingGroup < CIMI::Model::Base + + array :networks do + scalar :href + end + + array :operations do + scalar :rel, :href + end + + def self.find(id, context) + if id==:all + context.driver.forwarding_groups(context.credentials, {:env=>context}) + else + context.driver.forwarding_groups(context.credentials, {:env=>context, :id=>id}) + end + end + +end diff --git a/server/lib/cimi/models/forwarding_group_collection.rb b/server/lib/cimi/models/forwarding_group_collection.rb new file mode 100644 index 0000000..a54d5a7 --- /dev/null +++ b/server/lib/cimi/models/forwarding_group_collection.rb @@ -0,0 +1,36 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +class CIMI::Model::ForwardingGroupCollection < CIMI::Model::Base + + act_as_root_entity :forwarding_group + + text :count + + self << CIMI::Model::ForwardingGroup + + def self.default(context) + forwarding_groups = CIMI::Model::ForwardingGroup.all(context) + self.new( + :id => context.forwarding_groups_url, + :name => 'default', + :created => Time.now, + :description => "#{context.driver.name.capitalize} ForwardingGroupCollection", + :count => forwarding_groups.size, + :forwarding_groups => forwarding_groups + ) + end + +end diff --git a/server/lib/cimi/models/forwarding_group_template.rb b/server/lib/cimi/models/forwarding_group_template.rb new file mode 100644 index 0000000..1c54d23 --- /dev/null +++ b/server/lib/cimi/models/forwarding_group_template.rb @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +class CIMI::Model::ForwardingGroupTemplate < CIMI::Model::Base + + array :networks do + scalar :href + end + + array :operations do + scalar :rel, :href + end + + def self.find(id, context) + if id==:all + context.driver.forwarding_group_templates(context.credentials, {:env=>context}) + else + context.driver.forwarding_group_templates(context.credentials, {:env=>context, :id=>id}) + end + end + +end diff --git a/server/lib/cimi/models/forwarding_group_template_collection.rb b/server/lib/cimi/models/forwarding_group_template_collection.rb new file mode 100644 index 0000000..f6d6a18 --- /dev/null +++ b/server/lib/cimi/models/forwarding_group_template_collection.rb @@ -0,0 +1,37 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +class CIMI::Model::ForwardingGroupTemplateCollection < CIMI::Model::Base + + act_as_root_entity :forwarding_group_template + + text :count + + self << CIMI::Model::ForwardingGroupTemplate + + def self.default(context) + fg_templates = CIMI::Model::ForwardingGroupTemplate.all(context) + self.new( + :id => context.forwarding_group_templates_url, + :name => 'default', + :created => Time.now, + :description => "#{context.driver.name.capitalize} ForwardingGroupTemplateCollection", + :count => fg_templates.size, + :forwarding_group_templates => fg_templates + ) + end + +end diff --git a/server/lib/cimi/models/routing_group.rb b/server/lib/cimi/models/routing_group.rb deleted file mode 100644 index d26f4d7..0000000 --- a/server/lib/cimi/models/routing_group.rb +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -class CIMI::Model::RoutingGroup < CIMI::Model::Base - - array :networks do - scalar :href - end - - array :operations do - scalar :rel, :href - end - - def self.find(id, context) - if id==:all - context.driver.routing_groups(context.credentials, {:env=>context}) - else - context.driver.routing_groups(context.credentials, {:env=>context, :id=>id}) - end - end - -end diff --git a/server/lib/cimi/models/routing_group_collection.rb b/server/lib/cimi/models/routing_group_collection.rb deleted file mode 100644 index 285e164..0000000 --- a/server/lib/cimi/models/routing_group_collection.rb +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -class CIMI::Model::RoutingGroupCollection < CIMI::Model::Base - - act_as_root_entity :routing_group - - array :routing_groups do - scalar :href - end - - def self.default(context) - self.new( - :id => context.routing_groups_url, - :name => 'default', - :created => Time.now, - :description => "#{context.driver.name.capitalize} RoutingGroupCollection", - :routing_groups => CIMI::Model::RoutingGroup.all_uri(context) - ) - end - -end diff --git a/server/lib/cimi/models/routing_group_template.rb b/server/lib/cimi/models/routing_group_template.rb deleted file mode 100644 index 204a353..0000000 --- a/server/lib/cimi/models/routing_group_template.rb +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -class CIMI::Model::RoutingGroupTemplate < CIMI::Model::Base - - array :networks do - scalar :href - end - - array :operations do - scalar :rel, :href - end - - def self.find(id, context) - if id==:all - context.driver.routing_group_templates(context.credentials, {:env=>context}) - else - context.driver.routing_group_templates(context.credentials, {:env=>context, :id=>id}) - end - end - -end diff --git a/server/lib/cimi/models/routing_group_template_collection.rb b/server/lib/cimi/models/routing_group_template_collection.rb deleted file mode 100644 index 61a4a68..0000000 --- a/server/lib/cimi/models/routing_group_template_collection.rb +++ /dev/null @@ -1,35 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - -class CIMI::Model::RoutingGroupTemplateCollection < CIMI::Model::Base - - act_as_root_entity :routing_group_template - - array :routing_group_templates do - scalar :href - end - - def self.default(context) - self.new( - :id => context.routing_group_templates_url, - :name => 'default', - :created => Time.now, - :description => "#{context.driver.name.capitalize} RoutingGroupTemplateCollection", - :routing_group_templates => CIMI::Model::RoutingGroupTemplate.all_uri(context) - ) - end - -end diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/address/address1.json b/server/lib/deltacloud/drivers/mock/data/cimi/address/address1.json deleted file mode 100644 index ccf0695..0000000 --- a/server/lib/deltacloud/drivers/mock/data/cimi/address/address1.json +++ /dev/null @@ -1,19 +0,0 @@ -{ "id": "http://cimi.example.org/addresses/address1", - "name": "address1", - "description": "an IP address", - "created": "Wed Apr 04 11:59:15 EET 2012", - "ip": "192.168.10.1", - "hostname": "marios.local", - "allocation": "static", - "defaultGateway": "192.168.0.1", - "dns": "192.168.0.10", - "macAddress": "", - "protocol": "IPv4", - "mask": "255.255.0.0", - "network": {"href": "http://cimi.example.org/networks/network1"}, - "resource": {}, - "operations": [ - { "rel": "edit", "href": "http://cimi.example.org/addresses/address1" }, - { "rel": "delete", "href": "http://cimi.example.org/addresses/address1" } - ] -} diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/address/address2.json b/server/lib/deltacloud/drivers/mock/data/cimi/address/address2.json deleted file mode 100644 index 13891eb..0000000 --- a/server/lib/deltacloud/drivers/mock/data/cimi/address/address2.json +++ /dev/null @@ -1,19 +0,0 @@ -{ "id": "http://cimi.example.org/addresses/address2", - "name": "address2", - "description": "an IP address", - "created": "Thu Apr 05 12:57:59 EET 2012", - "ip": "192.168.10.2", - "hostname": "foo.bar", - "allocation": "static", - "defaultGateway": "192.168.0.1", - "dns": "192.168.0.10", - "macAddress": "", - "protocol": "IPv4", - "mask": "255.255.0.0", - "network": {"href": "http://cimi.example.org/networks/network1"}, - "resource": {}, - "operations": [ - { "rel": "edit", "href": "http://cimi.example.org/addresses/address2" }, - { "rel": "delete", "href": "http://cimi.example.org/addresses/address2" } - ] -} diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/address/address3.json b/server/lib/deltacloud/drivers/mock/data/cimi/address/address3.json deleted file mode 100644 index 6dc72cb..0000000 --- a/server/lib/deltacloud/drivers/mock/data/cimi/address/address3.json +++ /dev/null @@ -1,19 +0,0 @@ -{ "id": "http://cimi.example.org/addresses/address3", - "name": "address3", - "description": "an IP address", - "created": "Wed Apr 04 11:59:15 EET 2012", - "ip": "192.168.10.3", - "hostname": "jsmith.local", - "allocation": "static", - "defaultGateway": "192.168.0.1", - "dns": "192.168.0.10", - "macAddress": "", - "protocol": "IPv4", - "mask": "255.255.0.0", - "network": {"href": "http://cimi.example.org/networks/network1"}, - "resource": {}, - "operations": [ - { "rel": "edit", "href": "http://cimi.example.org/addresses/address3" }, - { "rel": "delete", "href": "http://cimi.example.org/addresses/address3" } - ] -} diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group/group1.json b/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group/group1.json new file mode 100644 index 0000000..e10e0bd --- /dev/null +++ b/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group/group1.json @@ -0,0 +1,13 @@ +{ "id": "http://cimi.example.org/routing_groups/group1", + "name": "group1", + "description": "a mock routing group", + "created": "Thu Jan 12 16:02:56 EET 2012", + "networks": [ + { "href": "http://cimi.example.org/networks/network1"}, + { "href": "http://cimi.example.org/networks/network2"} + ], + "operations": [ + { "rel": "edit", "href": "http://cimi.example.org/routing_groups/group1" }, + { "rel": "delete", "href": "http://cimi.example.org/routing_groups/group1" } + ] +} diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group_template/template1.json b/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group_template/template1.json new file mode 100644 index 0000000..adbe645 --- /dev/null +++ b/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group_template/template1.json @@ -0,0 +1,12 @@ +{ "id": "http://cimi.example.org/routing_group_templates/template1", + "name": "template1", + "description": "A mock routing group template", + "created": "Fri Mar 16 16:42:50 EET 2012", + "networks": [ + { "href": "http://cimi.example.org/networks/network1"}, + { "href": "http://cimi.example.org/networks/network2"} + ], + "operations": [ + { "rel": "edit", "href": "http://cimi.example.org/routing_group_templates/template1" }, + { "rel": "delete", "href": "http://cimi.example.org/routing_group_templates/template1" }] +} diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/routing_group/group1.json b/server/lib/deltacloud/drivers/mock/data/cimi/routing_group/group1.json deleted file mode 100644 index e10e0bd..0000000 --- a/server/lib/deltacloud/drivers/mock/data/cimi/routing_group/group1.json +++ /dev/null @@ -1,13 +0,0 @@ -{ "id": "http://cimi.example.org/routing_groups/group1", - "name": "group1", - "description": "a mock routing group", - "created": "Thu Jan 12 16:02:56 EET 2012", - "networks": [ - { "href": "http://cimi.example.org/networks/network1"}, - { "href": "http://cimi.example.org/networks/network2"} - ], - "operations": [ - { "rel": "edit", "href": "http://cimi.example.org/routing_groups/group1" }, - { "rel": "delete", "href": "http://cimi.example.org/routing_groups/group1" } - ] -} diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json b/server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json deleted file mode 100644 index adbe645..0000000 --- a/server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json +++ /dev/null @@ -1,12 +0,0 @@ -{ "id": "http://cimi.example.org/routing_group_templates/template1", - "name": "template1", - "description": "A mock routing group template", - "created": "Fri Mar 16 16:42:50 EET 2012", - "networks": [ - { "href": "http://cimi.example.org/networks/network1"}, - { "href": "http://cimi.example.org/networks/network2"} - ], - "operations": [ - { "rel": "edit", "href": "http://cimi.example.org/routing_group_templates/template1" }, - { "rel": "delete", "href": "http://cimi.example.org/routing_group_templates/template1" }] -} diff --git a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb index 3431e51..336f77b 100644 --- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb @@ -53,25 +53,25 @@ module Deltacloud::Drivers::Mock end end - def routing_groups(credentials, opts={}) + def forwarding_groups(credentials, opts={}) check_credentials(credentials) if opts[:id].nil? - routing_groups = @client.load_all_cimi(:routing_group).map{|rg| CIMI::Model::RoutingGroup.from_json(rg)} - routing_groups.map{|rg|convert_cimi_mock_urls(:routing_group, rg, opts[:env])}.flatten + forwarding_groups = @client.load_all_cimi(:forwarding_group).map{|fg| CIMI::Model::ForwardingGroup.from_json(fg)} + forwarding_groups.map{|fg|convert_cimi_mock_urls(:forwarding_group, fg, opts[:env])}.flatten else - routing_group = CIMI::Model::RoutingGroup.from_json(@client.load_cimi(:routing_group, opts[:id])) - convert_cimi_mock_urls(:routing_group, routing_group, opts[:env]) + forwarding_group = CIMI::Model::ForwardingGroup.from_json(@client.load_cimi(:forwarding_group, opts[:id])) + convert_cimi_mock_urls(:forwarding_group, forwarding_group, opts[:env]) end end - def routing_group_templates(credentials, opts={}) + def forwarding_group_templates(credentials, opts={}) check_credentials(credentials) if opts[:id].nil? - routing_group_templates = @client.load_all_cimi(:routing_group_template).map{|rg_templ| CIMI::Model::RoutingGroupTemplate.from_json(rg_templ)} - routing_group_templates.map{|rg_templ|convert_cimi_mock_urls(:routing_group_template, rg_templ, opts[:env])}.flatten + forwarding_group_templates = @client.load_all_cimi(:forwarding_group_template).map{|fg_templ| CIMI::Model::ForwardingGroupTemplate.from_json(fg_templ)} + forwarding_group_templates.map{|fg_templ|convert_cimi_mock_urls(:forwarding_group_template, fg_templ, opts[:env])}.flatten else - routing_group_template = CIMI::Model::RoutingGroupTemplate.from_json(@client.load_cimi(:routing_group_template, opts[:id])) - convert_cimi_mock_urls(:routing_group_template, routing_group_template, opts[:env]) + forwarding_group_template = CIMI::Model::ForwardingGroupTemplate.from_json(@client.load_cimi(:forwarding_group_template, opts[:id])) + convert_cimi_mock_urls(:forwarding_group_template, forwarding_group_template, opts[:env]) end end @@ -108,6 +108,17 @@ module Deltacloud::Drivers::Mock end end + def address_templates(credentials, opts={}) + check_credentials(credentials) + if opts[:id].nil? + address_templates = @client.load_all_cimi(:address_template).map{|addr_templ| CIMI::Model::AddressTemplate.from_json(addr_templ)} + address_templates.map{|addr_templ|convert_cimi_mock_urls(:address_template, addr_templ, opts[:env])}.flatten + else + address_template = CIMI::Model::AddressTemplate.from_json(@client.load_cimi(:address_template, opts[:id])) + convert_cimi_mock_urls(:address_template, address_template, opts[:env]) + end + end + private def convert_cimi_mock_urls(model_name, cimi_object, context) -- 1.7.11.4
