deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [2/2] git commit: CIMI: rename vsp to networkPort in the networkPort model
Date Wed, 20 Feb 2013 00:46:46 GMT
Updated Branches:
  refs/heads/master dde256ac9 -> ff1271fa9


CIMI: rename vsp to networkPort in the networkPort model


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/ff1271fa
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/ff1271fa
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/ff1271fa

Branch: refs/heads/master
Commit: ff1271fa979373ff2dbe47a418edf1229b4c5c2a
Parents: ac17127
Author: NjeriChelimo <martha.c.chumo@gmail.com>
Authored: Mon Feb 18 17:05:59 2013 +0300
Committer: David Lutterkort <lutter@redhat.com>
Committed: Tue Feb 19 16:42:06 2013 -0800

----------------------------------------------------------------------
 server/lib/cimi/models/network_port.rb |   34 +++++++++++++-------------
 1 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ff1271fa/server/lib/cimi/models/network_port.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/network_port.rb b/server/lib/cimi/models/network_port.rb
index d69dc3f..03b0ca3 100644
--- a/server/lib/cimi/models/network_port.rb
+++ b/server/lib/cimi/models/network_port.rb
@@ -43,31 +43,31 @@ class CIMI::Model::NetworkPort < CIMI::Model::Base
 
   def self.create(request_body, context, type)
     input = (type == :xml)? XmlSimple.xml_in(request_body, {"ForceArray"=>false, "NormaliseSpace"=>2})
: JSON.parse(request_body)
-    if input["vspTemplate"]["href"] #template by reference
-      vsp_config, network = get_by_reference(input, context)
+    if input["networkPortTemplate"]["href"] #template by reference
+      network_port_config, network = get_by_reference(input, context)
     else
-      if input["vspTemplate"]["vspConfig"]["href"] # configuration by reference
-        vsp_config = CIMI::Model::VSPConfiguration.find(context.href_id(input["vspTemplate"]["vspConfig"]["href"],:vsp_configurations),
context)
+      if input["networkPortTemplate"]["networkPortConfig"]["href"] # configuration by reference
+        network_port_config = CIMI::Model::NetworkPortConfiguration.find(context.href_id(input["networkPortTemplate"]["networkPortConfig"]["href"],:network_port_configurations),
context)
       else #configuration by value
-        vsp_config = get_by_value(request_body, type)
+        network_port_config = get_by_value(request_body, type)
       end
-      network = CIMI::Model::Network.find(context.href_id(input["vspTemplate"]["network"]["href"],
:networks), context)
+      network = CIMI::Model::Network.find(context.href_id(input["networkPortTemplate"]["network"]["href"],
:networks), context)
     end
-    params = {:vsp_config => vsp_config, :network => network, :name=>input["name"],
:description=>input["description"], :env=>context}
+    params = {:network_port_config => network_port_config, :network => network, :name=>input["name"],
:description=>input["description"], :env=>context}
     raise CIMI::Model::BadRequest.new("Bad request - missing required parameters. Client
sent: #{request_body} which produced #{params.inspect}")  if params.has_value?(nil)
-    context.driver.create_vsp(context.credentials, params)
+    context.driver.create_network_port(context.credentials, params)
   end
 
   def self.delete!(id, context)
-    context.driver.delete_vsp(context.credentials, id)
+    context.driver.delete_network_port(context.credentials, id)
   end
 
   def perform(action, context, &block)
     begin
-      if context.driver.send(:"#{action.name}_vsp", context.credentials, self.name)
+      if context.driver.send(:"#{action.name}_network_port", context.credentials, self.name)
         block.callback :success
       else
-        raise "Operation #{action.name} failed to execute on the VSP #{self.name} "
+        raise "Operation #{action.name} failed to execute on the NetworkPort #{self.name}
"
       end
     rescue => e
       block.callback :failure, e.message
@@ -91,19 +91,19 @@ class CIMI::Model::NetworkPort < CIMI::Model::Base
   private
 
   def self.get_by_reference(input, context)
-    vsp_template = CIMI::Model::VSPTemplate.find(context.href_id(input["vspTemplate"]["href"],
:vsp_templates), context)
-    vsp_config = CIMI::Model::VSPConfiguration.find(context.href_id(vsp_template.vsp_config.href,
:vsp_configurations), context)
-    network = CIMI::Model::Network.find(context.href_id(vsp_template.network.href, :networks),
context)
-    return vsp_config, network
+    network_port_template = CIMI::Model::NetworkPortTemplate.find(context.href_id(input["networkPortTemplate"]["href"],
:network_port_templates), context)
+    network_port_config = CIMI::Model::NetworkPortConfiguration.find(context.href_id(network_port_template.network_port_config.href,
:network_port_configurations), context)
+    network = CIMI::Model::Network.find(context.href_id(network_port_template.network.href,
:networks), context)
+    return network_port_config, network
   end
 
   def self.get_by_value(request_body, type)
     if type == :xml
       xml_arrays = XmlSimple.xml_in(request_body, {"NormaliseSpace"=>2})
-      vsp_config = CIMI::Model::VSPConfiguration.from_xml(XmlSimple.xml_out(xml_arrays["vspTemplate"][0]["vspConfig"][0]))
+      network_port_config = CIMI::Model::NetworkPortConfiguration.from_xml(XmlSimple.xml_out(xml_arrays["networkPortTemplate"][0]["networkPortConfig"][0]))
     else
      json = JSON.parse(request_body)
-      vsp_config = CIMI::Model::VSPConfiguration.from_json(JSON.generate(json["vspTemplate"]["vspConfig"]))
+      network_port_config = CIMI::Model::NetworkPortConfiguration.from_json(JSON.generate(json["networkPortTemplate"]["networkPortConfig"]))
     end
   end
 end


Mime
View raw message