occi 2.0.6 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.gitignore +1 -0
  2. data/.yardopts +1 -1
  3. data/Gemfile +3 -20
  4. data/Gemfile.lock +10 -59
  5. data/README.md +64 -2
  6. data/etc/model/infrastructure/compute.json +115 -0
  7. data/etc/model/infrastructure/ipnetwork.json +43 -0
  8. data/etc/model/infrastructure/ipnetworkinterface.json +43 -0
  9. data/etc/model/infrastructure/network.json +56 -0
  10. data/etc/model/infrastructure/networkinterface.json +40 -0
  11. data/etc/model/infrastructure/os_template.json +9 -0
  12. data/etc/model/infrastructure/resource_template.json +9 -0
  13. data/etc/model/infrastructure/storage.json +75 -0
  14. data/etc/model/infrastructure/storagelink.json +38 -0
  15. data/lib/occi/collection.rb +34 -0
  16. data/lib/occi/core/action.rb +0 -21
  17. data/lib/occi/core/attribute_properties.rb +0 -21
  18. data/lib/occi/core/attributes.rb +1 -20
  19. data/lib/occi/core/category.rb +0 -21
  20. data/lib/occi/core/entity.rb +7 -28
  21. data/lib/occi/core/kind.rb +1 -22
  22. data/lib/occi/core/link.rb +3 -23
  23. data/lib/occi/core/mixin.rb +0 -22
  24. data/lib/occi/core/resource.rb +3 -24
  25. data/lib/occi/log.rb +24 -22
  26. data/lib/occi/model.rb +102 -0
  27. data/lib/occi/{parse.rb → parser.rb} +73 -56
  28. data/lib/occi/version.rb +1 -1
  29. data/lib/occi.rb +17 -17
  30. data/lib/{occi/antlr → occiantlr}/.gitignore +0 -0
  31. data/lib/{occi/antlr/OCCI.g → occiantlr/OCCIANTLR.g} +17 -50
  32. data/lib/{occi/antlr/OCCI.tokens → occiantlr/OCCIANTLR.tokens} +4 -2
  33. data/lib/{occi/antlr/OCCILexer.rb → occiantlr/OCCIANTLRLexer.rb} +597 -555
  34. data/lib/occiantlr/OCCIANTLRParser.rb +2232 -0
  35. data/lib/{occi/antlr → occiantlr}/README.md +0 -0
  36. data/occi.gemspec +3 -0
  37. data/spec/occi/collection_spec.rb +19 -0
  38. data/spec/occi/log_spec.rb +16 -0
  39. data/spec/occi/model_spec.rb +26 -0
  40. data/spec/occi/parser_spec.rb +12 -0
  41. data/spec/occiantlr/parser_spec.rb +84 -0
  42. metadata +78 -14
  43. data/lib/occi/antlr/OCCIParser.rb +0 -2472
  44. data/lib/occi/core/collection.rb +0 -27
  45. data/lib/occi/exceptions.rb +0 -59
  46. data/lib/occi/registry.rb +0 -87
  47. data/spec/occi/antlr/parser_spec.rb +0 -82
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .project
1
2
  .idea
2
3
  .yardoc
3
4
  .bundle
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --plugin yard-sinatra --markup markdown
1
+ --title "Documentation of the OCCI gem" --markup markdown
data/Gemfile CHANGED
@@ -1,32 +1,15 @@
1
1
  source :rubygems
2
2
 
3
3
  # external ruby libraries
4
- gem "uuidtools"
5
4
  gem "json"
6
5
  gem "antlr3"
7
- #gem "hashie", :git => 'git://github.com/ffeldhaus/hashie.git', :branch => "hash_deep_merge_with_array_concatenation"
8
6
  gem "hashie"
9
- gem "nokogiri", "<=1.5.0"
7
+ gem "uuidtools"
8
+ gem "nokogiri"
10
9
  gem "builder"
11
- gem "haml"
12
- gem "erubis"
13
-
14
- # sinatra and related
15
- gem "sinatra"
16
- gem "sinatra-contrib"
17
- gem "sinatra-cross_origin"
18
-
19
- # active gems
20
10
  gem "activesupport"
21
11
 
22
- # passenger
23
- gem "passenger"
24
-
25
- group :ec2 do
26
- gem "aws-sdk"
27
- gem "xml-simple"
28
- end
29
-
12
+ # development related gems
30
13
  group :development do
31
14
  gem "rspec"
32
15
  gem "simplecov"
data/Gemfile.lock CHANGED
@@ -1,72 +1,31 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (3.2.2)
4
+ activesupport (3.2.3)
5
5
  i18n (~> 0.6)
