occi-core 4.3.6 → 5.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (359) hide show
  1. checksums.yaml +4 -4
  2. data/.fasterer.yml +3 -0
  3. data/.gitignore +9 -16
  4. data/.rspec +1 -1
  5. data/.rubocop.yml +69 -0
  6. data/.travis.yml +27 -0
  7. data/AUTHORS +8 -6
  8. data/CHANGELOG.md +0 -0
  9. data/Gemfile +1 -1
  10. data/LICENSE +1 -1
  11. data/README.md +25 -170
  12. data/Rakefile +25 -17
  13. data/examples/initialize_model.rb +10 -0
  14. data/examples/parse_action_instance_json.rb +15 -0
  15. data/examples/parse_action_instance_text.rb +15 -0
  16. data/examples/parse_categories_json.rb +15 -0
  17. data/examples/parse_categories_text.rb +15 -0
  18. data/examples/parse_instance_json.rb +15 -0
  19. data/examples/parse_instance_text.rb +15 -0
  20. data/examples/parse_model_json.rb +9 -0
  21. data/examples/parse_model_text.rb +9 -0
  22. data/examples/render_action_instance_json.rb +17 -0
  23. data/examples/render_action_instance_text.rb +17 -0
  24. data/examples/render_instance_json.rb +20 -0
  25. data/examples/render_instance_text.rb +20 -0
  26. data/examples/render_model_json.rb +12 -0
  27. data/examples/render_model_text.rb +12 -0
  28. data/examples/rendering/action_instance.json +6 -0
  29. data/examples/rendering/action_instance.txt +2 -0
  30. data/examples/rendering/categories.json +78 -0
  31. data/examples/rendering/categories.txt +4 -0
  32. data/examples/rendering/instance.json +70 -0
  33. data/examples/rendering/instance.txt +12 -0
  34. data/examples/rendering/model.alt.json +1716 -0
  35. data/examples/rendering/model.json +785 -0
  36. data/examples/rendering/model.txt +68 -0
  37. data/lib/occi/core/action.rb +12 -26
  38. data/lib/occi/core/action_instance.rb +109 -65
  39. data/lib/occi/core/attribute.rb +136 -0
  40. data/lib/occi/core/attribute_definition.rb +269 -0
  41. data/lib/occi/core/category.rb +110 -83
  42. data/lib/occi/core/collection.rb +255 -0
  43. data/lib/occi/core/constants.rb +14 -0
  44. data/lib/occi/core/entity.rb +301 -195
  45. data/lib/occi/core/errors/.gitkeep +0 -0
  46. data/lib/occi/core/errors/attribute_definition_error.rb +11 -0
  47. data/lib/occi/core/errors/attribute_validation_error.rb +13 -0
  48. data/lib/occi/core/errors/category_validation_error.rb +13 -0
  49. data/lib/occi/core/errors/collection_lookup_error.rb +11 -0
  50. data/lib/occi/core/errors/instance_validation_error.rb +13 -0
  51. data/lib/occi/core/errors/mandatory_argument_error.rb +11 -0
  52. data/lib/occi/core/errors/model_lookup_error.rb +11 -0
  53. data/lib/occi/core/errors/parser_error.rb +11 -0
  54. data/lib/occi/core/errors/parsing_error.rb +11 -0
  55. data/lib/occi/core/errors/renderer_error.rb +11 -0
  56. data/lib/occi/core/errors/rendering_error.rb +11 -0
  57. data/lib/occi/core/errors/validation_error.rb +11 -0
  58. data/lib/occi/core/errors.rb +9 -0
  59. data/lib/occi/core/helpers/.gitkeep +0 -0
  60. data/lib/occi/core/helpers/argument_validator.rb +27 -0
  61. data/lib/occi/core/helpers/attributes_accessor.rb +22 -0
  62. data/lib/occi/core/helpers/error_handler.rb +29 -0
  63. data/lib/occi/core/helpers/hash_dereferencer.rb +149 -0
  64. data/lib/occi/core/helpers/identifier_validator.rb +135 -0
  65. data/lib/occi/core/helpers/instance_attribute_resetter.rb +131 -0
  66. data/lib/occi/core/helpers/instance_attributes_accessor.rb +30 -0
  67. data/lib/occi/core/helpers/locatable.rb +40 -0
  68. data/lib/occi/core/helpers/parser_dereferencer.rb +96 -0
  69. data/lib/occi/core/helpers/raw_json_parser.rb +18 -0
  70. data/lib/occi/core/helpers/renderable.rb +93 -0
  71. data/lib/occi/core/helpers/yaml_summoner.rb +44 -0
  72. data/lib/occi/core/helpers.rb +13 -0
  73. data/lib/occi/core/instance_builder.rb +162 -0
  74. data/lib/occi/core/kind.rb +100 -132
  75. data/lib/occi/core/link.rb +47 -72
  76. data/lib/occi/core/mixin.rb +76 -61
  77. data/lib/occi/core/model.rb +341 -0
  78. data/lib/occi/core/parsers/.gitkeep +0 -0
  79. data/lib/occi/core/parsers/base_parser.rb +168 -0
  80. data/lib/occi/core/parsers/json/.gitkeep +0 -0
  81. data/lib/occi/core/parsers/json/action_instance.rb +36 -0
  82. data/lib/occi/core/parsers/json/category.rb +113 -0
  83. data/lib/occi/core/parsers/json/entity.rb +156 -0
  84. data/lib/occi/core/parsers/json/validator/.gitkeep +0 -0
  85. data/lib/occi/core/parsers/json/validator/action-instance.json +3 -0
  86. data/lib/occi/core/parsers/json/validator/entity-collection.json +3 -0
  87. data/lib/occi/core/parsers/json/validator/link-collection.json +3 -0
  88. data/lib/occi/core/parsers/json/validator/link.json +3 -0
  89. data/lib/occi/core/parsers/json/validator/locations.json +3 -0
  90. data/lib/occi/core/parsers/json/validator/mixin-collection.json +3 -0
  91. data/lib/occi/core/parsers/json/validator/model.json +3 -0
  92. data/lib/occi/core/parsers/json/validator/occi-schema.json +277 -0
  93. data/lib/occi/core/parsers/json/validator/resource-collection.json +3 -0
  94. data/lib/occi/core/parsers/json/validator/resource.json +3 -0
  95. data/lib/occi/core/parsers/json/validator.rb +87 -0
  96. data/lib/occi/core/parsers/json_parser.rb +128 -0
  97. data/lib/occi/core/parsers/text/.gitkeep +0 -0
  98. data/lib/occi/core/parsers/text/category.rb +183 -0
  99. data/lib/occi/core/parsers/text/constants.rb +89 -0
  100. data/lib/occi/core/parsers/text/entity.rb +257 -0
  101. data/lib/occi/core/parsers/text/location.rb +48 -0
  102. data/lib/occi/core/parsers/text_parser.rb +257 -0
  103. data/lib/occi/core/parsers.rb +18 -0
  104. data/lib/occi/core/renderer_factory.rb +213 -0
  105. data/lib/occi/core/renderers/.gitkeep +0 -0
  106. data/lib/occi/core/renderers/base_renderer.rb +81 -0
  107. data/lib/occi/core/renderers/json/.gitkeep +0 -0
  108. data/lib/occi/core/renderers/json/action_instance.rb +24 -0
  109. data/lib/occi/core/renderers/json/attributes.rb +50 -0
  110. data/lib/occi/core/renderers/json/base.rb +46 -0
  111. data/lib/occi/core/renderers/json/category.rb +85 -0
  112. data/lib/occi/core/renderers/json/collection.rb +52 -0
  113. data/lib/occi/core/renderers/json/instance.rb +39 -0
  114. data/lib/occi/core/renderers/json/link.rb +48 -0
  115. data/lib/occi/core/renderers/json/model.rb +26 -0
  116. data/lib/occi/core/renderers/json/resource.rb +27 -0
  117. data/lib/occi/core/renderers/json_renderer.rb +72 -0
  118. data/lib/occi/core/renderers/text/.gitkeep +0 -0
  119. data/lib/occi/core/renderers/text/action_instance.rb +36 -0
  120. data/lib/occi/core/renderers/text/attributes.rb +87 -0
  121. data/lib/occi/core/renderers/text/base.rb +82 -0
  122. data/lib/occi/core/renderers/text/category.rb +183 -0
  123. data/lib/occi/core/renderers/text/collection.rb +65 -0
  124. data/lib/occi/core/renderers/text/instance.rb +44 -0
  125. data/lib/occi/core/renderers/text/link.rb +40 -0
  126. data/lib/occi/core/renderers/text/model.rb +41 -0
  127. data/lib/occi/core/renderers/text/resource.rb +109 -0
  128. data/lib/occi/core/renderers/text_renderer.rb +72 -0
  129. data/lib/occi/core/renderers.rb +20 -0
  130. data/lib/occi/core/resource.rb +93 -57
  131. data/lib/occi/core/utils/.gitkeep +0 -0
  132. data/lib/occi/core/version.rb +17 -0
  133. data/lib/occi/core/warehouse/actions/.gitkeep +0 -0
  134. data/lib/occi/core/warehouse/actions/attributes/.gitkeep +0 -0
  135. data/lib/occi/core/warehouse/kinds/.gitkeep +0 -0
  136. data/lib/occi/core/warehouse/kinds/attributes/.gitkeep +0 -0
  137. data/lib/occi/core/warehouse/kinds/attributes/occi.core.id.yml +7 -0
  138. data/lib/occi/core/warehouse/kinds/attributes/occi.core.source.yml +7 -0
  139. data/lib/occi/core/warehouse/kinds/attributes/occi.core.summary.yml +7 -0
  140. data/lib/occi/core/warehouse/kinds/attributes/occi.core.target.yml +7 -0
  141. data/lib/occi/core/warehouse/kinds/attributes/occi.core.title.yml +7 -0
  142. data/lib/occi/core/warehouse/kinds/entity.yml +10 -0
  143. data/lib/occi/core/warehouse/kinds/link.yml +10 -0
  144. data/lib/occi/core/warehouse/kinds/resource.yml +9 -0
  145. data/lib/occi/core/warehouse/mixins/.gitkeep +0 -0
  146. data/lib/occi/core/warehouse/mixins/attributes/.gitkeep +0 -0
  147. data/lib/occi/core/warehouse.rb +115 -0
  148. data/lib/occi/core.rb +59 -23
  149. data/lib/occi/infrastructure/compute.rb +5 -122
  150. data/lib/occi/infrastructure/constants.rb +25 -0
  151. data/lib/occi/infrastructure/instance_builder.rb +24 -0
  152. data/lib/occi/infrastructure/mixins/.gitkeep +0 -0
  153. data/lib/occi/infrastructure/mixins/os_tpl.rb +19 -0
  154. data/lib/occi/infrastructure/mixins/resource_tpl.rb +19 -0
  155. data/lib/occi/infrastructure/mixins.rb +12 -0
  156. data/lib/occi/infrastructure/model.rb +27 -0
  157. data/lib/occi/infrastructure/network.rb +5 -104
  158. data/lib/occi/infrastructure/networkinterface.rb +5 -100
  159. data/lib/occi/infrastructure/storage.rb +5 -59
  160. data/lib/occi/infrastructure/storagelink.rb +5 -54
  161. data/lib/occi/infrastructure/version.rb +5 -0
  162. data/lib/occi/infrastructure/warehouse/actions/.gitkeep +0 -0
  163. data/lib/occi/infrastructure/warehouse/actions/attributes/.gitkeep +0 -0
  164. data/lib/occi/infrastructure/warehouse/actions/compute_restart.yml +12 -0
  165. data/lib/occi/infrastructure/warehouse/actions/compute_save.yml +19 -0
  166. data/lib/occi/infrastructure/warehouse/actions/compute_start.yml +4 -0
  167. data/lib/occi/infrastructure/warehouse/actions/compute_stop.yml +12 -0
  168. data/lib/occi/infrastructure/warehouse/actions/compute_suspend.yml +12 -0
  169. data/lib/occi/infrastructure/warehouse/actions/network_down.yml +4 -0
  170. data/lib/occi/infrastructure/warehouse/actions/network_up.yml +4 -0
  171. data/lib/occi/infrastructure/warehouse/actions/networkinterface_down.yml +4 -0
  172. data/lib/occi/infrastructure/warehouse/actions/networkinterface_up.yml +4 -0
  173. data/lib/occi/infrastructure/warehouse/actions/storage_backup.yml +4 -0
  174. data/lib/occi/infrastructure/warehouse/actions/storage_offline.yml +4 -0
  175. data/lib/occi/infrastructure/warehouse/actions/storage_online.yml +4 -0
  176. data/lib/occi/infrastructure/warehouse/actions/storage_resize.yml +12 -0
  177. data/lib/occi/infrastructure/warehouse/actions/storage_snapshot.yml +4 -0
  178. data/lib/occi/infrastructure/warehouse/actions/storagelink_offline.yml +4 -0
  179. data/lib/occi/infrastructure/warehouse/actions/storagelink_online.yml +4 -0
  180. data/lib/occi/infrastructure/warehouse/kinds/.gitkeep +0 -0
  181. data/lib/occi/infrastructure/warehouse/kinds/attributes/.gitkeep +0 -0
  182. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.architecture.yml +7 -0
  183. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.cores.yml +7 -0
  184. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.hostname.yml +7 -0
  185. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.memory.yml +7 -0
  186. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.speed.yml +7 -0
  187. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.state.yml +7 -0
  188. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.network.label.yml +7 -0
  189. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.network.state.yml +7 -0
  190. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.network.vlan.yml +7 -0
  191. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.networkinterface.interface.yml +7 -0
  192. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.networkinterface.mac.yml +7 -0
  193. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.networkinterface.state.yml +7 -0
  194. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.storage.size.yml +7 -0
  195. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.storage.state.yml +7 -0
  196. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.storagelink.deviceid.yml +7 -0
  197. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.storagelink.mountpoint.yml +7 -0
  198. data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.storagelink.state.yml +7 -0
  199. data/lib/occi/infrastructure/warehouse/kinds/compute.yml +19 -0
  200. data/lib/occi/infrastructure/warehouse/kinds/network.yml +13 -0
  201. data/lib/occi/infrastructure/warehouse/kinds/networkinterface.yml +13 -0
  202. data/lib/occi/infrastructure/warehouse/kinds/storage.yml +15 -0
  203. data/lib/occi/infrastructure/warehouse/kinds/storagelink.yml +13 -0
  204. data/lib/occi/infrastructure/warehouse/mixins/.gitkeep +0 -0
  205. data/lib/occi/infrastructure/warehouse/mixins/attributes/.gitkeep +0 -0
  206. data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.network.address.yml +7 -0
  207. data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.network.allocation.yml +7 -0
  208. data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.network.gateway.yml +7 -0
  209. data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.networkinterface.address.yml +7 -0
  210. data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.networkinterface.allocation.yml +7 -0
  211. data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.networkinterface.gateway.yml +7 -0
  212. data/lib/occi/infrastructure/warehouse/mixins/ipnetwork.yml +11 -0
  213. data/lib/occi/infrastructure/warehouse/mixins/ipnetworkinterface.yml +11 -0
  214. data/lib/occi/infrastructure/warehouse.rb +20 -0
  215. data/lib/occi/infrastructure-ext.rb +35 -0
  216. data/lib/occi/infrastructure.rb +34 -19
  217. data/lib/occi/infrastructure_ext/constants.rb +20 -0
  218. data/lib/occi/infrastructure_ext/instance_builder.rb +22 -0
  219. data/lib/occi/infrastructure_ext/ipreservation.rb +9 -0
  220. data/lib/occi/infrastructure_ext/mixins/.gitkeep +0 -0
  221. data/lib/occi/infrastructure_ext/mixins/availability_zone.rb +19 -0
  222. data/lib/occi/infrastructure_ext/mixins.rb +12 -0
  223. data/lib/occi/infrastructure_ext/model.rb +26 -0
  224. data/lib/occi/infrastructure_ext/securitygroup.rb +9 -0
  225. data/lib/occi/infrastructure_ext/securitygrouplink.rb +9 -0
  226. data/lib/occi/infrastructure_ext/version.rb +5 -0
  227. data/lib/occi/infrastructure_ext/warehouse/actions/.gitkeep +0 -0
  228. data/lib/occi/infrastructure_ext/warehouse/actions/attributes/.gitkeep +0 -0
  229. data/lib/occi/infrastructure_ext/warehouse/actions/ipreservation_down.yml +4 -0
  230. data/lib/occi/infrastructure_ext/warehouse/actions/ipreservation_up.yml +4 -0
  231. data/lib/occi/infrastructure_ext/warehouse/kinds/.gitkeep +0 -0
  232. data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/.gitkeep +0 -0
  233. data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.ipreservation.address.yml +7 -0
  234. data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.ipreservation.state.yml +7 -0
  235. data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.ipreservation.used.yml +7 -0
  236. data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.securitygroup.rules.yml +7 -0
  237. data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.securitygroup.state.yml +7 -0
  238. data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.securitygrouplink.state.yml +7 -0
  239. data/lib/occi/infrastructure_ext/warehouse/kinds/ipreservation.yml +13 -0
  240. data/lib/occi/infrastructure_ext/warehouse/kinds/securitygroup.yml +9 -0
  241. data/lib/occi/infrastructure_ext/warehouse/kinds/securitygrouplink.yml +8 -0
  242. data/lib/occi/infrastructure_ext/warehouse/mixins/.gitkeep +0 -0
  243. data/lib/occi/infrastructure_ext/warehouse/mixins/attributes/.gitkeep +0 -0
  244. data/lib/occi/infrastructure_ext/warehouse.rb +20 -0
  245. data/lib/occi/monkey_island/boolean.rb +6 -0
  246. data/lib/occi/monkey_island/hash.rb +4 -0
  247. data/occi-core.gemspec +26 -26
  248. metadata +312 -243
  249. data/.yardopts +0 -1
  250. data/config/occi.yml +0 -4
  251. data/lib/occi/collection.rb +0 -265
  252. data/lib/occi/core/actions.rb +0 -21
  253. data/lib/occi/core/attributes.rb +0 -411
  254. data/lib/occi/core/categories.rb +0 -64
  255. data/lib/occi/core/dependencies.rb +0 -7
  256. data/lib/occi/core/entities.rb +0 -48
  257. data/lib/occi/core/kinds.rb +0 -22
  258. data/lib/occi/core/links.rb +0 -37
  259. data/lib/occi/core/mixins.rb +0 -37
  260. data/lib/occi/core/properties.rb +0 -108
  261. data/lib/occi/core/resources.rb +0 -14
  262. data/lib/occi/errors/attribute_definitions_converted_error.rb +0 -5
  263. data/lib/occi/errors/attribute_missing_error.rb +0 -5
  264. data/lib/occi/errors/attribute_name_invalid_error.rb +0 -5
  265. data/lib/occi/errors/attribute_not_defined_error.rb +0 -5
  266. data/lib/occi/errors/attribute_property_type_error.rb +0 -5
  267. data/lib/occi/errors/attribute_type_error.rb +0 -5
  268. data/lib/occi/errors/category_not_defined_error.rb +0 -5
  269. data/lib/occi/errors/kind_not_defined_error.rb +0 -5
  270. data/lib/occi/errors/parser_input_error.rb +0 -5
  271. data/lib/occi/errors/parser_type_error.rb +0 -5
  272. data/lib/occi/errors.rb +0 -1
  273. data/lib/occi/extensions/hashie.rb +0 -25
  274. data/lib/occi/helpers/comparators/action_instance.rb +0 -22
  275. data/lib/occi/helpers/comparators/attributes.rb +0 -22
  276. data/lib/occi/helpers/comparators/categories.rb +0 -22
  277. data/lib/occi/helpers/comparators/category.rb +0 -22
  278. data/lib/occi/helpers/comparators/collection.rb +0 -40
  279. data/lib/occi/helpers/comparators/entities.rb +0 -22
  280. data/lib/occi/helpers/comparators/entity.rb +0 -22
  281. data/lib/occi/helpers/comparators/properties.rb +0 -26
  282. data/lib/occi/helpers/comparators.rb +0 -1
  283. data/lib/occi/helpers/inspect.rb +0 -12
  284. data/lib/occi/infrastructure/network/ipnetwork.rb +0 -28
  285. data/lib/occi/infrastructure/networkinterface/ipnetworkinterface.rb +0 -28
  286. data/lib/occi/infrastructure/os_tpl.rb +0 -20
  287. data/lib/occi/infrastructure/resource_tpl.rb +0 -20
  288. data/lib/occi/log.rb +0 -71
  289. data/lib/occi/model.rb +0 -87
  290. data/lib/occi/parser/json.rb +0 -38
  291. data/lib/occi/parser/text/constants.rb +0 -89
  292. data/lib/occi/parser/text.rb +0 -280
  293. data/lib/occi/parser.rb +0 -144
  294. data/lib/occi/settings.rb +0 -10
  295. data/lib/occi/version.rb +0 -3
  296. data/lib/occi-core.rb +0 -53
  297. data/spec/helpers/to_plain.rb +0 -39
  298. data/spec/helpers/yaml_hash.rb +0 -32
  299. data/spec/occi/collection_samples/collection1.json +0 -1
  300. data/spec/occi/collection_samples/directory2/collection2.json +0 -1
  301. data/spec/occi/collection_spec.rb +0 -1003
  302. data/spec/occi/core/action_instance_spec.rb +0 -317
  303. data/spec/occi/core/action_spec.rb +0 -71
  304. data/spec/occi/core/attributes_spec.rb +0 -665
  305. data/spec/occi/core/categories_spec.rb +0 -28
  306. data/spec/occi/core/category_spec.rb +0 -216
  307. data/spec/occi/core/entities_spec.rb +0 -160
  308. data/spec/occi/core/entity_spec.rb +0 -374
  309. data/spec/occi/core/kind_spec.rb +0 -182
  310. data/spec/occi/core/link_spec.rb +0 -52
  311. data/spec/occi/core/links_spec.rb +0 -132
  312. data/spec/occi/core/mixin_spec.rb +0 -38
  313. data/spec/occi/core/mixins_spec.rb +0 -107
  314. data/spec/occi/core/properties_spec.rb +0 -171
  315. data/spec/occi/core/resource_spec.rb +0 -42
  316. data/spec/occi/core_spec.rb +0 -12
  317. data/spec/occi/infrastructure/compute_spec.rb +0 -229
  318. data/spec/occi/infrastructure/network_spec.rb +0 -96
  319. data/spec/occi/infrastructure/networkinterface_spec.rb +0 -96
  320. data/spec/occi/infrastructure/storage_spec.rb +0 -33
  321. data/spec/occi/infrastructure/storagelink_spec.rb +0 -45
  322. data/spec/occi/log_spec.rb +0 -117
  323. data/spec/occi/model_spec.rb +0 -256
  324. data/spec/occi/parser/json_samples/test.json +0 -49
  325. data/spec/occi/parser/text_samples/occi_categories.body_plain.expected +0 -2
  326. data/spec/occi/parser/text_samples/occi_categories.expected +0 -2
  327. data/spec/occi/parser/text_samples/occi_categories.parse_headers.expected +0 -2
  328. data/spec/occi/parser/text_samples/occi_categories.text +0 -2
  329. data/spec/occi/parser/text_samples/occi_compute_rocci_server.expected +0 -11
  330. data/spec/occi/parser/text_samples/occi_compute_rocci_server.text +0 -10
  331. data/spec/occi/parser/text_samples/occi_link_resource_instance.body_plain.expected +0 -7
  332. data/spec/occi/parser/text_samples/occi_link_resource_instance.expected +0 -7
  333. data/spec/occi/parser/text_samples/occi_link_resource_instance.parse.expected +0 -7
  334. data/spec/occi/parser/text_samples/occi_link_resource_instance.text +0 -7
  335. data/spec/occi/parser/text_samples/occi_link_simple.expected +0 -7
  336. data/spec/occi/parser/text_samples/occi_link_simple.text +0 -1
  337. data/spec/occi/parser/text_samples/occi_link_w_attributes.expected +0 -7
  338. data/spec/occi/parser/text_samples/occi_link_w_attributes.text +0 -7
  339. data/spec/occi/parser/text_samples/occi_link_w_category.expected +0 -7
  340. data/spec/occi/parser/text_samples/occi_link_w_category.text +0 -3
  341. data/spec/occi/parser/text_samples/occi_model_categories.expected +0 -3
  342. data/spec/occi/parser/text_samples/occi_model_rocci_server.text +0 -51
  343. data/spec/occi/parser/text_samples/occi_network_rocci_server.body_plain.expected +0 -11
  344. data/spec/occi/parser/text_samples/occi_network_rocci_server.expected +0 -11
  345. data/spec/occi/parser/text_samples/occi_network_rocci_server.resource.header.expected +0 -9
  346. data/spec/occi/parser/text_samples/occi_network_rocci_server.resource.rack.expected +0 -9
  347. data/spec/occi/parser/text_samples/occi_network_rocci_server.text +0 -11
  348. data/spec/occi/parser/text_samples/occi_resource_custom_class_w_attributes.parse.expected +0 -15
  349. data/spec/occi/parser/text_samples/occi_resource_custom_class_w_attributes.text +0 -15
  350. data/spec/occi/parser/text_samples/occi_resource_w_attributes.text +0 -11
  351. data/spec/occi/parser/text_samples/occi_resource_w_inline_links.expected +0 -1
  352. data/spec/occi/parser/text_samples/occi_resource_w_inline_links.text +0 -16
  353. data/spec/occi/parser/text_samples/occi_resource_w_inline_links_only.text +0 -13
  354. data/spec/occi/parser/text_samples/occi_storage_rocci_server.expected +0 -9
  355. data/spec/occi/parser/text_samples/occi_storage_rocci_server.text +0 -9
  356. data/spec/occi/parser/text_spec.rb +0 -320
  357. data/spec/occi/parser_spec.rb +0 -259
  358. data/spec/occi-core_spec.rb +0 -31
  359. data/spec/spec_helper.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 982c9d4d37b5b8e86e38e039dce74a1a27c3d0f9
