From: NjeriChelimo <[email protected]>
---
clients/cimi/app.rb | 4 ----
clients/cimi/lib/entities.rb | 3 ---
server/lib/cimi/models/network_port.rb | 34 ++++++++++++++++----------------
3 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index 3809425..d18e85f 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -38,11 +38,7 @@ module CIMI::Frontend
use CIMI::Frontend::NetworkPort
use CIMI::Frontend::RoutingGroup
use CIMI::Frontend::RoutingGroupTemplate
- use CIMI::Frontend::VSP
- use CIMI::Frontend::VSPConfiguration
- use CIMI::Frontend::VSPTemplate
use Rack::Session::Cookie
-
helpers CIMI::Frontend::Helper
before do
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index c5c40df..6529486 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -38,6 +38,3 @@ require 'entities/network_port_template'
require 'entities/network_template'
require 'entities/routing_group'
require 'entities/routing_group_template'
-require 'entities/vsp'
-require 'entities/vsp_configuration'
-require 'entities/vsp_template'
diff --git a/server/lib/cimi/models/network_port.rb
b/server/lib/cimi/models/network_port.rb
index d69dc3f..36bdbe8 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["networkTemplate"]["href"] #template by reference
+ network_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["networkTemplate"]["networkConfig"]["href"] # configuration by
reference
+ network_config =
CIMI::Model::NetworkConfiguration.find(context.href_id(input["networkTemplate"]["networkConfig"]["href"],:network_configurations),
context)
else #configuration by value
- vsp_config = get_by_value(request_body, type)
+ network_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["networkTemplate"]["network"]["href"],
:networks), context)
end
- params = {:vsp_config => vsp_config, :network => network,
:name=>input["name"], :description=>input["description"], :env=>context}
+ params = {:network_config => network_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(context.credentials, params)
end
def self.delete!(id, context)
- context.driver.delete_vsp(context.credentials, id)
+ context.driver.delete_network(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", 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 Network
#{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_template =
CIMI::Model::NetworkTemplate.find(context.href_id(input["networkTemplate"]["href"],
:network_templates), context)
+ network_config =
CIMI::Model::NetworkConfiguration.find(context.href_id(network_template.network_config.href,
:network_configurations), context)
+ network =
CIMI::Model::Network.find(context.href_id(network_template.network.href,
:networks), context)
+ return network_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_config =
CIMI::Model::NetworkConfiguration.from_xml(XmlSimple.xml_out(xml_arrays["networkTemplate"][0]["networkConfig"][0]))
else
json = JSON.parse(request_body)
- vsp_config =
CIMI::Model::VSPConfiguration.from_json(JSON.generate(json["vspTemplate"]["vspConfig"]))
+ network_config =
CIMI::Model::NetworkConfiguration.from_json(JSON.generate(json["networkTemplate"]["networkConfig"]))
end
end
end
--
1.7.9.5