occi-api 4.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/.gitignore +15 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +43 -0
  4. data/.yardopts +1 -0
  5. data/AUTHORS +9 -0
  6. data/Gemfile +16 -0
  7. data/LICENSE +13 -0
  8. data/README.md +344 -0
  9. data/Rakefile +37 -0
  10. data/examples/dsl_example.rb +167 -0
  11. data/examples/x509auth_example.rb +161 -0
  12. data/ext/mkrf_conf.rb +34 -0
  13. data/features/cassettes/Create_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +288 -0
  14. data/features/cassettes/Delete_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +288 -0
  15. data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__application_json_200_.yml +333 -0
  16. data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__text_plain_200_.yml +529 -0
  17. data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__text_plain_200_action_.yml +288 -0
  18. data/features/cassettes/Miscellaneous_operation_on_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +288 -0
  19. data/features/cassettes/Read_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +288 -0
  20. data/features/cassettes/Update_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +288 -0
  21. data/features/common/step_definitions/common_steps.rb +32 -0
  22. data/features/occi/core/create/create.feature +18 -0
  23. data/features/occi/core/create/step_definitions/create_steps.rb +0 -0
  24. data/features/occi/core/delete/delete.feature +18 -0
  25. data/features/occi/core/delete/step_definitions/delete_steps.rb +0 -0
  26. data/features/occi/core/discovery_interface/discovery_interface.feature +37 -0
  27. data/features/occi/core/discovery_interface/step_definitions/discovery_interface_steps.rb +19 -0
  28. data/features/occi/core/miscellaneous/miscellaneous.feature +18 -0
  29. data/features/occi/core/miscellaneous/step_definitions/miscellaneous_steps.rb +0 -0
  30. data/features/occi/core/read/read.feature +18 -0
  31. data/features/occi/core/read/step_definitions/read_steps.rb +0 -0
  32. data/features/occi/core/update/step_definitions/update_steps.rb +0 -0
  33. data/features/occi/core/update/update.feature +18 -0
  34. data/features/occi/infrastructure/create/create.feature +18 -0
  35. data/features/occi/infrastructure/create/step_definitions/create_steps.rb +0 -0
  36. data/features/support/env.rb +16 -0
  37. data/lib/occi/api/client/client_amqp.rb +766 -0
  38. data/lib/occi/api/client/client_base.rb +689 -0
  39. data/lib/occi/api/client/client_http.rb +541 -0
  40. data/lib/occi/api/client/errors/authn_error.rb +7 -0
  41. data/lib/occi/api/client/errors.rb +1 -0
  42. data/lib/occi/api/client/http/authn_plugins/base.rb +27 -0
  43. data/lib/occi/api/client/http/authn_plugins/basic.rb +22 -0
  44. data/lib/occi/api/client/http/authn_plugins/digest.rb +22 -0
  45. data/lib/occi/api/client/http/authn_plugins/dummy.rb +13 -0
  46. data/lib/occi/api/client/http/authn_plugins/keystone.rb +61 -0
  47. data/lib/occi/api/client/http/authn_plugins/x509.rb +46 -0
  48. data/lib/occi/api/client/http/authn_plugins.rb +6 -0
  49. data/lib/occi/api/client/http/authn_utils.rb +87 -0
  50. data/lib/occi/api/client/http/httparty_fix.rb +53 -0
  51. data/lib/occi/api/client/http/net_http_fix.rb +21 -0
  52. data/lib/occi/api/dsl.rb +146 -0
  53. data/lib/occi/api/version.rb +5 -0
  54. data/lib/occi-api.rb +14 -0
  55. data/occi-api.gemspec +38 -0
  56. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/creates_a_new_compute_resource.yml +266 -0
  57. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/creates_a_new_network_resource.yml +266 -0
  58. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/creates_a_new_storage_resource.yml +266 -0
  59. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deletes_a_compute_resource.yml +266 -0
  60. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deletes_a_network_resource.yml +266 -0
  61. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deletes_a_storage_resource.yml +266 -0
  62. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deploys_an_instance_based_on_OVF_OVA_file.yml +266 -0
  63. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_compute_resources.yml +368 -0
  64. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_network_resources.yml +370 -0
  65. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_storage_resources.yml +430 -0
  66. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/establishes_connection.yml +266 -0
  67. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/finds_and_describes_scoped_os_tpl_mixin.yml +266 -0
  68. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/finds_and_describes_scoped_resource_tpl_mixin.yml +266 -0
  69. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/finds_and_describes_unscoped_mixin.yml +266 -0
  70. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_compute_resource_using_type_identifier.yml +266 -0
  71. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_compute_resource_using_type_name.yml +266 -0
  72. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_network_resource_using_type_identifier.yml +266 -0
  73. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_network_resource_using_type_name.yml +266 -0
  74. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_storage_resource_using_type_identifier.yml +266 -0
  75. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_storage_resource_using_type_name.yml +266 -0
  76. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_entity_type_identifiers.yml +266 -0
  77. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_entity_types.yml +266 -0
  78. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_link_type_identifiers.yml +266 -0
  79. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_link_types.yml +266 -0
  80. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_mixin_type_identifiers.yml +266 -0
  81. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_mixin_types.yml +266 -0
  82. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_mixins.yml +266 -0
  83. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_resource_type_identifiers.yml +266 -0
  84. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_resource_types.yml +266 -0
  85. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_compute_resources.yml +308 -0
  86. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_network_resources.yml +308 -0
  87. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_os_tpl_mixins.yml +266 -0
  88. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_resource_tpl_mixins.yml +266 -0
  89. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_storage_resources.yml +310 -0
  90. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/refreshes_its_model.yml +485 -0
  91. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/triggers_an_action_on_a_compute_resource.yml +266 -0
  92. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/triggers_an_action_on_a_network_resource.yml +266 -0
  93. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/triggers_an_action_on_a_storage_resource.yml +266 -0
  94. data/spec/occi/api/client/client_amqp_spec.rb +158 -0
  95. data/spec/occi/api/client/client_http_spec.rb +292 -0
  96. data/spec/occi/api/client/http/authn_utils_spec.rb +55 -0
  97. data/spec/occi/api/client/http/httparty_fix_spec.rb +0 -0
  98. data/spec/occi/api/client/http/net_http_fix_spec.rb +0 -0
  99. data/spec/occi/api/client/http/rocci-cred-cert.pem +3 -0
  100. data/spec/occi/api/client/http/rocci-cred-key-jruby.pem +3 -0
  101. data/spec/occi/api/client/http/rocci-cred-key.pem +3 -0
  102. data/spec/occi/api/client/http/rocci-cred.p12 +0 -0
  103. data/spec/occi/api/dsl_spec.rb +21 -0
  104. data/spec/spec_helper.rb +38 -0
  105. metadata +379 -0
