deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [7/9] git commit: CIMI: Adds VSP and Collection to CIMI server
Date Tue, 20 Mar 2012 10:10:20 GMT
CIMI: Adds VSP and Collection to CIMI server


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

Branch: refs/heads/master
Commit: b051ea1206c7ec70f6bdb23e39f39eae1d4a473c
Parents: fdb1250
Author: marios <marios@redhat.com>
Authored: Fri Mar 16 18:08:16 2012 +0200
Committer: marios <marios@redhat.com>
Committed: Tue Mar 20 12:09:08 2012 +0200

----------------------------------------------------------------------
 server/lib/cimi/model.rb                |    2 +
 server/lib/cimi/model/vsp.rb            |   50 ++++++++++++++++++++++++++
 server/lib/cimi/model/vsp_collection.rb |   34 +++++++++++++++++
 server/lib/cimi/server.rb               |   29 +++++++++++++++
 4 files changed, 115 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b051ea12/server/lib/cimi/model.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model.rb b/server/lib/cimi/model.rb
index 132ae6a..6f19673 100644
--- a/server/lib/cimi/model.rb
+++ b/server/lib/cimi/model.rb
@@ -55,3 +55,5 @@ require 'cimi/model/routing_group'
 require 'cimi/model/routing_group_collection'
 require 'cimi/model/routing_group_template'
 require 'cimi/model/routing_group_template_collection'
+require 'cimi/model/vsp'
+require 'cimi/model/vsp_collection'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b051ea12/server/lib/cimi/model/vsp.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model/vsp.rb b/server/lib/cimi/model/vsp.rb
new file mode 100644
index 0000000..33e5d5b
--- /dev/null
+++ b/server/lib/cimi/model/vsp.rb
@@ -0,0 +1,50 @@
+# 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::VSP < CIMI::Model::Base
+
+  text :state
+
+  href :network
+
+  text :bandwidth_reservation
+
+  text :traffic_priority
+
+  text :max_traffic_delay
+
+  text :max_traffic_loss
+
+  text :max_traffic_jitter
+
+  href :event_log
+
+  array :meters do
+    scalar :href
+  end
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id==:all
+      context.driver.vsps(context.credentials, {:env=>context})
+    else
+      context.driver.vsps(context.credentials, {:id=>id, :env=>context})
+    end
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b051ea12/server/lib/cimi/model/vsp_collection.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model/vsp_collection.rb b/server/lib/cimi/model/vsp_collection.rb
new file mode 100644
index 0000000..6f659e1
--- /dev/null
+++ b/server/lib/cimi/model/vsp_collection.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::VSPCollection < CIMI::Model::Base
+
+  CIMI::Model.register_as_root_entity! "VSPs"
+
+  array :vsps do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.vsps_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VSPCollection",
+      :vsps => VSP.all_uri(context)
+    )
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b051ea12/server/lib/cimi/server.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
index 9f541d0..308d922 100644
--- a/server/lib/cimi/server.rb
+++ b/server/lib/cimi/server.rb
@@ -668,3 +668,32 @@ global_collection :routing_group_templates do
 end
 
 
+global_collection :vsps do
+
+  description 'A VSP represents the connection parameters of a network port'
+
+  operation :index do
+    description 'List all VSPs in the VSPCollection'
+    param :CIMISelect, :string, :optional
+    control do
+      vsps = VSPCollection.default(self).filter_by(params[:CIMISelect])
+      respond_to do |format|
+        format.xml {vsps.to_xml}
+        format.json {vsps.to_json}
+      end
+    end
+  end
+
+  operation :show do
+    description 'Show a specific VSP'
+    param :id, :string, :required
+    control do
+      vsp = VSP.find(params[:id], self)
+      respond_to do |format|
+        format.xml {vsp.to_xml}
+        format.json {vsp.to_json}
+      end
+    end
+  end
+
+end


Mime
View raw message