4
- data.tar.gz: 8ff90a2a4c11dbeed57dd7ac8e8a5f4a7d14d9ec
3
+ metadata.gz: 5d36511dceaecabc4508ec2db62c83920e63fff0
4
+ data.tar.gz: e9f542fefa3da8fabe0e6aaecaa822b7d1d25233
5
5
  SHA512:
6
- metadata.gz: d5b7a5296a00711b0d9b3f1abfc8a6e089aeaf1e5e71c6de83ff987d49dbe65e2e4d0eb0cfbffb16303fc9e772ffbbe111b378f4a072bc5454d941ac93831f48
7
- data.tar.gz: 1a5b883d2eef57cdf6ee9dc498e3b9516f34025d2ba2c2193ab7f97d2d766c117dee223d0a5898ba703b215d5d451d7a4da484a59b650fcf14ad5c5e93615901
6
+ metadata.gz: b96ea07c5b9c28b5933e47f0874946abb38df81ceed4461a188c0b96ca3ae3ed56bf43842b1eddbca21c058c6884816683900e35a7e3fbe720da8ce86672eee8
7
+ data.tar.gz: a3b0c5dbb6b998df32495b6b2d474f7b7ab8dafe95264953410fe58ac3e1e07c1ea1bac21a5c4dff21142a5704cb180b2196083c78d08bd48173c8f2eca540c8
data/.fasterer.yml ADDED
@@ -0,0 +1,3 @@
1
+ exclude_paths:
2
+ - 'spec/**/*.rb'
3
+ - 'vendor/**/*.rb'
data/.gitignore CHANGED
@@ -1,16 +1,9 @@
1
- *.gem
2
- *.swp
3
- .project
4
- .idea
5
- .yardoc
6
- .bundle
7
- .rvmrc
8
- lib/occiantlr/output/
9
- pkg
10
- tmp
11
- log
12
- coverage
13
- vendor
14
- collection
15
- Gemfile.lock
16
- doc
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec CHANGED
@@ -1 +1 @@
1
- --require spec_helper --color --format documentation
1
+ --require spec_helper --color --format documentation --order rand
data/.rubocop.yml ADDED
@@ -0,0 +1,69 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-05-23 13:39:50 +0200 using RuboCop version 0.40.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ require: rubocop-rspec
10
+
11
+ Metrics/ModuleLength:
12
+ Exclude:
13
+ - 'spec/**/*'
14
+ - 'test/**/*'
15
+
16
+ Metrics/MethodLength:
17
+ Max: 12
18
+
19
+ Metrics/AbcSize:
20
+ Exclude:
21
+ - 'lib/occi/core/parsers/text/*'
22
+ - 'lib/occi/core/parsers/json/*'
23
+ - 'lib/occi/core/helpers/parser_dereferencer.rb'
24
+
25
+ Metrics/LineLength:
26
+ Max: 120
27
+ Exclude:
28
+ - 'lib/occi/core/parsers/text/constants.rb'
29
+
30
+ Metrics/BlockLength:
31
+ Exclude:
32
+ - 'spec/**/*'
33
+ - 'test/**/*'
34
+ - '*.gemspec'
35
+
36
+ ClassLength:
37
+ Max: 180
38
+
39
+ Style/Documentation:
40
+ Exclude:
41
+ - 'spec/**/*'
42
+ - 'test/**/*'
43
+ - 'lib/occi/core/version.rb'
44
+
45
+ Style/StructInheritance:
46
+ Exclude:
47
+ - 'lib/occi/core/attribute.rb'
48
+
49
+ Style/NilComparison:
50
+ Exclude:
51
+ - 'spec/occi/core/category_spec.rb'
52
+
53
+ Style/FileName:
54
+ Exclude:
55
+ - 'lib/occi/infrastructure-ext.rb'
56
+
57
+ RSpec/MultipleExpectations:
58
+ Max: 5
59
+
60
+ RSpec/MessageSpies:
61
+ EnforcedStyle: receive
62
+
63
+ RSpec/SubjectStub:
64
+ Exclude:
65
+ - 'spec/**/*'
66
+
67
+ RSpec/MessageExpectation:
68
+ Exclude:
69
+ - 'spec/**/*'
data/.travis.yml ADDED
@@ -0,0 +1,27 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.2.2
5
+ - 2.3.0
6
+ - 2.4.0
7
+ - ruby-head
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
12
+ fast_finish: true
13
+
14
+ branches:
15
+ only:
16
+ - master
17
+ - 4.3.x
18
+ - next
19
+
20
+ env:
21
+ - ON_TRAVIS_CI=yes
22
+
23
+ install: 'gem install bundler -v ">= 1.12" && bundle install --retry=10'
24
+
25
+ script: 'bundle exec rake acceptance'
26
+
27
+ sudo: false
data/AUTHORS CHANGED
@@ -1,9 +1,11 @@
1
- rOcci was designed and is mainly developed by Florian Feldhaus (GWDG) and Piotr Kasprzak (GWDG) in Germany.
1
+ rOCCI was originally designed by Florian Feldhaus (GWDG) and Piotr Kasprzak
2
+ (GWDG) in Germany. The project is currently being developed by CESNET, mainly
3
+ for EGI Federated Cloud.
2
4
 