6
6
  multi_json (~> 1.0)
7
7
  antlr3 (1.8.12)
8
- aws-sdk (1.3.8)
9
- httparty (~> 0.7)
10
- json (~> 1.4)
11
- nokogiri (<= 1.5.0)
12
- uuidtools (~> 2.1)
13
- backports (2.5.0)
14
8
  builder (3.0.0)
15
- daemon_controller (1.0.0)
16
9
  diff-lcs (1.1.3)
17
- erubis (2.7.0)
18
- eventmachine (0.12.10)
19
- fastthread (1.0.7)
20
- haml (3.1.6)
21
10
  hashie (1.2.0)
22
- httparty (0.8.1)
23
- multi_json
24
- multi_xml
25
11
  i18n (0.6.0)
26
12
  json (1.6.6)
27
- multi_json (1.2.0)
28
- multi_xml (0.4.2)
29
- nokogiri (1.5.0)
30
- passenger (3.0.11)
31
- daemon_controller (>= 0.2.5)
32
- fastthread (>= 1.0.1)
33
- rack
34
- rake (>= 0.8.1)
35
- rack (1.4.1)
36
- rack-protection (1.2.0)
37
- rack
38
- rack-test (0.6.1)
39
- rack (>= 1.0)
40
- rake (0.9.2.2)
41
- rspec (2.9.0)
42
- rspec-core (~> 2.9.0)
43
- rspec-expectations (~> 2.9.0)
44
- rspec-mocks (~> 2.9.0)
45
- rspec-core (2.9.0)
46
- rspec-expectations (2.9.0)
13
+ multi_json (1.3.5)
14
+ rspec (2.10.0)
15
+ rspec-core (~> 2.10.0)
16
+ rspec-expectations (~> 2.10.0)
17
+ rspec-mocks (~> 2.10.0)
18
+ rspec-core (2.10.1)
19
+ rspec-expectations (2.10.0)
47
20
  diff-lcs (~> 1.1.3)
48
21
  rspec-http (0.10.0)
49
22
  rspec (~> 2.0)
50
- rspec-mocks (2.9.0)
23
+ rspec-mocks (2.10.1)
51
24
  simplecov (0.6.1)
52
25
  multi_json (~> 1.0)
53
26
  simplecov-html (~> 0.5.3)
54
27
  simplecov-html (0.5.3)
55
- sinatra (1.3.2)
56
- rack (~> 1.3, >= 1.3.6)
57
- rack-protection (~> 1.2)
58
- tilt (~> 1.3, >= 1.3.3)
59
- sinatra-contrib (1.3.1)
60
- backports (>= 2.0)
61
- eventmachine
62
- rack-protection
63
- rack-test
64
- sinatra (~> 1.3.0)
65
- tilt (~> 1.3)
66
- sinatra-cross_origin (0.1.0)
67
- tilt (1.3.3)
68
28
  uuidtools (2.1.2)
69
- xml-simple (1.1.1)
70
29
  yard (0.7.5)
71
30
  yard-sinatra (1.0.0)
72
31
  yard (~> 0.7)
@@ -77,21 +36,13 @@ PLATFORMS
77
36
  DEPENDENCIES
78
37
  activesupport
79
38
  antlr3
80
- aws-sdk
81
39
  builder
82
- erubis
83
- haml
84
40
  hashie
85
41
  json
86
- nokogiri (<= 1.5.0)
87
- passenger
42
+ nokogiri
88
43
  rspec
89
44
  rspec-http
90
45
  simplecov
91
- sinatra
92
- sinatra-contrib
93
- sinatra-cross_origin
94
46
  uuidtools
95
- xml-simple
96
47
  yard
97
48
  yard-sinatra
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  rOCCI - A Ruby OCCI Framework
2
- =============================
2
+ =================================
3
3
 
