On Sep 14, 2012, at 5:42 PM, [email protected] wrote: ACK.
Review notes: * There are no unit-tests for this stuff. It would be great to add them for the Mock driver (network methods) * Maybe more descriptive commit messages ;-) (Yes I know that I'm the last person who should point on that). -- Michal > From: marios <[email protected]> > > > Signed-off-by: marios <[email protected]> > --- > server/lib/cimi/collections/network_configurations.rb | 2 +- > server/lib/cimi/models/network_configuration.rb | 12 +++--------- > server/lib/cimi/models/network_configuration_collection.rb | 12 ++++++++---- > .../data/cimi/network_configuration/network_config1.json | 11 ++++------- > .../data/cimi/network_configuration/network_config2.json | 9 +++------ > 5 files changed, 19 insertions(+), 27 deletions(-) > > diff --git a/server/lib/cimi/collections/network_configurations.rb > b/server/lib/cimi/collections/network_configurations.rb > index 62faf3e..cab28ca 100644 > --- a/server/lib/cimi/collections/network_configurations.rb > +++ b/server/lib/cimi/collections/network_configurations.rb > @@ -32,7 +32,7 @@ module CIMI::Collections > end > end > > - operation :show, :with_capability => :network_configuration do > + operation :show, :with_capability => :network_configurations do > description 'Show a specific NetworkConfiguration' > control do > network_config = NetworkConfiguration.find(params[:id], self) > diff --git a/server/lib/cimi/models/network_configuration.rb > b/server/lib/cimi/models/network_configuration.rb > index 1b04548..479f5cb 100644 > --- a/server/lib/cimi/models/network_configuration.rb > +++ b/server/lib/cimi/models/network_configuration.rb > @@ -15,17 +15,11 @@ > > class CIMI::Model::NetworkConfiguration < CIMI::Model::Base > > - text :access > + text :network_type > > - text :bandwidth_limit > + text :mtu > > - text :traffic_priority > - > - text :max_traffic_delay > - > - text :max_traffic_loss > - > - text :max_traffic_jitter > + text :class_of_service > > array :operations do > scalar :rel, :href > diff --git a/server/lib/cimi/models/network_configuration_collection.rb > b/server/lib/cimi/models/network_configuration_collection.rb > index fc14592..edad20f 100644 > --- a/server/lib/cimi/models/network_configuration_collection.rb > +++ b/server/lib/cimi/models/network_configuration_collection.rb > @@ -17,17 +17,21 @@ class CIMI::Model::NetworkConfigurationCollection < > CIMI::Model::Base > > act_as_root_entity :network_configuration > > - array :network_configurations do > - scalar :href > - end > + text :count > + > +#add members Array: > + self << CIMI::Model::NetworkConfiguration > + > > def self.default(context) > + network_configurations = CIMI::Model::NetworkConfiguration.all(context) > self.new( > :id => context.network_configurations_url, > :name => 'default', > :created => Time.now, > :description => "#{context.driver.name.capitalize} > NetworkConfigurationCollection", > - :network_configurations => > CIMI::Model::NetworkConfiguration.all(context).map { |c| { :href => c.id } } > + :count => network_configurations.size, > + :network_configurations => network_configurations > ) > end > > diff --git > a/server/lib/deltacloud/drivers/mock/data/cimi/network_configuration/network_config1.json > > b/server/lib/deltacloud/drivers/mock/data/cimi/network_configuration/network_config1.json > index 8fad5d3..4c5ca58 100644 > --- > a/server/lib/deltacloud/drivers/mock/data/cimi/network_configuration/network_config1.json > +++ > b/server/lib/deltacloud/drivers/mock/data/cimi/network_configuration/network_config1.json > @@ -1,13 +1,10 @@ > { "id": "http://cimi.example.org/network_configurations/network_config1", > "name": "network_config1", > - "description": "a network configuration", > + "description": "another network configuration", > "created": "Fri Mar 9 11:57:39 EET 2012", > - "access": "Public", > - "bandwidthLimit": 2, > - "trafficPriority": 1, > - "maxTrafficDelay": 500000, > - "maxTrafficLoss": 100, > - "maxTrafficJitter": 100000, > + "networkType": "Public", > + "mtu": 1500, > + "classOfService": "SILVER", > "operations": [ > { "rel": "edit", "href": > "http://cimi.example.org/network_configurations/network_config1" }, > { "rel": "delete", "href": > "http://cimi.example.org/network_configurations/network_config1" } > diff --git > a/server/lib/deltacloud/drivers/mock/data/cimi/network_configuration/network_config2.json > > b/server/lib/deltacloud/drivers/mock/data/cimi/network_configuration/network_config2.json > index e489bf5..a6f3436 100644 > --- > a/server/lib/deltacloud/drivers/mock/data/cimi/network_configuration/network_config2.json > +++ > b/server/lib/deltacloud/drivers/mock/data/cimi/network_configuration/network_config2.json > @@ -2,12 +2,9 @@ > "name": "network_config2", > "description": "a network configuration", > "created": "Fri Mar 9 12:01:53 EET 2012", > - "access": "Public", > - "bandwidthLimit": 3, > - "trafficPriority": 2, > - "maxTrafficDelay": 600000, > - "maxTrafficLoss": 100, > - "maxTrafficJitter": 200000, > + "networkType": "PUBLIC", > + "mtu": 1500, > + "classOfService": "GOLD", > "operations": [ > { "rel": "edit", "href": > "http://cimi.example.org/network_configurations/network_config2" }, > { "rel": "delete", "href": > "http://cimi.example.org/network_configurations/network_config2" } > -- > 1.7.11.4 > Michal Fojtik http://deltacloud.org [email protected]
