occi-core 4.2.9 → 4.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -30
- data/lib/occi/parser.rb +0 -6
- data/lib/occi/version.rb +1 -1
- data/lib/occi-core.rb +0 -1
- data/occi-core.gemspec +0 -1
- data/spec/occi/parser_spec.rb +0 -42
- metadata +2 -24
- data/lib/occi/parser/ova.rb +0 -41
- data/lib/occi/parser/ovf.rb +0 -211
- data/lib/occi/parser/xml.rb +0 -20
- data/spec/occi/parser/ova_samples/test.dump +0 -0
- data/spec/occi/parser/ova_samples/test.ova +0 -0
- data/spec/occi/parser/ovf_samples/test.dump +0 -0
- data/spec/occi/parser/ovf_samples/test.ovf +0 -198
- data/spec/occi/parser/xml_samples/test.xml +0 -352
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24ac48413195e65ec6847bb7d4c3ebad5a13e910
|
4
|
+
data.tar.gz: 039a79688fea638a32f959e5faa7dbba6e71938a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa4eeb03ceadf69c476ace568a61d1517b166043a3e0104a0451b569a91f16882a258144ae48254a2ca2d9e7c4c0ec62be9a1c5b9cc9cf62b6fcebd92ecc92f8
|
7
|
+
data.tar.gz: f601b3b6bde0c77b61da0c2d7c817761060d2556ff4b716d6f787ae9c5f80e25a2b31e3ca4039ac2c698efb10333f37f2aece544b4c5c04878d9d5d7af5ba29c
|
data/README.md
CHANGED
@@ -14,14 +14,10 @@ Requirements
|
|
14
14
|
* RubyGems have to be installed
|
15
15
|
* Rake has to be installed (e.g., `gem install rake`)
|
16
16
|
|
17
|
-
### Dependencies
|
18
|
-
* `libxslt1-dev` or `libxslt-devel`
|
19
|
-
* `libxml2-dev`or `libxml2-devel`
|
20
|
-
|
21
17
|
### Examples
|
22
18
|
#### For distros based on Debian:
|
23
19
|
~~~
|
24
|
-
apt-get install ruby rubygems ruby-dev
|
20
|
+
apt-get install ruby rubygems ruby-dev
|
25
21
|
~~~
|
26
22
|
~~~
|
27
23
|
ruby -v
|
@@ -31,7 +27,7 @@ ruby -v
|
|
31
27
|
|
32
28
|
#### For distros based on RHEL:
|
33
29
|
~~~
|
34
|
-
yum install
|
30
|
+
yum install ruby-devel openssl-devel gcc gcc-c++ ruby rubygems
|
35
31
|
~~~
|
36
32
|
~~~
|
37
33
|
ruby -v
|
@@ -132,30 +128,6 @@ OCCI messages can be parsed to an OCCI collection for example like
|
|
132
128
|
body = %Q|Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"|
|
133
129
|
collection=Occi::Parser.parse(media_type, body)
|
134
130
|
|
135
|
-
### Parsing OVF / OVA files
|
136
|
-
|
137
|
-
Parsing of OVF/OVA files is partly supported and will be improved in future versions.
|
138
|
-
|
139
|
-
The example in [DMTF DSP 2021](http://www.dmtf.org/sites/default/files/standards/documents/DSP2021_1.0.0.tar) is
|
140
|
-
bundled with rOCCI and can be parsed to an OCCI collection with
|
141
|
-
|
142
|
-
require 'open-uri'
|
143
|
-
ova=open 'https://raw.github.com/gwdg/rOCCI/master/spec/occi/test.ova'
|
144
|
-
collection=Occi::Parser.ova(ova.read)
|
145
|
-
|
146
|
-
Currently only the following entries of OVF files are parsed
|
147
|
-
|
148
|
-
* File in References
|
149
|
-
* Disk in the DiskSection
|
150
|
-
* Network in the NetworkSection
|
151
|
-
* In the VirutalSystemSection:
|
152
|
-
* Info
|
153
|
-
* in the VirtualHardwareSection the items regarding
|
154
|
-
* Processor
|
155
|
-
* Memory
|
156
|
-
* Ethernet Adapter
|
157
|
-
* Parallel port
|
158
|
-
|
159
131
|
### Using the OCCI model
|
160
132
|
|
161
133
|
The occi-core gem includes all OCCI Core classes necessary to handly arbitrary OCCI objects.
|
data/lib/occi/parser.rb
CHANGED
@@ -86,12 +86,6 @@ module Occi
|
|
86
86
|
collection = parse_body_plain(body, category, entity_type)
|
87
87
|
when 'application/occi+json', 'application/json'
|
88
88
|
collection = Occi::Parser::Json.collection body
|
89
|
-
when 'application/occi+xml', 'application/xml'
|
90
|
-
collection = Occi::Parser::Xml.collection body
|
91
|
-
when 'application/ovf', 'application/ovf+xml'
|
92
|
-
collection = Occi::Parser::Ovf.collection body
|
93
|
-
when 'application/ova'
|
94
|
-
collection = Occi::Parser::Ova.collection body
|
95
89
|
else
|
96
90
|
raise Occi::Errors::ParserTypeError, "Content type #{media_type} not supported"
|
97
91
|
end
|
data/lib/occi/version.rb
CHANGED
data/lib/occi-core.rb
CHANGED
data/occi-core.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_dependency 'json'
|
22
22
|
gem.add_dependency 'hashie'
|
23
23
|
gem.add_dependency 'uuidtools', '>=2.1.3'
|
24
|
-
gem.add_dependency 'nokogiri', '~>1.6.0'
|
25
24
|
gem.add_dependency 'activesupport', '~>4.0.0'
|
26
25
|
gem.add_dependency 'settingslogic'
|
27
26
|
|
data/spec/occi/parser_spec.rb
CHANGED
@@ -86,48 +86,6 @@ module Occi
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
it "parses an OVF file" do
|
90
|
-
media_type = 'application/ovf+xml'
|
91
|
-
body = File.read('spec/occi/parser/ovf_samples/test.ovf')
|
92
|
-
collection = Occi::Parser.parse(media_type, body)
|
93
|
-
|
94
|
-
collection.resources.each { |res| res.id="noid" } #Equalize auto-generated IDs
|
95
|
-
|
96
|
-
expected = Marshal.load(File.open("spec/occi/parser/ovf_samples/test.dump", "rb"))
|
97
|
-
expect(collection).to eql expected
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'copes with faulty OVF' #do
|
101
|
-
# expect{ Occi::Parser.parse('application/ovf', "{This is not an OVF}")}.to raise_error(Occi::Errors::ParserInputError)
|
102
|
-
# end
|
103
|
-
|
104
|
-
it "parses an OVA container" do
|
105
|
-
media_type = 'application/ova'
|
106
|
-
body = File.read('spec/occi/parser/ova_samples/test.ova')
|
107
|
-
collection = Occi::Parser.parse(media_type, body)
|
108
|
-
|
109
|
-
collection.resources.each { |res| res.id="noid" } #Equalize auto-generated IDs
|
110
|
-
|
111
|
-
expected = Marshal.load(File.open("spec/occi/parser/ova_samples/test.dump", "rb"))
|
112
|
-
expect(collection).to eql expected
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'copes with faulty OVA' do
|
116
|
-
expect{ Occi::Parser.parse('application/ova', "{This is not an OVA}")}.to raise_error(Occi::Errors::ParserInputError)
|
117
|
-
end
|
118
|
-
|
119
|
-
# ZS 11 Oct 2013: XML format not yet properly specified
|
120
|
-
# it "parses a XML file" do
|
121
|
-
# media_type = 'application/xml'
|
122
|
-
# body = File.read('spec/occi/parser/xml_samples/test.xml')
|
123
|
-
# collection = Occi::Parser.parse(media_type, body)
|
124
|
-
#
|
125
|
-
# end
|
126
|
-
|
127
|
-
it 'copes with faulty XML' do
|
128
|
-
expect{ collection = Occi::Parser.parse('application/xml', "{This is not a XML}") }.to raise_error(Occi::Errors::ParserInputError)
|
129
|
-
end
|
130
|
-
|
131
89
|
it 'copes with non-existent MIME-type' do
|
132
90
|
expect{ collection = Occi::Parser.parse('application/notexist', 'X-OCCI-Location: http://example.com:8090/a/b/vm1"') }.to raise_error(Occi::Errors::ParserTypeError)
|
133
91
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: occi-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Feldhaus
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-02-
|
13
|
+
date: 2014-02-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -54,20 +54,6 @@ dependencies:
|
|
54
54
|
- - '>='
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 2.1.3
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: nokogiri
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - ~>
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 1.6.0
|
64
|
-
type: :runtime
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - ~>
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: 1.6.0
|
71
57
|
- !ruby/object:Gem::Dependency
|
72
58
|
name: activesupport
|
73
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,11 +159,8 @@ files:
|
|
173
159
|
- lib/occi/model.rb
|
174
160
|
- lib/occi/parser.rb
|
175
161
|
- lib/occi/parser/json.rb
|
176
|
-
- lib/occi/parser/ova.rb
|
177
|
-
- lib/occi/parser/ovf.rb
|
178
162
|
- lib/occi/parser/text.rb
|
179
163
|
- lib/occi/parser/text/constants.rb
|
180
|
-
- lib/occi/parser/xml.rb
|
181
164
|
- lib/occi/settings.rb
|
182
165
|
- lib/occi/version.rb
|
183
166
|
- occi-core.gemspec
|
@@ -207,10 +190,6 @@ files:
|
|
207
190
|
- spec/occi/log_spec.rb
|
208
191
|
- spec/occi/model_spec.rb
|
209
192
|
- spec/occi/parser/json_samples/test.json
|
210
|
-
- spec/occi/parser/ova_samples/test.dump
|
211
|
-
- spec/occi/parser/ova_samples/test.ova
|
212
|
-
- spec/occi/parser/ovf_samples/test.dump
|
213
|
-
- spec/occi/parser/ovf_samples/test.ovf
|
214
193
|
- spec/occi/parser/text_samples/occi_categories.dump
|
215
194
|
- spec/occi/parser/text_samples/occi_categories.text
|
216
195
|
- spec/occi/parser/text_samples/occi_compute_rocci_server.dump
|
@@ -240,7 +219,6 @@ files:
|
|
240
219
|
- spec/occi/parser/text_samples/occi_storage_rocci_server.resource.dump
|
241
220
|
- spec/occi/parser/text_samples/occi_storage_rocci_server.text
|
242
221
|
- spec/occi/parser/text_spec.rb
|
243
|
-
- spec/occi/parser/xml_samples/test.xml
|
244
222
|
- spec/occi/parser_spec.rb
|
245
223
|
- spec/spec_helper.rb
|
246
224
|
homepage: https://github.com/gwdg/rOCCI-core
|
data/lib/occi/parser/ova.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
module Occi
|
2
|
-
module Parser
|
3
|
-
module Ova
|
4
|
-
|
5
|
-
# @param [String] string
|
6
|
-
# @return [Occi::Collection]
|
7
|
-
def self.collection(string)
|
8
|
-
Occi::Log.debug "[#{self}] Parsing ova format"
|
9
|
-
tar = Gem::Package::TarReader.new(StringIO.new(string))
|
10
|
-
ovf = mf = cert = nil
|
11
|
-
files = {}
|
12
|
-
|
13
|
-
tar.each do |entry|
|
14
|
-
tempfile = Tempfile.new(entry.full_name)
|
15
|
-
tempfile.write(entry.read)
|
16
|
-
tempfile.close
|
17
|
-
files[entry.full_name] = tempfile.path
|
18
|
-
|
19
|
-
ovf = tempfile.path if entry.full_name.end_with? '.ovf'
|
20
|
-
mf = tempfile.path if entry.full_name.end_with? '.mf'
|
21
|
-
cert = tempfile.path if entry.full_name.end_with? '.cert'
|
22
|
-
end
|
23
|
-
|
24
|
-
Occi::Log.debug "[#{self}] In ova found: #{ovf} #{mf} #{cert}"
|
25
|
-
raise Occi::Errors::ParserInputError, 'No ovf file found' unless ovf
|
26
|
-
|
27
|
-
File.read(mf).each_line do |line|
|
28
|
-
line = line.scan(/SHA1\(([^\)]*)\)= (.*)/).flatten
|
29
|
-
name = line.first
|
30
|
-
sha1 = line.last
|
31
|
-
|
32
|
-
Occi::Log.debug "[#{self}] SHA1 hash #{Digest::SHA1.hexdigest(files[name])}"
|
33
|
-
raise Occi::Errors::ParserInputError, "SHA1 mismatch for file #{name}" unless Digest::SHA1.hexdigest(File.read(files[name])) == sha1
|
34
|
-
end if mf
|
35
|
-
|
36
|
-
Occi::Parser::Ovf.collection(File.read(ovf), files)
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/lib/occi/parser/ovf.rb
DELETED
@@ -1,211 +0,0 @@
|
|
1
|
-
module Occi
|
2
|
-
module Parser
|
3
|
-
module Ovf
|
4
|
-
|
5
|
-
# Declaring Class constants for OVF XML namespaces (defined in OVF specification ver.1.1)
|
6
|
-
OVF ="http://schemas.dmtf.org/ovf/envelope/1"
|
7
|
-
RASD ="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
|
8
|
-
VSSD ="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
|
9
|
-
OVFENV="http://schemas.dmtf.org/ovf/environment/1"
|
10
|
-
CIM ="http://schemas.dmtf.org/wbem/wscim/1/common"
|
11
|
-
|
12
|
-
class << self
|
13
|
-
|
14
|
-
# @param [String] string
|
15
|
-
# @param [Hash] files key value pairs of file names and paths to the file
|
16
|
-
def collection(string, files={})
|
17
|
-
collection = Occi::Collection.new
|
18
|
-
doc = Nokogiri::XML(string)
|
19
|
-
|
20
|
-
references = parse_references(doc, files)
|
21
|
-
parse_storage(doc, references, collection)
|
22
|
-
parse_network(doc, collection)
|
23
|
-
parse_compute(doc, references, collection)
|
24
|
-
|
25
|
-
collection
|
26
|
-
end
|
27
|
-
|
28
|
-
def parse_references(doc, files)
|
29
|
-
references = {}
|
30
|
-
|
31
|
-
doc.xpath('envelope:Envelope/envelope:References/envelope:File', 'envelope' => "#{OVF}").each do |file|
|
32
|
-
href = URI.parse(file.attributes['href'].to_s)
|
33
|
-
references[file.attributes['id'].to_s] = if href.relative?
|
34
|
-
files[href.to_s] ? "file://#{files[href.to_s]}" : "file://#{href.to_s}"
|
35
|
-
else
|
36
|
-
href.to_s
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
references
|
41
|
-
end
|
42
|
-
|
43
|
-
def parse_storage(doc, references, collection)
|
44
|
-
doc.xpath('envelope:Envelope/envelope:DiskSection/envelope:Disk', 'envelope' => "#{OVF}").each do |disk|
|
45
|
-
storage = Occi::Infrastructure::Storage.new
|
46
|
-
|
47
|
-
if disk.attributes['fileRef']
|
48
|
-
parse_storage_disk_file(disk, storage, references)
|
49
|
-
else
|
50
|
-
parse_storage_disk_alloc(disk, storage, references)
|
51
|
-
end
|
52
|
-
|
53
|
-
collection.resources << storage
|
54
|
-
end
|
55
|
-
|
56
|
-
collection
|
57
|
-
end
|
58
|
-
|
59
|
-
def parse_storage_disk_file(disk, storage, references)
|
60
|
-
storagelink = Occi::Infrastructure::Storagelink.new
|
61
|
-
storagelink.title = disk.attributes['fileRef'].to_s
|
62
|
-
storagelink.target = references[disk.attributes['fileRef'].to_s]
|
63
|
-
|
64
|
-
storage.title = disk.attributes['diskId'].to_s
|
65
|
-
storage.links << storagelink
|
66
|
-
|
67
|
-
storage
|
68
|
-
end
|
69
|
-
|
70
|
-
def parse_storage_disk_alloc(disk, storage)
|
71
|
-
#OCCI accepts storage size in GB
|
72
|
-
#OVF ver 1.1: The capacity of a virtual disk shall be specified by the ovf:capacity attribute with an xs:long integer
|
73
|
-
#value. The default unit odf allocation shall be bytes. The optional string attribute
|
74
|
-
#ovf:capacityAllocationUnits may be used to specify a particular unit of allocation.
|
75
|
-
alloc_units = disk.attributes['capacityAllocationUnits'].to_s
|
76
|
-
|
77
|
-
if alloc_units.empty?
|
78
|
-
# The capacity is defined in bytes, convert to GB and pass it to OCCI
|
79
|
-
capacity = disk.attributes['capacity'].to_s.to_i
|
80
|
-
else
|
81
|
-
alloc_unit_bytes = alloc_units_bytes(alloc_units)
|
82
|
-
capacity = calculate_capacity_bytes(disk.attributes['capacity'].to_s, alloc_unit_bytes)
|
83
|
-
end
|
84
|
-
|
85
|
-
capacity_gb = calculate_capacity_gb(capacity)
|
86
|
-
storage.size = capacity_gb.to_s if capacity_gb
|
87
|
-
storage.title = disk.attributes['diskId'].to_s if disk.attributes['diskId']
|
88
|
-
|
89
|
-
storage
|
90
|
-
end
|
91
|
-
|
92
|
-
def parse_network(doc, collection)
|
93
|
-
doc.xpath('envelope:Envelope/envelope:NetworkSection/envelope:Network', 'envelope' => "#{OVF}").each do |nw|
|
94
|
-
network = Occi::Infrastructure::Network.new
|
95
|
-
network.title = nw.attributes['name'].to_s
|
96
|
-
collection.resources << network
|
97
|
-
end
|
98
|
-
|
99
|
-
collection
|
100
|
-
end
|
101
|
-
|
102
|
-
def parse_compute(doc, references, collection)
|
103
|
-
# Iteration through all the virtual hardware sections,and a sub-iteration on each Item defined in the Virtual Hardware section
|
104
|
-
doc.xpath('envelope:Envelope/envelope:VirtualSystem', 'envelope' => "#{OVF}").each do |virtsys|
|
105
|
-
compute = Occi::Infrastructure::Compute.new
|
106
|
-
|
107
|
-
doc.xpath('envelope:Envelope/envelope:VirtualSystem/envelope:VirtualHardwareSection', 'envelope' => "#{OVF}").each do |virthwsec|
|
108
|
-
compute.summary = virthwsec.xpath("item:Info/text()", 'item' => "#{RASD}").to_s
|
109
|
-
parse_compute_resources(collection, compute, virthwsec)
|
110
|
-
end
|
111
|
-
|
112
|
-
collection.resources << compute
|
113
|
-
end
|
114
|
-
|
115
|
-
collection
|
116
|
-
end
|
117
|
-
|
118
|
-
def parse_compute_resources(collection, compute, virthwsec)
|
119
|
-
virthwsec.xpath('envelope:Item', 'envelope' => "#{OVF}").each do |resource_alloc|
|
120
|
-
resType = resource_alloc.xpath("item:ResourceType/text()", 'item' => "#{RASD}")
|
121
|
-
|
122
|
-
case resType.to_s
|
123
|
-
when "4" then
|
124
|
-
# 4 is the ResourceType for memory in the CIM_ResourceAllocationSettingData
|
125
|
-
parse_compute_memory(resource_alloc, compute)
|
126
|
-
when "3" then
|
127
|
-
# 3 is the ResourceType for processor in the CIM_ResourceAllocationSettingData
|
128
|
-
compute.cores = resource_alloc.xpath("item:VirtualQuantity/text()", 'item' => "#{RASD}").to_s.to_i
|
129
|
-
when "10" then
|
130
|
-
# extract the network
|
131
|
-
parse_compute_network(resource_alloc, compute, collection)
|
132
|
-
when "17" then
|
133
|
-
# extract the mountpoint
|
134
|
-
parse_compute_storage(resource_alloc, compute, collection)
|
135
|
-
end
|
136
|
-
|
137
|
-
##Add the cpu architecture
|
138
|
-
#system_sec = virthwsec.xpath('envelope:System', 'envelope' => "#{OVF}")
|
139
|
-
#compute.architecture = system_sec.xpath('vssd_:VirtualSystemType/text()', 'vssd_' => "#{VSSD}")
|
140
|
-
end
|
141
|
-
|
142
|
-
compute
|
143
|
-
end
|
144
|
-
|
145
|
-
def parse_compute_memory(resource_alloc, compute)
|
146
|
-
alloc_units = resource_alloc.xpath("item:AllocationUnits/text()", 'item' => "#{RASD}").to_s
|
147
|
-
|
148
|
-
alloc_unit_bytes = alloc_units_bytes(alloc_units)
|
149
|
-
capacity = calculate_capacity_bytes(resource_alloc.xpath("item:VirtualQuantity/text()", 'item' => "#{RASD}").to_s, alloc_unit_bytes)
|
150
|
-
capacity_gb = calculate_capacity_gb(capacity)
|
151
|
-
|
152
|
-
compute.memory = capacity_gb
|
153
|
-
# compute.attributes.occi!.compute!.memory = resource_alloc.xpath("item:VirtualQuantity/text()", 'item' => "#{RASD}").to_s.to_i
|
154
|
-
|
155
|
-
compute
|
156
|
-
end
|
157
|
-
|
158
|
-
def parse_compute_network(resource_alloc, compute, collection)
|
159
|
-
id = resource_alloc.xpath("item:Connection/text()", 'item' => "#{RASD}").to_s
|
160
|
-
network = collection.resources.select { |resource| resource.title == id }.first
|
161
|
-
raise Occi::Errors::ParserInputError, "Network with id #{id} not found" unless network
|
162
|
-
|
163
|
-
networkinterface = compute.networkinterface(network)
|
164
|
-
networkinterface.title = resource_alloc.xpath("item:ElementName/text()", 'item' => "#{RASD}").to_s
|
165
|
-
|
166
|
-
compute
|
167
|
-
end
|
168
|
-
|
169
|
-
def parse_compute_storage(resource_alloc, compute, collection)
|
170
|
-
host_resource = resource_alloc.xpath("item:HostResource/text()", 'item' => "#{RASD}").to_s
|
171
|
-
|
172
|
-
if host_resource.start_with? 'ovf:/disk/'
|
173
|
-
id = host_resource.gsub('ovf:/disk/', '')
|
174
|
-
storage = collection.resources.select { |resource| resource.title == id }.first
|
175
|
-
raise Occi::Errors::ParserInputError, "Disk with id #{id} not found" unless storage
|
176
|
-
elsif host_resource.start_with? 'ovf:/file/'
|
177
|
-
raise Occi::Errors::ParserInputError, 'OVF files are not supported!'
|
178
|
-
#id = host_resource.gsub('ovf:/file/', '')
|
179
|
-
#storagelink.attributes.occi!.core!.target = references[id]
|
180
|
-
end
|
181
|
-
|
182
|
-
storagelink = compute.storagelink(storage)
|
183
|
-
storagelink.title = resource_alloc.xpath("item:ElementName/text()", 'item' => "#{RASD}").to_s
|
184
|
-
|
185
|
-
compute
|
186
|
-
end
|
187
|
-
|
188
|
-
def calculate_capacity_bytes(capacity, alloc_units_bytes)
|
189
|
-
total_capacity_bytes = alloc_units_bytes * capacity.to_i
|
190
|
-
total_capacity_bytes
|
191
|
-
end
|
192
|
-
|
193
|
-
def calculate_capacity_gb(capacity)
|
194
|
-
capacity_gb = capacity.to_f/(2**30)
|
195
|
-
capacity_gb
|
196
|
-
end
|
197
|
-
|
198
|
-
def alloc_units_bytes(alloc_units)
|
199
|
-
units = alloc_units.split('*')
|
200
|
-
#check units[1] is nil??
|
201
|
-
units[1].strip!
|
202
|
-
alloc_vars = units[1].split('^')
|
203
|
-
alloc_units_bytes = (alloc_vars[0].to_i**alloc_vars[1].to_i)
|
204
|
-
alloc_units_bytes
|
205
|
-
end
|
206
|
-
|
207
|
-
end
|
208
|
-
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
data/lib/occi/parser/xml.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module Occi
|
2
|
-
module Parser
|
3
|
-
module Xml
|
4
|
-
# @param [String] string
|
5
|
-
# @return [Occi::Collection]
|
6
|
-
def self.collection(string)
|
7
|
-
|
8
|
-
begin
|
9
|
-
parsed_xml = Nokogiri::XML(string) { |config| config.strict.nonet }
|
10
|
-
rescue Nokogiri::XML::SyntaxError => perr
|
11
|
-
Occi::Log.error "[#{self}] Failed to parse XML input: #{perr.message}"
|
12
|
-
raise Occi::Errors::ParserInputError, perr.message
|
13
|
-
end
|
14
|
-
|
15
|
-
hash = Hashie::Mash.new(Hash.from_xml(parsed_xml))
|
16
|
-
Occi::Collection.new(hash)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,198 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
-
xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
|
4
|
-
xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
|
5
|
-
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
|
6
|
-
xmlns="http://schemas.dmtf.org/ovf/envelope/1"
|
7
|
-
xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 ../dsp8023.xsd">
|
8
|
-
|
9
|
-
<!-- This example reference a local schema file, to validate against online schema use:
|
10
|
-
xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.0.0.xsd"
|
11
|
-
-->
|
12
|
-
|
13
|
-
<!-- References to all external files -->
|
14
|
-
<References>
|
15
|
-
<File ovf:id="lamp" ovf:href="http://example.com/lamp.vmdk" ovf:size="180114671"/>
|
16
|
-
</References>
|
17
|
-
<!-- Describes meta-information about all virtual disks in the package -->
|
18
|
-
<DiskSection>
|
19
|
-
<Info>List of the virtual disks used in the package</Info>
|
20
|
-
<Disk ovf:diskId="lamp" ovf:fileRef="lamp" ovf:capacity="4294967296"
|
21
|
-
ovf:populatedSize="1924967692"
|
22
|
-
ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized"/>
|
23
|
-
</DiskSection>
|
24
|
-
<!-- Describes all networks used in the package -->
|
25
|
-
<NetworkSection>
|
26
|
-
<Info>Logical networks used in the package</Info>
|
27
|
-
<Network ovf:name="VM Network">
|
28
|
-
<Description>The network that the LAMP Service will be available
|
29
|
-
on</Description>
|
30
|
-
</Network>
|
31
|
-
</NetworkSection>
|
32
|
-
<VirtualSystem ovf:id="MyLampService">
|
33
|
-
<Info>Single-VM Virtual appliance with LAMP stack</Info>
|
34
|
-
<Name>LAMP Virtual Appliance</Name>
|
35
|
-
<!-- Overall information about the product -->
|
36
|
-
<ProductSection>
|
37
|
-
<Info>Product information for the service</Info>
|
38
|
-
<Product>Lamp Service</Product>
|
39
|
-
<Version>1.0</Version>
|
40
|
-
<FullVersion>1.0.0</FullVersion>
|
41
|
-
</ProductSection>
|
42
|
-
<!-- Linux component configuration parameters -->
|
43
|
-
<ProductSection ovf:class="org.linuxdist.x">
|
44
|
-
<Info>Product customization for the installed Linux system</Info>
|
45
|
-
<Product>Linux Distribution X</Product>
|
46
|
-
<Version>2.6.3</Version>
|
47
|
-
<Property ovf:key="hostname" ovf:type="string">
|
48
|
-
<Description>Specifies the hostname for the appliance</Description>
|
49
|
-
</Property>
|
50
|
-
<Property ovf:key="ip" ovf:type="string">
|
51
|
-
<Description>Specifies the IP address for the appliance</Description>
|
52
|
-
</Property>
|
53
|
-
<Property ovf:key="subnet" ovf:type="string">
|
54
|
-
<Description> Specifies the subnet to use on the deployed network
|
55
|
-
</Description>
|
56
|
-
</Property>
|
57
|
-
<Property ovf:key="gateway" ovf:type="string">
|
58
|
-
<Description> Specifies the gateway on the deployed network
|
59
|
-
</Description>
|
60
|
-
</Property>
|
61
|
-
<Property ovf:key="dns" ovf:type="string">
|
62
|
-
<Description> A comma separated list of DNS servers on the deployed
|
63
|
-
network </Description>
|
64
|
-
</Property>
|
65
|
-
<Property ovf:key="netCoreRmemMaxMB" ovf:type="uint16" ovf:value="16"
|
66
|
-
ovf:userConfigurable="true">
|
67
|
-
<Description> Specify TCP read max buffer size in mega bytes. Default is
|
68
|
-
16. </Description>
|
69
|
-
</Property>
|
70
|
-
<Property ovf:key="netCoreWmemMaxMB" ovf:type="uint16" ovf:value="16"
|
71
|
-
ovf:userConfigurable="true">
|
72
|
-
<Description> Specify TCP write max buffer size in mega bytes. Default is
|
73
|
-
16. </Description>
|
74
|
-
</Property>
|
75
|
-
</ProductSection>
|
76
|
-
<!-- Apache component configuration parameters -->
|
77
|
-
<ProductSection ovf:class="org.apache.httpd">
|
78
|
-
<Info>Product customization for the installed Apache Web Server</Info>
|
79
|
-
<Product>Apache Distribution Y</Product>
|
80
|
-
<Version>2.6.6</Version>
|
81
|
-
<Property ovf:key="httpPort" ovf:type="uint16" ovf:value="80"
|
82
|
-
ovf:userConfigurable="true">
|
83
|
-
<Description>Port number for HTTP requests</Description>
|
84
|
-
</Property>
|
85
|
-
<Property ovf:key="httpsPort" ovf:type="uint16" ovf:value="443"
|
86
|
-
ovf:userConfigurable="true">
|
87
|
-
<Description>Port number for HTTPS requests</Description>
|
88
|
-
</Property>
|
89
|
-
<Property ovf:key="startThreads" ovf:type="uint16" ovf:value="50"
|
90
|
-
ovf:userConfigurable="true">
|
91
|
-
<Description>Number of threads created on startup. </Description>
|
92
|
-
</Property>
|
93
|
-
<Property ovf:key="minSpareThreads" ovf:type="uint16" ovf:value="15"
|
94
|
-
ovf:userConfigurable="true">
|
95
|
-
<Description> Minimum number of idle threads to handle request spikes.
|
96
|
-
</Description>
|
97
|
-
</Property>
|
98
|
-
<Property ovf:key="maxSpareThreads" ovf:type="uint16" ovf:value="30"
|
99
|
-
ovf:userConfigurable="true">
|
100
|
-
<Description>Maximum number of idle threads </Description>
|
101
|
-
</Property>
|
102
|
-
<Property ovf:key="maxClients" ovf:type="uint16" ovf:value="256"
|
103
|
-
ovf:userConfigurable="true">
|
104
|
-
<Description>Limit the number of simultaneous requests that will be
|
105
|
-
served. </Description>
|
106
|
-
</Property>
|
107
|
-
</ProductSection>
|
108
|
-
<!-- MySQL component configuration parameters -->
|
109
|
-
<ProductSection ovf:class="org.mysql.db">
|
110
|
-
<Info>Product customization for the installed MySql Database Server</Info>
|
111
|
-
<Product>MySQL Distribution Z</Product>
|
112
|
-
<Version>5.0</Version>
|
113
|
-
<Property ovf:key="queryCacheSizeMB" ovf:type="uint16" ovf:value="32"
|
114
|
-
ovf:userConfigurable="true">
|
115
|
-
<Description>Buffer to cache repeated queries for faster access (in
|
116
|
-
MB)</Description>
|
117
|
-
</Property>
|
118
|
-
<Property ovf:key="maxConnections" ovf:type="uint16" ovf:value="500"
|
119
|
-
ovf:userConfigurable="true">
|
120
|
-
<Description>The number of concurrent connections that can be
|
121
|
-
served</Description>
|
122
|
-
</Property>
|
123
|
-
<Property ovf:key="waitTimeout" ovf:type="uint16" ovf:value="100"
|
124
|
-
ovf:userConfigurable="true">
|
125
|
-
<Description>Number of seconds to wait before timing out a connection
|
126
|
-
</Description>
|
127
|
-
</Property>
|
128
|
-
</ProductSection>
|
129
|
-
<!-- PHP component configuration parameters -->
|
130
|
-
<ProductSection ovf:class="net.php">
|
131
|
-
<Info>Product customization for the installed PHP component</Info>
|
132
|
-
<Product>PHP Distribution U</Product>
|
133
|
-
<Version>5.0</Version>
|
134
|
-
<Property ovf:key="sessionTimeout" ovf:type="uint16" ovf:value="5"
|
135
|
-
ovf:userConfigurable="true">
|
136
|
-
<Description> How many minutes a session has to be idle before it is
|
137
|
-
timed out </Description>
|
138
|
-
</Property>
|
139
|
-
<Property ovf:key="concurrentSessions" ovf:type="uint16" ovf:value="500"
|
140
|
-
ovf:userConfigurable="true">
|
141
|
-
<Description> The number of concurrent sessions that can be served
|
142
|
-
</Description>
|
143
|
-
</Property>
|
144
|
-
<Property ovf:key="memoryLimit" ovf:type="uint16" ovf:value="32"
|
145
|
-
ovf:userConfigurable="true">
|
146
|
-
<Description> How much memory in megabytes a script can consume before
|
147
|
-
being killed </Description>
|
148
|
-
</Property>
|
149
|
-
</ProductSection>
|
150
|
-
<OperatingSystemSection ovf:id="36">
|
151
|
-
<Info>Guest Operating System</Info>
|
152
|
-
<Description>Linux 2.6.x</Description>
|
153
|
-
</OperatingSystemSection>
|
154
|
-
<VirtualHardwareSection>
|
155
|
-
<Info>Virtual Hardware Requirements: 256MB, 1 CPU, 1 disk, 1 NIC</Info>
|
156
|
-
<System>
|
157
|
-
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
|
158
|
-
<vssd:InstanceID>0</vssd:InstanceID>
|
159
|
-
<vssd:VirtualSystemType>vmx-04</vssd:VirtualSystemType>
|
160
|
-
</System>
|
161
|
-
<Item>
|
162
|
-
<rasd:Description>Number of virtual CPUs</rasd:Description>
|
163
|
-
<rasd:ElementName>1 virtual CPU</rasd:ElementName>
|
164
|
-
<rasd:InstanceID>1</rasd:InstanceID>
|
165
|
-
<rasd:ResourceType>3</rasd:ResourceType>
|
166
|
-
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
|
167
|
-
</Item>
|
168
|
-
<Item>
|
169
|
-
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
|
170
|
-
<rasd:Description>Memory Size</rasd:Description>
|
171
|
-
<rasd:ElementName>256 MB of memory</rasd:ElementName>
|
172
|
-
<rasd:InstanceID>2</rasd:InstanceID>
|
173
|
-
<rasd:ResourceType>4</rasd:ResourceType>
|
174
|
-
<rasd:VirtualQuantity>256</rasd:VirtualQuantity>
|
175
|
-
</Item>
|
176
|
-
<Item>
|
177
|
-
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
|
178
|
-
<rasd:Connection>VM Network</rasd:Connection>
|
179
|
-
<rasd:ElementName>Ethernet adapter on "VM Network"</rasd:ElementName>
|
180
|
-
<rasd:InstanceID>3</rasd:InstanceID>
|
181
|
-
<rasd:ResourceType>10</rasd:ResourceType>
|
182
|
-
</Item>
|
183
|
-
<Item>
|
184
|
-
<rasd:ElementName>SCSI Controller 0 - LSI Logic</rasd:ElementName>
|
185
|
-
<rasd:InstanceID>4</rasd:InstanceID>
|
186
|
-
<rasd:ResourceSubType>LsiLogic</rasd:ResourceSubType>
|
187
|
-
<rasd:ResourceType>6</rasd:ResourceType>
|
188
|
-
</Item>
|
189
|
-
<Item>
|
190
|
-
<rasd:ElementName>Harddisk 1</rasd:ElementName>
|
191
|
-
<rasd:HostResource>ovf:/disk/lamp</rasd:HostResource>
|
192
|
-
<rasd:InstanceID>5</rasd:InstanceID>
|
193
|
-
<rasd:Parent>4</rasd:Parent>
|
194
|
-
<rasd:ResourceType>17</rasd:ResourceType>
|
195
|
-
</Item>
|
196
|
-
</VirtualHardwareSection>
|
197
|
-
</VirtualSystem>
|
198
|
-
</Envelope>
|
@@ -1,352 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<occi:extension xmlns:occi="http://schemas.ogf.org/occi"
|
3
|
-
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
4
|
-
scheme="http://schemas.ogf.org/occi/infrastructure" name="infrastructure" >
|
5
|
-
<!--
|
6
|
-
Compute Resource
|
7
|
-
-->
|
8
|
-
<occi:kind term="compute" title="Compute Resource" >
|
9
|
-
<xsd:annotation>
|
10
|
-
<xsd:documentation xml:lang="en" >Information processing resources.</xsd:documentation>
|
11
|
-
</xsd:annotation>
|
12
|
-
<occi:related scheme="http://schemas.ogf.org/occi/core" term="resource" />
|
13
|
-
<occi:attribute name="occi.compute.architecture" mutable="true" >
|
14
|
-
<xsd:annotation>
|
15
|
-
<xsd:documentation xml:lang="en" >CPU architecture of the instance</xsd:documentation>
|
16
|
-
</xsd:annotation>
|
17
|
-
<xsd:simpleType>
|
18
|
-
<xsd:restriction base="xsd:string" >
|
19
|
-
<xsd:enumeration name="x86" />
|
20
|
-
<xsd:enumeration name="x64" />
|
21
|
-
</xsd:restriction>
|
22
|
-
</xsd:simpleType>
|
23
|
-
</occi:attribute>
|
24
|
-
<occi:attribute name="occi.compute.cores" type="xsd:integer" >
|
25
|
-
<xsd:annotation>
|
26
|
-
<xsd:documentation xml:lang="en" >Number of CPU cores assigned to the instance</xsd:documentation>
|
27
|
-
</xsd:annotation>
|
28
|
-
</occi:attribute>
|
29
|
-
<occi:attribute name="occi.compute.hostname" type="xsd:string" >
|
30
|
-
<xsd:annotation>
|
31
|
-
<xsd:documentation xml:lang="en" >Fully qualified DNS hostname for the instance</xsd:documentation>
|
32
|
-
</xsd:annotation>
|
33
|
-
</occi:attribute>
|
34
|
-
<occi:attribute name="occi.compute.speed" type="xsd:float" >
|
35
|
-
<xsd:annotation>
|
36
|
-
<xsd:documentation xml:lang="en" >CPU clock frequency (speed) in gigahertz</xsd:documentation>
|
37
|
-
</xsd:annotation>
|
38
|
-
</occi:attribute>
|
39
|
-
<occi:attribute name="occi.compute.memory" type="xsd:float" >
|
40
|
-
<xsd:annotation>
|
41
|
-
<xsd:documentation xml:lang="en" >Maximum RAM in gigabytes allocated to the instance</xsd:documentation>
|
42
|
-
</xsd:annotation>
|
43
|
-
</occi:attribute>
|
44
|
-
<occi:attribute name="occi.compute.state" mutable="false" use="required" >
|
45
|
-
<xsd:annotation>
|
46
|
-
<xsd:documentation xml:lang="en" >Current state of the instance</xsd:documentation>
|
47
|
-
</xsd:annotation>
|
48
|
-
<xsd:simpleType>
|
49
|
-
<xsd:restriction base="xsd:string" >
|
50
|
-
<xsd:enumeration name="active" />
|
51
|
-
<xsd:enumeration name="inactive" />
|
52
|
-
</xsd:restriction>
|
53
|
-
</xsd:simpleType>
|
54
|
-
</occi:attribute>
|
55
|
-
<occi:action scheme="./compute/action" term="start" />
|
56
|
-
<occi:action scheme="./compute/action" term="stop" >
|
57
|
-
<occi:attribute name="method" >
|
58
|
-
<xsd:simpleType>
|
59
|
-
<xsd:restriction base="xsd:string" >
|
60
|
-
<xsd:enumeration name="graceful" />
|
61
|
-
<xsd:enumeration name="acpioff" />
|
62
|
-
<xsd:enumeration name="poweroff" />
|
63
|
-
</xsd:restriction>
|
64
|
-
</xsd:simpleType>
|
65
|
-
</occi:attribute>
|
66
|
-
</occi:action>
|
67
|
-
<occi:action scheme="./compute/action" term="restart" >
|
68
|
-
<occi:attribute name="method" >
|
69
|
-
<xsd:simpleType>
|
70
|
-
<xsd:restriction base="xsd:string" >
|
71
|
-
<xsd:enumeration name="graceful" />
|
72
|
-
<xsd:enumeration name="warm" />
|
73
|
-
<xsd:enumeration name="cold" />
|
74
|
-
</xsd:restriction>
|
75
|
-
</xsd:simpleType>
|
76
|
-
</occi:attribute>
|
77
|
-
</occi:action>
|
78
|
-
<occi:action scheme="./compute/action" term="suspend" >
|
79
|
-
<occi:attribute name="method" >
|
80
|
-
<xsd:simpleType>
|
81
|
-
<xsd:restriction base="xsd:string" >
|
82
|
-
<xsd:enumeration name="hibernate" />
|
83
|
-
<xsd:enumeration name="suspend" />
|
84
|
-
</xsd:restriction>
|
85
|
-
</xsd:simpleType>
|
86
|
-
</occi:attribute>
|
87
|
-
</occi:action>
|
88
|
-
</occi:kind>
|
89
|
-
<!--
|
90
|
-
Storage Resource
|
91
|
-
-->
|
92
|
-
<occi:kind term="storage" title="Storage Resource" >
|
93
|
-
<xsd:annotation>
|
94
|
-
<xsd:documentation xml:lang="en" >Information recording resources.</xsd:documentation>
|
95
|
-
</xsd:annotation>
|
96
|
-
<occi:related scheme="http://schemas.ogf.org/occi/core" term="resource" />
|
97
|
-
<occi:attribute name="occi.storage.size" type="xsd:float" use="required" >
|
98
|
-
<xsd:annotation>
|
99
|
-
<xsd:documentation xml:lang="en" >Storage size in gigabytes of the instance.</xsd:documentation>
|
100
|
-
</xsd:annotation>
|
101
|
-
</occi:attribute>
|
102
|
-
<occi:attribute name="occi.storage.state" mutable="false" use="required" >
|
103
|
-
<xsd:annotation>
|
104
|
-
<xsd:documentation xml:lang="en" >Current status of the instance</xsd:documentation>
|
105
|
-
</xsd:annotation>
|
106
|
-
<xsd:simpleType>
|
107
|
-
<xsd:restriction base="xsd:string" >
|
108
|
-
<xsd:enumeration name="online" />
|
109
|
-
<xsd:enumeration name="offline" />
|
110
|
-
<xsd:enumeration name="backup" />
|
111
|
-
<xsd:enumeration name="snapshot" />
|
112
|
-
<xsd:enumeration name="resize" />
|
113
|
-
<xsd:enumeration name="degraded" />
|
114
|
-
</xsd:restriction>
|
115
|
-
</xsd:simpleType>
|
116
|
-
</occi:attribute>
|
117
|
-
<occi:action scheme="./storage/action" term="online" />
|
118
|
-
<occi:action scheme="./storage/action" term="offline" />
|
119
|
-
<occi:action scheme="./storage/action" term="backup" />
|
120
|
-
<occi:action scheme="./storage/action" term="snapshot" />
|
121
|
-
<occi:action scheme="./storage/action" term="resize" >
|
122
|
-
<occi:attribute name="size" type="xsd:float" >
|
123
|
-
<xsd:annotation>
|
124
|
-
<xsd:documentation xml:lang="en" >gigabytes</xsd:documentation>
|
125
|
-
</xsd:annotation>
|
126
|
-
</occi:attribute>
|
127
|
-
</occi:action>
|
128
|
-
</occi:kind>
|
129
|
-
<!--
|
130
|
-
StorageLink Link
|
131
|
-
-->
|
132
|
-
<occi:kind term="storagelink" title="StorageLink Link" >
|
133
|
-
<occi:related scheme="http://schemas.ogf.org/occi/core" term="link" />
|
134
|
-
<occi:attribute name="occi.storagelink.deviceid" use="required" type="xsd:string" >
|
135
|
-
<xsd:annotation>
|
136
|
-
<xsd:documentation xml:lang="en" >
|
137
|
-
Device identifier as defined by the OCCI service provider.
|
138
|
-
</xsd:documentation>
|
139
|
-
</xsd:annotation>
|
140
|
-
</occi:attribute>
|
141
|
-
<occi:attribute name="occi.storagelink.mountpoint" type="xsd:string" >
|
142
|
-
<xsd:annotation>
|
143
|
-
<xsd:documentation xml:lang="en" >
|
144
|
-
Point to where the storage is mounted in the guest OS.
|
145
|
-
</xsd:documentation>
|
146
|
-
</xsd:annotation>
|
147
|
-
</occi:attribute>
|
148
|
-
<occi:attribute name="occi.storagelink.state" use="required" mutable="false" >
|
149
|
-
<xsd:annotation>
|
150
|
-
<xsd:documentation xml:lang="en" >
|
151
|
-
Current status of the instance.
|
152
|
-
</xsd:documentation>
|
153
|
-
</xsd:annotation>
|
154
|
-
<xsd:simpleType>
|
155
|
-
<xsd:restriction base="xsd:string" >
|
156
|
-
<xsd:enumeration name="active" />
|
157
|
-
<xsd:enumeration name="inactive" />
|
158
|
-
</xsd:restriction>
|
159
|
-
</xsd:simpleType>
|
160
|
-
</occi:attribute>
|
161
|
-
</occi:kind>
|
162
|
-
<!--
|
163
|
-
Network
|
164
|
-
-->
|
165
|
-
<occi:kind term="network" title="Network Resource" >
|
166
|
-
<xsd:annotation>
|
167
|
-
<xsd:documentation xml:lang="en" >
|
168
|
-
Interconnection resoruce and represents a L2 networking
|
169
|
-
resource. This is complimented by the IPNetwork Mixin.
|
170
|
-
</xsd:documentation>
|
171
|
-
</xsd:annotation>
|
172
|
-
<occi:related scheme="http://schemas.ogf.org/occi/core" term="resource" />
|
173
|
-
<occi:attribute name="occi.network.vlan" mutable="true" >
|
174
|
-
<xsd:simpleType>
|
175
|
-
<xsd:restriction base="xsd:integer" >
|
176
|
-
<xsd:minInclusive value="0" />
|
177
|
-
<xsd:maxInclusive value="4095" />
|
178
|
-
</xsd:restriction>
|
179
|
-
</xsd:simpleType>
|
180
|
-
<xsd:annotation>
|
181
|
-
<xsd:documentation xml:lang="en" >802.1q VLAN identifier (e.g 343)</xsd:documentation>
|
182
|
-
</xsd:annotation>
|
183
|
-
</occi:attribute>
|
184
|
-
<occi:attribute name="occi.network.label" mutable="true" type="xsd:string" >
|
185
|
-
<xsd:annotation>
|
186
|
-
<xsd:documentation xml:lang="en" >Tag based VLANs (e.g. external-dmz)</xsd:documentation>
|
187
|
-
</xsd:annotation>
|
188
|
-
</occi:attribute>
|
189
|
-
<occi:attribute name="occi.network.state" mutable="false" use="required" >
|
190
|
-
<xsd:annotation>
|
191
|
-
<xsd:documentation xml:lang="en" >Current state of the instance</xsd:documentation>
|
192
|
-
</xsd:annotation>
|
193
|
-
<xsd:simpleType>
|
194
|
-
<xsd:restriction base="xsd:string" >
|
195
|
-
<xsd:enumeration name="active" />
|
196
|
-
<xsd:enumeration name="inactive" />
|
197
|
-
</xsd:restriction>
|
198
|
-
</xsd:simpleType>
|
199
|
-
</occi:attribute>
|
200
|
-
<occi:action scheme="./network/action" term="up" />
|
201
|
-
<occi:action scheme="./network/action" term="down" />
|
202
|
-
</occi:kind>
|
203
|
-
<!--
|
204
|
-
NetworkInterface Link
|
205
|
-
-->
|
206
|
-
<occi:kind term="networkinterface" title="NetworkInterface Link" >
|
207
|
-
<occi:related scheme="http://schemas.ogf.org/occi/core" term="link" />
|
208
|
-
<occi:attribute name="occi.networkinterface.interface" mutable="false" type="xsd:string" use="required" >
|
209
|
-
<xsd:annotation>
|
210
|
-
<xsd:documentation xml:lang="en" >
|
211
|
-
Identifier that relates the link to the link's device
|
212
|
-
interface.
|
213
|
-
</xsd:documentation>
|
214
|
-
</xsd:annotation>
|
215
|
-
</occi:attribute>
|
216
|
-
<occi:attribute name="occi.networkinterface.mac" type="occi:mac802" use="required" >
|
217
|
-
<xsd:annotation>
|
218
|
-
<xsd:documentation xml:lang="en" >
|
219
|
-
MAC address associated with the link's device interface.
|
220
|
-
</xsd:documentation>
|
221
|
-
</xsd:annotation>
|
222
|
-
</occi:attribute>
|
223
|
-
<occi:attribute name="occi.networkinterface.state" mutable="false" use="required" >
|
224
|
-
<xsd:annotation>
|
225
|
-
<xsd:documentation xml:lang="en" >Current status of the instance.</xsd:documentation>
|
226
|
-
</xsd:annotation>
|
227
|
-
<xsd:simpleType>
|
228
|
-
<xsd:restriction base="xsd:string" >
|
229
|
-
<xsd:enumeration name="active" />
|
230
|
-
<xsd:enumeration name="inactive" />
|
231
|
-
</xsd:restriction>
|
232
|
-
</xsd:simpleType>
|
233
|
-
</occi:attribute>
|
234
|
-
</occi:kind>
|
235
|
-
<!--
|
236
|
-
IP Networking Mixin
|
237
|
-
-->
|
238
|
-
<occi:mixin term="ipnetwork" title="IP Networking Mixin" scheme="./network" >
|
239
|
-
<xsd:annotation>
|
240
|
-
<xsd:documentation xml:lang="en" >
|
241
|
-
IPNetworking Mixin is defined in order to support L3/L4 capabilities
|
242
|
-
</xsd:documentation>
|
243
|
-
</xsd:annotation>
|
244
|
-
<occi:attribute name="occi.network.address" type="occi:cidr" >
|
245
|
-
<xsd:annotation>
|
246
|
-
<xsd:documentation xml:lang="en" >
|
247
|
-
Internet Protocol (IP) network address (e.g. 192.168.0.1/24, fc00::/7)
|
248
|
-
</xsd:documentation>
|
249
|
-
</xsd:annotation>
|
250
|
-
</occi:attribute>
|
251
|
-
<occi:attribute name="occi.network.gateway" type="occi:ip" >
|
252
|
-
<xsd:annotation>
|
253
|
-
<xsd:documentation xml:lang="en" >
|
254
|
-
Internet Protocol (IP) network address (e.g. 192.168.0.1, fc00::/7)
|
255
|
-
</xsd:documentation>
|
256
|
-
</xsd:annotation>
|
257
|
-
</occi:attribute>
|
258
|
-
<occi:attribute name="occi.network.allocation" use="required" >
|
259
|
-
<xsd:annotation>
|
260
|
-
<xsd:documentation xml:lang="en" >
|
261
|
-
Address allocation mechanism, 'dynamic' e.g. uses the
|
262
|
-
dynamic host configuration protocol, 'static' e.g. uses
|
263
|
-
user supplied static network configurations.
|
264
|
-
</xsd:documentation>
|
265
|
-
</xsd:annotation>
|
266
|
-
<xsd:simpleType>
|
267
|
-
<xsd:restriction base="xsd:string" >
|
268
|
-
<xsd:enumeration name="dynamic" />
|
269
|
-
<xsd:enumeration name="static" />
|
270
|
-
</xsd:restriction>
|
271
|
-
</xsd:simpleType>
|
272
|
-
</occi:attribute>
|
273
|
-
</occi:mixin>
|
274
|
-
<!--
|
275
|
-
IP NetworkInterface Mixin
|
276
|
-
-->
|
277
|
-
<occi:mixin term="ipnetworkinterface" title="IP Network Interface Mixin" scheme="./networkinterface" >
|
278
|
-
<xsd:annotation>
|
279
|
-
<xsd:documentation xml:lang="en" >
|
280
|
-
IPNetworkInterface mixin is described in order for
|
281
|
-
NetworkInterface to support L3/L4 capabilities (e.g. IP, TCP
|
282
|
-
etc.).
|
283
|
-
</xsd:documentation>
|
284
|
-
</xsd:annotation>
|
285
|
-
<occi:attribute name="occi.networkinterface.address" type="occi:cidr" use="required" >
|
286
|
-
<xsd:annotation>
|
287
|
-
<xsd:documentation xml:lang="en" >
|
288
|
-
Internet Procotol (IP) network address (e.g. 192.168.0.1/24,
|
289
|
-
fc00::/7) of the link.
|
290
|
-
</xsd:documentation>
|
291
|
-
</xsd:annotation>
|
292
|
-
</occi:attribute>
|
293
|
-
<occi:attribute name="occi.networkinterface.gateway" type="occi:ip">
|
294
|
-
<xsd:annotation>
|
295
|
-
<xsd:documentation xml:lang="en" >
|
296
|
-
Internet Protocol (IP) network address (e.g. 192.168.0.1/24, fc00::/7)
|
297
|
-
</xsd:documentation>
|
298
|
-
</xsd:annotation>
|
299
|
-
</occi:attribute>
|
300
|
-
<occi:attribute name="occi.networkinterface.allocation" use="required" >
|
301
|
-
<xsd:annotation>
|
302
|
-
<xsd:documentation xml:lang="en" >
|
303
|
-
Address mechanism, 'dynamic' e.g. uses the
|
304
|
-
dynamic host configuration protocol, 'static' e.g. uses
|
305
|
-
user supplied static network configurations.
|
306
|
-
</xsd:documentation>
|
307
|
-
</xsd:annotation>
|
308
|
-
<xsd:simpleType>
|
309
|
-
<xsd:restriction base="xsd:string" >
|
310
|
-
<xsd:enumeration name="dynamic" />
|
311
|
-
<xsd:enumeration name="static" />
|
312
|
-
</xsd:restriction>
|
313
|
-
</xsd:simpleType>
|
314
|
-
</occi:attribute>
|
315
|
-
</occi:mixin>
|
316
|
-
<!--
|
317
|
-
OS template
|
318
|
-
-->
|
319
|
-
<occi:mixin term="os_tpl" title="OS Template" />
|
320
|
-
<!--
|
321
|
-
Resource template
|
322
|
-
-->
|
323
|
-
<occi:mixin term="resource_tpl" title="Resoruce template" />
|
324
|
-
<!--
|
325
|
-
Attribute Types
|
326
|
-
-->
|
327
|
-
<xsd:simpleType name="ip">
|
328
|
-
<xsd:annotation>
|
329
|
-
<xsd:documentation xml:lang="en">
|
330
|
-
The datatype denoting a string corresponding to a IPv4 or IPv6 address.
|
331
|
-
</xsd:documentation>
|
332
|
-
</xsd:annotation>
|
333
|
-
<xsd:restriction base="xsd:string">
|
334
|
-
<xsd:pattern value="(((([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5]))|((([\da-fA-F]{1,4})|(\:))\:){7}(([\da-fA-F]{1,4})|(\:))))"/>
|
335
|
-
</xsd:restriction>
|
336
|
-
</xsd:simpleType>
|
337
|
-
<xsd:simpleType name="cidr" >
|
338
|
-
<xsd:annotation>
|
339
|
-
<xsd:documentation xml:lang="en">
|
340
|
-
The datatype denoting a string corresponding to a CIDR block.
|
341
|
-
</xsd:documentation>
|
342
|
-
</xsd:annotation>
|
343
|
-
<xsd:restriction base="xsd:string">
|
344
|
-
<xsd:pattern value="(((([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])\/(\d|[1-2]\d|3[0-2]))|((([\da-fA-F]{0,4})|(\:))\:){7}(([\da-fA-F]{0,4})|(\:)))\/([1-9]?\d|1[01]\d|12[0-8])))"/>
|
345
|
-
</xsd:restriction>
|
346
|
-
</xsd:simpleType>
|
347
|
-
<xsd:simpleType name="mac802" >
|
348
|
-
<xsd:restriction base="xsd:string" >
|
349
|
-
<xsd:pattern value="[\da-fA-F]{2}(\:[\da-fA-F]){5}" />
|
350
|
-
</xsd:restriction>
|
351
|
-
</xsd:simpleType>
|
352
|
-
</occi:extension>
|