Ow2 webinar erocci

Uploaded on

erocci is a new erlang frameowrk for building OCCI compliant REST APIs.

erocci is a new erlang frameowrk for building OCCI compliant REST APIs.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. © 2014 Jean Parpaillon 1
  • 3. © 2014 Jean Parpaillon CLOUD IS REST... int create_vm(char* name, int cores, int mem); def get_bucket(size) module:erase_stuff/3 GET http://example.com/bucket?size=12 PUT http://example.com/vm { "name": "myvm1", "cores": 4, "mem": 2.5 } DELETE http://example.com/stuff/id1 object oriented relational tables relational tables Resource oriented factory pattern builder iterator observer C(reate) R(ead) U(pdate) D(elete) 3
  • 4. © 2014 Jean Parpaillon ...SO IS EROCCI PUT /myresource/id1 CREATE POST /myresource/id1 UPDATE GET /myresource/id1 READ DELETE /myresource/id1 DELETE 4
  • 5. © 2014 Jean Parpaillon "YET ANOTHER REST FRAMEWORK" ? REST APIs looks similar, but are not interoperable 5
  • 6. © 2014 Jean Parpaillon OCCI IS TYPED Kind: a named list of attributes and actions e.g.: http://schemas.ogf.org/occi/infrastructure#compute Attribute: name, type (string, numeric, etc), mutability, occurrence, default value Resource: an instance of a kind, identified with a URI Action: an invocable operation applicable to a resource e.g.: http://schemas.ogf.org/occi/infrastructure/compute/action#start Kinds are inheritable Inherits attributes and actions 6
  • 7. © 2014 Jean Parpaillon OCCI IS EXTENSIBLE Mixin: a named set of additional attributes and actions e.g.: http://schemas.ogf.org/occi/infrastructure/networkinterface#ipnetworkinterface Resource can be associated with one or several mixin User Mixin: a user can create its own mixin, to tag resources e.g.: http://example.com/occi/mixins#my_group1 7
  • 8. © 2014 Jean Parpaillon OCCI IS RELATIONAL Links are resources with specific attributes: occi.core.source: resource URI occi.core.target: resource URI A collection is a list of resource URIs of the same kind/mixin GET /collections/compute/ GET /collections/os_tpl/ 8
  • 9. © 2014 Jean Parpaillon OCCI IS SELF-DESCRIBED GET /-/ (capabilities) List of supported kinds + description List of supported mixins + description List of supported actions + description Capabilities show collection's URL http://schemas.ogf.org/occi/infrsatructure#compute -> /collections/compute 9
  • 10. © 2014 Jean Parpaillon OCCI IS META-MODEL BASED Category scheme: URI term: String title: String [0..1] Kind Mixin Action Entity id: URI Resource Link Attribute name: String type: String [0..1] mutable: Boolean [0..1] required: Boolean [0..1] default: String [0..1] description: String [0..1] 0..1 * actions 1* actions * mixins * entities 1 kind * entities 1 target 1 source * links 0..1 parent * * depends * 1 * attributes * applies Model consistency checking Rendering independant text/plain, application/json, etc. Transport independant HTTP, others... Automatic model implementation 10
  • 11. © 2014 Jean Parpaillon OCCI IMPLEMENTATIONS rOCCI occi4java Frameworks DoYouSpeakOCCI : test Tools CompatibleOne pyOCNI OpenStack, OpenNebula, etc Specific implementations Models are language extensions/libs Hard to exchange models: what about interoperability ? Limits See http://occi-wg.org/community/implementations/ 11
  • 12. occi_store occi_backend supervisor occi_backend_riak backend occi_backend_mnesia backend / /path/to/resources mount create load update delete occi_hook supervisor call on_save on_load on_update on_delete on_action occi_hook_mgr hook notify occi_renderer_json occi_renderer occi_renderer_occi occi_renderer occi_renderer_xml occi_renderer parse render parse render occi_listener_http occi_listener occi_listener_xmpp occi_listener based on cowboy based on exmpp occi_category_mgr supervisorcategories description <?xml > <occi:extension> <occi:kind> ... </occi:kind> </occi:extension>load APPLICATION MODEL STANDARD OCCI API STORAGE occi_backend_XXX backend PROPRIETARY API /other/path/to/resources © 2014 Jean Parpaillon EROCCI ARCHITECTURE 12
  • 13. © 2014 Jean Parpaillon MULTIPLE REPRESENTATIONS text/plain Write your own rendering: Implements: render, parse text/occi application/json (draft) application/xml (experimental): see XSD: https://github.com/jeanparpaillon/occi-schemas 13
  • 14. / /store/db1 /store/db2 /virt occi_backend_mnesia occi_backend_riak occi_backend_odbc occi_backend_libvirt © 2014 Jean Parpaillon MULTIPLE BACKENDS Backends attached to mountpoints Backends declare a schema Storage backend: user-defined schema API adapter: backend specific schema Simple backend API Implements CRUD operations Shared kinds/mixins Collection requests run in parallel 14
  • 15. © 2014 Jean Parpaillon MULTIPLE TRANSPORTS HTTP(S) Natural REST transport cowboy web server 100% erlang (easy to port) Small, tested, scalable (distributed) XMPP Ideal for M2M, IoT Based on forked exmpp (erim) <iq/> based XML schema available Extensible Simple APIs for: - dispatching requests (occi_store) - parsing/rendering Fault tolerant: - erlang supervisor'ed 15
  • 16. © 2014 Jean Parpaillon EXTENDING EROCCI AS A REST "ORM" Choose a storage backend Load OCCI schema as XML Choose a listener Start it ! AS API ADAPTOR Write your own backend Implements CRUD operations w/ calls to your favourite API NEW TRANSPORT Share your model Just transport it differently -> No erlang needed ! -> Need to write erlang (no harm) -> Enjoy scalability, fault tolerance, transports, etc. 16
  • 17. © 2014 Jean Parpaillon ROADMAP authn/authz x509, HTTP basic etc, XMPP rosters, oauth/openid, etc. POSIX based with file-based backend ? Contributions welcome ! Testing Functional tests: migrate to Common Test Unit tests: use eunit, add tests POSIX based with file-based backend ? Optimize occi_store New storage backends Riak (started...) ODBC (SQL) etc. XMPP listener XMPP component (API proxy) Implements rosters, presence, etc 17
  • 18. © 2014 Jean Parpaillon RESOURCES Website: Source code: Continuous integration: Mailing lists: http://erocci.ow2.org http://github.com/jeanparpaillon/erocci https://travis-ci.org/jeanparpaillon/erocci erocci-dev@ow2.org erocci-info@ow2.org (ongoing work) 18
  • 19. © 2014 Jean Parpaillon THANKS 19