3
- Special thanks to the following extraordinary individuals, whithout whom rOcci would not be possible:
5
+ Special thanks goes to the following extraordinary individuals, without whom
6
+ rOCCI would not be possible:
4
7
 
5
- * Hayati Bice - who wrote the initial version of an Occi server rOcci is based on
6
- * Max Günther - who wrote the EC2 backend
8
+ * Hayati Bice - who wrote the initial version of a server for rOCCI
9
+ * Max Günther - who wrote the EC2 backend
7
10
  * Andre Thevapalan - for his input regarding the JSON rendering
8
- * Boris Parak - especially for his input regarding the Client / Client DSL and CLI
9
- * the OCCI Working Group - for developing OCCI
11
+ * The OCCI WG - for developing OCCI
data/CHANGELOG.md ADDED
File without changes
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "https://rubygems.org/"
1
+ source 'https://rubygems.org/'
2
2
 
3
3
  gemspec
data/LICENSE CHANGED
@@ -4,7 +4,7 @@ The work represented by this source file is partially or entirely funded
4
4
  by the EGI-InSPIRE project through the European Commission's 7th Framework
5
5
  Programme (contract # INFSO-RI-261323)
6
6
 
7
- Copyright (c) 2012-2014 GWDG, CESNET
7
+ Copyright (c) 2012-2016 CESNET
8
8
 
9
9
  Licensed under the Apache License, Version 2.0 (the "License");
10
10
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -1,190 +1,45 @@
1
- rOCCI-core - A Ruby OCCI Framework
2
- =================================
3
-
4
- [![Build Status](https://secure.travis-ci.org/EGI-FCTF/rOCCI-core.png)](http://travis-ci.org/EGI-FCTF/rOCCI-core)
5
- [![Dependency Status](https://gemnasium.com/EGI-FCTF/rOCCI-core.png)](https://gemnasium.com/EGI-FCTF/rOCCI-core)
6
- [![Gem Version](https://fury-badge.herokuapp.com/rb/occi-core.png)](https://badge.fury.io/rb/occi-core)
7
- [![Code Climate](https://codeclimate.com/github/EGI-FCTF/rOCCI-core.png)](https://codeclimate.com/github/EGI-FCTF/rOCCI-core)
8
-
9
- Requirements
10
- ------------
1
+ # rOCCI-core - A Ruby OCCI Framework
2
+ [![Travis](https://img.shields.io/travis/EGI-FCTF/rOCCI-core.svg?style=flat-square)](http://travis-ci.org/EGI-FCTF/rOCCI-core)
3
+ [![Gemnasium](https://img.shields.io/gemnasium/EGI-FCTF/rOCCI-core.svg?style=flat-square)](https://gemnasium.com/EGI-FCTF/rOCCI-core)
4
+ [![Gem](https://img.shields.io/gem/v/occi-core.svg?style=flat-square)](https://rubygems.org/gems/occi-core)
5
+ [![Code Climate](https://img.shields.io/codeclimate/github/EGI-FCTF/rOCCI-core.svg?style=flat-square)](https://codeclimate.com/github/EGI-FCTF/rOCCI-core)
11
6
 
7
+ ## Requirements
12
8
  ### Ruby
13
- * Ruby 1.9.3 is required
14
- * RubyGems have to be installed
9
+ * Ruby 2.2.2 is required
10
+ * Rubygems
15
11
 
16
- ### Examples
17
- #### For distros based on Debian:
18
- ~~~
19
- apt-get install ruby rubygems ruby-dev
20
- ~~~
12
+ ## Installation
13
+ ### As a gem
14
+ To install the most recent stable version
21
15
  ~~~
22
- ruby -v
16
+ gem install occi-core
23
17
  ~~~
24
18
 
25
- **Unless you have Ruby >= 1.9.3, please, go to [rOCCI-core#RVM](#rvm) and install RVM with a newer Ruby version.**
26
-
27
- #### For distros based on RHEL:
28
- ~~~
29
- yum install ruby-devel openssl-devel gcc gcc-c++ ruby rubygems
30
- ~~~
19
+ To install the most recent beta version
31
20
  ~~~
32
- ruby -v
21
+ gem install occi-core --pre
33
22
  ~~~
34
23
 
35
- **Unless you have Ruby >= 1.9.3, please, go to [rOCCI-core#RVM](#rvm) and install RVM with a newer Ruby version.**
36
-
37
- Installation
38
- ------------
39
-
40
- ### From RubyGems.org
41
-
42
- To install the most recent stable version
43
-
44
- gem install occi-core
45
-
46
- To install the most recent beta version
47
-
48
- gem install occi-core --pre
49
-
50
- ### From source (dev)
51
-
52
- **Installation from source should never be your first choice! Especially, if you are not familiar with RVM, Bundler, Rake and other dev tools for Ruby!**
53
-
54
- **However, if you wish to contribute to our project, this is the right way to start.**
55
-
24
+ ### From source
56
25
  To build and install the bleeding edge version from master
57
-
58
- git clone git://github.com/EGI-FCTF/rOCCI-core.git
59
- cd rOCCI-core
60
- gem install bundler
61
- bundle install
62
- bundle exec rake spec
63
- rake install
64
-
65
- ### RVM
66
-
67
- **Notice:** Follow the RVM installation guide linked below, we recommend using the default 'Single-User installation'.
68
-
69
- **Warning:** NEVER install RVM as root! If you choose the 'Multi-User installation', use a different user account with sudo access instead!
70
-
71
- * [Installing RVM](https://rvm.io/rvm/install#explained)
72
- * Install Ruby
73
-
74
26
  ~~~
75
- rvm requirements
76
- rvm install 1.9.3
77
- rvm use 1.9.3 --default
27
+ gem install bundler
78
28
  ~~~
79
29
  ~~~
80
- ruby -v
30
+ git clone git://github.com/EGI-FCTF/rOCCI-core.git
31
+ cd rOCCI-core
32
+ gem build occi-core.gemspec
81
33
  ~~~
82
34
 
83
- Usage
84
- -----
85
- Detailed documentation is available in our [Wiki](https://github.com/EGI-FCTF/rOCCI-core/wiki).
86
-
87
- Changelog
88
- ---------
89
-
90
- ### Version 4.3
91
- * Internal updates and bug fixes
92
- * Updated JSON rendering
93
- * Updated dependencies
94
-
95
- ### Version 4.2
96
- * Internal changes and bug fixes
97
- * Extended test coverage
98
- * Added custom exceptions and error classes
99
- * Improved text/plain and text/occi rendering
100
-
101
- ### Version 4.1
102
- * Dropped support for Rubies 1.8.x
103
- * Updated dependencies
104
-
105
- ### Version 4.0
106
- * introduced compatibility mode (for OCCI-OS, on by default)
107
- * introduced new attribute handling for resources
108
- * completely rewrote OCCI parser
109
- * improved action and mixin handling
110
- * aligned with latest draft of OCCI Core and OCCI JSON specification
111
- * split the code into rOCCI-core, rOCCI-api and rOCCI-cli
112
- * internal changes, refactoring and some bugfixes
113
-
114
- ### Version 3.1
115
- * added basic OS Keystone support
116
- * added support for PKCS12 credentials for X.509 authN
117
- * updated templates for plain output formatting
118
- * minor client API changes
119
- * several bugfixes
120
-
121
- ### Version 3.0
122
-
123
- * many bugfixes
124
- * rewrote Core classes to use metaprogramming techniques
125
- * added VCR cassettes for reliable testing against prerecorded server responses
126
- * several updates to the OCCI Client
127
- * started work on an OCCI Client using AMQP as transport protocol
128
- * added support for keystone authentication to be used with the OpenStack OCCI server
129
- * updated dependencies
130
- * updated rspec tests
131
- * started work on cucumber features
132
-
133
- ### Version 2.5
134
-
135
- * improved OCCI Client
136
- * improved documentation
137
- * several bugfixes
138
-
139
- ### Version 2.4
140
-
141
- * Changed OCCI attribute properties from lowercase to first letter uppercase (e.g. type -> Type, default -> Default, ...)
142
-
143
- ### Version 2.3
144
-
145
- * OCCI objects are now initialized with a list of attributes instead of a hash. Thus it is easier to check which
146
- attributes are expected by a class and helps prevent errors.
147
- * Parsing of a subset of the OVF specification is supported. Further parts of the specification will be covered in
148
- future versions of rOCCI.
149
-
150
- ### Version 2.2
151
-
152
- * OCCI Client added. The client simplifies the execution of OCCI commands and provides shortcuts for often used steps.
153
-
154
- ### Version 2.1
155
-
156
- * 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.
157
-
158
- ### Version 2.0
159
-
160
- * 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.
161
-
162
- ### Version 1.X
163
-
164
- * 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.
165
-
166
- Development
167
- -----------
168
-
169
- Checkout latest version from git:
170
-
171
- git clone git://github.com/EGI-FCTF/rOCCI-core.git
172
-
173
- Change to rOCCI-core folder
174
-
175
- cd rOCCI-core
176
-
177
- Install dependencies
178
-
179
- bundle install
180
-
181
- ### Code Documentation
182
-
183
- [Code Documentation for rOCCI by YARD](http://rubydoc.info/github/EGI-FCTF/rOCCI-core/)
35
+ ## Usage
36
+ Detailed documentation is available in our [wiki](https://wiki.egi.eu/wiki/ROCCI).
184
37
 
185
- ### Continuous integration
38
+ ## Changelog
39
+ See `CHANGELOG.md`.
186
40
 
187
- [Continuous integration for rOCCI by Travis-CI](http://travis-ci.org/EGI-FCTF/rOCCI-core/)
41
+ ## Code Documentation
42
+ [Code Documentation for rOCCI](http://rubydoc.info/github/EGI-FCTF/rOCCI-core/)
188
43
 
189
44
  ### Contribute
190
45
 
data/Rakefile CHANGED
@@ -1,31 +1,39 @@
1
- require 'rubygems'
2
1
  require 'rubygems/tasks'
2
+ require 'rubocop/rake_task'
3
+ require 'yard'
4
+
5
+ task default: 'test'
3
6
 
4
- task :default => 'test'
7
+ desc 'Run acceptance tests (RSpec + Rubocop)'
8
+ task test: 'acceptance'
5
9
 
6
- desc "Run all tests; includes rspec and coverage reports"
7
- task :test => 'rcov:all'
10
+ desc 'Run all RSpec test with coverage reporting'
11
+ task spec: 'rcov:all'
8
12
 
9
- desc "Run all tests; includes rspec and coverage reports"
10
- task :spec => 'test'
13
+ Gem::Tasks.new(build: { tar: true, zip: true }, sign: { checksum: true, pgp: false })
11
14
 
12
- Gem::Tasks.new(:build => {:tar => true, :zip => true}, :sign => {:checksum => true, :pgp => false})
15
+ RuboCop::RakeTask.new
16
+
17
+ YARD::Rake::YardocTask.new do |t|
18
+ t.stats_options = ['--list-undoc']
19
+ end
20
+
21
+ desc 'Run acceptance tests (RSpec + Rubocop)'
22
+ task :acceptance do |_t|
23
+ Rake::Task['spec'].invoke
24
+ Rake::Task['rubocop'].invoke
25
+ end
13
26
 
14
27
  namespace :rcov do
15
28
  require 'rspec/core/rake_task'
16
29
 
17
- RSpec::Core::RakeTask.new(:rspec) do |t|
18
- ENV['COVERAGE'] = "true"
30
+ RSpec::Core::RakeTask.new(:rspec) do |_t|
31
+ ENV['COVERAGE'] = 'true'
19
32
  end
20
33
 
21
- desc "Run rspec to generate aggregated coverage"
22
- task :all do |t|
23
- rm "coverage/coverage.data" if File.exist?("coverage/coverage.data")
34
+ desc 'Run RSpec to generate aggregated coverage'
35
+ task :all do |_t|
36
+ rm 'coverage/coverage.data' if File.exist?('coverage/coverage.data')
24
37
  Rake::Task['rcov:rspec'].invoke
25
38
  end
26
39
  end
27
-
28
- require 'yard'
29
- YARD::Rake::YardocTask.new(:yard) do |t|
30
- t.options = ['--any', '--extra', '--opts'] # optional
31
- end
@@ -0,0 +1,10 @@
1
+ require 'occi/infrastructure-ext'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::InfrastructureExt::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+ model.load_infrastructure_ext!
9
+
10
+ model.valid!
@@ -0,0 +1,15 @@
1
+ require 'occi/infrastructure'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::Infrastructure::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+
9
+ model.valid!
10
+
11
+ parser = Occi::Core::Parsers::JsonParser.new(model: model, media_type: 'application/occi+json')
12
+ aif = File.read File.join(File.dirname(__FILE__), 'rendering', 'action_instance.json')
13
+
14
+ ai = parser.action_instances(aif, {}).first
15
+ ai.valid!
@@ -0,0 +1,15 @@
1
+ require 'occi/infrastructure'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::Infrastructure::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+
9
+ model.valid!
10
+
11
+ parser = Occi::Core::Parsers::TextParser.new(model: model, media_type: 'text/plain')
12
+ aif = File.read File.join(File.dirname(__FILE__), 'rendering', 'action_instance.txt')
13
+
14
+ ai = parser.action_instances(aif, {}).first
15
+ ai.valid!
@@ -0,0 +1,15 @@
1
+ require 'occi/infrastructure'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::Infrastructure::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+
9
+ model.valid!
10
+
11
+ parser = Occi::Core::Parsers::JsonParser.new(model: model, media_type: 'application/occi+json')
12
+ cf = File.read File.join(File.dirname(__FILE__), 'rendering', 'categories.json')
13
+
14
+ cats = parser.categories(cf, {})
15
+ cats.each(&:valid!)
@@ -0,0 +1,15 @@
1
+ require 'occi/infrastructure'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::Infrastructure::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+
9
+ model.valid!
10
+
11
+ parser = Occi::Core::Parsers::TextParser.new(model: model, media_type: 'text/plain')
12
+ cf = File.read File.join(File.dirname(__FILE__), 'rendering', 'categories.txt')
13
+
14
+ cats = parser.categories(cf, {})
15
+ cats.each(&:valid!)
@@ -0,0 +1,15 @@
1
+ require 'occi/infrastructure'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::Infrastructure::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+
9
+ model.valid!
10
+
11
+ parser = Occi::Core::Parsers::JsonParser.new(model: model, media_type: 'application/occi+json')
12
+ cf = File.read File.join(File.dirname(__FILE__), 'rendering', 'instance.json')
13
+
14
+ compute = parser.entities(cf, {}).first
15
+ compute.valid!
@@ -0,0 +1,15 @@
1
+ require 'occi/infrastructure'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::Infrastructure::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+
9
+ model.valid!
10
+
11
+ parser = Occi::Core::Parsers::TextParser.new(model: model, media_type: 'text/plain')
12
+ cf = File.read File.join(File.dirname(__FILE__), 'rendering', 'instance.txt')
13
+
14
+ compute = parser.entities(cf, {}).first
15
+ compute.valid!
@@ -0,0 +1,9 @@
1
+ require 'occi/infrastructure'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::Infrastructure::Model.new
6
+
7
+ mf = File.read File.join(File.dirname(__FILE__), 'rendering', 'model.json')
8
+ Occi::Core::Parsers::JsonParser.model(mf, {}, 'application/json', model)
9
+ model.valid!
@@ -0,0 +1,9 @@
1
+ require 'occi/infrastructure'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::Infrastructure::Model.new
6
+
7
+ mf = File.read File.join(File.dirname(__FILE__), 'rendering', 'model.txt')
8
+ Occi::Core::Parsers::TextParser.model(mf, {}, 'text/plain', model)
9
+ model.valid!
@@ -0,0 +1,17 @@
1
+ require 'occi/infrastructure-ext'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::InfrastructureExt::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+ model.load_infrastructure_ext!
9
+
10
+ model.valid!
11
+
12
+ ai = Occi::Core::ActionInstance.new(
13
+ action: model.actions.first
14
+ )
15
+ ai.valid!
16
+
17
+ puts ai.to_json
@@ -0,0 +1,17 @@
1
+ require 'occi/infrastructure-ext'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::InfrastructureExt::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+ model.load_infrastructure_ext!
9
+
10
+ model.valid!
11
+
12
+ ai = Occi::Core::ActionInstance.new(
13
+ action: model.actions.first
14
+ )
15
+ ai.valid!
16
+
17
+ puts ai.to_text
@@ -0,0 +1,20 @@
1
+ require 'occi/infrastructure-ext'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::InfrastructureExt::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+ model.load_infrastructure_ext!
9
+
10
+ model.valid!
11
+
12
+ compute = model.instance_builder.get Occi::Infrastructure::Constants::COMPUTE_KIND
13
+ compute.identify!
14
+ compute.title = 'My Compute Instance'
15
+ compute['occi.compute.cores'] = 4
16
+ compute['occi.compute.memory'] = 2.0
17
+
18
+ compute.valid!
19
+
20
+ puts compute.to_json
@@ -0,0 +1,20 @@
1
+ require 'occi/infrastructure-ext'
2
+
3
+ Yell.new '/dev/null', name: Object
4
+
5
+ model = Occi::InfrastructureExt::Model.new
6
+ model.load_core!
7
+ model.load_infrastructure!
8
+ model.load_infrastructure_ext!
9
+
10
+ model.valid!
11
+
12
+ compute = model.instance_builder.get Occi::Infrastructure::Constants::COMPUTE_KIND
13
+ compute.identify!
14
+ compute.title = 'My Compute Instance'
15
+ compute['occi.compute.cores'] = 4
16
+ compute['occi.compute.memory'] = 2.0
17
+
18
+ compute.valid!
19
+
20
+ puts compute.to_text