Commit Graph

98 Commits

Author SHA1 Message Date
Alvaro Lopez Garcia c57310fc81 validator: add unit tests 2015-04-29 16:39:16 +02:00
Alvaro Lopez Garcia 1a931ab0f4 Catch exception if we got an unknown response from OpenStack
If we are getting an unexpected reponse from OpenStack we should not
fail, but render a 500 error to the client
2015-04-29 16:39:16 +02:00
Alvaro Lopez Garcia ec12099382 parsing: check for categories instead of kinds
We should check for kinds and actions when parsing and validating the
data, since POSTing an action is needed when we are triggering an action
on a resource.
2015-04-29 16:39:16 +02:00
Alvaro Lopez Garcia 2c34553176 Move the OCCI validator into its own module
It is better to separate the validator from the parsers
2015-04-29 16:39:16 +02:00
Alvaro Lopez Garcia 88c6a4f29d Stop using decorators for parse and validate
Instead of using a decorator for parsing the incoming data we can use
calls to the objects, making the code much more readable.
2015-04-29 16:39:16 +02:00
Alvaro Lopez Garcia a55edb366a catch unexpected exceptions in handler
The wsgi.ResourceExceptionHandler should catch also the unexpected
exceptions and render a 500 error to the client.
2015-04-21 14:20:05 +02:00
Alvaro Lopez Garcia 81b8eac229 readme: add a bit of information 2015-04-17 14:39:10 +02:00
Alvaro Lopez Garcia 1d80e810bb Change readme to markdown and add badges 2015-04-17 14:39:10 +02:00
Alvaro Lopez Garcia a44c086d55 Operations on paths that are not resources must end with /
According to OCCI specification, operations on paths that are not
resource instances or location paths, the path must end with "/". We
need to add the rule manually, since otherwise routes will strip out all
the slashes when generating the resources rules.
2015-04-17 14:18:42 +02:00
Alvaro Lopez Garcia b52984db6c Comply with RFC5785
According to section 3.6.7, to comply with the RFC5785 we should
implement the query interface functionality under the authrority
path "/.well-known/org/ogf/occi/-/".
2015-04-17 14:06:01 +02:00
Alvaro Lopez Garcia 2675a8c3d8 Check OCCI version in user agent
We only support OCCI/1.1, so if we have another version we have to raise
a 501 not implemented error.
2015-04-16 17:49:50 +02:00
Alvaro Lopez Garcia 86329b79f3 Advertise supported OCCI version
In section 3.6.5 it is said that a server must indicate the version that
it supports via the Server HTTP header. We have to advertise this even
when a fault is returned.
2015-04-16 14:53:39 +02:00
Enol Fernandez 5c343437bb Basic tests for the parser.
Missing the validation tests.
2015-04-14 16:46:56 +02:00
Enol Fernandez 8a336a5407 Added TextParser. 2015-04-14 16:33:08 +02:00
Enol Fernandez fa2b1c809f Improved parsers and validators
Everything is now under the same module (wsgi). Request
object includes methods for parsing a validating the
user input.
Fixed the compute method which was still using the old
body for creating the VM.
Added tests for parser.
2015-04-14 10:17:15 +02:00
Enol Fernandez 4ee3782619 Introduced support for user_data contextualization
- New parser and validator for create methods.
- Includes schemes in the mixin class to allow comparisons
- Fix scheme builder in helper (was missing # at the end)
- Update tests
2015-04-13 16:57:26 +02:00
Enol Fernandez b9de8abc9f Moved parsers to wsgi module. 2015-04-13 16:53:48 +02:00
Enol Fernandez c80b4c73db Renamed and updated OCCI exceptions. 2015-04-13 16:53:48 +02:00
Enol Fernandez c9dbfb97d7 Just a TODO message. 2015-04-13 16:53:48 +02:00
Enol Fernandez 6f0ab44985 First parser attempt. 2015-04-13 16:53:48 +02:00
Enol Fernandez 7f2aa8c0f5 Introducing contextualization tests. 2015-04-13 16:53:46 +02:00
Enol Fernandez 79d3fce5b6 Added tests for volume linked to compute. 2015-04-13 16:50:54 +02:00
Enol Fernandez c45cf7e1a9 Improved link rendering. 2015-04-13 16:49:40 +02:00
Enol Fernandez 4291c10672 Improve testing. 2015-04-13 16:49:40 +02:00
Enol Fernandez 62b6de5d4c Added Storage to query. 2015-04-13 16:49:40 +02:00
Enol Fernandez fcaab700d3 Storage controller implementation (index and show).
New occi.infrastructure.storage and associated tests.

Added StorageLinks
2015-04-13 16:49:40 +02:00
Alvaro Lopez Garcia 65edb4b8c7 Merge branch 'handle_delete_trailing_slash' into compute_controller
Conflicts:
	ooi/api/base.py
2015-04-10 14:09:58 +02:00
Alvaro Lopez Garcia 3f436d490a Merge branch 'content_types' into compute_controller 2015-04-10 14:06:33 +02:00
Alvaro Lopez Garcia 0c417288e6 Return 204 if there is no content
If after serializing the response we do not have a body or headers (for
example after a delete), we should return a 204 code.
2015-04-10 14:01:50 +02:00
Pablo Orviz bfbe5c08ec Handle trailing slash for delete all operation. 2015-04-10 13:56:15 +02:00
Alvaro Lopez Garcia f75d2d6dc2 Check for other valid return codes
200, 201 and 202 are valid return codes that will contain a JSON, so we
should check for them also.
2015-04-10 10:05:03 +02:00
Alvaro Lopez Garcia 9bacf8edea Add negative test fot compute controller
Check that we are actually raising the proper exception when there is a
bad request in the compute controller create method.
2015-04-09 18:48:19 +02:00
Alvaro Lopez Garcia 91b910e3e8 Fix typo in raised exception 2015-04-09 18:48:16 +02:00
Alvaro Lopez Garcia 59272482f6 Improve content-type handling
According to the OCCI specification, the accept header MUST be handled
as follows:

 - If Accept is empty, the returned content-type should be text/plain
 - If Accept is "*/*", the returned content-type should be text/plain
 - If Accept cannot be understood, a 406 error should be returned.

We are still missing the handling of the content-type header (that must
indicate the type of the data being sent, if any) that should be checked
against the available parsers (this is still missing).
2015-04-09 18:48:16 +02:00
Pablo Orviz cdf535a644 Action 'delete' for compute controller. 2015-04-09 16:37:30 +02:00
Alvaro Lopez Garcia 0b92038f62 Improve and fix locations and URLs
We are not taking into account the application url (i.e. the
scheme://server:port/application) when we are cheking the responses.
This change sets an application URL that we should check for each of the
expected locations. Moreover, when we were creating the OCCI kinds for
each of the objects we were using absolute locations, so change to
relative ones.
2015-04-08 16:44:51 +02:00
Alvaro Lopez Garcia 69ba66b830 Preserve original request when calling OpenStack
This change creates a new request instead of modifying the original one
when it needs to be modified so as to access OpenStack. Before we were
modifying the original request (i.e. the path, body and content_type)
and this is wrong, since we cannot access those attributes after it has
been modified.
2015-04-08 11:12:46 +02:00
Enol Fernández 8ab4be59bf Merge pull request #10 from alvarolopez/refactor_rendering
Refactor rendering
2015-04-08 10:16:20 +02:00
Alvaro Lopez Garcia 4cd9b74379 Move helper functions into more coherent locations
Put together all the util functions into one single module, whenever
possible.
2015-04-07 18:58:19 +02:00
Alvaro Lopez Garcia 1adaa68be9 Cleaner join_url helper method 2015-04-07 18:06:40 +02:00
Alvaro Lopez Garcia edac5e2383 Refactor action rendering
When an action is rendered when it is associated with an instance its
rendering is different than the action object. In the former case it
shall be rendered as a link, whereas in the latter it is rendered as a
category.
2015-04-07 17:37:45 +02:00
Alvaro Lopez Garcia f53f9744da Handle OpenStack API faults
We should start handling the OpenStack Faults, in case they exist. The
easiest way is checking if the status code belongs to one of the HTTP
error codes. If this is the case, we convert it back to a webob
exception and raise it so that it is eventually handled in our WSGI
middleware.
2015-04-07 16:35:34 +02:00
Alvaro Lopez Garcia c96b600452 Separate rendering from objects
Since the rendering of an object may vary depending on what is being
serialized (i.e. if it is only one object or a collection) it is better
to handle the serialization from outside the object.
2015-04-07 12:54:01 +02:00
Alvaro Lopez Garcia e443785026 Merge pull request #8 from alvarolopez/query
Update query controller

Add the compute controller related stuff into the query controller.
2015-03-31 10:52:34 +02:00
Enol Fernandez d599ced867 Fix tests for query interface. 2015-03-30 18:20:53 +02:00
Enol Fernandez c8e2db13dc Query update. 2015-03-30 18:20:53 +02:00
Enol Fernandez 283846b006 New OpenStack mixins. 2015-03-30 18:20:53 +02:00
Enol Fernandez 7059d31396 Start the work on the query. 2015-03-27 17:23:05 +01:00
Enol Fernández 63839d2b55 Merge pull request #7 from alvarolopez/refactor_tests
Refactor unit testing using a fake application
2015-03-20 18:33:34 +01:00
Alvaro Lopez Garcia fc9c5db92f Refactor unit testing using a fake application
Instead of constructing each of the responses in each of the tests,
start using a (poor man's) fake application that can be used by all the
controller tests.
2015-03-19 17:44:33 +01:00