4
4
  [![Build Status](https://secure.travis-ci.org/gwdg/rOCCI.png)](http://travis-ci.org/gwdg/rOCCI)
5
5
 
@@ -8,7 +8,7 @@ Requirements
8
8
 
9
9
  The following setup is recommended
10
10
 
11
- * usage of the Ruby Version Manger recommended
11
+ * usage of the Ruby Version Manger
12
12
  * Ruby 1.9.3
13
13
  * RubyGems installed
14
14
 
@@ -31,6 +31,68 @@ Install dependencies for deployment
31
31
 
32
32
  bundle install --deployment
33
33
 
34
+ Usage
35
+ -----
36
+
37
+ First require the gem
38
+ require 'occi'
39
+
40
+ ### Logging
41
+
42
+ The OCCI gem includes its own logging mechanism using a message queue. By default, no one is listening to that queue.
43
+ A new OCCI Logger can be initialized by specifying the log destination (either a filename or an IO object like
44
+ STDOUT) and the log level.
45
+ OCCI::Log.new(STDOUT,OCCI::Log::INFO)
46
+ You can create multiple Loggers to receive the log output.
47
+
48
+ You can always, even if there is no logger defined, log output using the class methods of OCCI::Log e.g.
49
+ OCCI::Log.info("Test message")
50
+
51
+ ### Registering categories in the OCCI Model
52
+
53
+ Before the parser may be used, the available categories have to be registered in the OCCI Model.
54
+
55
+ For categories already specified by the OCCI WG a method exists in the OCCI Model class to register them:
56
+ OCCI::Model.register_core
57
+ OCCI::Model.register_infrastructure
58
+
59
+ Further categories can either be registered from files which include OCCI collections in JSON formator or from parsed
60
+ JSON objects (e.g. from the query interface of an OCCI service endpoint).
61
+
62
+ ### Parsing OCCI messages
63
+
64
+ The OCCI gem includes a Parser to easily parse OCCI messages. With a given media type (e.g. json,
65
+ xml or plain text) the parser analyses the content of the message body and, if supplied,
66
+ the message header. As the text/plain and text/occi media type do not clearly distinguish between a message with a
67
+ category and a message with an entity which has a kind, it has to be specified if the message contains a category (e
68
+ .g. for user defined mixins)
69
+
70
+ OCCI messages can be parsed for example like
71
+ media_type = text/plain
72
+ body = %Q|Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"|
73
+ header = {}
74
+ category = false
75
+ OCCI::Parser.parse(media_type,body,header,category)
76
+
77
+ ### Using the OCCI model
78
+
79
+ The OCCI gem includes all OCCI Core classes necessary to handly arbitrary OCCI objects.
80
+
81
+ Changelog
82
+ ---------
83
+
84
+ ### Version 2.1
85
+
86
+ Several improvements to the gem structure and code documentation. First rSpec test were added. Readme has been extended to include instructions how the gem can be used.
87
+
88
+ ### Version 2.0
89
+
90
+ Starting with version 2.0 Florian Feldhaus and Piotr Kasprzak took over the development of the OCCI gem. The codebase was taken from the rOCCI framework and improved to be bundled as a standalone gem.
91
+
92
+ ### Version 1.X
93
+
94
+ Version 1.X of the OCCI gem has been developed by retr0h and served as a simple way to access the first OpenNebula OCCI implementation.
95
+
34
96
  Development
35
97
  -----------
36
98
 
@@ -0,0 +1,115 @@
1
+ {
2
+ "kinds":[
3
+ {
4
+ "term":"compute",
5
+ "scheme":"http://schemas.ogf.org/occi/infrastructure#",
6
+ "title":"Compute Resource",
7
+ "related":[
8
+ "http://schemas.ogf.org/occi/core#resource"
9
+ ],
10
+ "attributes":{
11
+ "occi":{
12
+ "compute":{
13
+ "architecture":{
14
+ "mutable":true,
15
+ "required":false,
16
+ "type":"string",
17
+ "pattern":"x86|x64",
18
+ "default":"x86"
19
+ },
20
+ "cores":{
21
+ "mutable":true,
22
+ "required":false,
23
+ "type":"number",
24
+ "minimum":1,
25
+ "maximum":32767
26
+ },
27
+ "hostname":{
28
+ "mutable":true,
29
+ "required":false,
30
+ "type":"string",
31
+ "pattern":"(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*"
32
+ },
33
+ "speed":{
34
+ "mutable":true,
35
+ "required":false,
36
+ "type":"number",
37
+ "minimum":0,
38
+ "maximum":32767
39
+ },
40
+ "memory":{
41
+ "mutable":true,
42
+ "required":false,
43
+ "type":"number",
44
+ "minimum":0,
45
+ "maximum":32767
46
+ },
47
+ "state":{
48
+ "mutable":false,
49
+ "required":false,
50
+ "type":"string",
51
+ "pattern":"inactive|active|suspended|error",
52
+ "default":"inactive"
53
+ }
54
+ }
55
+ }
56
+ },
57
+ "actions":[
58
+ "http://schemas.ogf.org/occi/infrastructure/compute/action#start",
59
+ "http://schemas.ogf.org/occi/infrastructure/compute/action#stop",
60
+ "http://schemas.ogf.org/occi/infrastructure/compute/action#restart",
61
+ "http://schemas.ogf.org/occi/infrastructure/compute/action#suspend"
62
+ ],
63
+ "location":"/compute/"
64
+ }
65
+ ],
66
+ "actions":[
67
+ {
68
+ "term":"start",
69
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#",
70
+ "title":"Start Compute instance"
71
+ },
72
+ {
73
+ "term":"stop",
74
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#",
75
+ "title":"Stop Compute instance",
76
+ "attributes":{
77
+ "method":{
78
+ "mutable":true,
79
+ "required":false,
80
+ "type":"string",
81
+ "pattern":"graceful|acpioff|poweroff",
82
+ "default":"poweroff"
83
+ }
84
+ }
85
+ },
86
+ {
87
+ "term":"restart",
88
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#",
89
+ "title":"Restart Compute instance",
90
+ "attributes":{
91
+ "method":{
92
+ "mutable":true,
93
+ "required":false,
94
+ "type":"string",
95
+ "pattern":"graceful|warm|cold",
96
+ "default":"cold"
97
+ }
98
+ }
99
+ },
100
+ {
101
+ "term":"suspend",
102
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#",
103
+ "title":"Suspend Compute instance",
104
+ "attributes":{
105
+ "method":{
106
+ "mutable":true,
107
+ "required":false,
108
+ "type":"string",
109
+ "pattern":"hibernate|suspend",
110
+ "default":"suspend"
111
+ }
112
+ }
113
+ }
114
+ ]
115
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "mixins":[
3
+ {
4
+ "term":"ipnetwork",
5
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/network#",
6
+ "title":"IP Network Mixin",
7
+ "attributes":{
8
+ "occi":{
9
+ "network":{
10
+ "address":{
11
+ "mutable":true,
12
+ "required":false,
13
+ "type":"string",
14
+ "pattern":"(^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*(\\/(\\d|\\d\\d|1[0-1]\\d|12[0-8]))$)|(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\/(\\d|[1-2]\\d|3[0-2]))$)",
15
+ "default":"10.0.0.0/8"
16
+ },
17
+ "gateway":{
18
+ "mutable":true,
19
+ "required":false,
20
+ "type":"string",
21
+ "pattern":"(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$)|(^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*)",
22
+ "default":"10.0.0.1"
23
+ },
24
+ "allocation":{
25
+ "mutable":true,
26
+ "required":false,
27
+ "type":"string",
28
+ "pattern":"dynamic|static",
29
+ "default":"dynamic"
30
+ },
31
+ "state":{
32
+ "mutable":false,
33
+ "required":false,
34
+ "type":"string",
35
+ "pattern":"active|inactive",
36
+ "default":"inactive"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ ]
43
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "mixins":[
3
+ {
4
+ "term":"ipnetworkinterface",
5
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/networkinterface#",
6
+ "title":"IP Networkinterface Mixin",
7
+ "attributes":{
8
+ "occi":{
9
+ "networkinterface":{
10
+ "address":{
11
+ "mutable":true,
12
+ "required":false,
13
+ "type":"string",
14
+ "pattern":"(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$)|(^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*)",
15
+ "default":"10.0.0.0/8"
16
+ },
17
+ "gateway":{
18
+ "mutable":true,
19
+ "required":false,
20
+ "type":"string",
21
+ "pattern":"(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$)|(^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*)",
22
+ "default":"10.0.0.1"
23
+ },
24
+ "allocation":{
25
+ "mutable":true,
26
+ "required":false,
27
+ "type":"string",
28
+ "pattern":"dynamic|static",
29
+ "default":"dynamic"
30
+ },
31
+ "state":{
32
+ "mutable":false,
33
+ "required":false,
34
+ "type":"string",
35
+ "pattern":"active|inactive",
36
+ "default":"inactive"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ ]
43
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "kinds":[
3
+ {
4
+ "term":"network",
5
+ "scheme":"http://schemas.ogf.org/occi/infrastructure#",
6
+ "title":"Network Resource",
7
+ "related":[
8
+ "http://schemas.ogf.org/occi/core#resource"
9
+ ],
10
+ "attributes":{
11
+ "occi":{
12
+ "network":{
13
+ "vlan":{
14
+ "mutable":true,
15
+ "required":false,
16
+ "type":"number",
17
+ "minimum":0,
18
+ "maximum":4095,
19
+ "default":0
20
+ },
21
+ "label":{
22
+ "mutable":true,
23
+ "required":false,
24
+ "type":"string",
25
+ "pattern":".*"
26
+ },
27
+ "state":{
28
+ "mutable":false,
29
+ "required":false,
30
+ "type":"string",
31
+ "pattern":"active|inactive|error",
32
+ "default":"inactive"
33
+ }
34
+ }
35
+ }
36
+ },
37
+ "actions":[
38
+ "http://schemas.ogf.org/occi/infrastructure/network/action#up" ,
39
+ "http://schemas.ogf.org/occi/infrastructure/network/action#down"
40
+ ],
41
+ "location":"/network/"
42
+ }
43
+ ],
44
+ "actions":[
45
+ {
46
+ "term":"up",
47
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/network/action#",
48
+ "title":"Activate network"
49
+ },
50
+ {
51
+ "term":"down",
52
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/network/action#up",
53
+ "title":"Activate network"
54
+ }
55
+ ]
56
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "kinds":[
3
+ {
4
+ "term":"networkinterface",
5
+ "scheme":"http://schemas.ogf.org/occi/infrastructure#",
6
+ "title":"Networkinterface",
7
+ "related":[
8
+ "http://schemas.ogf.org/occi/core#link"
9
+ ],
10
+ "attributes":{
11
+ "occi":{
12
+ "networkinterface":{
13
+ "interface":{
14
+ "mutable":true,
15
+ "required":false,
16
+ "type":"string",
17
+ "pattern":".*",
18
+ "default":"eth0"
19
+ },
20
+ "mac":{
21
+ "mutable":true,
22
+ "required":false,
23
+ "type":"string",
24
+ "pattern":"^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$",
25
+ "default":"00:16:3e:00:00:00"
26
+ },
27
+ "state":{
28
+ "mutable":false,
29
+ "required":false,
30
+ "type":"string",
31
+ "pattern":"active|inactive",
32
+ "default":"inactive"
33
+ }
34
+ }
35
+ }
36
+ },
37
+ "location":"/networkinterface/"
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "mixins":[
3
+ {
4
+ "term":"os_tpl",
5
+ "scheme":"http://schemas.ogf.org/occi/infrastructure#",
6
+ "title":"Operating System Template"
7
+ }
8
+ ]
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "mixins":[
3
+ {
4
+ "term":"resource_tpl",
5
+ "scheme":"http://schemas.ogf.org/occi/infrastructure#",
6
+ "title":"Resource Template"
7
+ }
8
+ ]
9
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "kinds":[
3
+ {
4
+ "term":"storage",
5
+ "scheme":"http://schemas.ogf.org/occi/infrastructure#",
6
+ "title":"Storage Resource",
7
+ "related":[
8
+ "http://schemas.ogf.org/occi/core#resource"
9
+ ],
10
+ "attributes":{
11
+ "occi":{
12
+ "storage":{
13
+ "size":{
14
+ "mutable":true,
15
+ "required":false,
16
+ "type":"number",
17
+ "minimum":0,
18
+ "maximum":32767
19
+ },
20
+ "state":{
21
+ "mutable":false,
22
+ "required":false,
23
+ "type":"string",
24
+ "pattern":"online|offline|backup|snapshot|resize|degraded",
25
+ "default":"offline"
26
+ }
27
+ }
28
+ }
29
+ },
30
+ "actions":[
31
+ "http://schemas.ogf.org/occi/infrastructure/storage/action#online",
32
+ "http://schemas.ogf.org/occi/infrastructure/storage/action#offline",
33
+ "http://schemas.ogf.org/occi/infrastructure/storage/action#backup",
34
+ "http://schemas.ogf.org/occi/infrastructure/storage/action#snapshot",
35
+ "http://schemas.ogf.org/occi/infrastructure/storage/action#resize"
36
+ ],
37
+ "location":"/storage/"
38
+ }
39
+ ],
40
+ "actions":[
41
+ {
42
+ "term":"online",
43
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/storage/action#",
44
+ "title":"Activate Storage"
45
+ },
46
+ {
47
+ "term":"offline",
48
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/storage/action#",
49
+ "title":"Deactivate Storage"
50
+ },
51
+ {
52
+ "term":"backup",
53
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/storage/action#",
54
+ "title":"Backup Storage"
55
+ },
56
+ {
57
+ "term":"snapshot",
58
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/storage/action#",
59
+ "title":"Snapshot Storage"
60
+ },
61
+ {
62
+ "term":"resize",
63
+ "scheme":"http://schemas.ogf.org/occi/infrastructure/storage/action#",
64
+ "title":"Resize Storage",
65
+ "attributes":{
66
+ "size":{
67
+ "mutable":true,
68
+ "required":false,
69
+ "type":"number",
70
+ "default":"suspend"
71
+ }
72
+ }
73
+ }
74
+ ]
75
+ }