@@ -0,0 +1,37 @@
1
+ # language: en
2
+
3
+ Feature: Discovery Interface
4
+ In order to discover the capabilities of an OCCI Server
5
+ As an OCCI Client
6
+ I want to receive all OCCI Categories supported by the OCCI Server
7
+
8
+ @vcr_record
9
+ Scenario Outline: Retrieving all OCCI Categories supported by the OCCI Server
10
+ Given endpoint : <endpoint>
11
+ And transfer_protocol : <protocol>
12
+ And accept type : <accept_type>
13
+ And category filter : <category_filter>
14
+ And have an initialize Client
15
+ When OCCI Client request all OCCI Categories supported by the OCCI Server
16
+ Then the Client should have the response code <response_code>
17
+ And OCCI Client should display the OCCI Categories received from the OCCI Server
18
+
19
+ @vcr_record
20
+ Scenarios:
21
+ | protocol | endpoint | accept_type | response_code | category_filter |
22
+ | http | http://141.5.99.69/ | application/json | 200 | |
23
+ #| http | http://141.5.99.69/ | text/occi | 200 | |
24
+ | http | http://141.5.99.69/ | text/plain | 200 | |
25
+ #| http | http://46.231.128.85:8086/| text/occi | 200 | |
26
+ | http | http://141.5.99.69/ | text/plain | 200 | action |
27
+
28
+ #Scenario: Retrieving the OCCI Categories with an OCCI Category filter from the OCCI Server
29
+ # Given an "http" OCCI Server with endpoint "http://141.5.99.69/"
30
+ # And the client accept "text/plain"
31
+ # And OCCI Client requests all OCCI Categories supported by the OCCI Server
32
+ # And select "action" Category from the OCCI Server
33
+ # When OCCI Client requests from the OCCI Server the OCCI Categories related to the selected OCCI Category
34
+ # Then OCCI Client should display the OCCI Categories received from the OCCI Server
35
+ # And displayed Categories should related to the selected OCCI Category
36
+ # And should be some
37
+
@@ -0,0 +1,19 @@
1
+ When /^OCCI Client request all OCCI Categories supported by the OCCI Server$/ do
2
+ if @category_filter.length > 0
3
+ @category_filter = @category_filter.pluralize
4
+ @selected_category = @client.model.send @category_filter.to_sym
5
+ @selected_category.should have_at_least(1).bla
6
+ pending
7
+ else
8
+ @client.refresh
9
+ end
10
+ end
11
+
12
+ Then /^OCCI Client should display the OCCI Categories received from the OCCI Server$/ do
13
+ @client.model.should_not be_empty
14
+
15
+ # @client.model.actions .should have_at_least(1).actions
16
+ @client.model.kinds .should have_at_least(4).kinds
17
+ @client.model.links .should be_empty
18
+ @client.model.resources.should be_empty
19
+ end
@@ -0,0 +1,18 @@
1
+ Feature:
2
+ In order to manipulate an OCCI Resource on the OCCI Server
3
+ As an OCCI Client
4
+ I want to get an success report of the miscellaneous operation
5
+
6
+ @vcr_record
7
+ Scenario Outline: Miscellaneous operation on an OCCI Resource
8
+ Given endpoint : <endpoint>
9
+ And transfer_protocol : <protocol>
10
+ And accept type : <accept_type>
11
+ And have an initialize Client
12
+ When the Client makes a miscellaneous request
13
+ Then the Client should have the response code <response_code>
14
+
15
+ @vcr_record
16
+ Scenarios:
17
+ | protocol | endpoint | accept_type | response_code |
18
+ | http | http://141.5.99.69/ | text/plain | 201 |
@@ -0,0 +1,18 @@
1
+ Feature:
2
+ In order to read an OCCI Resource on the OCCI Server
3
+ As an OCCI Client
4
+ I want to get an success report of the read operation and receive Resource data from the OCCI Server
5
+
6
+ @vcr_record
7
+ Scenario Outline: Read an OCCI Resource
8
+ Given endpoint : <endpoint>
9
+ And transfer_protocol : <protocol>
10
+ And accept type : <accept_type>
11
+ And have an initialize Client
12
+ When the Client makes a read request
13
+ Then the Client should have the response code <response_code>
14
+
15
+ @vcr_record
16
+ Scenarios:
17
+ | protocol | endpoint | accept_type | response_code |
18
+ | http | http://141.5.99.69/ | text/plain | 201 |
@@ -0,0 +1,18 @@
1
+ Feature:
2
+ In order to update an OCCI Resource on the OCCI Server
3
+ As an OCCI Client
4
+ I want to get an success report of the update operation
5
+
6
+ @vcr_record
7
+ Scenario Outline: Update an OCCI Resource
8
+ Given endpoint : <endpoint>
9
+ And transfer_protocol : <protocol>
10
+ And accept type : <accept_type>
11
+ And have an initialize Client
12
+ When the Client makes an update request
13
+ Then the Client should have the response code <response_code>
14
+
15
+ @vcr_record
16
+ Scenarios:
17
+ | protocol | endpoint | accept_type | response_code |
18
+ | http | http://141.5.99.69/ | text/plain | 201 |
@@ -0,0 +1,18 @@
1
+ Feature:
2
+ In order to create an OCCI Resource on the OCCI Server
3
+ As an OCCI Client
4
+ I want to get an success report of the create operation and receive the URI of the new Resource by the OCCI Server
5
+
6
+ @vcr_record
7
+ Scenario Outline: Create an OCCI Resource
8
+ Given endpoint : <endpoint>
9
+ And transfer_protocol : <protocol>
10
+ And accept type : <accept_type>
11
+ And have an initialize Client
12
+ When the Client makes a create request
13
+ Then the Client should have the response code <response_code>
14
+
15
+ @vcr_record
16
+ Scenarios:
17
+ | protocol | endpoint | accept_type | response_code |
18
+ | http | http://141.5.99.69/ | text/plain | 201 |
@@ -0,0 +1,16 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
2
+
3
+ require 'rubygems'
4
+ require 'occi-api'
5
+
6
+ require 'vcr'
7
+
8
+ VCR.configure do |c|
9
+ c.hook_into :webmock
10
+ c.cassette_library_dir = 'features/cassettes'
11
+ end
12
+
13
+ VCR.cucumber_tags do |t|
14
+ t.tags '@vcr_ignore', :record => :none
15
+ t.tag '@vcr_record', {:use_scenario_name => true, :record => :new_episodes}
16
+ end